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AGwL,EAAM0kC,GAC5B,GAAG,CAAC,EACR","sources":["legacy-types/acl.ts","legacy-types/campaigns.ts","legacy-types/models.ts","legacy-types/users.ts","legacy-types/telnyx.ts","legacy-types/user-settings.ts","legacy-types/index.ts","pages/alerts/user.alerts.helpers.ts","pages/campaigns/builder/cmp.builder.helpers.ts","pages/campaigns/builder/cmp.builder.types.ts","pages/campaigns/builder/components/ProductSelectorModal.tsx","pages/campaigns/builder/macros.tsx","pages/crew/crew-types/CrewLeaderboardTypes.ts","pages/crew/crew-types/CrewGoalTypes.ts","pages/crew/crew-types/CrewPayoutTypes.ts","pages/crew/helpers/index.ts","pages/crew/pages/goals/crewgoal.helpers.ts"],"sourcesContent":["export const Role = {\n\t// Admin types\n\tADMIN_SUPERUSER: 'admin_superuser',\n\tADMIN_DIRECTOR: 'admin_director',\n\tADMIN_ACCOUNTMANAGER: 'admin_accountmanager',\n\t// User types\n\tOWNER: 'owner',\n\tOPERATOR: 'operator',\n\tMA: 'marketinganalyst',\n\tMARKETING: 'marketing',\n\tANALYST: 'analyst',\n\tMANAGER: 'manager',\n\tBUDTENDER: 'budtender',\n\tFINANCIAL: 'financial'\n} as const;\nexport type Role = typeof Role[keyof typeof Role];\n\nexport const RoleTitles = {\n\t[Role.ADMIN_SUPERUSER]: 'Admin Superuser',\n\t[Role.ADMIN_DIRECTOR]: 'Admin Director',\n\t[Role.ADMIN_ACCOUNTMANAGER]: 'Account Manager',\n\t[Role.OWNER]: 'Owner',\n\t[Role.OPERATOR]: 'Operator',\n\t[Role.MA]: 'Marketing Analyst',\n\t[Role.MARKETING]: 'Marketing',\n\t[Role.ANALYST]: 'Analyst',\n\t[Role.MANAGER]: 'Manager',\n\t[Role.BUDTENDER]: 'Staff',\n\t[Role.FINANCIAL]: 'Financial'\n} as const;\n\nexport interface AclPolicy {\n\trole: string;\n\tdomain: string;\n\troute: string;\n\tmethod: string;\n\tperm: Perm;\n};\n\nexport type Perm = 'allow' | 'deny';\n","import { Contact, Fees, FeesV2, ID } from '.';\nimport { userUtils, utils } from '../helpers';\nimport { CampaignBuilderPageProps, CampaignBuilderTextOption, CampaignBuilderTextOptions } from '../pages/campaigns/builder/cmp.builder.types';\nimport { Audience } from './audience';\nimport { BudgetForecastOutput } from './forecast';\nimport { ChangeSet, RecipeInfo } from './recipes';\n\nexport type BulkUpdateItem = { id: string; action: string; value: string | number | boolean };\n\ntype ConvesionTypeData = {\n\tdescription: string;\n\tname: string;\n\tdefaultEnabled: boolean;\n\ttemplate: CampaignChannelType | undefined;\n};\nexport const CampaignConversionActionMap = {\n\ttext_received: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Text received',\n\t\tdescription: 'After a text is sent',\n\t\ttemplate: 'templates',\n\t} as ConvesionTypeData,\n\ttext_click_to_open: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Opened text',\n\t\tdescription: 'After they open a text',\n\t\ttemplate: 'templates',\n\t} as ConvesionTypeData,\n\ttext_sent: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Customer response via text',\n\t\tdescription: 'After customer responds to a text',\n\t\ttemplate: 'templates',\n\t} as ConvesionTypeData,\n\ttext_click: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Landing page viewed',\n\t\tdescription: 'After landing page link was clicked',\n\t\ttemplate: 'templates',\n\t} as ConvesionTypeData,\n\temail_received: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Email received',\n\t\tdescription: 'After email is sent',\n\t\ttemplate: 'emailTemplate',\n\t} as ConvesionTypeData,\n\temail_open: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Opened email',\n\t\tdescription: 'After an email was opened',\n\t\ttemplate: 'emailTemplate',\n\t} as ConvesionTypeData,\n\tpush_received: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Native push received',\n\t\tdescription: 'After native app push delivered',\n\t\ttemplate: 'pushTemplate',\n\t} as ConvesionTypeData,\n\tpush_open: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Opened native push',\n\t\tdescription: 'After a push was opened',\n\t\ttemplate: 'pushTemplate',\n\t} as ConvesionTypeData,\n\t// ad_received: {\n\t// \tdefaultEnabled: false,\n\t// \tname: \"Screen ad received\",\n\t// \tdescription: \"After an app ad or screen ad was shown\",\n\t// \ttemplate: 'adTemplate'\n\t// } as ConvesionTypeData,\n\tbrowser_received: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Browser push received',\n\t\tdescription: 'After browser push delivered',\n\t\ttemplate: 'browserTemplate',\n\t} as ConvesionTypeData,\n\tdirect_mail_received: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Direct mail received',\n\t\tdescription: 'After a direct mail letter was delievered',\n\t\ttemplate: 'snailMailTemplate',\n\t} as ConvesionTypeData,\n\tTerpliReview: {\n\t\tdefaultEnabled: false,\n\t\tname: 'Terpli review left',\n\t\tdescription: 'After a Terpli review',\n\t\ttemplate: undefined,\n\t} as ConvesionTypeData,\n\tTerpliRecommendation: {\n\t\tdefaultEnabled: false,\n\t\tname: 'Terpli recommendation left',\n\t\tdescription: 'After a Terpli recommendation',\n\t\ttemplate: undefined,\n\t} as ConvesionTypeData,\n\tTerpliReviewDiscount: {\n\t\tdefaultEnabled: false,\n\t\tname: 'Terpli review discount',\n\t\tdescription: 'After a Terpli review discount',\n\t\ttemplate: undefined,\n\t} as ConvesionTypeData,\n\tTerpliRecommendationDiscount: {\n\t\tdefaultEnabled: false,\n\t\tname: 'Terpli recommendation discount',\n\t\tdescription: 'After a Terpli recommendation discount',\n\t\ttemplate: undefined,\n\t} as ConvesionTypeData,\n\tcall_answer: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Voice drop answered',\n\t\tdescription: 'After call was answered by a person',\n\t\ttemplate: 'voiceTemplate',\n\t} as ConvesionTypeData,\n\tcall_vm: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Voice drop hit voicemail',\n\t\tdescription: 'After call went to voicemail',\n\t\ttemplate: 'voiceTemplate',\n\t} as ConvesionTypeData,\n\tcall_complete: {\n\t\tdefaultEnabled: true,\n\t\tname: 'Voice drop completed',\n\t\tdescription: 'After a voice drop is completed',\n\t\ttemplate: 'voiceTemplate',\n\t} as ConvesionTypeData,\n} as const;\n\nexport type ConversionAction = keyof typeof CampaignConversionActionMap;\n\nconst getTiers = () => ({\n\tcurrentMarketingPlan: userUtils.getPackageTier('marketing'),\n\thasMarketingStarter: userUtils.hasPackageTier('marketing', 'starter'),\n\thasMarketingPro: userUtils.hasPackageTier('marketing', 'pro'),\n\thasMarketingEnterprise: userUtils.hasPackageTier('marketing', 'enterprise'),\n});\n\n//* Users will be exempt from email/app channel requirments\nconst exceptions = ['1749', '1207', '2890', '2891', '2892', '3019', '1614'];\n\nexport const CampaignChannelsMap = {\n\temailTemplate: {\n\t\ticon: 'envelope',\n\t\tshortName: 'Email',\n\t\tdescription: 'Email',\n\t\tdefaultPriority: 0,\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costEmail,\n\t\t\t\tsends: estimate.sendEstimates?.countEmail,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn audience.optInEmailSize || 0;\n\t\t},\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (exceptions.includes(args.uid) || utils.isDemo(args.uid)) return [];\n\t\t\tif (!tiers.hasMarketingStarter) {\n\t\t\t\treturn [`Email is not available on your current plan. Requires starter plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\tif (!args.sendgridDomainCheck?.emailReady && !utils.isBrand()) {\n\t\t\t\terrors.push(`Email is not available until you verify your domain. Please verify your domain in the settings page.`);\n\t\t\t}\n\t\t\tif (utils.initialUser()?.agencyID === '1434') errors.push(`Email is not available`);\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: EmailTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.subject;\n\t\t},\n\t\thasContent: (channel: EmailTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.html || !!channel.json;\n\t\t},\n\t\tvalidate: (channel: EmailTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\tif (!channel.subject) errors.push('Subject is required');\n\t\t\tif (!channel.from) errors.push('From is required');\n\t\t\tif (!channel.fromName) errors.push('From name is required');\n\t\t\tif (!channel.html) errors.push('Content is required');\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerSentEmail || 0;\n\t\t\t}\n\t\t\treturn (fees as FeesV2).messagingDefaults?.email || 0;\n\t\t},\n\t},\n\tvoiceTemplate: {\n\t\ticon: 'phone',\n\t\tshortName: 'Voice',\n\t\tdescription: 'Voice call',\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costVoice,\n\t\t\t\tsends: estimate.sendEstimates?.countVoice,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn audience.optInVoiceSize || 0;\n\t\t},\n\t\tdefaultPriority: 1,\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (!tiers.hasMarketingStarter) {\n\t\t\t\treturn [`Voice is not available on your current plan. Requires starter plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: VoiceTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: VoiceTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.voiceFile || (!!channel.lo && !!channel.ttv);\n\t\t},\n\t\tvalidate: (channel: VoiceTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\tif (channel.ttv) {\n\t\t\t\tif (!channel.lo) errors.push('Language is required');\n\t\t\t} else if (!channel.voiceFile) {\n\t\t\t\terrors.push('Voice file is required');\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerCallMinute || 0;\n\t\t\t}\n\t\t\treturn (fees as FeesV2).messagingDefaults?.call || 0;\n\t\t},\n\t},\n\ttemplates: {\n\t\ticon: 'comment-lines',\n\t\tshortName: 'Text',\n\t\tdescription: 'Text message',\n\t\t// defaultItems: { landingType: \"HTML\", } as Partial<SMSTemplate>,\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\tconst isAgnostic = CampaignBuilderTextOptions.regular.isAvailable(campaign);\n\t\t\tconst defaultTemplate: SMSTemplate = {\n\t\t\t\tlandingType: campaign.optinCampaign || campaign.emailOptinCampaign ? 'RAW' : 'HTML',\n\t\t\t\toptionType: isAgnostic ? 'regular' : 'regulated',\n\t\t\t\tmsgContainer: utils.user.msgContainer ?? '',\n\t\t\t};\n\t\t\tif (isAgnostic) {\n\t\t\t\tdefaultTemplate.agnostic = true;\n\t\t\t\tdefaultTemplate.msgContainer = undefined;\n\t\t\t\tdefaultTemplate.landingType = undefined;\n\t\t\t\tdefaultTemplate.landingHTML = undefined;\n\t\t\t\tdefaultTemplate.landingDesign = undefined;\n\t\t\t}\n\t\t\treturn defaultTemplate;\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\tconst smsCost = estimate.budgetEstimates?.costSMS || 0;\n\t\t\tconst mmsCost = estimate.budgetEstimates?.costMMS || 0;\n\t\t\tconst smsSends = estimate.sendEstimates?.countSMS || 0;\n\t\t\tconst mmsSends = estimate.sendEstimates?.countMMS || 0;\n\t\t\treturn {\n\t\t\t\tcost: smsCost + mmsCost,\n\t\t\t\tsends: smsSends + mmsSends,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn audience.optInPhoneSize || 0;\n\t\t},\n\t\tdefaultPriority: 2,\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (!tiers.hasMarketingStarter) {\n\t\t\t\treturn [`Text is not available on your current plan. Requires starter plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: SMSTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: SMSTemplate, campaign: Campaign): boolean => {\n\t\t\tconst MMSOnly = campaign.templates?.mmsOnly;\n\t\t\tconst isHTML = channel.landingType === 'HTML';\n\t\t\tconst isLegacy = !isHTML || campaign.optinCampaign;\n\t\t\tif (channel.optionType === 'regular') {\n\t\t\t\treturn !!channel.body;\n\t\t\t}\n\t\t\tif (MMSOnly) {\n\t\t\t\treturn !!channel.mmsMediaURL;\n\t\t\t}\n\t\t\tif (isLegacy) {\n\t\t\t\treturn !!channel.body;\n\t\t\t}\n\t\t\treturn !!channel.landingHTML || !!channel.landingDesign;\n\t\t},\n\t\tvalidate: (channel: SMSTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: (isMMS?: boolean) => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\tif (isMMS) return (fees as Fees).chargePerSentMMS || 0;\n\t\t\t\treturn (fees as Fees).chargePerSentSMS || 0;\n\t\t\t}\n\t\t\tif (isMMS) return (fees as FeesV2).messagingDefaults?.mms || 0;\n\t\t\treturn (fees as FeesV2).messagingDefaults?.sms || 0;\n\t\t},\n\t},\n\tpushTemplate: {\n\t\ticon: 'mobile',\n\t\tshortName: 'Native Push',\n\t\tdescription: 'Native app push',\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costPush,\n\t\t\t\tsends: estimate.sendEstimates?.countPush,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn audience.optInPushSize || 0;\n\t\t},\n\t\tdefaultPriority: 3,\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (['3164', ...exceptions].includes(args.uid) || utils.isDemo(args.uid)) return [];\n\t\t\tif (!tiers.hasMarketingStarter) {\n\t\t\t\treturn [`Push is not available on your current plan. Requires starter plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\tif (!utils.user?.metadata?.hasNativeApp && !utils.user?.hasCustomApp && !utils.isBrand()) {\n\t\t\t\treturn [`Push is not available until you have a native app. Please contact support to get started.`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: PushTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: PushTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.body && !!channel.title;\n\t\t},\n\t\tvalidate: (channel: PushTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerSentPush || 0;\n\t\t\t}\n\t\t\treturn (fees as FeesV2).messagingDefaults?.push || 0;\n\t\t},\n\t},\n\tbrowserTemplate: {\n\t\ticon: 'browser',\n\t\tshortName: 'Browser Push',\n\t\tdescription: 'Browser push',\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costBrowser,\n\t\t\t\tsends: estimate.sendEstimates?.countBrowser,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn 0;\n\t\t},\n\t\tdefaultPriority: 4,\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (!tiers.hasMarketingStarter) {\n\t\t\t\treturn [`Browser push is not available on your current plan. Requires starter plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: PushTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: BrowserTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.body && !!channel.title;\n\t\t},\n\t\tvalidate: (channel: BrowserTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerSentBrowser || 0;\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t},\n\tsnailMailTemplate: {\n\t\ticon: 'mailbox',\n\t\tshortName: 'Direct Mail',\n\t\tdescription: 'Direct mail',\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costMail,\n\t\t\t\tsends: estimate.sendEstimates?.countPostal,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn 0;\n\t\t},\n\t\tdefaultPriority: 5,\n\t\tisVisible: () => true,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (!tiers.hasMarketingPro) {\n\t\t\t\treturn [`Direct mail is not available on your current plan. Requires pro plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: PushTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: SnailMailTemplate, campaign: Campaign): boolean => {\n\t\t\treturn !!channel.front && !!channel.back && !!channel.size;\n\t\t},\n\t\tvalidate: (channel: SnailMailTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerSentSnailMail || 0;\n\t\t\t}\n\t\t\treturn (fees as FeesV2).messagingDefaults?.directMail || 0;\n\t\t},\n\t},\n\tadTemplate: {\n\t\ticon: 'tv',\n\t\tshortName: 'Screen Ad',\n\t\tdescription: 'Screen ad',\n\t\tdefaultItems: (campaign: Campaign) => {\n\t\t\treturn {};\n\t\t},\n\t\tgetBudgetInfo: (estimate: BudgetForecastOutput) => {\n\t\t\treturn {\n\t\t\t\tcost: estimate.budgetEstimates?.costAd,\n\t\t\t\tsends: estimate.sendEstimates?.countAd,\n\t\t\t};\n\t\t},\n\t\tgetAudienceOptins(audience: Audience): number {\n\t\t\treturn 0;\n\t\t},\n\t\tdefaultPriority: 6,\n\t\tisVisible: () => false,\n\t\tisLocked: (args: CampaignBuilderPageProps) => {\n\t\t\tconst errors: string[] = [],\n\t\t\t\ttiers = getTiers();\n\t\t\tif (!tiers.hasMarketingPro) {\n\t\t\t\treturn [`Screen ads are not available on your current plan. Requires pro plan or higher. Current plan: ${tiers.currentMarketingPlan}`];\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t\thasPreContent: (channel: PushTemplate, campaign: Campaign): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\thasContent: (channel: AdTemplate, campaign: Campaign): boolean => {\n\t\t\treturn false;\n\t\t},\n\t\tvalidate: (channel: AdTemplate, campaign: Campaign): string[] => {\n\t\t\tconst errors: string[] = [];\n\t\t\treturn errors;\n\t\t},\n\t\tgetCostPerSend: () => {\n\t\t\tconst fees = userUtils.getUserFees();\n\t\t\tif (userUtils.hasLegacyBilling()) {\n\t\t\t\treturn (fees as Fees).chargePerCPMAds || 0;\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t},\n} as const;\n\nexport const CampaignChannels = Object.keys(CampaignChannelsMap) as CampaignChannelType[];\nexport type CampaignChannelType = keyof typeof CampaignChannelsMap;\nexport type CampaignChannel = (EmailTemplate | SMSTemplate | BrowserTemplate | AdTemplate | PushTemplate | VoiceTemplate) & { inUse?: boolean };\n\nexport type CampaignMap = Partial<{ [key in CampaignChannelType]: Campaign }>;\n\nexport type CampaignRealitives = Partial<{ [key in CampaignChannelType]: string }>;\nexport interface Campaign {\n\tid?: string;\n\ttype?: string;\n\tuserID?: string;\n\tname?: string;\n\ttimezone?: string;\n\tavatar?: string;\n\tstoreIDs?: string[];\n\tstoreIDHash?: { [key: ID]: ID[] };\n\texclude?: string[];\n\taudiences?: string[];\n\tupdated?: number;\n\tcreated?: number;\n\trecurDays?: number;\n\tcapPerDay?: number;\n\tapproved?: number;\n\tgiftPoints?: number;\n\ttriggers?: Triggers;\n\toptinCampaign?: boolean;\n\temailOptinCampaign?: boolean;\n\tdefault?: boolean;\n\tarchived?: boolean;\n\tisActive?: boolean;\n\trecipe?: RecipeInfo;\n\tisLocked?: boolean; // is this locked (being used in a recipe)\n\tlockedReason?: string; // why is this locked\n\trecipes?: { [key: string]: boolean }; // the id of the receipes that this campaign is in\n\tlastMessage?: number;\n\ttempID?: string;\n\tconversionWindow?: number;\n\tconversionActions?: ConversionAction[] | string[];\n\tclonedFrom?: string;\n\tmessageExpiry?: number;\n\tmessageExpiryUnit?: TimeUnit;\n\tchangeSet?: CampaignChangeSet;\n\tlifetimeCap?: number;\n\n\t// Scheduleing options\n\tblast?: boolean;\n\tscheduled?: number;\n\tsendAtTimePredicted?: boolean;\n\tdateRange?: DateRange;\n\tsendWindow?: SendWindow;\n\tenableQueue?: boolean;\n\n\tpushTemplate?: PushTemplate;\n\temailTemplate?: EmailTemplate;\n\ttemplates?: SMSTemplate;\n\tadTemplate?: AdTemplate;\n\tbrowserTemplate?: BrowserTemplate;\n\tsnailMailTemplate?: SnailMailTemplate;\n\tvoiceTemplate?: VoiceTemplate;\n\n\tsummary?: CampaignStats;\n\n\tpendingApproval?: boolean; // ! added and used in dash\n\tcontextUpdated?: number; // ! Added by dash to track when the context was last updated\n\n\trelations?: CampaignRealitives;\n\n\tdraft?: boolean; // ! Added by dash to track if this is a draft\n\ttags?: string[];\n\tbillingStoreID?: string;\n}\n\nexport interface CampaignLite {\n\tpushTemplate?: LiteTemplate;\n\tvoiceTemplate?: LiteTemplate;\n\temailTemplate?: LiteTemplate;\n\ttemplates?: LiteTemplate;\n\tadTemplate?: LiteTemplate;\n\tbrowserTemplate?: LiteTemplate;\n\tsnailMailTemplate?: LiteTemplate;\n\tblast?: boolean;\n\tdraft?: boolean;\n\tisActive?: boolean;\n\tarchived?: boolean;\n\trecurDays?: number;\n\tscheduled?: number;\n\tconversionWindow?: number;\n\tid: string;\n\tuserID?: string;\n\trecipeOwnerID?: string;\n\trecipeInfo?: RecipeInfo;\n}\n\nexport interface LiteTemplate {\n\tlandingType?: string;\n\tmediaURL?: string;\n\tmediaContentType?: string;\n\tmmsMediaURL?: string;\n\tmmsMediaContentType?: string;\n\tpriority?: number;\n\tadSize?: string;\n\tthirdPartyPlacement?: boolean;\n}\n\nexport interface CampaignUID {\n\ttriggers?: Triggers;\n\tadTemplate?: XLiteTemplate;\n\tpushTemplate?: XLiteTemplate;\n\tvoiceTemplate?: XLiteTemplate;\n\temailTemplate?: XLiteTemplate;\n\ttemplates?: XLiteTemplate;\n\tbrowserTemplate?: XLiteTemplate;\n\tsnailMailTemplate?: XLiteTemplate;\n\tmessageExpiry?: number;\n\tmessageExpiryUnit?: TimeUnit;\n\tdateRange?: DateRange;\n\tsendWindow?: SendWindow;\n\tuserID?: string;\n\tid: string;\n\tname?: string;\n\tblast?: boolean;\n\tdraft?: boolean;\n\trelations?: CampaignRealitives;\n\tarchived?: boolean;\n\tisActive?: boolean;\n\trecurDays?: number;\n\tscheduled?: number;\n\tcreated?: number;\n\tupdated?: number;\n\trecipe?: RecipeInfo;\n\tisLocked?: boolean;\n\tlockedReason?: string;\n\ttags?: string[];\n\n\tpendingApproval?: boolean; // ! added and used in dash\n\n\tlastMessage?: number;\n\tsummary?: CampaignStats;\n\tkey?: string;\n}\n\nexport type XLiteTemplate = {\n\tpriority?: number;\n\tinUse?: boolean;\n};\n\nexport type ChannelTemplate = {\n\tid: string;\n\tuserID: string;\n\tname: string;\n\tcreated: number;\n\tupdated: number;\n\tarchived: boolean;\n\tpushTemplate?: PushTemplate;\n\temailTemplate?: EmailTemplate;\n\ttemplates?: SMSTemplate;\n\tsmsTemplate?: SMSTemplate; // Can be in this form\n\tadTemplate?: AdTemplate;\n\tbrowserTemplate?: BrowserTemplate;\n\tsnailMailTemplate?: SnailMailTemplate;\n\tvoiceTemplate?: VoiceTemplate;\n};\n\nexport enum TimeUnit {\n\tDays = 0,\n\tHours,\n}\n\nexport interface CampaignGroup {\n\tcampaigns?: string[];\n\tid?: string | -1;\n\tuserID?: string;\n\tname?: string;\n\tpath?: string;\n\tcreated?: number;\n\tupdated?: number;\n\tarchived?: boolean;\n\tsplitCampaigns?: boolean;\n\tkey?: ID;\n}\n\ninterface CampaignChangeSet extends ChangeSet {\n\tdiffRetailer?: Campaign;\n\tdiffBrand?: Campaign;\n}\n\nexport interface GeoLoc {\n\tuuid: any;\n\tname: string;\n\tlat: number;\n\tlng: number;\n\tradius: number;\n}\nexport interface Triggers {\n\tabandonedCart?: boolean;\n\tpostSale?: boolean;\n\tgeoFence?: boolean;\n\tgeoFenceConditions?: {\n\t\tboundaries: GeoLoc[];\n\t\tfrequencyCap: number;\n\t};\n\tbirthday?: boolean;\n}\n\nexport interface DateRange {\n\tstart?: number;\n\tend?: number;\n\tactive?: boolean;\n}\nexport interface SendWindow {\n\tstart?: number;\n\tend?: number;\n}\nexport type LandingType = 'HTML' | 'RAW';\n\nexport interface SMSTemplate {\n\toptionType?: CampaignBuilderTextOption | undefined;\n\tagnostic?: boolean;\n\tbody?: string;\n\ttimezone?: string;\n\tmediaURL?: string;\n\tmediaContentType?: string;\n\tmsgContainer?: string;\n\tinUse?: boolean;\n\tpriority?: number;\n\tscheduled?: number;\n\trecurDays?: number;\n\tcapPerDay?: number;\n\tisMMS?: boolean;\n\tmmsMediaURL?: string;\n\tlandingHTML?: string;\n\tlandingDesign?: any;\n\tlandingType?: LandingType;\n\tmessageExpiry?: number; // used only for allowing the template to be saved if this is the only thing changed. real state sent to server is in Campaign object\n\tmessageExpiryUnit?: TimeUnit; // used only for allowing the template to be saved if this is the only thing changed. real state sent to server is in Campaign object\n\tdynamicContent?: DynamicContentFilter;\n\tmmsOnly?: boolean;\n\tslugs?: string[];\n}\n\nexport interface AdTemplate {\n\tthirdParty?: boolean;\n\tretailerTarget?: any;\n\tbudget?: number;\n\tadsPerCustomer?: number;\n\tclickthrough?: string;\n\tmediaURL?: string;\n\tmediaContentType?: string;\n\tmedia?: { [size: string]: { url?: string; contentType?: string } };\n\tlearn?: string;\n\tshop?: string;\n\tlargeBanner?: boolean;\n\tshowButtons?: boolean;\n\tshopButtonText?: string;\n\tshopButtonStyle?: string;\n\tlearnButtonText?: string;\n\tlearnButtonStyle?: string;\n\tinUse?: boolean;\n\tpriority?: number;\n\tadSize?: 'app' | 'tv';\n}\n\nexport interface AdTemplateOut extends AdTemplate {\n\tuserID: string;\n\tcmpID: string;\n\tpublisherUserID: string;\n\timpressionTracker: string;\n}\n\nexport interface EmailTemplate {\n\tfromName?: string;\n\tpreheader?: string;\n\thtml?: string;\n\tsubject?: string;\n\tfrom?: string;\n\tjson?: any;\n\tinUse?: boolean;\n\tpriority?: number;\n\tcustom?: boolean;\n\tdynamicContent?: DynamicContentFilter;\n\tslugs?: string[];\n}\n\nexport interface BrowserTemplate {\n\ttitle?: string;\n\tbody?: string;\n\tlink?: string;\n\tmediaURL?: string; // Set when Get is called if not using media lib\n\tmediaContentType?: string; // Set when Get is called if not using media lib\n\tinUse?: boolean;\n\tpriority?: number;\n}\n\nexport interface PushTemplate {\n\ttitle?: string;\n\tbody?: string;\n\tmediaURL?: string; // Set when Get is called if not using media lib\n\tmediaContentType?: string; // Set when Get is called if not using media lib\n\tinUse?: boolean;\n\tpriority?: number;\n}\nexport interface SnailMailTemplate {\n\tfront?: string; // html string, lob template id, or remote file url\n\tback?: string; // html string, lob template id, or remote file url\n\tsize?: string; // \"4x6\" \"6x9\" \"6x11\"\n\tinUse?: boolean;\n\tpriority?: number;\n\tcurrentResident?: boolean;\n}\n\nexport interface VoiceTemplate {\n\tttv?: string;\n\tvoiceFile?: string;\n\tinUse?: boolean;\n\tpriority?: number;\n\tlo?: string;\n\tdiscountTemplate?: string;\n}\n\nexport interface UnsubChannels {\n\ttext?: number;\n\temail?: number;\n\tbrowser?: number;\n}\n\nexport interface CampaignStats {\n\tlinkClicks: { [key: string]: number };\n\tconversionData: ConversionValue[];\n\tconversionValueData: GeoValue[];\n\tunsubCategories: GeoValue[];\n\tmsgsSent: number;\n\tmsgsReceived: number;\n\tclicks: number;\n\tlpClicks: number;\n\tredemptions: number;\n\tdiscountRedemptions: number;\n\tunsubscribes: number;\n\tunsubChannels: {\n\t\ttext: number;\n\t\temail: number;\n\t\tbrowser: number;\n\t\tvoice: number;\n\t};\n\tbrandConvs: number;\n\tconvs: number;\n\tuniqueClicks: number;\n\tuniqueLPClicks: number;\n\tmmsCost: number;\n\tsmsCost: number;\n\trevenue: number;\n\tbrandRevenue: number;\n\tretailRevenue?: number;\n\tuniqueUsers: number;\n\tremainingUsers: number;\n\ttotalEligible: number;\n\tmsgsErrored: number;\n\tinserted: number;\n\temailsSent: number;\n\temailsErrored: number;\n\temailOpens: number;\n\tuniqueEmailOpens: number;\n\tuniqueEmails: number;\n\temailCost: number;\n\n\tbrowsersSent: number;\n\tbrowsersErrored: number;\n\tuniqueBrowsers: number;\n\tbrowserCost: number;\n\n\tthirdPartyAdsSent: number;\n\tthirdPartyAdsErrored: number;\n\tthirdPartyAdsCost: number;\n\tuniqueThirdPartyAds: number;\n\n\tadsCost: number;\n\tadsSent: number;\n\tadsErrored: number;\n\tuniqueAds: number;\n\n\tpushesSent: number;\n\tpushesErrored: number;\n\tuniquePushes: number;\n\tpushCost: number;\n\tpushOpens: number;\n\tuniquePushOpens: number;\n\n\tsnailMailMailed: number;\n\tsnailMailInTransit: number;\n\tsnailMailInLocalArea: number;\n\tsnailMailDelivered: number;\n\tsnailMailReRouted: number;\n\tsnailMailReturnedToSender: number;\n\tsnailMailCost: number;\n\n\tcallsSent: number;\n\tcallsErrored: number;\n\tuniqueCalls: number;\n\tcallsCost: number;\n\tcallsAnswered: number;\n\tcallCompleted: number;\n\tcallsVM: number;\n\tavgCallDuration: number;\n\n\tusername?: string;\n\n\tbrandCost?: number;\n\ttotalCost?: number;\n\n\tmmsCredits?: number;\n\tsmsCredits?: number;\n\temailCredits?: number;\n\tbrowserCredits?: number;\n\tsnailMailCredits?: number;\n\tpushCredits?: number;\n\tcallCredits?: number;\n\n\tcampaignID?: string;\n\tcampaignName?: string;\n\trecipe?: RecipeInfo;\n}\nexport interface ConversionValue {\n\tlabel?: ConversionAction;\n\tcount?: number;\n\trevenue?: number;\n\tpercentage?: number;\n}\n\nexport interface GeoValue {\n\tlabel?: string;\n\tsubLabel?: string;\n\tcount?: number;\n\trevenue?: number;\n\tperc?: number;\n}\n\nexport interface SendgridVerified {\n\tdomain: string;\n\tsubdomain: string;\n\tsender: string;\n}\n\nexport interface SendgridDomainCheck {\n\tverified: SendgridVerified[];\n\temailReady: boolean;\n}\n\nexport interface DynamicContentFilter {\n\tstore?: number[];\n\tcategories?: string[];\n\tquantityMin?: number;\n\tblockCount?: number;\n\tpriceMin?: number;\n\tpriceMax?: number;\n\tcontentType?: 'mostPurchased' | 'abandoned' | 'recommended' | 'all';\n\tbrands?: string[];\n\tbrandPerc?: number;\n}\n\nexport type LanguageType = {\n\tkey: string; // key\n\tlngc: string; // languageCode\n\tg: string; // gender\n\tcn: string; // countryName\n\tlngn: string; // languageName\n};\n\nexport type CampaignTag = {\n\tid: string;\n\tname: string;\n\tcolor: string;\n};\n\nexport type ReportConversion = {\n\tchannel: string;\n\tproducts: string[];\n\tcategories: string[];\n\tonline: boolean;\n\tgrossRev: number;\n\tnetRev: number;\n};\n\nexport type CleanedReportConversion = {\n\tchannel: string;\n\tproducts: string;\n\tcategories: string;\n\tonline: boolean;\n\tgrossRev: number;\n\tnetRev: number;\n};\n\nexport type CampaignQueueSnapshot = {\n\tcontact: Contact[];\n\tsent: number;\n\ttotal: number;\n};\n","import React from 'react';\n\nimport { GDataFilter } from '../components/global/GTable';\nimport utils from '../helpers/utils';\nimport { GeoValue } from './campaigns';\nimport { ColumnType } from 'antd/lib/table';\nimport { MessageCardConfig } from '../pages/wallet/assets/walletStyles';\n\nexport interface Source {\n\tavatar: string;\n\ttitle: string;\n\terrors: string[];\n\tmid: number;\n\tusersSourced: number;\n\tusersSourcedLast24: number;\n};\n\nexport interface Destination {\n\tavatar: string;\n\ttitle: string;\n\t// usersPushedLast24Raw: integrations.Contact[];\n\terrors: string[];\n\tusersPushed: number;\n\tusersSuppressed: number;\n\tusersPushedLast24: number;\n\tmid: number;\n};\n\nexport interface MissionControl {\n\tnextSiftRunTime: string;\n\tdestinations: Destination[];\n\taudienceIDs: string[];\n\tsources: Source[];\n\trecipeIDs: string[];\n\tpersonas: number;\n\tpersonasAnon: number;\n\tpersonasRestricted: number;\n\taudiences: number;\n};\n\nexport interface LeakySnapshot {\n\tHighLevel: { [key: string]: LifecycleData };\n\tRetailerLevel: { [key: string]: LeakyLevels };\n}\n\nexport interface LeakyLevels {\n\tuid: string;\n\tname: string;\n\tformatted: LifecycleFormatted;\n\tData: { [key: string]: LifecycleData };\n\tStoreBreakdown: { [key: string]: { [key: string]: LifecycleData } };\n}\n\nexport interface LifecycleFormatted {\n\tleakyBucketBar: any[]\n\tlineEarned: any[]\n\tlifecycleConfig: LifecycleConfig\n}\n\nexport interface LifecycleConfig {\n\tlifecycle: string;\n\tActive: number;\n\tactiveRev: number;\n\tactiveCount: number;\n\tactiveColor: string;\n\tChilling: number;\n\tchillingRev: number;\n\tchillingCount: number;\n\tcoolingColor: string;\n\tAbsent: number;\n\tabsentRev: number;\n\tabsentCount: number;\n\tatRiskColor: string;\n\t'Highly Absent': number;\n\thighlyAbsentRev: number;\n\thighlyAbsentCount: number;\n\thighlyAtRiskColor: string;\n\tGone: number;\n\tgoneRev: number;\n\tgoneCount: number;\n\tlostColor: string;\n\ttotalCustomers: number;\n\ttotalNew: number;\n\ttotalLost: number;\n\ttotalWinback: number;\n\ttotalAtRisk: number;\n\twinbackRatio: string;\n\twinbackPercentage: number;\n\ttotalRevenueEarned: number;\n}\n\nexport interface LifecycleData {\n\tlifecycleDistribution: GeoValue[];\n\tdaily: DailyLeak[];\n}\n\nexport interface DailyLeak {\n\tdate: string;\n\tnew: number;\n\tatRisk: number;\n\tlost: number;\n\twinBack: number;\n\trevenue: number;\n}\n\n// /invite/signup ep body\nexport interface FreeSignupUser {\n\ttoken: string\n\temail: string\n\tpassword: string\n\tname: string\n}\n\nexport interface OverrideContact {\n\t// [index: string]: string | number | boolean | undefined;\n\tfirstName?: string;\n\tlastName?: string;\n\tfavoriteStoreID?: number;\n\thomePhone?: string;\n\tmobilePhone?: string;\n\temail?: string;\n\tbirthdate?: number;\n\tdriversLicense?: string;\n\tmatchKey?: string;\n\toptOut?: boolean;\n\tloyalty?: boolean;\n\tts?: number; // set by backend\n};\n\nexport interface SendGridDNSObj {\n\tvalid: boolean;\n\ttype: string;\n\thost: string;\n\tdata: string;\n};\n\nexport interface SendGridDNS {\n\tmail_cname: SendGridDNSObj;\n\tdkim1: SendGridDNSObj;\n\tdkim2: SendGridDNSObj;\n};\n\nexport interface SendGridDomain {\n\tid: number;\n\tuser_id: number;\n\tsubdomain: string;\n\tdomain: string;\n\tips: string[];\n\tcustom_spf: boolean;\n\tlegacy: boolean;\n\tautomatic_security: boolean;\n\tvalid: boolean;\n\tcustom_dkim_selector: string;\n\tdns: SendGridDNS;\n};\n\nexport interface SendGridSender {\n\tid: number;\n\tnickname: string;\n\tfrom_email: string;\n\tfrom_name: string;\n\treply_to: string;\n\treply_to_name: string;\n\taddress: string;\n\taddress2: string;\n\tstate: string;\n\tcity: string;\n\tzip: string;\n\tcountry: string;\n\tverified: boolean;\n\tlocked: boolean;\n};\n\nexport interface SendGridUser {\n\tdomain?: SendGridDomain;\n\tsender?: SendGridSender;\n\tcreated?: number;\n\tupdated?: number;\n};\n\nexport interface SendGridWarning {\n\tdomain: string;\n\twarning: string;\n};\n\nexport interface SendGridDomainAuthReq {\n\tdomain: string;\n\tsubdomain?: string;\n\tusername?: string;\n\tips?: string[];\n\tcustom_spf?: boolean;\n\tautomatic_security?: boolean;\n\tcustom_dkim_selector?: string;\n};\n\nexport interface Message {\n\tcode: string;\n\thost: string;\n\tuserID: string;\n\tcampaignID: string;\n\tcontactID: string;\n\tfrom: string;\n\tmessage: string;\n\textra: string;\n\tSID?: string;\n\tbody?: string;\n\tcarrier?: string;\n\tcmpID?: string;\n\tcontentType?: string;\n\tdirection?: string;\n\tdiscountTemplate?: boolean;\n\tisBrowser: boolean;\n\thungup: \"callee\" | \"caller\"\n\tisEmail: boolean;\n\tisMMS: boolean;\n\tisPush: boolean;\n\tmediaURL: string;\n\tplatform: string;\n\tprice: string;\n\tsegments: number;\n\tsent: boolean;\n\ttimestamp: number;\n\tto: string;\n\ttwilioStatus: string;\n\tunshorty: string;\n\terrorMsg?: string;\n\tmeta?: string\n\ttitle?: string\n\tpublisherUserID?: string\n\tbrandBillingID?: string\n\terrorCode?: number\n\tisAd?: boolean\n\tthirdParty?: boolean\n\tsnailMail?: boolean\n\ttrs?: boolean\n\n\tconfig?: MessageCardConfig\n}\n\nexport type InboxMessage = Message & {\n\tmediaURL?: string;\n\tcontentType?: string;\n}\n\nexport interface TableColumn<T = any> extends ColumnType<T> {\n\t// align?: 'left' | 'right' | 'center'   // The specify which way that column is aligned\t\t\n\t// className?: string   // The className of this column\tstring\t-\t\n\t// colSpan?: number   // Span of this column's title\tnumber\t-\t\n\t// dataIndex?: string | string[]   // Display field of the data record, support nest path by string array\tstring | string[]\t\n\t// defaultFilteredValue?: string[]\t   // Default filtered values\tstring[]\t\n\t// filterResetToDefaultFilteredValue?: boolean  // Click the reset button, whether to restore the default filter\tboolean\tfalse\t\n\t// defaultSortOrder?: 'ascend' | 'descend'   // Default order of sorted values\tascend | descend\t\n\t// ellipsis?: any   // The ellipsis cell content, not working with sorter and filters for now.\n\t// tableLayout?: any   // would be fixed when ellipsis is true or { showTitle?: boolean }\tboolean | {showTitle?: boolean }\tfalse\tshowTitle: 4.3.0\n\t// filterDropdown?: any   // Customized filter overlay\tReactNode | (props: FilterDropdownProps) => ReactNode\t\n\t// filterDropdownOpen?: any   // Whether filterDropdown is visible\tboolean\t\n\t// filtered?: any   // Whether the dataSource is filtered\tboolean\tfalse\t\n\t// filteredValue?: any   // Controlled filtered value, filter icon will highlight\tstring[]\t\n\t// filterIcon?: any   // Customized filter icon\tReactNode | (filtered: boolean) => ReactNode\t\n\t// filterMultiple?: any   // Whether multiple filters can be selected\tboolean\ttrue\t\n\t// filterMode?: any   // To specify the filter interface\t'menu' | 'tree'\t'menu'\t4.17.0\n\t// filterSearch?: any   // Whether to be searchable for filter menu\tboolean | function(input, record):boolean\tfalse\tboolean:4.17.0 function:4.19.0\n\t// fixed?: 'left' | 'right'   // (IE not support) Set column to be fixed: true(same as left) 'left' 'right'\tboolean | string\tfalse\t\n\t// responsive?: any   // The list of breakpoints at which to display this column. Always visible if not set.\tBreakpoint[]\t4.2.0\n\t// shouldCellUpdate?: any   // Control cell render logic\t(record, prevRecord) => boolean\t4.3.0\n\t// showSorterTooltip?: any   // If header show next sorter direction tooltip, override showSorterTooltip in table\tboolean | Tooltip props\ttrue\t\n\t// sortDirections?: any   // Supported sort way, override sortDirections in Table, could be ascend, descend\tArray\t[ascend, descend]\t\n\t// sortOrder?: any   // Order of sorted values: 'ascend' 'descend' false\tboolean | string\t\n\t// title?: any   // Title of this column\tReactNode | ({ sortOrder, sortColumn, filters }) => ReactNode\t\n\t// width?: any   // Width of this column (width not working?)\tstring | number\t\n\t// onCell?: any   // Set props on per cell\tfunction(record, rowIndex)\t\n\t// onFilter?: any   // Function that determines if the row is displayed when filtered\tfunction(value, record) => boolean\t\n\t// onFilterDropdownVisibleChange?: any   // Callback executed when filterDropdownVisible is changed\tfunction(visible) {}\t\n\tonHeaderCell?: any   // Set props on per header cell\tfunction(column)\n\n\tkey?: string   // Unique key of this column, you can ignore this prop if you've set a unique dataIndex\tstring\t\n\trender?: (text: any, record: T, index: number) => React.ReactNode;  // Renderer of the table cell. The return value should be a ReactNode\tfunction(text, record, index) {}\t\n\tshown?: boolean // * added by us to filter cols\n\tposition?: number // * added by us to pos cols\n\tsort?: boolean | string // * added by us to pos cols\n\tuplift?: boolean\n\n\tonFilter?: (value: string | number | boolean, record: T) => boolean;\n\n\tchildren?: TableColumn[]\n\n\t// ! used by GTable\n\ttitleStyle?: React.CSSProperties\n\tdataFilter?: GDataFilter\n\n\tEXPAND_COLUMN?: boolean\n}\n// export const getColumn = (title: string | React.ReactNode, render: (record: any) => React.ReactNode | any, cfg?: TableColumn) => {\n// \tcfg = { ...cfg }\n// \tif (!cfg.key) cfg.key = utils.strify(title)\n// \treturn ({ title, render, ...cfg }) as any\n// } \n\nexport const getColumn = <T = any>(\n\ttitle: string | React.ReactNode,\n\trender: (record: T) => React.ReactNode | any,\n\tcfg?: TableColumn<T>\n): TableColumn<T> => {\n\tcfg = { ...cfg };\n\tif (!cfg.key) cfg.key = utils.strify(title);\n\treturn { title, render, ...cfg };\n};\n\n\nexport function getColumns<T>(defs: Array<TableColumn<T>>): TableColumn<T>[] {\n\treturn defs\n}","import { CSSProperties } from 'react';\n\nimport { WalletStyles } from '../pages/wallet/assets/walletStyles';\nimport { Role } from './acl';\nimport * as geo from './geo';\nimport * as twilio from './twilio';\nexport const Industries = {\n\tcannabis: 'Cannabis',\n\tbrewery: 'Alcohol',\n\tcoffee: 'Coffee',\n\tnightlife: 'Nightlife',\n\tpolitical: 'Political',\n\tentertainment: 'Entertainment',\n\tfirearms: 'Firearms',\n\tother: 'Other',\n} as const;\nexport type Industry = keyof typeof Industries;\n\nexport interface Profile {\n\temail?: string;\n\tcc?: string[];\n\tphone?: string;\n\tavatar?: string;\n\tname?: string;\n\twebsite?: string;\n\tpassword?: string;\n\tisSub?: boolean;\n\tsubType?: string;\n\tmemberType?: string;\n\tindustry?: Industry;\n\tsubUserTypes?: { [key: string]: string };\n\ttimezone?: string;\n\tnotes?: string;\n\tsubUsers?: string[];\n}\n\nexport interface AllowedIPs {\n\tbudtender?: string[];\n\tglobal?: string[];\n}\n\nexport interface GoogleProfile {\n\tuuid: string;\n\temail: string;\n\tdomain?: string;\n\tname?: string;\n\tverified?: boolean;\n}\n\nexport interface MicrosoftProfile {\n\tuuid: string;\n\temail: string;\n\tname: string;\n}\n\nexport interface RebirthStatus {\n\tuid: string;\n\tstatus: 'success' | 'error' | 'default' | 'processing' | 'warning';\n\tdomain: boolean;\n\tlastRebirth: number;\n\trebirthType: string;\n}\n\nexport interface AccountCancellation {\n\tuid: string;\n\trequester: string;\n\tconfirmer: string;\n\treason: string;\n\trequested: number;\n\tconfirmed: number;\n}\n\nexport interface Login {\n\tid: string; // account uid\n\temail: string;\n\tpassword?: string;\n\ttokenKey?: string;\n\tsubUser?: boolean;\n\tlastLogin?: number;\n\tsso?: 'google' | 'microsoft';\n\tglobalID?: string;\n\tgoogle?: GoogleProfile;\n\tmicrosoft?: MicrosoftProfile;\n\trole: Role;\n\tphone?: string;\n\tname?: string;\n\ttimezone?: string;\n\tupdated?: number;\n\tdisabled: boolean;\n}\n\nexport interface TokenSSO {\n\tprovider: 'google' | 'microsoft';\n\tvalue: string;\n}\n\nexport interface Onboarding {\n\tfirstStore: number;\n\tfinished: number;\n\tfinishedSignup: number;\n\tsteps?: { [key: string]: boolean };\n\tconnections?: { [key: string]: string };\n\tlastStep?: string;\n}\n\nexport interface Address {\n\tzip?: string;\n\tcity?: string;\n\tstate?: string;\n\tcountry?: string;\n}\n\nexport interface MicrosoftConfig {\n\tenabled: boolean;\n\tdomain: string;\n}\n\nexport interface GoogleConfig {\n\tenabled: boolean;\n\tdomain: string;\n}\n\nexport interface ImpliedConsent {\n\tenabled?: boolean;\n\tstart?: number;\n}\n\nexport interface User {\n\tid?: string;\n\n\toptOutSpamReports?: boolean;\n\tnickname?: string;\n\tagencyID?: string;\n\ttype?: string;\n\tisIO?: boolean;\n\tcreated?: number;\n\tlastUpdated?: number;\n\tprofile?: Profile;\n\tactive?: boolean;\n\tfreqCap?: boolean;\n\tprobation?: boolean;\n\tinvoiceFreeze?: boolean;\n\tarchived?: boolean;\n\twipedDomain?: boolean;\n\thasDynamicContent?: boolean;\n\tdispenseOrgID?: string;\n\tmanualNums?: boolean;\n\thasDynamicAbandonCart?: boolean;\n\thasDynamicContentViaAPI?: boolean;\n\t// chargebee?: Customer;\n\tadomain?: string;\n\trdomains?: string[];\n\thidePointsInWallet?: boolean;\n\tpointsBlacklist?: string;\n\tapiKey?: string;\n\tsendgridKey?: string;\n\tcurrency?: string;\n\tshortyPrefix?: string;\n\tverifiedOptin?: boolean;\n\tdisableShorty?: boolean;\n\tinfobipCmpID?: string;\n\tenableMessageInbox?: boolean;\n\tskipProviderRestrictions?: boolean;\n\tautoResponder?: { [key: string]: string };\n\tmacroFallback?: { [key: string]: string };\n\toptInAttempts?: number;\n\taddress?: Address;\n\tapprovedTelnyxCampaign?: string;\n\tcontractStart?: number;\n\t// importers\n\t// exporters\n\t// extensions\n\tcndResp?: { [key: string]: string };\n\tmaxMTU?: number;\n\tspendByDay?: Record<string, number>;\n\ttop20PercentileSpend?: number;\n\toptinMessage?: string;\n\tpostOptinMessage?: string;\n\tmsgContainer?: string;\n\twalletLoginMessage?: string;\n\treplySTOP?: string;\n\tnameMacroFallback?: string;\n\tmmsLogo?: boolean;\n\tnameDOBMerge?: boolean;\n\tpostSaleMessage?: string;\n\tloyaltyCutoff?: number;\n\tlastInvoiceTime?: number;\n\n\tfees?: Fees;\n\tfeesV2?: FeesV2;\n\tpendingFeesV2?: FeesV2;\n\tpendingPlanRequested?: number; // Time the pending plan was requested\n\tpendingMessaging?: string;\n\tmsgingPlanRequested?: number; // Time the messaging plan was requested\n\n\t// invoicesList?: billing.InvoiceResponseData;\n\t// billing?: billing.CustomerData;\n\tsubType: 'freemium' | 'brand' | 'retail' | 'vertical' | 'sandbox';\n\tsignupNum?: twilio.IncomingPhoneNumber;\n\ttelnyxSignup?: string;\n\tstores?: Store[];\n\tmetadata?: {\n\t\thasNativeApp?: boolean;\n\t\thasEcommerce?: boolean;\n\t};\n\tonboarding?: Onboarding;\n\tlastImpor?: number;\n\tlastCapture?: number;\n\tlastBQ?: number;\n\tlastAccess?: number;\n\tutmTags?: boolean;\n\tallowAds?: boolean;\n\tallowCollectibleCodes?: boolean;\n\tdisableWalledGarden?: boolean;\n\tdisableAnonLoyalty?: boolean;\n\toptOutBounces?: boolean;\n\thasCustomApp?: boolean;\n\tdisableBlockAdjustments?: boolean;\n\tenableRelativeExpirationEarn?: boolean;\n\trequirePhoneCaptcha?: boolean;\n\tmessage2FA?: boolean;\n\tmessageDOB?: boolean;\n\tmasterVerification: boolean;\n\tmasterVerificationPin: any;\n\tpos?: string;\n\treferredBy?: string;\n\tsalesRep?: string;\n\tlastAudienceRun?: number;\n\tmicrosoft?: MicrosoftConfig;\n\tgoogle?: GoogleConfig;\n\tbrandOptOuts?: string[];\n\timpliedConsent?: ImpliedConsent;\n\n\treportStorage?: { [k: string]: string };\n\treportStoragePersona?: { [k: string]: string };\n\treportStorageDebug?: { [k: string]: string };\n\n\tnewWebWallet?: boolean; // ! To use legacy or new wallet, should be true by default for new accounts\n\n\tdisableImplicitEmail?: boolean;\n\tshowPerStoreBilling?: boolean;\n\n\texcludedFromCmpApprovalNotifs: string[];\n\n\tsettingsVersion?: number;\n\tloyaltyAppVersion?: number;\n\tsignupFormsVersion?: number;\n\tapprovedTelnyxCampaignTS?: number; // When Telnyx campaign was approved\n\tinfobipCmpIDTS?: number; // When Infobip campaign was approved\n\n\tbilling?: any; //billing *billing.CustomerData\n\tchargebee?: any; //chargebee *customer.Customer\n\tbrandAliases?: BrandTargets; //brandTargets otk.Set\n\tbtByRegion?: any; //btByRegion map[string]otk.Set\n\tthirdPartyStores?: any; //thirdPartyStores map[string][]int\n\tinvoiceCSV?: any; //invoiceCSV map[string]int64\n\tpr?: any; //pr *Priority\n\toptinImage?: string; //optinImage string\n\ttcmpID?: any; //tcmpID string\n\texporters?: any; //exporters integrations.Exporters\n\textensions?: any; //extensions integrations.Extensions\n\timporters?: any; //importers integrations.Importers\n\tinvoicesList?: any; //invoicesList []*billing.InvoiceResponseData\n\ttotalRevenue?: number; //totalRevenue float64\n\tlastBrandTargetUpdate?: number; //lastBrandTargetUpdate int64\n\tlastRebirth?: number; //lastRebirth int64\n\tfrsExport?: number; //frsExport int64\n\tlastProbation?: number; //lastProbation int64\n\tlastSpotlight?: number; //lastSpotlight int64\n\trefreshTS?: number; //refreshTS int64\n\trefreshDomain?: boolean; //refreshDomain bool\n\trefreshPhones?: boolean; //refreshPhones bool\n\tallowBanned?: boolean; //allowBanned bool\n\tblockDataSharing?: boolean; //blockDataSharing bool\n\tbrandStoresForMarketAnalytics?: boolean; //brandStoresForMarketAnalytics bool\n\n\tnextRefreshFree?: boolean; //nextRefreshFree int64\n\n\tsandboxTerms?: SandboxTerms;\n}\n\nexport type SandboxTerms = {\n\ttimestamp?: number;\n\tacceptedBy?: string;\n};\n\nexport type BrandTargets = { [key: string]: { [k: string]: string[] } };\n\nexport interface StoreReviewTemplate {\n\tgoogle?: string;\n\tfacebook?: string;\n\tfacebookPageID?: string;\n\tleafly?: string;\n\tweedmaps?: string;\n\tinstagram?: string;\n\ttwitter?: string;\n\tyelp?: string;\n\tappleStore?: string;\n\tgooglePlay?: string;\n}\n\nexport interface PublicStore {\n\taddr?: geo.MailingAddress;\n\tstate: string;\n\tname: string;\n\tnickname: string;\n\tphone: string;\n\tisBrandStore?: boolean;\n\tonlineShopURL: string;\n\tcustomURL: string;\n\tcustomURLAndroid: string;\n\tembeddedURL: string;\n\tembeddedMedURL: string;\n\tdisclaimer?: string;\n\tcity: string;\n\tcountry: string;\n\tzipCode: string;\n\tid: number;\n}\n\nexport interface Store {\n\taddr?: geo.MailingAddress;\n\tsignupNumber?: twilio.IncomingPhoneNumber;\n\tsourceMapping?: { [key: string]: string[] };\n\ttollFree?: twilio.IncomingPhoneNumber;\n\treviewLinks?: StoreReviewTemplate;\n\tnotes?: string;\n\tavatar?: string;\n\tuserID?: string;\n\tnickname?: string;\n\tbrandNickname?: string;\n\tdomain?: string;\n\tonlineShopURL?: string;\n\tcustomURL?: string;\n\tcustomURLAndroid?: string;\n\tembeddedURL?: string;\n\tembeddedMedURL?: string;\n\tphone?: string;\n\tvenueID?: string;\n\tglobalID?: string;\n\tname?: string;\n\ttelnyxSignup?: string;\n\temail?: string;\n\tdisclaimer?: string;\n\tscraperMapping?: string;\n\trating?: number;\n\tranking?: number;\n\tid?: number;\n\tcreated_at?: number;\n\tsignupViaPhone?: boolean;\n\toptInQueue?: boolean;\n\tllOptInQueue?: boolean;\n\talleavesOptInQueue?: boolean;\n\tmeadowOptInQueue?: boolean;\n\tarchived?: boolean;\n\tisBrandStore?: boolean;\n\thiddenFromForms?: boolean;\n\tdynamicContentCustomURL?: boolean;\n\n\tcrewCount?: number;\n\tgeneralManager?: string;\n}\n\nexport interface StoreMappings {\n\t[source: string]: string[];\n}\n\nexport interface TelenexPhones {\n\tID: string;\n\tmid: string;\n\tnumbers: TelenxPhone[];\n\tremoved: TelenxPhone[];\n\tcreated: number;\n\tupdated: number;\n}\nexport interface TelenxPhone {\n\tid: string;\n\tphone_number: string;\n\tremoveTS: TelenxPhone[];\n}\n\nexport interface AppSettings extends AppSettingsContent, WalletStyles {\n\tname?: string;\n\tallowChangeStore?: boolean;\n\tandroid?: {\n\t\tdesc?: string;\n\t\ticon?: string;\n\t\tname?: string;\n\t\tsvcAcc?: string;\n\t\tpreviewImages?: string[];\n\t};\n\tapple?: {\n\t\tdesc?: string;\n\t\ticon?: string;\n\t\tkeywords?: string;\n\t\tname?: string;\n\t\tpreviewImages?: string[];\n\t\tsubtitle?: string;\n\t\tappid?: string;\n\t\tteamid?: string;\n\t};\n\tstoreStyles?: {\n\t\t[storeID: string | number]: AppSettingsContent;\n\t};\n\tverbiage?: {\n\t\t[key: string]: string;\n\t};\n\tshowPromptHomeScreen?: boolean;\n\tprizeWheel?: PrizeWheelSettings;\n}\n\nexport interface AppSettingsContent {\n\tbrand?: {\n\t\tbgImage?: string[];\n\t\tcover?: string;\n\t\ticonColor?: string;\n\t\tloading?: string;\n\t\tlogo?: string;\n\t\tsplash?: string;\n\t};\n\thideCoverAvatarLogo?: boolean;\n\thideBrowser?: boolean;\n\tmsgBG?: string;\n\tborderColor?: string;\n\tbutton?: CSSProperties;\n\tbuttonDanger?: CSSProperties;\n\tbuttonDangerText?: CSSProperties;\n\tbuttonGhost?: CSSProperties;\n\tbuttonText?: CSSProperties;\n\tcaption?: CSSProperties;\n\tcollapse?: CSSProperties;\n\tconsentText?: string;\n\tcontainer?: CSSProperties;\n\tcustomURL?: string;\n\tmessageColor?: string;\n\tcustomURLAndroid?: string;\n\t// dangerButton?: CSSProperties\n\terror?: CSSProperties;\n\teulaURL?: string;\n\tfromEmail?: string;\n\th2?: CSSProperties;\n\ticon?: CSSProperties;\n\tinput?: CSSProperties;\n\tlink?: CSSProperties;\n\tnavBackgroundColor?: string;\n\tprivacyURL?: string;\n\tprogress?: any;\n\treferBox?: CSSProperties;\n\treferLink?: CSSProperties;\n\tsectionTitle?: CSSProperties;\n\tshopURL?: string;\n\tswitch?: CSSProperties;\n\ttermsURL?: string;\n\ttheme?: string;\n\ttitleColor?: string;\n\thideAddress?: boolean;\n\thideProfileAddress?: boolean;\n\thideDOB?: boolean;\n\tenableScanToPay?: boolean;\n\tshowGeneralInfo?: boolean;\n\thideOrderStore?: boolean;\n\thideOrderPrice?: boolean;\n\thideCall?: boolean;\n\thideCallStore?: true;\n\thideDirections?: boolean;\n\thideIcons?: boolean;\n\thideDiscountOpen?: boolean;\n\thideEmails?: boolean;\n\thideStores?: boolean;\n\thideAllDiscounts?: boolean;\n\thideFavStoreAddr?: true;\n\thideMessages?: boolean;\n\tshowDealsTab?: boolean;\n\thideOldMSGs?: string;\n\thidePoints?: boolean;\n\thideRAF?: boolean;\n\thideShop?: boolean;\n\thideSocial?: boolean;\n\thideDefFAQ?: boolean;\n\tredeemButtonText?: string;\n\tredeemInStoreText?: string;\n\tredeemTitle?: string;\n\tcontainerInternal?: CSSProperties;\n\tfaqs?: {\n\t\tbody?: string;\n\t\ttitle?: string;\n\t}[];\n\tmainBGColor?: string;\n\tghostButton?: CSSProperties;\n\traf?: CSSProperties;\n\treferbox?: CSSProperties;\n\trequiredSignupFields?: string[];\n\tsection?: CSSProperties;\n\tsignupAfterLogin?: boolean;\n\ttopBar?: CSSProperties;\n\tbuttonGhostText?: CSSProperties;\n\tinputV2?: CSSProperties;\n\trow?: CSSProperties;\n\tcol?: CSSProperties;\n\titem?: CSSProperties;\n\titemLeft?: CSSProperties;\n\titemRight?: CSSProperties;\n\tcollapseBody?: CSSProperties;\n\tcenteredView?: CSSProperties;\n\tmodalView?: CSSProperties;\n\tbody?: CSSProperties;\n\tround?: CSSProperties;\n\tfullWidth?: CSSProperties;\n\tcol60?: CSSProperties;\n\tcol50?: CSSProperties;\n\tcol20?: CSSProperties;\n\tp?: CSSProperties;\n\tbold?: CSSProperties;\n\tdiscTitle?: CSSProperties;\n\tts?: CSSProperties;\n\tbuttonTextSm?: CSSProperties;\n\ticonButtonText?: CSSProperties;\n\tbuttonDeleteText?: CSSProperties;\n\tbuttonCancelText?: CSSProperties;\n\tmodalTitle?: CSSProperties;\n\tmodalText?: CSSProperties;\n\txxsIcon?: CSSProperties;\n\txxsIconClr?: CSSProperties;\n\ticonButton?: CSSProperties;\n\tcaret?: CSSProperties;\n\tbuttonIcon?: CSSProperties;\n\tbuttonSignout?: CSSProperties;\n\tbuttonConfirmGreen?: CSSProperties;\n\tbuttonDelete?: CSSProperties;\n\tbuttonCancel?: CSSProperties;\n\tbackgroundImage?: CSSProperties;\n\tsplash?: CSSProperties;\n\tborderBottom?: CSSProperties;\n\tborder?: string;\n\n\thomeTab?: string;\n\tdealsTab?: string;\n\tmessageTab?: string;\n\tshopTab?: string;\n\tdiscoverTab?: string;\n\tsocialTab?: string;\n\tprofileTab?: string;\n\thelpTab?: string;\n\n\thideConnectTab?: boolean;\n\thideCustom?: boolean;\n\tshowPointsPill?: boolean;\n\n\tnavIcon?: string;\n\ttabTitle?: string;\n\tboldFont?: string;\n\tnavBG?: string;\n\n\thideOrders?: boolean;\n\tshowTopProducts?: boolean;\n\tshowOrderHistoryFeed?: boolean;\n\thideReorderButtons?: boolean;\n\n\t// ! Settings for the new skin\n\theaderIconColor?: string;\n\tmessageTabTitle?: string;\n\trewardTabTitle?: string;\n\tprofileTabTitle?: string;\n\tordersTab?: string;\n\tordersTabTitle?: string;\n\tfaqsTabTitle?: string;\n\n\tpopularTabTitle?: string;\n\tallProductsTabTitle?: string;\n\n\tmessageTabTitleReverse?: boolean;\n\tallProductsTabTitleReverse?: boolean;\n\n\tdontRedirectWebWalletShop?: boolean;\n\tdontRedirectWebWalletCustom?: boolean;\n\tforceCustomTabRedirect?: boolean;\n\tforceShopTabRedirect?: boolean;\n\n\thidePopularProductsSlider?: boolean;\n\thidePopularProductsTab?: boolean;\n\thideReviewStars?: boolean;\n}\n\nexport interface PrizeWheelSettings {\n\tenabled?: boolean;\n\tprimary?: string;\n\tsecondary?: string;\n\tnotchColor?: string;\n\twheelFrequency?: WheelFrequency;\n}\n\nexport interface WheelFrequency {\n\tfreq?: number;\n\tfreqUnit?: string;\n\tstart?: any;\n}\n\nexport interface LegacyUserSettings {\n\tuserName?: string;\n\n\tapp?: AppSettings;\n\thasNewSkin?: boolean; // ! Has this client switched over to using the new app skins\n\tdisableShopLock?: boolean;\n\tforceShop?: boolean;\n\thideLegacyWallet?: boolean; //! has this client switched over to the new wallet designs\n\tcss?: {\n\t\tbutton: string;\n\t\tdisabledButton: string;\n\t\th1: string;\n\t\toverride: string;\n\t\tprogressColor: string;\n\t\tprogressSuccessColor: string;\n\t};\n\tdata?: UserSettingsData;\n\tfonts?: string[];\n\ticons?: { [icon: string]: string };\n\ttoggles?: UserSettingsToggles;\n\n\tbyStore?: { [storeID: number | string]: LegacyUserSettings };\n}\n\nexport interface UserSettingsToggles {\n\tallowCustomStore?: boolean;\n\tdisableRedeemInStore?: boolean;\n\thideRedeemInStore?: boolean;\n\thideBar?: boolean;\n\thideLogo?: boolean;\n\thideName?: boolean;\n\thidePoints?: boolean;\n\tsquareLogo?: boolean;\n\thideBrowser?: boolean;\n\tenablePin?: boolean;\n}\n\nexport interface UserSettingsData {\n\tname?: string;\n\tnotice?: string;\n\taddrLabel?: string;\n\tcaptchaSubmit?: string;\n\tcaptchaText?: string;\n\tcover?: string;\n\tlogo?: string;\n\tmmsLogo?: string;\n\tpointsAlias?: string;\n\tstoreShopURL?: string;\n\tredeemInStoreText?: string;\n\tredeemTitle?: string;\n}\n\nexport interface Fees {\n\t'0to10k'?: number;\n\t'10to20k'?: number;\n\t'20to40k'?: number;\n\t'40to100k'?: number;\n\t'100to200k'?: number;\n\t'200k'?: number;\n\t'400k'?: number;\n\t'address'?: geo.MailingAddress;\n\t'chargePerCPMAds'?: number;\n\t'chargePerSentMMS'?: number;\n\t'chargePerSentEmail'?: number;\n\t'chargePerSentBrowser'?: number;\n\t'chargePerSentPush'?: number;\n\t'chargePerSentSnailMail'?: number;\n\t'chargePerReceivedMMS'?: number;\n\t'chargePerSentSMS'?: number;\n\t'chargePerReceivedSMS'?: number;\n\t'chargePerStoreLicense'?: number;\n\t'chargePerStoreManagedService'?: number;\n\t'premiumSupportCharge'?: number;\n\t'premiumSupportPlusCharge'?: number;\n\t'brandLicenseCharge'?: number;\n\t'nativeAppCharge'?: number;\n\t'chargePerNumber'?: number;\n\t'chargePerDomain'?: number;\n\t'chargePerCallMinute'?: number;\n\t'nativeAppStartDate'?: number;\n\t'flatFee'?: number;\n\t'isFranchise'?: boolean;\n\t'transactionPricing'?: boolean;\n\t'firstMonthTransactions'?: number;\n\t'firstMonthStores'?: number;\n\t'billingEmail'?: string;\n\t'coupon'?: string;\n\t'name'?: string;\n\t'currency'?: string;\n\t'ccEmails'?: string[];\n\t'planType'?: number;\n\t'billingCreation'?: number;\n\t'ecommStores'?: number;\n\t'ecommLicenseCharge'?: number;\n}\n\nexport interface FeesV2 {\n\taddress?: geo.MailingAddress;\n\tpackages?: Packages;\n\tbillingEmail?: string;\n\tname?: string;\n\tccEmails?: string[];\n\tbundle?: BundleTypes;\n\tmessaging?: MessagingCreditPlans; // Messaging credit plan\n\tmessagingDefaults?: MessagingDefaults; // Number of credits for each messaging type\n\n\tbillingCreation?: number;\n\tcontractStart?: number;\n\ttermLength?: number; // Days\n\n\tnativeAppStartDate?: number;\n\tnativeAppTermLength?: number;\n\n\tcoupon?: string;\n\n\tecommStores?: number; // number of ecomm stores\n\tecommLicenseCharge?: number;\n\tcustomDomainCount?: number;\n\tmarketSpotlightStateCount?: number;\n\tmarketSpotlightCountryCount?: number;\n\tmarketSpotlightAliasCount?: number;\n\tcontactCount?: number;\n\tcustomOverage?: number;\n\n\tchargePerSignupFormBoost?: number;\n\tsignupFormBoosts?: number;\n\n\tchargePerAudienceBoost?: number;\n\taudienceBoosts?: number;\n}\n\nexport interface MessagingDefaults {\n\tmms: number; // How many credits is each MMS worth?\n\tsms: number; // How many credits is each SMS worth?\n\temail: number; // How many credits is each Email worth?\n\tpush: number; // How many credits is each Push worth?\n\tdirectMail: number; // How many credits is each direct mail worth?\n\tcall: number; // How many credits is each call minute worth?\n}\n\nexport type PackageType = BasicPackage | AnalyticsPackage;\nexport interface Package {\n\tpriceOverride?: number;\n}\nexport interface BasicPackage extends Package {\n\ttype?: BasicTiers;\n}\nexport interface AnalyticsPackage extends Package {\n\ttype?: AnalyticsTiers;\n}\n\nexport interface Packages {\n\tmarketing?: BasicPackage;\n\tloyalty?: BasicPackage;\n\tanalytics?: AnalyticsPackage;\n\tbrandAnalytics?: AnalyticsPackage;\n\tdataops?: BasicPackage;\n\tsupport?: BasicPackage;\n\tnativeApps?: BasicPackage;\n\tcrew?: BasicPackage;\n}\n\n// export type PackageTypes = 'marketing' | 'loyalty' | 'analytics' | 'dataops' | 'support' | 'nativeApps'\nexport type PackageTypes = keyof Packages;\nexport type BasicTiers = 'starter' | 'pro' | 'enterprise';\nexport type AnalyticsTiers = 'starter' | 'pro' | 'brand-starter' | 'brand-pro';\nexport type NewMarketTiers = 'starter-nm' | 'pro-nm' | 'enterprise-nm';\nexport type BrandTiers = 'starter-brand' | 'pro-brand' | 'enterprise-brand';\nexport type AllTiers = BasicTiers | AnalyticsTiers;\n\nexport type BundleTypes = 'starter-bundle' | 'starter-brand-bundle' | 'pro-bundle' | 'pro-brand-bundle' | 'enterprise-bundle' | 'enterprise-brand-bundle';\n\nexport type Addons = 'custom-domain' | 'market-spotlight-state' | 'market-spotlight-country' | 'market-spotlight-alias' | 'contact';\n\nexport type MessagingCreditPlans =\n\t| 'messaging-0k'\n\t| 'messaging-8k'\n\t| 'messaging-20k'\n\t| 'messaging-60k'\n\t| 'messaging-125k'\n\t| 'messaging-300k'\n\t| 'messaging-525k'\n\t| 'messaging-825k'\n\t| 'messaging-1175k'\n\t| 'messaging-1500k'\n\t| 'messaging-2000k'\n\t| 'messaging-2500k'\n\t| 'messaging-3000k'\n\t| 'messaging-3500k'\n\t| 'messaging-6000k'\n\t| 'messaging-10000k'\n\t| 'messaging-15000k'\n\t| 'messaging-20000k'\n\t| 'messaging-30000k'\n\t| 'messaging-50000k'\n\t| 'messaging-0k-nm'\n\t| 'messaging-8k-nm'\n\t| 'messaging-20k-nm'\n\t| 'messaging-60k-nm'\n\t| 'messaging-125k-nm'\n\t| 'messaging-300k-nm'\n\t| 'messaging-525k-nm'\n\t| 'messaging-825k-nm'\n\t| 'messaging-1175k-nm'\n\t| 'messaging-1500k-nm'\n\t| 'messaging-2000k-nm'\n\t| 'messaging-2500k-nm'\n\t| 'messaging-3000k-nm'\n\t| 'messaging-3500k-nm'\n\t| 'messaging-6000k-nm'\n\t| 'messaging-10000k-nm'\n\t| 'messaging-15000k-nm'\n\t| 'messaging-20000k-nm'\n\t| 'messaging-30000k-nm'\n\t| 'messaging-50000k-nm'\n\t| 'messaging-0k-discount'\n\t| 'messaging-8k-discount'\n\t| 'messaging-20k-discount'\n\t| 'messaging-60k-discount'\n\t| 'messaging-125k-discount'\n\t| 'messaging-300k-discount'\n\t| 'messaging-525k-discount'\n\t| 'messaging-825k-discount'\n\t| 'messaging-1175k-discount'\n\t| 'messaging-1500k-discount'\n\t| 'messaging-2000k-discount'\n\t| 'messaging-2500k-discount'\n\t| 'messaging-3000k-discount'\n\t| 'messaging-3500k-discount'\n\t| 'messaging-6000k-discount'\n\t| 'messaging-10000k-discount'\n\t| 'messaging-15000k-discount'\n\t| 'messaging-20000k-discount'\n\t| 'messaging-30000k-discount'\n\t| 'messaging-50000k-discount';\n\nexport interface TransactionalStats {\n\tsent: number; // Number of messages sent\n\tsuccess: number; // Number of messages sent successfully\n\terrors: number; // Number of messages errored\n\tmessages: TrimmedMessage[]; // Last 50 messages sent given the constraints\n}\n\nexport interface TrimmedMessage {\n\tto: string;\n\tbody: string;\n\tdeliveryStatus: string;\n\tts: number;\n}\n\nexport type UserPagination = {\n\ttotalItems: number;\n\ttotalResults: number;\n\ttotalResultsPages: number;\n\tpage: number;\n\tsize: number;\n};\n\nexport interface FullUserQuery {\n\ttrimResponse?: boolean;\n\tquery: UserQuery;\n\tpagination: UserPagination;\n\tsort: SortFields;\n}\n\nexport interface UserQueryResponse {\n\tusers: User[];\n\tpagination: UserPagination;\n}\n\nexport interface UserQuery {\n\tsearch?: string;\n\tagencyID?: string;\n\tuid?: string;\n\tname?: string;\n\temail?: string;\n\tphone?: string;\n\ttype?: string;\n\tsubType?: string;\n\twebsite?: string;\n\taddress?: Address;\n\tactive?: number;\n\tarchived?: number;\n\thasNewBilling?: boolean;\n\tandLogic?: boolean;\n}\n\nexport interface SortFields {\n\tid?: SortField;\n\tname?: SortField;\n\tlastCapture?: SortField;\n\tlastAudienceRun?: SortField;\n\tstores?: SortField;\n\tcreated?: SortField;\n}\n\nexport interface SortField {\n\tdirection: 'asc' | 'desc';\n\tpriority?: number;\n}\n","import { z } from 'zod';\nimport { isValidTelnyxEntityType, isValidTelynxVerticalType, utils, validatePhoneNumber, validateURL } from '../helpers';\nimport { colors } from '../helpers';\nimport { TelynxIdentityStatusTypes, TelnyxVerticalTypes, TelynxEntityTypes, TelynxStockExchanges, TelynxUseCaseTypes, TelynxStatusTypes } from '../constants';\n\nconst filteredIndustries = ['alcohol', 'cannabis'];\nexport const isRestricted = (industry?: string) => {\n\tif (!industry) industry = utils.user.profile?.industry ?? '';\n\treturn filteredIndustries.includes(industry);\n};\n\nconst EntityTypeKeys = Object.keys(TelynxEntityTypes) as [keyof typeof TelynxEntityTypes, ...Array<keyof typeof TelynxEntityTypes>];\nconst TelnyxEntityTypesSchema = z.enum(EntityTypeKeys);\nconst VerticalKeys = Object.keys(TelnyxVerticalTypes) as [keyof typeof TelnyxVerticalTypes, ...Array<keyof typeof TelnyxVerticalTypes>];\nconst TelnyxVerticalTypesSchema = z.enum(VerticalKeys);\nconst StatusKeys = Object.keys(TelynxStatusTypes) as [keyof typeof TelynxStatusTypes, ...Array<keyof typeof TelynxStatusTypes>];\nconst TelnyxStatusTypesSchema = z.enum(StatusKeys);\nconst IdentityStatusKeys = Object.keys(TelynxIdentityStatusTypes) as [keyof typeof TelynxIdentityStatusTypes, ...Array<keyof typeof TelynxIdentityStatusTypes>];\nconst TelnyxIdentityStatusTypesSchema = z.enum(IdentityStatusKeys);\nconst TelnyxCampaignSubmssionStatuses = ['CREATED', 'FAILED', 'PENDING'] as const;\nconst TelnyxCampaignSubmissionStatusSchema = z.enum(TelnyxCampaignSubmssionStatuses);\n\nexport const FailureCategorySchema = z.object({\n\tid: z.string(),\n\tdisplayName: z.string(),\n\tdescription: z.string(),\n\tfields: z.array(z.string()),\n});\nexport const FailureDataSchema = z.object({\n\tbrandId: z.string().optional(),\n\tcategory: z.array(FailureCategorySchema).optional(),\n});\n\nexport const TelnyxBrandSchema = z.object({\n\tdisplayName: z.string(),\n\tein: z.string(),\n\tstreet: z.string(),\n\tcity: z.string(),\n\tstate: z.string(),\n\tpostalCode: z.string(),\n\tcountry: z.string(),\n\tphone: z.string().refine(\n\t\t(phone) => {\n\t\t\t// if (!phone) return true;\n\t\t\treturn validatePhoneNumber(phone);\n\t\t},\n\t\t{\n\t\t\tmessage: 'Invalid phone number.',\n\t\t},\n\t),\n\temail: z.string().email('Invalid email address.'),\n\tvertical: TelnyxVerticalTypesSchema.refine((value) => isValidTelynxVerticalType(value as TelnyxVerticalType), {\n\t\tmessage: 'Invalid vertical (sector) type',\n\t}),\n\tentityType: TelnyxEntityTypesSchema.refine((value) => isValidTelnyxEntityType(value as TelynxEntityType), {\n\t\tmessage: 'Invalid entity type',\n\t}),\n\twebsite: z\n\t\t.string()\n\t\t.optional()\n\t\t.refine(\n\t\t\t(site) => {\n\t\t\t\tif (!site) return true; // If no site is provided, validation passes\n\t\t\t\treturn validateURL(site);\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage: 'Invalid website URL. Please make sure to use http:// or https://',\n\t\t\t},\n\t\t),\n\tcompanyName: z.string(),\n\tfirstName: z.string().optional(),\n\tlastName: z.string().optional(),\n\tstockSymbol: z.string().optional(),\n\tstockExchange: z.string().optional(),\n\tipAddress: z.string().optional(),\n\tisReseller: z.boolean().optional(),\n\tmock: z.boolean().optional(),\n\tmobilePhone: z.string().optional(),\n\tbusinessContactEmail: z.string().optional(),\n});\n\nexport const TelnyxGetBrandSchema = TelnyxBrandSchema.extend({\n\tcspId: z.string().optional(),\n\tbrandId: z.string().optional(),\n\taltBusinessID: z.string().optional(),\n\tuniversalEin: z.string().optional(),\n\tidentityStatus: TelnyxIdentityStatusTypesSchema.optional(),\n\treferenceID: z.string().optional(),\n\toptionalAttributes: z\n\t\t.object({\n\t\t\ttaxExemptStatus: z.string().optional(),\n\t\t})\n\t\t.optional(),\n\tstatus: TelnyxStatusTypesSchema.optional(),\n\tfailureReasons: z.array(z.string()).optional(),\n\tfailureData: FailureDataSchema.optional(),\n});\n\nexport type TelnyxBrand = z.infer<typeof TelnyxBrandSchema>;\nexport type TelnyxGetBrand = z.infer<typeof TelnyxGetBrandSchema>;\nexport type TelnyxStatusType = keyof typeof TelynxIdentityStatusTypes;\nexport type TelnyxVerticalType = keyof typeof TelnyxVerticalTypes;\nexport type TelynxEntityType = keyof typeof TelynxEntityTypes;\nexport type TelynxUseCaseType = keyof typeof TelynxUseCaseTypes;\nexport type TelynxStockExchange = keyof typeof TelynxStockExchanges;\nexport type FailureCategory = z.infer<typeof FailureCategorySchema>;\nexport type FailureData = z.infer<typeof FailureDataSchema>;\n\nexport const TelnyxGetCampaignSchema = z.object({\n\tageGated: z.boolean().optional(),\n\tautoRenewal: z.boolean().optional(),\n\tbilledDate: z.string().optional(),\n\tbrandId: z.string().optional(),\n\tcampaignId: z.string().optional(),\n\tcreateDate: z.string().optional(),\n\tcspId: z.string().optional(),\n\tdescription: z.string().optional(),\n\tdirectLending: z.boolean().optional(),\n\tembeddedLink: z.boolean().optional(),\n\tembeddedPhone: z.boolean().optional(),\n\thelpKeywords: z.string().optional(),\n\thelpMessage: z.string().optional(),\n\tmessageFlow: z.string().optional(),\n\tmock: z.boolean().optional(),\n\tnextRenewalOrExpirationDate: z.string().optional(),\n\tnumberPool: z.boolean().optional(),\n\toptinKeywords: z.string().optional(),\n\toptinMessage: z.string().optional(),\n\toptoutKeywords: z.string().optional(),\n\toptoutMessage: z.string().optional(),\n\treferenceId: z.string().optional(),\n\tresellerId: z.string().optional(),\n\tsample1: z.string().optional(),\n\tsample2: z.string().optional(),\n\tsample3: z.string().optional(),\n\tsample4: z.string().optional(),\n\tsample5: z.string().optional(),\n\tstatus: z.string().optional(),\n\tsubUsecases: z.array(z.string()).optional(),\n\tsubscriberHelp: z.boolean().optional(),\n\tsubscriberOptin: z.boolean().optional(),\n\tsubscriberOptout: z.boolean().optional(),\n\ttermsAndConditions: z.boolean().optional(),\n\tusecase: z.string().optional(),\n\twebhookURL: z.string().optional(),\n\twebhookFailoverURL: z.string().optional(),\n\tisTMobileRegistered: z.boolean().optional(),\n\tisTMobileSuspended: z.boolean().optional(),\n\tfailureReasons: z.any().optional(),\n\tsubmissionStatus: TelnyxCampaignSubmissionStatusSchema.optional(),\n});\n\nexport type TelnyxGetCampaign = z.infer<typeof TelnyxGetCampaignSchema>;\n\nexport interface GetTelnyxCampaignOptions {\n\tageGated?: boolean;\n\tautoRenewal?: boolean;\n\tbilledDate?: string;\n\tbrandId?: string;\n\tcampaignId?: string;\n\tcreateDate?: string;\n\tcspId?: string;\n\tdescription?: string;\n\tdirectLending?: boolean;\n\tembeddedLink?: boolean;\n\tembeddedPhone?: boolean;\n\thelpKeywords?: string;\n\thelpMessage?: string;\n\tmessageFlow?: string;\n\tmock?: boolean;\n\tnextRenewalOrExpirationDate?: string;\n\tnumberPool?: boolean;\n\toptinKeywords?: string;\n\toptinMessage?: string;\n\toptoutKeywords?: string;\n\toptoutMessage?: string;\n\treferenceID?: string;\n\tresellerId?: string;\n\tsample1?: string;\n\tsample2?: string;\n\tsample3?: string;\n\tsample4?: string;\n\tsample5?: string;\n\tstatus?: string;\n\tsubUsecases?: string[];\n\tsubscriberHelp?: boolean;\n\tsubscriberOptin?: boolean;\n\tsubscriberOptout?: boolean;\n\ttermsAndConditions?: boolean;\n\tusecase?: string;\n\twebhookURL?: string;\n\twebhookFailoverURL?: string;\n\tisTMobileRegistered?: boolean;\n\tisTMobileSuspended?: boolean;\n}\n\nexport const getStatusColor = (status: string): string => {\n\tswitch (status) {\n\t\tcase 'VERIFIED':\n\t\tcase 'VETTED_VERIFIED':\n\t\t\treturn colors.primary.primary;\n\t\tcase 'SELF_DECLARED':\n\t\t\treturn colors.primary.blue;\n\t\tcase 'UNVERIFIED':\n\t\t\treturn colors.primary.pinkRed;\n\t\tdefault:\n\t\t\treturn '';\n\t}\n};\n\nexport const getStatusText = (status: string): string => {\n\tswitch (status) {\n\t\tcase 'VERIFIED':\n\t\t\treturn 'Verified';\n\t\tcase 'VETTED_VERIFIED':\n\t\t\treturn 'Vetted Verified';\n\t\tcase 'SELF_DECLARED':\n\t\t\treturn 'Self Declared';\n\t\tcase 'UNVERIFIED':\n\t\t\treturn 'Unverified';\n\t\tdefault:\n\t\t\treturn '';\n\t}\n};\n","import { adminUtils, userUtils } from '@/helpers';\nimport { TextingSettings } from '@/pages/settings/textingSettings/TextingSettingsPage';\nimport { LandingPageButtonLink, LandingVariant, UserSettings } from '@alpine-iq/shared';\n\nexport const LandingVariants: Record<\n\tLandingVariant | 'enableMessageInbox',\n\t{\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tisEnabled: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => boolean;\n\t\tisVisible: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => boolean;\n\t}\n> = {\n\tenableMessageInbox: {\n\t\ttitle: 'Skip inbox',\n\t\tdescription: 'Age gated messages without an inbox',\n\t\tisEnabled: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\treturn !user?.enableMessageInbox;\n\t\t},\n\t\tisVisible: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\treturn !!adminUtils.canSeeAll() || !user?.enableMessageInbox;\n\t\t},\n\t},\n\tmodern: {\n\t\ttitle: 'Modern style',\n\t\tdescription: 'Drive more customers to engage with your intended CTA via a clean non-distracting design',\n\t\tisEnabled: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\tif (!user?.enableMessageInbox) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn brandSettings?.landingPage?.variant === 'modern' || !brandSettings?.landingPage?.variant;\n\t\t},\n\t\tisVisible: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\treturn true;\n\t\t},\n\t},\n\tlinkTree: {\n\t\ttitle: 'Linktree style',\n\t\tdescription: 'Use full width large buttons',\n\t\tisEnabled: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\tif (!user?.enableMessageInbox) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn brandSettings?.landingPage?.variant === 'linkTree';\n\t\t},\n\t\tisVisible: (user?: Partial<TextingSettings>, brandSettings?: Partial<UserSettings>) => {\n\t\t\treturn true;\n\t\t},\n\t},\n};\n\nexport const LandingPageButtonLinks: Record<\n\tLandingPageButtonLink,\n\t{\n\t\ttitle: string;\n\t\tdescription: string;\n\t}\n> = {\n\tshopOnline: {\n\t\ttitle: 'Shop Online',\n\t\tdescription: 'Link to your online store',\n\t},\n\tdirections: {\n\t\ttitle: 'Directions',\n\t\tdescription: 'Link to your location on a map',\n\t},\n\tcallUs: {\n\t\ttitle: 'Call Us',\n\t\tdescription: 'Link to a phone number',\n\t},\n\tmemberWallet: {\n\t\ttitle: 'Member Wallet',\n\t\tdescription: 'Link to a member wallet page',\n\t},\n};\n","import React from 'react';\nimport type { CSSProp } from 'styled-components';\n\nexport * from './invoice';\nexport * from './acl';\nexport * from './audience';\nexport * from './account';\nexport * from './accountHealth';\nexport * from './activity';\nexport * from './audience';\nexport * from './brands';\nexport * from './campaigns';\nexport * from './cmpreports';\nexport * from './discount';\nexport * from './events';\nexport * from './forecast';\nexport * from './geo';\nexport * from './integrations';\nexport * from './invoice_legacy';\nexport * from './loyaltyTemplates';\nexport * from './marketanalytics';\nexport * from './missionControl';\nexport * from './models';\nexport * from './recipes';\nexport * from './service';\nexport * from './twilio';\nexport * from './users';\nexport * from './userAlerts';\nexport * from '../pages/crew/crew-types/index';\nexport * from '../pages/surveysAndReviews/survey-types';\nexport * from '../components/global/types';\nexport * from '../pages/legacyPersonas/persona-types';\nexport * from './contexts';\nexport * from './form';\nexport * from './telnyx';\nexport * from './customer-chat';\nexport * from './user-settings';\nexport * from './points-freeze-windows';\nexport * from './signupForms';\n\nexport type UserBlacklist = {\n\t[key: string]: number[];\n};\n\nexport type Setter<T> = Partial<T> | ((curr: T) => Partial<T>);\n\nexport interface LoaderState {\n\tloading?: boolean;\n\tloaded?: boolean;\n}\n\nexport type LoaderSetter = React.Dispatch<\n\tReact.SetStateAction<{\n\t\tloading: boolean;\n\t\tloaded: boolean;\n\t}>\n>;\n\nexport type ID = string | number;\n\nexport type EntryData<T> = {\n\tids: (string | number)[]; // Used to keep the order of the entries\n\tentries: { [id: ID]: T };\n};\n\nexport type EntryMap<T> = { [id: ID]: T };\n\nexport type EntryDataLoader<T> = EntryData<T> & {\n\tloaded?: boolean;\n};\n\ntype InputArgs<T> = [filterCB?: (i: T, key: number) => boolean, mapCb?: (i: T, key: number) => T];\n\nexport function createEntryMap<T extends { id?: string | number | undefined | any }>(items: T[], ...args: InputArgs<T>): EntryMap<T> {\n\tconst entries: { [id: string]: T } = {};\n\n\tconst filterCB = args[0];\n\tconst mapCB = args[1];\n\n\tlet key = 0;\n\tfor (const item of items) {\n\t\tif (!item.id) continue;\n\n\t\tif (filterCB && !filterCB(item, key)) continue;\n\t\tif (mapCB) entries[item.id] = mapCB(item, key);\n\t\telse entries[item.id] = item;\n\t\tkey++;\n\t}\n\n\treturn entries;\n}\n\nexport function setValidID<T>(item: T & { id?: ID }, filterCB?: (i: T) => boolean): { [id: string]: T } {\n\tif (item.id === undefined || (filterCB && !filterCB(item))) return {};\n\treturn { [item.id]: item };\n}\n\nexport function createEntryData<T extends { id?: string | number | undefined | any }>(\n\titems: T[],\n\tcb?: (item: T) => T,\n\tfilterCb?: (item: T) => boolean,\n): EntryData<T> | EntryDataLoader<T> {\n\tconst ids: (string | number)[] = [];\n\tconst entries: { [id: string | number]: T } = {};\n\n\tfor (const item of items) {\n\t\tif (!item.id) continue;\n\t\tids.push(item.id);\n\t\tconst isValid = filterCb ? filterCb(item) : true;\n\t\tif (!isValid) continue;\n\t\tentries[item.id] = cb?.(item) ?? item;\n\t}\n\n\treturn { loaded: true, ids, entries };\n}\n\nexport type DropdownOption = { label: string | React.ReactNode; value: string | number };\n\ndeclare module 'react' {\n\tinterface Attributes {\n\t\tcss?: CSSProp | undefined;\n\t}\n}\n","import { formatHLCTotals } from './../accountHealth/utils';\nimport { API, asyncWrap } from '../../api';\nimport { UserAlertUpdateActionInput } from '../../api/userAlerts';\nimport timeUtils from '../../helpers/timeUtils';\nimport utils from '../../helpers/utils';\nimport { AcknowledgedAlert, Acknowledgement, AlertsContext, AlertsContextState, AlertStore, EntryMap, Role, UserAlert } from '@/legacy-types';\n\nexport const isStillSnoozed = (alert: UserAlert, uid: string, email: string, acknowledge?: Acknowledgement | false) => {\n\tif (!acknowledge && acknowledge !== false) acknowledge = getAcknowledgement(alert, uid, email);\n\tif (!acknowledge) return false;\n\tif (!acknowledge.snoozeDuration || !acknowledge.snoozeStart) return false;\n\tconst snoozeEnd = (acknowledge.snoozeStart + acknowledge.snoozeDuration) * 1000;\n\treturn snoozeEnd > Date.now();\n};\n\nexport const getUnViewedAlerts = (alerts: UserAlert[], uid: string, email: string) => {\n\treturn (alerts || []).filter((alert: UserAlert) => isUnViewed(alert, uid, email));\n};\n\nexport const isUnViewed = (alert: UserAlert, uid: string, email: string) => {\n\tconst acknowledged = getAcknowledgement(alert, uid, email);\n\tif (isStillSnoozed(alert, uid, email, acknowledged)) return false;\n\treturn !acknowledged && !alert.adminViews?.includes(email);\n};\n\nexport const getUnAcknowledgedAlerts = (alerts: UserAlert[], uid: string, email: string) => {\n\treturn (alerts || []).filter((alert: UserAlert) => {\n\t\tconst acknowledged = getAcknowledgement(alert, uid, email);\n\t\tif (isStillSnoozed(alert, uid, email, acknowledged)) return false;\n\t\treturn !acknowledged || acknowledged.acknowledged !== true;\n\t});\n};\n\nexport const getAcknowledgement = (alert: UserAlert, uid: string, email: string): Acknowledgement | undefined => {\n\treturn alert?.acknowledged?.[uid]?.[email];\n};\n\n// check if any alerts require attention\nexport const shouldDrawerAutoOpen = (alerts: UserAlert[]): boolean => {\n\tif (!alerts || !alerts.length) return false;\n\treturn alerts.some((alert) => shouldBeShown(alert));\n};\n\n// check if alert requires attention\nexport const shouldBeShown = (alert: UserAlert, uid: string = utils.uid, email: string = utils.auth.getEmail(), role: Role = utils.auth.getRole()): boolean => {\n\tif (!alert) return false;\n\t// if the alert is not active, return false\n\tif (!alert.active) return false;\n\t// check if alert is archived\n\tif (alert.archived) return false;\n\t// check alert is within start and end sending range\n\tconst now = Math.floor(Date.now() / 1000);\n\tif ((alert.startTime && alert.startTime > now) || (alert.endTime && alert.endTime < now)) return false;\n\t// check if user should see it\n\tif (alert.targetIDs && !alert.targetIDs.includes(uid)) return false;\n\t// check email should see it\n\tif (alert.targetEmails && !alert.targetEmails.includes(email)) return false;\n\t// check role should see it\n\tif (alert.permissionLevels && !alert.permissionLevels.includes(role)) return false;\n\t// check if alert is acknowledged\n\tif (alert.required && isAcknowledged(alert, uid, email)) return false;\n\t// check if alert is snoozed\n\tif (!alert.disAllowSnooze && isSnoozed(alert, uid, email)) return false;\n\treturn true;\n};\n\n// check if alert is acknowledged for email\nexport const isAcknowledged = (alert: UserAlert, uid: string, email: string): boolean => {\n\tconst ackMap = alert.acknowledged || ({} as AcknowledgedAlert);\n\t// check admins as they only need to view once per uid always\n\tif (alert.adminViews && alert.adminViews.includes(email)) return true;\n\t// if the alert is view only once, and the user has already viewed it, return true\n\tif (alert.viewOnlyOnce && !!Object.keys(ackMap[uid] || {}).length) return true;\n\t// if if alert is not view once check sub user acknowledge\n\tif (ackMap && ackMap[uid] && ackMap[uid][email]) return !!ackMap[uid][email].acknowledged;\n\treturn false;\n};\n// check if alert is snoozed for email\nexport const isSnoozed = (alert: UserAlert, uid: string, email: string): boolean => {\n\tconst ackMap = alert.acknowledged || ({} as AcknowledgedAlert);\n\t// check if email exist user's in map\n\tif (ackMap && ackMap[uid] && ackMap[uid][email]) {\n\t\tconst snoozeStart = ackMap[uid][email].snoozeStart;\n\t\tconst snoozeDuration = ackMap[uid][email].snoozeDuration;\n\t\t// check if snooze start and duration exist\n\t\tif (snoozeStart && snoozeDuration) {\n\t\t\tconst now = Math.floor(Date.now() / 1000);\n\t\t\tconst snoozeEnd = snoozeStart + snoozeDuration;\n\t\t\tif (now >= snoozeStart && now <= snoozeEnd) return true;\n\t\t}\n\t}\n\treturn false;\n};\n\nexport const validateAlert = (alert: UserAlert) => {\n\tconst errors: string[] = [];\n\tif (alert.manuallyCreated && !alert.internalName) errors.push('Alert must have a(n) internal name for identifying it');\n\tif (!alert.text) errors.push('Alert must have text');\n\n\tif (alert.active) {\n\t\tif (alert.required) errors.push('Alert cannot be required');\n\t}\n\n\treturn errors;\n};\n\nfunction updateAnalyticsAlertsTimestamps(alert: UserAlert): UserAlert {\n\treturn alert;\n\t// if (!alert.prefix?.value) return alert;\n\t// const regex = /\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/g;\n\t// const matches = (alert.prefix.value.match(regex) || []);\n\t// if (!matches) {\n\t// \treturn alert;\n\t// }\n\t// const [ startDate, endDate ] = matches;\n\t// alert.prefix.value = `Analytics Report Completed: ${timeUtils.formatTimestamp(startDate)}${endDate ? (' - ' + timeUtils.formatTimestamp(endDate)) : ''}`;\n\t// return alert;\n}\n\nfunction parseAndRemoveStrings(htmlString: string) {\n\ttry {\n\t\tconst regex =\n\t\t\t/<p>(.*?)<br\\/><\\/p>\\n<p><a href=\"(.*?)\">See Documentation<\\/a><\\/p>\\n<details style=\"cursor: pointer\">\\n<summary>Raw Error<\\/summary>\\n(.*?)\\n<\\/details>/s;\n\t\tconst matches = htmlString.match(regex);\n\n\t\tif (matches) {\n\t\t\tconst [, errorMessage, documentationLink, rawError] = matches;\n\t\t\tconst cleanedHTML = htmlString.replace(matches[0], '');\n\n\t\t\treturn {\n\t\t\t\terrorMessage: errorMessage.trim(),\n\t\t\t\tdocumentationLink: documentationLink.trim(),\n\t\t\t\trawError: rawError.trim(),\n\t\t\t\tcleanedHTML: cleanedHTML.trim(),\n\t\t\t};\n\t\t}\n\t} catch (e) {\n\t\tconsole.warn(e);\n\t}\n\treturn null;\n}\n\nconst ERROR_RETRIEVING_FROM_IMPORTER = 'errorretrievingfromimporter';\nconst FINAL_REMINDER_TO = 'Final Reminder to';\nconst ANALYTICS_REPORT_COMPLETED = 'Analytics Report Completed';\nconst DETAILS_STYLE = '<details style';\n\n// Some legacy alerts require formatting or filtering before being shown\nexport const formatAlertsData = (userAlerts: UserAlert[], alertsMap: EntryMap<UserAlert>, noLayout?: boolean): Partial<AlertsContextState> => {\n\tif (!userAlerts || !userAlerts?.length) {\n\t\treturn { alerts: {} };\n\t}\n\n\tconst inputAlerts: UserAlert[] = Array.isArray(userAlerts) ? userAlerts : [userAlerts];\n\n\tconst alerts = inputAlerts.reduce((acc, ua) => {\n\t\tif (isValidAlert(ua, noLayout)) {\n\t\t\tif (ua?.text?.value?.includes(DETAILS_STYLE)) {\n\t\t\t\tconst cleaned = parseAndRemoveStrings(ua.text.value);\n\t\t\t\tif (cleaned) {\n\t\t\t\t\tua.text.value = cleaned.errorMessage;\n\t\t\t\t\tua.suffix = { link: cleaned.documentationLink, value: 'See documentation' };\n\t\t\t\t\tua.hover = { value: cleaned.rawError };\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ua?.prefix?.value?.includes(ANALYTICS_REPORT_COMPLETED)) {\n\t\t\t\tconst now = Math.floor(Date.now() / 1000);\n\t\t\t\t// if it's start date is over 24 hours ago, we don't want to show it\n\t\t\t\tif (ua.startTime && ua.startTime < now - 86400) return acc;\n\t\t\t\tua = updateAnalyticsAlertsTimestamps(ua);\n\t\t\t}\n\n\t\t\tconst newAlert: UserAlert = utils.clone(ua);\n\n\t\t\tif (newAlert.id === '28376') {\n\t\t\t\tacc[ua.id || ''] = {\n\t\t\t\t\t...newAlert,\n\t\t\t\t\t...Q1ALERT,\n\t\t\t\t};\n\t\t\t\treturn acc;\n\t\t\t}\n\n\t\t\tacc[ua.id || ''] = newAlert;\n\t\t}\n\t\treturn acc;\n\t}, alertsMap || {});\n\t// const entities = Object.keys(alerts).sort((a, b) => (alerts[b].updated || alerts[b].created || 0) - (alerts[a].updated || alerts[a].created || 0));\n\treturn {\n\t\talerts,\n\t};\n};\n\nexport const sortUserAlerts = (a: UserAlert, b: UserAlert) => {\n\tif (a.created !== b.created) return (a.created || 0) > (b.created || 0) ? -1 : 1;\n\tif (a.updated !== b.updated) return (a.updated || 0) > (b.updated || 0) ? -1 : 1;\n\treturn (a.id || 0) > (b.id || 0) ? -1 : 1;\n};\n\nconst isImporterTypeError = (rawErr: string, hoverErr: string) => {\n\treturn [rawErr, hoverErr].some((err) => utils.strify(err)?.includes(ERROR_RETRIEVING_FROM_IMPORTER)) || rawErr?.endsWith(' : :');\n};\n\n// Some alerts are old, invalid, or busted and should be removed from the list\nconst isValidAlert = (ua: UserAlert, noLayout?: boolean) => {\n\t// IF the user alert doesn't have any text, we don't want to show it\n\tif (!ua || (!ua.prefix?.value && !ua.text?.value && !ua.suffix?.value)) return false;\n\t// If this alert alert is not visible to the current user, we don't want to show it\n\tif (noLayout && !ua.permissionLevels?.includes('budtender' || utils.auth.getRole())) return false;\n\tlet rawErr = ua?.text?.value?.trim() || '',\n\t\thoverErr = ua?.hover?.value?.trim() || '';\n\t// Remove old final reminder alerts\n\tif (ua.type === 'recipe' && rawErr.startsWith(FINAL_REMINDER_TO)) return false;\n\t// If this alert is an importer error, and it doesn't have an end time, we don't want to show it\n\tif (isImporterTypeError(rawErr, hoverErr) && !ua?.endTime) return false;\n\t// If this alert is an importer error, and it has a start or end time, we don't want to show it if it's not in the current time range\n\tif (isImporterTypeError(rawErr, hoverErr) || ua.type === 'error') {\n\t\tconst now = Math.floor(Date.now() / 1000);\n\t\tif ((ua.startTime && ua.startTime > now) || (ua.endTime && ua.endTime < now)) return false;\n\t}\n\t// If this alert is manually created, and it's not active, we don't want to show it\n\tif (ua.manuallyCreated && !ua.active) return false;\n\treturn true;\n};\n\n// ! This function is used to fetch alerts for the user\nexport const fetchUserAlerts = (\n\tuid: string, // The user ID to fetch alerts for\n\t[alertData, setAlertData]: AlertsContext, // Alert context to update\n\tcheck = 10,\n\tnoLayout?: boolean,\n) => {\n\t// In some cases we don't need to check for alerts\n\tif (utils.uid === '1') return;\n\n\tasyncWrap(async () => {\n\t\tlet alertsData: UserAlert[] = [];\n\t\t// when requesting alerts we only get new ones, so we need to add the old ones back in\n\t\t// const cachedAlerts = getCachedUserAlerts(uid, check);\n\t\t// if (cachedAlerts.length) {\n\t\t// alertsData = cachedAlerts;\n\t\t// } else {\n\t\talertsData = await API.getUserAlerts({}); // showAcknowledged: true })\n\t\t// cacheUserAlerts(uid, alertsData);\n\t\t// }\n\n\t\tconst formattedAlerts = formatAlertsData(alertsData, alertData.alerts || {}, noLayout);\n\t\tsetAlertData({ ...formattedAlerts, updated: Date.now() });\n\t});\n};\n\n// update alert with an action\nexport const submitUserAlertAction = (\n\t[alertData, setAlertData]: AlertsContext, // Alert context to update\n\ttarget?: UserAlert | UserAlert[], // The alert(s) to apply the action to\n\toptions?: Partial<UserAlertUpdateActionInput>, // The action to apply\n\tnoLayout?: boolean, // Optionally is this for budtender view\n) =>\n\tasyncWrap(async () => {\n\t\tif (!target) return;\n\t\tconst currentEmail = utils.auth.getEmail();\n\t\tlet query: UserAlert[] = (Array.isArray(target) ? target : [target]) as UserAlert[];\n\n\t\tconst requiredAcknowledgement: string[] = (query || [])\n\t\t\t.filter((alert: UserAlert) => !!alert?.id && alert.required && getAcknowledgement(alert, utils.uid, currentEmail) === undefined)\n\t\t\t.map((alert: UserAlert) => `Alert: ${alert.prefix?.value || ''} is required!`);\n\n\t\t// If there are any required alerts that have not been acknowledged, we return an error\n\t\tif (requiredAcknowledgement.length > 0 && options?.action === 'snooze') {\n\t\t\treturn utils.showErrs(requiredAcknowledgement, 'You must acknowledge required alerts!');\n\t\t}\n\n\t\t// The ID's to apply the action to\n\t\tconst ids = (query || []).map((alert: UserAlert) => alert.id || '');\n\n\t\t// Send request to update to server\n\t\tconst { alerts, errors } = (await API.updateUserAlertsClicked({ ids, ...options })) || [];\n\t\t// If we have any errors, show them\n\t\tif ((errors || []).length) {\n\t\t\tutils.showErrs(errors, 'Error updating alerts!');\n\t\t}\n\n\t\tconst formattedAlerts = formatAlertsData(alerts, alertData.alerts || {}, noLayout);\n\n\t\tsetAlertData((s) => ({ ...s, ...formattedAlerts, updated: Date.now() }));\n\t\tupdateCachedAlerts(utils.uid, Object.values(alerts || {}));\n\t});\n\nexport const getCachedUserAlerts = (uid: string, check?: number): UserAlert[] => {\n\tconst storedValue: AlertStore = (utils.local.get('new_dash_alerts', {}) || {})?.[uid] || {};\n\tconst updatedInLast10Min = Date.now() - (storedValue.updated || 0) < timeUtils.units.MINUTE_MS * (check || 1);\n\tdeleteOldCache();\n\tif (storedValue.updated && updatedInLast10Min) {\n\t\treturn utils.decodeObject(storedValue.data || '') || [];\n\t}\n\treturn [];\n};\n\nexport const updateCachedAlerts = (uid: string, alerts: UserAlert[]) => {\n\tconst alertMap = alerts.reduce((acc, alert) => ({ ...acc, [alert?.id || '']: alert }), {} as EntryMap<UserAlert>);\n\tconst storedValue = getCachedUserAlerts(uid).map((alert) => alertMap[alert.id || ''] || alert);\n\tcacheUserAlerts(uid, storedValue);\n};\n\nexport const cacheUserAlerts = (uid: string, alerts: UserAlert[]) => {\n\tconst isMobile = window.innerWidth < 768;\n\tutils.local.set('new_dash_alerts', {\n\t\t[uid]: {\n\t\t\tupdated: Date.now(),\n\t\t\tdata: utils.encodeObject((alerts || [])?.slice(0, isMobile ? 10 : 100)) || '',\n\t\t},\n\t});\n};\n\n// Handle deleting of older alerts & old alerts cache\nconst deleteOldCache = () => {\n\t// Loop over each key inside the cache, and delete any that are older than 1 day\n\tconst now = Date.now();\n\tconst cache = utils.local.get('new_dash_alerts', {});\n\tObject.keys(cache).forEach((key) => {\n\t\tconst value = cache[key];\n\t\tif (now - value.updated > timeUtils.units.DAY_MS) {\n\t\t\tdelete cache[key];\n\t\t}\n\t});\n\tutils.local.set('new_dash_alerts', cache);\n\t// Delete the legacy cache (which was not msgpack encoded)\n\tutils.local.remove('new_dash');\n};\n\nconst deleteOldCacheUID = (uid: string) => {\n\tconst cache = utils.local.get('new_dash_alerts', {});\n\tdelete cache[uid];\n\tutils.local.set('new_dash_alerts', cache);\n};\n\nexport const formatUserAlertLink = (link?: string) => {\n\tif (!link) return '';\n\tif (utils.isLocal() && link.startsWith('https://lab.alpineiq.com')) link = link.replace('https://lab.alpineiq.com', '');\n\n\t// We update legacy recipe links to new format\n\tif (link.includes('/recipe')) {\n\t\tlet updated = '';\n\t\tif (link.includes('builder')) {\n\t\t\tconst [, retailerID, targetRecipeID] = link.match(/\\/recipes\\/(\\d+)\\/builder\\/(\\d+)/) || [];\n\t\t\tupdated = `/templates/${retailerID || ':uid'}/builder?recipe=${targetRecipeID}&z=9001`;\n\t\t}\n\t\tif (link.includes('manage')) {\n\t\t\tconst [, brandSponsorID, sponsoredRecipeID] = link.match(/\\/recipes\\/(\\d+)\\/manage\\/recipe=(\\d+)/) || [];\n\t\t\tupdated = `/templates/${brandSponsorID || ':uid'}/builder?recipe=${sponsoredRecipeID}`;\n\t\t}\n\t\t// Any that we didn't convert wont work so we just clear them\n\t\tlink = updated;\n\t}\n\n\treturn `${link || ''}${link.includes('?') ? '&' : '?'}ignoreAlerts=true`.replace(':uid', utils.uid);\n};\n\nexport const sampleUserAlerts: UserAlert[] = [\n\t{\n\t\tid: '-2',\n\t\ttype: 'critical',\n\t\tprefix: { value: 'Critical Issue' },\n\t\ttext: { value: 'API is offline' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'error',\n\t\tprefix: { value: 'API Error' },\n\t\ttext: { value: 'The API information entered is incorrect (key/username/password or wrong access granted to key).' },\n\t\thover: { value: `This is an example` },\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'info',\n\t\tprefix: { value: 'Settings Changed' },\n\t\ttext: { value: 'Sub-user: xemail@gmail.com has updated the user settings for your account' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'warning',\n\t\tprefix: { value: 'Deprecated Settings' },\n\t\ttext: { value: 'We recommend you upgrade to our new and improved settings' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'recipe',\n\t\tprefix: { value: 'Recipe Asset Activated!' },\n\t\ttext: { value: 'Co-Marketing Template (1234) Email Send has been activated' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'debug',\n\t\tprefix: { value: 'Wallet Failed' },\n\t\ttext: { value: 'Failed to update user wallet info for user.' },\n\t\tsuffix: { value: '<a>Click here</a> to download JSON', style: { fontSize: '.75rem' } },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'success',\n\t\tprefix: { value: 'No alerts exist at this time', color: '#000' },\n\t},\n];\n\nexport const sampleFeatureHighlightsAlerts: UserAlert[] = [\n\t{\n\t\tid: '-2',\n\t\ttype: 'critical',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'Critical Issue' },\n\t\ttext: { value: 'API is offline' },\n\t\tbutton: { value: 'Resolve' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'error',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'API Error' },\n\t\ttext: { value: 'The API information entered is incorrect (key/username/password or wrong access granted to key).' },\n\t\tbutton: { value: 'View documentation' },\n\t\thover: { value: `This is an example` },\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'info',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'Settings Changed' },\n\t\ttext: { value: 'Sub-user: xemail@gmail.com has updated the user settings for your account' },\n\t\tbutton: { value: 'Check settings' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'warning',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'Deprecated Settings' },\n\t\ttext: { value: 'We recommend you upgrade to our new and improved settings' },\n\t\tbutton: { value: 'Upgrade' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'recipe',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'Recipe Asset Activated!' },\n\t\ttext: { value: 'Co-Marketing Template (1234) Email Send has been activated' },\n\t\tbutton: { value: 'View Recipe' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'debug',\n\t\tfeatureHighlight: true,\n\t\tprefix: { value: 'Wallet Failed' },\n\t\ttext: { value: 'Failed to update user wallet info for user.' },\n\t\tsuffix: { value: '<a>Click here</a> to download JSON', style: { fontSize: '.75rem' } },\n\t\tbutton: { value: 'View JSON' },\n\t\thover: {\n\t\t\tvalue: `This is a CRITICAL error, please try to resolve as soon as possible. Ensure there's no spaces in the key. If not, please contact your integration provider to resolve.`,\n\t\t},\n\t\tlink: '/',\n\t},\n\t{\n\t\tid: '-2',\n\t\ttype: 'success',\n\t\tfeatureHighlight: true,\n\t\tbutton: { value: 'View all' },\n\t\tprefix: { value: 'No alerts exist at this time', color: '#fff' },\n\t\tlink: '/',\n\t},\n];\n\nexport const Q1ALERT = {\n\tid: '28376',\n\tcreated: 1711440711,\n\tupdated: 1711441581,\n\tcreator: 'brynner.doyle@alpineiq.com',\n\tmanuallyCreated: true,\n\tfeatureHighlight: true,\n\tyoutubeVideo: 'https://www.youtube.com/embed/QjmqA_sR7Js?si=vV2lMX7AoM2vD0cD',\n};\n\nexport const ECOM_ALERT: UserAlert = {\n\tmanuallyCreated: true,\n\tcreator: 'brynner.doyle@alpineiq.com',\n\tcolor: '#6F4CFB',\n\tflipImage: true,\n\tfeatureHighlight: true,\n\tslideshowPages: {\n\t\t0: {\n\t\t\tprefix: { value: 'AIQ Ecommerce launches 🚀', color: '#fff' },\n\t\t\ttext: { value: 'Easily host highly SEO optimized menus that seamlessly integrate across marketing, loyalty, apps, and customer flows.' },\n\t\t\tbulletItems: [\n\t\t\t\t{ value: 'Single sign on checkout across desktop, mobile, and native apps' },\n\t\t\t\t{ value: 'Abandoned cart marketing automation' },\n\t\t\t\t{ value: 'Feed orders directly into your favorite point-of-sale systems and payment providers' },\n\t\t\t\t{ value: \"Customize your look and feel or build custom with no limits API's\" },\n\t\t\t],\n\t\t},\n\t\t1: {\n\t\t\tprefix: { value: 'Build loyalty the right way', color: '#fff' },\n\t\t\ttext: {\n\t\t\t\tvalue:\n\t\t\t\t\t'Customers can easily sign up for your rewards program from your checkout page. Existing loyalty members can access their digital wallet at time of purchase to accrue or redeem rewards.',\n\t\t\t},\n\t\t\tbulletItems: [\n\t\t\t\t{ value: 'Scale loyalty sign ups faster than ever' },\n\t\t\t\t{ value: 'Let shoppers earn status badges with gamification' },\n\t\t\t\t{ value: 'Access rewards with phone or email based lookups' },\n\t\t\t],\n\t\t},\n\t\t2: {\n\t\t\tprefix: { value: 'Manage orders more efficiently', color: '#fff' },\n\t\t\ttext: {\n\t\t\t\tvalue:\n\t\t\t\t\t\"We help store managers and their teams handle orders with ease, no matter if they're in-store purchases, delivery, pick up, or direct-to-consumer purchases.\",\n\t\t\t},\n\t\t\tbulletItems: [{ value: 'Customers can schedule pickup windows' }, { value: 'Manage every order type in the same place' }],\n\t\t},\n\t},\n};\n\n// @ts-ignore\nwindow['userAlertsCache'] = {\n\tgetRaw: () => utils.local.get('new_dash_alerts', {}),\n\tgetCachedUserAlerts,\n\tupdateCachedAlerts,\n\tdeleteOldCacheUID,\n};\n","import { isEqual } from 'lodash';\n\nimport { asyncWrap, fetchAPI } from '../../../api';\nimport TimezoneSelect from '../../../components/timezones';\nimport { timeUtils, userUtils, utils } from '../../../helpers';\nimport {\n\tAudience,\n\tCampaign,\n\tCampaignChannel,\n\tCampaignChannelsMap,\n\tCampaignChannelType,\n\tCampaignConversionActionMap,\n\tCampaignMap,\n\tConversionAction,\n\tDateRange,\n\tEmailTemplate,\n\tEntryMap,\n\tSendWindow,\n\tSMSTemplate,\n} from '@/legacy-types';\nimport { CampaignBuilderStagesProps, CampaignType, CampaignTypesMapping, ChannelInfo, ChannelInput, SaveCampaignOption } from './cmp.builder.types';\nimport { bannedMacrosByTemplate, CampaignBuilderMacros, getLinkMacros, Macro, warningMacros } from './macros';\nimport { isTelnyxCampaignApproved } from '../../../helpers/telynxSettings';\n\nexport function showSidebarInCampaigns() {\n\treturn utils.local.get('showSidebarInCampaigns') || false;\n}\n\nexport function setShowSidebarInCampaigns(show: boolean) {\n\tif (show) utils.local.set('showSidebarInCampaigns', true);\n\telse utils.local.remove('showSidebarInCampaigns');\n}\n\nexport function cleanCopyCampaign(campaign: Campaign): Campaign {\n\tconst copy = utils.clone(campaign) as Campaign;\n\tdelete copy.lastMessage;\n\tif (copy.summary) copy.summary = undefined;\n\tcopy.clonedFrom = `${copy.id || ''}`;\n\tcopy.name += ' (Copy)';\n\tcopy.isActive = false;\n\tcopy.created = 0;\n\tcopy.recipe = {};\n\tcopy.recipes = {};\n\tcopy.isLocked = false;\n\tcopy.id = undefined;\n\tif (!utils.AYR.includes(utils.uid) && !utils.hideVoiceConvs.includes(utils.uid)) {\n\t\tcopy.conversionActions = Array.from(new Set([...(copy.conversionActions || []), 'call_vm', 'call_answer']));\n\t}\n\tif (copy.enableQueue) {\n\t\tcopy.scheduled = Math.floor(Date.now() / 1000) - timeUtils.units.MINUTE_S * 5;\n\t}\n\treturn copy;\n}\n\nexport function isChannelEmpty(channel?: CampaignChannel): boolean {\n\tconst copy: CampaignChannel = utils.clone(channel || {});\n\tif (copy.priority) delete copy.priority;\n\tif (Object.keys(copy).length === 0) return true;\n\treturn false;\n}\n\nexport function getTriggers(campaign: Campaign): Campaign['triggers'] {\n\tconst triggers: Campaign['triggers'] = utils.clone(campaign.triggers || {});\n\tdelete triggers?.geoFence;\n\tdelete triggers?.geoFenceConditions;\n\treturn triggers;\n}\n\nconst getAllChannels = () => Object.keys(CampaignChannelsMap) as CampaignChannelType[];\n\nexport function getCampaignChannels(input: ChannelInput): (ChannelInfo & CampaignChannel)[] {\n\t// IF input is a campaign, we assume that it is a waterfall campaign\n\tif (input.isWaterfall) {\n\t\treturn getAllChannels()\n\t\t\t.map((channel) => {\n\t\t\t\tconst channelCampaign = input.campaign[channel];\n\t\t\t\treturn {\n\t\t\t\t\tchannel,\n\t\t\t\t\tisSelected: !isChannelEmpty(channelCampaign),\n\t\t\t\t\t...channelCampaign,\n\t\t\t\t} as ChannelInfo;\n\t\t\t})\n\t\t\t.sort((a, b) => {\n\t\t\t\t// If both are undefined we sort by default\n\t\t\t\tif (a.priority === undefined && b.priority === undefined) {\n\t\t\t\t\tconst defaultA = CampaignChannelsMap[a.channel].defaultPriority;\n\t\t\t\t\tconst defaultB = CampaignChannelsMap[b.channel].defaultPriority;\n\t\t\t\t\treturn defaultA - defaultB;\n\t\t\t\t}\n\t\t\t\t// undefined priorities are sorted to the end\n\t\t\t\tif (a.priority === undefined) return 1;\n\t\t\t\tif (b.priority === undefined) return -1;\n\t\t\t\treturn (a?.priority || 0) - (b?.priority || 0);\n\t\t\t});\n\t}\n\treturn getAllChannels()\n\t\t.map((channel) => {\n\t\t\tconst channelCampaign = input.campaigns[channel]?.[channel];\n\t\t\treturn {\n\t\t\t\tchannel,\n\t\t\t\tisSelected: !isChannelEmpty(channelCampaign),\n\t\t\t\t...channelCampaign,\n\t\t\t} as ChannelInfo;\n\t\t})\n\t\t.sort((a, b) => {\n\t\t\tconst defaultA = CampaignChannelsMap[a.channel].defaultPriority;\n\t\t\tconst defaultB = CampaignChannelsMap[b.channel].defaultPriority;\n\t\t\treturn defaultA - defaultB;\n\t\t});\n}\n\ntype ChannelChanges = {\n\t[key in CampaignChannelType]: {\n\t\tchannel: CampaignChannelType;\n\t\tstart: number;\n\t\tend: number;\n\t};\n};\n\nexport function validateCampaignChannelPriority(campaign: Campaign): { campaign: Campaign; changed: ChannelChanges } {\n\t// Get all channels\n\tconst changed = getAllChannels()\n\t\t// Filter out channels that are not selected\n\t\t.filter((channel) => !isChannelEmpty(campaign[channel]) && campaign[channel]?.priority !== undefined && CampaignChannelsMap[channel].isVisible())\n\t\t// Map to channel and priority\n\t\t.map((channel) => ({ channel, priority: campaign[channel]?.priority as number }))\n\t\t// Sort by priority\n\t\t.sort((a, b) => a.priority - b.priority)\n\t\t// Update channels with invalid priority and return the changes\n\t\t.reduce((acc, chan, index) => {\n\t\t\tconst { channel, priority } = chan;\n\t\t\tif (priority > index) {\n\t\t\t\t(campaign[channel] as CampaignChannel).priority = index;\n\t\t\t\tacc[channel] = { channel, start: priority, end: index };\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} as ChannelChanges);\n\treturn { campaign, changed };\n}\n\ntype ChannelPriorityUpdate = {\n\tcampaign: Campaign;\n\tchanged: boolean;\n\tchanges?: ChannelChanges;\n};\n\nexport function setCampaignChannelPriority(campaign: Campaign, channel: CampaignChannelType, priority: number): ChannelPriorityUpdate {\n\tlet copy: Campaign = utils.clone(campaign);\n\n\tconst campaignChannels = getCampaignChannels({ isWaterfall: true, campaign: copy });\n\n\tconst maxPriorityAllowed = campaignChannels.filter((chan) => chan.isSelected).length - 1;\n\tconst currentPriority: number = copy[channel]?.priority || 0;\n\tconst newPriority = Math.max(0, Math.min(priority, maxPriorityAllowed));\n\n\tif (userUtils.debugMode()) {\n\t\tconsole.log('%c--------------------%csetCampaignChannelPriority%c--------------------', 'color: green', 'color: aqua', 'color: green');\n\t\tconsole.log('channel:', channel);\n\t\tconsole.log('priority:', priority);\n\t\tconsole.log('copy:', copy);\n\t\tconsole.log('campaignChannels:', campaignChannels);\n\t\tconsole.log('maxPriorityAllowed:', maxPriorityAllowed);\n\t\tconsole.log('currentPriority:', currentPriority);\n\t\tconsole.log('newPriority:', newPriority);\n\t\tconsole.log('%c--------------------%csetCampaignChannelPriority%c--------------------', 'color: green', 'color: aqua', 'color: green');\n\t}\n\n\t// If currentyPriority === newPriority, we don't need to do anything\n\tif (currentPriority === newPriority) return { campaign, changed: false };\n\n\tconst hasCurrentPriority = currentPriority !== undefined;\n\tconst shiftingLeft = hasCurrentPriority && currentPriority > newPriority;\n\tconst shiftingRight = hasCurrentPriority && currentPriority < newPriority;\n\tconst distance = Math.abs(newPriority - currentPriority);\n\n\t// If we are shifting over by just one, we can just swap the priorities\n\tif (distance === 1) {\n\t\tconst channelToSwap = campaignChannels.find((chan) => chan.priority === newPriority)?.channel;\n\t\tif (channelToSwap) {\n\t\t\tcopy[channelToSwap] = { ...copy[channelToSwap], priority: currentPriority };\n\t\t\tcopy[channel] = { ...copy[channel], priority: newPriority };\n\t\t}\n\t\treturn { campaign: copy, changed: true };\n\t}\n\n\tconst channelsToUpdate = campaignChannels\n\t\t.filter((chan) => chan.isSelected && chan.priority !== currentPriority)\n\t\t.filter((chan) => {\n\t\t\tconst isNewPriority = chan.priority === newPriority;\n\t\t\tconst isAboveNewPriority = chan.priority > newPriority && shiftingLeft;\n\t\t\tconst isBelowNewPriority = chan.priority < newPriority && shiftingRight;\n\t\t\treturn isNewPriority || isAboveNewPriority || isBelowNewPriority;\n\t\t})\n\t\t.map((chan) => chan.channel);\n\n\t// Update the priority of the channels in between\n\tchannelsToUpdate.forEach((chan) => {\n\t\tconst channelPriority = copy[chan]?.priority;\n\t\tif (channelPriority === undefined) return;\n\t\tconst isAboveNewPriority = channelPriority >= newPriority && shiftingLeft;\n\t\tconst isBelowNewPriority = channelPriority <= newPriority && shiftingRight;\n\t\tif (isAboveNewPriority && channelPriority < currentPriority) {\n\t\t\tcopy[chan] = { ...copy[chan], priority: channelPriority + 1 };\n\t\t\tconsole.log(`Chan: ${chan} | Priority: ${channelPriority} | New Priority: ${channelPriority + 1}. (Is Above)`);\n\t\t}\n\t\tif (isBelowNewPriority && channelPriority > currentPriority) {\n\t\t\tcopy[chan] = { ...copy[chan], priority: channelPriority - 1 };\n\t\t\tconsole.log(`Chan: ${chan} | Priority: ${channelPriority} | New Priority: ${channelPriority - 1}. (Is Below)`);\n\t\t}\n\t});\n\n\t// Set the priority of the channel\n\tcopy[channel] = { ...copy[channel], priority: newPriority };\n\n\t// Validate the campaign chanenls are in bounds, though should be unnecessary\n\tcopy = validateCampaignChannelPriority(copy).campaign;\n\n\treturn { campaign: copy, changed: true };\n}\n\n// This gets merged with existing campaign so ensure values added here are always included in the campaign struct\n// ! (no omitempty)'s or they will be removed\nexport const DefaultCampaign = (tempID?: string, campaign: Campaign = {}): Campaign => {\n\treturn {\n\t\tdraft: true,\n\t\tblast: true,\n\t\ttype: 'TEXT',\n\t\trecurDays: -1,\n\t\tconversionWindow: 14,\n\t\ttimezone: TimezoneSelect.DefaultTZ,\n\t\tconversionActions: (Object.keys(CampaignConversionActionMap) as ConversionAction[]).filter((key) => CampaignConversionActionMap[key].defaultEnabled),\n\t\t...campaign,\n\t\ttempID,\n\t} as Campaign;\n};\n\ntype ScheduleContent = {\n\tdateRange?: DateRange;\n\tsendWindow?: SendWindow;\n\tblast?: boolean;\n\tscheduled?: number;\n\t// sendAtTimePredicted?: boolean\n};\n\nexport function haveSameSchedule(campaigns: Campaign[]): boolean {\n\tconst schedule: ScheduleContent = {\n\t\tdateRange: campaigns[0].dateRange,\n\t\tblast: campaigns[0].blast,\n\t\tscheduled: campaigns[0].scheduled,\n\t\tsendWindow: campaigns[0].sendWindow,\n\t\t// sendAtTimePredicted: campaigns[0].sendAtTimePredicted,\n\t};\n\n\tfor (let i = 1; i < campaigns.length; i++) {\n\t\tconst campaign = campaigns[i];\n\t\t// if campaign has a different date range, return false\n\t\tif (schedule.dateRange) {\n\t\t\tif (!campaign.dateRange) return false;\n\t\t\tif (campaign.dateRange.start !== schedule.dateRange.start) return false;\n\t\t\tif (campaign.dateRange.end !== schedule.dateRange.end) return false;\n\t\t}\n\t\t// if campaign has a different blast, return false\n\t\tif (campaign.blast !== schedule.blast) return false;\n\t\t// if campaign has a different scheduled, return false\n\t\tif (campaign.scheduled !== schedule.scheduled) return false;\n\t\t// if campaign has a different sendWindow, return false\n\t\tif (schedule.sendWindow) {\n\t\t\tif (!campaign.sendWindow) return false;\n\t\t\tif (campaign.sendWindow.start !== schedule.sendWindow.start) return false;\n\t\t\tif (campaign.sendWindow.end !== schedule.sendWindow.end) return false;\n\t\t}\n\t\t// if campaign has a different sendAtTimePredicted, return false\n\t\t// if (campaign.sendAtTimePredicted !== schedule.sendAtTimePredicted) return false\n\t}\n\n\treturn true;\n}\n\n// Return an object with only the schedule keys that are shared\nexport function getCampaignSchedule(campaign: Campaign): ScheduleContent {\n\tif (!campaign) return {};\n\tconst schedule: ScheduleContent = {\n\t\tdateRange: campaign.dateRange,\n\t\tblast: campaign.blast,\n\t\tscheduled: campaign.scheduled,\n\t\tsendWindow: campaign.sendWindow,\n\t\t// sendAtTimePredicted: campaign.sendAtTimePredicted,\n\t};\n\t// Remove keys that are undefined as to not override the default values\n\tfor (const key of Object.keys(schedule) as (keyof ScheduleContent)[]) {\n\t\tif (schedule[key] === undefined) delete schedule[key];\n\t}\n\treturn utils.clone(schedule);\n}\n\nexport function getCampaignType(campaign: Campaign): CampaignType {\n\tconst channelTypes = (Object.keys(CampaignTypesMapping) as CampaignType[]).map((key) => {\n\t\tconst typeInfo = CampaignTypesMapping[key];\n\t\tconst hasType = typeInfo.check(campaign);\n\t\treturn { key, hasType };\n\t});\n\n\treturn channelTypes.find((type) => type.hasType)?.key || 'normal';\n}\n\ntype InfoValidation = {\n\t[key in keyof Campaign]: string | ((campaign: Campaign, next: Campaign, channel: CampaignChannelType) => boolean);\n};\nconst informationKeys: InfoValidation = {\n\tname: (prev, next, channel) => {\n\t\t// Remove the \"- <Channel>\" from the name\n\t\tconst channelName = CampaignChannelsMap[channel].shortName;\n\t\tconst channelNameIndex = (prev.name || '').indexOf(channelName);\n\t\tconst prevName = (prev.name || '').slice(0, channelNameIndex).trim();\n\t\tconst nextName = (next.name || '').slice(0, channelNameIndex).trim();\n\t\treturn prevName === nextName;\n\t},\n\tstoreIDHash: (prev, next) => isEqual(prev.storeIDHash, next.storeIDHash),\n\ttriggers: (prev, next) => isEqual(getTriggers(prev), getTriggers(next)),\n\taudiences: (prev, next) => isEqual(prev.audiences, next.audiences),\n\texclude: (prev, next) => isEqual(prev.exclude, next.exclude),\n\tstoreIDs: (prev, next) => isEqual(prev.storeIDs, next.storeIDs),\n\ttags: 'tags',\n\tcapPerDay: 'capPerDay',\n\tsendAtTimePredicted: 'sendAtTimePredicted',\n} as const;\n\nexport function isCampaignInformationMatching(channelMap: CampaignMap): boolean {\n\tconst channels = Object.keys(channelMap) as CampaignChannelType[];\n\tconst channel = channels[0];\n\tconst campaign = channelMap[channel] as Campaign;\n\n\tfor (let i = 1; i < channels.length; i++) {\n\t\tconst otherChannel = channels[i];\n\t\tconst otherCampaign = channelMap[otherChannel] as Campaign;\n\t\tfor (const key of Object.keys(informationKeys) as (keyof Campaign)[]) {\n\t\t\tconst value = informationKeys[key];\n\t\t\tif (typeof value === 'string') {\n\t\t\t\tif (JSON.stringify(campaign[key] || '') !== JSON.stringify(otherCampaign[key] || '')) return false;\n\t\t\t} else if (typeof value === 'function') {\n\t\t\t\tif (!value(campaign, otherCampaign, channel)) return false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n// Return a campaign object with only the information keys\nexport function getCampaignInformation(campaign: Campaign): Campaign {\n\tif (!campaign) return {};\n\tconst campaignChannel = getCampaignChannelType(campaign);\n\tconst newCampaign: Campaign = {};\n\tfor (const key of Object.keys(informationKeys) as (keyof Campaign)[]) {\n\t\tlet value = campaign[key];\n\t\tif (key === 'name' && campaignChannel) {\n\t\t\t// Remove the \"- <Channel>\" from the name\n\t\t\tconst channelName = ` - ${CampaignChannelsMap[campaignChannel].shortName}`;\n\t\t\tconst channelNameIndex = ((value || '') as string).indexOf(channelName);\n\t\t\tvalue = ((value || '') as string).slice(0, channelNameIndex).trim();\n\t\t}\n\t\t// @ts-ignore - TS doesn't like the type of informationKeys\n\t\tnewCampaign[key] = value;\n\t}\n\t// Remove keys that are undefined as to not override the default values\n\tfor (const key of Object.keys(newCampaign) as (keyof Campaign)[]) {\n\t\tif (newCampaign[key] === undefined) delete newCampaign[key];\n\t}\n\treturn newCampaign;\n}\n\nexport function addChannelNameToCampaigns(campaigns: CampaignMap, options?: SaveCampaignOption): CampaignMap {\n\t// Loop over the channels and add the channel name to the campaign. But only if all names are the same\n\tconst channels = Object.keys(campaigns) as CampaignChannelType[];\n\tconst firstChannel = channels[0] as CampaignChannelType;\n\tconst firstCampaignName = campaigns[firstChannel]?.name || ('' as string);\n\n\tconst newCampaigns: CampaignMap = utils.clone(campaigns);\n\n\tif (!!options) {\n\t\tchannels.forEach((channel) => {\n\t\t\tconst campaign = newCampaigns[channel];\n\t\t\tif (campaign) {\n\t\t\t\tif (options === 'publish') {\n\t\t\t\t\tcampaign.isActive = true;\n\t\t\t\t}\n\t\t\t\tcampaign.draft = false;\n\t\t\t}\n\t\t});\n\t\treturn newCampaigns;\n\t}\n\n\t// Check if all of the channels have the same name\n\tconst allSameName = channels.every((channel) => {\n\t\tconst campaign = campaigns[channel];\n\t\treturn campaign?.name === firstCampaignName;\n\t});\n\n\t// If they are not all the same, return\n\tif (!allSameName || Object.keys(campaigns || {}).length === 1) return newCampaigns;\n\n\t// If they are all the same, add the channel name to the campaign\n\tchannels.forEach((channel) => {\n\t\tconst campaign = newCampaigns[channel];\n\t\tif (campaign) {\n\t\t\tcampaign.name = `${firstCampaignName} - ${CampaignChannelsMap[channel].shortName}`;\n\t\t}\n\t});\n\treturn newCampaigns;\n}\n\nexport function deleteAllChannels(campaign: Campaign): Campaign {\n\tconst copy = utils.clone(campaign);\n\tgetAllChannels().forEach((channel) => delete copy[channel]);\n\treturn copy;\n}\n\nexport function campaignHasRecipientsConfigured(campaign: Campaign): string[] {\n\tconst errors = [] as string[];\n\tif (!campaign.name) errors.push('Campaign must have a name');\n\tif (!campaign.audiences || campaign.audiences.length === 0) {\n\t\terrors.push('Campaign must have at least one audience');\n\t}\n\treturn errors;\n}\n\nexport function validateCampaigns(args: CampaignBuilderStagesProps, requireContent = false): string[] {\n\tconst errors: string[] = [];\n\t// Must select a channel before anything\n\tif (args.selectedCount === 0) errors.push('You must select at least one channel to create a campaign.');\n\n\tconst isMatching = args.config.sameInformation && args.config.sameSchedule;\n\t// If we are in a waterfall campaign or the information is matching, we validate the campaign\n\tif (args.isWaterfall || isMatching) {\n\t\tconst campaign = args.getCampaign();\n\t\t// Validate all of the channels\n\t\tif (requireContent) {\n\t\t\targs.channels\n\t\t\t\t.filter((channel) => channel.isSelected)\n\t\t\t\t.forEach((channel) => {\n\t\t\t\t\t// Check if channel has content\n\t\t\t\t\tconst channelInfo = CampaignChannelsMap[channel.channel];\n\t\t\t\t\tconst channelData = campaign[channel.channel] as CampaignChannel;\n\t\t\t\t\tif (channelInfo.hasContent && !channelInfo.hasContent(channelData || {}, campaign)) {\n\t\t\t\t\t\terrors.push(`${channelInfo.shortName} must have content before creating a campaign.`);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\terrors.push(...validateSingleCampaign(campaign));\n\t} else {\n\t\t// Otherwise we validate each of the campaigns\n\t\tfor (const [channel, campaign] of Object.entries(args.campaigns) as [CampaignChannelType, Campaign][]) {\n\t\t\tif (requireContent) {\n\t\t\t\tconst channelInfo = CampaignChannelsMap[channel];\n\t\t\t\tconst channelData = campaign[channel] as CampaignChannel;\n\t\t\t\t// Check if channel has content\n\t\t\t\tif (channelInfo.hasContent && !channelInfo.hasContent(channelData || {}, campaign)) {\n\t\t\t\t\terrors.push(`${channelInfo.shortName} must have content before creating a campaign.`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst channelErrors = validateSingleCampaign(campaign);\n\t\t\tif (channelErrors.length > 0) {\n\t\t\t\terrors.push(...channelErrors.map((error) => `${CampaignChannelsMap[channel].shortName}: ${error}`));\n\t\t\t}\n\t\t}\n\t}\n\treturn errors;\n}\nconst dynamicRegex = new RegExp(/\\{\\{dynamic-[A-Za-z0-9]+-[A-Za-z0-9]+-[A-Za-z0-9]+\\}\\}/gi);\nconst isDynamic = (html: string) => dynamicRegex.test(html || '') || (html || '')?.includes(`id=\"dynamic`);\n\nexport function validateSingleCampaign(campaign: Campaign): string[] {\n\tconst errors: string[] = [];\n\n\tif (!campaign.name) errors.push('Campaign must have a name');\n\tif (!campaign.audiences || campaign.audiences.length === 0) {\n\t\terrors.push('Campaign must have at least one audience');\n\t}\n\n\t// If campaign is optinCampin don't allow HTML landing pages\n\tif (campaign.optinCampaign && campaign.templates?.landingType === 'HTML') {\n\t\terrors.push('You cannot use HTML landing pages with opt-in campaigns!');\n\t}\n\n\tconst hasQueue = campaign.enableQueue;\n\tconst hasLifetimeCap = (campaign.lifetimeCap ?? 0) > 0;\n\t// Blast date cannot be in past (if set)\n\t// If they have lifetime cap, or queue enabled, we ignore the send date being in the past\n\tif (!hasQueue && !hasLifetimeCap && campaign.scheduled && campaign.scheduled < Date.now() / 1000) {\n\t\terrors.push('Send date cannot be in the past');\n\t}\n\n\t// If campaign has hashStoreId's then it is a sponsored campaign, and there cannot be store ID's and audiences\n\tif (campaign.storeIDHash && Object.keys(campaign.storeIDHash).length) {\n\t\t// If audiences is not just ['all] return err\n\t\tif ((campaign.audiences || []).length !== 1 && (campaign.audiences || [])[0] !== 'all') {\n\t\t\terrors.push('You must target \"All subscribed users\" when creating a campaign targeting connected stores.');\n\t\t}\n\t\t// If they have selected stores return err\n\t\tif (campaign.storeIDs?.length) {\n\t\t\terrors.push('You cannot select stores when creating a campaign targeting connected stores.');\n\t\t}\n\t\t// same for excluded audiences\n\t\tif (campaign.exclude?.length) {\n\t\t\terrors.push('You cannot exclude audiences when creating a campaign targeting connected stores.');\n\t\t}\n\t}\n\n\tconst isBrand = utils.isBrand();\n\n\t// Retailer specific checks\n\tif (!isBrand) {\n\t\tif (campaign?.emailTemplate && !campaign?.emailTemplate.from) {\n\t\t\terrors.push('You must input a \"From email\" inside your email template if you wish to send emails!');\n\t\t}\n\t}\n\n\tif (isBrand) {\n\t\tif (campaign.templates && !campaign.templates.msgContainer) {\n\t\t\terrors.push('You must select a \"Message Container\" inside your text template before saving');\n\t\t}\n\t}\n\n\tif (campaign.templates) {\n\t\tconst hasMsgContainer = campaign.templates.msgContainer;\n\t\tconst hasBody = campaign.templates.body;\n\t\tif (hasMsgContainer && hasBody && !campaign.templates.landingType) {\n\t\t\terrors.push('Campaign has invalid \"Landing Type\" (Can occur when cloning legacy campaigns)');\n\t\t}\n\t}\n\n\t// Check dynamic content\n\t[\n\t\t{\n\t\t\ttype: 'Text Channel',\n\t\t\thtml: campaign.templates?.landingHTML,\n\t\t\tjson: campaign.templates?.landingDesign,\n\t\t\tdynamicContent: campaign.templates?.dynamicContent,\n\t\t},\n\t\t{\n\t\t\ttype: 'Email Channel',\n\t\t\thtml: campaign.emailTemplate?.html,\n\t\t\tjson: campaign.emailTemplate?.json,\n\t\t\tdynamicContent: campaign.emailTemplate?.dynamicContent,\n\t\t},\n\t].forEach((info) => {\n\t\tif (info.html) {\n\t\t\tconst htmlHasDynamicMacros = isDynamic(info.html);\n\t\t\tconst sampleDataEnabled = JSON.stringify(info.json || {}).includes(`\"showSampleData\":true,`);\n\t\t\tconst hasConfiguredContent = info?.dynamicContent || Object.keys(info?.dynamicContent || {}).length > 0;\n\n\t\t\t// If they have dynamic content, but no dynamic macros, throw an error\n\t\t\tif (hasConfiguredContent && !htmlHasDynamicMacros) {\n\t\t\t\terrors.push(`Add dynamic content before saving your ${info.type} with a \"Product Feed\" filter!`);\n\t\t\t}\n\n\t\t\t// If they have dynamic macros, but no dynamic content, throw an error\n\t\t\tif (htmlHasDynamicMacros && !hasConfiguredContent) {\n\t\t\t\terrors.push(`You must configure your dynamic content before saving your ${info.type} with dynamic macros!`);\n\t\t\t}\n\n\t\t\tif (sampleDataEnabled) {\n\t\t\t\terrors.push(`You must disable sample dynamic content data before saving! (You may need to toggle it on/off again)`);\n\t\t\t}\n\t\t}\n\t});\n\n\tcheckInvalidMacroEnding(campaign.templates?.msgContainer || '');\n\n\t//\n\t// Bypassing this check for now\n\t//\n\t// If they are on 10dlc they are not allowed to have mmsMediaUrls\n\t// const templates = campaign.templates\n\t// if (utils.hasRestrictedIndustry10DLC() && templates) {\n\t// \tconst mmsURL = templates?.mmsMediaURL\n\t// \tconst hasMMSMedia = templates?.mediaURL && (templates.isMMS || templates.mmsOnly)\n\t// \tif (mmsURL || hasMMSMedia) {\n\t// \t\terrors.push('You are not allowed to use MMS media URLs in your campaign.')\n\t// \t}\n\t// }\n\treturn errors;\n}\n\nexport function lockMMSURL(campaign: Campaign): Campaign {\n\tif (campaign && campaign.templates) {\n\t\tif (utils.user.optinImage !== '') {\n\t\t\tcampaign.templates.mmsMediaURL = utils.user.optinImage;\n\t\t} else {\n\t\t\tcampaign.templates.mmsMediaURL = `https://lab.alpineiq.com/avatar/${uid}/-1?cacheBuster=${Date.now()}&mms=true`;\n\t\t}\n\t\tcampaign.templates.mediaContentType = 'image';\n\t}\n\treturn campaign;\n}\n\nexport function removeUnusedProductSlugs(campaign: Campaign): Campaign {\n\tif (!!campaign.templates?.slugs?.length) {\n\t\tconst textHtml = campaign.templates.landingHTML || '';\n\t\t// Check that the textHTML contains the slugs, if not remove them\n\t\tcampaign.templates.slugs = campaign.templates.slugs.filter((slug) => textHtml.includes(slug));\n\t}\n\n\tif (!!campaign.emailTemplate?.slugs?.length) {\n\t\tconst emailHtml = campaign.emailTemplate.html || '';\n\t\t// Check that the emailHTML contains the slugs, if not remove them\n\t\tcampaign.emailTemplate.slugs = campaign.emailTemplate.slugs.filter((slug) => emailHtml.includes(slug));\n\t}\n\treturn campaign;\n}\n\nexport function cleanEmailTemplate(campaign: Campaign): Campaign {\n\t// &amp; is breaking the links so we need to remove it.\n\tif (campaign.emailTemplate?.html) {\n\t\tcampaign.emailTemplate.html = campaign.emailTemplate.html?.replaceAll(/&amp;/g, '&');\n\t}\n\treturn campaign;\n}\n\nexport function checkInvalidMacroEnding(html: string): boolean {\n\tif (!html) return false;\n\n\tconst linkMacros = getLinkMacros();\n\tconst endMacroMatch = (html.match(/{{[^}]+}}[^? ][^ ]{0,5}/g) || [])\n\t\t// Filter out macros which don't need to be checked\n\t\t.filter((macroString) => {\n\t\t\t// Remove everything before & after the {{macro}}\n\t\t\tconst realMacro = macroString.match(/{{[^}]+}}/g)?.[0] || '';\n\t\t\t// Check if the macro is a link macro\n\t\t\tif (!linkMacros.includes(realMacro)) return false;\n\t\t\treturn true;\n\t\t});\n\n\tif (endMacroMatch.length) {\n\t\tutils.sendNotification({\n\t\t\ttype: 'warning',\n\t\t\tmessage: 'Warning!',\n\t\t\tdescription: `Please do not follow macros with a character direcly after the closing \"${endMacroMatch}\", as it may cause issues with your template when sending your campaign.`,\n\t\t});\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport function hasCampaignChannel(input: ChannelInput, channel: CampaignChannelType): boolean {\n\tif (input.isWaterfall) {\n\t\treturn !isChannelEmpty(input.campaign[channel]);\n\t}\n\treturn !isChannelEmpty(input.campaigns[channel]?.[channel]);\n}\n\nexport async function sendTestEmail(recipient: string, templateData: EmailTemplate): Promise<boolean> {\n\tconst lastSend = utils.local.get('lastTestEmailSend');\n\tconst now = Date.now();\n\tconst COOLDOWN = 30 * 1000;\n\tif (lastSend && now - lastSend < COOLDOWN) {\n\t\tconst timeRemaining = Math.round((COOLDOWN - (now - lastSend)) / 1000);\n\t\tutils.showErr(`Please wait ${timeRemaining} seconds before sending another test email`);\n\t\treturn false;\n\t}\n\n\tconst email = recipient?.trim();\n\tif (!email) {\n\t\tutils.showErr('Missing email to send test to');\n\t\treturn false;\n\t}\n\n\tif (!templateData.subject) {\n\t\tutils.showErr('Missing subject');\n\t\treturn false;\n\t}\n\n\tif (!templateData.from) {\n\t\tutils.showErr('Missing from');\n\t\treturn false;\n\t}\n\n\tif ((templateData.html?.length || 0) >= 300_000 && utils.uid !== '1033') {\n\t\tutils.showErr('Email body is too large');\n\t\treturn false;\n\t}\n\n\t// &amp; is breaking the links so we need to remove it.\n\ttemplateData.html = templateData.html?.replaceAll(/&amp;/g, '&');\n\n\tawait asyncWrap(async () => {\n\t\tawait utils.auth.post(`sendTestEmail/${utils.uid}/${email}`, { emailTemplate: templateData });\n\t\tutils.showSuccess(`Test email sent to ${email}`);\n\t\tutils.local.set('lastTestEmailSend', now);\n\t});\n\treturn true;\n}\n\nexport async function sendTestText(recipient: string, templates: SMSTemplate): Promise<boolean> {\n\tconst lastSend = utils.local.get('lastTestTextSend');\n\tconst now = Date.now();\n\tconst COOLDOWN = 30 * 1000;\n\tif (lastSend && now - lastSend < COOLDOWN) {\n\t\tconst timeRemaining = Math.round((COOLDOWN - (now - lastSend)) / 1000);\n\t\tutils.showErr(`Please wait ${timeRemaining} seconds before sending another test phone`);\n\t\treturn false;\n\t}\n\n\tconst phone = recipient?.trim();\n\tif (!phone) {\n\t\tutils.showErr('Missing phone to send test to');\n\t\treturn false;\n\t}\n\n\tif (!utils.phoneRex.test(phone)) {\n\t\tutils.showErr('Invalid phone number');\n\t\treturn false;\n\t}\n\n\tawait asyncWrap(async () => {\n\t\tawait fetchAPI(`/campaign/full/preview/:uid?sendToPhone=${phone}`, {\n\t\t\tpayload: { id: 'DNE', templates },\n\t\t\tmethod: 'POST',\n\t\t});\n\t\tutils.showSuccess(`Test phone sent to ${phone}`);\n\t\tutils.local.set('lastTestTextSend', now);\n\t});\n\treturn true;\n}\n\nexport type DisabledMap = { [key in CampaignChannelType]?: string[] };\nexport type DisabledCMP = {\n\tdisabled: boolean;\n\treasons?: string[];\n\tdisabledMap?: DisabledMap;\n};\nexport function isCampaignDisabled(input: ChannelInput): DisabledCMP {\n\tif (input.isWaterfall) {\n\t\t// If the campaign is locked, it is disabled\n\t\treturn isDisabled(input.campaign);\n\t}\n\tconst disabledCmp = { disabled: false, reasons: [], disabledMap: undefined } as DisabledCMP;\n\tfor (const [channel, campaign] of Object.entries(input.campaigns) as [CampaignChannelType, Campaign][]) {\n\t\tconst result = isDisabled(campaign);\n\t\tdisabledCmp.disabledMap = { ...disabledCmp.disabledMap, [channel]: result.reasons || [] };\n\t\tif (result.disabled) {\n\t\t\t// aggregate disabled reasons\n\t\t\tdisabledCmp.disabled = disabledCmp.disabled || result.disabled;\n\t\t\tdisabledCmp.reasons = [...(disabledCmp.reasons || []), ...(result.reasons || [])];\n\t\t}\n\t}\n\treturn { ...disabledCmp, reasons: Array.from(new Set(disabledCmp.reasons || [])) };\n}\n\nconst isDisabled = (campaign: Campaign): DisabledCMP => {\n\tconst reasons = [] as string[];\n\t// if (utils.isLocal() && campaign.id !== \"1331\") return { disabled: true, reasons: ['Local testing'] }\n\tif (campaign.userID !== '3652' && campaign.userID !== '1163' && hasCamaignSent(campaign)) {\n\t\treasons.push('Cannot edit a campaign after it has already been sent');\n\t}\n\t// if (isPastSendDate(campaign)) reasons.push('Campaign has passed the send date')\n\t// if (isCampaignActive(campaign)) reasons.push('Cannot edit a campaign that is active')\n\tif (isCampaignLocked(campaign)) reasons.push(campaign.lockedReason ? `Locked: ${campaign.lockedReason}` : `Campaign is locked`);\n\treturn {\n\t\tdisabled: reasons.length > 0,\n\t\treasons,\n\t};\n};\n\nexport function isCampaignLocked(campaign: Campaign): boolean {\n\treturn !!campaign.isLocked;\n}\n\nexport function hasCamaignSent(campaign: Campaign): boolean {\n\treturn !!campaign.lastMessage && !!campaign.blast && !(utils.isLocal() || utils.isStaging());\n}\n\nexport function isCampaignActive(campaign: Campaign): boolean {\n\treturn !!campaign.isActive;\n}\n\nexport function isPastSendDate(campaign: Campaign, bufferTime?: number): boolean {\n\tif (campaign.blast) {\n\t\tif (!campaign.scheduled) return false;\n\t\tconst sendTime = campaign.scheduled || 0;\n\t\tconst now = Date.now() / 1000;\n\t\tconst buffer = bufferTime || 0;\n\t\treturn sendTime + buffer < now;\n\t\t// return !!campaign.scheduled && campaign.scheduled < Date.now() / 1000\n\t}\n\tif (campaign.dateRange?.active && campaign.dateRange?.end) {\n\t\treturn campaign.dateRange.end < Date.now() / 1000;\n\t}\n\treturn false;\n}\n\n// Get CampaignChannelType from Campaign.. only works if there is one channel\nexport function getCampaignChannelType(campaign: Campaign): CampaignChannelType | undefined {\n\t// Loop over channels and find first one that is not empty\n\tfor (const channel of getAllChannels()) {\n\t\tif (!isChannelEmpty(campaign[channel])) return channel;\n\t}\n\treturn undefined;\n}\n\n// Get campaign without any channel data\nexport function getCampaignWithoutChannel(campaign: Campaign): Campaign {\n\tif (!campaign) return {};\n\tconst copy = utils.clone(campaign || {});\n\tgetAllChannels().forEach((channel) => delete copy[channel]);\n\treturn copy;\n}\n\n// Remove all info not required for forecast\nexport function cleanForecastableCampaign(campaign: Campaign, noChannel?: boolean): Campaign {\n\tconst copy: Campaign = utils.clone(campaign || {});\n\t// return copy\n\tconst cleaned: Campaign = {\n\t\tid: copy.id || '-1',\n\t\tstoreIDHash: copy.storeIDHash,\n\t\tstoreIDs: copy.storeIDs,\n\t\taudiences: copy.audiences,\n\t\texclude: copy.exclude,\n\t\toptinCampaign: copy.optinCampaign,\n\t\temailOptinCampaign: copy.emailOptinCampaign,\n\t\t//     scheduled: copy.scheduled,\n\t\t//     blast: copy.blast,\n\t\t//     dateRange: copy.dateRange,\n\t\t//     sendWindow: copy.sendWindow,\n\t\t//     sendAtTimePredicted: copy.sendAtTimePredicted,\n\t\t//     triggers: copy.triggers,\n\t};\n\n\t// Remove all channels that are empty\n\tif (!noChannel) {\n\t\tObject.keys(CampaignChannelsMap).forEach((channel) => {\n\t\t\tconst channelData = copy[channel as CampaignChannelType];\n\t\t\tif (isChannelEmpty(channelData)) return;\n\t\t\tcleaned[channel as CampaignChannelType] = {\n\t\t\t\tinUse: true,\n\t\t\t\t...(channel === 'templates' && {\n\t\t\t\t\tmsgContainer: copy.templates?.msgContainer,\n\t\t\t\t\tbody: copy.templates?.body,\n\t\t\t\t\tisMMS: copy.templates?.isMMS,\n\t\t\t\t\tmmsOnly: copy.templates?.mmsOnly,\n\t\t\t\t}),\n\t\t\t\t...(channel === 'voiceTemplate' && {\n\t\t\t\t\tttv: copy.voiceTemplate?.ttv,\n\t\t\t\t\tvoiceFile: copy.voiceTemplate?.voiceFile,\n\t\t\t\t}),\n\t\t\t} as CampaignChannel;\n\t\t});\n\t}\n\n\t// Clean off any undefined values, or empty arrays\n\treturn utils.trimObject(cleaned, true, false, true, true);\n}\n\nexport type ContentValidationResults = {\n\tblankAudiences: string[];\n\tbyTemplate: TemplateValidationResults;\n};\n\nexport type TemplateValidationResults = { [key in CampaignChannelType]: TemplateValidationResult };\nexport type TemplateValidationResult = {\n\tbrokenMacros?: string[];\n\tdiscountMacros?: string[];\n\tinvaildMacros?: string[];\n\twarningMacros?: string[];\n};\n\n// Keys to check which can contain macros\nconst contentKeys = ['title', 'body', 'custom', 'html', 'msgContainer', 'landingHTML'];\n\nexport function validateCampaignContent(\n\tcampaigns: Campaign[],\n\tchannels: CampaignChannel & { channel: CampaignChannelType }[],\n\taudiences: EntryMap<Audience>,\n\tcheckMacros = false,\n): ContentValidationResults {\n\tconst results: ContentValidationResults = {\n\t\tblankAudiences: [],\n\t\tbyTemplate: {\n\t\t\tadTemplate: {},\n\t\t\temailTemplate: {},\n\t\t\tvoiceTemplate: {},\n\t\t\ttemplates: {},\n\t\t\tbrowserTemplate: {},\n\t\t\tpushTemplate: {},\n\t\t\tsnailMailTemplate: {},\n\t\t},\n\t};\n\n\t// Create a set of all audiences\n\tconst allAudiences = new Set(campaigns.flatMap((campaign) => campaign.audiences || []));\n\n\t// Check if any audiences are\n\tfor (const audienceID of Array.from(allAudiences)) {\n\t\tif (audienceID === 'all') {\n\t\t\tresults.blankAudiences = [];\n\t\t\tbreak;\n\t\t}\n\t\tconst result = audiences[audienceID];\n\t\tif (result && !result.traits?.length && (result.sources?.includes(-1) || !result.sources?.length)) {\n\t\t\tresults.blankAudiences.push(result.id || '');\n\t\t}\n\t}\n\n\tif (checkMacros) {\n\t\t// Loop over each channel, and check if the content\n\t\tchannels.forEach((channel) => {\n\t\t\tconst channelKey = channel.channel;\n\t\t\tlet checkText: string = contentKeys.reduce((text, key) => (key in channel ? text + (channel as any)[key] : text), '').toLowerCase();\n\n\t\t\tconsole.log(`Checking ${channelKey} for macros`);\n\n\t\t\tif (!checkText) return;\n\n\t\t\tconst allValidMacros = findValidMacros(checkText);\n\t\t\t// const allValidMacros = checkText.match(/(?:{{(.+?)}})/g);\n\n\t\t\t// Remove all valid macros from the checkText\n\t\t\tif (allValidMacros) {\n\t\t\t\tfor (const macro of allValidMacros) {\n\t\t\t\t\tif (channelKey in bannedMacrosByTemplate) {\n\t\t\t\t\t\tconst bannedMacros = bannedMacrosByTemplate[channelKey as CampaignChannelType];\n\t\t\t\t\t\tif (bannedMacros?.includes(macro)) {\n\t\t\t\t\t\t\tconst invalidMacroList = results.byTemplate[channelKey as CampaignChannelType].invaildMacros || [];\n\t\t\t\t\t\t\tresults.byTemplate[channelKey as CampaignChannelType].invaildMacros = [...invalidMacroList, macro];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (warningMacros.includes(macro)) {\n\t\t\t\t\t\tconst warninMacroList = results.byTemplate[channelKey as CampaignChannelType].warningMacros || [];\n\t\t\t\t\t\tresults.byTemplate[channelKey as CampaignChannelType].warningMacros = [...warninMacroList, macro];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!checkText) break;\n\n\t\t\t\t\tcheckText = checkText.replaceAll(macro, '');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// all banned macros from all te mplates\n\t\t\tconst allBannedMacros = (Object.values(bannedMacrosByTemplate) as string[][]).flat();\n\n\t\t\t// (Object.entries(CampaignBuilderMacros)).forEach(([key, value]: [string, Macro]) => {\n\t\t\tfor (const [key, value] of Object.entries(CampaignBuilderMacros)) {\n\t\t\t\tlet matchValue: string | RegExp = utils.strify(value.macro);\n\t\t\t\tif ('regex' in value) {\n\t\t\t\t\tconst regex = value.regex as RegExp;\n\t\t\t\t\t// IF macro is \"discounts\", use regex to add all discount macros to discountMacros\n\t\t\t\t\tif (key === 'discounts') {\n\t\t\t\t\t\tconst discountMacros = checkText.match(regex);\n\t\t\t\t\t\tif (discountMacros) {\n\t\t\t\t\t\t\tresults.byTemplate[channelKey as CampaignChannelType].discountMacros = discountMacros;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tmatchValue = regex;\n\t\t\t\t}\n\n\t\t\t\tif (!checkText) break;\n\n\t\t\t\tif (warningMacros.includes(value.macro.toLowerCase()) || allBannedMacros.includes(value.macro.toLowerCase())) {\n\t\t\t\t\tcheckText?.replaceAll(matchValue, '');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcheckText = checkText\n\t\t\t\t.replace(/<style.*?>[\\s\\S]*?<\\/style>|style=\"[a-zA-Z0-9:;\\.\\s\\(\\)\\-\\,]*\"|<[^>]*>|\\s+/gi, '') // Remove all whitespace and style tags and html tags\n\t\t\t\t.replace(/\\s+/g, '') // Remove all whitespace\n\t\t\t\t.replace(/\\s+|<style[\\s\\S]*?<\\/style>|style=\"[a-zA-Z0-9:;\\.\\s\\(\\)\\-\\,]*\"|<style.*?>[\\s\\S]*?<\\/style>|style.*?>[\\s\\S]*?<\\/style>/gi, '') // Remove all style tags\n\t\t\t\t// Remove all basic html\n\t\t\t\t// .replace(/<[^>]*>/g, '')\n\t\t\t\t.trim();\n\n\t\t\tif (!checkText) return;\n\n\t\t\tif (checkText.length && (checkText.includes('{') || checkText.includes('}'))) {\n\t\t\t\tconst brokenMacrosMap = new Map();\n\t\t\t\t[...(checkText.match(/\\{\\{[^}\\n]*\\}|\\{[^}\\n]*\\}\\}?|[^{\\n]*?\\}\\}(?!\\})/g) || []), ...(checkText.match(/\\{\\{[^}\\n]*?(?=\\{|$)|[^{\\n]*?\\}\\}/g) || [])].forEach(\n\t\t\t\t\t(macro) => {\n\t\t\t\t\t\tconst cleaned = macro.replaceAll('{', '').replaceAll('}', '');\n\t\t\t\t\t\t// Strip the macro length to a max of 50 characters\n\t\t\t\t\t\tbrokenMacrosMap.set(cleaned, macro.length > 32 ? `${macro.slice(0, 32)}...` : macro);\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (brokenMacrosMap.size > 0) {\n\t\t\t\t\tresults.byTemplate[channelKey as CampaignChannelType].brokenMacros = Array.from(brokenMacrosMap.values());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\treturn results;\n}\n\nfunction findValidMacros(checkText: string): string[] {\n\tconst regexPatterns = [\n\t\t/\\{\\{[^{}]+\\}\\}/g, // Standard Macro Matching\n\t\t/\\{\\{[a-zA-Z0-9_]+\\}\\}/g, // Macro Matching with Specific Characters\n\t\t/\\{\\{[^{}:;]+?\\}\\}/g, // Macro Matching with Negated Set\n\t];\n\n\t// Find all matches for each regex pattern\n\tconst validMacros = new Set<string>();\n\tregexPatterns.flatMap((regex) => checkText.match(regex) || []).forEach((macro) => validMacros.add(macro.toLowerCase()));\n\n\treturn Array.from(validMacros);\n}\n\nexport function canTestSendTextMessages() {\n\tif (utils.isDispojoy() || utils.isMessageDigital() || utils.isPolitical()) {\n\t\treturn true;\n\t}\n\tif (utils.isPolitical()) {\n\t\treturn true;\n\t}\n\tif (utils.isDevUID()) {\n\t\treturn true;\n\t}\n\treturn utils.hasApprovedTelnyxCampaign() || utils.hasInfoBipCampaignID();\n}\n","import { isEqual, template } from 'lodash';\nimport { timeUtils, utils } from '../../../helpers';\nimport { Audience, EntryMap, Store } from '@/legacy-types';\nimport { RecipeStatus } from '../../recipes/recipeUtils';\nimport { Campaign, CampaignChannel, CampaignChannelsMap, CampaignChannelType, CampaignMap, EmailTemplate, SendgridDomainCheck, SMSTemplate } from '@/legacy-types';\nimport { DisabledMap, campaignHasRecipientsConfigured, getTriggers, hasCamaignSent, validateCampaigns } from './cmp.builder.helpers';\nimport { TemplateFiltersState } from './components/template-browser/template.brower.types';\n\nexport type CampaignPermissions = {\n\tdisableActivation?: boolean;\n};\n\nexport type SaveCampaignOption = 'publish' | 'de-draft';\nexport type CampaignBuilderPageProps = {\n\tisPreview?: boolean;\n\n\tuid: string;\n\tisActive: boolean;\n\tisDisabled: (channel?: CampaignChannelType) => boolean;\n\tdisabledReasons: (channel?: CampaignChannelType) => string[];\n\tdisabledMap?: DisabledMap;\n\n\tlastSave?: number;\n\tloaded: boolean;\n\n\tisExternalEditor?: boolean; // If this campaign is being viewed as a preview. Usually for recipe templates\n\tisInstaller?: boolean; // If the viewer is an installer\n\n\tisWaterfall: boolean;\n\tsetIsWaterfall: React.Dispatch<React.SetStateAction<boolean>>;\n\n\tselectedStage: CampaignBuilderStage | undefined;\n\tsetSelectedStage: React.Dispatch<React.SetStateAction<CampaignBuilderStage | undefined>>;\n\n\tselectedChannel: CampaignChannelType | undefined;\n\tsetSelectedChannel: React.Dispatch<React.SetStateAction<CampaignChannelType | undefined>>;\n\n\tgetCampaign: (channel?: CampaignChannelType) => Campaign;\n\tupdateCampaign: (campaign: Campaign, channel?: CampaignChannelType | true) => void;\n\tupdateChannel: (channel: CampaignChannelType, data: Partial<CampaignChannel>) => void;\n\n\tsaveCampaign: (option?: SaveCampaignOption) => void;\n\tshowCancel: boolean;\n\tcancelProcess: () => void;\n\tchangeStage: (stage: CampaignBuilderStage, opts?: ChangeStageOpts) => boolean;\n\n\trecipeStatus: RecipeStatus;\n\tsetRecipeStatus: React.Dispatch<React.SetStateAction<RecipeStatus>>;\n\n\tchannels: (ChannelInfo & CampaignChannel)[];\n\tchannelMap: CmpChannelMap;\n\tselectedCount: number;\n\n\tstores: EntryMap<Store>;\n\n\taudiences: EntryMap<Audience>;\n\tsetAudiences: React.Dispatch<React.SetStateAction<EntryMap<Audience>>>;\n\n\tconfig: CampaignBuilderConfig;\n\tsetConfig: React.Dispatch<React.SetStateAction<CampaignBuilderConfig>>;\n\n\tsendgridDomainCheck?: SendgridDomainCheck | undefined;\n\n\ttextSegments: number | undefined;\n\tsetTextSegments: React.Dispatch<React.SetStateAction<number | undefined>>;\n};\n\nexport type CampaignBuilderChannelsProps = CampaignBuilderPageProps & {\n\tcampaign: Campaign;\n\tsetCampaign: React.Dispatch<React.SetStateAction<Campaign>>;\n\tcampaigns: CampaignMap;\n\tsetCampaigns: React.Dispatch<React.SetStateAction<CampaignMap>>;\n\togCampaigns?: CampaignMap;\n};\nexport type CampaignBuilderContentProps = CampaignBuilderPageProps & {\n\tsendgridDomainCheck?: SendgridDomainCheck | undefined;\n\tsetPreviewConfig?: React.Dispatch<React.SetStateAction<ContentPreviewConfig>>;\n};\nexport type CampaignBuilderRecipientsProps = CampaignBuilderPageProps & {\n\tisInformationMatching: () => boolean;\n};\nexport type CampaignBuilderReviewProps = CampaignBuilderPageProps & {\n\tcampaign: Campaign;\n\tcampaigns: CampaignMap;\n\togCampaigns: CampaignMap;\n\togCampaign: Campaign;\n\tsetCampaigns: React.Dispatch<React.SetStateAction<CampaignMap>>;\n\n\tclonedCampaign?: Campaign | undefined;\n\tsetClonedCampaign: React.Dispatch<React.SetStateAction<Campaign | undefined>>;\n\n\tclonedCampaigns: CampaignMap;\n\tsetClonedCampaigns: React.Dispatch<React.SetStateAction<CampaignMap>>;\n};\n\nexport type CampaignBuilderStagesProps = {\n\tconfig: CampaignBuilderConfig;\n\tisWaterfall: boolean;\n\tcampaign: Campaign;\n\tcampaigns: CampaignMap;\n\tselectedStage: CampaignBuilderStage | undefined;\n\tselectedChannel: CampaignChannelType | undefined;\n\tchannels: (ChannelInfo & CampaignChannel)[];\n\tselectedCount: number;\n\tgetCampaign: (channel?: CampaignChannelType) => Campaign;\n};\n\nexport type CampaignReviewPageSubProps = {};\n\nexport type CampaignChannelSelectorProps = {\n\tisWaterfall: boolean;\n\tchannel: CampaignChannelType;\n\tisSelected: boolean;\n\tpriority: number;\n\tmaxPriorityAllowed: number;\n\n\ttoggleSelected: () => void;\n\tsetPriority: (priority: number) => boolean;\n\n\tdoesOverflow: boolean;\n\tdisabled?: boolean;\n\n\tlockedReasons?: string[];\n};\nexport type ChannelInfo = {\n\tchannel: CampaignChannelType;\n\tpriority: number;\n\tisSelected?: boolean;\n};\n\nexport type CmpChannelMap = {\n\t[key in CampaignChannelType]: {\n\t\tisSelected: boolean;\n\t\tpriority: number;\n\t};\n};\n\nexport type ToggleWaterfallConfig = {\n\tconfirmed: boolean; // They have confirmed that they want to switch\n\tcopyTemplates?: boolean; // They want to copy templates from the previous campaign if it exists\n\tcopyTemplate?: CampaignChannelType; // They want to copy a specific template from the previous campaign if it exists\n\tarchivePrevious?: boolean; // They want to archive the previous campaign if it exists\n};\n\nexport const CampaignTypesMapping = {\n\tnormal: {\n\t\ttitle: 'Normal',\n\t\tdescription: 'Send a one-off campaign to your audience',\n\t\tconfirm: false,\n\t\tvisisble() {\n\t\t\treturn true;\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\tconst isRandomLottery = !!campaign.capPerDay;\n\t\t\tconst triggers = getTriggers(campaign);\n\t\t\tconst hasTriggers = !!triggers && Object.values(triggers || {}).filter(Boolean).length > 0;\n\t\t\tconst isOptin = campaign.optinCampaign || campaign.emailOptinCampaign;\n\n\t\t\treturn !isRandomLottery && !hasTriggers && !isOptin;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.capPerDay = undefined;\n\t\t\tcampaign.triggers = undefined;\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = false;\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: [],\n\t\t\t\tusage: [],\n\t\t\t};\n\t\t},\n\t},\n\tabandonedCart: {\n\t\ttitle: 'Abandoned cart',\n\t\tdescription: 'Send a campaign to customers who have abandoned their cart',\n\t\tconfirm: false,\n\t\tvisisble() {\n\t\t\treturn true;\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.triggers?.abandonedCart;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.capPerDay = undefined;\n\t\t\tcampaign.triggers = { abandonedCart: true };\n\t\t\tcampaign.sendAtTimePredicted = false;\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = false;\n\n\t\t\t// When enabling abandoned cart we also have to switch to ongoing\n\t\t\tcampaign = CampaignScheduleTypesMapping.ongoing.enable(campaign);\n\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: [],\n\t\t\t\tusage: ['Abandoned Cart'],\n\t\t\t};\n\t\t},\n\t},\n\tpostPurchase: {\n\t\ttitle: 'Post-purchase survey or review',\n\t\tdescription: 'Send a campaign to customers who have recently purchased',\n\t\tconfirm: false,\n\t\tvisisble() {\n\t\t\treturn true;\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.triggers?.postSale;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.capPerDay = undefined;\n\t\t\tcampaign.triggers = { postSale: true };\n\t\t\tcampaign.sendAtTimePredicted = false;\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = false;\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: ['Post Purchase'],\n\t\t\t\tusage: ['Post Purchase'],\n\t\t\t};\n\t\t},\n\t},\n\tbirthdayReward: {\n\t\ttitle: 'Birthday award',\n\t\tdescription: 'Send a campaign to customers on their birthday',\n\t\tconfirm: false,\n\t\tvisisble() {\n\t\t\treturn true;\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.triggers?.birthday;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.capPerDay = undefined;\n\t\t\tcampaign.triggers = { birthday: true };\n\t\t\tcampaign.sendAtTimePredicted = false;\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = false;\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: ['Birthday'],\n\t\t\t\tusage: [],\n\t\t\t};\n\t\t},\n\t},\n\trandomLottery: {\n\t\ttitle: 'Random lottery',\n\t\tdescription: 'Send a campaign to a random selection of your audience per day',\n\t\tconfirm: false,\n\t\tvisisble() {\n\t\t\treturn true;\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.capPerDay;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.capPerDay = 1;\n\t\t\tcampaign.triggers = undefined;\n\t\t\tcampaign.sendAtTimePredicted = false;\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = false;\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: [],\n\t\t\t\tusage: [],\n\t\t\t};\n\t\t},\n\t},\n\tsmsOptin: {\n\t\ttitle: 'SMS opt-in',\n\t\tdescription: 'This feature has been enabled via a manual override by Alpine IQ staff. Switch on at your own risk!',\n\t\tconfirm: true,\n\t\tvisisble() {\n\t\t\tconst showOptInToggle = ['1062', '4125', '1099', '1159', '1002', '1243', '1653', '2182', '1345', '2932', '2692', '3384', '1096'];\n\t\t\treturn utils.isDevUID() || showOptInToggle.includes(utils.uid);\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.optinCampaign;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.optinCampaign = true;\n\t\t\tcampaign.emailOptinCampaign = false;\n\t\t\tif (campaign.templates) {\n\t\t\t\tcampaign.templates = {\n\t\t\t\t\t...campaign.templates,\n\t\t\t\t\tlandingType: 'RAW',\n\t\t\t\t} as SMSTemplate;\n\t\t\t}\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: [],\n\t\t\t\tusage: [],\n\t\t\t};\n\t\t},\n\t},\n\temailOptin: {\n\t\ttitle: 'Email opt-in',\n\t\tdescription: 'This feature has been enabled via a manual override by Alpine IQ staff. Switch on at your own risk!',\n\t\tconfirm: true,\n\t\tvisisble() {\n\t\t\treturn utils.user?.disableImplicitEmail || utils.isDevUID();\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.emailOptinCampaign;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.optinCampaign = false;\n\t\t\tcampaign.emailOptinCampaign = true;\n\t\t\treturn campaign;\n\t\t},\n\t\tgetDefaultTemplateKeysFilters: (): TemplateFiltersState => {\n\t\t\treturn {\n\t\t\t\tindustries: [],\n\t\t\t\ttags: [],\n\t\t\t\tusage: [],\n\t\t\t};\n\t\t},\n\t},\n} as const;\n\nexport type CampaignType = keyof typeof CampaignTypesMapping;\n\nexport const CampaignScheduleTypesMapping = {\n\tblast: {\n\t\ticon: 'rocket',\n\t\ttitle: 'Blast',\n\t\tdescription: 'Campaign starts sending to all recipients at the defined start time',\n\t\tshow: (args: CampaignBuilderStagesProps) => true,\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\tif (campaign.enableQueue) return false;\n\t\t\tconst isBlast = !!campaign.blast || (campaign.blast === undefined && !campaign.id);\n\t\t\treturn isBlast && !campaign.dateRange?.active;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\t// campaign.scheduled = 0;\n\t\t\tcampaign.blast = true;\n\t\t\tcampaign.enableQueue = false;\n\t\t\tcampaign.recurDays = -1;\n\t\t\tcampaign.dateRange = undefined;\n\t\t\treturn campaign;\n\t\t},\n\t},\n\tongoing: {\n\t\ticon: 'arrows-rotate',\n\t\ttitle: 'Ongoing',\n\t\tdescription: 'Campaign starts sending to recipients as soon as they are added after the defined start time',\n\t\tshow: (args: CampaignBuilderStagesProps) => true,\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\tconst isBlast = !!campaign.blast || (campaign.blast === undefined && !campaign.id);\n\t\t\treturn !isBlast && !campaign?.dateRange?.active;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\t// campaign.scheduled = 0;\n\t\t\tcampaign.blast = false;\n\t\t\tcampaign.enableQueue = false;\n\t\t\tcampaign.recurDays = -1;\n\t\t\tcampaign.dateRange = { active: false, start: 0, end: 0 };\n\t\t\treturn campaign;\n\t\t},\n\t},\n\tstartEnd: {\n\t\ticon: 'flag-checkered',\n\t\ttitle: 'Start & End',\n\t\tdescription: 'Campaign starts sending to recipients at the defined start time and anyone until the end time',\n\t\tshow: (args: CampaignBuilderStagesProps) => true,\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.dateRange && !!campaign.dateRange.active;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.enableQueue = false;\n\t\t\tcampaign.scheduled = 0;\n\t\t\tcampaign.recurDays = -1;\n\t\t\tcampaign.blast = false;\n\t\t\tif (campaign.dateRange) campaign.dateRange.active = true;\n\t\t\telse campaign.dateRange = { active: true };\n\t\t\treturn campaign;\n\t\t},\n\t},\n\tqueue: {\n\t\ticon: 'paper-plane-top',\n\t\ttitle: 'Queue',\n\t\tdescription: 'Send messages to clients one at a time',\n\t\tshow: (args: CampaignBuilderStagesProps) => {\n\t\t\t// This cannot be used if there are any non - SMS channels\n\t\t\tfor (const channel of args.channels) {\n\t\t\t\tif (channel.channel !== 'templates' && channel.inUse) return false;\n\t\t\t}\n\t\t\treturn utils.isDevUID() || utils.user.profile?.industry === 'political';\n\t\t},\n\t\tcheck: (campaign: Campaign): boolean => {\n\t\t\treturn !!campaign.enableQueue;\n\t\t},\n\t\tenable: (campaign: Campaign): Campaign => {\n\t\t\tcampaign.enableQueue = true;\n\t\t\tcampaign.scheduled = Math.floor(Date.now() / 1000) - timeUtils.units.MINUTE_S * 5;\n\t\t\tcampaign.blast = true;\n\t\t\tcampaign.recurDays = -1;\n\t\t\tcampaign.dateRange = undefined;\n\t\t\treturn campaign;\n\t\t},\n\t},\n};\n\nexport type CampaignScheduleTypes = keyof typeof CampaignScheduleTypesMapping;\n\nexport type ChannelInput =\n\t| {\n\t\t\tisWaterfall?: false | undefined;\n\t\t\tcampaign: Campaign;\n\t\t\tcampaigns: CampaignMap;\n\t\t\togCampaigns?: CampaignMap;\n\t  }\n\t| {\n\t\t\tisWaterfall: true;\n\t\t\tcampaign: Campaign;\n\t\t\togCampaign?: Campaign;\n\t  };\ntype Errors = string[];\nexport const CampaignBuilderStages = {\n\tchannels: {\n\t\tindex: 0,\n\t\tname: 'Channels',\n\t\t// This is the first stage so it has always started\n\t\thasStarted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\treturn true;\n\t\t},\n\t\t// Stage is considered completed after channels have been selected\n\t\t// and the user has moved on to the next stage\n\t\thasCompleted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isCompleted = CampaignBuilderStages.channels.checkCompleted(args).length === 0;\n\t\t\tconst isOnChannelStage = args.selectedStage === 'channels';\n\t\t\treturn isCompleted && !isOnChannelStage;\n\t\t},\n\t\tcheckCompleted: (args: CampaignBuilderStagesProps): Errors => {\n\t\t\tconst hasChannels = args.selectedCount > 0;\n\t\t\tif (!hasChannels) return ['You must select at least one channel before continuing'];\n\t\t\treturn [];\n\t\t},\n\t},\n\trecipients: {\n\t\tindex: 1,\n\t\tname: 'Recipients',\n\t\t// This stage has started if the user has selected this stage\n\t\t// OR if the user has already completed the stage\n\t\thasStarted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isMatching = args.config.sameInformation;\n\t\t\tconst isOnRecipientsStage = args.selectedStage === 'recipients';\n\t\t\tconst hasCompleted = CampaignBuilderStages.recipients.hasCompleted(args);\n\t\t\t// IF campaign has a name then we have started\n\t\t\tif (args.isWaterfall || isMatching) {\n\t\t\t\tconst campaign = args.getCampaign();\n\t\t\t\tif (!!campaign.name || !!campaign.audiences?.length) return true;\n\t\t\t} else {\n\t\t\t\tfor (const campaign of Object.values(args.campaigns)) {\n\t\t\t\t\tif (!!campaign.name || !!campaign.audiences?.length) return true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn isOnRecipientsStage || hasCompleted;\n\t\t},\n\t\t// Stage is considered completed after recipients have been selected (for each campaign)\n\t\thasCompleted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isCompleted = CampaignBuilderStages.recipients.checkCompleted(args).length === 0;\n\t\t\tconst isOnRecipientsStage = args.selectedStage === 'recipients';\n\t\t\treturn isCompleted && !isOnRecipientsStage;\n\t\t},\n\t\tcheckCompleted: (args: CampaignBuilderStagesProps): Errors => {\n\t\t\tconst isMatching = args.config.sameInformation;\n\t\t\t// If waterfall only need to check one campaign\n\t\t\t// Also IF sameInformation is true then we only need to check one campaign\n\t\t\tif (args.isWaterfall || isMatching) {\n\t\t\t\tconst campaign = args.getCampaign();\n\t\t\t\tconst errs = campaignHasRecipientsConfigured(campaign);\n\t\t\t\tif (!!errs.length) return errs;\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\t// If we have no campaigns then we have not started\n\t\t\tif (Object.keys(args.campaigns).length === 0) {\n\t\t\t\treturn ['Could not find any campaigns'];\n\t\t\t}\n\t\t\tconst errors: Errors = [];\n\t\t\t// Otherwise we need to check each campaign has completed\n\t\t\tfor (const [channel, campaign] of Object.entries(args.campaigns) as [CampaignChannelType, Campaign][]) {\n\t\t\t\tconst errs = campaignHasRecipientsConfigured(campaign);\n\t\t\t\tif (!!errs.length) {\n\t\t\t\t\tconst channelName = CampaignChannelsMap[channel].shortName;\n\t\t\t\t\terrors.push(...errs.map((err) => `${channelName} ${err}`));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t},\n\tcontent: {\n\t\tindex: 2,\n\t\tname: 'Content',\n\t\t// This stage has started if the user has selected this stage\n\t\t// OR if the user has already completed the stage\n\t\thasStarted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isOnContentStage = args.selectedStage === 'content';\n\t\t\tconst hasCompletedPrev = CampaignBuilderStages.recipients.hasCompleted(args);\n\t\t\t// IF any of the channels have content then we have started\n\t\t\tconst channels = args.channels.filter((channel) => channel.isSelected);\n\t\t\tfor (const channel of channels) {\n\t\t\t\tconst channelInfo = CampaignChannelsMap[channel.channel];\n\t\t\t\tconst hasContent = channelInfo.hasContent(channel, args.getCampaign(channel.channel));\n\t\t\t\tif (hasContent) return true;\n\t\t\t}\n\t\t\treturn isOnContentStage || hasCompletedPrev;\n\t\t},\n\t\t// Stage is considered completed after all selected channels have content and are valid\n\t\thasCompleted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isCompleted = CampaignBuilderStages.content.checkCompleted(args);\n\t\t\tconst isOnContentStage = args.selectedStage === 'content';\n\t\t\treturn isCompleted.length === 0 && !isOnContentStage;\n\t\t},\n\t\tcheckCompleted: (args: CampaignBuilderStagesProps): Errors => {\n\t\t\tconst errors: Errors = [];\n\t\t\tconst channels = args.channels.filter((channel) => channel.isSelected);\n\t\t\t// IF no channels are selected then we have not started\n\t\t\tif (channels.length === 0) {\n\t\t\t\treturn ['Could not find any channels'];\n\t\t\t}\n\t\t\t// Loop over each channel and check if it has content/validate\n\t\t\tfor (const channel of channels) {\n\t\t\t\tconst channelInfo = CampaignChannelsMap[channel.channel];\n\t\t\t\t// const isValid = channelInfo.validate(channel, args.getCampaign(channel.channel));\n\t\t\t\tconst hasContent = channelInfo.hasContent(channel, args.getCampaign(channel.channel));\n\t\t\t\t// if (!isValid || !hasContent) {\n\t\t\t\tif (!hasContent) {\n\t\t\t\t\terrors.push(`Content must be configured for ${channelInfo.shortName}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn errors;\n\t\t},\n\t},\n\treview: {\n\t\tindex: 3,\n\t\tname: 'Review',\n\t\t// This stage has started if the user has selected this stage\n\t\t// OR if the user has already completed the stage\n\t\thasStarted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isOnReviewStage = args.selectedStage === 'review';\n\t\t\tconst hasCompleted = CampaignBuilderStages.content.hasCompleted(args);\n\t\t\treturn isOnReviewStage || hasCompleted;\n\t\t},\n\t\t// Stage is considered completed after campaign is validated and all steps are completed\n\t\thasCompleted: (args: CampaignBuilderStagesProps): boolean => {\n\t\t\tconst isCompleted = CampaignBuilderStages.review.checkCompleted(args).length === 0;\n\t\t\tconst isOnReviewStage = args.selectedStage === 'review';\n\n\t\t\tlet hasMessage = false;\n\n\t\t\t// Check if campaign has sent a message\n\t\t\tif (args.isWaterfall) {\n\t\t\t\tconst campaign = args.getCampaign();\n\t\t\t\thasMessage = hasCamaignSent(campaign);\n\t\t\t} else {\n\t\t\t\tfor (const campaign of Object.values(args.campaigns)) {\n\t\t\t\t\thasMessage = hasCamaignSent(campaign);\n\t\t\t\t\tif (hasMessage) break;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn isCompleted && (!isOnReviewStage || hasMessage);\n\t\t},\n\t\tcheckCompleted: (args: CampaignBuilderStagesProps): Errors => {\n\t\t\tlet lastSend = args.campaign.lastMessage || 0;\n\t\t\tif (!args.isWaterfall) {\n\t\t\t\tfor (const campaign of Object.values(args.campaigns)) {\n\t\t\t\t\tif (campaign.lastMessage && campaign.lastMessage > lastSend) lastSend = campaign.lastMessage;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Check if campaign is valid\n\t\t\treturn lastSend && !utils.isLocal() ? [] : validateCampaigns(args, true);\n\t\t},\n\t},\n} as const;\n\nexport type CampaignBuilderStage = keyof typeof CampaignBuilderStages;\n\nexport type CampaignBuilderConfig = {\n\tsameSchedule?: boolean;\n\tsameInformation?: boolean;\n};\n\nexport type ChangeStageOpts = { ignoreErrors?: boolean };\n\nexport type ContentPreviewConfig =\n\t| { type: '' }\n\t| (\n\t\t\t| {\n\t\t\t\t\ttype: 'email';\n\t\t\t\t\ttemplate: EmailTemplate;\n\t\t\t  }\n\t\t\t| {\n\t\t\t\t\ttype: 'text';\n\t\t\t\t\ttemplate: SMSTemplate;\n\t\t\t  }\n\t  );\n\nexport const CampaignBuilderTextOptions = {\n\t'regular': {\n\t\ttitle: () => 'Regular SMS/MMS',\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\tconst template: SMSTemplate = campaign.templates || {};\n\t\t\treturn template.optionType === 'regular';\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\tconst industry = utils.user.profile?.industry;\n\t\t\tif ((industry === 'cannabis' || industry === 'brewery') && !utils.user.disableWalledGarden) return false;\n\t\t\treturn !utils.hasRestrictedIndustry10DLC();\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn !!campaign.optinCampaign;\n\t\t},\n\t},\n\t'regulated': {\n\t\ttitle: () => {\n\t\t\tconst industry = utils.user.profile?.industry;\n\t\t\tif (industry === 'cannabis' || industry === 'brewery') {\n\t\t\t\treturn 'Regulated industry text';\n\t\t\t}\n\t\t\treturn 'Text with landing page';\n\t\t},\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\tconst template: SMSTemplate = campaign.templates || {};\n\t\t\treturn template.optionType === 'regulated' || (!template.mmsOnly && !template.optionType);\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\treturn !utils.hasRestrictedIndustry10DLC();\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t},\n\t'mms-only': {\n\t\ttitle: () => 'MMS Image only',\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\tconst template = campaign.templates || {};\n\t\t\treturn template.optionType === 'mms-only' || (!!template.mmsOnly && !template.optionType);\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\treturn !utils.hasRestrictedIndustry10DLC();\n\t\t\t// const whiteListMMSOnly = (['1034', '2538', '1048', '2627', '1925', '2452', '2479', '2481', '2312', '2876', '2778', '2480', '1281'])\n\t\t\t// const canViewMMSOnly = (whiteListMMSOnly.includes(utils.uid))\n\t\t\t// return canViewMMSOnly\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn !!campaign.optinCampaign;\n\t\t},\n\t},\n\t'sms-10dlc': {\n\t\ttitle: () => {\n\t\t\treturn 'SMS with landing page';\n\t\t},\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\tconst template = campaign.templates || {};\n\t\t\treturn !template.isMMS;\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\tif (utils.user.mmsLogo) return false; // Users with MMS logo send mms by default and don't have the option to send SMS\n\t\t\treturn utils.hasRestrictedIndustry10DLC();\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t},\n\t'mms-10dlc': {\n\t\ttitle: () => {\n\t\t\treturn 'MMS with landing page';\n\t\t},\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\tconst template = campaign.templates || {};\n\t\t\treturn !!template.isMMS || !!utils.user.mmsLogo;\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\treturn utils.hasRestrictedIndustry10DLC();\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t},\n\t'walletPass': {\n\t\ttitle: () => {\n\t\t\treturn 'Wallet pass text';\n\t\t},\n\t\tisSelected(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t\tisAvailable(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t\tisDisabled(campaign: Campaign): boolean {\n\t\t\treturn false;\n\t\t},\n\t},\n} as const;\n\nexport type CampaignBuilderTextOption = keyof typeof CampaignBuilderTextOptions;\n\nexport interface CampaignPreview {\n\tsegments: number;\n\tbody: string;\n\tlandingHTML: string;\n\tpromoScore?: {\n\t\tscore: number;\n\t\tbreakdown: string;\n\t};\n}\n\nexport interface StaticProduct {\n\timageUrl?: string;\n\tproductName?: string;\n\tslug?: string;\n\tsalesPrice?: number;\n}\n\nexport const ClonedCampaignTrackerFields = {\n\tname: {\n\t\tname: 'Name',\n\t\tdescription: 'The name of your campaign has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedStage('recipients');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst ogName = ogCampaign.name || '';\n\t\t\tconst name = campaign.name || '';\n\t\t\treturn !!ogName && name === ogName;\n\t\t},\n\t},\n\trecipients: {\n\t\tname: 'Recipients ',\n\t\tdescription: 'The recipients of your campaign have not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedStage('recipients');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst ogAudiences = ogCampaign.audiences || [];\n\t\t\tconst audiences = campaign.audiences || [];\n\n\t\t\tif (!isEqual(ogAudiences, audiences)) return false;\n\n\t\t\tconst ogExcluded = ogCampaign.exclude || [];\n\t\t\tconst excluded = campaign.exclude || [];\n\n\t\t\tif (!isEqual(ogExcluded, excluded)) return false;\n\n\t\t\tconst ogStores = ogCampaign.storeIDs || [];\n\t\t\tconst stores = campaign.storeIDs || [];\n\n\t\t\tif (!isEqual(ogStores, stores)) return false;\n\n\t\t\tconst ogStoreHash = ogCampaign.storeIDHash || {};\n\t\t\tconst storeHash = campaign.storeIDHash || {};\n\n\t\t\tif (!isEqual(ogStoreHash, storeHash)) return false;\n\n\t\t\treturn true;\n\t\t},\n\t},\n\temail_subject: {\n\t\tname: 'Email subject',\n\t\tdescription: 'The subject line of your email channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('emailTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.emailTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.emailTemplate || {};\n\t\t\treturn !!ogTemplate?.subject && template?.subject === ogTemplate?.subject;\n\t\t},\n\t},\n\temail_content: {\n\t\tname: 'Email content',\n\t\tdescription: 'The content of your email channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('emailTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.emailTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.emailTemplate || {};\n\t\t\treturn !!ogTemplate?.html && template?.html === ogTemplate?.html;\n\t\t},\n\t},\n\ttext_mms_image: {\n\t\tname: 'Text MMS image',\n\t\tdescription: 'The image of your text channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('templates');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.templates || {};\n\t\t\tconst ogTemplate = ogCampaign.templates || {};\n\t\t\treturn !!ogTemplate.mmsMediaURL && template.mmsMediaURL === ogTemplate.mmsMediaURL;\n\t\t},\n\t},\n\ttext_message_body: {\n\t\tname: 'Text message body',\n\t\tdescription: 'The body of your text channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('templates');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.templates || {};\n\t\t\tconst ogTemplate = ogCampaign.templates || {};\n\t\t\treturn (!!ogTemplate.body && template.body === ogTemplate.body) || (!!ogTemplate.msgContainer && template.msgContainer === ogTemplate.msgContainer);\n\t\t},\n\t},\n\ttext_landing_page: {\n\t\tname: 'Text landing page',\n\t\tdescription: 'The landing page of your text channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('templates');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.templates || {};\n\t\t\tconst ogTemplate = ogCampaign.templates || {};\n\t\t\treturn !!ogTemplate.landingHTML && template.landingHTML === ogTemplate.landingHTML;\n\t\t},\n\t},\n\tvoice_ttv_message: {\n\t\tname: 'Text to voice message',\n\t\tdescription: 'The text to voice message of your voice channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('voiceTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.voiceTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.voiceTemplate || {};\n\t\t\treturn !!ogTemplate.ttv && template.ttv === ogTemplate.ttv;\n\t\t},\n\t},\n\tvoice_recording: {\n\t\tname: 'Voice audio file/recording',\n\t\tdescription: 'The voice audio for your voice channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('voiceTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.voiceTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.voiceTemplate || {};\n\t\t\treturn !!ogTemplate.voiceFile && template.voiceFile === ogTemplate.voiceFile;\n\t\t},\n\t},\n\tpush_image: {\n\t\tname: 'Push image',\n\t\tdescription: 'The image of your push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('pushTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.pushTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.pushTemplate || {};\n\t\t\treturn !!ogTemplate.mediaURL && template.mediaURL === ogTemplate.mediaURL;\n\t\t},\n\t},\n\tpush_subject: {\n\t\tname: 'Push subject',\n\t\tdescription: 'The subject line of your push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('pushTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.pushTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.pushTemplate || {};\n\t\t\treturn !!ogTemplate.title && template.title === ogTemplate.title;\n\t\t},\n\t},\n\tpush_content: {\n\t\tname: 'Push content',\n\t\tdescription: 'The content of your push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('pushTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.pushTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.pushTemplate || {};\n\t\t\treturn !!ogTemplate.body && template.body === ogTemplate.body;\n\t\t},\n\t},\n\tbrowser_push_image: {\n\t\tname: 'Browser push image',\n\t\tdescription: 'The image of your browser push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('browserTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.browserTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.browserTemplate || {};\n\t\t\treturn !!ogTemplate.mediaURL && template.mediaURL === ogTemplate.mediaURL;\n\t\t},\n\t},\n\tbrowser_push_subject: {\n\t\tname: 'Browser push subject',\n\t\tdescription: 'The subject line of your browser push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('browserTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.browserTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.browserTemplate || {};\n\t\t\treturn !!ogTemplate.title && template.title === ogTemplate.title;\n\t\t},\n\t},\n\tbrowser_push_content: {\n\t\tname: 'Browser push content',\n\t\tdescription: 'The content of your browser push channel has not been updated',\n\t\tonClick: (props: CampaignBuilderPageProps) => {\n\t\t\tprops.setSelectedChannel('browserTemplate');\n\t\t\tprops.setSelectedStage('content');\n\t\t},\n\t\tisSame: (campaign: Campaign, ogCampaign: Campaign): boolean => {\n\t\t\tconst template = campaign.browserTemplate || {};\n\t\t\tconst ogTemplate = ogCampaign.browserTemplate || {};\n\t\t\treturn !!ogTemplate.body && template.body === ogTemplate.body;\n\t\t},\n\t},\n} as const;\n\nexport type ClonedCampaignTrackerField = keyof typeof ClonedCampaignTrackerFields;\n","import { AutoComplete, Avatar, Empty, Modal, Select, Space } from 'antd';\nimport React from 'react';\nimport { EntryMap, LoaderState, getColumn, getColumns } from '@/legacy-types';\nimport { StaticProduct } from '../cmp.builder.types';\nimport { API, asyncWrap } from '../../../../api';\nimport GButton from '../../../../components/global/GButton';\nimport { SearchOutlined } from '@ant-design/icons';\nimport { colors, userUtils, utils } from '../../../../helpers';\nimport { useSearchDebounce } from '../../../../hooks/useSearchDebounce';\nimport FA from '../../../../components/global/FA';\nimport Break from '../../../../components/Break';\nimport GTable from '../../../../components/global/GTable';\nimport HighlightText from '../../../../components/HighlightText';\n\nexport interface ProductSelectorModalContextState {\n\tecomBrands: string[];\n\tecomCategories: string[];\n}\n\nexport type ProductSelectorModalContext = [\n\tecomData: ProductSelectorModalContextState,\n\tsetEcomData: React.Dispatch<React.SetStateAction<ProductSelectorModalContextState>>,\n];\n\nexport const ProductSelectorModalContextProvider = React.createContext<ProductSelectorModalContext | {}>({});\n\ntype ProductSelectorModalProps = {\n\tslugs?: string[];\n\tonConfirm: (products: EntryMap<StaticProduct>) => void;\n};\n\nexport default function ProductSelectorModal(props: ProductSelectorModalProps) {\n\tconst [open, setOpen] = React.useState(false);\n\tconst [inputValue, search, setSearch] = useSearchDebounce();\n\tconst [hasSearched, setHasSearched] = React.useState(false);\n\tconst [loader, setLoader] = React.useState<LoaderState>({ loading: false, loaded: false });\n\tconst [staticProducts, setStaticProducts] = React.useState<EntryMap<StaticProduct & { selected?: boolean }>>({});\n\n\tconst [ecomData, setEcomData] = React.useContext(ProductSelectorModalContextProvider) as ProductSelectorModalContext;\n\tconst [filters, setFilters] = React.useState({\n\t\tcategories: [],\n\t\tbrands: [],\n\t});\n\n\tReact.useEffect(() => {\n\t\tif (!loader.loaded)\n\t\t\tasyncWrap(\n\t\t\t\tasync () => {\n\t\t\t\t\tconst ecomBrands = (await API.getEcomBrands()) || [];\n\t\t\t\t\tconst ecomCategories = (await API.getEcomCategories()) || [];\n\n\t\t\t\t\t// If they have slugs, load the products\n\t\t\t\t\tif (props.slugs?.length) {\n\t\t\t\t\t\thandleSearch(true);\n\t\t\t\t\t}\n\n\t\t\t\t\tsetEcomData({ ecomBrands, ecomCategories });\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tfinallyCallback(wasError) {\n\t\t\t\t\t\tsetLoader({ loading: false, loaded: true });\n\t\t\t\t\t},\n\t\t\t\t\tcancelError: utils.isDemo() || utils.isStaging(),\n\t\t\t\t},\n\t\t\t);\n\t}, [open]);\n\n\tconst handleSearch = (initial?: boolean) => {\n\t\tasyncWrap(async () => {\n\t\t\tlet productsMap: EntryMap<StaticProduct & { selected?: boolean }> = {};\n\t\t\t// Load loacal products if we're in sandbox\n\t\t\tif (utils.isLocal() || utils.isStaging() || utils.isDemo()) {\n\t\t\t\tproductsMap = (await import('../../../../assets/sandbox/ecomProducts.json')) as EntryMap<StaticProduct>;\n\t\t\t} else {\n\t\t\t\tproductsMap =\n\t\t\t\t\t(await API.getStaticProducts({\n\t\t\t\t\t\tslugs: initial ? props.slugs : undefined,\n\t\t\t\t\t\tcategories: filters.categories || [],\n\t\t\t\t\t\tbrands: filters.brands || [],\n\t\t\t\t\t})) || {};\n\t\t\t}\n\n\t\t\t// Let user know if we found/didn't find any products\n\t\t\tif (Object.keys(productsMap).length === 0) {\n\t\t\t\tutils.showErr('No products found');\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tutils.showSuccess(`${utils.formatNumber(Object.keys(productsMap).length)} products found`);\n\t\t\t}\n\n\t\t\t// if intital load we onCOnfirm with the products that match props.slugs\n\t\t\tif (initial) {\n\t\t\t\tconst selectedProducts = Object.entries(productsMap).reduce((acc, [slug, product]) => {\n\t\t\t\t\tif (props.slugs?.includes(slug || '')) {\n\t\t\t\t\t\tacc[slug || ''] = product;\n\t\t\t\t\t\t// Set selected to true\n\t\t\t\t\t\tproductsMap[slug || ''].selected = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t}, {} as EntryMap<StaticProduct>);\n\t\t\t\tprops.onConfirm(selectedProducts);\n\t\t\t}\n\n\t\t\tsetStaticProducts(productsMap);\n\t\t\tsetHasSearched(true);\n\t\t});\n\t};\n\n\tconst selectProduct = (product: StaticProduct) => {\n\t\tconst isSelected = !!staticProducts[product.slug || '']?.selected;\n\t\tconst newProducts = { ...staticProducts };\n\t\tnewProducts[product.slug || ''].selected = !isSelected;\n\t\tsetStaticProducts(newProducts);\n\t};\n\n\tconst query = utils.strify(search);\n\tconst productList = React.useMemo(() => {\n\t\tlet results = Object.values(staticProducts);\n\t\tif (query) {\n\t\t\tresults = results.filter((product) => {\n\t\t\t\treturn utils.strify(product.productName).includes(query) || utils.strify(product.slug).includes(query);\n\t\t\t});\n\t\t}\n\t\treturn results.map((product, key) => ({\n\t\t\t...product,\n\t\t\tkey,\n\t\t\tlabel: product.productName,\n\t\t\tvalue: product.slug,\n\t\t}));\n\t}, [staticProducts, query]);\n\n\tconst categoryOptions = React.useMemo(() => {\n\t\treturn ecomData.ecomCategories.map((category) => ({ label: category, value: category }));\n\t}, [ecomData.ecomCategories]);\n\n\tconst brandOptions = React.useMemo(() => {\n\t\treturn ecomData.ecomBrands.map((brand) => ({ label: brand, value: brand }));\n\t}, [ecomData.ecomBrands]);\n\n\tif (!userUtils.hasPackageTier('marketing', 'pro')) return null;\n\n\treturn (\n\t\t<>\n\t\t\t<GButton\n\t\t\t\ttooltip='Select static products to insert into this template using the \"Static Product\" tool'\n\t\t\t\tonClick={() => setOpen(true)}\n\t\t\t>\n\t\t\t\t<div style={{ padding: 2 }}>\n\t\t\t\t\t<FA\n\t\t\t\t\t\tname=\"circle-plus\"\n\t\t\t\t\t\tstyle={{ marginRight: 5, opacity: 0.8 }}\n\t\t\t\t\t/>\n\t\t\t\t\tStatic products\n\t\t\t\t</div>\n\t\t\t</GButton>\n\n\t\t\t<Modal\n\t\t\t\topen={open}\n\t\t\t\tcentered\n\t\t\t\tonCancel={() => setOpen(false)}\n\t\t\t\twidth={'max-content'}\n\t\t\t\tbodyStyle={{ padding: '16px 32px' }}\n\t\t\t\tokText=\"Select products\"\n\t\t\t\tonOk={() => {\n\t\t\t\t\tconst selectedProducts = Object.values(staticProducts || {}).reduce((acc, product) => {\n\t\t\t\t\t\tif (product.selected) acc[product.slug || ''] = product;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t}, {} as EntryMap<StaticProduct>);\n\t\t\t\t\tprops.onConfirm(selectedProducts);\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div>\n\t\t\t\t\t<span style={{ fontSize: '1.25rem', fontWeight: 700, lineHeight: '130%' }}>Insert a product</span>\n\t\t\t\t\t<Break s=\"15\" />\n\t\t\t\t</div>\n\n\t\t\t\t<>\n\t\t\t\t\t<div style={{ display: 'flex', gap: 24, alignItems: 'center' }}>\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<AutoComplete\n\t\t\t\t\t\t\t\tstyle={{ width: '100%', minWidth: 300 }}\n\t\t\t\t\t\t\t\toptions={productList}\n\t\t\t\t\t\t\t\tfilterOption={utils.filterOption}\n\t\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t\t<Space>\n\t\t\t\t\t\t\t\t\t\t<SearchOutlined style={{ color: '#939399' }} /> Search media by name, tag, or type...\n\t\t\t\t\t\t\t\t\t</Space>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\t\tonChange={(value) => setSearch(value)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\tstyle={{ width: 200 }}\n\t\t\t\t\t\t\t\tplaceholder=\"Filter by category\"\n\t\t\t\t\t\t\t\tallowClear\n\t\t\t\t\t\t\t\tshowArrow\n\t\t\t\t\t\t\t\tmode=\"multiple\"\n\t\t\t\t\t\t\t\toptions={categoryOptions}\n\t\t\t\t\t\t\t\tvalue={filters.categories}\n\t\t\t\t\t\t\t\tonChange={(value) => setFilters({ ...filters, categories: value })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\tstyle={{ width: 200 }}\n\t\t\t\t\t\t\t\tplaceholder=\"Filter by brand\"\n\t\t\t\t\t\t\t\tallowClear\n\t\t\t\t\t\t\t\tshowArrow\n\t\t\t\t\t\t\t\tmode=\"multiple\"\n\t\t\t\t\t\t\t\toptions={brandOptions}\n\t\t\t\t\t\t\t\tvalue={filters.brands}\n\t\t\t\t\t\t\t\tonChange={(value) => setFilters({ ...filters, brands: value })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t<GButton\n\t\t\t\t\t\t\t\tsize=\"large\"\n\t\t\t\t\t\t\t\tonClick={() => handleSearch()}\n\t\t\t\t\t\t\t\ttype=\"primary\"\n\t\t\t\t\t\t\t\tstyle={{ paddingLeft: 24, paddingRight: 24 }}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\tSearch\n\t\t\t\t\t\t\t</GButton>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\n\t\t\t\t<div style={{ marginTop: 24 }}>\n\t\t\t\t\t<GTable\n\t\t\t\t\t\talternateHeader\n\t\t\t\t\t\tnoRadius\n\t\t\t\t\t\tpagination={{ defaultPageSize: 10 }}\n\t\t\t\t\t\tdataSource={productList}\n\t\t\t\t\t\tloading={loader.loading}\n\t\t\t\t\t\tcolumns={getColumns<StaticProduct & { selected?: boolean }>([\n\t\t\t\t\t\t\tgetColumn(\n\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t(product) => (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<GButton\n\t\t\t\t\t\t\t\t\t\t\ttype={product.selected ? 'primary' : 'default'}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ color: product.selected ? undefined : colors.primary.blue }}\n\t\t\t\t\t\t\t\t\t\t\tonClick={() => selectProduct(product)}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{product.selected ? 'Selected' : 'Select'}\n\t\t\t\t\t\t\t\t\t\t</GButton>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ width: '100px' },\n\t\t\t\t\t\t\t),\n\n\t\t\t\t\t\t\tgetColumn('PRODUCT', (product) => (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>\n\t\t\t\t\t\t\t\t\t\t<Avatar\n\t\t\t\t\t\t\t\t\t\t\tshape=\"square\"\n\t\t\t\t\t\t\t\t\t\t\tsize={50}\n\t\t\t\t\t\t\t\t\t\t\tsrc={product.imageUrl}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<HighlightText\n\t\t\t\t\t\t\t\t\t\t\ttext={product.productName}\n\t\t\t\t\t\t\t\t\t\t\tsearch={search}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)),\n\n\t\t\t\t\t\t\tgetColumn('PRICE', (product) => <>${utils.formatNumber(product.salesPrice)}</>),\n\t\t\t\t\t\t])}\n\t\t\t\t\t\tlocale={{\n\t\t\t\t\t\t\temptyText() {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<Empty\n\t\t\t\t\t\t\t\t\t\t\timage={Empty.PRESENTED_IMAGE_SIMPLE}\n\t\t\t\t\t\t\t\t\t\t\tdescription={hasSearched ? 'No products found' : 'Search for products'}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</Modal>\n\t\t</>\n\t);\n}\n","import React from 'react';\nimport Break from '../../../components/Break';\nimport { CampaignChannelType } from '@/legacy-types';\nimport { utils } from '@/helpers';\n\nexport type Macro = {\n\tname: string;\n\tdescription: string;\n\tmacro: string;\n\tisLink?: boolean;\n\tcategory: string;\n\trequiredPermissions?: {\n\t\tmarketing?: 'pro' | 'enterprise';\n\t\tloyalty?: 'starter' | 'pro' | 'enterprise';\n\t};\n\ttooltip?: React.ReactNode;\n\tregex?: RegExp;\n\tdontShowInMacroList?: boolean | (() => boolean);\n\tfallback?: boolean; // Some traits can have a fallback value\n};\n\nexport const getLinkMacros = () => {\n\treturn Object.values(CampaignBuilderMacros)\n\t\t.filter((macro) => macro.isLink)\n\t\t.map((macro) => macro.macro);\n};\n\nexport const CampaignBuilderMacros: Record<string, Macro> = {\n\tbrand: {\n\t\tname: 'Brand',\n\t\tdescription: 'Your Brand Name',\n\t\tmacro: '{{brand}}',\n\t\tcategory: 'General',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tdate: {\n\t\tname: 'Date',\n\t\tdescription: 'The date the message is sent',\n\t\tmacro: '{{date}}',\n\t\tcategory: 'General',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\treviewWidgetURL: {\n\t\tisLink: true,\n\t\tname: 'Review Widget URL',\n\t\tdescription: 'The URL to the contacts favorite store review widget',\n\t\tmacro: '{{reviewWidgetURL}}',\n\t\tcategory: 'General',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\twalletURL: {\n\t\tisLink: true,\n\t\tname: 'Wallet URL',\n\t\tdescription: 'The URL to the contacts wallet',\n\t\tmacro: '{{walletURL}}',\n\t\tcategory: 'General',\n\t},\n\twalletURLSignup: {\n\t\tisLink: true,\n\t\tname: 'Wallet URL Signup',\n\t\tdescription: 'The URL to the contacts wallet to sign up',\n\t\tmacro: '{{walletURLSignup}}',\n\t\tcategory: 'General',\n\t},\n\tloyaltySignupURL: {\n\t\tisLink: true,\n\t\tname: 'Loyalty Signup URL',\n\t\tdescription: 'The loyalty signup URL',\n\t\tmacro: '{{loyaltySignupURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'General',\n\t},\n\treferFriendURL: {\n\t\tisLink: true,\n\t\tname: 'Refer Friend URL',\n\t\tdescription: 'The refer friend URL',\n\t\tmacro: '{{referFriendURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'General',\n\t},\n\ttattleFeedbackURL: {\n\t\tisLink: true,\n\t\tname: 'Tattle Feedback URL',\n\t\tdescription: 'The tattle feedback URL',\n\t\ttooltip:\n\t\t\t'This macro requires the Tattle integration. If turned on, place this macro in your campaign message body to send users to the Tattle feedback landing page.',\n\t\tmacro: '{{tattleFeedbackURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'General',\n\t},\n\temailOptOutURL: {\n\t\tisLink: true,\n\t\tname: 'Email Opt Out URL',\n\t\tdescription: 'The email opt out URL',\n\t\tmacro: '{{emailOptOutURL}}',\n\t\tcategory: 'General',\n\t},\n\tpredictedTopProduct: {\n\t\tname: 'Predicted Top Product',\n\t\tdescription: 'The predicted top product',\n\t\tmacro: '{{predictedTopProduct}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Prediction',\n\t},\n\tpredictedTopSku: {\n\t\tname: 'Predicted Top SKU',\n\t\tdescription: 'The predicted top SKU',\n\t\tmacro: '{{predictedTopSku}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Prediction',\n\t},\n\tpredictedTopBrand: {\n\t\tname: 'Predicted Top Brand',\n\t\tdescription: 'The predicted top brand',\n\t\tmacro: '{{predictedTopBrand}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Prediction',\n\t},\n\tpredictedTopCategory: {\n\t\tname: 'Predicted Top Category',\n\t\tdescription: 'The predicted top category',\n\t\tmacro: '{{predictedTopCategory}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Prediction',\n\t},\n\tfavoriteStore: {\n\t\tname: 'Favorite Store',\n\t\tdescription: 'The conacts favorite store',\n\t\tmacro: '{{favoriteStore}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Contact',\n\t\tfallback: true,\n\t},\n\tfavoriteStoreShopURL: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Shop URL',\n\t\tdescription: 'The contacts favorite store shop URL',\n\t\tmacro: '{{favoriteStoreShopURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Contact',\n\t\tfallback: true,\n\t},\n\tfavoriteRecStoreShopURL: {\n\t\tisLink: true,\n\t\tname: 'Favorite Rec Store Shop URL',\n\t\tdescription: 'The favorite rec store shop URL',\n\t\tmacro: '{{favoriteRecStoreShopURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tdontShowInMacroList: () => !utils?.isCannabis(),\n\t\tcategory: 'Contact',\n\t},\n\tfavoriteMedStoreShopURL: {\n\t\tisLink: true,\n\t\tname: 'Favorite Med Store Shop URL',\n\t\tdescription: 'The favorite med store shop URL',\n\t\tmacro: '{{favoriteMedStoreShopURL}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tdontShowInMacroList: () => !utils?.isCannabis(),\n\t\tcategory: 'Contact',\n\t},\n\tfavStoreDisclaimer: {\n\t\tname: 'Favorite Store Disclaimer',\n\t\tdescription: 'The favorite store disclaimer',\n\t\tmacro: '{{favStoreDisclaimer}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Contact',\n\t},\n\tfavStoreAvatar: {\n\t\tname: 'Favorite Store Avatar',\n\t\tdescription: 'The favorite store avatar',\n\t\tmacro: '{{favStoreAvatar}}',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tcategory: 'Contact',\n\t},\n\tfirstName: {\n\t\tname: 'First Name',\n\t\tdescription: 'The contacts first name',\n\t\tmacro: '{{firstName}}',\n\t\tcategory: 'Contact',\n\t\tfallback: true,\n\t},\n\tlastName: {\n\t\tname: 'Last Name',\n\t\tdescription: 'The contacts last name',\n\t\tmacro: '{{lastName}}',\n\t\tcategory: 'Contact',\n\t\tfallback: true,\n\t},\n\tname: {\n\t\tname: 'Name',\n\t\tdescription: 'The contacts name',\n\t\tmacro: '{{name}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tfallback: true,\n\t},\n\temail: {\n\t\tname: 'Email',\n\t\tdescription: 'The contacts email',\n\t\tmacro: '{{email}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tphone: {\n\t\tname: 'Phone',\n\t\tdescription: 'The contacts phone',\n\t\tmacro: '{{phone}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tstate: {\n\t\tname: 'State',\n\t\tdescription: 'The contacts state',\n\t\tmacro: '{{state}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tfallback: true,\n\t},\n\tcity: {\n\t\tname: 'City',\n\t\tdescription: 'The contacts city',\n\t\tmacro: '{{city}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tfallback: true,\n\t},\n\tzip: {\n\t\tname: 'Zip',\n\t\tdescription: 'The contacts zip',\n\t\tmacro: '{{zip}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t\tfallback: true,\n\t},\n\tloyaltyPoints: {\n\t\tname: 'Loyalty Points',\n\t\tdescription: 'The contacts loyalty points',\n\t\tmacro: '{{loyaltyPoints}}',\n\t\tcategory: 'Contact',\n\t},\n\tcontactID: {\n\t\tname: 'Contact ID',\n\t\tdescription: 'The contacts ID',\n\t\tmacro: '{{contactID}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\ttotalPointsEarned: {\n\t\tname: 'Total Points Earned',\n\t\tdescription: 'The contacts total points earned',\n\t\tmacro: '{{totalPointsEarned}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\ttotalPointsRedeemed: {\n\t\tname: 'Total Points Redeemed',\n\t\tdescription: 'The contacts total points redeemed',\n\t\tmacro: '{{totalPointsRedeemed}}',\n\t\tcategory: 'Contact',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tlastOrderedProduct: {\n\t\tname: 'Last Ordered Product',\n\t\tdescription: 'The contacts last ordered product',\n\t\tmacro: '{{lastOrderedProduct}}',\n\t\tcategory: 'Order',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tlastOrderedBrand: {\n\t\tname: 'Last Ordered Brand',\n\t\tdescription: 'The contacts last ordered brand',\n\t\tmacro: '{{lastOrderedBrand}}',\n\t\tcategory: 'Order',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tlastOrderedCategory: {\n\t\tname: 'Last Ordered Category',\n\t\tdescription: 'The contacts last ordered category',\n\t\tmacro: '{{lastOrderedCategory}}',\n\t\tcategory: 'Order',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoreapplestore: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Apple Store',\n\t\tdescription: 'The contacts favorite store apple store',\n\t\tmacro: '{{favoritestoreapplestore}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoregoogleplay: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Google Play',\n\t\tdescription: 'The contacts favorite store google play',\n\t\tmacro: '{{favoritestoregoogleplay}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoreinstagram: {\n\t\tname: 'Favorite Store Instagram',\n\t\tdescription: 'The contacts favorite store instagram',\n\t\tmacro: '{{favoritestoreinstagram}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoretwitter: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Twitter',\n\t\tdescription: 'The contacts favorite store twitter',\n\t\tmacro: '{{favoritestoretwitter}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoregoogle: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Google',\n\t\tdescription: 'The contacts favorite store google',\n\t\tmacro: '{{favoritestoregoogle}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestorefacebook: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Facebook',\n\t\tdescription: 'The contacts favorite store facebook',\n\t\tmacro: '{{favoritestorefacebook}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoreyelp: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Yelp',\n\t\tdescription: 'The contacts favorite store yelp',\n\t\tmacro: '{{favoritestoreyelp}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoreweedmaps: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Weedmaps',\n\t\tdescription: 'The contacts favorite store weedmaps',\n\t\tmacro: '{{favoritestoreweedmaps}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoreleafly: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Leafly',\n\t\tdescription: 'The contacts favorite store leafly',\n\t\tmacro: '{{favoritestoreleafly}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoritestoretattle: {\n\t\tisLink: true,\n\t\tname: 'Favorite Store Tattle',\n\t\tdescription: 'The contacts favorite store tattle',\n\t\tmacro: '{{favoritestoretattle}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tlandingPage: {\n\t\tisLink: true,\n\t\tname: 'Landing Page',\n\t\tdescription: 'The text message landing page',\n\t\tmacro: '{{landingPage}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tforstaURL: {\n\t\tisLink: true,\n\t\tname: 'Forsta URL',\n\t\tdescription: 'The contacts forsta URL',\n\t\tmacro: '{{forstaURL}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\temailOptInURL: {\n\t\tisLink: true,\n\t\tname: 'Email Opt In URL',\n\t\tdescription: 'The email opt in URL',\n\t\tmacro: '{{emailOptInURL}}',\n\t\tcategory: 'Social',\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tfavoriteStoreSales: {\n\t\tname: 'Favorite Store Sales',\n\t\tdescription: 'The contacts favorite store sales',\n\t\tmacro: '{{favoriteStoreSales-7-🔥}}',\n\t\tregex: /(?:{{favoriteStoreSales-)([0-9]+)-(.{0,})}}/gi,\n\t\tcategory: 'General',\n\t\ttooltip: (\n\t\t\t<>\n\t\t\t\t<b>Requires GlobalTill POS:</b> This macro replaces itself with discounted products as long as they have at least <b>7</b> items in inventory available (You\n\t\t\t\tcan change the <b>7</b> in the macro to any number of your choice). It customizes itself by the user's favorite store with top 10 items discounted with the\n\t\t\t\tlargest discount item first.\n\t\t\t\t<Break air />\n\t\t\t\t<b>7</b> the argument is the minimum quantity that should be in stock for the product to be sent in the macro. <small>Can be any number.</small>\n\t\t\t\t<Break air />\n\t\t\t\t<b>🔥</b> optionally use a custom bullet point indicator/icon\n\t\t\t</>\n\t\t),\n\t\tdontShowInMacroList: true,\n\t\trequiredPermissions: {\n\t\t\tmarketing: 'pro',\n\t\t},\n\t},\n\tdiscounts: {\n\t\tisLink: true,\n\t\tname: 'Discounts',\n\t\tdontShowInMacroList: true,\n\t\tdescription: 'The discounts',\n\t\tmacro: '{{discounts-id}}',\n\t\tregex: /(?:{{discount-)([0-9]+)}}/gi,\n\t\tcategory: 'General',\n\t},\n\tsurveys: {\n\t\tisLink: true,\n\t\tname: 'Surveys',\n\t\tdontShowInMacroList: true,\n\t\tdescription: 'The surveys',\n\t\tmacro: '{{surveys-id}}',\n\t\tregex: /\\{\\{survey-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\}\\}/g,\n\t\tcategory: 'General',\n\t},\n\tdynamicContent: {\n\t\tname: 'Dynamic Content',\n\t\tdontShowInMacroList: true,\n\t\tdescription: 'The dynamic content',\n\t\tmacro: '{{dynamicContent-x-x-x}}',\n\t\tregex: /\\{\\{dynamic-[A-Za-z0-9]+-[A-Za-z0-9]+-[A-Za-z0-9]+\\}\\}/gi,\n\t\tcategory: 'General',\n\t},\n\tproductSlug: {\n\t\tname: 'Product Slug',\n\t\tdontShowInMacroList: true,\n\t\tdescription: 'The product slug',\n\t\tmacro: '{{product-slug}}',\n\t\tcategory: 'General',\n\t},\n} as const;\n\nexport type CampaignBuilderMacro = keyof typeof CampaignBuilderMacros;\n\nexport const warningMacros: string[] = [\n\t'{{favoritestore}}',\n\t'{{favoritestoreshopurl}}',\n\t'{{favstoreavatar}}',\n\t'{{favoritestoreapplestore}}',\n\t'{{favoritestoregoogleplay}}',\n\t'{{favoritestoreinstagram}}',\n\t'{{favoritestoretwitter}}',\n\t'{{favoritestoregoogle}}',\n\t'{{favoritestorefacebook}}',\n\t'{{favoritestoreyelp}}',\n\t'{{favoritestoreweedmaps}}',\n\t'{{favoritestoreleafly}}',\n\t'{{lastorderedproduct}}',\n\t'{{lastorderedbrand}}',\n\t'{{lastorderedcategory}}',\n];\n\nexport const bannedMacrosByTemplate: { [key in CampaignChannelType]?: string[] } = {\n\ttemplates: ['{{emailoptouturl}}'],\n};\n","import React from \"react\";\nimport { colors, generateRandomString, generateRandomWord, timeUtils, utils } from \"../../../helpers\";\nimport { SearchDataType } from \"../../../hooks/useSearchDebounce\";\nimport { BrandCrewGoalData, BrandCrewLocationData, BrandCrewMemberData, BrandSnapshot, RetailerCrewGoalData, RetailerCrewLocationData, RetailerCrewMemberData, RetailerSnapshot } from \"../pages/leaderboard/components/leaderboard.helpers\";\nimport { BrandCrewGoal, RetailCrewGoal } from \"./CrewGoalTypes\";\n\nexport const CrewLeaderboardTypes = {\n    members: 'Crew',\n    locations: 'Location',\n    goals: 'Goal'\n} as const;\nexport type CrewLeaderboardType = keyof typeof CrewLeaderboardTypes;\n\nexport const Crew_TopSellingTypes = {\n    brands: 'Brands',\n    products: 'Products',\n    categories: 'Categories'\n} as const;\n\nexport type TopSellingType = keyof typeof Crew_TopSellingTypes;\n\nexport const Leaderboard_ViewingVersions = {\n    retailer: {\n        title: () => \"My Company\",\n        description: () => 'Leaderboards for your company (crew, locations, goals)',\n        show: () => utils.isVertical()\n    },\n    brand: {\n        title: () => \"Sponsored\",\n        description: () => 'Leaderboards from sponsored goals (crew, locations, goals)',\n        show: () => utils.isVertical()\n    }\n} as const\n\nexport type LBVVConfig = typeof Leaderboard_ViewingVersions[keyof typeof Leaderboard_ViewingVersions];\nexport type LeaderboardViewingVersion = keyof typeof Leaderboard_ViewingVersions;\n\nexport const DateRangeDayPeriods = {\n    all: {\n        label: 'All Time',\n        getTime: () => {\n            return { start: undefined, end: undefined }\n        }\n    },\n    '90days': {\n        label: '90 Days',\n        getTime: () => {\n            const today = timeUtils.getTodayUnix();\n            return {\n                start: today.start - timeUtils.units.DAY_S * 90,\n                end: today.end\n            }\n        }\n    },\n    '30days': {\n        label: '30 Days',\n        getTime: () => {\n            const today = timeUtils.getTodayUnix();\n            return {\n                start: today.start - timeUtils.units.DAY_S * 30,\n                end: today.end\n            }\n        }\n    },\n    '15days': {\n        label: '15 Days',\n        getTime: () => {\n            const today = timeUtils.getTodayUnix();\n            return {\n                start: today.start - timeUtils.units.DAY_S * 15,\n                end: today.end\n            }\n        }\n    },\n    '7days': {\n        label: '7 Days',\n        getTime: () => {\n            const today = timeUtils.getTodayUnix();\n            return {\n                start: today.start - timeUtils.units.DAY_S * 7,\n                end: today.end\n            }\n        }\n    },\n} as const;\n\nexport const goalMessages = {\n    notStarted: {\n        title: 'Pending',\n        tooltip: 'This goal has not started yet',\n        icon: {\n            name: 'hourglass-start',\n        },\n        style: {\n            color: colors.primary.blue,\n            borderColor: colors.primary.blue,\n        }\n    },\n    isActive: {\n        title: 'Active',\n        tooltip: 'This goal is active',\n        icon: {\n            name: 'check',\n        },\n        style: {\n            color: colors.primary.primary,\n            borderColor: colors.primary.primary,\n        }\n    },\n    nearlyEnded: {\n        title: 'Ending Soon',\n        tooltip: 'This goal is ending soon',\n        icon: {\n            name: 'hourglass-half',\n        },\n        style: {\n            color: colors.primary.pink,\n            borderColor: colors.primary.pink,\n        }\n    },\n    ended: {\n        title: 'Ended',\n        tooltip: 'This goal has ended',\n        icon: {\n            name: 'hourglass-end',\n        },\n        style: {\n            color: colors.primary.error500,\n            borderColor: colors.primary.error500,\n        }\n    },\n    final: {\n        title: 'Final',\n        tooltip: 'This goal is final',\n        icon: {\n            name: 'flag-checkered',\n        },\n        style: {\n            color: colors.primary.error500,\n            borderColor: colors.primary.error500,\n        }\n    }\n}\n\n\nexport type DateRangeDayPeriod = keyof typeof DateRangeDayPeriods;\n\nexport interface Entity {\n    id: string | number;\n    name: string;\n}\n\nexport interface CrewLeaderboardFilters {\n    StartDate?: number;\n    EndDate?: number;\n    Locations?: number[];\n    Brands?: string[];\n    ProductNames?: string[];\n    BrandAttribuitionUID?: string;\n}\nexport interface LeaderboardTarget {\n    id: string | undefined;\n    type: CrewLeaderboardType\n};\n\nexport type CrewGoals = {\n    retailer?: {\n        loaded?: boolean;\n        data?: { [key: string]: RetailCrewGoal }\n    }\n    brand?: {\n        loaded?: boolean;\n        data?: { [key: string]: BrandCrewGoal }\n    }\n}\n\nexport type CrewLeaderboardProps = {\n    uid: string\n    searchData: SearchDataType\n\n    viewType: CrewLeaderboardType\n    setViewType: React.Dispatch<React.SetStateAction<CrewLeaderboardType>>\n\n    viewingVersion: LeaderboardViewingVersion\n    setViewingVersion: React.Dispatch<React.SetStateAction<LeaderboardViewingVersion>>\n\n    filters: CrewLeaderboardFilters\n    setFilters: React.Dispatch<React.SetStateAction<CrewLeaderboardFilters>>\n\n    drawerTarget: LeaderboardTarget | undefined\n    setDrawerTarget: React.Dispatch<React.SetStateAction<LeaderboardTarget | undefined>>\n\n    retailSnapshot: RetailerSnapshot\n    brandSnapshot: BrandSnapshot\n\n    retailCrewMemberData: RetailerCrewMemberData\n    brandCrewMemberData: BrandCrewMemberData\n\n    retailCrewLocationData: RetailerCrewLocationData\n    brandCrewLocationData: BrandCrewLocationData\n\n    retailCrewGoalData: RetailerCrewGoalData\n    brandCrewGoalData: BrandCrewGoalData\n\n    crewGoals: CrewGoals\n    setCrewGoals: React.Dispatch<React.SetStateAction<CrewGoals>>\n\n}\nexport interface LeaderboardDrawerProps extends CrewLeaderboardProps {\n    target: MemberLeaderboardEntry | MemberLeaderboardDashFormat | undefined\n}\n\n// NOTE LEADERBOARD DATA TYPES\n\nexport type SalesMetrics = {\n    units: number;\n    revenue: number;\n    transactions: number;\n    // Average Cart Value, defined as Revenue / Transactions\n    acv: number;\n    // Count of distinct products\n    totalProducts: number;\n}\n\nexport type LeaderboardDataset<T> = {\n    loaded: boolean;\n    data: T;\n    priorFilters?: CrewLeaderboardFilters;\n}\n\ntype SalesMetricContext = {\n    key: number // Added by dash for ordering\n    id: string\n    name: string\n}\n\nexport type FormattedSalesMetric = SalesMetricContext & SalesMetrics & {\n    color?: string;\n}\n\n// NOTE BY MEMBERS ---> RETAILER\n\nexport type MemberLeaderboardEntry = SalesMetricContext & SalesMetrics & {\n    topStore?: SalesMetricContext\n}\nexport type MemberGoalBreakdown = MemberLeaderboardEntry & {\n    goalsRollup: SalesMetrics\n    totalRevenue: number\n    goalRevenuePercentage: number\n    byGoal: { [goalID: string]: GoalLeaderboardEntry }\n}\nexport type ByMembersMap = { [memberID: string]: MemberLeaderboardEntry }\nexport type ByMembers = MemberLeaderboardEntry[]\nexport type ByMembersByDay = { [memberID: string]: { [date: string]: MemberLeaderboardEntry } }\nexport type ByMembersByGoal = { [memberID: string]: MemberGoalBreakdown }\nexport type MemberByBrandAndProduct = { [brandID: string]: { [productID: string]: MemberLeaderboardEntry } }\nexport type MemberByCategoryAndProduct = { [categoryID: string]: { [productID: string]: MemberLeaderboardEntry } }\n\n// NOTE BY LOCATIONS ---> RETAILER\n\nexport type LocationLeaderboardEntry = SalesMetricContext & SalesMetrics\nexport type LocationGoalBreakdown = SalesMetricContext & {\n    goalsRollup: SalesMetrics\n    totalRevenue: number\n    goalRevenuePercentage: number\n    byGoal: { [goalID: string]: SalesMetrics }\n}\nexport type ByLocationsMap = { [locationID: string]: LocationLeaderboardEntry }\nexport type ByLocation = LocationLeaderboardEntry[]\nexport type ByLocationByDay = { [locationID: string]: { [date: string]: LocationLeaderboardEntry } }\nexport type ByLocationByGoal = { [locationID: string]: LocationGoalBreakdown }\nexport type LocationByBrandAndProduct = { [brandID: string]: { [productID: string]: LocationLeaderboardEntry } }\nexport type LocationByCategoryAndProduct = { [categoryID: string]: { [productID: string]: LocationLeaderboardEntry } }\n\n// NOTE BY GOALS ---> RETAILER\n\nexport type GoalLeaderboardEntry = SalesMetricContext & SalesMetrics\nexport type GoalLeaderboardEntryWithPercentage = GoalLeaderboardEntry & {\n    goalRevenuePercentage: number\n}\nexport type GoalLeaderboardWithRollup = {\n    goalsRollup: SalesMetrics\n    totalRevenue: number\n    byGoal: GoalLeaderboardEntryWithPercentage[]\n}\nexport type ByGoalMap = { [goalID: string]: GoalLeaderboardEntry }\nexport type ByGoal = GoalLeaderboardWithRollup\nexport type ByGoalByDay = { [goalID: string]: { [date: string]: GoalLeaderboardEntry } }\nexport type GoalByBrandAndProduct = { [brandID: string]: { [productID: string]: GoalLeaderboardEntry } }\nexport type GoalByCategoryAndProduct = { [categoryID: string]: { [productID: string]: GoalLeaderboardEntry } }\n\n// NOTE BY MEMBERS ---> BRAND\n\nexport type MemberLeaderboardDashFormat = MemberLeaderboardEntry & {\n    byUID: { [uid: string]: MemberLeaderboardEntry }\n}\nexport type ByMembersBrandMap = { [memberID: string]: MemberLeaderboardDashFormat }\nexport type ByMembersBrand = { [retailerID: string]: MemberLeaderboardEntry[] }\nexport type ByMembersByDayBrand = { [retailerID: string]: { [memberID: string]: { [date: string]: MemberLeaderboardEntry } } }\nexport type ByMembersByGoalBrand = { [retailerID: string]: { [memberID: string]: MemberGoalBreakdown } }\nexport type MemberByBrandAndProductBrand = { [retailerID: string]: { [brandID: string]: { [productID: string]: MemberLeaderboardEntry } } }\nexport type MemberByCategoryAndProductBrand = { [retailerID: string]: { [categoryID: string]: { [productID: string]: MemberLeaderboardEntry } } }\n\n// NOTE BY LOCATIONS ---> BRAND\n\nexport type LocationLeaderboardDashFormat = LocationLeaderboardEntry & {\n    byUID: { [uid: string]: LocationLeaderboardEntry }\n}\nexport type ByLocationsBrandMap = { [locationID: string]: LocationLeaderboardDashFormat }\nexport type ByLocationBrand = { [retailerID: string]: LocationLeaderboardEntry[] }\nexport type ByLocationByDayBrand = { [retailerID: string]: { [locationID: string]: { [date: string]: LocationLeaderboardEntry } } }\nexport type ByLocationByGoalBrand = { [retailerID: string]: { [locationID: string]: LocationGoalBreakdown } }\nexport type LocationByBrandAndProductBrand = { [retailerID: string]: { [brandID: string]: { [productID: string]: LocationLeaderboardEntry } } }\nexport type LocationByCategoryAndProductBrand = { [retailerID: string]: { [categoryID: string]: { [productID: string]: LocationLeaderboardEntry } } }\n\n// NOTE BY GOAL ---> BRAND\n\nexport type GoalLeaderboardDashFormat = GoalLeaderboardEntry & {\n    byUID: { [uid: string]: GoalLeaderboardEntry }\n}\nexport type ByGoalBrandMap = { [goalID: string]: GoalLeaderboardDashFormat }\nexport type ByGoalBrand = { [retailerID: string]: GoalLeaderboardWithRollup }\nexport type ByGoalByDayBrand = { [retailerID: string]: { [goalID: string]: { [date: string]: GoalLeaderboardEntry } } }\nexport type GoalByBrandAndProductBrand = { [retailerID: string]: { [brandID: string]: { [productID: string]: GoalLeaderboardEntry } } }\nexport type GoalByCategoryAndProductBrand = { [retailerID: string]: { [categoryID: string]: { [productID: string]: GoalLeaderboardEntry } } }\n\nexport type ProductSaleEntry = FormattedSalesMetric & {\n    brand?: string,\n    category?: string,\n}\n\nexport type BrandSaleEntry = FormattedSalesMetric & {\n    products: ProductSaleEntry[]\n}\n\nexport type CategorySaleEntry = FormattedSalesMetric & {\n    products: ProductSaleEntry[]\n}\n\nexport type SalesData = {\n    productSalesByBrand: BrandSaleEntry[],\n    productSalesByCategory: CategorySaleEntry[],\n    allProductSales: ProductSaleEntry[],\n}\n\nexport type SnapshotData = {\n    global?: GlobalSnapshot,\n    members?: MemberSnapshot,\n    goals?: GoalSnapshot,\n    locations?: LocationSnapshot\n}\n\nexport type GlobalSnapshot = {\n    totalRevenue: number\n    goalsRevenue: number\n    goalsRevenuePercentage: number\n    orders: number\n    acv: number\n}\n\nexport type MemberSnapshot = {\n    topMembers: MemberLeaderboardEntry[]\n    topMembersByDay: { [memberID: string]: { [date: string]: MemberLeaderboardEntry } }\n}\n\nexport type LocationSnapshot = {\n    topLocations: LocationLeaderboardEntry[]\n    topLocationsByDay: { [locationID: string]: { [date: string]: LocationLeaderboardEntry } }\n    topLocationsByMember: { [memberID: string]: MemberLeaderboardEntry[] }\n}\n\nexport type GoalSnapshot = {\n    topGoals: GoalLeaderboardEntryWithPercentage[]\n    topGoalsByDay: { [goalID: string]: { [date: string]: GoalLeaderboardEntry } }\n    topGoalsByMember: { [memberID: string]: MemberLeaderboardEntry[] }\n}\n\nexport const getRandomEntry = (key: number, targetID = utils.getUUID()): FormattedSalesMetric => ({\n    key,\n    id: targetID,\n    acv: Math.random() * 10,\n    totalProducts: Math.random() * 100,\n    name: `${generateRandomWord()} ${generateRandomWord()}`,\n    revenue: Math.random() * 1000,\n    transactions: Math.random() * 100,\n    units: Math.random() * 100,\n})\n\n// Mock MemberByBrandAndProductBrand\nexport const getMockMemberByBrandAndProductBrand = (): MemberByBrandAndProductBrand => {\n    return {\n        \"1048\": {\n            [generateRandomString()]: {\n                [generateRandomString()]: getRandomEntry(0),\n                [generateRandomString()]: getRandomEntry(0),\n                [generateRandomString()]: getRandomEntry(0),\n                [generateRandomString()]: getRandomEntry(0),\n            },\n            [generateRandomString()]: {\n                [generateRandomString()]: getRandomEntry(0),\n                [generateRandomString()]: getRandomEntry(0),\n                [generateRandomString()]: getRandomEntry(0)\n            },\n            [generateRandomString()]: {\n                [generateRandomString()]: getRandomEntry(0)\n            },\n        }\n    }\n}\n\nexport const getMockGoalByBrandAndProduct = (): GoalByBrandAndProduct => {\n    return {\n        [generateRandomString()]: {\n            [generateRandomString()]: getRandomEntry(0),\n            [generateRandomString()]: getRandomEntry(0),\n            [generateRandomString()]: getRandomEntry(0),\n            [generateRandomString()]: getRandomEntry(0),\n        },\n        [generateRandomString()]: {\n            [generateRandomString()]: getRandomEntry(0),\n            [generateRandomString()]: getRandomEntry(0),\n            [generateRandomString()]: getRandomEntry(0)\n        },\n        [generateRandomString()]: {\n            [generateRandomString()]: getRandomEntry(0)\n        },\n    }\n}\n\n// Get a date that is today minus -x days, YYYY-MM-DD\nexport const getMockDate = (days: number): string => {\n    const today = new Date();\n    const date = new Date(today.setDate(today.getDate() - days));\n    return date.toISOString().split('T')[0];\n}\n\n// Mock Snapshot data\nexport const getMockSnapshotData = (): SnapshotData => {\n\n    const topMembers: MemberLeaderboardEntry[] = Array.from({ length: 10 }, (_, i) => getRandomEntry(i))\n    const topGoals: GoalLeaderboardEntryWithPercentage[] = Array.from({ length: 10 }, (_, i) => getRandomEntry(i)) as GoalLeaderboardEntryWithPercentage[]\n    const topLocations: LocationLeaderboardEntry[] = Array.from({ length: 10 }, (_, i) => getRandomEntry(i))\n\n    return {\n        global: {\n            totalRevenue: Math.random() * 1000,\n            goalsRevenue: Math.random() * 1000,\n            goalsRevenuePercentage: Math.random() * 100,\n            orders: Math.random() * 100,\n            acv: Math.random() * 1000\n        },\n        members: {\n            topMembers,\n            topMembersByDay: topMembers.reduce((prev, entry) => {\n                const byDate: { [date: string]: MemberLeaderboardEntry } = Array.from({ length: 10 }, (_, i) => getRandomEntry(i)).reduce((prev, entry, i) => {\n                    return {\n                        ...prev,\n                        [getMockDate(i)]: entry\n                    }\n                }, {})\n                return {\n                    ...prev,\n                    [entry.id]: byDate\n                }\n            }, {}),\n        },\n        goals: {\n            topGoals: topGoals,\n            topGoalsByDay: topGoals.reduce((prev, entry) => {\n                const byDate: { [date: string]: GoalLeaderboardEntry } = Array.from({ length: 10 }, (_, i) => getRandomEntry(i)).reduce((prev, entry, i) => {\n                    return {\n                        ...prev,\n                        [getMockDate(i)]: entry\n                    }\n                }, {})\n                return {\n                    ...prev,\n                    [entry.id]: byDate\n                }\n            }, {}),\n            topGoalsByMember: topGoals.reduce((prev, entry) => {\n                const byMember: MemberLeaderboardEntry[] = Array.from({ length: 10 }, (_, i) => getRandomEntry(i))\n                return {\n                    ...prev,\n                    [entry.id]: byMember\n                }\n            }, {}),\n        },\n        locations: {\n            topLocations: topLocations,\n            topLocationsByDay: topLocations.reduce((prev, entry) => {\n                const byDate: { [date: string]: LocationLeaderboardEntry } = Array.from({ length: 10 }, (_, i) => getRandomEntry(i)).reduce((prev, entry, i) => {\n                    return {\n                        ...prev,\n                        [getMockDate(i)]: entry\n                    }\n                }, {})\n                return {\n                    ...prev,\n                    [entry.id]: byDate\n                }\n            }, {}),\n            topLocationsByMember: topLocations.reduce((prev, entry) => {\n                const byMember: MemberLeaderboardEntry[] = Array.from({ length: 10 }, (_, i) => getRandomEntry(i))\n                return {\n                    ...prev,\n                    [entry.id]: byMember\n                }\n            }, {}),\n        }\n    }\n}","import { DataNode } from 'antd/lib/tree';\nimport React from 'react';\n\nimport { CrewBrand, CrewCategory, CrewProduct, CrewProps, DateRangeDayPeriod, Entity } from '.';\nimport { utils } from '../../../helpers';\nimport { SearchDataType } from '../../../hooks/useSearchDebounce';\nimport { Audience, EntryData, LoaderState, Store } from '@/legacy-types';\nimport { GoalsHelpers } from '../helpers';\nimport { CrewListResponse } from '../../../api/crew';\nimport { CrewAudience, CrewAudienceWithStats } from './CrewAudienceTypes';\n\nexport const CrewGoalRewardTypes = ['cash'] as const;\nexport type CrewGoalRewardType = (typeof CrewGoalRewardTypes)[number];\nexport type CrewGoalRewards = { [key: string]: CrewGoalReward };\n\n// Fields both RetailCrewGoal and BrandCrewGoal share\ntype BaseGoal = {\n\tid: string;\n\tname: string;\n\tinternalName?: string;\n\tdescription?: string;\n\twinCondition?: CrewGoalCondition;\n\t// Metric and MetricThreshold are used to determine winners.\n\t// For example Metric could be \"unitsSold\" and MetricThreshold\n\t// could be 100.\n\tmetric?: CrewGoalMetric;\n\tmetricThreshold?: number;\n\t// MetricPeriod is used to determine the time period over which\n\t// the metric is calculated. For example, if MetricPeriod is \"day\"\n\t// the goal will be reached if MetricThreshold is reached within any single\n\t// day during the goal period. If MetricPeriod is empty, the metric\n\t// will be calculated over the entire goal period.\n\tmetricPeriod?: RewardValuePeriod; // The period of time over which the goal is measured. (Empty if goal is not measured over a period of time)\n\trewards: CrewGoalRewards;\n\n\taudienceIDs: string[]; // Audience IDs\n\n\tincludeProducts?: string[]; // Product IDs\n\texcludeProducts?: string[]; // Product IDs\n\n\tincludeCategories?: string[]; // Category IDs\n\texcludeCategories?: string[]; // Category IDs\n\n\tstartDate: number;\n\tendDate: number;\n\tcreatedAt?: number;\n\tupdatedAt?: number;\n\tarchived?: boolean;\n\n\t// maxWinners?: number\n\n\tclonedFrom?: string;\n};\n\n// Crew Goal is returned from the API when requesting a list of goals\nexport type RetailCrewGoal = BaseGoal & {\n\tlocations: number[]; // Location IDs\n\n\tincludeBrands?: string[]; // Brand IDs\n\texcludeBrands?: string[]; // Brand IDs\n\n\teligibleMemberIDs?: string[]; // Employee IDs\n\teligibleMemberCalculatedAt?: number;\n\n\tbrandSponsorUID?: string;\n\tbrandGoal?: boolean; // Id of the brands goal\n\n\tisActive?: boolean;\n\tsettled?: boolean;\n};\n\nexport type BrandCrewGoal = BaseGoal & {\n\teligibleRetailers: { [uid: string]: number[] };\n\toptedInRetailers: { [uid: string]: string };\n\toptedOutRetailers: { [uid: string]: string };\n\tadvertised?: boolean;\n};\n\nexport type CrewGoal = RetailCrewGoal | BrandCrewGoal | SponsoredCrewGoal;\n\nexport type SponsoredCrewGoal = RetailCrewGoal & {\n\tsponsorUID: string;\n\taudiences?: CrewAudience[];\n};\n\nexport interface CrewGoalGroup {\n\tid: string;\n\tname: string;\n\tretailerGoals: { [key: string]: boolean };\n\tbrandGoals: { [key: string]: boolean };\n\tcreated: number;\n\tupdated: number;\n\tarchived: boolean;\n}\n\nexport interface CrewQualification {\n\tminRevenue?: number; // Minimum revenue an employee must achieve before qualifying for a top reward.\n\tminUnits?: number; // Minimum number of units per transactions an employee must achieve before qualifying for a top reward.\n\tminOrders?: number; // Minium number of orders an employee must achieve before qualifying for a top reward.\n}\n\nexport interface CrewGoalReward {\n\tplace?: number; // The place the employee must achieve to win the reward. (Empty if reward is for all participants)\n\tname?: string;\n\trewardType: CrewGoalRewardType;\n\tvalue?: number; // The value of the dependent value, IE, \"for every <value> units sold...\" earn rewardValue\n\n\t// VariableValue and VariableAmount are used to calculate the reward value\n\t// For example, if the reward is $1 per 10 unit sold, VariableValue would be\n\t// 1 and VariableAmount would be 10.\n\tvariableValue?: number;\n\tvariableAmount?: number;\n\n\tfulfilledByAIQ?: boolean;\n}\n\nexport const ValuePeriods = {\n\tday: 'Day',\n\t// 'week': 'Week',\n\t// 'month': 'Month',\n\t// 'quarter': 'Quarter',\n\t// 'year': 'Year'\n} as const;\n\nexport type RewardValuePeriod = keyof typeof ValuePeriods;\n\nexport const CrewGoalMetrics = {\n\t// \"percentIncrease\": {\n\t//     title: \"% Increase\",\n\t//     description: \"Increase sales of selected products\",\n\t// },\n\tunitsSold: {\n\t\ttitle: 'Units Sold',\n\t\tdescription: 'Track sales of selected products in units',\n\t\tshown(goal: CrewGoal, vv: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t},\n\tdollarAmount: {\n\t\ttitle: 'Dollar Amount',\n\t\tdescription: 'Track sales of selected products in dollars',\n\t\tshown(goal: CrewGoal, vv: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t},\n\ttransactions: {\n\t\ttitle: 'Transactions',\n\t\tdescription: 'Track number of transactions made',\n\t\tshown(goal: CrewGoal, vv: GoalViewingVersion) {\n\t\t\t// Can't be seen for brand goals\n\t\t\tif (vv === 'brand') return false;\n\t\t\treturn true;\n\t\t},\n\t},\n} as const;\nexport type CrewGoalMetric = keyof typeof CrewGoalMetrics;\n\nexport const CrewGoalWinConditions = {\n\tallCanWin: {\n\t\tshortTitle: 'All can win',\n\t\ttitle: 'All participants can win',\n\t\tdescription: 'Employees across all selected locations will compete on a single goal. Each eligible participant who meets the goal wins.',\n\t\tshown(goal: CrewGoal, _: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t\tapply(goal: CrewGoal, _: GoalViewingVersion): CrewGoal {\n\t\t\treturn {\n\t\t\t\t...goal,\n\t\t\t\twinCondition: 'allCanWin',\n\t\t\t};\n\t\t},\n\t},\n\tsetNumber: {\n\t\tshortTitle: 'Set number',\n\t\ttitle: 'Set number of winners',\n\t\tdescription: 'Employees across all selected locations will compete on a single leaderboard. Only ONE set of winners.',\n\t\tshown(goal: CrewGoal, _: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t\tapply(goal: CrewGoal, _: GoalViewingVersion): CrewGoal {\n\t\t\treturn {\n\t\t\t\t...goal,\n\t\t\t\twinCondition: 'setNumber',\n\t\t\t\tmetricPeriod: undefined,\n\t\t\t};\n\t\t},\n\t},\n\tlocationGoal: {\n\t\tshortTitle: 'Each location',\n\t\ttitle: 'Goal for each location',\n\t\tdescription: 'A leaderboard is created for each selected location. Each location has its own set of winners.',\n\t\tshown(goal: CrewGoal, _: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t\tapply(goal: CrewGoal, _: GoalViewingVersion): CrewGoal {\n\t\t\treturn {\n\t\t\t\t...goal,\n\t\t\t\twinCondition: 'locationGoal',\n\t\t\t\tmetricPeriod: undefined,\n\t\t\t};\n\t\t},\n\t},\n\tteamGoal: {\n\t\tshortTitle: 'Team goal',\n\t\ttitle: 'Team goal',\n\t\tdescription: 'Everyone competes together to hit the goal and everyone wins together.',\n\t\tshown(goal: CrewGoal, _: GoalViewingVersion) {\n\t\t\treturn true;\n\t\t},\n\t\tapply(goal: CrewGoal, _: GoalViewingVersion): CrewGoal {\n\t\t\treturn {\n\t\t\t\t...goal,\n\t\t\t\twinCondition: 'teamGoal',\n\t\t\t\tmetricPeriod: undefined,\n\t\t\t};\n\t\t},\n\t},\n} as const;\n\nexport type CrewGoalCondition = keyof typeof CrewGoalWinConditions;\n\nexport interface CrewGoalsPageProps extends CrewProps {\n\tsearchData: SearchDataType;\n\tloader: LoaderState;\n\tsetLoader: React.Dispatch<React.SetStateAction<LoaderState>>;\n\tgoalData: EntryData<RetailCrewGoal | BrandCrewGoal>;\n\tsetGoalData: React.Dispatch<React.SetStateAction<EntryData<RetailCrewGoal | BrandCrewGoal>>>;\n\tgroupData: EntryData<CrewGoalGroup>;\n\tsetGroupData: React.Dispatch<React.SetStateAction<EntryData<CrewGoalGroup>>>;\n\taudiences: EntryData<Partial<CrewAudienceWithStats>>;\n\tsetAudiences: React.Dispatch<React.SetStateAction<EntryData<Partial<CrewAudienceWithStats>>>>;\n\tstoreLocations: EntryData<Store>;\n\tsetStoreLocations: React.Dispatch<React.SetStateAction<EntryData<Store>>>;\n\thandleSubmit: () => void;\n\tarchiveGroup: (group: Partial<CrewGoalGroup>) => void;\n\tselectedGroup: string | undefined;\n\tsetSelectedGroup: React.Dispatch<React.SetStateAction<string | undefined>>;\n\teditingGroup: string | undefined;\n\tsetEditingGroup: React.Dispatch<React.SetStateAction<string | undefined>>;\n\tfilters: CrewGoalsFilters;\n\tsetFilters: React.Dispatch<React.SetStateAction<CrewGoalsFilters>>;\n\tgoal: Partial<RetailCrewGoal> | undefined;\n\tsetGoal: React.Dispatch<React.SetStateAction<Partial<RetailCrewGoal> | undefined>>;\n\toriginalGoal: Partial<RetailCrewGoal> | undefined;\n\tsetOriginalGoal: React.Dispatch<React.SetStateAction<Partial<RetailCrewGoal> | undefined>>;\n\tstats: GoalsPageStats;\n\tsetStats: React.Dispatch<React.SetStateAction<GoalsPageStats>>;\n\tviewingVersion: GoalViewingVersion;\n\tsetViewingVersion: React.Dispatch<React.SetStateAction<GoalViewingVersion>>;\n}\n\nexport type GoalsPageStats = {\n\tarchived: number;\n\tactive: number;\n};\n\nexport interface FormattedGoalGroup extends CrewGoalGroup, DataNode {\n\tisOfficial?: boolean; // For official groups\n\tchildrenNodes?: string[];\n\tchildCount?: number;\n}\n\nexport interface CrewGoalsFilters {\n\t// period: DateRangeDayPeriod;\n\t// dateRange: number[];\n\t// locations: string[];\n\t// products: string[];\n\t// categories: string[];\n\t// brands: string[];\n\t// types: CrewGoalMetric[];\n\tshowArchivedGoals?: boolean;\n\tshowArchivedGroups: boolean;\n}\n\nexport const GoalViewingVersions = {\n\t'retailer': {\n\t\ttitle: () => 'My Goals',\n\t\tdescription: 'View and manage your goals',\n\t\tshow: () => utils.isRetail(),\n\t},\n\t'brand': {\n\t\ttitle: () => (utils.isRetail() ? 'Brand Goals' : 'My Goals'),\n\t\tdescription: 'View and manage brand goals',\n\t\tshow: () => utils.isBrand(),\n\t},\n\t'brand-sponsored': {\n\t\ttitle: () => 'Sponsored Goals',\n\t\tdescription: 'View and manage brand sponsored goals',\n\t\tshow: () => utils.isRetail(),\n\t},\n} as const;\nexport type GoalViewingVersion = keyof typeof GoalViewingVersions;\n\n// --------------------------------------------------\n\nexport const GoalDrawerTabDetails = {\n\t'details': {\n\t\ttitle: 'Details',\n\t\tcanContinue: (goal: Partial<RetailCrewGoal | BrandCrewGoal>, isBrandGoal?: boolean): boolean => {\n\t\t\treturn !!goal?.id || (!!goal?.name && !!goal.startDate && !!goal.endDate && goal.startDate < goal.endDate);\n\t\t},\n\t},\n\t'targets': {\n\t\ttitle: 'Participants',\n\t\tcanContinue: (goal: Partial<RetailCrewGoal | BrandCrewGoal>, isBrandGoal?: boolean): boolean => {\n\t\t\tconst retailGoal = goal as RetailCrewGoal;\n\t\t\t// const hasLocations = (retailGoal?.locations?.length || 0) > 0;\n\t\t\tconst hasAudiences = (goal?.audienceIDs?.length || 0) > 0;\n\n\t\t\tif (isBrandGoal) {\n\t\t\t\tconst brandGoal = goal as BrandCrewGoal;\n\t\t\t\tconst targetStoresLen = Object.values(brandGoal.eligibleRetailers || {}).reduce((acc, val) => acc + (val ?? []).length ?? 0, 0);\n\t\t\t\treturn !!goal.winCondition && targetStoresLen !== 0;\n\t\t\t}\n\t\t\t// return !!goal.winCondition && (hasLocations || hasAudiences);\n\t\t\treturn !!goal.winCondition;\n\t\t},\n\t},\n\t'goal': {\n\t\ttitle: 'Goal',\n\t\tcanContinue: (goal: Partial<RetailCrewGoal | BrandCrewGoal>, isBrandGoal?: boolean): boolean => {\n\t\t\tconst includedProducts = (goal?.includeProducts?.length || 0) > 0;\n\t\t\tconst excludedProducts = (goal?.excludeProducts?.length || 0) > 0;\n\t\t\tconst includedCategories = (goal?.includeCategories?.length || 0) > 0;\n\t\t\tconst excludedCategories = (goal?.excludeCategories?.length || 0) > 0;\n\n\t\t\tconst hasFilters = includedProducts || excludedProducts || includedCategories || excludedCategories;\n\t\t\tconst hasMetric = !!goal.metric;\n\n\t\t\tif (isBrandGoal) {\n\t\t\t\treturn hasMetric && hasFilters;\n\t\t\t}\n\n\t\t\tconst retailGoal = goal as RetailCrewGoal;\n\n\t\t\tconst includedBrands = (retailGoal?.includeBrands?.length || 0) > 0;\n\t\t\tconst excludedBrands = (retailGoal?.excludeBrands?.length || 0) > 0;\n\n\t\t\tconst hasBrands = includedBrands || excludedBrands;\n\n\t\t\treturn hasMetric && (hasFilters || hasBrands);\n\t\t},\n\t},\n\t'rewards': {\n\t\ttitle: 'Rewards',\n\t\tcanContinue: (goal: Partial<RetailCrewGoal | BrandCrewGoal>, isBrandGoal?: boolean): boolean => {\n\t\t\treturn (Object.keys(goal?.rewards || {})?.length || 0) > 0;\n\t\t},\n\t},\n\t'review-publish': {\n\t\ttitle: 'Review & Publish',\n\t\tcanContinue: (goal: Partial<RetailCrewGoal | BrandCrewGoal>, isBrandGoal?: boolean): boolean => {\n\t\t\treturn GoalsHelpers.validateGoal(goal)?.valid;\n\t\t},\n\t},\n} as const;\n\nexport type GoalDrawerTab = keyof typeof GoalDrawerTabDetails;\n\nexport interface CrewGoalsDrawerTabProps extends CrewGoalsPageProps {\n\texternal?: boolean;\n\tisDisabled?: boolean;\n\n\tselectedTab: GoalDrawerTab;\n\tsetSelectedTab: React.Dispatch<React.SetStateAction<GoalDrawerTab>>;\n\n\tnextTab: (tab: GoalDrawerTab) => void;\n\n\tcompleted: GoalDrawerTab[];\n\tsetCompleted: React.Dispatch<React.SetStateAction<GoalDrawerTab[]>>;\n\n\thandleClose: (actionCheck?: boolean) => void;\n\n\tloadProductData: (search?: string) => void;\n\tproductData: CrewGoalBuilderEntity<CrewProduct>;\n\tsetProductData: React.Dispatch<React.SetStateAction<CrewGoalBuilderEntity<CrewProduct>>>;\n\n\tloadBrandData: (search?: string) => void;\n\tbrandData: CrewGoalBuilderEntity<CrewBrand>;\n\tsetBrandData: React.Dispatch<React.SetStateAction<CrewGoalBuilderEntity<CrewBrand>>>;\n\n\tloadCategoryData: (search?: string) => void;\n\tcategoryData: CrewGoalBuilderEntity<CrewCategory>;\n\tsetCategoryData: React.Dispatch<React.SetStateAction<CrewGoalBuilderEntity<CrewCategory>>>;\n}\n\nexport type CrewGoalBuilderEntity<T> = CrewListResponse<T> & {\n\tloading?: boolean;\n\tmapped: { [key: string]: T };\n};\n\nexport type ProductEntry = {\n\tid: number | string;\n\tbrandID?: number | string;\n\tname?: string;\n\tbrand?: string;\n\tcategory: string;\n};\n\nexport type AvailableGoalPreview = {\n\tid: string;\n\tsponsorUID: string;\n\tgoal: RetailCrewGoal;\n\taudiences: Audience[];\n};\n\nexport type AvailableBrandGoal = {\n\tbrandUID: string;\n\tbrandGoalID: string;\n\toptedIn: boolean;\n\toptedInAt: number;\n\toptedOut: boolean;\n\toptedOutAt: number;\n\tcreatedAt: number;\n};\n","import React from 'react';\nimport { utils } from '../../../helpers';\nimport { SearchDataType } from '../../../hooks/useSearchDebounce';\nimport { EntryMap } from '@/legacy-types';\nimport { DateRangeDayPeriod } from './CrewLeaderboardTypes';\n\nexport const PayoutViewingVersions = {\n\tretailer: {\n\t\ttitle: () => 'My Payouts',\n\t\tdescription: 'View and manage your goals',\n\t\tshow: () => utils.isRetail(),\n\t},\n\tbrand: {\n\t\ttitle: () => (utils.isRetail() ? 'Brand Payouts' : 'My Payouts'),\n\t\tdescription: 'View and manage brand goals',\n\t\tshow: () => utils.isBrand(),\n\t},\n\t// 'brand-sponsored': {\n\t//     title: () => 'Sponsored Goals',\n\t//     description: 'View and manage brand sponsored goals',\n\t//     show: () => utils.isRetail(),\n\t// },\n} as const;\nexport type PayoutViewingVersion = keyof typeof PayoutViewingVersions;\n\nexport type PayoutsLoader = { [key in PayoutViewingVersion]: boolean };\n\nexport const CrewPayoutStatusConfig = {\n\tpending: {\n\t\tlabel: 'Pending',\n\t},\n\tupcoming: {\n\t\tlabel: 'Upcoming',\n\t},\n\tcompleted: {\n\t\tlabel: 'Completed',\n\t},\n\tdisputed: {\n\t\tlabel: 'Disputed',\n\t},\n} as const;\n\nexport type CrewPayoutStatus = keyof typeof CrewPayoutStatusConfig;\n\nexport type RewardStage = 'unsent' | 'sent' | 'verified';\nexport interface CrewPayout {\n\tid: string;\n\tuid: string; // User ID of the user who created the payout\n\t// LiableUID is the UID responsible for approving and fulfilling the payout.\n\t// Normally this is the same as the UID, but for sponsored goals, this is the UID of the brand sponsor.\n\tliableUID?: string;\n\n\tgoalID: string; // Goal ID which the payout is from/attached to\n\tmemberID: string; // Crew member ID which the payout is from/attached to\n\tgoalName: string;\n\tmemberName: string;\n\n\tvalue: number; // Cost of the payout\n\trewardType: string; // Type of reward for the payout\n\n\tapproved: boolean; // If the payout was approved\n\tapprovedByEmail: string; // Email of the user who approved the payout\n\tsettled: boolean; // If the payout was settled\n\tcreatedAt: number; // Date the payout was created\n\tapprovedAt: number; // Date the payout was approved\n\tapprovesAt?: number; // ! Date to be approved, set within the dashboard\n\tsettledAt: number; // Date the payout was settled\n\n\tidempotencyKey: string; // Idempotency key for the payout\n\trewardStage: RewardStage | ''; // Stage of the reward for the payout\n\trewardSendError: string; // Error message if the reward failed to send\n\trewardVerifiedSentAt: number; // Date the reward was verified as sent\n\tlastUpdate: number; // Date the payout was last updated\n\n\trewardReciept: RewardReceipt;\n}\n\nexport interface BrandPayoutInfo {\n\tid: string;\n\tbrandGoalID: string;\n\tretailerUID: string;\n\tretailerPayoutID: string;\n\tapproved: boolean;\n\tapprovedByEmail: string;\n\tapprovedAt: number;\n\tcreatedAt: number;\n}\n\nexport type BrandPayout = {\n\tbrandPayout: BrandPayoutWithNames;\n\tretailerPayout: CrewPayout;\n};\n\nexport type BrandPayoutWithNames = BrandPayoutInfo & {\n\tgoalName: string;\n\tmemberName: string;\n};\n\nexport type BrandFormattedForUXPayout = CrewPayout & {\n\tbrandPayout: BrandPayoutWithNames;\n};\n\nexport interface RewardReceipt {\n\tid: string; // from the RewardProvider on the Tremendous side\n\tsubtotal: number; // amount given as reward\n\tfees: number; // fees charged by the award provider\n\tstatus: string;\n}\n\nexport interface CrewPayoutFilters {\n\tperiod: DateRangeDayPeriod;\n\tstatus: CrewPayoutStatus | undefined;\n\tdateRange: number[];\n}\n\nexport interface CrewPayoutsSubProps {\n\tviewingVersion: PayoutViewingVersion;\n\tsetViewingVersion: React.Dispatch<React.SetStateAction<PayoutViewingVersion>>;\n\n\tsearchData: SearchDataType;\n\n\tfilters: CrewPayoutFilters;\n\tsetFilters: React.Dispatch<React.SetStateAction<CrewPayoutFilters>>;\n\n\tretailPayouts: EntryMap<CrewPayout>;\n\tsetRetailPayouts: React.Dispatch<React.SetStateAction<EntryMap<CrewPayout>>>;\n\n\tbrandPayouts: EntryMap<BrandFormattedForUXPayout>;\n\tsetBrandPayouts: React.Dispatch<React.SetStateAction<EntryMap<BrandFormattedForUXPayout>>>;\n}\n","import { CrewMember } from \"../crew-types\"\nexport * from '../pages/goals/crewgoal.helpers'\n\nexport function validateCrewMember(crewMember?: Partial<CrewMember>): [boolean, string[]] {\n    if (!crewMember) return [false, [\"No crew member provided.\"]]\n    const errors: string[] = []\n\n    // We require at least a phone or email\n    if (!crewMember.phone && !crewMember.email) {\n        errors.push(\"You must provide either a phone number or email address.\")\n    }\n\n    // We require store\n    // if (!crewMember.locationID) {\n    //     errors.push(\"You must provide a store.\")\n    // }\n\n    return [!errors.length, errors]\n}","import { CrewGoalCondition, CrewGoalWinConditions, CrewGoalMetric, CrewGoalMetrics, CrewGoalReward, RetailCrewGoal } from '../../crew-types';\nimport { BrandCrewGoal, CrewGoal, CrewGoalRewards, GoalViewingVersion } from '../../crew-types/CrewGoalTypes';\n\nexport function getDefaultCrewGoal<T>(type: GoalViewingVersion): T {\n    const base: Partial<RetailCrewGoal & BrandCrewGoal> = {\n        winCondition: 'allCanWin',\n        metric: 'unitsSold'\n    }\n    if (type === 'retailer') {\n        return {\n            ...base,\n        } as RetailCrewGoal as T\n    }\n    return {\n        ...base,\n    } as BrandCrewGoal as T\n}\n\nfunction validateGoal(goal: Partial<RetailCrewGoal | undefined>): { valid: boolean, errors: string[] } {\n    const goalMetrics = Object.keys(CrewGoalMetrics) as CrewGoalMetric[]\n    const winConditions = Object.keys(CrewGoalWinConditions) as CrewGoalCondition[]\n    if (!goal) return { valid: false, errors: [\"Goal is required\"] }\n    const errors: string[] = []\n    if (!goal.name) errors.push(\"Goal name is required\")\n    if (!goal.metric) errors.push(\"Goal type is required\")\n    if (goal.metric && !goalMetrics.includes(goal?.metric)) errors.push(\"Invalid goal metric\")\n    if (!goal.winCondition) errors.push(\"Win condition is required\")\n    if (goal.winCondition && !winConditions.includes(goal?.winCondition)) errors.push(\"Invalid win condition\")\n    if (((Object.values(goal?.rewards || {})?.length) || 0) === 0) errors.push(\"At least one reward is required\")\n\n    if (goal.winCondition === 'locationGoal') {\n        if ((goal.locations?.length || 0) === 0) errors.push(\"At least one location is required when using location goal\")\n    }\n\n    if (goal.winCondition === 'setNumber') {\n        // if ((goal.maxWinners || 0) <= 0) errors.push(\"Set number must be greater than 0\")\n        if ((Object.keys(goal.rewards ?? {})?.length || 0) === 0) errors.push(\"At least one reward is required when using set number goal\")\n    }\n\n    if (goal.startDate && goal.endDate && goal.startDate >= goal.endDate) errors.push(\"Start date must be before end date\")\n\n    if (goal.metricPeriod && goal.metricPeriod !== 'day') errors.push(\"Invalid metric period\")\n\n    if ((goal.includeProducts?.length || 0) > 0 && (goal.excludeProducts?.length || 0) > 0) {\n        errors.push(\"Cannot use both include and exclude product filters\")\n    }\n\n    const requireThreshold = goal.winCondition === 'teamGoal' || goal.winCondition === 'allCanWin'\n    if (requireThreshold && (goal.metricThreshold ?? 0) <= 0) {\n        errors.push(\"Threshold must be greater than 0\")\n    }\n\n    errors.push(...validateWinConditions(goal))\n\n    for (const reward of Object.values(goal?.rewards || {})) {\n        errors.push(...validateReward(reward))\n    }\n\n    return { valid: !errors.length, errors }\n}\n\nfunction validateWinConditions(goal: Partial<RetailCrewGoal>, partial = false): string[] {\n    const errors: string[] = []\n    switch (goal.winCondition) {\n        case \"allCanWin\":\n            errors.push(...validateWinConditionAll(goal, partial))\n            break;\n        case \"teamGoal\":\n            errors.push(...validateWinConditionTeam(goal, partial))\n            break;\n        case \"setNumber\":\n            errors.push(...validateWinConditionSetNumber(goal))\n            break;\n        case \"locationGoal\":\n            errors.push(...validateWinConditionLocation(goal))\n            break;\n    }\n    return errors\n}\n\nfunction validateReward(reward: Partial<CrewGoalReward>): string[] {\n    const errors: string[] = []\n    if (!reward.name) errors.push(\"Reward name is required\")\n    if ((reward.place || 0) < 0) errors.push(\"Place must not be negative\")\n    if ((reward.value || 0) > 0) {\n        // flat rate reward\n        if ((reward.variableValue || 0) > 0 || (reward.variableAmount || 0) > 0) {\n            errors.push(\"Flat rate rewards cannot have variable values\")\n        }\n    } else {\n        // variable rate reward\n        if ((reward.variableValue || 0) <= 0 || (reward.variableAmount || 0) <= 0) {\n            errors.push(\"Variable rate rewards must have variable values\")\n        }\n    }\n    return errors\n}\n\n\nfunction validateWinConditionAll(goal: Partial<RetailCrewGoal>, partial: boolean): string[] {\n    const errors: string[] = []\n    const rewardLen = Object.values(goal?.rewards || {}).length || 0;\n    const validLen = partial ? rewardLen <= 1 : rewardLen === 1\n    if (!validLen) errors.push(\"All can win can only have one reward\")\n    return errors\n}\n\nfunction validateWinConditionTeam(goal: Partial<RetailCrewGoal>, partial: boolean): string[] {\n    const errors: string[] = []\n    const rewardLen = Object.values(goal?.rewards || {}).length || 0;\n    const validLen = partial ? rewardLen <= 1 : rewardLen === 1\n    if (!validLen) errors.push(\"Win condition team can only have one reward\")\n    if (goal.metricPeriod) errors.push(\"Win condition team cannot have a metric period\")\n    return errors\n}\n\nfunction validateWinConditionSetNumber(goal: Partial<RetailCrewGoal>): string[] {\n    const errors: string[] = []\n    if (goal.metricPeriod) errors.push(\"Win condition team cannot have a metric period\")\n    for (const reward of Object.values(goal?.rewards || {})) {\n        if ((reward.place || 0) < 1) errors.push(\"Rewards must have a place\")\n    }\n    return errors\n}\n\nfunction validateWinConditionLocation(goal: Partial<RetailCrewGoal>): string[] {\n    const errors: string[] = []\n    if (goal.metricPeriod) errors.push(\"Win condition location cannot have a metric period\")\n    for (const reward of Object.values(goal?.rewards || {})) {\n        if ((reward.place || 0) < 1) errors.push(\"Rewards must have a place\")\n    }\n    return errors\n}\n\nconst defaultReward = (place?: number): CrewGoalReward => ({ rewardType: \"cash\", place: place || 1, });\nconst cleanRewards = (rewards: CrewGoalRewards, init?: boolean): CrewGoalRewards => {\n    return Object.entries(rewards).reduce((acc, [key, reward]) => {\n        reward.place = parseInt(key + 1);\n        if (init && (reward.variableAmount === 0 && reward.variableValue === 0)) {\n            reward.variableAmount = undefined;\n            reward.variableValue = undefined;\n        }\n        return { ...acc, [key]: reward };\n    }, {});\n};\n\n\n\nconst cleanGoal = (goal: Partial<CrewGoal>, viewingVersion: GoalViewingVersion): Partial<CrewGoal> => {\n    if (viewingVersion === 'retailer') {\n        const retailGoal: Partial<RetailCrewGoal> = goal as RetailCrewGoal;\n        if (retailGoal.locations?.includes(-1)) {\n            retailGoal.locations = [];\n        }\n        return retailGoal;\n    }\n\n    if (viewingVersion === 'brand') {\n        const brandGoal: Partial<BrandCrewGoal> = goal as BrandCrewGoal;\n        return brandGoal;\n\n    }\n    return goal;\n}\n\nconst onSelectGoal = (goal: Partial<CrewGoal> | undefined, viewingVersion: GoalViewingVersion): Partial<CrewGoal> | undefined => {\n    if (goal?.id) {\n        if (viewingVersion === 'retailer') {\n            const retailGoal: Partial<RetailCrewGoal> = goal as RetailCrewGoal;\n            if (retailGoal.locations?.length === 0) {\n                retailGoal.locations = [-1];\n            }\n            return retailGoal;\n        }\n\n        if (viewingVersion === 'brand') {\n            const brandGoal: Partial<BrandCrewGoal> = goal as BrandCrewGoal;\n            return brandGoal;\n        }\n    }\n    return goal;\n\n}\n\nexport const GoalsHelpers = {\n    cleanGoal,\n    validateGoal,\n    onSelectGoal,\n    validateWinConditions,\n    validateReward,\n    defaultReward,\n    cleanRewards\n}   "],"names":["Role","ADMIN_SUPERUSER","ADMIN_DIRECTOR","ADMIN_ACCOUNTMANAGER","OWNER","OPERATOR","MA","MARKETING","ANALYST","MANAGER","BUDTENDER","FINANCIAL","RoleTitles","_defineProperty","_RoleTitles","CampaignConversionActionMap","text_received","defaultEnabled","name","description","template","text_click_to_open","text_sent","text_click","email_received","email_open","push_received","push_open","browser_received","direct_mail_received","TerpliReview","undefined","TerpliRecommendation","TerpliReviewDiscount","TerpliRecommendationDiscount","call_answer","call_vm","call_complete","getTiers","currentMarketingPlan","userUtils","getPackageTier","hasMarketingStarter","hasPackageTier","hasMarketingPro","hasMarketingEnterprise","exceptions","CampaignChannelsMap","emailTemplate","icon","shortName","defaultPriority","defaultItems","campaign","getBudgetInfo","estimate","_estimate$budgetEstim","_estimate$sendEstimat","cost","budgetEstimates","costEmail","sends","sendEstimates","countEmail","getAudienceOptins","audience","optInEmailSize","isVisible","isLocked","args","_args$sendgridDomainC","_utils$initialUser","errors","tiers","includes","uid","utils","isDemo","sendgridDomainCheck","emailReady","isBrand","push","initialUser","agencyID","concat","hasPreContent","channel","subject","hasContent","html","json","validate","from","fromName","getCostPerSend","_messagingDefaults","fees","getUserFees","hasLegacyBilling","chargePerSentEmail","messagingDefaults","email","voiceTemplate","_estimate$budgetEstim2","_estimate$sendEstimat2","costVoice","countVoice","optInVoiceSize","voiceFile","lo","ttv","_messagingDefaults2","chargePerCallMinute","call","templates","_utils$user$msgContai","isAgnostic","CampaignBuilderTextOptions","regular","isAvailable","defaultTemplate","landingType","optinCampaign","emailOptinCampaign","optionType","msgContainer","user","agnostic","landingHTML","landingDesign","_estimate$budgetEstim3","_estimate$budgetEstim4","_estimate$sendEstimat3","_estimate$sendEstimat4","costSMS","costMMS","countSMS","countMMS","optInPhoneSize","_campaign$templates","MMSOnly","mmsOnly","isLegacy","body","mmsMediaURL","isMMS","_messagingDefaults3","_messagingDefaults4","chargePerSentMMS","chargePerSentSMS","mms","sms","pushTemplate","_estimate$budgetEstim5","_estimate$sendEstimat5","costPush","countPush","optInPushSize","_utils$user","_utils$user2","metadata","hasNativeApp","hasCustomApp","title","_messagingDefaults5","chargePerSentPush","browserTemplate","_estimate$budgetEstim6","_estimate$sendEstimat6","costBrowser","countBrowser","chargePerSentBrowser","snailMailTemplate","_estimate$budgetEstim7","_estimate$sendEstimat7","costMail","countPostal","front","back","size","_messagingDefaults6","chargePerSentSnailMail","directMail","adTemplate","_estimate$budgetEstim8","_estimate$sendEstimat8","costAd","countAd","chargePerCPMAds","CampaignChannels","Object","keys","TimeUnit","getColumn","render","cfg","_objectSpread","key","strify","getColumns","defs","Industries","cannabis","brewery","coffee","nightlife","political","entertainment","firearms","other","filteredIndustries","isRestricted","industry","_utils$user$profile$i","_utils$user$profile","profile","EntityTypeKeys","TelynxEntityTypes","TelnyxEntityTypesSchema","z","enum","VerticalKeys","TelnyxVerticalTypes","TelnyxVerticalTypesSchema","StatusKeys","TelynxStatusTypes","TelnyxStatusTypesSchema","IdentityStatusKeys","TelynxIdentityStatusTypes","TelnyxIdentityStatusTypesSchema","TelnyxCampaignSubmissionStatusSchema","FailureCategorySchema","object","id","string","displayName","fields","array","FailureDataSchema","brandId","optional","category","TelnyxBrandSchema","ein","street","city","state","postalCode","country","phone","refine","validatePhoneNumber","message","vertical","value","isValidTelynxVerticalType","entityType","isValidTelnyxEntityType","website","site","validateURL","companyName","firstName","lastName","stockSymbol","stockExchange","ipAddress","isReseller","boolean","mock","mobilePhone","businessContactEmail","LandingVariants","extend","cspId","altBusinessID","universalEin","identityStatus","referenceID","optionalAttributes","taxExemptStatus","status","failureReasons","failureData","ageGated","autoRenewal","billedDate","campaignId","createDate","directLending","embeddedLink","embeddedPhone","helpKeywords","helpMessage","messageFlow","nextRenewalOrExpirationDate","numberPool","optinKeywords","optinMessage","optoutKeywords","optoutMessage","referenceId","resellerId","sample1","sample2","sample3","sample4","sample5","subUsecases","subscriberHelp","subscriberOptin","subscriberOptout","termsAndConditions","usecase","webhookURL","webhookFailoverURL","isTMobileRegistered","isTMobileSuspended","any","submissionStatus","enableMessageInbox","isEnabled","brandSettings","adminUtils","canSeeAll","modern","_brandSettings$landin","_brandSettings$landin2","landingPage","variant","linkTree","_brandSettings$landin3","createEntryMap","items","_step","entries","filterCB","arguments","length","mapCB","_iterator","_createForOfIteratorHelper","s","n","done","item","err","e","f","setValidID","createEntryData","cb","filterCb","_step2","ids","_iterator2","_cb","loaded","_regeneratorRuntime","t","r","prototype","hasOwnProperty","o","defineProperty","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","h","l","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","return","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","isNaN","isGeneratorFunction","constructor","mark","setPrototypeOf","__proto__","awrap","async","Promise","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","catch","delegateYield","asyncGeneratorStep","_asyncToGenerator","apply","_next","_throw","ownKeys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","getOwnPropertyDescriptors","defineProperties","toPrimitive","String","Number","_toPrimitive","_toPropertyKey","_slicedToArray","Array","isArray","_arrayWithHoles","_iterableToArrayLimit","_arrayLikeToArray","toString","test","_unsupportedIterableToArray","_nonIterableRest","isStillSnoozed","alert","acknowledge","getAcknowledgement","snoozeDuration","snoozeStart","Date","now","isUnViewed","_alert$adminViews","acknowledged","adminViews","getUnAcknowledgedAlerts","alerts","_alert$acknowledged","validateAlert","manuallyCreated","internalName","text","active","required","formatAlertsData","userAlerts","alertsMap","noLayout","reduce","acc","ua","isValidAlert","_ua","_ua2","cleaned","htmlString","matches","match","_matches","errorMessage","documentationLink","rawError","cleanedHTML","replace","trim","console","warn","parseAndRemoveStrings","suffix","link","hover","prefix","Math","floor","startTime","newAlert","clone","Q1ALERT","sortUserAlerts","b","created","updated","isImporterTypeError","rawErr","hoverErr","some","_utils$strify","endsWith","_ua$prefix","_ua$text","_ua$suffix","_ua$permissionLevels","_ua$text2","_ua$hover","permissionLevels","startsWith","endTime","fetchUserAlerts","_ref","_ref2","alertData","setAlertData","asyncWrap","_callee","alertsData","formattedAlerts","_context","API","getUserAlerts","submitUserAlertAction","_ref4","target","options","_ref5","_callee2","currentEmail","query","requiredAcknowledgement","_ref7","_context2","auth","getEmail","map","_alert$prefix","action","showErrs","updateUserAlertsClicked","t0","updateCachedAlerts","getCachedUserAlerts","check","_ref8","storedValue","local","get","updatedInLast10Min","timeUtils","units","MINUTE_MS","deleteOldCache","decodeObject","data","alertMap","cacheUserAlerts","_ref9","isMobile","window","innerWidth","set","encodeObject","cache","DAY_MS","remove","formatUserAlertLink","isLocal","_ref11","retailerID","targetRecipeID","_ref13","brandSponsorID","sponsoredRecipeID","sampleUserAlerts","style","fontSize","color","sampleFeatureHighlightsAlerts","featureHighlight","button","creator","youtubeVideo","ECOM_ALERT","flipImage","slideshowPages","bulletItems","getRaw","deleteOldCacheUID","_n","F","_toConsumableArray","_arrayWithoutHoles","_iterableToArray","_nonIterableSpread","cleanCopyCampaign","copy","lastMessage","summary","clonedFrom","isActive","recipe","recipes","AYR","hideVoiceConvs","conversionActions","Set","enableQueue","scheduled","MINUTE_S","isChannelEmpty","priority","getTriggers","triggers","geoFence","geoFenceConditions","getAllChannels","getCampaignChannels","input","isWaterfall","channelCampaign","isSelected","sort","_input$campaigns$chan","campaigns","validateCampaignChannelPriority","changed","_campaign$channel","_campaign$channel2","chan","index","start","end","setCampaignChannelPriority","_copy$channel","campaignChannels","maxPriorityAllowed","currentPriority","newPriority","max","min","debugMode","log","hasCurrentPriority","shiftingLeft","shiftingRight","abs","_campaignChannels$fin","channelToSwap","find","isNewPriority","isAboveNewPriority","isBelowNewPriority","_copy$chan","channelPriority","DefaultCampaign","tempID","draft","blast","recurDays","conversionWindow","timezone","TimezoneSelect","DefaultTZ","haveSameSchedule","schedule","dateRange","sendWindow","getCampaignSchedule","_i","_arr","getCampaignType","_channelTypes$find","CampaignTypesMapping","hasType","informationKeys","channelName","channelNameIndex","indexOf","storeIDHash","isEqual","audiences","exclude","storeIDs","tags","capPerDay","sendAtTimePredicted","isCampaignInformationMatching","channelMap","channels","otherCampaign","_i2","_arr2","JSON","stringify","getCampaignInformation","campaignChannel","getCampaignChannelType","newCampaign","_i3","_arr3","_i4","_arr4","addChannelNameToCampaigns","_campaigns$firstChann","firstChannel","firstCampaignName","newCampaigns","every","deleteAllChannels","campaignHasRecipientsConfigured","validateCampaigns","requireContent","selectedCount","isMatching","config","sameInformation","sameSchedule","getCampaign","channelInfo","channelData","validateSingleCampaign","_loop","_arr5$_i","_arr5","_i5","channelErrors","error","dynamicRegex","RegExp","isDynamic","_campaign$lifetimeCap","_campaign$templates2","_campaign$templates3","_campaign$templates4","_campaign$emailTempla","_campaign$emailTempla2","_campaign$emailTempla3","_campaign$templates5","_campaign$storeIDs","_campaign$exclude","hasQueue","hasLifetimeCap","lifetimeCap","hasMsgContainer","hasBody","dynamicContent","info","htmlHasDynamicMacros","sampleDataEnabled","hasConfiguredContent","checkInvalidMacroEnding","lockMMSURL","optinImage","mediaContentType","removeUnusedProductSlugs","_campaign$templates6","_campaign$emailTempla4","slugs","textHtml","slug","emailHtml","cleanEmailTemplate","_campaign$emailTempla5","_campaign$emailTempla6","replaceAll","linkMacros","getLinkMacros","endMacroMatch","macroString","_macroString$match","realMacro","sendNotification","hasCampaignChannel","_input$campaigns$chan2","sendTestEmail","_x","_x2","_sendTestEmail","recipient","templateData","_templateData$html","_templateData$html2","lastSend","timeRemaining","round","showErr","post","showSuccess","sendTestText","_x3","_x4","_sendTestText","_callee4","_context4","phoneRex","_callee3","_context3","fetchAPI","payload","isCampaignDisabled","isDisabled","disabledCmp","disabled","reasons","disabledMap","_i6","_arr6","_arr6$_i","result","userID","hasCamaignSent","isCampaignLocked","lockedReason","isStaging","isPastSendDate","bufferTime","_campaign$dateRange","_campaign$dateRange2","getCampaignWithoutChannel","cleanForecastableCampaign","noChannel","_copy$templates","_copy$templates2","_copy$templates3","_copy$templates4","_copy$voiceTemplate","_copy$voiceTemplate2","inUse","trimObject","contentKeys","validateCampaignContent","checkMacros","results","blankAudiences","byTemplate","allAudiences","flatMap","_i7","_Array$from","_result$traits","_result$sources","_result$sources2","audienceID","traits","sources","channelKey","checkText","toLowerCase","allValidMacros","regexPatterns","validMacros","regex","macro","add","findValidMacros","bannedMacrosByTemplate","bannedMacros","invalidMacroList","invaildMacros","warningMacros","warninMacroList","allBannedMacros","flat","_i8","_Object$entries","CampaignBuilderMacros","_checkText","_Object$entries$_i","matchValue","discountMacros","brokenMacrosMap","Map","brokenMacros","canTestSendTextMessages","isDispojoy","isMessageDigital","isPolitical","isDevUID","hasApprovedTelnyxCampaign","hasInfoBipCampaignID","normal","confirm","visisble","isRandomLottery","hasTriggers","Boolean","isOptin","enable","getDefaultTemplateKeysFilters","industries","usage","abandonedCart","_campaign$triggers","CampaignScheduleTypesMapping","ongoing","postPurchase","_campaign$triggers2","postSale","birthdayReward","_campaign$triggers3","birthday","randomLottery","smsOptin","emailOptin","disableImplicitEmail","show","startEnd","queue","CampaignBuilderStages","hasStarted","hasCompleted","isCompleted","checkCompleted","isOnChannelStage","selectedStage","recipients","isOnRecipientsStage","_campaign$audiences","_Object$values","_campaign$audiences2","errs","_arr$_i","content","isOnContentStage","hasCompletedPrev","_step3","_iterator3","review","isOnReviewStage","hasMessage","_Object$values2","_Object$values3","_utils$user$profile2","disableWalledGarden","hasRestrictedIndustry10DLC","_utils$user$profile3","mmsLogo","ClonedCampaignTrackerFields","onClick","props","setSelectedStage","isSame","ogCampaign","ogName","ogAudiences","ogExcluded","excluded","ogStores","stores","ogStoreHash","storeHash","email_subject","setSelectedChannel","ogTemplate","email_content","text_mms_image","text_message_body","text_landing_page","voice_ttv_message","voice_recording","push_image","mediaURL","push_subject","push_content","browser_push_image","browser_push_subject","browser_push_content","ProductSelectorModalContextProvider","React","ProductSelectorModal","_React$useState2","open","setOpen","_useSearchDebounce2","useSearchDebounce","inputValue","search","setSearch","_React$useState4","hasSearched","setHasSearched","_React$useState6","loading","loader","setLoader","_React$useState8","staticProducts","setStaticProducts","ecomData","setEcomData","_React$useState10","categories","brands","filters","setFilters","_props$slugs","ecomBrands","ecomCategories","getEcomBrands","getEcomCategories","t1","handleSearch","finallyCallback","wasError","cancelError","initial","productsMap","selectedProducts","getStaticProducts","formatNumber","_props$slugs2","_ref6","product","selected","onConfirm","productList","productName","label","categoryOptions","brandOptions","brand","GButton","tooltip","padding","FA","marginRight","opacity","Modal","centered","onCancel","width","bodyStyle","okText","onOk","fontWeight","lineHeight","Break","display","gap","alignItems","AutoComplete","minWidth","filterOption","placeholder","Space","SearchOutlined","onChange","Select","allowClear","showArrow","mode","paddingLeft","paddingRight","marginTop","GTable","alternateHeader","noRadius","pagination","defaultPageSize","dataSource","columns","colors","primary","blue","_staticProducts","newProducts","selectProduct","Avatar","shape","src","imageUrl","HighlightText","salesPrice","locale","emptyText","Empty","image","PRESENTED_IMAGE_SIMPLE","isLink","requiredPermissions","marketing","date","reviewWidgetURL","walletURL","walletURLSignup","loyaltySignupURL","referFriendURL","tattleFeedbackURL","emailOptOutURL","predictedTopProduct","predictedTopSku","predictedTopBrand","predictedTopCategory","favoriteStore","fallback","favoriteStoreShopURL","favoriteRecStoreShopURL","dontShowInMacroList","isCannabis","favoriteMedStoreShopURL","favStoreDisclaimer","favStoreAvatar","zip","loyaltyPoints","contactID","totalPointsEarned","totalPointsRedeemed","lastOrderedProduct","lastOrderedBrand","lastOrderedCategory","favoritestoreapplestore","favoritestoregoogleplay","favoritestoreinstagram","favoritestoretwitter","favoritestoregoogle","favoritestorefacebook","favoritestoreyelp","favoritestoreweedmaps","favoritestoreleafly","favoritestoretattle","forstaURL","emailOptInURL","favoriteStoreSales","air","discounts","surveys","productSlug","CrewLeaderboardTypes","members","locations","goals","Leaderboard_ViewingVersions","retailer","isVertical","DateRangeDayPeriods","all","getTime","today","getTodayUnix","DAY_S","getRandomEntry","pink","error500","getUUID","acv","random","totalProducts","generateRandomWord","revenue","transactions","getMockMemberByBrandAndProductBrand","generateRandomString","getMockGoalByBrandAndProduct","getMockDate","days","setDate","getDate","toISOString","split","getMockSnapshotData","topMembers","_","topGoals","topLocations","global","totalRevenue","goalsRevenue","goalsRevenuePercentage","orders","topMembersByDay","entry","byDate","topGoalsByDay","topGoalsByMember","byMember","topLocationsByDay","topLocationsByMember","ValuePeriods","day","CrewGoalMetrics","unitsSold","shown","goal","vv","dollarAmount","CrewGoalWinConditions","allCanWin","shortTitle","winCondition","setNumber","metricPeriod","locationGoal","teamGoal","GoalViewingVersions","isRetail","GoalDrawerTabDetails","canContinue","isBrandGoal","startDate","endDate","_goal$audienceIDs","audienceIDs","brandGoal","targetStoresLen","eligibleRetailers","val","_goal$includeProducts","_goal$excludeProducts","_goal$includeCategori","_goal$excludeCategori","_retailGoal$includeBr","_retailGoal$excludeBr","includedProducts","includeProducts","excludedProducts","excludeProducts","includedCategories","includeCategories","excludedCategories","excludeCategories","hasFilters","hasMetric","metric","retailGoal","includedBrands","includeBrands","excludedBrands","excludeBrands","_Object$keys","rewards","_GoalsHelpers$validat","GoalsHelpers","validateGoal","valid","PayoutViewingVersions","CrewPayoutStatusConfig","pending","upcoming","completed","disputed","validateCrewMember","crewMember","getDefaultCrewGoal","base","validateWinConditions","partial","rewardLen","validLen","validateWinConditionAll","validateWinConditionTeam","place","validateWinConditionSetNumber","_Object$values4","validateWinConditionLocation","validateReward","reward","variableValue","variableAmount","cleanGoal","viewingVersion","_retailGoal$locations","_goal$metricThreshold","goalMetrics","winConditions","_goal$locations","_goal$rewards","metricThreshold","onSelectGoal","_retailGoal$locations2","defaultReward","rewardType","cleanRewards","init","parseInt"],"sourceRoot":""}