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