Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚩 (llm) reborn feature flag #8398

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
themooneer marked this conversation as resolved.
Show resolved Hide resolved
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
Loading