import { IOrder } from "./index"; /** States define flow of campaign */ interface CampaignStateDefinition { /** * @minLength 1 * @maxLength 32 * @pattern [a-zA-Z0-9_-]+ */ id: string; /** * @minLength 1 * @maxLength 32 * @pattern [a-zA-Z0-9_-]+ */ transitionTo?: string; /** @format int64 */ stats?: number; type: string; } /** Define push notification templates */ export interface CampaignNotification { /** * @minLength 0 * @maxLength 256 */ title: string; /** * @minLength 0 * @maxLength 256 */ message: string; /** * @minLength 0 * @maxLength 256 */ image?: string; payload?: Record; type: string; } export interface Campaign { /** * @minLength 0 * @maxLength 64 * @pattern [a-zA-Z0-9_-]+ */ id: string; /** * Name of a campaign * @minLength 3 * @maxLength 128 */ name: string; /** @format date-time */ activeFrom?: string; /** @format date-time */ activeTo?: string; /** * Constraints are rules that specify which accounts fall info the campaign. * @maxItems 16 * @minItems 1 */ constraints: Constraint[]; /** * States define flow of campaign * @maxItems 10 * @minItems 1 */ states: CampaignStateDefinition[]; /** Flag that determine if campaign can be dynamically joined upon account change or only initially assigned accounts take part in campaign. */ dynamic?: boolean; /** * Define push notification templates * @maxItems 3 * @minItems 0 */ notifications?: CampaignNotification[]; /** * When campaign was initialized * @format date-time */ initializedAt?: string; /** Who initialized the campaign */ initializedBy?: string; /** Whether campaign is initialized and running. There is a limit of simultaneously running campaigns. */ initialized?: boolean; /** * Number of accounts that fall info the campaign. Before initialization this is a predicted value, after initialization it is current value updated upon dynamic joins etc. * @format int64 */ cnt?: number; /** How many accounts finished each campaign state */ stateStats?: Record; /** * Preview generated at * @format date-time */ previewedAt?: string; /** Sample account ids for preview */ samples?: string[]; } interface Constraint { /** * @minLength 0 * @maxLength 64 * @pattern ((counters|properties|venues|tags)\.[a-zA-Z0-9_-]+)|(header\.(firstName|created|lastOrder|birthdate)) */ field: string; op: "EQ" | "NE" | "IN" | "GT" | "GTE" | "LT" | "LTE" | "EXISTS"; /** * @maxItems 16 * @minItems 0 */ value?: string[]; } interface AccountHeader { phone?: string; email?: string; pushId?: string; firstName?: string; lastName?: string; /** @format date */ birthdate?: string; /** @format date-time */ created?: string; /** @format date-time */ lastEvent?: string; /** @format date-time */ lastLogged?: string; /** @format date-time */ lastOrder?: string; } export interface ApiAccount { id?: string; card?: string; mgm?: string; header?: AccountHeader; consents?: Consents; /** @uniqueItems true */ tags?: string[]; /** @uniqueItems true */ importantTags?: string[]; /** @uniqueItems true */ venues?: string[]; properties?: Record; counters?: Record; relations?: Relation[]; openedOrders?: IOrder[]; previousOrders?: IOrder[]; /** @uniqueItems true */ coupons?: string[]; campaigns?: CampaignState[]; segment?: string; } interface CampaignState { id?: string; state?: string; } interface Consents { scope: "ACCOUNT" | "TRANSACTION"; /** * @minLength 0 * @maxLength 128 * @pattern [a-zA-Z0-9_.-]+ */ transaction?: string; consents: Record; } interface Relation { id?: string; /** @format date-time */ at?: string; type?: "INVITED_BY" | "INVITED" | "FRIEND" | "UNKNOWN"; } export {};