diff --git a/src/components/MessageForm/index.jsx b/src/components/MessageForm/index.jsx index b1ec12c6..566f5113 100644 --- a/src/components/MessageForm/index.jsx +++ b/src/components/MessageForm/index.jsx @@ -21,8 +21,8 @@ const MessageForm = ({ courseId, shouldAutofocus, unitId }) => { const { userId } = getAuthenticatedUser(); const [decision] = useDecision(OPTIMIZELY_PROMPT_EXPERIMENT_KEY, { autoUpdate: true }, { id: userId.toString() }); - const { active, variationKey } = decision || {}; - const promptExperimentVariationKey = active ? variationKey : undefined; + const { enabled, variationKey } = decision || {}; + const promptExperimentVariationKey = enabled ? variationKey : undefined; useEffect(() => { if (inputRef.current && !apiError && !apiIsLoading && shouldAutofocus) { diff --git a/src/components/MessageForm/index.test.jsx b/src/components/MessageForm/index.test.jsx index 61929f3f..0e9a83f2 100644 --- a/src/components/MessageForm/index.test.jsx +++ b/src/components/MessageForm/index.test.jsx @@ -158,7 +158,7 @@ describe('', () => { describe('prmpt experiment', () => { beforeEach(() => { useDecision.mockReturnValue([{ - active: true, + enabled: true, variationKey: OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT, }]); }); diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index f888156a..b3358176 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -37,8 +37,8 @@ const Sidebar = ({ const { userId } = getAuthenticatedUser(); const [decision] = useDecision(OPTIMIZELY_PROMPT_EXPERIMENT_KEY, { autoUpdate: true }, { id: userId.toString() }); - const { active: activeExperiment, variationKey } = decision || {}; - const experimentPayload = activeExperiment ? { + const { enabled: enabledExperiment, variationKey } = decision || {}; + const experimentPayload = enabledExperiment ? { experiment_name: OPTIMIZELY_PROMPT_EXPERIMENT_KEY, variation_key: variationKey, } : {}; @@ -81,7 +81,7 @@ const Sidebar = ({ setIsOpen(false); if (messageList.length >= 2) { - if (activeExperiment && variationKey === OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT) { + if (enabledExperiment && variationKey === OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT) { showVariationSurvey(); } else { showControlSurvey(); diff --git a/src/components/Sidebar/index.test.jsx b/src/components/Sidebar/index.test.jsx index 95933f5c..db56b160 100644 --- a/src/components/Sidebar/index.test.jsx +++ b/src/components/Sidebar/index.test.jsx @@ -123,9 +123,9 @@ describe('', () => { }], }; - it('should call showVariationSurvey if experiment is active', () => { + it('should call showVariationSurvey if experiment is enabled', () => { useDecision.mockReturnValue([{ - active: true, + enabled: true, variationKey: OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT, }]); @@ -139,7 +139,7 @@ describe('', () => { expect(showControlSurvey).not.toHaveBeenCalled(); }); - it('should call showControlSurvey if experiment is not active', () => { + it('should call showControlSurvey if experiment disabled', () => { render(undefined, { ...defaultState, experiments: {}, @@ -155,7 +155,7 @@ describe('', () => { it('should dispatch clearMessages() and call sendTrackEvent() with the expected props on clear', () => { useDecision.mockReturnValue([{ - active: true, + enabled: true, variationKey: OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT, }]); diff --git a/src/components/ToggleXpertButton/index.jsx b/src/components/ToggleXpertButton/index.jsx index d165af1e..750d2234 100644 --- a/src/components/ToggleXpertButton/index.jsx +++ b/src/components/ToggleXpertButton/index.jsx @@ -28,8 +28,8 @@ const ToggleXpert = ({ const { userId } = getAuthenticatedUser(); const [decision] = useDecision(OPTIMIZELY_PROMPT_EXPERIMENT_KEY, { autoUpdate: true }, { id: userId.toString() }); - const { active, variationKey } = decision || {}; - const experimentPayload = active ? { + const { enabled, variationKey } = decision || {}; + const experimentPayload = enabled ? { experiment_name: OPTIMIZELY_PROMPT_EXPERIMENT_KEY, variation_key: variationKey, } : {}; diff --git a/src/components/ToggleXpertButton/index.test.jsx b/src/components/ToggleXpertButton/index.test.jsx index d3e3d515..6f4e89d3 100644 --- a/src/components/ToggleXpertButton/index.test.jsx +++ b/src/components/ToggleXpertButton/index.test.jsx @@ -121,7 +121,7 @@ describe('', () => { describe('prompt experiment', () => { beforeEach(() => { useDecision.mockReturnValue([{ - active: true, + enabled: true, variationKey: OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT, }]); }); diff --git a/src/widgets/Xpert.test.jsx b/src/widgets/Xpert.test.jsx index 1fe46460..2e677f92 100644 --- a/src/widgets/Xpert.test.jsx +++ b/src/widgets/Xpert.test.jsx @@ -416,7 +416,7 @@ test('survey monkey variation survey should appear if user is in experiment', as const user = userEvent.setup(); useDecision.mockReturnValue([{ - active: true, + enabled: true, variationKey: OPTIMIZELY_PROMPT_EXPERIMENT_VARIATION_KEYS.UPDATED_PROMPT, }]);