From 466b6481e54a35bcca8fc2c368ba8f900ee88be7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 06:12:39 +0000 Subject: [PATCH 1/4] feat(remote-config): support Rollout, Personalization, and Experiment values Added new Remote Config parameter value types (Rollout, Personalization, Experiment) to the SDK. Updated `RemoteConfigParameterValue` union type and added corresponding interfaces. Updated unit tests to verify the new types in Remote Config templates. --- src/remote-config/remote-config-api.ts | 63 +++++++++++++- src/remote-config/remote-config-namespace.ts | 54 ++++++++++++ test/unit/remote-config/remote-config.spec.ts | 84 +++++++++++++++++++ 3 files changed, 200 insertions(+), 1 deletion(-) diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index ed7da05496..bcf22ba0a5 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -354,12 +354,73 @@ export interface InAppDefaultValue { useInAppDefault: boolean; } +/** + * Represents a Rollout value. + */ +export interface RolloutValue { + rolloutId: string; + value: string; + percent: number; // Numeric value between 1-100 +} + +/** + * Represents a Personalization value. + */ +export interface PersonalizationValue { + personalizationId: string; +} + +/** + * Represents a specific no change variant value within an Experiment. + */ +export interface ExperimentVariantExplicitValue { + variantId: string; + value: string; + noChange?: never; +} + +/** + * Represents a no-change variant value within an Experiment. + */ +export interface ExperimentVariantNoChange { + variantId: string; + value?: never; + noChange: true; +} + +export type ExperimentVariantValue = ExperimentVariantExplicitValue | ExperimentVariantNoChange; + +/** + * Represents an Experiment value. + */ +export interface ExperimentValue { + experimentId: string; + variantValues: ExperimentVariantValue[]; +} + +export interface RolloutParameterValue { + rolloutValue: RolloutValue; +} + +export interface PersonalizationParameterValue { + personalizationValue: PersonalizationValue; +} + +export interface ExperimentParameterValue { + experimentValue: ExperimentValue; +} + /** * Type representing a Remote Config parameter value. * A `RemoteConfigParameterValue` could be either an `ExplicitParameterValue` or * an `InAppDefaultValue`. */ -export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue; +export type RemoteConfigParameterValue = + | ExplicitParameterValue + | InAppDefaultValue + | RolloutParameterValue + | PersonalizationParameterValue + | ExperimentParameterValue; /** * Interface representing a Remote Config parameter. diff --git a/src/remote-config/remote-config-namespace.ts b/src/remote-config/remote-config-namespace.ts index 159204d316..abc315b150 100644 --- a/src/remote-config/remote-config-namespace.ts +++ b/src/remote-config/remote-config-namespace.ts @@ -18,6 +18,15 @@ import { App } from '../app'; import { ExplicitParameterValue as TExplicitParameterValue, InAppDefaultValue as TInAppDefaultValue, + RolloutValue as TRolloutValue, + PersonalizationValue as TPersonalizationValue, + ExperimentVariantExplicitValue as TExperimentVariantExplicitValue, + ExperimentVariantNoChange as TExperimentVariantNoChange, + ExperimentVariantValue as TExperimentVariantValue, + ExperimentValue as TExperimentValue, + RolloutParameterValue as TRolloutParameterValue, + PersonalizationParameterValue as TPersonalizationParameterValue, + ExperimentParameterValue as TExperimentParameterValue, ListVersionsOptions as TListVersionsOptions, ListVersionsResult as TListVersionsResult, ParameterValueType as TParameterValueType, @@ -73,6 +82,51 @@ export namespace remoteConfig { */ export type InAppDefaultValue = TInAppDefaultValue; + /** + * Type alias to {@link firebase-admin.remote-config#RolloutValue}. + */ + export type RolloutValue = TRolloutValue; + + /** + * Type alias to {@link firebase-admin.remote-config#PersonalizationValue}. + */ + export type PersonalizationValue = TPersonalizationValue; + + /** + * Type alias to {@link firebase-admin.remote-config#ExperimentVariantExplicitValue}. + */ + export type ExperimentVariantExplicitValue = TExperimentVariantExplicitValue; + + /** + * Type alias to {@link firebase-admin.remote-config#ExperimentVariantNoChange}. + */ + export type ExperimentVariantNoChange = TExperimentVariantNoChange; + + /** + * Type alias to {@link firebase-admin.remote-config#ExperimentVariantValue}. + */ + export type ExperimentVariantValue = TExperimentVariantValue; + + /** + * Type alias to {@link firebase-admin.remote-config#ExperimentValue}. + */ + export type ExperimentValue = TExperimentValue; + + /** + * Type alias to {@link firebase-admin.remote-config#RolloutParameterValue}. + */ + export type RolloutParameterValue = TRolloutParameterValue; + + /** + * Type alias to {@link firebase-admin.remote-config#PersonalizationParameterValue}. + */ + export type PersonalizationParameterValue = TPersonalizationParameterValue; + + /** + * Type alias to {@link firebase-admin.remote-config#ExperimentParameterValue}. + */ + export type ExperimentParameterValue = TExperimentParameterValue; + /** * Type alias to {@link firebase-admin.remote-config#ListVersionsOptions}. */ diff --git a/test/unit/remote-config/remote-config.spec.ts b/test/unit/remote-config/remote-config.spec.ts index e7e4f84e57..5fcb70c71c 100644 --- a/test/unit/remote-config/remote-config.spec.ts +++ b/test/unit/remote-config/remote-config.spec.ts @@ -96,6 +96,48 @@ describe('RemoteConfig', () => { description: 'this is a promo', valueType: 'BOOLEAN', }, + new_ui_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + rolloutValue: { + rolloutId: 'rollout_1', + value: 'true', + percent: 50, + } + } + }, + description: 'New UI Rollout', + valueType: 'BOOLEAN', + }, + personalized_welcome_message: { + defaultValue: { value: 'Welcome!' }, + conditionalValues: { + ios: { + personalizationValue: { + personalizationId: 'personalization_1', + } + } + }, + description: 'Personalized Welcome Message', + valueType: 'STRING', + }, + experiment_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + experimentValue: { + experimentId: 'experiment_1', + variantValues: [ + { variantId: 'variant_A', value: 'true' }, + { variantId: 'variant_B', noChange: true } + ] + } + } + }, + description: 'Experiment Enabled', + valueType: 'BOOLEAN', + } }, parameterGroups: PARAMETER_GROUPS, etag: 'etag-123456789012-5', @@ -153,6 +195,48 @@ describe('RemoteConfig', () => { description: 'this is a promo', valueType: 'BOOLEAN', }, + new_ui_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + rolloutValue: { + rolloutId: 'rollout_1', + value: 'true', + percent: 50, + } + } + }, + description: 'New UI Rollout', + valueType: 'BOOLEAN', + }, + personalized_welcome_message: { + defaultValue: { value: 'Welcome!' }, + conditionalValues: { + ios: { + personalizationValue: { + personalizationId: 'personalization_1', + } + } + }, + description: 'Personalized Welcome Message', + valueType: 'STRING', + }, + experiment_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + experimentValue: { + experimentId: 'experiment_1', + variantValues: [ + { variantId: 'variant_A', value: 'true' }, + { variantId: 'variant_B', noChange: true } + ] + } + } + }, + description: 'Experiment Enabled', + valueType: 'BOOLEAN', + } }, parameterGroups: PARAMETER_GROUPS, etag: 'etag-123456789012-6', From af761b8c591b05ac4aebc8ded7a47b11cf5111ed Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 07:14:39 +0000 Subject: [PATCH 2/4] feat(remote-config): support Rollout, Personalization, and Experiment values Added new Remote Config parameter value types (Rollout, Personalization, Experiment) to the SDK. Updated `RemoteConfigParameterValue` union type and added corresponding interfaces. Updated unit tests to verify the new types in Remote Config templates. Reverted unnecessary changes to test response objects. --- src/remote-config/remote-config-api.ts | 2 +- test/unit/remote-config/remote-config.spec.ts | 42 ------------------- 2 files changed, 1 insertion(+), 43 deletions(-) diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index bcf22ba0a5..c46d913066 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -371,7 +371,7 @@ export interface PersonalizationValue { } /** - * Represents a specific no change variant value within an Experiment. + * Represents a specific variant value within an Experiment. */ export interface ExperimentVariantExplicitValue { variantId: string; diff --git a/test/unit/remote-config/remote-config.spec.ts b/test/unit/remote-config/remote-config.spec.ts index 5fcb70c71c..c677bd0fa3 100644 --- a/test/unit/remote-config/remote-config.spec.ts +++ b/test/unit/remote-config/remote-config.spec.ts @@ -96,48 +96,6 @@ describe('RemoteConfig', () => { description: 'this is a promo', valueType: 'BOOLEAN', }, - new_ui_enabled: { - defaultValue: { value: 'false' }, - conditionalValues: { - ios: { - rolloutValue: { - rolloutId: 'rollout_1', - value: 'true', - percent: 50, - } - } - }, - description: 'New UI Rollout', - valueType: 'BOOLEAN', - }, - personalized_welcome_message: { - defaultValue: { value: 'Welcome!' }, - conditionalValues: { - ios: { - personalizationValue: { - personalizationId: 'personalization_1', - } - } - }, - description: 'Personalized Welcome Message', - valueType: 'STRING', - }, - experiment_enabled: { - defaultValue: { value: 'false' }, - conditionalValues: { - ios: { - experimentValue: { - experimentId: 'experiment_1', - variantValues: [ - { variantId: 'variant_A', value: 'true' }, - { variantId: 'variant_B', noChange: true } - ] - } - } - }, - description: 'Experiment Enabled', - valueType: 'BOOLEAN', - } }, parameterGroups: PARAMETER_GROUPS, etag: 'etag-123456789012-5', From d51fe026573bd584b1a564bcf447e5a88c616d20 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 07:19:54 +0000 Subject: [PATCH 3/4] feat(remote-config): support Rollout, Personalization, and Experiment values Added new Remote Config parameter value types (Rollout, Personalization, Experiment) to the SDK. Updated `RemoteConfigParameterValue` union type and added corresponding interfaces. Updated unit tests to verify the new types in Remote Config templates. Correctly updated `REMOTE_CONFIG_RESPONSE` in tests to include new types, while keeping `SERVER_REMOTE_CONFIG_RESPONSE` unchanged. --- test/unit/remote-config/remote-config.spec.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/unit/remote-config/remote-config.spec.ts b/test/unit/remote-config/remote-config.spec.ts index c677bd0fa3..5fcb70c71c 100644 --- a/test/unit/remote-config/remote-config.spec.ts +++ b/test/unit/remote-config/remote-config.spec.ts @@ -96,6 +96,48 @@ describe('RemoteConfig', () => { description: 'this is a promo', valueType: 'BOOLEAN', }, + new_ui_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + rolloutValue: { + rolloutId: 'rollout_1', + value: 'true', + percent: 50, + } + } + }, + description: 'New UI Rollout', + valueType: 'BOOLEAN', + }, + personalized_welcome_message: { + defaultValue: { value: 'Welcome!' }, + conditionalValues: { + ios: { + personalizationValue: { + personalizationId: 'personalization_1', + } + } + }, + description: 'Personalized Welcome Message', + valueType: 'STRING', + }, + experiment_enabled: { + defaultValue: { value: 'false' }, + conditionalValues: { + ios: { + experimentValue: { + experimentId: 'experiment_1', + variantValues: [ + { variantId: 'variant_A', value: 'true' }, + { variantId: 'variant_B', noChange: true } + ] + } + } + }, + description: 'Experiment Enabled', + valueType: 'BOOLEAN', + } }, parameterGroups: PARAMETER_GROUPS, etag: 'etag-123456789012-5', From d71dce2577606219b09915b4f33aff624a8ee406 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 07:40:43 +0000 Subject: [PATCH 4/4] feat(remote-config): support Rollout, Personalization, and Experiment values Added new Remote Config parameter value types (Rollout, Personalization, Experiment) to the SDK. Updated `RemoteConfigParameterValue` union type and added corresponding interfaces. Updated unit tests to verify the new types in Remote Config templates. Correctly updated `REMOTE_CONFIG_RESPONSE` in tests to include new types, while keeping `SERVER_REMOTE_CONFIG_RESPONSE` unchanged. Renamed `variantValues` to `variantValue` in `ExperimentValue` interface to match API specification. --- src/remote-config/remote-config-api.ts | 2 +- test/unit/remote-config/remote-config.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index c46d913066..e34a7d8317 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -395,7 +395,7 @@ export type ExperimentVariantValue = ExperimentVariantExplicitValue | Experiment */ export interface ExperimentValue { experimentId: string; - variantValues: ExperimentVariantValue[]; + variantValue: ExperimentVariantValue[]; } export interface RolloutParameterValue { diff --git a/test/unit/remote-config/remote-config.spec.ts b/test/unit/remote-config/remote-config.spec.ts index 5fcb70c71c..f7a2bcdbc5 100644 --- a/test/unit/remote-config/remote-config.spec.ts +++ b/test/unit/remote-config/remote-config.spec.ts @@ -128,7 +128,7 @@ describe('RemoteConfig', () => { ios: { experimentValue: { experimentId: 'experiment_1', - variantValues: [ + variantValue: [ { variantId: 'variant_A', value: 'true' }, { variantId: 'variant_B', noChange: true } ] @@ -227,7 +227,7 @@ describe('RemoteConfig', () => { ios: { experimentValue: { experimentId: 'experiment_1', - variantValues: [ + variantValue: [ { variantId: 'variant_A', value: 'true' }, { variantId: 'variant_B', noChange: true } ]