From d15fc8fd90468deac102a519383ab1b6b4e75b0b Mon Sep 17 00:00:00 2001 From: Logan Rasmussen Date: Thu, 19 Feb 2026 19:04:39 -0700 Subject: [PATCH 1/2] fix: schedule combo jobs when client requests products explicitly the widget is now informed when products are inferred or explicit --- src/redux/reducers/configSlice.ts | 2 +- src/utilities/JobSchedule.js | 12 ++--- src/utilities/__tests__/JobSchedule-test.js | 58 +++++++++++++++++++++ typings/connectProps.d.ts | 2 +- 4 files changed, 63 insertions(+), 11 deletions(-) diff --git a/src/redux/reducers/configSlice.ts b/src/redux/reducers/configSlice.ts index e6ed195d38..cbe4aa6f84 100644 --- a/src/redux/reducers/configSlice.ts +++ b/src/redux/reducers/configSlice.ts @@ -203,7 +203,7 @@ export const getIsLightColorScheme = createSelector( // Helpers const getProductDeterminedMode = (config: { - data_request?: { products?: string[] | null } | null + data_request?: Pick['data_request'] }) => { const products = config?.data_request?.products diff --git a/src/utilities/JobSchedule.js b/src/utilities/JobSchedule.js index 0d9f421c45..f7e54ee1bb 100644 --- a/src/utilities/JobSchedule.js +++ b/src/utilities/JobSchedule.js @@ -17,16 +17,10 @@ const shouldUseComboJobs = (config, isComboJobsEnabled) => { isComboJobsEnabled && config.data_request.products.length > 0 /** - * We know the customer is using products for their URL request if this returns true. - * The only way to have multiple products using the mode/boolean strategy is to pass in - * at least one of the existing booleans along with a mode: - * - include_identity: true - * - include_transactions: true + * We know the customer is explicitly using products in their widget URL request if inferred is false. + * This means we SHOULD USE COMBOJOBS for this session. */ - const customerOptedThemselvesIntoCombojobs = - config.data_request.products.length > 1 && - !config.include_identity && - !config.include_transactions + const customerOptedThemselvesIntoCombojobs = config.data_request.inferred === false return customerIsConfiguredToUseCombojobs || customerOptedThemselvesIntoCombojobs } diff --git a/src/utilities/__tests__/JobSchedule-test.js b/src/utilities/__tests__/JobSchedule-test.js index 24f641819e..884ac2f76b 100644 --- a/src/utilities/__tests__/JobSchedule-test.js +++ b/src/utilities/__tests__/JobSchedule-test.js @@ -99,6 +99,64 @@ describe('JobSchedule.initialize', () => { }, ]) }) + + describe('combo jobs inferred logic', () => { + const member = { is_being_aggregated: false } + const recentJob = null + const isComboJobFeatureFlagOn = false // This covers the feature flag behavior, when true it means combo jobs are expected + const baseConfig = { + data_request: { + products: ['foo'], + }, + mode: undefined, + include_identity: false, + } + + test('schedules COMBINATION job when inferred is false, and single product', () => { + const config = { + ...baseConfig, + data_request: { ...baseConfig.data_request, inferred: false }, + } + const schedule = JobSchedule.initialize(member, recentJob, config, isComboJobFeatureFlagOn) + expect(schedule.jobs[0].type).toBe(JOB_TYPES.COMBINATION) + }) + + test('schedules COMBINATION job when inferred is false and multiple products', () => { + const config = { ...baseConfig, data_request: { products: ['foo', 'bar'], inferred: false } } + const schedule = JobSchedule.initialize(member, recentJob, config, isComboJobFeatureFlagOn) + expect(schedule.jobs[0].type).toBe(JOB_TYPES.COMBINATION) + }) + + test('does not schedule COMBINATION job when inferred is true, single product', () => { + const config = { ...baseConfig, data_request: { ...baseConfig.data_request, inferred: true } } + const schedule = JobSchedule.initialize(member, recentJob, config, isComboJobFeatureFlagOn) + expect(schedule.jobs[0].type).not.toBe(JOB_TYPES.COMBINATION) + }) + + test('does not schedule COMBINATION job when inferred is true, multiple products', () => { + const config = { ...baseConfig, data_request: { products: ['foo', 'bar'], inferred: true } } + const schedule = JobSchedule.initialize(member, recentJob, config, isComboJobFeatureFlagOn) + expect(schedule.jobs[0].type).not.toBe(JOB_TYPES.COMBINATION) + }) + + test('does not schedule COMBINATION job when inferred is undefined and feature flag is off', () => { + const config = { ...baseConfig, data_request: { products: ['foo', 'bar'] } } + const schedule = JobSchedule.initialize(member, recentJob, config, isComboJobFeatureFlagOn) + expect(schedule.jobs[0].type).not.toBe(JOB_TYPES.COMBINATION) + }) + + test('does schedule COMBINATION job when inferred is undefined and feature flag is on', () => { + const config = { ...baseConfig, data_request: { products: ['foo', 'bar'] } } + const schedule = JobSchedule.initialize(member, recentJob, config, true) + expect(schedule.jobs[0].type).toBe(JOB_TYPES.COMBINATION) + }) + + test('does schedule COMBINATION job when inferred is true and feature flag is on', () => { + const config = { ...baseConfig, data_request: { products: ['foo', 'bar'], inferred: true } } + const schedule = JobSchedule.initialize(member, recentJob, config, true) + expect(schedule.jobs[0].type).toBe(JOB_TYPES.COMBINATION) + }) + }) }) describe('JobSchedule.onJobFinished', () => { diff --git a/typings/connectProps.d.ts b/typings/connectProps.d.ts index ad4a4fa6a5..65a9b06c7e 100644 --- a/typings/connectProps.d.ts +++ b/typings/connectProps.d.ts @@ -64,7 +64,7 @@ interface ClientConfigType { oauth_referral_source: string update_credentials: boolean wait_for_full_aggregation: boolean - data_request?: { products?: string[] | null } | null + data_request?: { products?: string[] | null; inferred?: boolean } | null use_cases?: UseCaseType[] | null additional_product_option?: string | null show_back_button?: boolean | null From 7174ba0f4e98f4b50495b8fa2a0d84970f0d687f Mon Sep 17 00:00:00 2001 From: Logan Rasmussen Date: Thu, 19 Feb 2026 19:46:50 -0700 Subject: [PATCH 2/2] fix: safely use the new inferred value, it may be undefined --- src/utilities/JobSchedule.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utilities/JobSchedule.js b/src/utilities/JobSchedule.js index f7e54ee1bb..37b979a623 100644 --- a/src/utilities/JobSchedule.js +++ b/src/utilities/JobSchedule.js @@ -17,10 +17,10 @@ const shouldUseComboJobs = (config, isComboJobsEnabled) => { isComboJobsEnabled && config.data_request.products.length > 0 /** - * We know the customer is explicitly using products in their widget URL request if inferred is false. - * This means we SHOULD USE COMBOJOBS for this session. + * We know the customer is explicitly using products in their widget URL request if inferred is type-equal to false. + * When the product values are not inferred, the widget SHOULD USE COMBOJOBS for this session. */ - const customerOptedThemselvesIntoCombojobs = config.data_request.inferred === false + const customerOptedThemselvesIntoCombojobs = config.data_request?.inferred === false return customerIsConfiguredToUseCombojobs || customerOptedThemselvesIntoCombojobs }