@revenuecat/purchases-ui-js
Version:
Web components for Paywalls. Powered by RevenueCat
64 lines (63 loc) • 2.15 kB
TypeScript
import type { CustomVariableValue } from "./variables.js";
type EqualityOperator = "=" | "!=";
type ArrayOperator = "in" | "not in";
export declare const RuleKey: {
readonly SelectedPackageCondition: "selected_package_condition";
readonly IntroOfferCondition: "intro_offer_condition";
readonly PromoOfferCondition: "promo_offer_condition";
readonly VariableCondition: "variable_condition";
};
type IntroOfferCondition = {
type: "intro_offer";
};
type MultipleIntroOffersCondition = {
type: "multiple_intro_offers";
};
type SelectedCondition = {
type: "selected";
};
type HoverCondition = {
type: "hover";
};
type FocusCondition = {
type: "focus";
};
type ErrorCondition = {
type: "error";
};
type PromoOfferCondition = {
type: "promo_offer";
};
type SelectedPackageCondition = {
type: typeof RuleKey.SelectedPackageCondition;
operator: ArrayOperator;
packages: string[];
};
type IntroductoryOfferCondition = {
type: typeof RuleKey.IntroOfferCondition;
operator: EqualityOperator;
value: boolean;
};
type PromotionalOfferCondition = {
type: typeof RuleKey.PromoOfferCondition;
operator: EqualityOperator;
value: boolean;
};
type VariableCondition = {
type: typeof RuleKey.VariableCondition;
operator: EqualityOperator;
variable: string;
value: CustomVariableValue | string | number | boolean;
};
type OverrideCondition = IntroOfferCondition | MultipleIntroOffersCondition | SelectedCondition | HoverCondition | FocusCondition | ErrorCondition | PromoOfferCondition | IntroductoryOfferCondition | PromotionalOfferCondition | SelectedPackageCondition | VariableCondition;
/**
* The reserved properties of an override that should not be included in the override properties
*/
type ReservedProperty = "id" | "type" | "overrides" | "stack" | "components" | "items" | "pages" | "tabs" | "field_id" | "option_id" | "keyboard_type" | "capitalize";
type OverrideProperties<C> = Partial<Omit<C, ReservedProperty>>;
type Override<C> = {
conditions: OverrideCondition[];
properties: OverrideProperties<C>;
};
export type Overrides<C> = Override<C>[];
export {};