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CzC,EAI5C,OAHqC,KAAb,QAApBsF,EAAA7C,EAAW9F,iBAAS,IAAA2I,OAAA,EAApBA,EAAsB18B,UACtB65B,EAAW9F,UAAY,EAAE,IAEtB8F,CACX,CAEA,GAAuB,UAAnBoC,EAEA,OAD0C7E,CAGlD,CACA,OAAOA,CAEX,EAMI8D,sBAAAA,EACAU,eAAAA,EACAe,cAxDkB,SAACnB,GAAc,MAAsB,CAAEoB,WAAY,OAAQpB,MAAOA,GAAS,EAAI,EAyDjGqB,aAxDiB,SAAC1C,EAA0B2C,GAC5C,OAAO/lC,OAAO8I,QAAQs6B,GAASjwB,QAAO,SAACC,EAAGiD,GAAoB,IAAAC,EAAAtF,EAAAqF,EAAA,GAAjB9V,EAAG+V,EAAA,GAAEwuB,EAAMxuB,EAAA,GAMpD,OALAwuB,EAAOL,MAAQuB,SAASzlC,EAAM,GAC1BwlC,GAAmC,IAA1BjB,EAAOE,gBAAiD,IAAzBF,EAAOC,gBAC/CD,EAAOE,oBAAiB/uC,EACxB6uC,EAAOC,mBAAgB9uC,GAE3BqK,EAAAA,EAAA,GAAY8S,GAAG,GAAAre,EAAA,GAAGwL,EAAMukC,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,\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 extends ColumnType {\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 = (\n\ttitle: string | React.ReactNode,\n\trender: (record: T) => React.ReactNode | any,\n\tcfg?: TableColumn\n): TableColumn => {\n\tcfg = { ...cfg };\n\tif (!cfg.key) cfg.key = utils.strify(title);\n\treturn { title, render, ...cfg };\n};\n\n\nexport function getColumns(defs: Array>): TableColumn[] {\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\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\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;\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\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];\nconst TelnyxEntityTypesSchema = z.enum(EntityTypeKeys);\nconst VerticalKeys = Object.keys(TelnyxVerticalTypes) as [keyof typeof TelnyxVerticalTypes, ...Array];\nconst TelnyxVerticalTypesSchema = z.enum(VerticalKeys);\nconst StatusKeys = Object.keys(TelynxStatusTypes) as [keyof typeof TelynxStatusTypes, ...Array];\nconst TelnyxStatusTypesSchema = z.enum(StatusKeys);\nconst IdentityStatusKeys = Object.keys(TelynxIdentityStatusTypes) as [keyof typeof TelynxIdentityStatusTypes, ...Array];\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;\nexport type TelnyxGetBrand = z.infer;\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;\nexport type FailureData = z.infer;\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;\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 { LandingPageButtonLink, LandingVariant, UserSettings } from '@alpine-iq/shared';\n\nexport const LandingVariants: Record<\n\tLandingVariant,\n\t{\n\t\ttitle: string;\n\t\tdescription: string;\n\t\tisEnabled: (brandSettings?: Partial) => boolean;\n\t}\n> = {\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: (brandSettings?: Partial) => {\n\t\t\treturn brandSettings?.landingPage?.variant === 'modern' || !brandSettings?.landingPage?.variant;\n\t\t},\n\t},\n\tlinkTree: {\n\t\ttitle: 'Linktree style',\n\t\tdescription: 'Use full width large buttons',\n\t\tisEnabled: (brandSettings?: Partial) => {\n\t\t\treturn brandSettings?.landingPage?.variant === 'linkTree';\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 './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 = Partial | ((curr: T) => Partial);\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 = {\n\tids: (string | number)[]; // Used to keep the order of the entries\n\tentries: { [id: ID]: T };\n};\n\nexport type EntryMap = { [id: ID]: T };\n\nexport type EntryDataLoader = EntryData & {\n\tloaded?: boolean;\n};\n\ntype InputArgs = [filterCB?: (i: T, key: number) => boolean, mapCb?: (i: T, key: number) => T];\n\nexport function createEntryMap(items: T[], ...args: InputArgs): EntryMap {\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(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(\n\titems: T[],\n\tcb?: (item: T) => T,\n\tfilterCb?: (item: T) => boolean,\n): EntryData | EntryDataLoader {\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>\\n

See Documentation<\\/a><\\/p>\\n

\\nRaw 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 = '
, noLayout?: boolean): Partial => {\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, // 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);\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: 'Click here 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: 'Click here 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 \"- \" 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 \"- \" 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// & is breaking the links so we need to remove it.\n\tif (campaign.emailTemplate?.html) {\n\t\tcampaign.emailTemplate.html = campaign.emailTemplate.html?.replaceAll(/&/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 {\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// & is breaking the links so we need to remove it.\n\ttemplateData.html = templateData.html?.replaceAll(/&/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 {\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,\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(/[\\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=\"[a-zA-Z0-9:;\\.\\s\\(\\)\\-\\,]*\"|[\\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();\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>;\n\n\tselectedStage: CampaignBuilderStage | undefined;\n\tsetSelectedStage: React.Dispatch>;\n\n\tselectedChannel: CampaignChannelType | undefined;\n\tsetSelectedChannel: React.Dispatch>;\n\n\tgetCampaign: (channel?: CampaignChannelType) => Campaign;\n\tupdateCampaign: (campaign: Campaign, channel?: CampaignChannelType | true) => void;\n\tupdateChannel: (channel: CampaignChannelType, data: Partial) => 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>;\n\n\tchannels: (ChannelInfo & CampaignChannel)[];\n\tchannelMap: CmpChannelMap;\n\tselectedCount: number;\n\n\tstores: EntryMap;\n\n\taudiences: EntryMap;\n\tsetAudiences: React.Dispatch>>;\n\n\tconfig: CampaignBuilderConfig;\n\tsetConfig: React.Dispatch>;\n\n\tsendgridDomainCheck?: SendgridDomainCheck | undefined;\n\n\ttextSegments: number | undefined;\n\tsetTextSegments: React.Dispatch>;\n};\n\nexport type CampaignBuilderChannelsProps = CampaignBuilderPageProps & {\n\tcampaign: Campaign;\n\tsetCampaign: React.Dispatch>;\n\tcampaigns: CampaignMap;\n\tsetCampaigns: React.Dispatch>;\n\togCampaigns?: CampaignMap;\n};\nexport type CampaignBuilderContentProps = CampaignBuilderPageProps & {\n\tsendgridDomainCheck?: SendgridDomainCheck | undefined;\n\tsetPreviewConfig?: React.Dispatch>;\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>;\n\n\tclonedCampaign?: Campaign | undefined;\n\tsetClonedCampaign: React.Dispatch>;\n\n\tclonedCampaigns: CampaignMap;\n\tsetClonedCampaigns: React.Dispatch>;\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>,\n];\n\nexport const ProductSelectorModalContextProvider = React.createContext({});\n\ntype ProductSelectorModalProps = {\n\tslugs?: string[];\n\tonConfirm: (products: EntryMap) => 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({ loading: false, loaded: false });\n\tconst [staticProducts, setStaticProducts] = React.useState>({});\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 = {};\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;\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);\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 setOpen(true)}\n\t\t\t>\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\tStatic products\n\t\t\t\t
\n\t\t\t\n\n\t\t\t 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);\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
\n\t\t\t\t\tInsert a product\n\t\t\t\t\t\n\t\t\t\t
\n\n\t\t\t\t<>\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t Search media by name, tag, or type...\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\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
\n\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t setFilters({ ...filters, categories: value })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t setFilters({ ...filters, brands: value })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t 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\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\n\n\t\t\t\t
\n\t\t\t\t\t([\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 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\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
\n\t\t\t\t\t\t\t\t\t\t\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\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\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
\n\t\t\t\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 = {\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\tRequires GlobalTill POS: This macro replaces itself with discounted products as long as they have at least 7 items in inventory available (You\n\t\t\t\tcan change the 7 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\n\t\t\t\t7 the argument is the minimum quantity that should be in stock for the product to be sent in the macro. Can be any number.\n\t\t\t\t\n\t\t\t\t🔥 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>\n\n viewingVersion: LeaderboardViewingVersion\n setViewingVersion: React.Dispatch>\n\n filters: CrewLeaderboardFilters\n setFilters: React.Dispatch>\n\n drawerTarget: LeaderboardTarget | undefined\n setDrawerTarget: React.Dispatch>\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>\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 = {\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 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>;\n\tgoalData: EntryData;\n\tsetGoalData: React.Dispatch>>;\n\tgroupData: EntryData;\n\tsetGroupData: React.Dispatch>>;\n\taudiences: EntryData>;\n\tsetAudiences: React.Dispatch>>>;\n\tstoreLocations: EntryData;\n\tsetStoreLocations: React.Dispatch>>;\n\thandleSubmit: () => void;\n\tarchiveGroup: (group: Partial) => void;\n\tselectedGroup: string | undefined;\n\tsetSelectedGroup: React.Dispatch>;\n\teditingGroup: string | undefined;\n\tsetEditingGroup: React.Dispatch>;\n\tfilters: CrewGoalsFilters;\n\tsetFilters: React.Dispatch>;\n\tgoal: Partial | undefined;\n\tsetGoal: React.Dispatch | undefined>>;\n\toriginalGoal: Partial | undefined;\n\tsetOriginalGoal: React.Dispatch | undefined>>;\n\tstats: GoalsPageStats;\n\tsetStats: React.Dispatch>;\n\tviewingVersion: GoalViewingVersion;\n\tsetViewingVersion: React.Dispatch>;\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, 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, 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, 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, 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, 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>;\n\n\tnextTab: (tab: GoalDrawerTab) => void;\n\n\tcompleted: GoalDrawerTab[];\n\tsetCompleted: React.Dispatch>;\n\n\thandleClose: (actionCheck?: boolean) => void;\n\n\tloadProductData: (search?: string) => void;\n\tproductData: CrewGoalBuilderEntity;\n\tsetProductData: React.Dispatch>>;\n\n\tloadBrandData: (search?: string) => void;\n\tbrandData: CrewGoalBuilderEntity;\n\tsetBrandData: React.Dispatch>>;\n\n\tloadCategoryData: (search?: string) => void;\n\tcategoryData: CrewGoalBuilderEntity;\n\tsetCategoryData: React.Dispatch>>;\n}\n\nexport type CrewGoalBuilderEntity = CrewListResponse & {\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>;\n\n\tsearchData: SearchDataType;\n\n\tfilters: CrewPayoutFilters;\n\tsetFilters: React.Dispatch>;\n\n\tretailPayouts: EntryMap;\n\tsetRetailPayouts: React.Dispatch>>;\n\n\tbrandPayouts: EntryMap;\n\tsetBrandPayouts: React.Dispatch>>;\n}\n","import { CrewMember } from \"../crew-types\"\nexport * from '../pages/goals/crewgoal.helpers'\n\nexport function validateCrewMember(crewMember?: Partial): [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(type: GoalViewingVersion): T {\n const base: Partial = {\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): { 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, 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): 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, 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, 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): 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): 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, viewingVersion: GoalViewingVersion): Partial => {\n if (viewingVersion === 'retailer') {\n const retailGoal: Partial = 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 = goal as BrandCrewGoal;\n return brandGoal;\n\n }\n return goal;\n}\n\nconst onSelectGoal = (goal: Partial | undefined, viewingVersion: GoalViewingVersion): Partial | undefined => {\n if (goal?.id) {\n if (viewingVersion === 'retailer') {\n const retailGoal: Partial = 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 = 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","modern","isEnabled","brandSettings","_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":""}