Skip to content

Commit

Permalink
🚩 (llm) reborn feature flag (#8398)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWerey authored Nov 20, 2024
1 parent 5ba2080 commit 724fa8b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/famous-tables-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ledgerhq/types-live": minor
"live-mobile": minor
"@ledgerhq/live-common": minor
---

Add llm Reborn II feature flag for A/B Test + analytics
14 changes: 13 additions & 1 deletion apps/ledger-live-mobile/src/analytics/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from "@react-navigation/native";
import snakeCase from "lodash/snakeCase";
import React, { MutableRefObject, useCallback } from "react";
import { FeatureId, Features, idsToLanguage } from "@ledgerhq/types-live";
import { ABTestingVariants, FeatureId, Features, idsToLanguage } from "@ledgerhq/types-live";
import {
hasNftInAccounts,
GENESIS_PASS_COLLECTION_CONTRACT,
Expand Down Expand Up @@ -107,6 +107,16 @@ const getLedgerSyncAttributes = (state: State) => {
};
};

const getRebornAttributes = () => {
if (!analyticsFeatureFlagMethod) return false;
const reborn = analyticsFeatureFlagMethod("llmRebornLP");

return {
llmRebornLP_A: reborn?.params?.variant === ABTestingVariants.variantA,
llmRebornLP_B: reborn?.params?.variant === ABTestingVariants.variantB,
};
};

const getMandatoryProperties = async (store: AppStore) => {
const state: State = store.getState();
const { user } = await getOrCreateUser();
Expand Down Expand Up @@ -186,6 +196,7 @@ const extraProperties = async (store: AppStore) => {
stakingProviders?.enabled && stakingProviders?.params?.listProvider.length;

const ledgerSyncAtributes = getLedgerSyncAttributes(state);
const rebornAttributes = getRebornAttributes();

return {
...mandatoryProperties,
Expand Down Expand Up @@ -222,6 +233,7 @@ const extraProperties = async (store: AppStore) => {
nps,
stakingProvidersEnabled: stakingProvidersCount || "flag not loaded",
...ledgerSyncAtributes,
...rebornAttributes,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ export const DEFAULT_FEATURES: Features = {
hourly: 2 * 24 * 60 * 60 * 1000,
},
},
llmRebornLP: { ...DEFAULT_FEATURE, params: { variant: ABTestingVariants.variantA } },
};

// Firebase SDK treat JSON values as strings
Expand Down
4 changes: 4 additions & 0 deletions libs/ledgerjs/packages/types-live/src/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export type Features = CurrencyFeatures & {
llMevProtection: DefaultFeature;
llmNetworkBasedAddAccountFlow: DefaultFeature;
llCounterValueGranularitiesRates: Feature_LlCounterValueGranularitiesRates;
llmRebornLP: Feature_LlmRebornLP;
};

/**
Expand Down Expand Up @@ -569,6 +570,9 @@ export type Feature_SpamFilteringTx = DefaultFeature;
export type Feature_MemoTag = DefaultFeature;
export type Feature_RecoverUpsellRedirection = DefaultFeature;

export type Feature_LlmRebornLP = Feature<{
variant: ABTestingVariants;
}>;
/**
* Utils types.
*/
Expand Down

0 comments on commit 724fa8b

Please sign in to comment.