/*** * * 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 * ***/ /*** * ProgramTransaction.schema.json * Generated on 2026-03-20T21:11:43.302Z * This file was automatically generated. DO NOT edit it by hand, instead edit the related JSON Schema file. ***/ export type ProgramIdentifier = string /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "mutation". */ export type ProgramMutation = (Mutation & Mutation1) export type Mutation = (RewardCreation | ModerateGraphNodes | SendEmail | ExchangeReward | RetractReferralConversion) /** * The program template key used to establish the relationship between this reward and the program */ export type RewardKey = string /** * A unique BSON ObjectID used to identify the reward, if not set this will be auto-generated. Use this to link with emails. */ export type RewardID = (string | null) /** * The referral ID for the event to be marked as a source of this reward */ export type ReferralID = (string | null) /** * This status defines the state the reward will be in when immediately after it is created * * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "initialRewardStatus". */ export type InitialRewardStatus = ("AVAILABLE" | "PENDING" | "CANCELLED") export type RewardSource = ("FRIEND_SIGNUP" | "REFERRED" | "ACTIVATION" | "ACQUISITION" | "RETENTION" | "REACTIVATION" | "AUTOMATED") export type UserID = string export type UserAccountID = string /** * The key of the event to be marked as a source of this reward */ export type EventKey = string /** * The unique identifier of the event to be marked as a source of this reward */ export type EventID = string /** * Defines the reward API data input structure. */ export type IfTheRewardIsMarkedAsDynamicByTheProgramTemplateThesePropertiesWillBeUsedToDynamicallyGenerateTheRewardTODODescribeUserDefinitionPrecedence = (({ type: "PCT_DISCOUNT" discountPercent: DiscountPercent name?: RewardName dateExpires?: RewardExpiryDate cancellable?: Cancellable dateScheduledFor?: ScheduledRewardGivenDate } | { type: "FUELTANK" fuelTankCode: FuelTankCode unit?: Unit amount: Amount dateExpires?: RewardExpiryDate fuelTankType: FuelTankType cancellable?: Cancellable } | { type: "CREDIT" unit: Unit name?: RewardName assignedCredit: AssignedCredit dateExpires?: RewardExpiryDate cancellable?: Cancellable dateScheduledFor?: ScheduledRewardGivenDate } | { type: "INTEGRATION" unit: Unit name?: RewardName description?: RewardDescription valueInCents: RewardAmount integrationSettings: IntegrationSettings }) & { type?: RewardType [k: string]: unknown }) /** * The discount associated with this reward */ export type DiscountPercent = number /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardName". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardName". */ export type RewardName = (string | null) /** * The date this reward will expire * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardDateExpires". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardDateExpires". */ export type RewardExpiryDate = (number | null) /** * Whether this reward can be cancelled * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardCancellable". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardCancellable". */ export type Cancellable = (boolean | null) /** * If the reward is created in a PENDING state this is the date we will attempt to 'give' it * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardDateScheduledFor". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardDateScheduledFor". */ export type ScheduledRewardGivenDate = (number | null) /** * The associated coupon code uploaded via the fuel tank API or portal code manager */ export type FuelTankCode = string /** * The unit of credit associated with this reward (i.e. months or usd) * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardUnit". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "rewardUnit". */ export type Unit = string /** * The amount of credit or discount to be given */ export type Amount = string /** * The type of fuel tank reward being given */ export type FuelTankType = ("PCT_DISCOUNT" | "CREDIT") /** * The initial redeemable credit assigned to be assigned to reward */ export type AssignedCredit = number /** * This text describes the integration reward given in more detail */ export type RewardDescription = string /** * The value in base currency unit (i.e. cents) to be assigned to this reward */ export type RewardAmount = string export type EmailTemplateID = string export type RewardType = ("PCT_DISCOUNT" | "FUELTANK" | "CREDIT" | "INTEGRATION") /** * If the reward is created in a PENDING state this is the date we will attempt to 'give' it */ export type ScheduledRewardGivenDate1 = (number | null) /** * The date this reward is scheduled to expire if the reward is expirable */ export type RewardExpiryDate1 = (number | null) /** * The type of the graph node(s) to be moderated */ export type GraphNodeType = ("REWARD" | "PROGRAM_EMAIL" | "REFERRAL" | "USER_EVENT" | "PAYMENT_ACCOUNT") /** * The moderation action to apply to the filtered graph node(s) */ export type ModerationAction = ("APPROVE" | "DENY" | "NOTHING") /** * The maximum depth of child nodes to be moderated */ export type MaxDepth = number /** * The program template key of the email to send */ export type EmailKey = string /** * The initial email status, if not set this will default to QUEUED */ export type EmailStatus = ("PENDING" | "QUEUED") /** * If included, this defines the reward that will be linked to this email */ export type EmailRewardID = (string | null) /** * If included, this defines the referral that will be linked to this email */ export type EmailReferralID = (string | null) /** * The GraphQL query used to build the context for this email */ export type EmailQuery = string /** * Defines the reward API data input structure. */ export type RewardAPIInput = (({ type: "PCT_DISCOUNT" discountPercent: DiscountPercent name?: RewardName dateExpires?: RewardExpiryDate cancellable?: Cancellable dateScheduledFor?: ScheduledRewardGivenDate } | { type: "FUELTANK" fuelTankCode: FuelTankCode unit?: Unit amount: Amount dateExpires?: RewardExpiryDate fuelTankType: FuelTankType cancellable?: Cancellable } | { type: "CREDIT" unit: Unit name?: RewardName assignedCredit: AssignedCredit dateExpires?: RewardExpiryDate cancellable?: Cancellable dateScheduledFor?: ScheduledRewardGivenDate } | { type: "INTEGRATION" unit: Unit name?: RewardName description?: RewardDescription valueInCents: RewardAmount integrationSettings: IntegrationSettings }) & { type?: RewardType [k: string]: unknown }) export type ReferralID1 = string /** * The type of mutation to be performed */ export type MutationType = ("CREATE_REWARD" | "SEND_EMAIL" | "MODERATE_GRAPH_NODES" | "EXCHANGE_REWARD" | "RETRACT_REFERRAL_CONVERSION") /** * These are actions we would like to be performed by the program engine (i.e. creating a reward or sending an email) */ export type Mutations = ProgramMutation[] /** * The type of event to record as an analytic */ export type EventType = ("PROGRAM_EVALUATED" | "PROGRAM_GOAL") /** * Event data - currently just program which only requires the user */ export type EventData = ({ [k: string]: unknown } & { user: MutationUser /** * The type of program (i.e. acquisition, loyalty, retention) */ programType?: ("ACQUISITION" | "RETENTION" | "LOYALTY") /** * The type of analytic recorded (i.e. in program goals this could describe the goal achieved such as 'friendPaid'). It maps directly to the goalId. */ analyticsKey?: string /** * An ID unique in the recording of this analytic that will be used to deduplicate (i.e. with goals this could be the number of times the referrer was rewarded) */ analyticsDedupeId?: (string | null) /** * Whether this analytic will trigger a referral conversion. When analyticsDedupeId exists, the default value is true. When analyticsDedupeId does not exist, the default value is false. */ isConversion?: boolean /** * The date this analytic will be marked as recorded (defaults to current tenant time if not set) */ timestamp?: number }) /** * A list of analytics representing activities performed by the program */ export type Analytics = ProgramAnalytic[] /** * Establishes the transaction interface that programs use apply mutations/generate analytics. */ export interface ProgramTransactionSchema { programId: ProgramIdentifier mutations?: Mutations analytics?: Analytics } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "rewardCreation". */ export interface RewardCreation { type: "CREATE_REWARD" data: RewardData } export interface RewardData { key: RewardKey rewardId?: RewardID referralId?: ReferralID status?: InitialRewardStatus rewardSource?: RewardSource user: MutationUser userEvent?: (({ key: EventKey id: EventID } | (null & { key: EventKey id: EventID })) & { key: EventKey id: EventID }) dynamicProperties?: IfTheRewardIsMarkedAsDynamicByTheProgramTemplateThesePropertiesWillBeUsedToDynamicallyGenerateTheRewardTODODescribeUserDefinitionPrecedence overrideProperties?: RewardOverride } /** * The mutation will be applied to this user * * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "user". */ export interface MutationUser { id: UserID accountId: UserAccountID } /** * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "integrationSettings". * * This interface was referenced by `undefined`'s JSON-Schema * via the `definition` "integrationSettings". */ export interface IntegrationSettings { templateId?: EmailTemplateID giftId?: string utid?: string [k: string]: unknown } /** * Properties included here will override or be added to properties setup via program reward configuration */ export interface RewardOverride { dateScheduledFor?: ScheduledRewardGivenDate1 dateExpires?: RewardExpiryDate1 } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "moderateGraphNodes". */ export interface ModerateGraphNodes { type: "MODERATE_GRAPH_NODES" data: RewardData1 } export interface RewardData1 { graphNodeType: GraphNodeType filter: ModerationFilter moderationInput: { action: ModerationAction maxDepth: MaxDepth } } /** * A GraphQL filter that defines the node(s) to be moderated. See RewardFilterInput, ProgramEmailTransactionFilterInput, ProgramReferralFilterInput, and UserEventDataFilterInput */ export interface ModerationFilter { [k: string]: unknown } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "sendEmail". */ export interface SendEmail { type: "SEND_EMAIL" data: EmailData } export interface EmailData { key: EmailKey status?: EmailStatus rewardId?: EmailRewardID referralId?: EmailReferralID user: MutationUser query: EmailQuery queryVariables: EmailQueryVariables } /** * This variables object parameterizes the GraphQL Email query */ export interface EmailQueryVariables { [k: string]: unknown } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "exchangeReward". */ export interface ExchangeReward { type?: "EXCHANGE_REWARD" data?: RewardExchangeData [k: string]: unknown } export interface RewardExchangeData { user: MutationUser /** * Defines the amount of credit to redeem for this reward exchange */ redeemCreditInput: { amount: number unit: string } rewardInput?: RewardAPIInput /** * The global reward key for the reward to be given */ globalRewardKey?: string status?: InitialRewardStatus /** * Whether this reward exchange should be performed repeatedly until the user does not have enough redeemable credit. If not set, this will default to false. */ repeat?: boolean } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "retractReferralConversion". */ export interface RetractReferralConversion { type?: "RETRACT_REFERRAL_CONVERSION" data?: RetractReferralConversionData [k: string]: unknown } export interface RetractReferralConversionData { referralId: ReferralID1 } export interface Mutation1 { type?: MutationType [k: string]: unknown } /** * This interface was referenced by `ProgramTransactionSchema`'s JSON-Schema * via the `definition` "analytics". */ export interface ProgramAnalytic { eventType: EventType data: EventData }