@feedmepos/mf-connect 0.1.115-prod → 0.1.117-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +64 -1
  2. package/dist/{App-CvtSY8ZO.js → App-BpcsgH7K.js} +444 -427
  3. package/dist/AuditLogs-BNnUiVnD.js +2016 -0
  4. package/dist/{Bin-B3gS9QVZ.js → Bin-Cm0wjQeR.js} +8 -8
  5. package/dist/{Broadcast-DAeb-HaN.js → Broadcast-BoJaHqnO.js} +22 -21
  6. package/dist/{CampaignAnalytic-BfTaHVem.js → CampaignAnalytic-Eg4xZW0B.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zsei4OfG.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BXylK6Ze.js} +9 -9
  8. package/dist/{Card-JFeVIwFs.js → Card-BfkMcFaG.js} +25 -24
  9. package/dist/{Collections-xcDpEhIm.js → Collections-RXmxQbII.js} +197 -185
  10. package/dist/{Credit-C9HJZjDS.js → Credit-CsRPM1jv.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DSqVY91w.js → DateRangeChip.vue_vue_type_script_setup_true_lang-D2tvK7pw.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BgPeHurN.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js → EffectSheet.vue_vue_type_style_index_0_lang-CUx8UIIq.js} +32 -32
  14. package/dist/{Experience-DszS8gto.js → Experience-BC8Pj-v9.js} +32 -31
  15. package/dist/{FileSaver.min-CFVQKaC-.js → FileSaver.min-DzmoQFA0.js} +1 -1
  16. package/dist/{Game-DhgeN7E2.js → Game-DJXNHFBs.js} +19 -18
  17. package/dist/{GiftCardSetup-CWm6IhrS.js → GiftCardSetup-_0n8lU-t.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-BuKADvmK.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-C-AiJdui.js} +7 -7
  19. package/dist/{Goals-DtRVierH.js → Goals-DSZwKpds.js} +4 -4
  20. package/dist/Grab-DDc7e-AC.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js → ImageInput.vue_vue_type_script_setup_true_lang-BZb-H4fM.js} +1 -1
  22. package/dist/{Index-DFRcu_qE.js → Index-Cbi0bquE.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-B3Br4Xvi.js → LocationPicker.vue_vue_type_script_setup_true_lang-GLhMtvzi.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CjNJj3qj.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Bt9CO_QR.js} +1 -1
  25. package/dist/{LoyaltyDashboard-BWHKDPzk.js → LoyaltyDashboard-fK90c27A.js} +15 -15
  26. package/dist/MainLayout-Bf-l9yL4.js +4 -0
  27. package/dist/{MainLayout-BmpNNAiE.js → MainLayout.vue_vue_type_script_setup_true_lang-COR6YYYI.js} +5 -4
  28. package/dist/Marketing-B7cZGsO-.js +269 -0
  29. package/dist/MarketingMaterialEdit-5IcV2ct6.js +1037 -0
  30. package/dist/{Member-xEzrBW_p.js → Member-BGTrRVdq.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-DRoC-I0t.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DJr2hV2W.js} +43 -50
  32. package/dist/{MemberImportHistory-CEQpBBF8.js → MemberImportHistory--FxkTJmu.js} +7 -7
  33. package/dist/{MemberList-CCvzkHv8.js → MemberList-EjY5dgwt.js} +103 -105
  34. package/dist/{MemberTransactions-Bmh39J2W.js → MemberTransactions-Oia7LIFK.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js → MessageInput.vue_vue_type_script_setup_true_lang-CLOQZCYy.js} +14 -14
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DIBKAwHP.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Ev3bB8cg.js} +1 -1
  37. package/dist/{Mission-CpUo2Bgw.js → Mission-BFHYb4aT.js} +22 -21
  38. package/dist/{Overview-DcDZmDXA.js → Overview-BVNyQxFL.js} +23 -22
  39. package/dist/{Overview-CwQqQ1Tn.js → Overview-d5U37aot.js} +145 -144
  40. package/dist/{Point-CUNQsQIx.js → Point-CXkqH02Z.js} +22 -21
  41. package/dist/{Promotion-Cqdim7aW.js → Promotion-DdxNvlOO.js} +137 -131
  42. package/dist/{Queue-CNBVh1UG.js → Queue-C96oNKyP.js} +46 -45
  43. package/dist/{Record-BYwz4l4o.js → Record-Bj2e2Y4i.js} +9 -9
  44. package/dist/{Review-CqLcZFj8.js → Review-CJK5S1oI.js} +2 -2
  45. package/dist/ReviewFacebookCallback-ChG7TRy5.js +225 -0
  46. package/dist/{ReviewGoogleCallback-Dg8R7QlO.js → ReviewGoogleCallback-Dmk4VyGA.js} +5 -5
  47. package/dist/{Reward-M8GZ8eHq.js → Reward-Dh2YI0Xb.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BkM9-Sx-.js → RewardGroup.vue_vue_type_script_setup_true_lang-U47m3AAn.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-2L6ZGMW7.js +1923 -0
  50. package/dist/{Segment-CrMi6xrp.js → Segment-FYvtCkqH.js} +304 -305
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DKH5_9db.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DPZZz2e0.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyeAQ-hg.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D8wBgLlS.js} +4 -4
  53. package/dist/Setting-CUAWjCqa.js +574 -0
  54. package/dist/{SettingAdvertisements-Dh7v4c1D.js → SettingAdvertisements-COIQwUD6.js} +12 -12
  55. package/dist/Settings-D2gFPvmW.js +286 -0
  56. package/dist/{Store-CV-BmK5b.js → Store-BAXwiyvx.js} +31 -30
  57. package/dist/{StoreRewards-DPhSLvSZ.js → StoreRewards-2mUavtUg.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-5g3yIL1a.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DHi4rdT1.js +7007 -0
  60. package/dist/{Tier-ChvYps23.js → Tier-BmAOzRHL.js} +2576 -687
  61. package/dist/{Title-v-Ivswr1.js → Title-DMxiUg30.js} +94 -92
  62. package/dist/{Transaction-CRqE1Ix0.js → Transaction-CF6hXEpN.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BON_t0dL.js} +26 -26
  64. package/dist/{Voucher-Bg8FOuzD.js → Voucher-DrtITxq-.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js → VoucherEditor.vue_vue_type_script_setup_true_lang-1DZOzJKx.js} +16 -16
  66. package/dist/WhatsappAccount-Bb0Y7ikk.js +159 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CPlyzkp4.js +39 -0
  68. package/dist/WhatsappBot-DNvvaPey.js +876 -0
  69. package/dist/WhatsappBotLogs-C8M-1pvv.js +372 -0
  70. package/dist/WhatsappBotSettings-D6egqUyU.js +705 -0
  71. package/dist/WhatsappLayout-DeQTPuF6.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DI0pcHcE.js +253 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-8d290Dcp.js → ZodTextField.vue_vue_type_script_setup_true_lang-CKZscSjU.js} +2 -2
  74. package/dist/{app-DdNKsn2Q.js → app-BjdLqYQq.js} +8879 -7107
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-R97FrSQL.js → base.export-B68z5BF6.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-Ce8vq3wQ.js → business-D9fgkHxb.js} +1 -1
  79. package/dist/{campaign-C19If7bW.js → campaign-Dw_ujovr.js} +121 -94
  80. package/dist/{campaign-BTllt2LH.js → campaign-eMaPX8r6.js} +31 -25
  81. package/dist/{campaign.enum-9CCbalR4.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-B4g03h0A.js → campaign.fn-DFjGNvmN.js} +78 -78
  83. package/dist/{collectible.enum-MvqF7mSg.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-CR0bD33S.js → collection.fn-CCOWtB-c.js} +2 -2
  85. package/dist/{currency-DmlguGIM.js → currency-CTLKReFC.js} +1 -1
  86. package/dist/duplicateCampaign-BcpBfUGL.js +51 -0
  87. package/dist/{effect-Dx3zfl28.js → effect-CTI1ZH57.js} +1 -1
  88. package/dist/{email-addresses-De5PGOY4.js → email-addresses-B74e3bnB.js} +2 -2
  89. package/dist/{feature-flag-CD9V1V0h.js → feature-flag-DVdEaChJ.js} +182 -166
  90. package/dist/google-BQK68wbe.js +5 -0
  91. package/dist/{helper-CEiv7SaO.js → helper-as9K-piK.js} +1 -1
  92. package/dist/{index-CBJy9bxB.js → index-3LjKJhQa.js} +1 -1
  93. package/dist/{index-BW6eb3n6.js → index-8mBfDn3M.js} +611 -252
  94. package/dist/{index-D4d3l0gw.js → index-B0h0iYWP.js} +8 -7
  95. package/dist/{index-BAXKd9Gg.js → index-BEKMTiFb.js} +198 -198
  96. package/dist/{index-B8yWVB8P.js → index-BW7FoVEA.js} +4 -3
  97. package/dist/{index-BVdYxi3l.js → index-B_wRpO02.js} +29 -15
  98. package/dist/{index-B8meeQoD.js → index-Ba719MYq.js} +1 -1
  99. package/dist/{index-BDPnyro2.js → index-BbVbqe4Y.js} +19 -6
  100. package/dist/{index-CqOCJTeR.js → index-BhTrG89b.js} +390 -232
  101. package/dist/index-C-iwb2Ln.js +109 -0
  102. package/dist/{index-CPODug8b.js → index-C5V6u2Qd.js} +2700 -2613
  103. package/dist/{index-CWUrODxL.js → index-CHU3UePP.js} +1 -1
  104. package/dist/{index-IZRfmmde.js → index-CQxkDpX0.js} +683 -581
  105. package/dist/{index-DT3S00_Y.js → index-CWLOcQ6j.js} +11 -10
  106. package/dist/index-C_H8jFYf.js +2743 -0
  107. package/dist/{index-__UT3_Ey.js → index-Ckz6u3ac.js} +2 -2
  108. package/dist/{index-BYI9ttxy.js → index-Czg-2Ni0.js} +8028 -10767
  109. package/dist/{index-xct3mnu8.js → index-DKI8401o.js} +7 -7
  110. package/dist/{index-649OZ_e1.js → index-DcZiikOH.js} +2 -2
  111. package/dist/{index-BquSqx6K.js → index-QHqcSN2q.js} +4 -4
  112. package/dist/{index-BR9h5DTI.js → index-TAoQpeLQ.js} +1 -1
  113. package/dist/index-wsCCqwdr.js +74 -0
  114. package/dist/{index.esm2017-AVbZ9btd.js → index.esm2017-DL6rTGDW.js} +177 -177
  115. package/dist/{loading-BvHm1m3K.js → loading-x6IScY4K.js} +1 -1
  116. package/dist/{lodash-Dvrceo7x.js → lodash-nwnDizYo.js} +1 -1
  117. package/dist/{member-import-c9avpiSS.js → member-import-C-b01Tyd.js} +6 -5
  118. package/dist/{membership-D-pZS634.js → membership-DfarOMtO.js} +3 -3
  119. package/dist/{money-D4skwMkD.js → money-CFn-jR4W.js} +1 -1
  120. package/dist/{number-DJ6ncfT6.js → number-CSlyDL2x.js} +1 -1
  121. package/dist/objectid-zcT6ESET.js +145 -0
  122. package/dist/{onboarding-t7R1d3h-.js → onboarding-DyaFaaF2.js} +25 -25
  123. package/dist/{onboardingSetup-lTaJc0oT.js → onboardingSetup-DQt91O9f.js} +2 -2
  124. package/dist/{plugins-DQNOWwRC.js → plugins-DEHr0UOe.js} +3 -3
  125. package/dist/{MarketingMaterialEdit-x3c_N7Gs.js → remy-icon-BhUGu2NI.js} +2 -1031
  126. package/dist/{reward-BK150pjm.js → reward-Du_Pv-4p.js} +1 -1
  127. package/dist/{rule-COcdAnUu.js → rule-DfqmQTVK.js} +572 -492
  128. package/dist/style.css +1 -1
  129. package/dist/template-CcbNF4PF.js +188 -0
  130. package/dist/{timezone-BP6UC4KL.js → timezone-_4tabIaK.js} +1 -1
  131. package/dist/{transaction.fn-BY0hzon0.js → transaction.fn-C46PHwCV.js} +2 -2
  132. package/dist/{trigger-DVBjVPbN.js → trigger-Dipr6btC.js} +8 -8
  133. package/dist/useMarketingMaterialActions-BAw2ZjeF.js +125 -0
  134. package/dist/{usePagination-QT552XyF.js → usePagination-D6RZ18zS.js} +1 -1
  135. package/dist/{user-CmAxNc7T.js → user-BCexQj3Q.js} +1 -1
  136. package/dist/vue-i18n-DXvyTCZf.js +2365 -0
  137. package/dist/{xlsx-DAczoc8y.js → xlsx-BTxt_Jg6.js} +224 -224
  138. package/dist/{zod-Aj-GuVQL.js → zod-T4wMYjWT.js} +1 -1
  139. package/package.json +6 -2
  140. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D_jXVE2I.js +0 -3494
  141. package/dist/Marketing-BKK45Eve.js +0 -236
  142. package/dist/ReviewFacebookCallback-DbSCILNN.js +0 -238
  143. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js +0 -1883
  144. package/dist/Setting-BnFRI0Se.js +0 -2037
  145. package/dist/Settings-BvT8_tkQ.js +0 -179
  146. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CDu1QySl.js +0 -1264
  147. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js +0 -142
  148. package/dist/google-C3S8u0mT.js +0 -4
  149. package/dist/objectid-DEMM_jdR.js +0 -145
  150. package/dist/rule-builder-Deufb6h_.js +0 -102
  151. package/dist/template-DeebIqJ_.js +0 -236
  152. package/dist/useMarketingMaterialActions-DpQCQHFI.js +0 -96
  153. package/dist/vue-i18n-Cze706-f.js +0 -2365
@@ -1,3494 +0,0 @@
1
- import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createVNode, unref, isRef, withCtx, createBlock, createCommentVNode, computed, createElementVNode, toDisplayString, Fragment, renderList, normalizeClass, createTextVNode, watchEffect, onMounted, withModifiers, toRefs, normalizeStyle, resolveDynamicComponent, onBeforeUnmount, createSlots } from "vue";
2
- import { _ } from "./lodash-Dvrceo7x.js";
3
- import { h as axios, S as SvcConfig } from "./index-xct3mnu8.js";
4
- import { z } from "./app-DdNKsn2Q.js";
5
- import { Z as ZodHelper } from "./zod-Aj-GuVQL.js";
6
- import { F as FdoObjectId, z as z$1 } from "./index-BYI9ttxy.js";
7
- import { e as FdoGroup, F as F_RUNNABLE_CAMPAIGN_TYPE, f as FdtoRunnableCampaign, g as FdoCreditLoyaltyReward, h as FdtoRandomReward, i as F_MISSION_TYPE, j as FdoThresholdCreditReward, k as FdtoThresholdReward, l as FdoMission } from "./index-CqOCJTeR.js";
8
- import { F as FdtoCollectibleConfig } from "./index-CPODug8b.js";
9
- import { i as isRuleGroup, R as RuleBuilder, a as isRuleEntry } from "./rule-builder-Deufb6h_.js";
10
- import { A as APP_INBOX_BODY_LIMIT, g as FdoBroadcastUrl, h as F_PUSH_DESTINATION, t as toDelivery, i as toLegacyMessage } from "./index-BAXKd9Gg.js";
11
- import { d as CHANNEL_DISPLAY_ORDER, i as isPaidChannel, e as isChannelComplete, f as setMode, h as addChannel, j as hasDraft, k as setPrimaryChannel, r as removeChannel, m as moveChannel, l as setChannelContent, n as getCampaignSummaryObject, o as normaliseBroadcastDelivery } from "./campaign-C19If7bW.js";
12
- import { u as useMembershipStore } from "./membership-D-pZS634.js";
13
- import { u as useBusinessStore } from "./business-Ce8vq3wQ.js";
14
- import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
15
- import { h as hooks } from "./moment-D7p2TMB-.js";
16
- import { f as featureVersionMapping } from "./campaign.enum-9CCbalR4.js";
17
- import { _ as _sfc_main$x } from "./ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js";
18
- import { b as _sfc_main$v, a as _sfc_main$y, _ as _sfc_main$A } from "./EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js";
19
- import { _ as _sfc_main$z } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js";
20
- import { _ as _sfc_main$B } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js";
21
- import { _ as _sfc_main$p, a as _sfc_main$t } from "./RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js";
22
- import { p as prompt, f as firebaseStorage } from "./plugins-DQNOWwRC.js";
23
- import { u as useI18n } from "./vue-i18n-Cze706-f.js";
24
- import { T as TypeToTriggerOptions, _ as _sfc_main$C, b as _sfc_main$D } from "./trigger-DVBjVPbN.js";
25
- import { D as DEFAULT_MESSAGE_VARIABLES, b as _sfc_main$q, g as getSmsMessageMetrics, _ as _sfc_main$r, a as _sfc_main$s } from "./MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js";
26
- import { useDialog } from "@feedmepos/ui-library";
27
- import { useCoreStore } from "@feedmepos/mf-common";
28
- import { c as campaignApi } from "./index-649OZ_e1.js";
29
- import { m as membershipApi } from "./index-BDPnyro2.js";
30
- import { u as useChannelFlag } from "./feature-flag-CD9V1V0h.js";
31
- import { m as moment } from "./index-BR9h5DTI.js";
32
- import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-COcdAnUu.js";
33
- import { C as CountryTimezone } from "./timezone-BP6UC4KL.js";
34
- import { _ as _sfc_main$u, a as _sfc_main$w } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js";
35
- import "./index-IZRfmmde.js";
36
- import { T as TEMPLATES } from "./index-BW6eb3n6.js";
37
- import "./index-D4d3l0gw.js";
38
- import "./index-B8yWVB8P.js";
39
- import { a as F_GAME_TYPE } from "./collectible.enum-MvqF7mSg.js";
40
- import { u as useLoading } from "./loading-BvHm1m3K.js";
41
- import { i as initCollectibleConfig } from "./helper-CEiv7SaO.js";
42
- import { C as CollectionUtils } from "./collection.fn-CR0bD33S.js";
43
- import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
44
- import { u as useCampaignStore } from "./campaign-BTllt2LH.js";
45
- import { a as cleanPF } from "./object-BYyQ0PZp.js";
46
- const publicClient = axios.create({ withCredentials: !1, timeout: 5e3 });
47
- async function getNativeApp(e) {
48
- z.string().length(24).parse(e);
49
- const o = await publicClient.get(
50
- `https://api.feedme.vip/metadata/${encodeURIComponent(e)}/native-app`
51
- );
52
- return z.object({
53
- businessId: z.literal(e),
54
- native: z.boolean(),
55
- platforms: z.array(z.string())
56
- }).parse(o.data).native;
57
- }
58
- function campaignRefinement(e, l) {
59
- var r, g;
60
- if (!e) return;
61
- const o = e.campaign;
62
- if (!o) return;
63
- const i = o.event.rule;
64
- if (!i || !isRuleGroup(i)) {
65
- l.addIssue({
66
- code: "custom",
67
- path: ["campaign", "event", "rule"],
68
- params: {
69
- i18n: "connectZodCustom:campaign.rule_required",
70
- type: o.event.type
71
- }
72
- });
73
- return;
74
- }
75
- switch (o.type) {
76
- case "MISSION": {
77
- o.earningOption.amount > o.mission.end && l.addIssue({
78
- code: "custom",
79
- path: ["campaign", "earningOption"],
80
- params: {
81
- i18n: "connectZodCustom:campaign.earning_amount_exceed",
82
- max: o.mission.end
83
- }
84
- });
85
- break;
86
- }
87
- case "CREDIT": {
88
- const a = (r = o.config) == null ? void 0 : r.validityOption;
89
- (!a || ["validForDay", "validBefore"].every((d) => a[d] == null)) && l.addIssue({
90
- code: "custom",
91
- path: ["campaign", "config", "validityOption"],
92
- params: {
93
- i18n: "connectZodCustom:campaign.credit_validity_required"
94
- }
95
- });
96
- }
97
- }
98
- switch (o.event.type) {
99
- case "BILL_COMPLETED":
100
- o.type === "MISSION" && o.rewards.length && (o.rewards.forEach((a, n) => {
101
- (a.threshold < 0 || a.threshold > o.mission.end) && l.addIssue({
102
- code: "custom",
103
- path: ["campaign", "rewards", n, "threshold"],
104
- params: {
105
- i18n: "connectZodCustom:campaign.reward_threshold_range"
106
- }
107
- });
108
- }), (g = o.config) != null && g.validityOption.followFirstReceive || l.addIssue({
109
- code: "custom",
110
- path: ["campaign", "config", "validityOption"],
111
- params: {
112
- i18n: "connectZodCustom:campaign.mission_first_receive"
113
- }
114
- }));
115
- break;
116
- case "SCHEDULE": {
117
- if (!i.rules.g_schedule) {
118
- l.addIssue({
119
- code: "custom",
120
- path: ["campaign", "event", "rule"],
121
- params: {
122
- i18n: "connectZodCustom:campaign.schedule_period_required"
123
- },
124
- fatal: !0
125
- });
126
- return;
127
- }
128
- const a = RuleBuilder.getRules(
129
- i.rules.g_schedule
130
- ), n = [
131
- {
132
- property: "trigger.date",
133
- operator: ["_isOnDate", "_rrule"]
134
- },
135
- {
136
- property: "trigger.time",
137
- operator: ["_isOnTime"]
138
- }
139
- ];
140
- n.length == a.length && n.every((s) => a.some((h) => {
141
- const p = RuleBuilder.simplify(h);
142
- return p.property === s.property && s.operator.includes(p.operator);
143
- })) || l.addIssue({
144
- code: "custom",
145
- path: ["campaign", "event", "rule"],
146
- params: {
147
- i18n: "connectZodCustom:campaign.active_period_invalid"
148
- }
149
- });
150
- break;
151
- }
152
- default: {
153
- "earningOption" in o && o.earningOption.type != "FIXED" && l.addIssue({
154
- code: "custom",
155
- path: ["campaign", "earningOption"],
156
- params: {
157
- i18n: "connectZodCustom:campaign.fixed_earning_required"
158
- }
159
- });
160
- break;
161
- }
162
- }
163
- }
164
- function campaignTransform(e) {
165
- var o;
166
- if (e.campaign.type === "VOUCHER" && "configs" in e) {
167
- const i = e.configs;
168
- i.extras.targetLocation = e.campaign.targetLocation;
169
- const r = Math.max(
170
- e.campaign.earningOption.amount,
171
- i.options.maxUse ?? 1
172
- );
173
- e.campaign.earningOption.amount = r, i.options.maxUse = r, e.campaign.earningOption = {
174
- type: "FIXED",
175
- amount: 1
176
- };
177
- }
178
- if (e.campaign.type == "MISSION" && "configs" in e) {
179
- const i = e.configs;
180
- i.options.validityOption = (o = e.campaign.config) == null ? void 0 : o.validityOption;
181
- }
182
- const l = e.campaign.event;
183
- return l.type != "BILL_COMPLETED" && l.rule && isRuleGroup(l.rule) && (l.rule = RuleBuilder.removeEntry(l.rule, "g_bill"), e.campaign.event = l), e;
184
- }
185
- function GenerateCampaignReq(e) {
186
- const l = FdtoRunnableCampaign.optionsMap.get(e).extend({
187
- _id: FdoObjectId.optional(),
188
- collectible: z$1.string().nullish()
189
- });
190
- switch (e) {
191
- case "VOUCHER":
192
- return z$1.object({
193
- campaign: l,
194
- templateId: FdoObjectId,
195
- configs: FdtoCollectibleConfig,
196
- updateCollections: z$1.boolean().optional(),
197
- code: z$1.string().optional()
198
- });
199
- case "PROMOTION":
200
- return z$1.object({
201
- campaign: l,
202
- templateId: FdoObjectId
203
- });
204
- case "POINT":
205
- return z$1.object({
206
- campaign: l,
207
- templateId: FdoObjectId
208
- });
209
- case "CREDIT":
210
- return z$1.object({
211
- campaign: l,
212
- templateId: FdoObjectId
213
- });
214
- case "BROADCAST":
215
- return z$1.object({
216
- campaign: l.refine((o) => !!o.delivery || !!o.message, {
217
- path: ["delivery"],
218
- message: "A broadcast requires a message or delivery configuration."
219
- }),
220
- templateId: FdoObjectId
221
- });
222
- case "COIN":
223
- return z$1.object({
224
- campaign: l,
225
- templateId: FdoObjectId
226
- });
227
- case "REWARD_POOL":
228
- return z$1.object({
229
- campaign: l,
230
- templateId: FdoObjectId,
231
- updateCollections: z$1.boolean().optional()
232
- });
233
- case "GAME":
234
- return z$1.object({
235
- campaign: l,
236
- configs: FdtoCollectibleConfig,
237
- templateId: FdoObjectId,
238
- updateCollections: z$1.boolean().optional()
239
- });
240
- case "MISSION":
241
- return z$1.object({
242
- campaign: l,
243
- configs: FdtoCollectibleConfig,
244
- templateId: FdoObjectId,
245
- updateCollections: z$1.boolean().optional()
246
- });
247
- default:
248
- throw new Error("Not implemented");
249
- }
250
- }
251
- FdoGroup.extend({
252
- _id: FdoObjectId.optional(),
253
- name: z$1.string().min(1).max(300),
254
- business: FdoObjectId.optional(),
255
- campaigns: z$1.array(FdoObjectId).optional()
256
- });
257
- const CampaignDtos = {
258
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.VOUCHER]: GenerateCampaignReq("VOUCHER"),
259
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.PROMOTION]: GenerateCampaignReq("PROMOTION"),
260
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.POINT]: GenerateCampaignReq("POINT"),
261
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.CREDIT]: GenerateCampaignReq("CREDIT"),
262
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.BROADCAST]: GenerateCampaignReq("BROADCAST"),
263
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.COIN]: GenerateCampaignReq("COIN"),
264
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.REWARD_POOL]: GenerateCampaignReq("REWARD_POOL"),
265
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.GAME]: GenerateCampaignReq("GAME"),
266
- [F_RUNNABLE_CAMPAIGN_TYPE.enum.MISSION]: GenerateCampaignReq("MISSION")
267
- }, _hoisted_1$m = { class: "space-y-24" }, _sfc_main$o = /* @__PURE__ */ defineComponent({
268
- __name: "TimeRuleGroup",
269
- props: {
270
- modelValue: {
271
- type: Object,
272
- default: () => {
273
- }
274
- }
275
- },
276
- emits: ["update:model-value"],
277
- setup(e, { emit: l }) {
278
- const { t: o } = useI18n(), i = e, r = l, g = ref(
279
- !i.modelValue || !i.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(i.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
280
- );
281
- watch(g, async (n, d) => {
282
- var s;
283
- if (d == "custom" && n == "all_time" && RuleBuilder.getRules((s = i.modelValue) == null ? void 0 : s.rules.g_time).length > 0) {
284
- const h = await prompt.confirm(
285
- o("connect.template.rule.time.confirm_remove"),
286
- o("connect.common.confirm"),
287
- o("connect.common.confirm"),
288
- o("connect.common.cancel")
289
- );
290
- h && r(
291
- "update:model-value",
292
- RuleBuilder.setRuleToGroup(
293
- i.modelValue ?? RuleBuilder.scaffoldGroup(),
294
- RuleBuilder.scaffoldGroup("g_time")
295
- )
296
- ), g.value = h ? n : d;
297
- }
298
- });
299
- async function a(n) {
300
- var d;
301
- if (n == "custom" && RuleBuilder.getRules((d = i.modelValue) == null ? void 0 : d.rules.g_time).length > 0) {
302
- if (!await prompt.confirm(
303
- o("connect.template.rule.time.confirm_remove"),
304
- o("connect.common.confirm"),
305
- o("connect.common.confirm"),
306
- o("connect.common.cancel")
307
- )) {
308
- g.value = "all_time";
309
- return;
310
- }
311
- r(
312
- "update:model-value",
313
- RuleBuilder.setRuleToGroup(
314
- i.modelValue ?? RuleBuilder.scaffoldGroup(),
315
- RuleBuilder.scaffoldGroup("g_time")
316
- )
317
- );
318
- }
319
- }
320
- return (n, d) => {
321
- var p;
322
- const s = resolveComponent("FmRadio"), h = resolveComponent("FmRadioGroup");
323
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
324
- createVNode(h, {
325
- modelValue: unref(g),
326
- "onUpdate:modelValue": [
327
- d[0] || (d[0] = (f) => isRef(g) ? g.value = f : null),
328
- d[1] || (d[1] = (f) => a(f))
329
- ]
330
- }, {
331
- default: withCtx(() => [
332
- createVNode(s, {
333
- label: unref(o)("connect.template.rule.time.all_time"),
334
- value: "all_time"
335
- }, null, 8, ["label"]),
336
- createVNode(s, {
337
- label: unref(o)("connect.template.rule.time.custom"),
338
- value: "custom"
339
- }, null, 8, ["label"])
340
- ]),
341
- _: 1
342
- }, 8, ["modelValue"]),
343
- unref(g) == "custom" ? (openBlock(), createBlock(_sfc_main$p, {
344
- key: 0,
345
- class: "!mt-[0px]",
346
- "include-only": "trigger",
347
- "trigger-type": "SCHEDULE",
348
- "model-value": ((p = e.modelValue) == null ? void 0 : p.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
349
- "onUpdate:modelValue": d[2] || (d[2] = (f) => r(
350
- "update:model-value",
351
- unref(RuleBuilder).setRuleToGroup(
352
- e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
353
- f,
354
- "&&"
355
- )
356
- ))
357
- }, null, 8, ["model-value"])) : createCommentVNode("", !0)
358
- ]);
359
- };
360
- }
361
- }), _sfc_main$n = /* @__PURE__ */ defineComponent({
362
- __name: "BirthdayInput",
363
- props: {
364
- modelValue: {
365
- type: Object
366
- }
367
- },
368
- emits: ["update:model-value"],
369
- setup(e, { emit: l }) {
370
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => {
371
- const { property: a, operator: n, equator: d } = RuleBuilder.simplify(
372
- i.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
373
- op: "before",
374
- x: 1
375
- })
376
- );
377
- return {
378
- property: a,
379
- operator: n,
380
- equator: d
381
- };
382
- });
383
- return (a, n) => {
384
- const d = resolveComponent("FmRadio"), s = resolveComponent("FmStepperField");
385
- return openBlock(), createElementBlock("div", null, [
386
- createVNode(d, {
387
- label: unref(o)("connect.template.rule.birthday.on_birthday"),
388
- value: "_isRange-day",
389
- "model-value": `${unref(g).operator}-${unref(g).equator.unit}`,
390
- "onUpdate:modelValue": n[0] || (n[0] = () => {
391
- r(
392
- "update:model-value",
393
- unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
394
- op: "this",
395
- unit: "day",
396
- ignoreYear: !0
397
- })
398
- );
399
- })
400
- }, null, 8, ["label", "model-value"]),
401
- createVNode(d, {
402
- label: unref(o)("connect.template.rule.birthday.days_before"),
403
- value: "_isDay",
404
- "model-value": unref(g).operator,
405
- "onUpdate:modelValue": n[1] || (n[1] = () => {
406
- r(
407
- "update:model-value",
408
- unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
409
- op: "after",
410
- x: 1,
411
- ignoreYear: !0
412
- })
413
- );
414
- })
415
- }, null, 8, ["label", "model-value"]),
416
- unref(g).operator == "_isDay" ? (openBlock(), createBlock(s, {
417
- key: 0,
418
- label: unref(o)("connect.template.rule.birthday.days_before_label"),
419
- "show-steppers": !1,
420
- "model-value": unref(g).equator.x,
421
- "onUpdate:modelValue": n[2] || (n[2] = (h) => r(
422
- "update:model-value",
423
- unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
424
- op: "after",
425
- x: h,
426
- ignoreYear: !0
427
- })
428
- ))
429
- }, null, 8, ["label", "model-value"])) : createCommentVNode("", !0),
430
- createVNode(d, {
431
- label: unref(o)("connect.template.rule.birthday.in_birthday_week"),
432
- value: "_isRange-week",
433
- "model-value": `${unref(g).operator}-${unref(g).equator.unit}`,
434
- "onUpdate:modelValue": n[3] || (n[3] = () => {
435
- r(
436
- "update:model-value",
437
- unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
438
- op: "this",
439
- unit: "week",
440
- ignoreYear: !0
441
- })
442
- );
443
- })
444
- }, null, 8, ["label", "model-value"]),
445
- createVNode(d, {
446
- label: unref(o)("connect.template.rule.birthday.in_birthday_month"),
447
- value: "_isRange-month",
448
- "model-value": `${unref(g).operator}-${unref(g).equator.unit}`,
449
- "onUpdate:modelValue": n[4] || (n[4] = () => {
450
- r(
451
- "update:model-value",
452
- unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
453
- op: "this",
454
- unit: "month",
455
- ignoreYear: !0
456
- })
457
- );
458
- })
459
- }, null, 8, ["label", "model-value"])
460
- ]);
461
- };
462
- }
463
- }), _hoisted_1$l = { class: "space-y-16" }, _hoisted_2$i = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$g = { class: "grid grid-cols-3 gap-16" }, _hoisted_4$f = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$c = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$m = /* @__PURE__ */ defineComponent({
464
- __name: "CampaignTriggerInput",
465
- props: {
466
- campaignType: {
467
- type: String,
468
- required: !0
469
- },
470
- modelValue: {
471
- type: String
472
- },
473
- disabled: {
474
- type: Boolean,
475
- default: !1
476
- }
477
- },
478
- emits: ["update:model-value"],
479
- setup(e, { emit: l }) {
480
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => i.disabled ? TypeToTriggerOptions[i.campaignType].filter(
481
- (a) => a.value == i.modelValue
482
- ) : TypeToTriggerOptions[i.campaignType]);
483
- return (a, n) => {
484
- const d = resolveComponent("FmCard");
485
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
486
- createElementVNode("div", _hoisted_2$i, toDisplayString(unref(o)("connect.campaign.trigger.description")), 1),
487
- createElementVNode("div", _hoisted_3$g, [
488
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (s) => (openBlock(), createBlock(d, {
489
- variant: "outlined",
490
- disabled: i.disabled,
491
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
492
- "col-span-3": unref(g).length == 1,
493
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
494
- "hover:bg-fm-color-opacity-sm": e.modelValue != s.value
495
- }]),
496
- onClick: () => {
497
- i.modelValue != s.value && !i.disabled && r("update:model-value", s.value);
498
- },
499
- key: s.name
500
- }, {
501
- default: withCtx(() => [
502
- createElementVNode("div", _hoisted_4$f, toDisplayString(s.name), 1),
503
- createElementVNode("div", _hoisted_5$c, toDisplayString(s.description), 1)
504
- ]),
505
- _: 2
506
- }, 1032, ["disabled", "class", "onClick"]))), 128))
507
- ])
508
- ]);
509
- };
510
- }
511
- }), _sfc_main$l = /* @__PURE__ */ defineComponent({
512
- __name: "DateInput",
513
- props: {
514
- label: {
515
- type: String,
516
- required: !1
517
- },
518
- modelValue: {
519
- type: Object,
520
- required: !1
521
- }
522
- },
523
- emits: ["update:model-value"],
524
- setup(e, { emit: l }) {
525
- const o = l;
526
- return (i, r) => {
527
- const g = resolveComponent("FmButton"), a = resolveComponent("FmField"), n = resolveComponent("FmDatePicker");
528
- return openBlock(), createBlock(n, {
529
- label: e.label,
530
- "model-value": e.modelValue || "",
531
- "onUpdate:modelValue": r[1] || (r[1] = (d) => o("update:model-value", d))
532
- }, {
533
- "trigger-button": withCtx(({ opened: d }) => [
534
- createVNode(a, {
535
- class: "flex items-center",
536
- "prepend-icon": "calendar_month",
537
- "icon-outlined": !d
538
- }, {
539
- append: withCtx(() => [
540
- e.modelValue ? (openBlock(), createBlock(g, {
541
- key: 0,
542
- variant: "tertiary",
543
- icon: "clear",
544
- onClick: r[0] || (r[0] = (s) => (s.stopPropagation(), o("update:model-value", null)))
545
- })) : createCommentVNode("", !0)
546
- ]),
547
- default: withCtx(() => [
548
- createElementVNode("div", {
549
- class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
550
- }, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
551
- ]),
552
- _: 1
553
- }, 8, ["icon-outlined"])
554
- ]),
555
- _: 1
556
- }, 8, ["label", "model-value"]);
557
- };
558
- }
559
- }), _hoisted_1$k = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$h = { class: "flex-1 xs:w-full" }, _hoisted_3$f = { class: "mt-5 xs:hidden" }, _hoisted_4$e = { class: "flex-1 xs:w-full" }, _sfc_main$k = /* @__PURE__ */ defineComponent({
560
- __name: "DateRangeInput",
561
- props: {
562
- modelValue: {
563
- type: Object,
564
- required: !1
565
- }
566
- },
567
- emits: ["update:model-value"],
568
- setup(e, { emit: l }) {
569
- const { t: o } = useI18n(), i = l;
570
- return (r, g) => {
571
- var a, n;
572
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
573
- createElementVNode("div", _hoisted_2$h, [
574
- createVNode(_sfc_main$l, {
575
- "model-value": ((a = e.modelValue) == null ? void 0 : a.startDate) ?? null,
576
- label: unref(o)("connect.common.startDate"),
577
- "onUpdate:modelValue": g[0] || (g[0] = (d) => {
578
- var s;
579
- return i("update:model-value", {
580
- startDate: d,
581
- endDate: ((s = e.modelValue) == null ? void 0 : s.endDate) ?? null
582
- });
583
- })
584
- }, null, 8, ["model-value", "label"])
585
- ]),
586
- createElementVNode("div", _hoisted_3$f, toDisplayString(unref(o)("connect.common.to")), 1),
587
- createElementVNode("div", _hoisted_4$e, [
588
- createVNode(_sfc_main$l, {
589
- "model-value": ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null,
590
- label: unref(o)("connect.common.endDate"),
591
- "onUpdate:modelValue": g[1] || (g[1] = (d) => {
592
- var s;
593
- return i("update:model-value", {
594
- startDate: ((s = e.modelValue) == null ? void 0 : s.startDate) ?? null,
595
- endDate: d
596
- });
597
- })
598
- }, null, 8, ["model-value", "label"])
599
- ])
600
- ]);
601
- };
602
- }
603
- }), _hoisted_1$j = { class: "flex flex-col gap-16" }, _hoisted_2$g = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$e = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$d = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$b = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$8 = { class: "flex items-center justify-between gap-8" }, _hoisted_7$7 = { class: "fm-typo-en-body-lg-400" }, _hoisted_8$7 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_9$7 = { class: "flex flex-col gap-8" }, _hoisted_10$6 = { class: "flex items-baseline justify-between" }, _hoisted_11$4 = { class: "fm-typo-en-body-lg-400" }, _hoisted_12$3 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_13$3 = { class: "min-w-[160px] flex-1" }, _hoisted_14$3 = { class: "min-w-[180px] flex-1" }, TITLE_LIMIT$1 = 40, PREVIEW_LIMIT = 120, MAX_BUTTONS = 2, TITLE_WARN_AT$1 = 34, PREVIEW_WARN_AT = 110, _sfc_main$j = /* @__PURE__ */ defineComponent({
604
- __name: "AppInboxInput",
605
- props: {
606
- modelValue: {
607
- type: Object,
608
- required: !0
609
- },
610
- variables: {
611
- type: Array,
612
- default: () => [...DEFAULT_MESSAGE_VARIABLES]
613
- },
614
- /** False until the form is submitted; broadcasts validate on submit. */
615
- showValidation: {
616
- type: Boolean,
617
- default: !0
618
- }
619
- },
620
- emits: ["update:model-value"],
621
- setup(e, { emit: l }) {
622
- const { t: o } = useI18n(), i = e, r = l;
623
- function g(k) {
624
- r("update:model-value", { ...i.modelValue, ...k });
625
- }
626
- function a(k, v) {
627
- return k >= v ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
628
- }
629
- const n = computed(() => i.modelValue.buttons ?? []), d = computed(() => {
630
- var k;
631
- return ((k = i.modelValue.content) == null ? void 0 : k.length) ?? 0;
632
- });
633
- function s(k, v) {
634
- g({
635
- buttons: n.value.map(
636
- (u, c) => c === k ? { ...u, ...v } : u
637
- )
638
- });
639
- }
640
- function h() {
641
- n.value.length >= MAX_BUTTONS || g({ buttons: [...n.value, { label: "", url: "" }] });
642
- }
643
- function p(k) {
644
- var c;
645
- if (!i.showValidation) return { label: void 0, url: void 0 };
646
- const v = (c = k.url) == null ? void 0 : c.trim();
647
- let u;
648
- return v ? FdoBroadcastUrl.safeParse(v).success || (u = o("connect.campaign.push.linkUrlInvalid")) : u = o("connect.campaign.appInbox.buttonUrlRequired"), {
649
- label: k.label.trim() ? void 0 : o("connect.campaign.appInbox.buttonLabelRequired"),
650
- url: u
651
- };
652
- }
653
- function f(k) {
654
- g({ buttons: n.value.filter((v, u) => u !== k) });
655
- }
656
- return (k, v) => {
657
- const u = resolveComponent("FmTextField"), c = resolveComponent("FmButton");
658
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
659
- createElementVNode("div", null, [
660
- createElementVNode("div", _hoisted_2$g, [
661
- createElementVNode("span", _hoisted_3$e, toDisplayString(unref(o)("connect.campaign.appInbox.title")), 1),
662
- createElementVNode("span", {
663
- class: normalizeClass(["fm-typo-en-body-sm-400", a(e.modelValue.title.length, TITLE_WARN_AT$1)])
664
- }, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT$1), 3)
665
- ]),
666
- createVNode(u, {
667
- "model-value": e.modelValue.title,
668
- "max-length": TITLE_LIMIT$1,
669
- placeholder: unref(o)("connect.campaign.appInbox.titlePlaceholder"),
670
- "onUpdate:modelValue": v[0] || (v[0] = (m) => g({ title: m }))
671
- }, null, 8, ["model-value", "placeholder"])
672
- ]),
673
- createElementVNode("div", null, [
674
- createElementVNode("div", _hoisted_4$d, [
675
- createElementVNode("span", _hoisted_5$b, toDisplayString(unref(o)("connect.campaign.appInbox.previewText")), 1),
676
- createElementVNode("span", {
677
- class: normalizeClass(["fm-typo-en-body-sm-400", a(e.modelValue.previewText.length, PREVIEW_WARN_AT)])
678
- }, toDisplayString(e.modelValue.previewText.length) + " / " + toDisplayString(PREVIEW_LIMIT), 3)
679
- ]),
680
- createVNode(u, {
681
- "model-value": e.modelValue.previewText,
682
- "max-length": PREVIEW_LIMIT,
683
- placeholder: unref(o)("connect.campaign.appInbox.previewTextPlaceholder"),
684
- "onUpdate:modelValue": v[1] || (v[1] = (m) => g({ previewText: m }))
685
- }, null, 8, ["model-value", "placeholder"])
686
- ]),
687
- createElementVNode("div", _hoisted_6$8, [
688
- createElementVNode("div", null, [
689
- createElementVNode("div", _hoisted_7$7, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessage")), 1),
690
- createElementVNode("div", _hoisted_8$7, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessageDescription")), 1),
691
- createElementVNode("div", {
692
- class: normalizeClass([
693
- "mt-[2px] fm-typo-en-body-sm-400",
694
- unref(d) > unref(APP_INBOX_BODY_LIMIT) ? "text-fm-color-system-error-400" : "text-fm-color-typo-secondary"
695
- ])
696
- }, toDisplayString(unref(d)) + " / " + toDisplayString(unref(APP_INBOX_BODY_LIMIT)), 3)
697
- ]),
698
- createVNode(_sfc_main$q, {
699
- html: e.modelValue.content,
700
- variables: e.variables,
701
- "media-limit": 1,
702
- "button-label": unref(o)("connect.campaign.appInbox.editBodyMessage"),
703
- "onUpdate:html": v[2] || (v[2] = (m) => g({ content: m.html }))
704
- }, null, 8, ["html", "variables", "button-label"])
705
- ]),
706
- createElementVNode("div", _hoisted_9$7, [
707
- createElementVNode("div", _hoisted_10$6, [
708
- createElementVNode("span", _hoisted_11$4, toDisplayString(unref(o)("connect.campaign.appInbox.buttons")), 1),
709
- createElementVNode("span", _hoisted_12$3, toDisplayString(unref(n).length) + " / " + toDisplayString(MAX_BUTTONS), 1)
710
- ]),
711
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (m, b) => (openBlock(), createElementBlock("div", {
712
- key: b,
713
- class: "flex flex-wrap items-start gap-8"
714
- }, [
715
- createElementVNode("div", _hoisted_13$3, [
716
- createVNode(u, {
717
- "model-value": m.label,
718
- "max-length": 20,
719
- placeholder: unref(o)("connect.campaign.appInbox.buttonLabel"),
720
- "helper-state": p(m).label ? "error" : "none",
721
- "helper-text": p(m).label,
722
- "onUpdate:modelValue": (E) => s(b, { label: E })
723
- }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
724
- ]),
725
- createElementVNode("div", _hoisted_14$3, [
726
- createVNode(u, {
727
- "model-value": m.url ?? "",
728
- inputmode: "url",
729
- placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
730
- "helper-state": p(m).url ? "error" : "none",
731
- "helper-text": p(m).url,
732
- "onUpdate:modelValue": (E) => s(b, { url: E.trim() })
733
- }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
734
- ]),
735
- createVNode(c, {
736
- icon: "delete",
737
- "icon-color": "neutral-gray-400",
738
- variant: "tertiary",
739
- onClick: (E) => f(b)
740
- }, null, 8, ["onClick"])
741
- ]))), 128)),
742
- unref(n).length < MAX_BUTTONS ? (openBlock(), createBlock(c, {
743
- key: 0,
744
- variant: "tertiary",
745
- icon: "add",
746
- label: unref(o)("connect.campaign.appInbox.addButton"),
747
- onClick: h
748
- }, null, 8, ["label"])) : createCommentVNode("", !0)
749
- ])
750
- ]);
751
- };
752
- }
753
- }), _hoisted_1$i = { class: "flex flex-col gap-16" }, _hoisted_2$f = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$d = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$c = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$a = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$7 = { class: "mb-[6px] fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_7$6 = {
754
- key: 0,
755
- class: "mt-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
756
- }, _hoisted_8$6 = {
757
- key: 1,
758
- class: "mt-12"
759
- }, _hoisted_9$6 = { class: "mb-[6px] fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, TITLE_LIMIT = 40, BODY_LIMIT = 120, TITLE_WARN_AT = 34, BODY_WARN_AT = 110, _sfc_main$i = /* @__PURE__ */ defineComponent({
760
- __name: "PushInput",
761
- props: {
762
- modelValue: {
763
- type: Object,
764
- required: !0
765
- },
766
- /** False until the form is submitted; broadcasts validate on submit. */
767
- showValidation: {
768
- type: Boolean,
769
- default: !0
770
- }
771
- },
772
- emits: ["update:model-value"],
773
- setup(e, { emit: l }) {
774
- const { t: o } = useI18n(), i = e, r = l, g = F_PUSH_DESTINATION.options, a = computed(() => i.modelValue.destination === "EXTERNAL"), n = computed(() => {
775
- var f;
776
- if (!i.showValidation || !a.value) return;
777
- const p = (f = i.modelValue.url) == null ? void 0 : f.trim();
778
- return p ? FdoBroadcastUrl.safeParse(p).success ? void 0 : o("connect.campaign.push.linkUrlInvalid") : o("connect.campaign.push.linkUrlRequired");
779
- });
780
- function d(p) {
781
- r("update:model-value", { ...i.modelValue, ...p });
782
- }
783
- function s(p) {
784
- d(p === "EXTERNAL" ? { destination: p } : { destination: p, url: null });
785
- }
786
- function h(p, f) {
787
- return p >= f ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
788
- }
789
- return (p, f) => {
790
- const k = resolveComponent("FmTextField"), v = resolveComponent("FmTextarea"), u = resolveComponent("FmSelect");
791
- return openBlock(), createElementBlock("div", _hoisted_1$i, [
792
- createElementVNode("div", null, [
793
- createElementVNode("div", _hoisted_2$f, [
794
- createElementVNode("span", _hoisted_3$d, toDisplayString(unref(o)("connect.campaign.push.title")), 1),
795
- createElementVNode("span", {
796
- class: normalizeClass(["fm-typo-en-body-sm-400", h(e.modelValue.title.length, TITLE_WARN_AT)])
797
- }, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT), 3)
798
- ]),
799
- createVNode(k, {
800
- "model-value": e.modelValue.title,
801
- "max-length": TITLE_LIMIT,
802
- placeholder: unref(o)("connect.campaign.push.titlePlaceholder"),
803
- "onUpdate:modelValue": f[0] || (f[0] = (c) => d({ title: c }))
804
- }, null, 8, ["model-value", "placeholder"])
805
- ]),
806
- createElementVNode("div", null, [
807
- createElementVNode("div", _hoisted_4$c, [
808
- createElementVNode("span", _hoisted_5$a, toDisplayString(unref(o)("connect.campaign.push.body")), 1),
809
- createElementVNode("span", {
810
- class: normalizeClass(["fm-typo-en-body-sm-400", h(e.modelValue.body.length, BODY_WARN_AT)])
811
- }, toDisplayString(e.modelValue.body.length) + " / " + toDisplayString(BODY_LIMIT), 3)
812
- ]),
813
- createVNode(v, {
814
- "model-value": e.modelValue.body,
815
- "max-length": BODY_LIMIT,
816
- placeholder: unref(o)("connect.campaign.push.bodyPlaceholder"),
817
- "onUpdate:modelValue": f[1] || (f[1] = (c) => d({ body: c }))
818
- }, null, 8, ["model-value", "placeholder"])
819
- ]),
820
- createElementVNode("div", null, [
821
- createElementVNode("div", _hoisted_6$7, toDisplayString(unref(o)("connect.campaign.push.link")), 1),
822
- createVNode(u, {
823
- "model-value": e.modelValue.destination ?? "NONE",
824
- items: unref(g).map((c) => ({
825
- label: unref(o)(`connect.campaign.appInbox.destination.${c}`),
826
- value: c
827
- })),
828
- "onUpdate:modelValue": f[2] || (f[2] = (c) => s(c))
829
- }, null, 8, ["model-value", "items"]),
830
- unref(a) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_7$6, toDisplayString(unref(o)("connect.campaign.push.linkHelper")), 1)),
831
- unref(a) ? (openBlock(), createElementBlock("div", _hoisted_8$6, [
832
- createElementVNode("div", _hoisted_9$6, toDisplayString(unref(o)("connect.campaign.push.linkUrl")), 1),
833
- createVNode(k, {
834
- "model-value": e.modelValue.url ?? "",
835
- inputmode: "url",
836
- placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
837
- "helper-state": unref(n) ? "error" : "none",
838
- "helper-text": unref(n),
839
- "onUpdate:modelValue": f[3] || (f[3] = (c) => d({ url: c.trim() || null }))
840
- }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text"])
841
- ])) : createCommentVNode("", !0)
842
- ])
843
- ]);
844
- };
845
- }
846
- }), _hoisted_1$h = { class: "flex items-stretch overflow-x-auto pb-4" }, _hoisted_2$e = {
847
- key: 0,
848
- class: "flex flex-none items-center px-8 fm-typo-en-body-lg-600 text-fm-color-neutral-gray-300",
849
- "aria-hidden": "true"
850
- }, _hoisted_3$c = ["aria-current", "onClick"], _hoisted_4$b = { class: "flex items-center gap-[6px]" }, _hoisted_5$9 = ["title"], _hoisted_6$6 = { class: "mt-[3px] block text-[11px] leading-[1.3] text-fm-color-typo-secondary" }, _sfc_main$h = /* @__PURE__ */ defineComponent({
851
- __name: "ChannelContentTabs",
852
- props: {
853
- tabs: {},
854
- modelValue: {}
855
- },
856
- emits: ["update:model-value"],
857
- setup(e) {
858
- const { t: l } = useI18n();
859
- return (o, i) => (openBlock(), createElementBlock("div", _hoisted_1$h, [
860
- (openBlock(!0), createElementBlock(Fragment, null, renderList(e.tabs, (r) => (openBlock(), createElementBlock("div", {
861
- key: r.key,
862
- class: "flex flex-none items-center"
863
- }, [
864
- r.connector ? (openBlock(), createElementBlock("span", _hoisted_2$e, toDisplayString(r.connector), 1)) : createCommentVNode("", !0),
865
- createElementVNode("button", {
866
- type: "button",
867
- class: normalizeClass([
868
- "min-w-[132px] flex-none rounded-[10px] border px-[14px] py-[10px] text-left transition-colors",
869
- e.modelValue === r.key ? "border-fm-color-primary bg-fm-color-system-warning-100" : "border-fm-color-neutral-gray-100 bg-fm-color-neutral-white hover:border-fm-color-neutral-gray-200"
870
- ]),
871
- "aria-current": e.modelValue === r.key ? "true" : void 0,
872
- onClick: (g) => o.$emit("update:model-value", r.key)
873
- }, [
874
- createElementVNode("span", _hoisted_4$b, [
875
- r.step ? (openBlock(), createElementBlock("span", {
876
- key: 0,
877
- class: normalizeClass([
878
- "flex h-[18px] w-[18px] flex-none items-center justify-center rounded-full text-[10.5px] font-semibold leading-[18px]",
879
- e.modelValue === r.key ? "bg-fm-color-primary text-fm-color-typo-white" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
880
- ])
881
- }, toDisplayString(r.step), 3)) : createCommentVNode("", !0),
882
- createElementVNode("span", {
883
- class: normalizeClass([
884
- "truncate text-[12.5px] font-semibold leading-[1.3]",
885
- e.modelValue === r.key ? "text-fm-color-primary" : "text-fm-color-typo-primary"
886
- ])
887
- }, toDisplayString(r.label), 3),
888
- r.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", {
889
- key: 1,
890
- class: "h-[7px] w-[7px] flex-none rounded-full bg-fm-color-system-error-400",
891
- title: unref(l)("connect.campaign.broadcast.messageMissing")
892
- }, null, 8, _hoisted_5$9))
893
- ]),
894
- createElementVNode("span", _hoisted_6$6, toDisplayString(r.sub), 1)
895
- ], 10, _hoisted_3$c)
896
- ]))), 128))
897
- ]));
898
- }
899
- }), _hoisted_1$g = {
900
- key: 0,
901
- class: "flex w-[264px] shrink-0 flex-col gap-8"
902
- }, _hoisted_2$d = { class: "fm-typo-en-body-md-600" }, _hoisted_3$b = { class: "flex justify-center py-8" }, _hoisted_4$a = {
903
- key: 0,
904
- class: "px-12 pb-16 pt-16"
905
- }, _hoisted_5$8 = { class: "mb-12 text-center text-[11px] text-[rgba(255,255,255,0.6)]" }, _hoisted_6$5 = { class: "rounded-[14px] border border-[rgba(255,255,255,0.12)] bg-[rgba(255,255,255,0.14)] p-12 backdrop-blur" }, _hoisted_7$5 = { class: "fm-typo-en-body-md-600 text-fm-color-typo-white line-clamp-2" }, _hoisted_8$5 = { class: "mt-[2px] fm-typo-en-body-sm-400 text-[rgba(255,255,255,0.72)] line-clamp-3" }, _hoisted_9$5 = {
906
- key: 1,
907
- class: "px-12 pb-16"
908
- }, _hoisted_10$5 = { class: "fm-typo-en-body-md-600 mb-8" }, _hoisted_11$3 = { class: "rounded-[12px] border border-fm-color-neutral-gray-100 p-12" }, _hoisted_12$2 = { class: "fm-typo-en-body-md-600 line-clamp-2" }, _hoisted_13$2 = { class: "mt-[2px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary line-clamp-3" }, _hoisted_14$2 = ["src"], _hoisted_15$2 = ["srcdoc", "title"], _hoisted_16$1 = {
909
- key: 2,
910
- class: "mt-12 flex flex-col gap-[6px]"
911
- }, _hoisted_17$1 = {
912
- key: 2,
913
- class: "px-12 pb-16"
914
- }, _hoisted_18$1 = { class: "fm-typo-en-body-md-600 mb-8" }, _hoisted_19$1 = { class: "whitespace-pre-wrap break-words rounded-[12px] bg-fm-color-neutral-gray-100 p-12 fm-typo-en-body-sm-400" }, _hoisted_20$1 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
915
- __name: "ChannelPreview",
916
- props: {
917
- target: {},
918
- content: {},
919
- senderPrefix: {}
920
- },
921
- setup(e) {
922
- const { t: l } = useI18n(), o = e, i = computed(
923
- () => o.target === "PUSH" ? o.content : void 0
924
- ), r = computed(
925
- () => o.target === "APP_INBOX" ? o.content : void 0
926
- ), g = computed(
927
- () => o.target === "SMS" || o.target === "WHATSAPP" ? o.content : void 0
928
- ), a = computed(() => {
929
- var p, f;
930
- const h = (f = (p = g.value) == null ? void 0 : p.content) == null ? void 0 : f.trim();
931
- return h ? o.senderPrefix ? `${o.senderPrefix}${h}` : h : l("connect.campaign.broadcast.preview.emptyText");
932
- }), n = computed(() => {
933
- var p;
934
- const h = ((p = r.value) == null ? void 0 : p.content) ?? "";
935
- return h.trim() ? `<!doctype html><meta charset="utf-8"><base target="_blank"><style>
936
- html,body{margin:0;font:400 12px/1.5 Inter,system-ui,sans-serif;color:#1C1C1E;word-break:break-word}
937
- img{max-width:100%;height:auto}
938
- </style>${h}` : "";
939
- }), d = computed(() => {
940
- const h = /* @__PURE__ */ new Date(), p = h.toLocaleDateString(void 0, {
941
- weekday: "short",
942
- day: "2-digit",
943
- month: "short"
944
- }), f = h.toLocaleTimeString(void 0, {
945
- hour: "2-digit",
946
- minute: "2-digit"
947
- });
948
- return `${p} · ${f}`;
949
- }), s = computed(() => o.target === "PUSH" ? l("connect.campaign.broadcast.preview.note.push") : o.target === "APP_INBOX" ? l("connect.campaign.broadcast.preview.note.inbox") : l("connect.campaign.broadcast.preview.note.text"));
950
- return (h, p) => {
951
- var f, k, v, u, c, m, b, E, V, S, N;
952
- return e.target !== "EMAIL" ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
953
- createElementVNode("div", _hoisted_2$d, toDisplayString(unref(l)("connect.campaign.broadcast.preview.title")), 1),
954
- createElementVNode("div", {
955
- class: normalizeClass([
956
- "overflow-hidden rounded-[22px] border border-fm-color-neutral-gray-100",
957
- e.target === "PUSH" ? "bg-fm-color-neutral-black" : "bg-fm-color-neutral-white"
958
- ])
959
- }, [
960
- createElementVNode("div", _hoisted_3$b, [
961
- createElementVNode("div", {
962
- class: normalizeClass([
963
- "h-4 w-40 rounded-full",
964
- e.target === "PUSH" ? "bg-fm-color-neutral-gray-400" : "bg-fm-color-neutral-gray-100"
965
- ])
966
- }, null, 2)
967
- ]),
968
- e.target === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_4$a, [
969
- createElementVNode("div", _hoisted_5$8, toDisplayString(unref(d)), 1),
970
- createElementVNode("div", _hoisted_6$5, [
971
- createElementVNode("div", _hoisted_7$5, toDisplayString(((k = (f = unref(i)) == null ? void 0 : f.title) == null ? void 0 : k.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyTitle")), 1),
972
- createElementVNode("div", _hoisted_8$5, toDisplayString(((u = (v = unref(i)) == null ? void 0 : v.body) == null ? void 0 : u.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyBody")), 1)
973
- ])
974
- ])) : e.target === "APP_INBOX" ? (openBlock(), createElementBlock("div", _hoisted_9$5, [
975
- createElementVNode("div", _hoisted_10$5, toDisplayString(unref(l)("connect.campaign.broadcast.preview.inboxHeading")), 1),
976
- createElementVNode("div", _hoisted_11$3, [
977
- createElementVNode("div", _hoisted_12$2, toDisplayString(((m = (c = unref(r)) == null ? void 0 : c.title) == null ? void 0 : m.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyTitle")), 1),
978
- createElementVNode("div", _hoisted_13$2, toDisplayString(((E = (b = unref(r)) == null ? void 0 : b.previewText) == null ? void 0 : E.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyBody")), 1),
979
- (V = unref(r)) != null && V.imageUrl ? (openBlock(), createElementBlock("img", {
980
- key: 0,
981
- src: unref(r).imageUrl,
982
- alt: "",
983
- class: "mt-8 w-full rounded-[8px]"
984
- }, null, 8, _hoisted_14$2)) : createCommentVNode("", !0),
985
- unref(n) ? (openBlock(), createElementBlock("iframe", {
986
- key: 1,
987
- srcdoc: unref(n),
988
- sandbox: "",
989
- referrerpolicy: "no-referrer",
990
- class: "mt-8 h-[120px] w-full border-0",
991
- title: unref(l)("connect.campaign.broadcast.preview.bodyFrameTitle")
992
- }, null, 8, _hoisted_15$2)) : createCommentVNode("", !0),
993
- (N = (S = unref(r)) == null ? void 0 : S.buttons) != null && N.length ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
994
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(r).buttons, (C, T) => (openBlock(), createElementBlock("div", {
995
- key: T,
996
- class: "rounded-[8px] bg-fm-color-primary px-12 py-8 text-center fm-typo-en-body-sm-400 text-fm-color-typo-white"
997
- }, toDisplayString(C.label || unref(l)("connect.campaign.appInbox.buttonLabel")), 1))), 128))
998
- ])) : createCommentVNode("", !0)
999
- ])
1000
- ])) : (openBlock(), createElementBlock("div", _hoisted_17$1, [
1001
- createElementVNode("div", _hoisted_18$1, toDisplayString(unref(l)(`connect.campaign.broadcast.channel.${e.target}`)), 1),
1002
- createElementVNode("div", _hoisted_19$1, toDisplayString(unref(a)), 1)
1003
- ]))
1004
- ], 2),
1005
- createElementVNode("div", _hoisted_20$1, toDisplayString(unref(s)), 1)
1006
- ])) : createCommentVNode("", !0);
1007
- };
1008
- }
1009
- }), _hoisted_1$f = { class: "flex flex-col gap-12 pt-8" }, _hoisted_2$c = { class: "flex flex-wrap items-baseline justify-between gap-16" }, _hoisted_3$a = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$9 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_5$7 = { class: "h-24 w-24 flex-none rounded-full bg-fm-color-neutral-gray-100 text-center fm-typo-en-body-sm-400 leading-[24px]" }, _hoisted_6$4 = { class: "min-w-0 flex-1" }, _hoisted_7$4 = { class: "flex flex-wrap items-center gap-[10px]" }, _hoisted_8$4 = { class: "fm-typo-en-body-md-600" }, _hoisted_9$4 = {
1010
- key: 0,
1011
- class: "inline-flex items-center gap-[5px] fm-typo-en-body-sm-400 text-fm-color-system-error-400"
1012
- }, _hoisted_10$4 = { class: "ml-auto flex flex-none items-center gap-[2px] border-l border-fm-color-neutral-gray-100 pl-4" }, _hoisted_11$2 = ["title"], _hoisted_12$1 = ["title"], _hoisted_13$1 = ["title"], _hoisted_14$1 = {
1013
- type: "button",
1014
- class: "w-full rounded-[8px] border-2 border-dashed border-fm-color-neutral-gray-200 p-[20px] fm-typo-en-body-lg-600 text-fm-color-typo-secondary transition-colors hover:border-fm-color-primary hover:text-fm-color-primary"
1015
- }, _hoisted_15$1 = {
1016
- key: 1,
1017
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1018
- }, _sfc_main$f = /* @__PURE__ */ defineComponent({
1019
- __name: "FallbackChannelList",
1020
- props: {
1021
- rows: {},
1022
- addable: {}
1023
- },
1024
- emits: ["move", "remove", "add"],
1025
- setup(e) {
1026
- const { t: l } = useI18n(), o = e, i = computed(() => o.addable.length > 0);
1027
- return (r, g) => {
1028
- const a = resolveComponent("FmButton"), n = resolveComponent("FmMenuItem"), d = resolveComponent("FmMenu");
1029
- return openBlock(), createElementBlock("div", _hoisted_1$f, [
1030
- createElementVNode("div", _hoisted_2$c, [
1031
- createElementVNode("span", _hoisted_3$a, toDisplayString(unref(l)("connect.campaign.broadcast.fallbackChannels")), 1),
1032
- createElementVNode("span", _hoisted_4$9, toDisplayString(unref(l)("connect.campaign.broadcast.fallbackChannelsHint")), 1)
1033
- ]),
1034
- (openBlock(!0), createElementBlock(Fragment, null, renderList(e.rows, (s, h) => (openBlock(), createElementBlock("div", {
1035
- key: s.channel,
1036
- class: "flex flex-wrap items-center gap-12 rounded-[8px] border border-fm-color-neutral-gray-100 px-16 py-[14px]"
1037
- }, [
1038
- createElementVNode("span", _hoisted_5$7, toDisplayString(s.position), 1),
1039
- createElementVNode("span", _hoisted_6$4, [
1040
- createElementVNode("span", _hoisted_7$4, [
1041
- createElementVNode("span", _hoisted_8$4, toDisplayString(s.label), 1),
1042
- s.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", _hoisted_9$4, [
1043
- g[0] || (g[0] = createElementVNode("span", { class: "h-[6px] w-[6px] rounded-full bg-fm-color-system-error-400" }, null, -1)),
1044
- createTextVNode(" " + toDisplayString(unref(l)("connect.campaign.broadcast.messageMissing")), 1)
1045
- ]))
1046
- ])
1047
- ]),
1048
- createElementVNode("span", _hoisted_10$4, [
1049
- createElementVNode("span", {
1050
- title: unref(l)("connect.campaign.broadcast.moveUp"),
1051
- class: "flex"
1052
- }, [
1053
- createVNode(a, {
1054
- icon: "arrow_upward",
1055
- "icon-color": "neutral-gray-400",
1056
- variant: "tertiary",
1057
- disabled: h === 0,
1058
- onClick: (p) => r.$emit("move", s.channel, -1)
1059
- }, null, 8, ["disabled", "onClick"])
1060
- ], 8, _hoisted_11$2),
1061
- createElementVNode("span", {
1062
- title: unref(l)("connect.campaign.broadcast.moveDown"),
1063
- class: "flex"
1064
- }, [
1065
- createVNode(a, {
1066
- icon: "arrow_downward",
1067
- "icon-color": "neutral-gray-400",
1068
- variant: "tertiary",
1069
- disabled: h === e.rows.length - 1,
1070
- onClick: (p) => r.$emit("move", s.channel, 1)
1071
- }, null, 8, ["disabled", "onClick"])
1072
- ], 8, _hoisted_12$1),
1073
- createElementVNode("span", {
1074
- title: unref(l)("connect.campaign.broadcast.removeChannel"),
1075
- class: "flex"
1076
- }, [
1077
- createVNode(a, {
1078
- icon: "delete",
1079
- "icon-color": "neutral-gray-400",
1080
- variant: "tertiary",
1081
- onClick: (p) => r.$emit("remove", s.channel)
1082
- }, null, 8, ["onClick"])
1083
- ], 8, _hoisted_13$1)
1084
- ])
1085
- ]))), 128)),
1086
- unref(i) ? (openBlock(), createBlock(d, {
1087
- key: 0,
1088
- placement: "bottom-start"
1089
- }, {
1090
- "menu-button": withCtx(() => [
1091
- createElementVNode("button", _hoisted_14$1, " + " + toDisplayString(unref(l)("connect.campaign.broadcast.addFallbackChannel")), 1)
1092
- ]),
1093
- default: withCtx(() => [
1094
- (openBlock(!0), createElementBlock(Fragment, null, renderList(e.addable, (s) => (openBlock(), createBlock(n, {
1095
- key: s.channel,
1096
- label: s.label,
1097
- onClick: (h) => r.$emit("add", s.channel)
1098
- }, null, 8, ["label", "onClick"]))), 128))
1099
- ]),
1100
- _: 1
1101
- })) : (openBlock(), createElementBlock("div", _hoisted_15$1, toDisplayString(unref(l)("connect.campaign.broadcast.allChannelsAdded")), 1))
1102
- ]);
1103
- };
1104
- }
1105
- });
1106
- var define_appEndpoint_default = { authUrl: "https://portal-v2.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedme.cc", crmUrl: "crm.feedme.cc", paymentPortalUrl: "https://portal.feedme.cc/payment/payout-account", licensePortalUrl: "https://license.feedme.cc/", marketingV1Portal: "https://marketing-v1.feedme.cc", voucherAppUrl: "https://voucher.feedme.cc/" };
1107
- const _hoisted_1$e = { class: "flex flex-col gap-[28px]" }, _hoisted_2$b = { class: "flex flex-col gap-[14px]" }, _hoisted_3$9 = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$8 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$6 = { class: "grid gap-12 md:grid-cols-2 lg:grid-cols-2" }, _hoisted_6$3 = { class: "flex items-start justify-between gap-12" }, _hoisted_7$3 = { class: "fm-typo-en-title-sm-800" }, _hoisted_8$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_9$3 = {
1108
- key: 0,
1109
- class: "flex items-start gap-8 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1110
- }, _hoisted_10$3 = { class: "flex flex-col gap-12" }, _hoisted_11$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_12 = { class: "grid items-stretch gap-12 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-4" }, _hoisted_13 = { class: "flex items-start justify-between gap-12" }, _hoisted_14 = {
1111
- key: 1,
1112
- class: "h-[8px] w-[8px] rounded-full bg-fm-color-neutral-white"
1113
- }, _hoisted_15 = {
1114
- key: 0,
1115
- class: "mt-[3px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1116
- }, _hoisted_16 = {
1117
- key: 1,
1118
- class: "mt-[6px] inline-flex rounded-[6px] bg-fm-color-system-warning-100 px-8 py-[3px] fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
1119
- }, _hoisted_17 = {
1120
- key: 2,
1121
- class: "mt-[6px] inline-flex rounded-[6px] bg-fm-color-neutral-gray-100 px-8 py-[3px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1122
- }, _hoisted_18 = {
1123
- key: 0,
1124
- class: "fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
1125
- }, _hoisted_19 = {
1126
- key: 1,
1127
- class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400"
1128
- }, _hoisted_20 = { class: "flex flex-col gap-[14px]" }, _hoisted_21 = { class: "fm-typo-en-body-lg-600" }, _hoisted_22 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_23 = {
1129
- key: 1,
1130
- class: "rounded-[8px] border border-dashed border-fm-color-neutral-gray-200 p-24 text-center fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1131
- }, _hoisted_24 = {
1132
- key: 3,
1133
- class: "flex flex-wrap items-start gap-24"
1134
- }, _hoisted_25 = { class: "min-w-0 flex-1 basis-[340px]" }, _hoisted_26 = {
1135
- key: 1,
1136
- class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1137
- }, _sfc_main$e = /* @__PURE__ */ defineComponent({
1138
- __name: "BroadcastDeliveryInput",
1139
- props: {
1140
- pushAvailability: {
1141
- type: String,
1142
- default: "checking"
1143
- },
1144
- /** Either the new delivery shape or a legacy single-channel message. */
1145
- modelValue: {
1146
- type: Object,
1147
- default: void 0
1148
- },
1149
- triggerType: {
1150
- type: String,
1151
- default: () => "SCHEDULE"
1152
- },
1153
- variables: {
1154
- type: Object,
1155
- default: () => [...DEFAULT_MESSAGE_VARIABLES]
1156
- },
1157
- helperText: { type: String },
1158
- /**
1159
- * False until the merchant tries to proceed. Broadcasts validate on submit,
1160
- * so incomplete-channel markers stay hidden while the form is being filled.
1161
- */
1162
- showValidation: { type: Boolean, default: !0 },
1163
- helperState: { type: String },
1164
- placeholder: { type: String }
1165
- },
1166
- emits: ["retry-push", "update:model-value"],
1167
- setup(e, { emit: l }) {
1168
- const { t: o } = useI18n(), i = useDialog(), r = computed(() => {
1169
- let y = "unavailable";
1170
- return d.pushAvailability === "checking" ? y = "checking" : d.pushAvailability === "non-native" && (y = "requiresNativeApp"), o("connect.campaign.broadcast.pushAvailability." + y);
1171
- });
1172
- function g() {
1173
- i.open({
1174
- title: o("connect.campaign.broadcast.pushAvailability.contactSales"),
1175
- message: o("connect.campaign.broadcast.pushAvailability.dialogMessage"),
1176
- primaryActions: {
1177
- text: o("connect.campaign.broadcast.pushAvailability.close"),
1178
- close: !0
1179
- }
1180
- });
1181
- }
1182
- const a = useCoreStore(), n = useMembershipStore(), d = e, s = l, h = ref(!1), p = ref("SMS"), f = computed(() => {
1183
- const y = d.modelValue;
1184
- return y && "channels" in y ? y : toDelivery({ message: y });
1185
- });
1186
- function k(y) {
1187
- s("update:model-value", y);
1188
- }
1189
- function v(y) {
1190
- return o(`connect.campaign.broadcast.channel.${y}`);
1191
- }
1192
- const u = {
1193
- SMS: "chat",
1194
- WHATSAPP: "chat",
1195
- EMAIL: "mail",
1196
- APP_INBOX: "inbox",
1197
- PUSH: "notifications"
1198
- };
1199
- function c(y) {
1200
- return u[y];
1201
- }
1202
- const m = computed(() => f.value.mode === "fallback"), b = computed(
1203
- () => d.variables.filter(
1204
- (y) => d.triggerType == "SCHEDULE" ? !y.startsWith("transaction.") : !0
1205
- )
1206
- ), E = useChannelFlag();
1207
- function V(y) {
1208
- return E(y) === "off" ? !1 : y === "PUSH" ? d.pushAvailability === "native" : y === "WHATSAPP" ? h.value : !0;
1209
- }
1210
- const S = ["fallback", "all"];
1211
- function N(y) {
1212
- y !== f.value.mode && k(setMode(f.value, y));
1213
- }
1214
- const C = ref(null);
1215
- function T(y) {
1216
- var $;
1217
- const x = ($ = C.value) == null ? void 0 : $[y];
1218
- return x ? new Intl.NumberFormat(void 0, {
1219
- style: "currency",
1220
- currency: x.currency,
1221
- minimumFractionDigits: x.precision,
1222
- maximumFractionDigits: x.precision
1223
- }).format(x.amount / 10 ** x.precision) : null;
1224
- }
1225
- const R = computed(
1226
- () => (
1227
- // A flagged-off channel stays visible while selected, so it can be removed.
1228
- CHANNEL_DISPLAY_ORDER.filter(
1229
- (y) => E(y) === "on" || f.value.channels.includes(y)
1230
- ).map((y) => {
1231
- const x = f.value.channels.includes(y), $ = T(y);
1232
- let F = o("connect.campaign.broadcast.freeChannel");
1233
- return isPaidChannel(y) && (F = $ ? o("connect.campaign.broadcast.perMessage", { price: $ }) : null), {
1234
- channel: y,
1235
- label: v(y),
1236
- selected: x,
1237
- available: V(y),
1238
- rateNote: F,
1239
- // In fallback mode the grid is a radio for the primary channel, so only
1240
- // the primary reads as checked; a fallback is tagged instead.
1241
- checked: m.value ? f.value.channels[0] === y : x,
1242
- usedAsFallback: m.value && f.value.channels.indexOf(y) > 0
1243
- };
1244
- })
1245
- )
1246
- );
1247
- async function w(y) {
1248
- if (m.value) {
1249
- await O(y);
1250
- return;
1251
- }
1252
- if (f.value.channels.includes(y)) {
1253
- await I(y);
1254
- return;
1255
- }
1256
- V(y) && k(addChannel(f.value, y, b.value));
1257
- }
1258
- async function O(y) {
1259
- if (!V(y)) return;
1260
- const x = f.value.channels[0];
1261
- x !== y && (x && hasDraft(f.value, x) && !await prompt.remove(
1262
- o("connect.campaign.broadcast.replaceChannelConfirm", {
1263
- channel: v(x),
1264
- next: v(y)
1265
- })
1266
- ) || V(y) && (k(setPrimaryChannel(f.value, y, b.value)), p.value = y));
1267
- }
1268
- async function I(y) {
1269
- if (hasDraft(f.value, y) && !await prompt.remove(
1270
- o("connect.campaign.broadcast.removeChannelConfirm", {
1271
- channel: v(y)
1272
- })
1273
- ))
1274
- return;
1275
- const x = removeChannel(f.value, y);
1276
- k(x), p.value === y && (p.value = x.channels[0] ?? "SMS");
1277
- }
1278
- function Y(y, x) {
1279
- k(moveChannel(f.value, y, x));
1280
- }
1281
- function j(y) {
1282
- V(y) && k(addChannel(f.value, y, b.value));
1283
- }
1284
- const G = computed(
1285
- () => f.value.channels.slice(1).map((y, x) => ({
1286
- channel: y,
1287
- label: v(y),
1288
- position: x + 2,
1289
- complete: !d.showValidation || isChannelComplete(f.value, y)
1290
- }))
1291
- ), q = computed(
1292
- () => CHANNEL_DISPLAY_ORDER.filter(
1293
- (y) => !f.value.channels.includes(y) && V(y)
1294
- ).map((y) => ({
1295
- channel: y,
1296
- label: v(y)
1297
- }))
1298
- ), U = computed(
1299
- () => f.value.channels.map((y, x) => {
1300
- let $ = o("connect.campaign.broadcast.tab.sendsToEligible");
1301
- m.value && ($ = o(
1302
- x === 0 ? "connect.campaign.broadcast.tab.firstAttempt" : "connect.campaign.broadcast.tab.ifNotReached"
1303
- ));
1304
- let F;
1305
- return x > 0 && (F = m.value ? "→" : "+"), {
1306
- key: y,
1307
- label: v(y),
1308
- sub: $,
1309
- complete: !d.showValidation || isChannelComplete(f.value, y),
1310
- step: m.value ? x + 1 : void 0,
1311
- connector: F
1312
- };
1313
- })
1314
- );
1315
- watchEffect(() => {
1316
- const y = U.value.map((x) => x.key);
1317
- y.length && !y.includes(p.value) && (p.value = y[0]);
1318
- });
1319
- const D = computed(() => p.value), Z = computed(() => {
1320
- const y = D.value;
1321
- if (!(y === "APP_INBOX" || y === "PUSH"))
1322
- return f.value.content[y];
1323
- }), L = computed(
1324
- () => f.value.content.APP_INBOX
1325
- ), M = computed(
1326
- () => f.value.content.PUSH
1327
- );
1328
- function W(y) {
1329
- k(setChannelContent(f.value, "APP_INBOX", y));
1330
- }
1331
- function X(y) {
1332
- V("PUSH") && k(setChannelContent(f.value, "PUSH", y));
1333
- }
1334
- function K(y, x) {
1335
- y === "APP_INBOX" || y === "PUSH" || k(setChannelContent(f.value, y, { ...x, channel: y }));
1336
- }
1337
- const H = computed(
1338
- () => f.value.channels.filter(isPaidChannel)
1339
- ), J = computed(() => {
1340
- var x, $, F;
1341
- const y = ((x = n.membership) == null ? void 0 : x.brand) || ((F = ($ = a.currentBusiness) == null ? void 0 : $.value) == null ? void 0 : F.name) || "";
1342
- return getSmsMessageMetrics({ brandName: y, content: "" }).prefix;
1343
- }), Q = `${define_appEndpoint_default.licensePortalUrl}settings?businessId=${SvcConfig.businessId}`;
1344
- async function ee() {
1345
- try {
1346
- const y = await membershipApi.getWhatsappNumbers();
1347
- h.value = y.some(
1348
- (x) => {
1349
- var $;
1350
- return ($ = x == null ? void 0 : x.default) == null ? void 0 : $.includes("Marketing");
1351
- }
1352
- );
1353
- } catch (y) {
1354
- console.error("Failed to fetch WhatsApp numbers:", y);
1355
- }
1356
- }
1357
- return onMounted(async () => {
1358
- const y = f.value.channels[0];
1359
- y && (p.value = y), campaignApi.readBroadcastCreditSummary().then((x) => C.value = x.prices).catch(() => C.value = null), await ee();
1360
- }), (y, x) => {
1361
- const $ = resolveComponent("FmIcon"), F = resolveComponent("FmCard"), A = resolveComponent("FmButton");
1362
- return openBlock(), createElementBlock("div", _hoisted_1$e, [
1363
- createElementVNode("div", _hoisted_2$b, [
1364
- createElementVNode("div", null, [
1365
- createElementVNode("div", _hoisted_3$9, toDisplayString(unref(o)("connect.campaign.broadcast.delivery")), 1),
1366
- createElementVNode("div", _hoisted_4$8, toDisplayString(unref(o)("connect.campaign.broadcast.deliveryDescription")), 1)
1367
- ]),
1368
- createElementVNode("div", _hoisted_5$6, [
1369
- (openBlock(), createElementBlock(Fragment, null, renderList(S, (B) => createVNode(F, {
1370
- key: B,
1371
- variant: "outlined",
1372
- class: normalizeClass(["h-full cursor-pointer select-none p-16 space-y-8", {
1373
- "border-fm-color-primary bg-fm-color-system-warning-100": unref(f).mode === B,
1374
- "hover:bg-fm-color-opacity-sm": unref(f).mode !== B
1375
- }]),
1376
- onClick: (P) => N(B)
1377
- }, {
1378
- default: withCtx(() => [
1379
- createElementVNode("div", _hoisted_6$3, [
1380
- createElementVNode("div", _hoisted_7$3, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${B}.label`)), 1),
1381
- unref(f).mode === B ? (openBlock(), createBlock($, {
1382
- key: 0,
1383
- name: "check_circle",
1384
- size: "md",
1385
- class: "shrink-0 text-fm-color-primary"
1386
- })) : createCommentVNode("", !0)
1387
- ]),
1388
- createElementVNode("div", _hoisted_8$3, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${B}.description`)), 1)
1389
- ]),
1390
- _: 2
1391
- }, 1032, ["class", "onClick"])), 64))
1392
- ]),
1393
- unref(f).channels.length < 2 ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
1394
- createVNode($, {
1395
- name: "info",
1396
- size: "sm",
1397
- class: "mt-[2px]"
1398
- }),
1399
- createElementVNode("span", null, toDisplayString(unref(o)("connect.campaign.broadcast.singleChannelNote")), 1)
1400
- ])) : createCommentVNode("", !0)
1401
- ]),
1402
- createElementVNode("div", _hoisted_10$3, [
1403
- createElementVNode("div", _hoisted_11$1, toDisplayString(unref(m) ? unref(o)("connect.campaign.broadcast.primaryChannel") : unref(o)("connect.campaign.broadcast.channels")), 1),
1404
- createElementVNode("div", _hoisted_12, [
1405
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(R), (B) => (openBlock(), createBlock(F, {
1406
- key: B.channel,
1407
- variant: "outlined",
1408
- class: normalizeClass(["flex h-full flex-col gap-12 p-16", [
1409
- B.checked ? "!border-fm-color-primary bg-fm-color-system-warning-100" : "",
1410
- B.available ? "cursor-pointer" : "cursor-not-allowed bg-fm-color-neutral-gray-100"
1411
- ]]),
1412
- "aria-disabled": B.channel === "PUSH" ? void 0 : !B.available,
1413
- onClick: (P) => w(B.channel)
1414
- }, {
1415
- default: withCtx(() => [
1416
- createElementVNode("div", _hoisted_13, [
1417
- createElementVNode("span", {
1418
- class: normalizeClass([
1419
- "flex h-[34px] w-[34px] flex-none items-center justify-center rounded-[8px]",
1420
- B.available ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-200 text-fm-color-neutral-gray-400"
1421
- ])
1422
- }, [
1423
- createVNode($, {
1424
- name: c(B.channel),
1425
- size: "md"
1426
- }, null, 8, ["name"])
1427
- ], 2),
1428
- B.available ? (openBlock(), createElementBlock("span", {
1429
- key: 0,
1430
- class: normalizeClass(["flex h-[22px] w-[22px] flex-none items-center justify-center border-2 transition-colors", [
1431
- unref(m) ? "rounded-full" : "rounded-[4px]",
1432
- B.checked ? "border-fm-color-primary bg-fm-color-primary text-fm-color-typo-white" : "border-fm-color-neutral-gray-300 bg-fm-color-neutral-white"
1433
- ]])
1434
- }, [
1435
- B.checked && !unref(m) ? (openBlock(), createBlock($, {
1436
- key: 0,
1437
- name: "check",
1438
- size: "sm"
1439
- })) : B.checked ? (openBlock(), createElementBlock("span", _hoisted_14)) : createCommentVNode("", !0)
1440
- ], 2)) : createCommentVNode("", !0)
1441
- ]),
1442
- createElementVNode("div", null, [
1443
- createElementVNode("div", {
1444
- class: normalizeClass(["fm-typo-en-body-md-600", B.available ? "" : "text-fm-color-typo-disabled"])
1445
- }, toDisplayString(B.label), 3),
1446
- B.available && B.rateNote ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(B.rateNote), 1)) : createCommentVNode("", !0),
1447
- B.available ? B.usedAsFallback ? (openBlock(), createElementBlock("div", _hoisted_17, toDisplayString(unref(o)("connect.campaign.broadcast.usedAsFallback")), 1)) : createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_16, toDisplayString(B.channel === "PUSH" ? unref(r) : unref(o)("connect.campaign.broadcast.notSetUp")), 1))
1448
- ]),
1449
- B.channel === "WHATSAPP" && !B.available ? (openBlock(), createElementBlock("a", {
1450
- key: 0,
1451
- href: Q,
1452
- target: "_blank",
1453
- class: "mt-auto fm-typo-en-body-sm-400 text-fm-color-secondary-blueberry underline",
1454
- onClick: x[0] || (x[0] = withModifiers(() => {
1455
- }, ["stop"]))
1456
- }, toDisplayString(unref(o)("connect.campaign.messageInput.manageWhatsappChannel")), 1)) : createCommentVNode("", !0),
1457
- B.channel === "PUSH" && !B.available ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1458
- e.pushAvailability === "non-native" ? (openBlock(), createBlock(A, {
1459
- key: 0,
1460
- label: unref(o)("connect.campaign.broadcast.pushAvailability.contactSales"),
1461
- onClick: withModifiers(g, ["stop"])
1462
- }, null, 8, ["label"])) : createCommentVNode("", !0),
1463
- e.pushAvailability === "failed" ? (openBlock(), createBlock(A, {
1464
- key: 1,
1465
- label: unref(o)("connect.campaign.broadcast.pushAvailability.retry"),
1466
- onClick: x[1] || (x[1] = withModifiers((P) => s("retry-push"), ["stop"]))
1467
- }, null, 8, ["label"])) : createCommentVNode("", !0),
1468
- B.selected ? (openBlock(), createBlock(A, {
1469
- key: 2,
1470
- label: unref(o)("connect.campaign.broadcast.pushAvailability.removePush"),
1471
- onClick: x[2] || (x[2] = withModifiers((P) => I("PUSH"), ["stop"]))
1472
- }, null, 8, ["label"])) : createCommentVNode("", !0)
1473
- ], 64)) : createCommentVNode("", !0)
1474
- ]),
1475
- _: 2
1476
- }, 1032, ["class", "aria-disabled", "onClick"]))), 128))
1477
- ]),
1478
- unref(f).channels.includes("PUSH") && !V("PUSH") ? (openBlock(), createElementBlock("div", _hoisted_18, toDisplayString(unref(o)("connect.campaign.broadcast.pushAvailability.removeBeforeSave")), 1)) : createCommentVNode("", !0),
1479
- e.showValidation && !unref(f).channels.length ? (openBlock(), createElementBlock("div", _hoisted_19, toDisplayString(unref(o)("connect.campaign.broadcast.selectChannelRequired")), 1)) : createCommentVNode("", !0),
1480
- unref(m) && unref(f).channels.length ? (openBlock(), createBlock(_sfc_main$f, {
1481
- key: 2,
1482
- rows: unref(G),
1483
- addable: unref(q),
1484
- onMove: Y,
1485
- onRemove: I,
1486
- onAdd: j
1487
- }, null, 8, ["rows", "addable"])) : createCommentVNode("", !0)
1488
- ]),
1489
- createElementVNode("div", _hoisted_20, [
1490
- createElementVNode("div", null, [
1491
- createElementVNode("div", _hoisted_21, toDisplayString(unref(o)("connect.campaign.broadcast.content")), 1),
1492
- createElementVNode("div", _hoisted_22, toDisplayString(unref(o)("connect.campaign.broadcast.contentDescription")), 1)
1493
- ]),
1494
- unref(H).length ? (openBlock(), createBlock(_sfc_main$r, {
1495
- key: 0,
1496
- channels: unref(H)
1497
- }, null, 8, ["channels"])) : createCommentVNode("", !0),
1498
- unref(f).channels.length ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_23, toDisplayString(unref(o)("connect.campaign.broadcast.noChannelContent")), 1)),
1499
- unref(f).channels.length ? (openBlock(), createBlock(_sfc_main$h, {
1500
- key: 2,
1501
- modelValue: unref(p),
1502
- "onUpdate:modelValue": x[3] || (x[3] = (B) => isRef(p) ? p.value = B : null),
1503
- tabs: unref(U)
1504
- }, null, 8, ["modelValue", "tabs"])) : createCommentVNode("", !0),
1505
- unref(f).channels.includes(unref(p)) ? (openBlock(), createElementBlock("div", _hoisted_24, [
1506
- createElementVNode("div", _hoisted_25, [
1507
- unref(p) === "PUSH" && unref(M) && V("PUSH") ? (openBlock(), createBlock(_sfc_main$i, {
1508
- key: 0,
1509
- "model-value": unref(M),
1510
- "show-validation": e.showValidation,
1511
- "onUpdate:modelValue": X
1512
- }, null, 8, ["model-value", "show-validation"])) : unref(p) === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_26, toDisplayString(unref(r)), 1)) : unref(p) === "APP_INBOX" && unref(L) ? (openBlock(), createBlock(_sfc_main$j, {
1513
- key: 2,
1514
- "model-value": unref(L),
1515
- variables: unref(b),
1516
- "show-validation": e.showValidation,
1517
- "onUpdate:modelValue": W
1518
- }, null, 8, ["model-value", "variables", "show-validation"])) : unref(p) !== "APP_INBOX" ? (openBlock(), createBlock(_sfc_main$s, {
1519
- key: unref(p),
1520
- "model-value": unref(Z),
1521
- "allow-email": !1,
1522
- "allow-whatsapp": !1,
1523
- "hide-credit-card": !0,
1524
- "trigger-type": e.triggerType,
1525
- variables: unref(b),
1526
- placeholder: e.placeholder,
1527
- "onUpdate:modelValue": x[4] || (x[4] = (B) => K(unref(D), B))
1528
- }, null, 8, ["model-value", "trigger-type", "variables", "placeholder"])) : createCommentVNode("", !0)
1529
- ]),
1530
- createVNode(_sfc_main$g, {
1531
- target: unref(p),
1532
- content: unref(f).content[unref(D)],
1533
- "sender-prefix": unref(J)
1534
- }, null, 8, ["target", "content", "sender-prefix"])
1535
- ])) : createCommentVNode("", !0)
1536
- ])
1537
- ]);
1538
- };
1539
- }
1540
- }), _hoisted_1$d = { class: "space-y-8" }, _hoisted_2$a = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$8 = {
1541
- key: 0,
1542
- class: "space-y-4"
1543
- }, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$5 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
1544
- __name: "ScheduleRuleInput",
1545
- props: {
1546
- modelValue: {
1547
- type: Object,
1548
- required: !0
1549
- },
1550
- startDate: {
1551
- type: String
1552
- },
1553
- endDate: {
1554
- type: String
1555
- }
1556
- },
1557
- emits: ["update:model-value"],
1558
- setup(e, { emit: l }) {
1559
- const { t: o } = useI18n(), i = e, r = l, g = useCoreStore(), a = computed(
1560
- () => CountryTimezone[g.currentCountry.value || "MY"]
1561
- );
1562
- function n() {
1563
- const u = RuleBuilder.getRules(i.modelValue);
1564
- return u.length == 0 ? "fixed" : u.some(
1565
- (c) => isRuleEntry(c) && RuleBuilder.simplify(c).operator == "_rrule"
1566
- ) ? "repeating" : "fixed";
1567
- }
1568
- const d = ref(n()), s = ref(!1), h = computed(() => [
1569
- { label: o("connect.template.rule.schedule.fixed"), value: "fixed" },
1570
- { label: o("connect.template.rule.schedule.repeating"), value: "repeating" }
1571
- ]), p = computed(() => {
1572
- const u = RuleBuilder.getRules(i.modelValue), c = u.find(
1573
- (b) => isRuleEntry(b) && RuleBuilder.simplify(b).property == "trigger.date"
1574
- ), m = u.find(
1575
- (b) => isRuleEntry(b) && RuleBuilder.simplify(b).property == "trigger.time"
1576
- );
1577
- return {
1578
- date: c ? RuleBuilder.simplify(c).equator : null,
1579
- time: m ? RuleBuilder.simplify(m).equator : null
1580
- };
1581
- }), f = computed(
1582
- () => calculateNextScheduleAt(
1583
- i.modelValue,
1584
- /* @__PURE__ */ new Date(),
1585
- i.startDate ? new Date(i.startDate) : void 0,
1586
- i.endDate ? new Date(i.endDate) : void 0
1587
- )
1588
- );
1589
- function k(u) {
1590
- const c = u.value, m = c == "fixed" ? [
1591
- RuleBuilder.constructEntry(
1592
- "trigger.date",
1593
- "_isOnDate",
1594
- (/* @__PURE__ */ new Date()).toISOString()
1595
- ),
1596
- RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
1597
- ] : [
1598
- RuleBuilder.constructEntry(
1599
- "trigger.date",
1600
- "_rrule",
1601
- "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
1602
- ),
1603
- RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
1604
- ];
1605
- r(
1606
- "update:model-value",
1607
- RuleBuilder.setRuleToGroup(
1608
- RuleBuilder.scaffoldGroup("g_schedule"),
1609
- m
1610
- )
1611
- ), d.value = c;
1612
- }
1613
- function v(u) {
1614
- d.value == "fixed" ? r(
1615
- "update:model-value",
1616
- RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
1617
- RuleBuilder.constructEntry(
1618
- "trigger.date",
1619
- "_isOnDate",
1620
- u.date
1621
- ),
1622
- RuleBuilder.constructEntry(
1623
- "trigger.time",
1624
- "_isOnTime",
1625
- u.time
1626
- )
1627
- ])
1628
- ) : r(
1629
- "update:model-value",
1630
- RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
1631
- RuleBuilder.constructEntry(
1632
- "trigger.date",
1633
- "_rrule",
1634
- u.date
1635
- ),
1636
- RuleBuilder.constructEntry(
1637
- "trigger.time",
1638
- "_isOnTime",
1639
- u.time
1640
- )
1641
- ])
1642
- );
1643
- }
1644
- return (u, c) => {
1645
- const m = resolveComponent("FmButtonGroup"), b = resolveComponent("FmTimePicker"), E = resolveComponent("FmIcon"), V = resolveComponent("FmTooltip"), S = resolveComponent("FmField"), N = resolveComponent("FmCard"), C = resolveComponent("FmPopover"), T = resolveComponent("FmDatePicker"), R = resolveComponent("FmHelperText");
1646
- return openBlock(), createElementBlock(Fragment, null, [
1647
- createVNode(m, {
1648
- items: unref(h),
1649
- "model-value": unref(h).find((w) => w.value === unref(d)) ?? null,
1650
- "onUpdate:modelValue": k,
1651
- class: "mb-8"
1652
- }, null, 8, ["items", "model-value"]),
1653
- createElementVNode("div", _hoisted_1$d, [
1654
- createElementVNode("div", _hoisted_2$a, [
1655
- createVNode(b, {
1656
- label: unref(o)("connect.template.rule.schedule.notify_time"),
1657
- "model-value": unref(p).time,
1658
- "onUpdate:modelValue": c[0] || (c[0] = (w) => v({ date: unref(p).date, time: w })),
1659
- "helper-text": unref(p).time ? void 0 : unref(o)("connect.template.rule.schedule.time_required"),
1660
- "helper-state": unref(p).time ? void 0 : "error"
1661
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"]),
1662
- unref(d) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
1663
- createElementVNode("div", _hoisted_4$7, [
1664
- createElementVNode("div", null, toDisplayString(unref(o)("connect.template.rule.schedule.notify_date")), 1),
1665
- unref(p).date ? (openBlock(), createBlock(V, {
1666
- key: 0,
1667
- "z-index": 9999,
1668
- content: unref(SummarizeRrule)(unref(RRule).fromString(unref(p).date).options)
1669
- }, {
1670
- default: withCtx(() => [
1671
- createVNode(E, {
1672
- name: "info",
1673
- size: "sm",
1674
- outline: !0
1675
- })
1676
- ]),
1677
- _: 1
1678
- }, 8, ["content"])) : createCommentVNode("", !0)
1679
- ]),
1680
- createVNode(C, {
1681
- "show-popover": unref(s),
1682
- onPopoverChanged: c[3] || (c[3] = (w) => s.value = w)
1683
- }, {
1684
- "popover-button": withCtx(() => [
1685
- createVNode(S, {
1686
- class: "cursor-pointer",
1687
- "helper-text": unref(p).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
1688
- "helper-state": unref(p).date ? void 0 : "error"
1689
- }, {
1690
- default: withCtx(() => [
1691
- createElementVNode("div", _hoisted_5$5, toDisplayString(unref(p).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(p).date).options) : unref(o)("connect.template.rule.schedule.set_repeating_date")), 1)
1692
- ]),
1693
- _: 1
1694
- }, 8, ["helper-text", "helper-state"])
1695
- ]),
1696
- default: withCtx(() => [
1697
- createVNode(N, { class: "elevated p-8 w-[450px]" }, {
1698
- default: withCtx(() => [
1699
- createVNode(_sfc_main$t, {
1700
- "apply-button": !0,
1701
- "model-value": unref(p).date || "",
1702
- onCancel: c[1] || (c[1] = (w) => s.value = !1),
1703
- "onUpdate:modelValue": c[2] || (c[2] = (w) => (v({ date: w, time: unref(p).time }), s.value = !1))
1704
- }, null, 8, ["model-value"])
1705
- ]),
1706
- _: 1
1707
- })
1708
- ]),
1709
- _: 1
1710
- }, 8, ["show-popover"])
1711
- ])) : (openBlock(), createBlock(T, {
1712
- key: 1,
1713
- label: unref(o)("connect.template.rule.schedule.notify_date"),
1714
- "model-value": unref(p).date || "",
1715
- "onUpdate:modelValue": c[4] || (c[4] = (w) => v({ date: w, time: unref(p).time })),
1716
- "helper-text": unref(p).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
1717
- "helper-state": unref(p).date ? void 0 : "error"
1718
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"]))
1719
- ]),
1720
- unref(p).date && unref(p).time && unref(f) ? (openBlock(), createBlock(R, {
1721
- key: 0,
1722
- text: `${unref(moment)(unref(f)).isAfter(unref(moment)()) ? unref(o)("connect.template.rule.schedule.next_notification") : unref(o)("connect.template.rule.schedule.last_trigger_on")} ${unref(moment)(unref(f)).format("dddd, DD MMM YYYY")} at
1723
- ${unref(moment)(unref(f)).format("hh:mmA")}(UTC${unref(moment).tz(unref(a)).format("Z")}) (${unref(moment)(unref(f)).fromNow()})`
1724
- }, null, 8, ["text"])) : createCommentVNode("", !0)
1725
- ])
1726
- ], 64);
1727
- };
1728
- }
1729
- }), _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$7 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$6 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
1730
- __name: "GameTypeInput",
1731
- props: {
1732
- modelValue: {
1733
- type: String
1734
- }
1735
- },
1736
- emits: ["update:model-value"],
1737
- setup(e, { emit: l }) {
1738
- const { t: o } = useI18n(), i = e, r = l, g = computed(
1739
- () => [
1740
- {
1741
- label: o("connect.campaign.gameType.option.FORTUNE_WHEEL.label"),
1742
- description: o("connect.campaign.gameType.option.FORTUNE_WHEEL.description"),
1743
- value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
1744
- hidden: !1
1745
- },
1746
- {
1747
- label: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.label"),
1748
- description: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.description"),
1749
- value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
1750
- hidden: !0
1751
- }
1752
- ].filter((a) => !a.hidden)
1753
- );
1754
- return (a, n) => {
1755
- const d = resolveComponent("FmCard");
1756
- return openBlock(), createElementBlock("div", _hoisted_1$c, [
1757
- createElementVNode("div", _hoisted_2$9, toDisplayString(unref(o)("connect.template.select_game")), 1),
1758
- createElementVNode("div", _hoisted_3$7, [
1759
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (s) => (openBlock(), createBlock(d, {
1760
- variant: "outlined",
1761
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1762
- "col-span-2": unref(g).length == 1,
1763
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
1764
- "hover:bg-fm-color-opacity-sm": e.modelValue != s.value
1765
- }]),
1766
- onClick: () => {
1767
- i.modelValue != s.value && r("update:model-value", s.value);
1768
- },
1769
- key: s.value
1770
- }, {
1771
- default: withCtx(() => [
1772
- createElementVNode("div", _hoisted_4$6, toDisplayString(s.label), 1),
1773
- createElementVNode("div", _hoisted_5$4, toDisplayString(s.description), 1)
1774
- ]),
1775
- _: 2
1776
- }, 1032, ["class", "onClick"]))), 128))
1777
- ])
1778
- ]);
1779
- };
1780
- }
1781
- }), _hoisted_1$b = {
1782
- key: 0,
1783
- class: "flex flex-col gap-y-24"
1784
- }, _hoisted_2$8 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
1785
- __name: "EditRewardPoolSheet",
1786
- emits: ["update:model-value"],
1787
- setup(e, { expose: l, emit: o }) {
1788
- const i = useMembershipStore(), { minor: r } = useLoading, g = ref(!1), a = ref(), n = ref(), d = ref(0), s = computed(() => {
1789
- var u;
1790
- return ((u = i.loyaltyRewards.items.find(
1791
- (c) => {
1792
- var m;
1793
- return c.value === ((m = a.value) == null ? void 0 : m.collectible);
1794
- }
1795
- )) == null ? void 0 : u.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
1796
- }), h = computed(() => {
1797
- const v = s.value.safeParse(a.value);
1798
- return v.success ? [] : v.error.errors;
1799
- });
1800
- function p(v, u, c) {
1801
- v && (a.value = u, d.value = c), g.value = v;
1802
- }
1803
- const f = o;
1804
- async function k() {
1805
- const v = s.value.safeParse(a.value);
1806
- v.success && (await r(
1807
- async () => {
1808
- v.data.type === "VOUCHER" && n.value && (v.data.collectibleConfig.image = await firebaseStorage.update(
1809
- v.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1810
- n.value
1811
- ));
1812
- },
1813
- {
1814
- message: "Uploading reward image",
1815
- successMessage: "Reward image updated"
1816
- }
1817
- ), f("update:model-value", v.data, d.value));
1818
- }
1819
- return l({
1820
- showSheet: p
1821
- }), (v, u) => {
1822
- const c = resolveComponent("FmSelect"), m = resolveComponent("FmStepperField"), b = resolveComponent("FmButton"), E = resolveComponent("FmSideSheet");
1823
- return openBlock(), createBlock(E, {
1824
- "max-width": 560,
1825
- modelValue: unref(g),
1826
- "onUpdate:modelValue": [
1827
- u[9] || (u[9] = (V) => isRef(g) ? g.value = V : null),
1828
- u[10] || (u[10] = (V) => g.value = V)
1829
- ],
1830
- header: "Edit reward",
1831
- "dismiss-away": ""
1832
- }, {
1833
- "side-sheet-footer": withCtx(() => [
1834
- createElementVNode("div", _hoisted_2$8, [
1835
- createVNode(b, {
1836
- variant: "primary",
1837
- type: "button",
1838
- disabled: unref(h).length > 0,
1839
- label: "Confirm",
1840
- onClick: u[7] || (u[7] = (V) => k())
1841
- }, null, 8, ["disabled"]),
1842
- createVNode(b, {
1843
- variant: "secondary",
1844
- type: "button",
1845
- label: "Cancel",
1846
- onClick: u[8] || (u[8] = (V) => g.value = !1)
1847
- })
1848
- ])
1849
- ]),
1850
- default: withCtx(() => {
1851
- var V, S, N;
1852
- return [
1853
- unref(a) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
1854
- createVNode(c, {
1855
- label: "Reward Type",
1856
- items: [
1857
- { label: "No Reward", value: "NO_REWARD" },
1858
- { label: "Voucher", value: "VOUCHER" },
1859
- { label: "Loyalty", value: "LOYALTY" }
1860
- ],
1861
- "model-value": unref(a).type,
1862
- "onUpdate:modelValue": u[0] || (u[0] = (C) => {
1863
- C == "NO_REWARD" ? a.value = {
1864
- type: "NO_REWARD",
1865
- collectible: null,
1866
- weight: 1
1867
- } : C === "VOUCHER" ? a.value = {
1868
- collectible: null,
1869
- type: "VOUCHER",
1870
- collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1871
- business: unref(useCoreStore)().currentBusiness.value._id
1872
- }),
1873
- earningOption: {
1874
- amount: 1,
1875
- type: "FIXED"
1876
- },
1877
- validityOption: {
1878
- validForDay: 7
1879
- },
1880
- weight: 1
1881
- } : a.value = {
1882
- collectible: unref(i).loyaltyRewards.raw[0]._id,
1883
- type: "LOYALTY",
1884
- earningOption: {
1885
- amount: 1,
1886
- type: "FIXED"
1887
- },
1888
- validityOption: {
1889
- validForDay: 7
1890
- },
1891
- weight: 1
1892
- };
1893
- })
1894
- }, null, 8, ["model-value"]),
1895
- unref(a).type == "LOYALTY" ? (openBlock(), createBlock(c, {
1896
- key: 0,
1897
- label: "Loyalty type",
1898
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "collectible", [unref(a).type])],
1899
- items: unref(i).loyaltyRewards.items,
1900
- "model-value": unref(a).collectible,
1901
- "onUpdate:modelValue": u[1] || (u[1] = (C) => unref(a).collectible = C)
1902
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1903
- createVNode(m, {
1904
- label: "Weight",
1905
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "weight", [unref(a).type])],
1906
- "model-value": unref(a).weight,
1907
- "onUpdate:modelValue": u[2] || (u[2] = (C) => a.value = {
1908
- ...unref(a),
1909
- weight: C
1910
- })
1911
- }, null, 8, ["rules", "model-value"]),
1912
- unref(a).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1913
- ((V = unref(i).loyaltyRewards.items.find(
1914
- (C) => {
1915
- var T;
1916
- return C.value === ((T = unref(a)) == null ? void 0 : T.collectible);
1917
- }
1918
- )) == null ? void 0 : V.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1919
- u[11] || (u[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1920
- createVNode(_sfc_main$u, {
1921
- class: "mt-[-8px]",
1922
- rules: [
1923
- unref(ZodHelper).ruleAtPath(unref(s), "earningOption", [unref(a).type])
1924
- ],
1925
- "helper-state": unref(ZodHelper).helperState(unref(h), "earningOption"),
1926
- "error-text": unref(ZodHelper).helperText(unref(h), "earningOption"),
1927
- "fixed-type": !0,
1928
- "model-value": unref(a).earningOption,
1929
- "onUpdate:modelValue": u[3] || (u[3] = (C) => a.value = {
1930
- ...unref(a),
1931
- earningOption: C
1932
- })
1933
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
1934
- ], 64)) : createCommentVNode("", !0),
1935
- u[12] || (u[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
1936
- createVNode(_sfc_main$v, {
1937
- type: unref(a).type === "LOYALTY" ? "custom" : "range",
1938
- "for-credit": unref(a).type === "LOYALTY" && ((S = unref(i).loyaltyRewards.items.find(
1939
- (C) => {
1940
- var T;
1941
- return C.value === ((T = unref(a)) == null ? void 0 : T.collectible);
1942
- }
1943
- )) == null ? void 0 : S.raw.type) === "CREDIT",
1944
- class: "!gap-24",
1945
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "validityOption", [unref(a).type])],
1946
- "model-value": unref(a).validityOption,
1947
- "onUpdate:modelValue": u[4] || (u[4] = (C) => a.value = {
1948
- ...unref(a),
1949
- validityOption: C
1950
- })
1951
- }, null, 8, ["type", "for-credit", "rules", "model-value"])
1952
- ], 64)) : createCommentVNode("", !0),
1953
- unref(a).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$w, {
1954
- key: 2,
1955
- "reward-image": unref(n),
1956
- "model-value": ((N = unref(a)) == null ? void 0 : N.collectibleConfig) ?? void 0,
1957
- "onUpdate:modelValue": u[5] || (u[5] = (C) => a.value = {
1958
- ...unref(a),
1959
- collectibleConfig: C
1960
- }),
1961
- "onUpdate:rewardImage": u[6] || (u[6] = (C) => n.value = C)
1962
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1963
- createVNode(JsonViewer, { json: unref(h) }, null, 8, ["json"])
1964
- ])) : createCommentVNode("", !0)
1965
- ];
1966
- }),
1967
- _: 1
1968
- }, 8, ["modelValue"]);
1969
- };
1970
- }
1971
- });
1972
- function isNullOrEmpty(e) {
1973
- return e == null || e === "";
1974
- }
1975
- const _hoisted_1$a = { class: "space-y-16" }, _hoisted_2$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$6 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$5 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$a = /* @__PURE__ */ defineComponent({
1976
- __name: "RewardPoolInput",
1977
- props: {
1978
- modelValue: {
1979
- type: Array,
1980
- default: () => [
1981
- {
1982
- collectible: null,
1983
- type: "NO_REWARD",
1984
- weight: 1
1985
- }
1986
- ]
1987
- }
1988
- },
1989
- emits: ["update:model-value"],
1990
- setup(e, { emit: l }) {
1991
- const o = e, i = l, r = useMembershipStore(), { t: g } = useI18n(), a = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), n = computed(() => o.modelValue ?? []), d = computed(() => {
1992
- const u = a.safeParse(n.value);
1993
- return u.success ? [] : u.error.errors;
1994
- }), s = ref();
1995
- function h(u, c) {
1996
- var b;
1997
- const m = [...n.value];
1998
- m[c] = u, (b = s.value) == null || b.showSheet(!1), i("update:model-value", m);
1999
- }
2000
- function p(u) {
2001
- const c = u.type == "VOUCHER" ? u.collectibleConfig : r.collectibles.find(
2002
- (E) => E._id.toString() == u.collectible
2003
- ), m = CollectionUtils.formattedType((c == null ? void 0 : c.name) || ""), b = u.weight;
2004
- return {
2005
- label: isNullOrEmpty(m) ? "NO REWARD" : m,
2006
- sublabel: `${b} (${(b / n.value.reduce((E, V) => E + V.weight, 0) * 100).toFixed(2)}%)`
2007
- };
2008
- }
2009
- function f(u) {
2010
- var m;
2011
- const c = [...n.value];
2012
- (m = s.value) == null || m.showSheet(!0, c[u], u);
2013
- }
2014
- function k(u) {
2015
- const c = [...n.value];
2016
- c.splice(u, 1), i("update:model-value", c);
2017
- }
2018
- function v() {
2019
- var u;
2020
- (u = s.value) == null || u.showSheet(
2021
- !0,
2022
- {
2023
- type: "NO_REWARD",
2024
- collectible: null,
2025
- weight: 1
2026
- },
2027
- n.value.length
2028
- );
2029
- }
2030
- return (u, c) => {
2031
- const m = resolveComponent("FmButton"), b = resolveComponent("FmCard"), E = resolveComponent("FmHelperText");
2032
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
2033
- createElementVNode("div", _hoisted_2$7, toDisplayString(unref(g)("connect.template.configure_reward_type")), 1),
2034
- createVNode(m, {
2035
- label: unref(g)("connect.campaign.rewardPool.addReward"),
2036
- onClick: c[0] || (c[0] = (V) => v()),
2037
- variant: "plain",
2038
- icon: "add"
2039
- }, null, 8, ["label"]),
2040
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (V, S) => (openBlock(), createBlock(b, {
2041
- key: S,
2042
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2043
- variant: "outlined",
2044
- onClick: (N) => f(S)
2045
- }, {
2046
- default: withCtx(() => {
2047
- var N;
2048
- return [
2049
- createElementVNode("div", null, [
2050
- createElementVNode("div", _hoisted_3$6, toDisplayString(V.type == "LOYALTY" ? (N = V == null ? void 0 : V.earningOption) == null ? void 0 : N.amount : "") + " " + toDisplayString(p(V).label), 1),
2051
- createElementVNode("div", _hoisted_4$5, toDisplayString(p(V).sublabel), 1)
2052
- ]),
2053
- createVNode(m, {
2054
- icon: "delete",
2055
- variant: "tertiary",
2056
- onClick: (C) => (C.stopPropagation(), k(S))
2057
- }, null, 8, ["onClick"])
2058
- ];
2059
- }),
2060
- _: 2
2061
- }, 1032, ["onClick"]))), 128)),
2062
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d).filter((V) => V.path.join(".") == ""), (V) => (openBlock(), createBlock(E, {
2063
- key: V.message,
2064
- text: V.message,
2065
- state: "error"
2066
- }, null, 8, ["text"]))), 128)),
2067
- createVNode(_sfc_main$b, {
2068
- ref_key: "sheetRef",
2069
- ref: s,
2070
- "onUpdate:modelValue": h
2071
- }, null, 512)
2072
- ]);
2073
- };
2074
- }
2075
- }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
2076
- key: 0,
2077
- class: "grid grid-cols-2 gap-16"
2078
- }, _hoisted_3$5 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
2079
- __name: "PromotionGameTypeInput",
2080
- props: {
2081
- modelValue: {
2082
- type: Object
2083
- }
2084
- },
2085
- emits: ["update:model-value"],
2086
- setup(e, { emit: l }) {
2087
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => [
2088
- {
2089
- label: o("connect.template.promotion_game.rock_paper_scissors.label"),
2090
- description: o("connect.template.promotion_game.rock_paper_scissors.description"),
2091
- value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
2092
- }
2093
- ]);
2094
- return (a, n) => {
2095
- var p, f, k;
2096
- const d = resolveComponent("FmSwitch"), s = resolveComponent("FmCard"), h = resolveComponent("FmHelperText");
2097
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
2098
- createVNode(d, {
2099
- label: unref(o)("connect.template.promotion_game.enable"),
2100
- "model-value": !!((p = e.modelValue) != null && p.gameType),
2101
- "onUpdate:modelValue": n[0] || (n[0] = (v) => v ? r("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : r("update:model-value", null))
2102
- }, null, 8, ["label", "model-value"]),
2103
- ((f = e.modelValue) == null ? void 0 : f.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
2104
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (v) => {
2105
- var u, c;
2106
- return openBlock(), createBlock(s, {
2107
- variant: "outlined",
2108
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2109
- "col-span-2": unref(g).length == 1,
2110
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((u = e.modelValue) == null ? void 0 : u.gameType) == v.value,
2111
- "hover:bg-fm-color-opacity-sm": ((c = e.modelValue) == null ? void 0 : c.gameType) != v.value
2112
- }]),
2113
- onClick: () => {
2114
- var m;
2115
- ((m = i.modelValue) == null ? void 0 : m.gameType) != v.value && r("update:model-value", { gameType: v.value });
2116
- },
2117
- key: v.value
2118
- }, {
2119
- default: withCtx(() => [
2120
- createElementVNode("div", _hoisted_3$5, toDisplayString(v.label), 1),
2121
- createElementVNode("div", _hoisted_4$4, toDisplayString(v.description), 1)
2122
- ]),
2123
- _: 2
2124
- }, 1032, ["class", "onClick"]);
2125
- }), 128))
2126
- ])) : createCommentVNode("", !0),
2127
- ((k = e.modelValue) == null ? void 0 : k.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(h, {
2128
- key: 1,
2129
- text: unref(o)("connect.template.promotion_game.rock_paper_scissors.warning"),
2130
- state: "warning"
2131
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2132
- ]);
2133
- };
2134
- }
2135
- }), _hoisted_1$8 = { class: "space-y-16" }, _hoisted_2$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$4 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$3 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$8 = /* @__PURE__ */ defineComponent({
2136
- __name: "MissionTypeInput",
2137
- props: {
2138
- modelValue: {
2139
- type: String
2140
- }
2141
- },
2142
- emits: ["update:model-value"],
2143
- setup(e, { emit: l }) {
2144
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => [
2145
- {
2146
- label: o("connect.campaign.mission.typeOption.STAMP.label"),
2147
- description: o("connect.campaign.mission.typeOption.STAMP.description"),
2148
- value: F_MISSION_TYPE.enum.STAMP
2149
- },
2150
- {
2151
- label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
2152
- description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
2153
- value: F_MISSION_TYPE.enum.PROGRESSIVE
2154
- }
2155
- ]);
2156
- return (a, n) => {
2157
- const d = resolveComponent("FmCard");
2158
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
2159
- createElementVNode("div", _hoisted_2$5, toDisplayString(unref(o)("connect.template.select_game")), 1),
2160
- createElementVNode("div", _hoisted_3$4, [
2161
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (s) => (openBlock(), createBlock(d, {
2162
- variant: "outlined",
2163
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2164
- "col-span-2": unref(g).length == 1,
2165
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
2166
- "hover:bg-fm-color-opacity-sm": e.modelValue != s.value
2167
- }]),
2168
- onClick: () => {
2169
- i.modelValue != s.value && r("update:model-value", s.value);
2170
- },
2171
- key: s.value
2172
- }, {
2173
- default: withCtx(() => [
2174
- createElementVNode("div", _hoisted_4$3, toDisplayString(s.label), 1),
2175
- createElementVNode("div", _hoisted_5$3, toDisplayString(s.description), 1)
2176
- ]),
2177
- _: 2
2178
- }, 1032, ["class", "onClick"]))), 128))
2179
- ])
2180
- ]);
2181
- };
2182
- }
2183
- }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
2184
- __name: "MissionEndInput",
2185
- props: {
2186
- modelValue: {
2187
- type: [String, Number]
2188
- },
2189
- helperText: {
2190
- type: String
2191
- },
2192
- helperState: {
2193
- type: String
2194
- }
2195
- },
2196
- emits: ["update:model-value"],
2197
- setup(e, { emit: l }) {
2198
- const o = l;
2199
- return (i, r) => {
2200
- const g = resolveComponent("FmStepperField");
2201
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
2202
- r[1] || (r[1] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Input the total number of stamps needed to complete the mission ", -1)),
2203
- createVNode(g, {
2204
- label: "Maximum to collect",
2205
- "model-value": e.modelValue || null,
2206
- "onUpdate:modelValue": r[0] || (r[0] = (a) => o("update:model-value", a)),
2207
- "helper-text": e.helperText || "Set the threshold required for reward eligibility",
2208
- "helper-state": e.helperState || "none"
2209
- }, null, 8, ["model-value", "helper-text", "helper-state"])
2210
- ]);
2211
- };
2212
- }
2213
- }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
2214
- __name: "EditMissionPoolSheet",
2215
- props: {
2216
- maxThreshold: {
2217
- type: Number,
2218
- required: !0
2219
- }
2220
- },
2221
- emits: ["update:model-value"],
2222
- setup(e, { expose: l, emit: o }) {
2223
- const i = e, r = useMembershipStore(), { minor: g } = useLoading, a = ref(!1), n = ref(), d = ref(), s = ref(0), h = computed(() => {
2224
- var m;
2225
- return ((m = r.loyaltyRewards.items.find(
2226
- (b) => {
2227
- var E;
2228
- return b.value === ((E = n.value) == null ? void 0 : E.collectible);
2229
- }
2230
- )) == null ? void 0 : m.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
2231
- }), p = computed(() => {
2232
- const c = h.value.safeParse(n.value);
2233
- return c.success ? [] : c.error.errors;
2234
- });
2235
- function f(c, m, b) {
2236
- c && (n.value = m, s.value = b), a.value = c;
2237
- }
2238
- const k = o;
2239
- async function v() {
2240
- const c = h.value.safeParse(n.value);
2241
- c.success && (await g(
2242
- async () => {
2243
- c.data.type === "VOUCHER" && d.value && (c.data.collectibleConfig.image = await firebaseStorage.update(
2244
- c.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, d.value),
2245
- d.value
2246
- ));
2247
- },
2248
- {
2249
- message: "Uploading reward image",
2250
- successMessage: "Reward image updated"
2251
- }
2252
- ), k("update:model-value", c.data, s.value));
2253
- }
2254
- const u = ref();
2255
- return l({
2256
- showSheet: f
2257
- }), (c, m) => {
2258
- const b = resolveComponent("FmStepperField"), E = resolveComponent("FmSelect"), V = resolveComponent("FmForm"), S = resolveComponent("FmButton"), N = resolveComponent("FmSideSheet");
2259
- return openBlock(), createBlock(N, {
2260
- "max-width": 560,
2261
- modelValue: unref(a),
2262
- "onUpdate:modelValue": [
2263
- m[10] || (m[10] = (C) => isRef(a) ? a.value = C : null),
2264
- m[11] || (m[11] = (C) => a.value = C)
2265
- ],
2266
- header: "Edit reward",
2267
- "dismiss-away": ""
2268
- }, {
2269
- "side-sheet-footer": withCtx(() => [
2270
- createElementVNode("div", _hoisted_1$6, [
2271
- createVNode(S, {
2272
- variant: "primary",
2273
- type: "button",
2274
- label: "Confirm",
2275
- disabled: unref(p).length > 0,
2276
- onClick: m[8] || (m[8] = async () => {
2277
- var C;
2278
- return (C = unref(u)) == null ? void 0 : C.validateInputs();
2279
- })
2280
- }, null, 8, ["disabled"]),
2281
- createVNode(S, {
2282
- variant: "secondary",
2283
- type: "button",
2284
- label: "Cancel",
2285
- onClick: m[9] || (m[9] = (C) => a.value = !1)
2286
- })
2287
- ])
2288
- ]),
2289
- default: withCtx(() => [
2290
- createVNode(JsonViewer, { json: unref(n) }, null, 8, ["json"]),
2291
- unref(n) ? (openBlock(), createBlock(V, {
2292
- key: 0,
2293
- class: "flex flex-col gap-y-24",
2294
- ref_key: "formRef",
2295
- ref: u,
2296
- onValidationSuccess: m[7] || (m[7] = (C) => v())
2297
- }, {
2298
- default: withCtx(() => {
2299
- var C, T;
2300
- return [
2301
- unref(n).type ? (openBlock(), createBlock(b, {
2302
- key: 0,
2303
- label: "Threshold",
2304
- rules: [
2305
- unref(ZodHelper).toRule(
2306
- unref(z).number().min(1).max(
2307
- i.maxThreshold,
2308
- `Number cannot be more than ${i.maxThreshold}`
2309
- )
2310
- )
2311
- ],
2312
- "model-value": unref(n).threshold,
2313
- "onUpdate:modelValue": m[0] || (m[0] = (R) => n.value = {
2314
- ...unref(n),
2315
- threshold: R
2316
- })
2317
- }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
2318
- createVNode(E, {
2319
- label: "Reward Type",
2320
- items: [
2321
- { label: "Voucher", value: "VOUCHER" },
2322
- { label: "Loyalty", value: "LOYALTY" }
2323
- ],
2324
- "model-value": unref(n).type,
2325
- "onUpdate:modelValue": m[1] || (m[1] = (R) => {
2326
- var w, O;
2327
- R === "VOUCHER" ? n.value = {
2328
- collectible: null,
2329
- type: "VOUCHER",
2330
- collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
2331
- business: unref(useCoreStore)().currentBusiness.value._id
2332
- }),
2333
- earningOption: {
2334
- amount: 1,
2335
- type: "FIXED"
2336
- },
2337
- validityOption: {
2338
- validForDay: 7
2339
- },
2340
- threshold: (w = unref(n)) == null ? void 0 : w.threshold
2341
- } : n.value = {
2342
- collectible: unref(r).loyaltyRewards.raw[0]._id,
2343
- type: "LOYALTY",
2344
- earningOption: {
2345
- amount: 1,
2346
- type: "FIXED"
2347
- },
2348
- validityOption: {
2349
- validForDay: 7
2350
- },
2351
- threshold: (O = unref(n)) == null ? void 0 : O.threshold
2352
- };
2353
- })
2354
- }, null, 8, ["model-value"]),
2355
- unref(n).type == "LOYALTY" ? (openBlock(), createBlock(E, {
2356
- key: 1,
2357
- label: "Loyalty type",
2358
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "collectible", [unref(n).type])],
2359
- items: unref(r).loyaltyRewards.items,
2360
- "model-value": unref(n).collectible,
2361
- "onUpdate:modelValue": m[2] || (m[2] = (R) => unref(n).collectible = R)
2362
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
2363
- unref(n).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2364
- m[12] || (m[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
2365
- createVNode(_sfc_main$u, {
2366
- class: "mt-[-8px]",
2367
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "earningOption", [unref(n).type])],
2368
- "helper-state": unref(ZodHelper).helperState(unref(p), "earningOption"),
2369
- "error-text": unref(ZodHelper).helperText(unref(p), "earningOption"),
2370
- "fixed-type": !0,
2371
- "model-value": unref(n).earningOption,
2372
- "onUpdate:modelValue": m[3] || (m[3] = (R) => n.value = {
2373
- ...unref(n),
2374
- earningOption: R
2375
- })
2376
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
2377
- createVNode(_sfc_main$v, {
2378
- class: "!gap-24",
2379
- type: unref(n).type === "LOYALTY" ? "custom" : "range",
2380
- "for-credit": unref(n).type === "LOYALTY" && ((C = unref(r).loyaltyRewards.items.find(
2381
- (R) => {
2382
- var w;
2383
- return R.value === ((w = unref(n)) == null ? void 0 : w.collectible);
2384
- }
2385
- )) == null ? void 0 : C.raw.type) === "CREDIT",
2386
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "validityOption", [unref(n).type])],
2387
- "model-value": unref(n).validityOption,
2388
- "onUpdate:modelValue": m[4] || (m[4] = (R) => n.value = {
2389
- ...unref(n),
2390
- validityOption: R
2391
- })
2392
- }, null, 8, ["type", "for-credit", "rules", "model-value"])
2393
- ], 64)) : createCommentVNode("", !0),
2394
- unref(n).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$w, {
2395
- key: 3,
2396
- "reward-image": unref(d),
2397
- "model-value": ((T = unref(n)) == null ? void 0 : T.collectibleConfig) ?? void 0,
2398
- "onUpdate:modelValue": m[5] || (m[5] = (R) => n.value = {
2399
- ...unref(n),
2400
- collectibleConfig: R
2401
- }),
2402
- "onUpdate:rewardImage": m[6] || (m[6] = (R) => d.value = R)
2403
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
2404
- createVNode(JsonViewer, { json: unref(p) }, null, 8, ["json"])
2405
- ];
2406
- }),
2407
- _: 1
2408
- }, 512)) : createCommentVNode("", !0)
2409
- ]),
2410
- _: 1
2411
- }, 8, ["modelValue"]);
2412
- };
2413
- }
2414
- }), _hoisted_1$5 = {
2415
- key: 0,
2416
- class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
2417
- }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
2418
- __name: "MissionProgress",
2419
- props: {
2420
- type: {
2421
- type: String,
2422
- required: !0
2423
- },
2424
- maxRange: {
2425
- type: Number,
2426
- required: !0
2427
- },
2428
- currentRange: {
2429
- type: Number,
2430
- default: 0
2431
- },
2432
- markers: {
2433
- type: Array,
2434
- default: () => []
2435
- }
2436
- },
2437
- setup(e) {
2438
- const l = e, { maxRange: o, currentRange: i, markers: r } = toRefs(l), g = computed(
2439
- () => Math.min(i.value / o.value * 100, 100)
2440
- ), a = (n) => n / o.value * 100;
2441
- return (n, d) => {
2442
- const s = resolveComponent("FmIcon");
2443
- return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
2444
- (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(o), 40), (h) => (openBlock(), createBlock(s, {
2445
- class: normalizeClass(
2446
- unref(i) >= h ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
2447
- ),
2448
- outline: unref(i) < h,
2449
- key: h,
2450
- name: unref(r).some((p) => p === h) ? "featured_seasonal_and_gifts" : "check_circle"
2451
- }, null, 8, ["class", "outline", "name"]))), 128))
2452
- ])) : (openBlock(), createElementBlock("div", {
2453
- key: 1,
2454
- class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
2455
- }, [
2456
- createElementVNode("div", {
2457
- class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
2458
- style: normalizeStyle({ width: unref(g) + "%" })
2459
- }, null, 4),
2460
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(r), (h, p) => (openBlock(), createElementBlock("div", {
2461
- key: p,
2462
- class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
2463
- style: normalizeStyle({ left: a(h) + "%" })
2464
- }, [
2465
- createElementVNode("div", _hoisted_2$4, [
2466
- createElementVNode("div", {
2467
- class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
2468
- }),
2469
- d[0] || (d[0] = createElementVNode("div", null, "🎁", -1))
2470
- ])
2471
- ], 4))), 128))
2472
- ]));
2473
- };
2474
- }
2475
- }), isObject = (e) => e !== null && typeof e == "object";
2476
- function changeKeysFactory(e) {
2477
- return function l(o, i = 1, r) {
2478
- if (i === 0 || !isObject(o))
2479
- return o;
2480
- if (Array.isArray(o))
2481
- return o.map((a) => l(a, i - 1, r));
2482
- const g = Object.create(Object.getPrototypeOf(o));
2483
- return Object.keys(o).forEach((a) => {
2484
- const n = o[a], d = e(a, r), s = l(n, i - 1, r);
2485
- g[d] = s;
2486
- }), g;
2487
- };
2488
- }
2489
- const sentenceCase = changeKeysFactory(sentenceCase$1), _hoisted_1$4 = { class: "space-y-16" }, _hoisted_2$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$3 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$2 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$2 = { class: "fm-typo-en-title-sm-800" }, _hoisted_6$2 = { class: "flex items-center gap-4" }, _hoisted_7$2 = { class: "fm-typo-en-body-lg-600" }, _hoisted_8$2 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_9$2 = { class: "flex items-center gap-16" }, _hoisted_10$2 = { key: 0 }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
2490
- __name: "MissionPoolInput",
2491
- props: {
2492
- modelValue: {
2493
- type: Array,
2494
- default: () => []
2495
- },
2496
- mission: {
2497
- type: Object,
2498
- required: !0
2499
- }
2500
- },
2501
- emits: ["update:model-value"],
2502
- setup(e, { emit: l }) {
2503
- const { t: o } = useI18n(), i = e, r = l, g = useMembershipStore(), a = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), n = computed(
2504
- () => i.modelValue.sort((c, m) => c.threshold - m.threshold) ?? []
2505
- ), d = computed(() => {
2506
- const c = a.safeParse(n.value);
2507
- return c.success ? [] : c.error.errors;
2508
- }), s = ref();
2509
- function h(c, m) {
2510
- var E;
2511
- const b = [...n.value];
2512
- b[m] = c, (E = s.value) == null || E.showSheet(!1), r("update:model-value", b);
2513
- }
2514
- function p(c) {
2515
- const m = c.type == "VOUCHER" ? c.collectibleConfig : g.collectibles.find(
2516
- (V) => V._id.toString() == c.collectible
2517
- ), b = CollectionUtils.formattedType((m == null ? void 0 : m.name) || ""), E = c.earningOption.type == "FIXED" ? o("connect.template.mission_pool.reward_sublabel_fixed", {
2518
- threshold: c.threshold,
2519
- amount: c.earningOption.amount
2520
- }) : o("connect.template.mission_pool.reward_sublabel_per_spend", {
2521
- threshold: c.threshold,
2522
- amount: c.earningOption.amount,
2523
- every: c.earningOption.every
2524
- });
2525
- return {
2526
- label: isNullOrEmpty(b) ? o("connect.template.mission_pool.no_reward") : b,
2527
- sublabel: E
2528
- };
2529
- }
2530
- function f(c) {
2531
- var b;
2532
- const m = [...n.value];
2533
- (b = s.value) == null || b.showSheet(!0, m[c], c);
2534
- }
2535
- function k(c) {
2536
- const m = [...n.value];
2537
- m.splice(c, 1), r("update:model-value", m);
2538
- }
2539
- function v() {
2540
- var c;
2541
- (c = s.value) == null || c.showSheet(
2542
- !0,
2543
- {
2544
- type: "LOYALTY",
2545
- collectible: g.loyaltyRewards.items[0].value,
2546
- threshold: null,
2547
- validityOption: {
2548
- validForDay: 7
2549
- },
2550
- earningOption: {
2551
- type: "FIXED",
2552
- amount: 1
2553
- }
2554
- },
2555
- n.value.length
2556
- );
2557
- }
2558
- function u(c) {
2559
- var m, b;
2560
- return c.type == "VOUCHER" ? (m = c.collectibleConfig) == null ? void 0 : m.name : sentenceCase(
2561
- ((b = g.loyaltyRewards.items.find(
2562
- (E) => E.value == c.collectible
2563
- )) == null ? void 0 : b.label) || ""
2564
- );
2565
- }
2566
- return (c, m) => {
2567
- const b = resolveComponent("FmButton"), E = resolveComponent("FmCard"), V = resolveComponent("FmHelperText");
2568
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2569
- createElementVNode("div", _hoisted_2$3, toDisplayString(unref(o)("connect.template.configure_reward_customer")), 1),
2570
- createVNode(b, {
2571
- label: unref(o)("connect.template.mission_pool.add_reward"),
2572
- onClick: m[0] || (m[0] = (S) => v()),
2573
- variant: "plain",
2574
- icon: "add"
2575
- }, null, 8, ["label"]),
2576
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (S, N) => (openBlock(), createBlock(E, {
2577
- key: N,
2578
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2579
- variant: "outlined",
2580
- onClick: (C) => f(N)
2581
- }, {
2582
- default: withCtx(() => [
2583
- createElementVNode("div", null, [
2584
- createElementVNode("div", _hoisted_3$3, toDisplayString(p(S).label), 1),
2585
- createElementVNode("div", _hoisted_4$2, toDisplayString(p(S).sublabel), 1)
2586
- ]),
2587
- createVNode(b, {
2588
- icon: "delete",
2589
- variant: "tertiary",
2590
- onClick: (C) => (C.stopPropagation(), k(N))
2591
- }, null, 8, ["onClick"])
2592
- ]),
2593
- _: 2
2594
- }, 1032, ["onClick"]))), 128)),
2595
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d).filter((S) => S.path.join(".") == ""), (S) => (openBlock(), createBlock(V, {
2596
- key: S.message,
2597
- text: S.message,
2598
- state: "error"
2599
- }, null, 8, ["text"]))), 128)),
2600
- createElementVNode("div", _hoisted_5$2, toDisplayString(unref(o)("connect.template.mission_pool.preview")), 1),
2601
- (openBlock(), createBlock(E, {
2602
- key: 0,
2603
- variant: "outlined",
2604
- class: "p-24 space-y-16 w-fit"
2605
- }, {
2606
- default: withCtx(() => {
2607
- var S, N;
2608
- return [
2609
- createElementVNode("div", _hoisted_6$2, [
2610
- createElementVNode("div", null, [
2611
- createElementVNode("div", _hoisted_7$2, toDisplayString(unref(o)("connect.template.mission_pool.collect_stamps", { end: e.mission.end })) + " " + toDisplayString(((S = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : S.earningOption.amount) > 1 ? (N = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : N.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? u(e.modelValue[e.modelValue.length - 1]) : ""), 1),
2612
- createElementVNode("div", _hoisted_8$2, toDisplayString(unref(o)("connect.template.mission_pool.earn_stamp")), 1)
2613
- ])
2614
- ]),
2615
- createElementVNode("div", _hoisted_9$2, [
2616
- createVNode(_sfc_main$5, {
2617
- type: e.mission.type,
2618
- "max-range": e.mission.end,
2619
- currentRange: e.mission.end / 4,
2620
- markers: e.modelValue.map((C) => C.threshold)
2621
- }, null, 8, ["type", "max-range", "currentRange", "markers"]),
2622
- e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_10$2, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
2623
- ])
2624
- ];
2625
- }),
2626
- _: 1
2627
- })),
2628
- createVNode(_sfc_main$6, {
2629
- ref_key: "sheetRef",
2630
- ref: s,
2631
- "onUpdate:modelValue": h,
2632
- "max-threshold": e.mission.end
2633
- }, null, 8, ["max-threshold"])
2634
- ]);
2635
- };
2636
- }
2637
- }), _hoisted_1$3 = { class: "space-y-16" }, _hoisted_2$2 = { class: "space-y-8" }, _hoisted_3$2 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_5$1 = { class: "grid grid-cols-2 gap-16" }, _hoisted_6$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_7$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_8$1 = { class: "space-y-8" }, _hoisted_9$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_10$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
2638
- __name: "MissionInput",
2639
- props: {
2640
- modelValue: Object
2641
- },
2642
- emits: ["update:model-value"],
2643
- setup(e, { emit: l }) {
2644
- const { t: o } = useI18n(), i = e, r = computed(() => {
2645
- const n = FdoMission.safeParse(i.modelValue);
2646
- return n.success ? [] : n.error.errors;
2647
- }), g = computed(() => [
2648
- {
2649
- label: o("connect.campaign.mission.typeOption.STAMP.label"),
2650
- description: o("connect.campaign.mission.typeOption.STAMP.description"),
2651
- value: F_MISSION_TYPE.enum.STAMP
2652
- },
2653
- {
2654
- label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
2655
- description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
2656
- value: F_MISSION_TYPE.enum.PROGRESSIVE
2657
- }
2658
- ]), a = l;
2659
- return (n, d) => {
2660
- var p;
2661
- const s = resolveComponent("FmCard"), h = resolveComponent("FmStepperField");
2662
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
2663
- createElementVNode("div", _hoisted_2$2, [
2664
- createElementVNode("div", _hoisted_3$2, toDisplayString(unref(o)("connect.campaign.mission.missionType")), 1),
2665
- createElementVNode("div", _hoisted_4$1, toDisplayString(unref(o)("connect.template.select_game")), 1),
2666
- createElementVNode("div", _hoisted_5$1, [
2667
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (f) => {
2668
- var k, v;
2669
- return openBlock(), createBlock(s, {
2670
- variant: "outlined",
2671
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2672
- "col-span-2": unref(g).length == 1,
2673
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((k = e.modelValue) == null ? void 0 : k.type) == f.value,
2674
- "hover:bg-fm-color-opacity-sm": ((v = e.modelValue) == null ? void 0 : v.type) != f.value
2675
- }]),
2676
- onClick: () => {
2677
- var u, c;
2678
- ((u = e.modelValue) == null ? void 0 : u.type) != f.value && a("update:model-value", {
2679
- ...e.modelValue,
2680
- type: f.value,
2681
- end: ((c = e.modelValue) == null ? void 0 : c.end) || 1
2682
- });
2683
- },
2684
- key: f.value
2685
- }, {
2686
- default: withCtx(() => [
2687
- createElementVNode("div", _hoisted_6$1, toDisplayString(f.label), 1),
2688
- createElementVNode("div", _hoisted_7$1, toDisplayString(f.description), 1)
2689
- ]),
2690
- _: 2
2691
- }, 1032, ["class", "onClick"]);
2692
- }), 128))
2693
- ])
2694
- ]),
2695
- createElementVNode("div", _hoisted_8$1, [
2696
- createElementVNode("div", _hoisted_9$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequired")), 1),
2697
- createElementVNode("div", _hoisted_10$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequiredDescription")), 1),
2698
- createVNode(h, {
2699
- label: unref(o)("connect.campaign.mission.maximumToCollect"),
2700
- "model-value": ((p = e.modelValue) == null ? void 0 : p.end) || null,
2701
- "onUpdate:modelValue": d[0] || (d[0] = (f) => {
2702
- var k;
2703
- return a("update:model-value", {
2704
- ...e.modelValue,
2705
- type: ((k = e.modelValue) == null ? void 0 : k.type) || "STAMP",
2706
- end: f
2707
- });
2708
- }),
2709
- "helper-text": unref(ZodHelper).helperText(unref(r), "end") || unref(o)("connect.campaign.mission.thresholdHelperText"),
2710
- "helper-state": unref(ZodHelper).helperState(unref(r), "end") || "none"
2711
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"])
2712
- ])
2713
- ]);
2714
- };
2715
- }
2716
- });
2717
- function useLocaleText() {
2718
- const { locale: e, t: l } = useI18n();
2719
- function o(i, r) {
2720
- return i ? i[e.value] ?? i["en-US"] ?? l(r) : l(r);
2721
- }
2722
- return { getLocaleText: o };
2723
- }
2724
- const _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
2725
- __name: "TemplateInput",
2726
- props: {
2727
- pushAvailability: {
2728
- type: String,
2729
- default: "checking"
2730
- },
2731
- field: { type: Object, required: !0 },
2732
- modelValue: {
2733
- type: Object
2734
- },
2735
- schema: {
2736
- type: Object
2737
- },
2738
- extras: {
2739
- type: Object
2740
- },
2741
- helperText: {
2742
- type: String
2743
- },
2744
- disabled: {
2745
- type: Boolean,
2746
- default: !1
2747
- },
2748
- campaignType: {
2749
- type: String,
2750
- default: void 0
2751
- },
2752
- /** False until the form has been submitted, for fields that validate late. */
2753
- showValidation: {
2754
- type: Boolean,
2755
- default: !0
2756
- }
2757
- },
2758
- emits: ["retry-push", "update:model-value", "update:file"],
2759
- setup(e, { emit: l }) {
2760
- const { t: o } = useI18n(), { getLocaleText: i } = useLocaleText(), r = e, g = l;
2761
- function a(h) {
2762
- switch (r.field.type) {
2763
- case "timeframe":
2764
- const p = h.startDate ? hooks(h.startDate).startOf("day").toISOString() : void 0, f = h.endDate ? hooks(h.endDate).endOf("day").toISOString() : void 0;
2765
- g("update:model-value", {
2766
- type: "timeframe",
2767
- property: "__now",
2768
- start: p,
2769
- end: f
2770
- });
2771
- break;
2772
- case "image": {
2773
- g(
2774
- "update:file",
2775
- h,
2776
- n.value || firebaseStorage.collectibleImagePath(void 0, h)
2777
- );
2778
- break;
2779
- }
2780
- default:
2781
- g("update:model-value", h);
2782
- break;
2783
- }
2784
- }
2785
- const n = computed(() => {
2786
- switch (r.field.type) {
2787
- case "timeframe": {
2788
- const h = r.modelValue;
2789
- return {
2790
- startDate: h != null && h.start ? hooks(h == null ? void 0 : h.start).format("YYYY-MM-DD") : null,
2791
- endDate: h != null && h.end ? hooks(h == null ? void 0 : h.end).format("YYYY-MM-DD") : null
2792
- };
2793
- }
2794
- default:
2795
- return r.modelValue;
2796
- }
2797
- });
2798
- function d() {
2799
- if (!s.value.schema) return [];
2800
- const h = s.value.schema.safeParse(r.modelValue);
2801
- return h.success ? [] : h.error.errors;
2802
- }
2803
- const s = computed(() => ({
2804
- schema: r.schema,
2805
- unwrapped: r.schema ? ZodHelper.unwrap(r.schema) : void 0,
2806
- rules: r.schema ? [ZodHelper.ruleAtPath(r.schema, "")] : void 0,
2807
- labelMark: r.schema && ZodHelper.isRequired(r.schema) == !1 ? "optional" : void 0,
2808
- zodLabel: r.schema ? ZodHelper.toInputLabel(
2809
- r.schema,
2810
- i(r.field.label_locale, r.field.label ?? "")
2811
- ) : void 0
2812
- }));
2813
- return (h, p) => {
2814
- var m, b, E, V, S;
2815
- const f = resolveComponent("FmTextField"), k = resolveComponent("FmStepperField"), v = resolveComponent("FmTextarea"), u = resolveComponent("FmHelperText"), c = resolveComponent("FmSwitch");
2816
- return e.field.type === "text" ? (openBlock(), createBlock(f, {
2817
- key: 0,
2818
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2819
- "label-mark": unref(s).labelMark,
2820
- rules: unref(s).rules,
2821
- "model-value": unref(n),
2822
- "onUpdate:modelValue": a,
2823
- "helper-state": e.helperText ? "error" : void 0,
2824
- "helper-text": e.helperText
2825
- }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2826
- createVNode(JsonViewer, {
2827
- json: { schema: unref(s).unwrapped, props: r }
2828
- }, null, 8, ["json"]),
2829
- createVNode(k, {
2830
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2831
- "label-mark": e.field.isRuleChildren ? void 0 : unref(s).labelMark,
2832
- "model-value": unref(n),
2833
- rules: e.field.isRuleChildren ? [] : unref(s).rules,
2834
- "onUpdate:modelValue": a,
2835
- "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
2836
- "helper-text": e.field.isRuleChildren ? e.helperText : void 0
2837
- }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
2838
- ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(v, {
2839
- key: 2,
2840
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2841
- "label-mark": unref(s).labelMark,
2842
- rules: unref(s).rules,
2843
- "model-value": unref(n),
2844
- "onUpdate:modelValue": a,
2845
- "show-word-count": "",
2846
- "max-length": (S = (V = (E = (b = (m = unref(s)) == null ? void 0 : m.unwrapped) == null ? void 0 : b._def) == null ? void 0 : E.checks) == null ? void 0 : V.find((N) => N.kind == "max")) == null ? void 0 : S.value
2847
- }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$m, {
2848
- key: 3,
2849
- "campaign-type": e.extras,
2850
- "model-value": unref(n),
2851
- disabled: e.disabled,
2852
- "onUpdate:modelValue": a
2853
- }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
2854
- createVNode(_sfc_main$k, {
2855
- "model-value": unref(n),
2856
- "onUpdate:modelValue": a
2857
- }, null, 8, ["model-value"]),
2858
- createVNode(u, {
2859
- class: "!mt-[8px]",
2860
- text: unref(ZodHelper).helperText(d(), ""),
2861
- state: unref(ZodHelper).helperState(d(), "")
2862
- }, null, 8, ["text", "state"])
2863
- ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$x, {
2864
- key: 5,
2865
- thumbnail: unref(n),
2866
- "aspect-ratio": "16 / 9",
2867
- class: "w-1/2 xs:w-2/3",
2868
- "onUpdate:file": a
2869
- }, {
2870
- label: withCtx(() => [
2871
- (openBlock(), createBlock(resolveDynamicComponent(unref(s).zodLabel)))
2872
- ]),
2873
- _: 1
2874
- }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(c, {
2875
- key: 6,
2876
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2877
- "label-placement": "right",
2878
- sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
2879
- "label-mark": unref(s).labelMark,
2880
- rules: unref(s).rules,
2881
- "model-value": unref(n),
2882
- "onUpdate:modelValue": a
2883
- }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$y, {
2884
- key: 7,
2885
- "model-value": unref(n),
2886
- "onUpdate:modelValue": a,
2887
- "no-campaign": !1,
2888
- schema: unref(s).schema,
2889
- "is-mission": e.extras === "MISSION"
2890
- }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$z, {
2891
- key: 8,
2892
- "model-value": unref(n),
2893
- "onUpdate:modelValue": a
2894
- }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
2895
- createVNode(_sfc_main$A, {
2896
- "model-value": unref(n),
2897
- "onUpdate:modelValue": a,
2898
- "can-set-auto-apply": e.field.property == "campaign.effect"
2899
- }, null, 8, ["model-value", "can-set-auto-apply"]),
2900
- unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(u, {
2901
- key: 0,
2902
- class: "!mt-[8px]",
2903
- text: unref(o)("connect.campaign.common.effect_required"),
2904
- state: "error"
2905
- }, null, 8, ["text"]))
2906
- ], 64)) : e.field.type === "message" ? (openBlock(), createElementBlock(Fragment, { key: 10 }, [
2907
- e.field.property === "campaign.message" ? (openBlock(), createBlock(_sfc_main$e, {
2908
- key: 0,
2909
- "push-availability": e.pushAvailability,
2910
- onRetryPush: p[0] || (p[0] = (N) => g("retry-push")),
2911
- "show-validation": e.showValidation,
2912
- "model-value": unref(n),
2913
- "onUpdate:modelValue": a,
2914
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2915
- "trigger-type": e.field.extras,
2916
- "helper-state": unref(ZodHelper).helperState(d(), "")
2917
- }, null, 8, ["push-availability", "show-validation", "model-value", "helper-text", "trigger-type", "helper-state"])) : (openBlock(), createBlock(_sfc_main$s, {
2918
- key: 1,
2919
- "allow-email": !0,
2920
- "allow-whatsapp": !0,
2921
- "model-value": unref(n),
2922
- "onUpdate:modelValue": a,
2923
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2924
- "trigger-type": e.field.extras,
2925
- "helper-state": unref(ZodHelper).helperState(d(), "")
2926
- }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"]))
2927
- ], 64)) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$u, {
2928
- key: 11,
2929
- "model-value": unref(n),
2930
- "onUpdate:modelValue": a,
2931
- extras: e.extras,
2932
- "error-text": e.helperText
2933
- }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$v, {
2934
- key: 12,
2935
- type: "custom",
2936
- "model-value": unref(n),
2937
- "onUpdate:modelValue": a,
2938
- "helper-text": e.helperText || unref(ZodHelper).helperText(d(), ""),
2939
- "for-credit": r.campaignType === "CREDIT"
2940
- }, null, 8, ["model-value", "helper-text", "for-credit"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$c, {
2941
- key: 13,
2942
- "model-value": unref(n),
2943
- "onUpdate:modelValue": a
2944
- }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
2945
- key: 14,
2946
- "model-value": unref(n),
2947
- "onUpdate:modelValue": a
2948
- }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
2949
- key: 15,
2950
- "model-value": unref(n),
2951
- "onUpdate:modelValue": a
2952
- }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
2953
- key: 16,
2954
- "model-value": unref(n),
2955
- "onUpdate:modelValue": a
2956
- }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
2957
- key: 17,
2958
- "model-value": unref(n),
2959
- "onUpdate:modelValue": a,
2960
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2961
- "helper-state": unref(ZodHelper).helperState(d(), "")
2962
- }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
2963
- key: 18,
2964
- "model-value": unref(n),
2965
- "onUpdate:modelValue": a,
2966
- mission: e.extras.mission
2967
- }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
2968
- createVNode(_sfc_main$d, {
2969
- "model-value": unref(n),
2970
- "onUpdate:modelValue": a,
2971
- "start-date": e.extras.start,
2972
- "end-date": e.extras.end
2973
- }, null, 8, ["model-value", "start-date", "end-date"]),
2974
- e.helperText ? (openBlock(), createBlock(u, {
2975
- key: 0,
2976
- class: "!mt-[8px]",
2977
- text: e.helperText,
2978
- state: "error"
2979
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2980
- ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
2981
- createVNode(_sfc_main$B, {
2982
- "model-value": unref(n),
2983
- "onUpdate:modelValue": a
2984
- }, null, 8, ["model-value"]),
2985
- e.helperText ? (openBlock(), createBlock(u, {
2986
- key: 0,
2987
- class: "!mt-[8px]",
2988
- text: e.helperText,
2989
- state: "error"
2990
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2991
- ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
2992
- e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(n).rules.g_time).length > 0 ? (openBlock(), createBlock(u, {
2993
- key: 0,
2994
- state: "warning",
2995
- text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
2996
- }, null, 8, ["text"])) : createCommentVNode("", !0),
2997
- createVNode(_sfc_main$o, {
2998
- "model-value": unref(n),
2999
- "onUpdate:modelValue": a
3000
- }, null, 8, ["model-value"]),
3001
- e.helperText ? (openBlock(), createBlock(u, {
3002
- key: 1,
3003
- class: "!mt-[8px]",
3004
- text: e.helperText,
3005
- state: "error"
3006
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3007
- ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
3008
- createVNode(_sfc_main$C, {
3009
- "model-value": unref(n),
3010
- "onUpdate:modelValue": a
3011
- }, null, 8, ["model-value"]),
3012
- e.helperText ? (openBlock(), createBlock(u, {
3013
- key: 0,
3014
- class: "!mt-[8px]",
3015
- text: e.helperText,
3016
- state: "error"
3017
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3018
- ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
3019
- createVNode(_sfc_main$D, {
3020
- "model-value": unref(n),
3021
- "onUpdate:modelValue": a
3022
- }, null, 8, ["model-value"]),
3023
- e.helperText ? (openBlock(), createBlock(u, {
3024
- key: 0,
3025
- class: "!mt-[8px]",
3026
- text: e.helperText,
3027
- state: "error"
3028
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3029
- ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
3030
- createVNode(_sfc_main$n, {
3031
- "model-value": unref(n),
3032
- "onUpdate:modelValue": a
3033
- }, null, 8, ["model-value"]),
3034
- e.helperText ? (openBlock(), createBlock(u, {
3035
- key: 0,
3036
- class: "!mt-[8px]",
3037
- text: e.helperText,
3038
- state: "error"
3039
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3040
- ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
3041
- createVNode(_sfc_main$9, {
3042
- "model-value": unref(n),
3043
- "onUpdate:modelValue": a
3044
- }, null, 8, ["model-value"]),
3045
- e.helperText ? (openBlock(), createBlock(u, {
3046
- key: 0,
3047
- class: "!mt-[8px]",
3048
- text: e.helperText,
3049
- state: "error"
3050
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3051
- ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(r.field), 1));
3052
- };
3053
- }
3054
- }), _hoisted_1$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_2$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$1 = { class: "fm-typo-en-body-lg-600" }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
3055
- __name: "CampaignSummary",
3056
- props: {
3057
- data: {
3058
- type: Object,
3059
- required: !0
3060
- }
3061
- },
3062
- setup(e) {
3063
- const { t: l, te: o } = useI18n();
3064
- function i(r) {
3065
- return o(r) || o(r, "en-US");
3066
- }
3067
- return (r, g) => {
3068
- const a = resolveComponent("FmCard");
3069
- return openBlock(), createBlock(a, {
3070
- variant: "outlined",
3071
- class: "p-16 space-y-8"
3072
- }, {
3073
- default: withCtx(() => [
3074
- createElementVNode("div", _hoisted_1$1, toDisplayString(unref(l)("connect.campaign.common.summary")), 1),
3075
- g[0] || (g[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
3076
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (n, d) => (openBlock(), createElementBlock("div", {
3077
- class: "space-y-4",
3078
- key: d
3079
- }, [
3080
- n ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3081
- createElementVNode("div", _hoisted_2$1, toDisplayString(unref(l)(`${d}`)), 1),
3082
- createElementVNode("div", _hoisted_3$1, toDisplayString(i(`${n}`) ? unref(l)(`${n}`) : n), 1)
3083
- ], 64)) : createCommentVNode("", !0)
3084
- ]))), 128))
3085
- ]),
3086
- _: 1
3087
- });
3088
- };
3089
- }
3090
- }), _hoisted_1 = { class: "xs:hidden px-24 pb-[14px] pt-[22px] flex items-center justify-between w-full border-b" }, _hoisted_2 = { class: "flex items-center gap-8" }, _hoisted_3 = {
3091
- key: 0,
3092
- class: "max-w-6xl mx-auto"
3093
- }, _hoisted_4 = { class: "hidden xs:!flex gap-8 items-center w-full px-16 py-8 border-b border-fm-color-neutral-gray-100" }, _hoisted_5 = { class: "grid grid-cols-3 gap-40" }, _hoisted_6 = { class: "col-span-2 space-y-40 xs:col-span-3 xs:px-16 xs:pt-16" }, _hoisted_7 = { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, _hoisted_8 = { class: "w-full flex items-center justify-end gap-8 pb-24" }, _hoisted_9 = { class: "max-w-6xl mx-auto rounded-md p-4 w-full" }, _hoisted_10 = { class: "animate-pulse flex space-x-4 pt-16" }, _hoisted_11 = { class: "grid grid-cols-3 w-full gap-40" }, _sfc_main = /* @__PURE__ */ defineComponent({
3094
- __name: "EditCampaignSheet",
3095
- emits: ["submit:model-value"],
3096
- setup(__props, { expose: __expose, emit: __emit }) {
3097
- const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), { getLocaleText } = useLocaleText(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
3098
- TEMPLATES.VOUCHER
3099
- ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign"), campaignType = ref("VOUCHER"), pushAvailability = ref("checking");
3100
- let availabilityRequest = 0;
3101
- async function checkPushAvailability() {
3102
- const e = ++availabilityRequest, l = SvcConfig.getBusinessId();
3103
- pushAvailability.value = "checking";
3104
- try {
3105
- if (!l) throw new Error("Business ID is unavailable");
3106
- const i = await getNativeApp(l);
3107
- o() && (pushAvailability.value = i ? "native" : "non-native");
3108
- } catch {
3109
- o() && (pushAvailability.value = "failed");
3110
- }
3111
- function o() {
3112
- return e === availabilityRequest && sheetVisible.value && campaignType.value === "BROADCAST" && SvcConfig.getBusinessId() === l;
3113
- }
3114
- }
3115
- watch(
3116
- sheetVisible,
3117
- (e) => {
3118
- e || ++availabilityRequest;
3119
- },
3120
- { flush: "sync" }
3121
- ), onBeforeUnmount(() => {
3122
- ++availabilityRequest;
3123
- });
3124
- const pushBlocked = computed(
3125
- () => {
3126
- var e;
3127
- return campaignType.value === "BROADCAST" && toDelivery(((e = data.value) == null ? void 0 : e.campaign) ?? {}).channels.includes("PUSH") && pushAvailability.value !== "native";
3128
- }
3129
- );
3130
- async function showSheet(visible, type, campaign, selectedTemplate) {
3131
- var e, l, o;
3132
- if (sheetVisible.value = visible, campaignType.value = type, ++availabilityRequest, !!visible) {
3133
- type === "BROADCAST" && checkPushAvailability();
3134
- try {
3135
- isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
3136
- } catch {
3137
- } finally {
3138
- await new Promise((i) => setTimeout(i, 120)), isLoading.value = !1;
3139
- }
3140
- template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((i, r) => {
3141
- var g;
3142
- if (i.campaign.type === "VOUCHER" && i.campaign.code) {
3143
- const a = (g = i.campaign._id) == null ? void 0 : g.toString();
3144
- useCampaignStore().campaigns.voucher.some(
3145
- (n) => n.code === i.campaign.code && n._id.toString() !== a
3146
- ) && r.addIssue({
3147
- code: "custom",
3148
- message: "Code already exists, please use another code",
3149
- path: ["campaign", "code"]
3150
- });
3151
- }
3152
- })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
3153
- ...(l = template.value) == null ? void 0 : l.defaultValue
3154
- }), "configs" in data.value && typeof data.value.configs == "string" && (data.value.configs = eval(data.value.configs)), data.value = cleanPF(data.value), type === "BROADCAST" && normaliseBroadcastDelivery(data.value.campaign), data.value.templateId = SvcConfig.getBusinessId(), data.value.campaign.business = SvcConfig.getBusinessId(), data.value.campaign.templateId = SvcConfig.getBusinessId(), "configs" in data.value && (data.value.configs.business = SvcConfig.getBusinessId()), currentStep.value = 1, submitAttempted.value = !1, sheetTitle.value = (o = campaign == null ? void 0 : campaign.campaign) != null && o._id ? t("connect.campaign.common.edit_campaign_title", {
3155
- typeName: t(`connect.campaign.common.typeName.${type}`)
3156
- }) : t("connect.campaign.common.create_campaign_title", {
3157
- typeName: t(`connect.campaign.common.typeName.${type}`)
3158
- });
3159
- }
3160
- }
3161
- async function hideSheet() {
3162
- Dialog.open({
3163
- title: t("connect.campaign.common.unsaved_changes"),
3164
- message: t("connect.campaign.common.unsaved_changes"),
3165
- primaryActions: {
3166
- text: t("connect.campaign.common.unsaved_changes_confirm"),
3167
- close: !0
3168
- },
3169
- secondaryActions: {
3170
- text: t("connect.campaign.common.unsaved_changes_cancel"),
3171
- close: !1
3172
- }
3173
- }).onPrimary(() => {
3174
- sheetVisible.value = !1;
3175
- }).onSecondary(() => {
3176
- Dialog.close();
3177
- });
3178
- }
3179
- const emits = __emit, errors = computed(() => {
3180
- const e = schema.value.superRefine(campaignRefinement).safeParse(data.value), l = e.success ? [] : [...e.error.errors];
3181
- return pushBlocked.value && l.push({
3182
- code: "custom",
3183
- path: ["campaign", "delivery", "channels"],
3184
- message: t(
3185
- "connect.campaign.broadcast.pushAvailability.removeBeforeSave"
3186
- )
3187
- }), l;
3188
- });
3189
- function stepErrors(e = currentStep.value - 1) {
3190
- const l = template.value.steps[e].groups.flatMap(
3191
- (o) => o.fields.map((i) => schemaPathForField(i.property))
3192
- );
3193
- return errors.value.filter(
3194
- (o) => l.some((i) => o.path.join(".").includes(i))
3195
- );
3196
- }
3197
- const validateOnSubmit = computed(() => campaignType.value === "BROADCAST"), submitAttempted = ref(!1), showValidation = computed(
3198
- () => !validateOnSubmit.value || submitAttempted.value
3199
- ), visibleErrors = computed(
3200
- () => showValidation.value ? errors.value : []
3201
- );
3202
- function hasVisibleStepErrors(e) {
3203
- return showValidation.value && stepErrors(e).length > 0;
3204
- }
3205
- function isNextDisabled() {
3206
- return validateOnSubmit.value ? !1 : currentStep.value - 1 < template.value.steps.length - 1 ? stepErrors().length > 0 : errors.value.length > 0;
3207
- }
3208
- function onNext() {
3209
- if (stepErrors().length > 0) {
3210
- submitAttempted.value = !0;
3211
- return;
3212
- }
3213
- submitAttempted.value = !1, currentStep.value++;
3214
- }
3215
- __expose({ showSheet });
3216
- function showSummaryDialog() {
3217
- Dialog.open({
3218
- title: "",
3219
- dialogComponent: _sfc_main$1,
3220
- dialogComponentProps: {
3221
- data: data.value
3222
- }
3223
- });
3224
- }
3225
- const broadcastDelivery = computed(
3226
- () => {
3227
- var e;
3228
- return (e = data.value) != null && e.campaign ? toDelivery(data.value.campaign) : void 0;
3229
- }
3230
- );
3231
- function valueForField(e) {
3232
- return e === "campaign.message" ? broadcastDelivery.value : _.get(data.value, e);
3233
- }
3234
- function schemaPathForField(e) {
3235
- return e === "campaign.message" ? "campaign.delivery" : e;
3236
- }
3237
- function onUpdateProperty(e, l) {
3238
- var o, i, r, g, a, n, d, s;
3239
- if (e === "campaign.message" && l && "channels" in l) {
3240
- _.set(data.value, "campaign.delivery", l);
3241
- const h = toLegacyMessage(l);
3242
- h ? _.set(data.value, "campaign.message", h) : delete data.value.campaign.message;
3243
- return;
3244
- }
3245
- if (_.set(data.value, e, l), e == "campaign.event.type") {
3246
- const p = ((g = (r = (i = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : i.campaign) == null ? void 0 : r.event) == null ? void 0 : g.rule) ? _.cloneDeep({
3247
- ...(s = (d = (n = (a = template.value) == null ? void 0 : a.defaultValue) == null ? void 0 : n.campaign) == null ? void 0 : d.event) == null ? void 0 : s.rule
3248
- }) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
3249
- RuleBuilder.scaffoldGroup("g_schedule"),
3250
- RuleBuilder.scaffoldGroup("g_time"),
3251
- RuleBuilder.scaffoldGroup("g_user"),
3252
- RuleBuilder.scaffoldGroup("g_bill")
3253
- ]), f = RuleBuilder.setRuleToGroup(
3254
- RuleBuilder.scaffoldGroup("g_schedule"),
3255
- [
3256
- RuleBuilder.constructEntry(
3257
- "trigger.date",
3258
- "_rrule",
3259
- "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
3260
- ),
3261
- RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
3262
- ],
3263
- "&&"
3264
- );
3265
- if (l != "SCHEDULE") {
3266
- _.set(data.value, "campaign.event.rule", p);
3267
- return;
3268
- }
3269
- _.set(
3270
- data.value,
3271
- "campaign.event.rule",
3272
- RuleBuilder.setRuleToGroup(p, f)
3273
- );
3274
- }
3275
- e == "campaign.notify" && l == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
3276
- }
3277
- async function onUpdateFile(e, l) {
3278
- return e ? await minor(async () => firebaseStorage.update(l, e), {
3279
- message: `${e ? "Uploading" : "Removing"} file`,
3280
- successMessage: `File ${e ? "uploaded" : "removed"} successfully`
3281
- }) : "";
3282
- }
3283
- function isDisable(e) {
3284
- var l, o;
3285
- switch (e == null ? void 0 : e.property) {
3286
- case "campaign.event.type":
3287
- return ((o = (l = data.value) == null ? void 0 : l.campaign) == null ? void 0 : o._id) || !1;
3288
- default:
3289
- return !1;
3290
- }
3291
- }
3292
- function onSubmit() {
3293
- if (submitAttempted.value = !0, pushBlocked.value) return;
3294
- const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
3295
- e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
3296
- }
3297
- return (e, l) => {
3298
- const o = resolveComponent("FmButton"), i = resolveComponent("FmStep"), r = resolveComponent("FmStepper"), g = resolveComponent("FmCard"), a = resolveComponent("FmTopSheet");
3299
- return openBlock(), createBlock(a, {
3300
- "fullscreen-size": "lg",
3301
- modelValue: unref(sheetVisible),
3302
- "onUpdate:modelValue": [
3303
- l[7] || (l[7] = (n) => isRef(sheetVisible) ? sheetVisible.value = n : null),
3304
- l[8] || (l[8] = (n) => sheetVisible.value = n)
3305
- ]
3306
- }, createSlots({
3307
- "top-sheet-header": withCtx(() => [
3308
- createElementVNode("div", _hoisted_1, [
3309
- createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
3310
- createElementVNode("div", _hoisted_2, [
3311
- createVNode(o, {
3312
- onClick: l[0] || (l[0] = (n) => hideSheet()),
3313
- label: unref(t)("connect.campaign.common.cancel"),
3314
- variant: "tertiary"
3315
- }, null, 8, ["label"]),
3316
- createVNode(o, {
3317
- onClick: onSubmit,
3318
- label: unref(t)("connect.campaign.common.save"),
3319
- disabled: !unref(validateOnSubmit) && unref(errors).length > 0
3320
- }, null, 8, ["label", "disabled"])
3321
- ])
3322
- ])
3323
- ]),
3324
- _: 2
3325
- }, [
3326
- unref(isLoading) ? {
3327
- name: "default",
3328
- fn: withCtx(() => [
3329
- createElementVNode("div", _hoisted_9, [
3330
- createElementVNode("div", _hoisted_10, [
3331
- createElementVNode("div", _hoisted_11, [
3332
- l[9] || (l[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
3333
- createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
3334
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
3335
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
3336
- createElementVNode("div", { class: "space-y-3" }, [
3337
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
3338
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
3339
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3340
- ]),
3341
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3342
- ]),
3343
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
3344
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
3345
- createElementVNode("div", { class: "space-y-3" }, [
3346
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
3347
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
3348
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3349
- ]),
3350
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3351
- ])
3352
- ])
3353
- ], -1)),
3354
- createVNode(g, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
3355
- ])
3356
- ])
3357
- ])
3358
- ]),
3359
- key: "1"
3360
- } : {
3361
- name: "default",
3362
- fn: withCtx(() => [
3363
- unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
3364
- createVNode(r, {
3365
- modelValue: unref(currentStep),
3366
- "onUpdate:modelValue": l[1] || (l[1] = (n) => isRef(currentStep) ? currentStep.value = n : null),
3367
- orientation: "horizontal",
3368
- class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
3369
- }, {
3370
- default: withCtx(() => [
3371
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, d) => (openBlock(), createBlock(i, {
3372
- key: n.name,
3373
- title: unref(getLocaleText)(n.name_locale, n.name),
3374
- value: d + 1,
3375
- error: () => hasVisibleStepErrors(d),
3376
- complete: () => d + 1 <= unref(currentStep)
3377
- }, null, 8, ["title", "value", "error", "complete"]))), 128))
3378
- ]),
3379
- _: 1
3380
- }, 8, ["modelValue"]),
3381
- createElementVNode("div", _hoisted_4, [
3382
- createVNode(o, {
3383
- icon: "close",
3384
- variant: "tertiary",
3385
- onClick: l[2] || (l[2] = (n) => sheetVisible.value = !1)
3386
- }),
3387
- createVNode(r, {
3388
- modelValue: unref(currentStep),
3389
- "onUpdate:modelValue": l[3] || (l[3] = (n) => isRef(currentStep) ? currentStep.value = n : null),
3390
- orientation: "horizontal",
3391
- class: "flex-1"
3392
- }, {
3393
- default: withCtx(() => [
3394
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, d) => (openBlock(), createBlock(i, {
3395
- key: n.name,
3396
- title: unref(sheetTitle),
3397
- description: unref(getLocaleText)(n.name_locale, n.name),
3398
- value: d + 1,
3399
- error: () => hasVisibleStepErrors(d),
3400
- complete: () => d + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
3401
- }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
3402
- ]),
3403
- _: 1
3404
- }, 8, ["modelValue"]),
3405
- createVNode(o, {
3406
- icon: "info",
3407
- variant: "tertiary",
3408
- onClick: l[4] || (l[4] = () => showSummaryDialog())
3409
- })
3410
- ]),
3411
- createElementVNode("div", _hoisted_5, [
3412
- createElementVNode("div", _hoisted_6, [
3413
- createVNode(JsonViewer, {
3414
- json: {
3415
- data: unref(data),
3416
- errors: unref(errors).map(
3417
- (n) => `${n.path.join(".")} - ${n.message}`
3418
- ),
3419
- stepErrors: stepErrors().map(
3420
- (n) => `${n.path.join(".")} - ${n.message}`
3421
- ),
3422
- schema: unref(schema)
3423
- }
3424
- }, null, 8, ["json"]),
3425
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
3426
- (n) => n.fields.length && (!n.condition || (Array.isArray(n.condition) ? n.condition.every((d) => unref(_).get(unref(data), d.property) == d.value == (d.not != !0)) : unref(_).get(unref(data), n.condition.property) == n.condition.value == (n.condition.not != !0)))
3427
- ), (n, d) => (openBlock(), createElementBlock("div", {
3428
- key: d,
3429
- class: "space-y-24"
3430
- }, [
3431
- createElementVNode("div", _hoisted_7, toDisplayString(unref(getLocaleText)(n.name_locale, n.name ?? "")), 1),
3432
- (openBlock(!0), createElementBlock(Fragment, null, renderList(n.fields, (s, h) => (openBlock(), createElementBlock("div", { key: h }, [
3433
- (openBlock(), createBlock(_sfc_main$2, {
3434
- key: h,
3435
- field: s,
3436
- modelValue: valueForField(s.property),
3437
- disabled: isDisable(s),
3438
- "campaign-type": unref(campaignType),
3439
- "show-validation": unref(showValidation),
3440
- "push-availability": unref(pushAvailability),
3441
- onRetryPush: checkPushAvailability,
3442
- "onUpdate:modelValue": (p) => onUpdateProperty(s.property, p),
3443
- "onUpdate:file": async (p, f) => {
3444
- const k = await onUpdateFile(p, f);
3445
- onUpdateProperty(s.property, k || "");
3446
- },
3447
- schema: unref(ZodHelper).typeAtPath(
3448
- unref(schema),
3449
- schemaPathForField(s.property),
3450
- unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
3451
- ),
3452
- "helper-state": unref(ZodHelper).helperState(
3453
- unref(visibleErrors),
3454
- schemaPathForField(s.property)
3455
- ),
3456
- "helper-text": unref(ZodHelper).helperText(
3457
- unref(visibleErrors),
3458
- schemaPathForField(s.property)
3459
- ),
3460
- extras: s.extras != null ? s.extras == "" ? unref(data) : unref(_).get(unref(data), s.extras) : void 0
3461
- }, null, 8, ["field", "modelValue", "disabled", "campaign-type", "show-validation", "push-availability", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
3462
- ]))), 128))
3463
- ]))), 128)),
3464
- createElementVNode("div", _hoisted_8, [
3465
- createVNode(o, {
3466
- label: unref(t)("connect.common.back"),
3467
- variant: "tertiary",
3468
- disabled: unref(currentStep) == 1,
3469
- onClick: l[5] || (l[5] = (n) => currentStep.value--)
3470
- }, null, 8, ["label", "disabled"]),
3471
- createVNode(o, {
3472
- disabled: isNextDisabled(),
3473
- label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? unref(t)("connect.common.next") : unref(t)("connect.common.submit"),
3474
- onClick: l[6] || (l[6] = (n) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? onNext() : onSubmit())
3475
- }, null, 8, ["disabled", "label"])
3476
- ])
3477
- ]),
3478
- createVNode(_sfc_main$1, {
3479
- data: unref(data),
3480
- class: "xs:hidden"
3481
- }, null, 8, ["data"])
3482
- ])
3483
- ])) : createCommentVNode("", !0)
3484
- ]),
3485
- key: "0"
3486
- }
3487
- ]), 1032, ["modelValue"]);
3488
- };
3489
- }
3490
- });
3491
- export {
3492
- _sfc_main as _,
3493
- useLocaleText as u
3494
- };