Skip to content
Open
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
18 changes: 18 additions & 0 deletions etc/firebase-admin.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,16 @@ export function remoteConfig(app?: App): remoteConfig.RemoteConfig;

// @public (undocumented)
export namespace remoteConfig {
// Warning: (ae-forgotten-export) The symbol "ExperimentParameterValue" needs to be exported by the entry point default-namespace.d.ts
export type ExperimentParameterValue = ExperimentParameterValue;
// Warning: (ae-forgotten-export) The symbol "ExperimentValue" needs to be exported by the entry point default-namespace.d.ts
export type ExperimentValue = ExperimentValue;
// Warning: (ae-forgotten-export) The symbol "ExperimentVariantExplicitValue" needs to be exported by the entry point default-namespace.d.ts
export type ExperimentVariantExplicitValue = ExperimentVariantExplicitValue;
// Warning: (ae-forgotten-export) The symbol "ExperimentVariantNoChange" needs to be exported by the entry point default-namespace.d.ts
export type ExperimentVariantNoChange = ExperimentVariantNoChange;
// Warning: (ae-forgotten-export) The symbol "ExperimentVariantValue" needs to be exported by the entry point default-namespace.d.ts
export type ExperimentVariantValue = ExperimentVariantValue;
// Warning: (ae-forgotten-export) The symbol "ExplicitParameterValue" needs to be exported by the entry point default-namespace.d.ts
export type ExplicitParameterValue = ExplicitParameterValue;
// Warning: (ae-forgotten-export) The symbol "InAppDefaultValue" needs to be exported by the entry point default-namespace.d.ts
Expand All @@ -444,6 +454,10 @@ export namespace remoteConfig {
export type ListVersionsResult = ListVersionsResult;
// Warning: (ae-forgotten-export) The symbol "ParameterValueType" needs to be exported by the entry point default-namespace.d.ts
export type ParameterValueType = ParameterValueType;
// Warning: (ae-forgotten-export) The symbol "PersonalizationParameterValue" needs to be exported by the entry point default-namespace.d.ts
export type PersonalizationParameterValue = PersonalizationParameterValue;
// Warning: (ae-forgotten-export) The symbol "PersonalizationValue" needs to be exported by the entry point default-namespace.d.ts
export type PersonalizationValue = PersonalizationValue;
// Warning: (ae-forgotten-export) The symbol "RemoteConfig" needs to be exported by the entry point default-namespace.d.ts
export type RemoteConfig = RemoteConfig;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigCondition" needs to be exported by the entry point default-namespace.d.ts
Expand All @@ -458,6 +472,10 @@ export namespace remoteConfig {
export type RemoteConfigTemplate = RemoteConfigTemplate;
// Warning: (ae-forgotten-export) The symbol "RemoteConfigUser" needs to be exported by the entry point default-namespace.d.ts
export type RemoteConfigUser = RemoteConfigUser;
// Warning: (ae-forgotten-export) The symbol "RolloutParameterValue" needs to be exported by the entry point default-namespace.d.ts
export type RolloutParameterValue = RolloutParameterValue;
// Warning: (ae-forgotten-export) The symbol "RolloutValue" needs to be exported by the entry point default-namespace.d.ts
export type RolloutValue = RolloutValue;
// Warning: (ae-forgotten-export) The symbol "TagColor" needs to be exported by the entry point default-namespace.d.ts
export type TagColor = TagColor;
// Warning: (ae-forgotten-export) The symbol "Version" needs to be exported by the entry point default-namespace.d.ts
Expand Down
26 changes: 25 additions & 1 deletion etc/firebase-admin.remote-config.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ export type DefaultConfig = {
// @public
export type EvaluationContext = UserProvidedSignals & PredefinedSignals;

// @public (undocumented)
export interface ExperimentParameterValue {
// Warning: (ae-forgotten-export) The symbol "ExperimentValue" needs to be exported by the entry point index.d.ts
//
// (undocumented)
experimentValue: ExperimentValue;
}

// @public
export interface ExplicitParameterValue {
value: string;
Expand Down Expand Up @@ -142,6 +150,14 @@ export enum PercentConditionOperator {
UNKNOWN = "UNKNOWN"
}

// @public (undocumented)
export interface PersonalizationParameterValue {
// Warning: (ae-forgotten-export) The symbol "PersonalizationValue" needs to be exported by the entry point index.d.ts
//
// (undocumented)
personalizationValue: PersonalizationValue;
}

// @public
export type PredefinedSignals = {
randomizationId?: string;
Expand Down Expand Up @@ -197,7 +213,7 @@ export interface RemoteConfigParameterGroup {
}

// @public
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue;
export type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue | RolloutParameterValue | PersonalizationParameterValue | ExperimentParameterValue;

// @public
export interface RemoteConfigTemplate {
Expand All @@ -219,6 +235,14 @@ export interface RemoteConfigUser {
name?: string;
}

// @public (undocumented)
export interface RolloutParameterValue {
// Warning: (ae-forgotten-export) The symbol "RolloutValue" needs to be exported by the entry point index.d.ts
//
// (undocumented)
rolloutValue: RolloutValue;
}

// @public
export interface ServerConfig {
getAll(): {
Expand Down
3 changes: 3 additions & 0 deletions src/remote-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export {
PredefinedSignals,
RemoteConfigCondition,
RemoteConfigParameter,
ExperimentParameterValue,
PersonalizationParameterValue,
RolloutParameterValue,
RemoteConfigParameterGroup,
RemoteConfigParameterValue,
RemoteConfigTemplate,
Expand Down
63 changes: 62 additions & 1 deletion src/remote-config/remote-config-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 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;
variantValue: 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.
Expand Down
54 changes: 54 additions & 0 deletions src/remote-config/remote-config-namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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}.
*/
Expand Down
5 changes: 4 additions & 1 deletion src/remote-config/remote-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ class ServerTemplateImpl implements ServerTemplate {
// Iterates in order over condition list. If there is a value associated
// with a condition, this checks if the condition is true.
for (const [conditionName, conditionEvaluation] of evaluatedConditions) {

if (normalizedConditionalValues[conditionName] && conditionEvaluation) {
parameterValueWrapper = normalizedConditionalValues[conditionName];
break;
Expand All @@ -395,7 +396,9 @@ class ServerTemplateImpl implements ServerTemplate {

if (parameterValueWrapper) {
const parameterValue = (parameterValueWrapper as ExplicitParameterValue).value;
configValues[key] = new ValueImpl('remote', parameterValue);
if (parameterValue !== undefined) {
configValues[key] = new ValueImpl('remote', parameterValue);
}
continue;
}

Expand Down
Loading