vwo-fme-node-sdk
Version:
VWO Node/JavaScript SDK for Feature Management and Experimentation
47 lines (46 loc) • 2.29 kB
TypeScript
/**
* Copyright 2024-2025 Wingify Software Pvt. Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CampaignModel } from '../models/campaign/CampaignModel';
import { FeatureModel } from '../models/campaign/FeatureModel';
import { SettingsModel } from '../models/settings/SettingsModel';
import { ContextModel } from '../models/user/ContextModel';
import { IStorageService } from '../services/StorageService';
/**
* Evaluates the rules for a given campaign and feature based on the provided context.
* This function checks for whitelisting and pre-segmentation conditions, and if applicable,
* sends an impression for the variation shown.
*
* @param {SettingsModel} settings - The settings configuration for the evaluation.
* @param {FeatureModel} feature - The feature being evaluated.
* @param {CampaignModel} campaign - The campaign associated with the feature.
* @param {ContextModel} context - The user context for evaluation.
* @param {Map<string, any>} evaluatedFeatureMap - A map of evaluated features.
* @param {Map<number, number>} megGroupWinnerCampaigns - A map of MEG group winner campaigns.
* @param {StorageService} storageService - The storage service for persistence.
* @param {any} decision - The decision object that will be updated based on the evaluation.
* @returns {Promise<[boolean, any]>} A promise that resolves to a tuple containing the result of the pre-segmentation
* and the whitelisted object, if any.
*/
export declare const evaluateRule: (
settings: SettingsModel,
feature: FeatureModel,
campaign: CampaignModel,
context: ContextModel,
evaluatedFeatureMap: Map<string, unknown>,
megGroupWinnerCampaigns: Map<number, any>,
storageService: IStorageService,
decision: any,
) => Promise<Record<string, any>>;