diff --git a/etc/firebase-admin.remote-config.api.md b/etc/firebase-admin.remote-config.api.md index 1a19d1bb6c..675fdf54a3 100644 --- a/etc/firebase-admin.remote-config.api.md +++ b/etc/firebase-admin.remote-config.api.md @@ -55,6 +55,7 @@ export interface ExperimentParameterValue { // @public export interface ExperimentValue { experimentId: string; + exposurePercent?: number; variantValue: ExperimentVariantValue[]; } diff --git a/src/remote-config/remote-config-api.ts b/src/remote-config/remote-config-api.ts index 6566fe231e..0f2648d797 100644 --- a/src/remote-config/remote-config-api.ts +++ b/src/remote-config/remote-config-api.ts @@ -451,6 +451,12 @@ export interface ExperimentValue { * served by the Experiment. */ variantValue: ExperimentVariantValue[]; + + /** + * The percentage of users included in the Experiment, represented as a number + * between 0 and 100. + */ + exposurePercent?: number; } /** diff --git a/test/unit/remote-config/remote-config.spec.ts b/test/unit/remote-config/remote-config.spec.ts index 74d277290e..a4c04119cc 100644 --- a/test/unit/remote-config/remote-config.spec.ts +++ b/test/unit/remote-config/remote-config.spec.ts @@ -134,7 +134,8 @@ describe('RemoteConfig', () => { variantValue: [ { variantId: 'variant_A', value: 'true' }, { variantId: 'variant_B', noChange: true } - ] + ], + exposurePercent: 25, } } }, @@ -233,7 +234,8 @@ describe('RemoteConfig', () => { variantValue: [ { variantId: 'variant_A', value: 'true' }, { variantId: 'variant_B', noChange: true } - ] + ], + exposurePercent: 25, } } }, @@ -652,6 +654,7 @@ describe('RemoteConfig', () => { expect(p4.conditionalValues).to.not.be.undefined; const experimentParam = p4.conditionalValues!['ios'] as ExperimentParameterValue; expect(experimentParam.experimentValue.experimentId).to.equal('experiment_1'); + expect(experimentParam.experimentValue.exposurePercent).to.equal(25); expect(experimentParam.experimentValue.variantValue.length).to.equal(2); expect(experimentParam.experimentValue.variantValue[0]).to.deep.equal({ variantId: 'variant_A', value: 'true' }); expect(experimentParam.experimentValue.variantValue[1]).to.deep.equal({ variantId: 'variant_B', noChange: true });