summaryrefslogtreecommitdiff
path: root/src/utils/features/runtime.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/features/runtime.ts')
-rw-r--r--src/utils/features/runtime.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/utils/features/runtime.ts b/src/utils/features/runtime.ts
new file mode 100644
index 0000000..ebb83ad
--- /dev/null
+++ b/src/utils/features/runtime.ts
@@ -0,0 +1,44 @@
+import {
+ buildFeatureConfig,
+ buildRuntimeFeatureKitConfig,
+ ENVIRONMENT,
+ loadFeatureKit,
+ type OnyxFeatures,
+} from '@amp/web-apps-featurekit';
+import type { LoggerFactory } from '@amp/web-apps-logger';
+import { BUILD } from '~/config/build';
+
+export async function setupRuntimeFeatures(
+ logger: LoggerFactory,
+): Promise<OnyxFeatures | void> {
+ // load featureKit only for internal builds
+ if (import.meta.env.APP_SCOPE === 'internal' || import.meta.env.DEV) {
+ const features = await import('./consts');
+
+ // Build FeatureKit Config with overrides
+ const config = buildRuntimeFeatureKitConfig(features, {
+ [features.__FF_SHOW_RADAR]: buildFeatureConfig({
+ [ENVIRONMENT.DEV]: true,
+ }),
+ [features.__FF_ARYA]: {
+ ...buildFeatureConfig({ [ENVIRONMENT.DEV]: false }),
+ itfe: ['y9ttlj15'],
+ },
+ });
+ // Load runtime featureKit
+ return loadFeatureKit(
+ 'com.apple.apps',
+ ENVIRONMENT.DEV,
+ config,
+ logger,
+ {
+ enableToolbar: true,
+ radarConfig: {
+ component: 'ASE Web',
+ app: 'App Store',
+ build: BUILD,
+ },
+ },
+ );
+ }
+}