Skip to content

Commit

Permalink
chore: add growthbook toggle key (#13053)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-deriv authored Jan 22, 2024
1 parent 450ddfb commit 7a7322e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/core/build/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const plugins = ({ base, is_test_env }) => {
'process.env.RUDDERSTACK_KEY': JSON.stringify(process.env.RUDDERSTACK_KEY),
'process.env.GROWTHBOOK_CLIENT_KEY': JSON.stringify(process.env.GROWTHBOOK_CLIENT_KEY),
'process.env.GROWTHBOOK_DECRYPTION_KEY': JSON.stringify(process.env.GROWTHBOOK_DECRYPTION_KEY),
'process.env.IS_GROWTHBOOK_ENABLED': JSON.stringify(process.env.IS_GROWTHBOOK_ENABLED),
}),
new CleanWebpackPlugin(),
new CopyPlugin(copyConfig(base)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,18 @@ const AccountSignup = ({
});
// need to modify data from ab testing platform to reach translation and tracking needs
const fetchQuestionnarieData = () => {
let ab_value = Analytics.getFeatureValue('questionnaire-config', 'inactive');
let ab_value = Analytics.getFeatureValue('questionnaire-config', 'inactive') || 'inactive';
const default_ab_value = ab_value;
ab_value = ab_value?.[language] ?? ab_value?.EN ?? ab_value;
if (ab_value?.show_answers_in_random_order) {
ab_value = [
{ ...default_ab_value.default },
{ ...default_ab_value?.default },
{
...ab_value,
answers: shuffleArray(ab_value.answers),
answers: shuffleArray(ab_value?.answers),
},
];
} else if (ab_value !== 'inactive') ab_value = [{ ...default_ab_value.default }, { ...ab_value }];
} else if (ab_value !== 'inactive') ab_value = [{ ...default_ab_value?.default }, { ...ab_value }];
return ab_value;
};
setABQuestionnaire(fetchQuestionnarieData());
Expand Down
12 changes: 8 additions & 4 deletions packages/core/src/App/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ const AppWithoutTranslation = ({ root_store }) => {

initializeTranslations();
if (process.env.RUDDERSTACK_KEY) {
Analytics.initialise({
growthbookKey: process.env.GROWTHBOOK_CLIENT_KEY,
growthbookDecryptionKey: process.env.GROWTHBOOK_DECRYPTION_KEY,
const config = {
growthbookKey:
process.env.IS_GROWTHBOOK_ENABLED === 'true' ? process.env.GROWTHBOOK_CLIENT_KEY : undefined,
growthbookDecryptionKey:
process.env.IS_GROWTHBOOK_ENABLED === 'true' ? process.env.GROWTHBOOK_DECRYPTION_KEY : undefined,
rudderstackKey: process.env.RUDDERSTACK_KEY,
});
};

Analytics.initialise(config);
}

// TODO: [translation-to-shared]: add translation implemnentation in shared
Expand Down

1 comment on commit 7a7322e

@vercel
Copy link

@vercel vercel bot commented on 7a7322e Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app-git-master.binary.sx
binary.sx
deriv-app.binary.sx

Please sign in to comment.