/*** * * SaaSquatch Type Definitions * * This file was automatically generated. DO NOT edit it by hand, instead edit the related JSON Schema file. * * Generated on 2026-03-20T21:11:42.771Z * ***/ /*** * ProgramRequest.schema.json * Generated on 2026-03-20T21:11:43.241Z * This file was automatically generated. DO NOT edit it by hand, instead edit the related JSON Schema file. ***/ /** * The requests that will be sent from the backend to the program */ export type ProgramRequest = ((ProgramTrigger | ProgramValidation | ProgramIntrospection | ProgramTriggerVariablesSchemaRequest) & { messageType?: MessageType version?: RPCVersion [k: string]: unknown }) /** * The requirement key we're validating */ export type RequirementKey = string /** * The validations we're asking the program to perform for a given set of requirement keys and associated query results */ export type ValidationRequests = { key?: RequirementKey queryResult?: QueryResult }[] /** * The unique contentful ID associated with this program template */ export type ID = string /** * A human-readable name for the program. Dispayed in the SaaSquatch Portal during Program setup. */ export type ProgramName = string /** * A human-readable summary of the program. Dispayed in the SaaSquatch Portal during Program setup. */ export type ProgramSummary = string /** * A long-form article that sells the benefits of this program. Dispayed in the SaaSquatch Portal during Program setup. */ export type ProgramLongDescription = string /** * This describes how to setup the current program and may update depending on how you've configured your program rules */ export type ProgramInstallGuide = string /** * A unique key to identify this reward type. Only numbers and latin characers are allowed. Reward types must be unique within the scope of a program. e.g. `FirstPurchaseReward` */ export type Key = string /** * A human-readable name for the reward type that gets displayed in the SaaSquatch portal during program setup. e.g. `First Purchase Reward` */ export type Name = string /** * A human-readable description that explains this reward type. Displayed in the SaaSquatch portal during program setup. e.g. `This reward is given to people when they make their first purchase.` */ export type Description = string /** * A list of reward units this reward can potentially have */ export type Units = string[] /** * A list of all the possible types of rewards this program will give. Your business logic will trigger these based on key */ export type Rewards = RewardType[] /** * A unique key to identify this email type. Only numbers and latin characers are allowed. Email types must be unique within the scope of a program. e.g. `RewardCreatedEmail` */ export type Key1 = string /** * A human-readable name for the email type that gets displayed in the SaaSquatch portal during program setup. e.g. `Reward Created Email` */ export type Name1 = string /** * A human-readable description that explains this email type. Displayed in the SaaSquatch portal during program setup. e.g. `This email is sent when a new reward is created by this program` */ export type Description1 = string export type DefaultTemplateId = string export type FromName = string export type FromAddress = string export type Subject = string export type HeaderImage = string export type Header = string /** * Supports markdown and handlebars expressions. e.g. *bold* _underline_ and [link](https://example.com) */ export type Body = string export type DisplayCTAButton = boolean export type Text = string export type Link = string export type Footer = string export type FromName1 = string export type FromAddress1 = string export type Subject1 = string export type BCC = string[] /** * Raw HTML content that can use {{mergeTags}} from handlebars */ export type HTMLContent = string /** * A list of all the possible types of emails this program will send. Your business logic will trigger these based on key */ export type Emails = EmailType[] /** * The URL for the logo associated with this program */ export type LogoURL = string /** * A list of all the possible types of widgets this program will send. Your business logic will trigger these based on key */ export type Widgets = EmailType1[] /** * Indicates whether this program can be installed by any tenant that support GA */ export type GloballyInstallable = boolean /** * The tenants that can install this program if it's not globally installable */ export type InstallableByTenants = (TenantAlias[] | null) /** * The tenant alias for a tenant that can install this program */ export type TenantAlias = string export type Sharing = (({ enabled?: SharingEnabled linksConfig?: LinksConfiguration [k: string]: unknown } | (null & { enabled?: SharingEnabled linksConfig?: LinksConfiguration [k: string]: unknown })) & { enabled?: SharingEnabled linksConfig?: LinksConfiguration [k: string]: unknown }) /** * When sharing is enabled the program will create/support referral share links */ export type SharingEnabled = boolean /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "openGraph". */ export type ShareLinkOpenGraph = (({ source: "HOSTED" title: Title description: Description2 image?: Image } | { source: "LANDING_PAGE" }) & { source?: ("HOSTED" | "LANDING_PAGE") [k: string]: unknown }) export type Title = string export type Description2 = string export type Image = string /** * @minItems 7 * @maxItems 7 */ export type ShareMessages = [Twitter, Email2, Linkedin, Sms, Whatsapp, Linemessenger, Pinterest] export type XShareBody = string export type EmailShareSubject = string export type EmailShareBody = string export type LinkedInShareSubject = string export type LinkedInShareBody = string export type LinkedInURLImage = string export type SMSShareBody = string export type WhatsAppShareBody = string export type LineMessengerShareBody = string export type PinterestImageURL = string export type PinterestShareBody = string export type RecurringSchedule = (({ userFilter?: UserFilter /** * Your program logic will be run on this schedule. */ periodInHours?: number [k: string]: unknown } | (null & { userFilter?: UserFilter /** * Your program logic will be run on this schedule. */ periodInHours?: number [k: string]: unknown })) & { userFilter?: UserFilter /** * Your program logic will be run on this schedule. */ periodInHours?: number [k: string]: unknown }) /** * The backend schedules that will run at a specified interval and trigger the program for specified users */ export type ProgramSchedules = ({ type?: ScheduleType key?: ScheduleKey periodInHours?: PeriodInHours filter?: Filter query?: Query [k: string]: unknown }[] | null) /** * The type of schedule to run */ export type ScheduleType = ("USER" | "REWARD") /** * A unique identifier for this specific schedule */ export type ScheduleKey = string /** * The interval by which this schedule will run (e.g. every x hours) */ export type PeriodInHours = number /** * The query used to create the program context when a user is evaluated by the schedule */ export type Query = string /** * All of these conditions should be satisfied to confirm the program is working */ export type ProgramRequirements = (ProgramRequirement[] | null) /** * A unique identifier used to validate this requirement */ export type Key2 = string /** * The human-friendly name of this requirement */ export type Name2 = string /** * A description of how this requirement can be satisfied */ export type Description3 = string /** * Rich content regarding the implementation and other details relevant to this requirement */ export type LongDescription = string /** * The results of this query will be used to validate this requirement has been satisfied */ export type GraphQLQuery = (string | null) /** * These are passed in as parameters to the query */ export type GraphQLQueryVariables = ({ [k: string]: unknown } | null) /** * User metrics establish how aggregate functions can be used to update a custom user field with respect to an event. */ export type UserMetric = (({ aggregateId?: "SUM" aggregateRules?: SingleFieldWithWindowingAggregate [k: string]: unknown } | { aggregateId?: "COUNT" aggregateRules?: WindowingAggregate [k: string]: unknown } | { aggregateId?: "FIRST_SEEN" [k: string]: unknown } | { aggregateId?: "LAST_SEEN" [k: string]: unknown } | { aggregateId?: "FIRST_VALUE" aggregateRules?: SingleFieldAggregate [k: string]: unknown } | { aggregateId?: "LAST_VALUE" aggregateRules?: SingleFieldAggregate [k: string]: unknown } | { aggregateId?: "THROTTLED_LAST_NUMERIC_VALUE" aggregateRules?: { fieldName: FieldName diff?: ThrottleInterval } [k: string]: unknown }) & { customFieldKey: CustomField aggregateId: AggregateIdentifier dateTriggeredWindow?: DateTriggeredWindow userEventKey: UserEventKey filter?: Filter1 [k: string]: unknown }) /** * The field on which this aggregate will be performed. * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "fieldName". */ export type FieldName = string /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "windowing". */ export type Windowing = (({ type: "FIXED" unit: ("DAY" | "WEEK" | "MONTH" | "YEAR") [k: string]: unknown } | { type: "SLIDING" duration: number unit: ("DAY" | "WEEK" | "MONTH" | "YEAR") maxBucketValue?: number [k: string]: unknown }) & { type: ("FIXED" | "SLIDING") [k: string]: unknown }) /** * The minimum interval time that can elapse between recording the value of field name. Default is milliseconds per hour. */ export type ThrottleInterval = string /** * The name of the custom field associated with this metric. */ export type CustomField = string /** * An unique identifier for the aggregate operation to perform. */ export type AggregateIdentifier = ("SUM" | "COUNT" | "FIRST_SEEN" | "LAST_SEEN" | "FIRST_VALUE" | "LAST_VALUE" | "THROTTLED_LAST_NUMERIC_VALUE") /** * An ISO 8601 interval. The aggregate operation will only be performed between this window. */ export type DateTriggeredWindow = string /** * The event that will be aggregated by this metric. */ export type UserEventKey = string /** * A JSONata expression which will filter out non-matching events */ export type Filter1 = string /** * Custom metrics defined by this program that will only be activated when the program is live */ export type ProgramUserMetrics = UserMetric[] /** * The URL that will be requested for this program when triggered */ export type WebtaskURL = string /** * When an event with this key is received this program will be triggered. Deprecated in favour of userEventKeys. */ export type EventKey = string /** * A list of events that can trigger this program */ export type EventKeys = EventKey[] /** * When an event with this key is received this program will be triggered */ export type UserEventKey1 = string /** * A list of events that can trigger this program */ export type UserEventKeys = UserEventKey1[] /** * When a custom field with this key is received this program may perform mutations */ export type CustomFieldKey = string /** * A list of custom field keys that this program evaluates on */ export type CustomFieldKeys = CustomFieldKey[] /** * A JSONata script that transforms program rules JSON to be compatible with the most recently published schema version */ export type RulesMigrationScript = string /** * The program goal ID */ export type GoalID = string /** * The human readable name */ export type Name3 = string /** * Template of program goals provided by this program */ export type Goals = { goalId: GoalID name?: Name3 }[] /** * A unique key to identify this widget type. Only numbers and latin characers are allowed. Widget types must be unique within the scope of a program. e.g. `ReferrerWidget` */ export type Key3 = string /** * A human-readable name for the widget type that gets displayed in the SaaSquatch portal during program setup. e.g. `Referrer Widget` */ export type Name4 = string /** * A human-readable description that explains this widget type. Displayed in the SaaSquatch portal during program setup. e.g. `This widget is sent when a new reward is created by this program` */ export type Description4 = string /** * Raw HTML content that can use web components. */ export type HTMLTemplate = string /** * Whether this widget should automatically popup on page load */ export type AutoPopup = boolean /** * The unique program ID */ export type ProgramID = string export type PredefiendReward = (({ rewardType?: "PCT_DISCOUNT" amount: DiscountPercent validityDuration?: DurationRewardIsValid pendingDuration?: DurationRewardIsPending [k: string]: unknown } | { rewardType?: "CREDIT" amount: CreditAmount unit: Unit validityDuration?: DurationRewardIsValid pendingDuration?: DurationRewardIsPending [k: string]: unknown } | (({ fuelTankType?: "PCT_DISCOUNT" amount: DiscountPercent1 validityDuration?: DurationRewardIsValid pendingDuration?: DurationRewardIsPending [k: string]: unknown } | { fuelTankType?: "CREDIT" amount: CreditAmount1 unit: Unit1 [k: string]: unknown }) & { rewardType?: "FUELTANK" fuelTankType: RewardType2 validityDuration?: DurationRewardIsValid pendingDuration?: DurationRewardIsPending [k: string]: unknown }) | { rewardType?: "INTEGRATION" amount: RewardAmount unit?: GiftCardType integrationId?: IntegrationIdentifier integrationSettings?: IntegrationSettings pendingDuration?: DurationRewardIsPending [k: string]: unknown }) & { rewardType: ("PCT_DISCOUNT" | "CREDIT" | "FUELTANK" | "INTEGRATION") key?: RewardKey [k: string]: unknown }) export type DiscountPercent = number /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "validityDuration". */ export type DurationRewardIsValid = string /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "pendingDuration". */ export type DurationRewardIsPending = string export type CreditAmount = number export type Unit = string export type DiscountPercent1 = number export type CreditAmount1 = number export type Unit1 = string export type RewardType2 = ("PCT_DISCOUNT" | "CREDIT") export type RewardAmount = number export type GiftCardType = string export type IntegrationIdentifier = string export type EmailTemplateID = string export type RewardKey = string /** * Rewards associated with this program */ export type ProgramRewards = PreDefinedRewardsSchema[] /** * A request for the programs trigger variables schema in case it is custom * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "programTriggerVariablesSchemaRequest". */ export type ProgramTriggerVariablesSchemaRequest = (ProgramTriggerVariablesSchemaRequest1 & ProgramTriggerVariablesSchemaRequest2) export type ProgramTriggerVariablesSchemaRequest1 = ({ triggerType?: "SCHEDULED" scheduleKey?: ScheduleKey1 [k: string]: unknown } | { triggerType?: TriggerType scheduleKey?: ScheduleKey2 [k: string]: unknown }) /** * Will match on the user schedule variables schema we're requesting */ export type ScheduleKey1 = string export type TriggerType = "REWARD_SCHEDULED" /** * Will match on the reward schedule variables schema we're requesting */ export type ScheduleKey2 = string /** * The type of request being made to the program */ export type MessageType = ("PROGRAM_TRIGGER" | "PROGRAM_VALIDATION" | "PROGRAM_INTROSPECTION" | "PROGRAM_TRIGGER_VARIABLES_SCHEMA_REQUEST") /** * The RPC version for this program request */ export type RPCVersion = string /** * A request for the program to evaluate a user for against its criteria (determines whether to reward/email/etc. the user) * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "programTrigger". */ export interface ProgramTrigger { messageType?: "PROGRAM_TRIGGER" [k: string]: unknown } /** * A request for the program to validate requirement query results * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "programValidation". */ export interface ProgramValidation { messageType?: "PROGRAM_VALIDATION" validationRequests?: ValidationRequests [k: string]: unknown } /** * The requests from running the query associated with this requirement key */ export interface QueryResult { [k: string]: unknown } /** * A request for the program to alter its template according to the provided program rules * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "programIntrospection". */ export interface ProgramIntrospection { messageType?: "PROGRAM_INTROSPECTION" template?: ProgramTemplateBuilder rules?: ProgramRulesDeprecated program?: Program [k: string]: unknown } /** * Build your program using the magic of magic! */ export interface ProgramTemplateBuilder { id?: ID name?: ProgramName summary?: ProgramSummary longDescription?: ProgramLongDescription installGuide?: ProgramInstallGuide rewards?: Rewards emails?: Emails logo?: LogoURL widgets?: Widgets globallyInstallable?: GloballyInstallable installableByTenants?: InstallableByTenants rules?: BusinessRuleVariables sharing?: Sharing schedule?: RecurringSchedule schedules?: ProgramSchedules settings?: { referrals?: { /** * Whether this program supports referrals */ enabled?: boolean [k: string]: unknown } [k: string]: unknown } rulesUISchema?: RulesUISchema requirements?: ProgramRequirements userMetrics?: ProgramUserMetrics url?: WebtaskURL trigger?: ProgramTriggers rulesMigrationScript?: RulesMigrationScript goals?: Goals } /** * A type of reward that is given by this program. */ export interface RewardType { key?: Key name?: Name description?: Description units?: Units [k: string]: unknown } /** * A type of email that is given by this program. */ export interface EmailType { key?: Key1 name?: Name1 description?: Description1 defaults?: (DefaultTemplateId | SimpleEmailTemplateSchema | HTMLEmailTemplateSchema) [k: string]: unknown } /** * Defines the customization points available in a Simple Email Template. */ export interface SimpleEmailTemplateSchema { meta: Email content: Content } export interface Email { fromName: FromName fromAddress: FromAddress subject: Subject } export interface Content { headerImage?: HeaderImage headerContent?: Header bodyContent: Body cta?: CallToAction footerContent?: Footer } export interface CallToAction { enabled?: DisplayCTAButton text?: Text link?: Link [k: string]: unknown } /** * Defines the customization points available in an HTML body email template. */ export interface HTMLEmailTemplateSchema { meta: Email1 htmlContent: HTMLContent jsonContent?: JSONContent } export interface Email1 { fromName: FromName1 fromAddress: FromAddress1 subject: Subject1 bcc?: BCC } /** * The JSON content for the email editor */ export interface JSONContent { [k: string]: unknown } /** * A type of email that is given by this program. * * This interface was referenced by `ProgramTemplateBuilder`'s JSON-Schema * via the `definition` "EmailType". */ export interface EmailType1 { key?: Key1 name?: Name1 description?: Description1 defaults?: (DefaultTemplateId | SimpleEmailTemplateSchema | HTMLEmailTemplateSchema) [k: string]: unknown } /** * The business rule variables define a JSON schema of the possible configuration points in the business logic. */ export interface BusinessRuleVariables { [k: string]: unknown } /** * Message links configuration (default share text/content for Open Graph/Twitter/etc) */ export interface LinksConfiguration { defaults?: ProgramMessaging [k: string]: unknown } /** * Defines the configurable share messages provided by this program. */ export interface ProgramMessaging { shareLinkOpenGraph: ShareLinkOpenGraph messageLinkOpenGraph: ShareLinkOpenGraph messages: ShareMessages } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "twitter". */ export interface Twitter { shareMedium?: "TWITTER" config?: X } export interface X { twitterShareBody: XShareBody } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "email". */ export interface Email2 { shareMedium?: "EMAIL" config?: Email3 } export interface Email3 { emailShareSubject: EmailShareSubject emailShareBody: EmailShareBody } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "linkedin". */ export interface Linkedin { shareMedium?: "LINKEDIN" config?: LinkedIn } export interface LinkedIn { linkedinShareSubject: LinkedInShareSubject linkedinShareBody: LinkedInShareBody linkedinShareImageURL?: LinkedInURLImage } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "sms". */ export interface Sms { shareMedium?: "SMS" config?: SMS } export interface SMS { smsShareBody: SMSShareBody } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "whatsapp". */ export interface Whatsapp { shareMedium?: "WHATSAPP" config?: WhatsApp } export interface WhatsApp { whatsAppShareBody: WhatsAppShareBody } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "linemessenger". */ export interface Linemessenger { shareMedium?: "LINEMESSENGER" config?: LineMessenger } export interface LineMessenger { lineMessengerShareBody: LineMessengerShareBody } /** * This interface was referenced by `ProgramMessaging`'s JSON-Schema * via the `definition` "pinterest". */ export interface Pinterest { shareMedium?: "PINTEREST" config?: Pinterest1 } export interface Pinterest1 { pinterestImageURL?: PinterestImageURL pinterestShareBody?: PinterestShareBody } /** * This should be a GraphQL-compatible query json object */ export interface UserFilter { [k: string]: unknown } /** * The filter used to determine which users are evaluated when the schedule is run */ export interface Filter { [k: string]: unknown } /** * Defines how the rules will be shown via schema form */ export interface RulesUISchema { [k: string]: unknown } /** * A condition that should be satified to confirm this program is working * * This interface was referenced by `ProgramTemplateBuilder`'s JSON-Schema * via the `definition` "Requirement". */ export interface ProgramRequirement { key: Key2 name: Name2 description: Description3 longDescription?: LongDescription query?: GraphQLQuery queryVariables?: GraphQLQueryVariables [k: string]: unknown } /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "singleFieldWithWindowingAggregate". */ export interface SingleFieldWithWindowingAggregate { fieldName: FieldName windowing?: Windowing } /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "windowingAggregate". */ export interface WindowingAggregate { windowing?: Windowing } /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "singleFieldAggregate". */ export interface SingleFieldAggregate { fieldName: FieldName } /** * Defines specific triggers for this program */ export interface ProgramTriggers { eventKeys?: EventKeys userEventKeys?: UserEventKeys customFieldKeys?: CustomFieldKeys [k: string]: unknown } /** * A type of widget that is displayed by this program. * * This interface was referenced by `ProgramTemplateBuilder`'s JSON-Schema * via the `definition` "WidgetType". */ export interface WidgetType { key?: Key3 name?: Name4 description?: Description4 defaults?: HTMLWidgetTemplateSchema [k: string]: unknown } /** * Defines a web-component based widget template that uses vanilla HTML. */ export interface HTMLWidgetTemplateSchema { meta?: TemplateMeta htmlTemplate: HTMLTemplate autoPopup?: AutoPopup brandingConfig?: BrandingConfig } export interface TemplateMeta { /** * A list of NPM resources to load into the widget */ dependencies?: NpmDependency[] /** * A list of component editors used in editing the widget */ plugins?: NpmDependency[] } /** * This interface was referenced by `HTMLWidgetTemplateSchema`'s JSON-Schema * via the `definition` "npmDependency". */ export interface NpmDependency { /** * An NPM package name or scoped package */ package: string /** * An NPM version string, such as Patch releases: 1.0 or 1.0.x or ~1.0.4 Minor releases: 1 or 1.x or ^1.0.4 Major releases: * or x */ version: string /** * The path to a resource in the specified package */ filePath?: string [k: string]: unknown } export interface BrandingConfig { [k: string]: unknown } /** * A type of reward that is given by this program. * * This interface was referenced by `ProgramTemplateBuilder`'s JSON-Schema * via the `definition` "RewardType". */ export interface RewardType1 { key?: Key name?: Name description?: Description units?: Units [k: string]: unknown } /** * The rules configured for this program */ export interface ProgramRulesDeprecated { [k: string]: unknown } export interface Program { rules?: ProgramRules id?: ProgramID rewards?: ProgramRewards } /** * The rules configured for this program */ export interface ProgramRules { [k: string]: unknown } /** * Establishes the available configuration for pre-defined. */ export interface PreDefinedRewardsSchema { reward?: PredefiendReward [k: string]: unknown } export interface IntegrationSettings { templateId?: EmailTemplateID giftId?: string utid?: string [k: string]: unknown } export interface ProgramTriggerVariablesSchemaRequest2 { messageType?: "PROGRAM_TRIGGER_VARIABLES_SCHEMA_REQUEST" triggerType?: ("AFTER_USER_CREATED_OR_UPDATED" | "SCHEDULED" | "REWARD_SCHEDULED" | "REFERRAL" | "AFTER_USER_EVENT_PROCESSED") schema?: DefaultSchema [k: string]: unknown } /** * The default schema for the request, which will be overridden if necessary */ export interface DefaultSchema { [k: string]: unknown }