@feedmepos/mf-connect 0.1.118-prod → 0.1.119-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 (149) hide show
  1. package/README.md +12 -8
  2. package/dist/{App-BHcTqLff.js → App-z-u6skb5.js} +349 -337
  3. package/dist/AuditLogs-J0UJ3HJW.js +2016 -0
  4. package/dist/{Bin-DWhXJmHo.js → Bin-Dh9RAgYi.js} +8 -8
  5. package/dist/{Broadcast-Ct1DL8Pd.js → Broadcast-Dg6azPS8.js} +22 -21
  6. package/dist/{CampaignAnalytic-BSEKCM-4.js → CampaignAnalytic-CVB4dstO.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BxRg2Wu8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DYgBeT23.js} +8 -9
  8. package/dist/{Card-B7DwrAPH.js → Card-CY736Ul0.js} +22 -22
  9. package/dist/{Collections-BJw4JJq_.js → Collections-CdTKWkZZ.js} +197 -185
  10. package/dist/{Credit-BteIGXkp.js → Credit-CUhEKlMI.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CSFwIzOS.js → DateRangeChip.vue_vue_type_script_setup_true_lang-CBwgeTXh.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BC4jTtVY.js +4439 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BDZ21UHA.js → EffectSheet.vue_vue_type_style_index_0_lang-D5-EKqG9.js} +30 -30
  14. package/dist/{Experience-C_VQVfJX.js → Experience-CMp09U-6.js} +32 -31
  15. package/dist/{FileSaver.min-CMiQUZQE.js → FileSaver.min-Bq5McdmK.js} +1 -1
  16. package/dist/{Game-BiHMrMBF.js → Game-Dv5NvG-q.js} +19 -18
  17. package/dist/{GiftCardSetup-DtJIm6oI.js → GiftCardSetup-SO2Tk5In.js} +31 -31
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-BKGnPAEj.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CgG5vHCp.js} +7 -7
  19. package/dist/{Goals-B7VjLMDT.js → Goals-BEwQP4cY.js} +4 -4
  20. package/dist/Grab-npbL7p7S.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-C9ecPgpJ.js → ImageInput.vue_vue_type_script_setup_true_lang-BDGEqsWE.js} +1 -1
  22. package/dist/{Index-D_DIHKZG.js → Index-8F2LOWng.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DSwB0Ubn.js → LocationPicker.vue_vue_type_script_setup_true_lang-BwAjki7Y.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-dk8_eVwd.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DK4C0Y9j.js} +1 -1
  25. package/dist/{LoyaltyDashboard-DOgHeJdK.js → LoyaltyDashboard-rWm0b8cm.js} +15 -15
  26. package/dist/{MainLayout-CfYgoXLS.js → MainLayout-ezbgp2IQ.js} +1 -1
  27. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Bz2LGHUd.js → MainLayout.vue_vue_type_script_setup_true_lang-1QY5-U5y.js} +3 -3
  28. package/dist/{Marketing-B6TCrwaR.js → Marketing-DcWF4xVc.js} +4 -4
  29. package/dist/{MarketingMaterialEdit-Bu3a9NGj.js → MarketingMaterialEdit-C1bXj_hU.js} +214 -211
  30. package/dist/{Member-X51KrYXV.js → Member-CgDZqGsV.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-CYU21JaO.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dh1_j06F.js} +39 -47
  32. package/dist/{MemberImportHistory-CHd9fx7E.js → MemberImportHistory-DT3QJ5se.js} +7 -7
  33. package/dist/{MemberList-D4L3bSlw.js → MemberList-Bm05jnbk.js} +103 -105
  34. package/dist/{MemberTransactions-CEgjfhnX.js → MemberTransactions-D90tTpdC.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-zsaig_yK.js → MessageInput.vue_vue_type_script_setup_true_lang-jvgjOXXA.js} +12 -12
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-YZQkKG66.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CxL-Nh6i.js} +1 -1
  37. package/dist/{Mission-BEVtvY0-.js → Mission-D_l2eJI3.js} +22 -21
  38. package/dist/{Overview-DVoXXZ16.js → Overview-1AYfTeMD.js} +20 -20
  39. package/dist/{Overview-4QRkldza.js → Overview-BOZBnorP.js} +145 -144
  40. package/dist/{Point-BJmebaL9.js → Point-Cqy4XzeG.js} +22 -21
  41. package/dist/{Promotion-DWZZBofu.js → Promotion-9RDNbCgB.js} +137 -131
  42. package/dist/{Queue-DLdsyhCT.js → Queue-D2Eie_np.js} +45 -45
  43. package/dist/{Record-QOD3XELf.js → Record-e4B--FD8.js} +9 -9
  44. package/dist/{Review-CKmhyuqj.js → Review-DcUpSvc-.js} +2 -2
  45. package/dist/ReviewFacebookCallback-BhHdYb4X.js +225 -0
  46. package/dist/{ReviewGoogleCallback-CDriVQPZ.js → ReviewGoogleCallback-JPkamgo2.js} +5 -5
  47. package/dist/Reward-BQJw-R8V.js +444 -0
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-ZgYX2QwC.js → RewardGroup.vue_vue_type_script_setup_true_lang-D_DSQ8q2.js} +13 -13
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DfWjXTx3.js +1923 -0
  50. package/dist/{Segment-URdB0lnl.js → Segment-Cjdqsqqg.js} +303 -306
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DmI2LAsz.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-g-CJUZBF.js} +14 -14
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BCEgZzA4.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-lbH0b170.js} +4 -4
  53. package/dist/{Setting-BDIHH2Wk.js → Setting-B3HK4mtx.js} +159 -148
  54. package/dist/{SettingAdvertisements-CkJYZnIN.js → SettingAdvertisements-BQFJpdIm.js} +12 -12
  55. package/dist/Settings-DKWkiRuA.js +286 -0
  56. package/dist/{Store-CV0kYncl.js → Store-mp1LyXwr.js} +28 -28
  57. package/dist/{StoreRewards-30kSkAZ_.js → StoreRewards-DiSB6d7_.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BAYKqf-Y.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-be7ksTJw.js +7007 -0
  60. package/dist/{Tier-DiQSC3iv.js → Tier-CxaXh96q.js} +2575 -687
  61. package/dist/{Title-DixxpjAg.js → Title-Byz0TGpi.js} +95 -94
  62. package/dist/{Transaction-DQK4LUGD.js → Transaction-CNXulI3o.js} +2 -2
  63. package/dist/Upselling-Dto64bmE.js +1013 -0
  64. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CL-GKkuD.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C0bfVZf8.js} +26 -26
  65. package/dist/{Voucher-CSVlk_Hr.js → Voucher-CVw3E8Y4.js} +19 -19
  66. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CiSoy0Ky.js → VoucherEditor.vue_vue_type_script_setup_true_lang-C0d3ktXA.js} +12 -12
  67. package/dist/{WhatsappAccount-CQYbv2Ew.js → WhatsappAccount-5vLzjaIV.js} +6 -6
  68. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-DjgRo9iA.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CwGBRX-Q.js} +1 -1
  69. package/dist/{WhatsappBot-DdO9Bfvh.js → WhatsappBot-BWJbD7Gk.js} +6 -6
  70. package/dist/{WhatsappBotLogs-CjjWJGND.js → WhatsappBotLogs-C8gpmZyC.js} +6 -6
  71. package/dist/{WhatsappBotSettings-DYGx-kRr.js → WhatsappBotSettings-BvPnKHz-.js} +4 -4
  72. package/dist/WhatsappLayout-DJXhXeXf.js +21 -0
  73. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DTUytfe5.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BxUYjrWQ.js} +3 -3
  74. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DdCUr_Zm.js → ZodTextField.vue_vue_type_script_setup_true_lang-CkjzVKif.js} +2 -2
  75. package/dist/{app-CqQeNnGq.js → app-BF1vds2J.js} +11496 -10741
  76. package/dist/app.js +4 -3
  77. package/dist/{base.export-Dls5LQeu.js → base.export-B7FU8J4P.js} +2 -2
  78. package/dist/{business-gvLSQklz.js → business-DkUMhys1.js} +1 -1
  79. package/dist/{campaign-Cd6GmA4U.js → campaign-0AgQP43B.js} +34 -28
  80. package/dist/{campaign-BqazvOUj.js → campaign-C9cVkGMF.js} +121 -94
  81. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-Dx-Zo68Q.js} +2 -1
  82. package/dist/campaign.fn-N6rJeDUx.js +776 -0
  83. package/dist/{collection.fn-CERMsFPh.js → collection.fn-B_QnW0e3.js} +2 -2
  84. package/dist/{currency-IkiKiNg1.js → currency-XQmondpC.js} +1 -1
  85. package/dist/duplicateCampaign-CvQRWP-Z.js +51 -0
  86. package/dist/{effect-j_T62HBN.js → effect-Mwn1x6qN.js} +1 -1
  87. package/dist/{email-addresses-CN1kPlEj.js → email-addresses-DQQAi6-l.js} +2 -2
  88. package/dist/{feature-flag-DDfyOLsv.js → feature-flag-B1VMMZMd.js} +144 -144
  89. package/dist/google-BQK68wbe.js +5 -0
  90. package/dist/{helper-DVUe13eh.js → helper-D1R8vyjc.js} +1 -1
  91. package/dist/{index-fNYUguDQ.js → index-BU6CU5MP.js} +389 -232
  92. package/dist/{index-DALsfLV7.js → index-Bm43wR8L.js} +2699 -2613
  93. package/dist/{index-jS16KX9p.js → index-Bym-ZIcv.js} +1 -1
  94. package/dist/{index-BvoOJdfc.js → index-C9Nbb7wc.js} +2 -2
  95. package/dist/{index-UJHdDEG1.js → index-CLlGMbnP.js} +1 -1
  96. package/dist/{index-BvkqHehI.js → index-CPB7j8Wn.js} +10 -10
  97. package/dist/{index-COuLtOaw.js → index-CRAuAyO3.js} +1 -1
  98. package/dist/{index-k7FFxt_M.js → index-Cg8Z5eYT.js} +2 -2
  99. package/dist/{index-CPyK4a5J.js → index-CzE9ZPDV.js} +4 -4
  100. package/dist/{index-Cjy0SXCn.js → index-D5BwAYuA.js} +197 -197
  101. package/dist/{index-ep_Kxxid.js → index-DMfCzjiA.js} +2 -2
  102. package/dist/{index-DMiaWY0s.js → index-DQnCdGWe.js} +682 -581
  103. package/dist/{index-D_1pnadB.js → index-DaUhJ6xV.js} +29 -15
  104. package/dist/{index-9RBtEPPj.js → index-P8DDRVa3.js} +1 -1
  105. package/dist/{index-C_SaKemI.js → index-Rs75lw-x.js} +1 -1
  106. package/dist/{index-C-IajuP1.js → index-ZYrey0SM.js} +10 -10
  107. package/dist/{index-CWGbeg5X.js → index-eR9mqPPV.js} +19 -6
  108. package/dist/{index-BmIfGArh.js → index-mOGrVzUV.js} +3 -3
  109. package/dist/{index-lzQ6ehOk.js → index-ug7pxPAX.js} +608 -251
  110. package/dist/{index-DzbVgUEP.js → index-ytSMcSMt.js} +1 -1
  111. package/dist/{index.esm2017-vJKhLfdu.js → index.esm2017-Gkctw9Mb.js} +111 -111
  112. package/dist/{loading-jZV2Dm--.js → loading-kUQqT44G.js} +1 -1
  113. package/dist/{lodash-C2pLek0l.js → lodash-B4AjV7YZ.js} +1 -1
  114. package/dist/{member-import-BKI7soRD.js → member-import-CwDUG5mj.js} +1 -1
  115. package/dist/{membership-smdlFpPr.js → membership-BI6U8-eM.js} +2 -2
  116. package/dist/{money-5XyTnYwW.js → money-Bum-AbB7.js} +1 -1
  117. package/dist/{number-DHU9qJJQ.js → number-uAoNqG-N.js} +1 -1
  118. package/dist/objectid-CPTCMH2h.js +145 -0
  119. package/dist/{onboarding-C_5pyGx-.js → onboarding-wtYzQipv.js} +36 -36
  120. package/dist/{onboardingSetup-Bd1V-Ipy.js → onboardingSetup-DlYM-oqd.js} +2 -2
  121. package/dist/{plugins-D1Ru-da5.js → plugins-BGyTPNfc.js} +3 -3
  122. package/dist/{reward-BqPl68Xk.js → reward-D0xtG-bp.js} +1 -1
  123. package/dist/{rule-WBrRXwL-.js → rule-BAA5-vRj.js} +572 -492
  124. package/dist/style.css +1 -1
  125. package/dist/template-DKgW9ul3.js +188 -0
  126. package/dist/{timezone-O4qrCDcK.js → timezone-Bbw2OeEP.js} +1 -1
  127. package/dist/{transaction.fn-CY_F8Nb8.js → transaction.fn-DZdNjP_E.js} +2 -2
  128. package/dist/{trigger-D-vySeIB.js → trigger-BpotFb7G.js} +9 -9
  129. package/dist/{useMarketingMaterialActions-kA6SLHy_.js → useMarketingMaterialActions-CQ1M0N9c.js} +4 -4
  130. package/dist/{usePagination-AYE_RJH2.js → usePagination-qALFI_Td.js} +1 -1
  131. package/dist/{user-DJcMkYXP.js → user-X_94TRIK.js} +1 -1
  132. package/dist/vue-i18n-CRFpVnMa.js +2365 -0
  133. package/dist/{xlsx--s3hBdDk.js → xlsx-DW48eXDT.js} +224 -224
  134. package/dist/{zod-IpHRbxaJ.js → zod-BAP9II5C.js} +1 -1
  135. package/package.json +8 -3
  136. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BJotVIKM.js +0 -3496
  137. package/dist/ReviewFacebookCallback-C6DlaJ_j.js +0 -238
  138. package/dist/Reward-DftoZfPN.js +0 -442
  139. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DHmBwLNP.js +0 -1884
  140. package/dist/Settings-9gaegvYJ.js +0 -179
  141. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Dgwyk3NA.js +0 -1265
  142. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CDUhH6wp.js +0 -142
  143. package/dist/WhatsappLayout-B6k_79Kl.js +0 -21
  144. package/dist/campaign.fn-C0oMb1fs.js +0 -776
  145. package/dist/google-C3S8u0mT.js +0 -4
  146. package/dist/objectid-jT5g6pGt.js +0 -145
  147. package/dist/rule-builder-DAlSbaWh.js +0 -102
  148. package/dist/template-DDquG4Xc.js +0 -236
  149. package/dist/vue-i18n-kXHiDb_1.js +0 -2365
@@ -1,3496 +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-C2pLek0l.js";
3
- import { h as axios, S as SvcConfig } from "./index-BvkqHehI.js";
4
- import { z } from "./app-CqQeNnGq.js";
5
- import { Z as ZodHelper } from "./zod-IpHRbxaJ.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-fNYUguDQ.js";
8
- import { F as FdoObjectId } from "./index-BmIfGArh.js";
9
- import { F as FdtoCollectibleConfig } from "./index-DALsfLV7.js";
10
- import { i as isRuleGroup, R as RuleBuilder, a as isRuleEntry } from "./rule-builder-DAlSbaWh.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-Cjy0SXCn.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-BqazvOUj.js";
13
- import { u as useMembershipStore } from "./membership-smdlFpPr.js";
14
- import { u as useBusinessStore } from "./business-gvLSQklz.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-C9ecPgpJ.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-BDZ21UHA.js";
20
- import { _ as _sfc_main$z } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-CDUhH6wp.js";
21
- import { _ as _sfc_main$B } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-CL-GKkuD.js";
22
- import { _ as _sfc_main$p, a as _sfc_main$t } from "./RuleGroup.vue_vue_type_script_setup_true_lang-DHmBwLNP.js";
23
- import { p as prompt, f as firebaseStorage } from "./plugins-D1Ru-da5.js";
24
- import { u as useI18n } from "./vue-i18n-kXHiDb_1.js";
25
- import { T as TypeToTriggerOptions, _ as _sfc_main$C, b as _sfc_main$D } from "./trigger-D-vySeIB.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-zsaig_yK.js";
27
- import { useDialog } from "@feedmepos/ui-library";
28
- import { useCoreStore } from "@feedmepos/mf-common";
29
- import { c as campaignApi } from "./index-ep_Kxxid.js";
30
- import { m as membershipApi } from "./index-CWGbeg5X.js";
31
- import { a as useChannelFlag } from "./feature-flag-DDfyOLsv.js";
32
- import { m as moment } from "./index-DzbVgUEP.js";
33
- import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-WBrRXwL-.js";
34
- import { C as CountryTimezone } from "./timezone-O4qrCDcK.js";
35
- import { _ as _sfc_main$u, a as _sfc_main$w } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-CiSoy0Ky.js";
36
- import "./index-DMiaWY0s.js";
37
- import { T as TEMPLATES } from "./index-lzQ6ehOk.js";
38
- import "./index-BvoOJdfc.js";
39
- import "./index-I9lmcd2w.js";
40
- import "./index-9RBtEPPj.js";
41
- import { a as F_GAME_TYPE } from "./collectible.enum-Liy2wH3s.js";
42
- import { u as useLoading } from "./loading-jZV2Dm--.js";
43
- import { i as initCollectibleConfig } from "./helper-DVUe13eh.js";
44
- import { C as CollectionUtils } from "./collection.fn-CERMsFPh.js";
45
- import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
46
- import { u as useCampaignStore } from "./campaign-Cd6GmA4U.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, g;
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((d) => a[d] == 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
- }), (g = o.config) != null && g.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((h) => {
143
- const p = RuleBuilder.simplify(h);
144
- return p.property === s.property && s.operator.includes(p.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, g = 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(g, async (n, d) => {
284
- var s;
285
- if (d == "custom" && n == "all_time" && RuleBuilder.getRules((s = i.modelValue) == null ? void 0 : s.rules.g_time).length > 0) {
286
- const h = 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
- h && r(
293
- "update:model-value",
294
- RuleBuilder.setRuleToGroup(
295
- i.modelValue ?? RuleBuilder.scaffoldGroup(),
296
- RuleBuilder.scaffoldGroup("g_time")
297
- )
298
- ), g.value = h ? n : d;
299
- }
300
- });
301
- async function a(n) {
302
- var d;
303
- if (n == "custom" && RuleBuilder.getRules((d = i.modelValue) == null ? void 0 : d.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
- g.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, d) => {
323
- var p;
324
- const s = resolveComponent("FmRadio"), h = resolveComponent("FmRadioGroup");
325
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
326
- createVNode(h, {
327
- modelValue: unref(g),
328
- "onUpdate:modelValue": [
329
- d[0] || (d[0] = (f) => isRef(g) ? g.value = f : null),
330
- d[1] || (d[1] = (f) => a(f))
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(g) == "custom" ? (openBlock(), createBlock(_sfc_main$p, {
346
- key: 0,
347
- class: "!mt-[0px]",
348
- "include-only": "trigger",
349
- "trigger-type": "SCHEDULE",
350
- "model-value": ((p = e.modelValue) == null ? void 0 : p.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
351
- "onUpdate:modelValue": d[2] || (d[2] = (f) => r(
352
- "update:model-value",
353
- unref(RuleBuilder).setRuleToGroup(
354
- e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
355
- f,
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, g = computed(() => {
373
- const { property: a, operator: n, equator: d } = 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: d
383
- };
384
- });
385
- return (a, n) => {
386
- const d = resolveComponent("FmRadio"), s = resolveComponent("FmStepperField");
387
- return openBlock(), createElementBlock("div", null, [
388
- createVNode(d, {
389
- label: unref(o)("connect.template.rule.birthday.on_birthday"),
390
- value: "_isRange-day",
391
- "model-value": `${unref(g).operator}-${unref(g).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(d, {
404
- label: unref(o)("connect.template.rule.birthday.days_before"),
405
- value: "_isDay",
406
- "model-value": unref(g).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(g).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(g).equator.x,
423
- "onUpdate:modelValue": n[2] || (n[2] = (h) => r(
424
- "update:model-value",
425
- unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
426
- op: "after",
427
- x: h,
428
- ignoreYear: !0
429
- })
430
- ))
431
- }, null, 8, ["label", "model-value"])) : createCommentVNode("", !0),
432
- createVNode(d, {
433
- label: unref(o)("connect.template.rule.birthday.in_birthday_week"),
434
- value: "_isRange-week",
435
- "model-value": `${unref(g).operator}-${unref(g).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(d, {
448
- label: unref(o)("connect.template.rule.birthday.in_birthday_month"),
449
- value: "_isRange-month",
450
- "model-value": `${unref(g).operator}-${unref(g).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, g = computed(() => i.disabled ? TypeToTriggerOptions[i.campaignType].filter(
483
- (a) => a.value == i.modelValue
484
- ) : TypeToTriggerOptions[i.campaignType]);
485
- return (a, n) => {
486
- const d = 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(g), (s) => (openBlock(), createBlock(d, {
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(g).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 g = 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] = (d) => o("update:model-value", d))
534
- }, {
535
- "trigger-button": withCtx(({ opened: d }) => [
536
- createVNode(a, {
537
- class: "flex items-center",
538
- "prepend-icon": "calendar_month",
539
- "icon-outlined": !d
540
- }, {
541
- append: withCtx(() => [
542
- e.modelValue ? (openBlock(), createBlock(g, {
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, g) => {
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": g[0] || (g[0] = (d) => {
580
- var s;
581
- return i("update:model-value", {
582
- startDate: d,
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": g[1] || (g[1] = (d) => {
594
- var s;
595
- return i("update:model-value", {
596
- startDate: ((s = e.modelValue) == null ? void 0 : s.startDate) ?? null,
597
- endDate: d
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 g(k) {
626
- r("update:model-value", { ...i.modelValue, ...k });
627
- }
628
- function a(k, v) {
629
- return k >= v ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
630
- }
631
- const n = computed(() => i.modelValue.buttons ?? []), d = computed(() => {
632
- var k;
633
- return ((k = i.modelValue.content) == null ? void 0 : k.length) ?? 0;
634
- });
635
- function s(k, v) {
636
- g({
637
- buttons: n.value.map(
638
- (m, c) => c === k ? { ...m, ...v } : m
639
- )
640
- });
641
- }
642
- function h() {
643
- n.value.length >= MAX_BUTTONS || g({ buttons: [...n.value, { label: "", url: "" }] });
644
- }
645
- function p(k) {
646
- var c;
647
- if (!i.showValidation) return { label: void 0, url: void 0 };
648
- const v = (c = k.url) == null ? void 0 : c.trim();
649
- let m;
650
- return v ? FdoBroadcastUrl.safeParse(v).success || (m = o("connect.campaign.push.linkUrlInvalid")) : m = o("connect.campaign.appInbox.buttonUrlRequired"), {
651
- label: k.label.trim() ? void 0 : o("connect.campaign.appInbox.buttonLabelRequired"),
652
- url: m
653
- };
654
- }
655
- function f(k) {
656
- g({ buttons: n.value.filter((v, m) => m !== k) });
657
- }
658
- return (k, v) => {
659
- const m = 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(m, {
669
- "model-value": e.modelValue.title,
670
- "max-length": TITLE_LIMIT$1,
671
- placeholder: unref(o)("connect.campaign.appInbox.titlePlaceholder"),
672
- "onUpdate:modelValue": v[0] || (v[0] = (u) => g({ title: u }))
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(m, {
683
- "model-value": e.modelValue.previewText,
684
- "max-length": PREVIEW_LIMIT,
685
- placeholder: unref(o)("connect.campaign.appInbox.previewTextPlaceholder"),
686
- "onUpdate:modelValue": v[1] || (v[1] = (u) => g({ previewText: u }))
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(d) > unref(APP_INBOX_BODY_LIMIT) ? "text-fm-color-system-error-400" : "text-fm-color-typo-secondary"
697
- ])
698
- }, toDisplayString(unref(d)) + " / " + 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": v[2] || (v[2] = (u) => g({ content: u.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), (u, b) => (openBlock(), createElementBlock("div", {
714
- key: b,
715
- class: "flex flex-wrap items-start gap-8"
716
- }, [
717
- createElementVNode("div", _hoisted_13$3, [
718
- createVNode(m, {
719
- "model-value": u.label,
720
- "max-length": 20,
721
- placeholder: unref(o)("connect.campaign.appInbox.buttonLabel"),
722
- "helper-state": p(u).label ? "error" : "none",
723
- "helper-text": p(u).label,
724
- "onUpdate:modelValue": (E) => s(b, { label: E })
725
- }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
726
- ]),
727
- createElementVNode("div", _hoisted_14$3, [
728
- createVNode(m, {
729
- "model-value": u.url ?? "",
730
- inputmode: "url",
731
- placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
732
- "helper-state": p(u).url ? "error" : "none",
733
- "helper-text": p(u).url,
734
- "onUpdate:modelValue": (E) => s(b, { url: E.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: (E) => f(b)
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: h
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, g = F_PUSH_DESTINATION.options, a = computed(() => i.modelValue.destination === "EXTERNAL"), n = computed(() => {
777
- var f;
778
- if (!i.showValidation || !a.value) return;
779
- const p = (f = i.modelValue.url) == null ? void 0 : f.trim();
780
- return p ? FdoBroadcastUrl.safeParse(p).success ? void 0 : o("connect.campaign.push.linkUrlInvalid") : o("connect.campaign.push.linkUrlRequired");
781
- });
782
- function d(p) {
783
- r("update:model-value", { ...i.modelValue, ...p });
784
- }
785
- function s(p) {
786
- d(p === "EXTERNAL" ? { destination: p } : { destination: p, url: null });
787
- }
788
- function h(p, f) {
789
- return p >= f ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
790
- }
791
- return (p, f) => {
792
- const k = resolveComponent("FmTextField"), v = resolveComponent("FmTextarea"), m = 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", h(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": f[0] || (f[0] = (c) => d({ 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", h(e.modelValue.body.length, BODY_WARN_AT)])
813
- }, toDisplayString(e.modelValue.body.length) + " / " + toDisplayString(BODY_LIMIT), 3)
814
- ]),
815
- createVNode(v, {
816
- "model-value": e.modelValue.body,
817
- "max-length": BODY_LIMIT,
818
- placeholder: unref(o)("connect.campaign.push.bodyPlaceholder"),
819
- "onUpdate:modelValue": f[1] || (f[1] = (c) => d({ 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(m, {
825
- "model-value": e.modelValue.destination ?? "NONE",
826
- items: unref(g).map((c) => ({
827
- label: unref(o)(`connect.campaign.appInbox.destination.${c}`),
828
- value: c
829
- })),
830
- "onUpdate:modelValue": f[2] || (f[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": f[3] || (f[3] = (c) => d({ 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: (g) => 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
- ), g = computed(
929
- () => o.target === "SMS" || o.target === "WHATSAPP" ? o.content : void 0
930
- ), a = computed(() => {
931
- var p, f;
932
- const h = (f = (p = g.value) == null ? void 0 : p.content) == null ? void 0 : f.trim();
933
- return h ? o.senderPrefix ? `${o.senderPrefix}${h}` : h : l("connect.campaign.broadcast.preview.emptyText");
934
- }), n = computed(() => {
935
- var p;
936
- const h = ((p = r.value) == null ? void 0 : p.content) ?? "";
937
- return h.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>${h}` : "";
941
- }), d = computed(() => {
942
- const h = /* @__PURE__ */ new Date(), p = h.toLocaleDateString(void 0, {
943
- weekday: "short",
944
- day: "2-digit",
945
- month: "short"
946
- }), f = h.toLocaleTimeString(void 0, {
947
- hour: "2-digit",
948
- minute: "2-digit"
949
- });
950
- return `${p} · ${f}`;
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 (h, p) => {
953
- var f, k, v, m, c, u, b, E, V, S, N;
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(d)), 1),
972
- createElementVNode("div", _hoisted_6$5, [
973
- createElementVNode("div", _hoisted_7$5, toDisplayString(((k = (f = unref(i)) == null ? void 0 : f.title) == null ? void 0 : k.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyTitle")), 1),
974
- createElementVNode("div", _hoisted_8$5, toDisplayString(((m = (v = unref(i)) == null ? void 0 : v.body) == null ? void 0 : m.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(((u = (c = unref(r)) == null ? void 0 : c.title) == null ? void 0 : u.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyTitle")), 1),
980
- createElementVNode("div", _hoisted_13$2, toDisplayString(((E = (b = unref(r)) == null ? void 0 : b.previewText) == null ? void 0 : E.trim()) || unref(l)("connect.campaign.broadcast.preview.emptyBody")), 1),
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
- (N = (S = unref(r)) == null ? void 0 : S.buttons) != null && N.length ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
996
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(r).buttons, (C, T) => (openBlock(), createElementBlock("div", {
997
- key: T,
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(C.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, g) => {
1030
- const a = resolveComponent("FmButton"), n = resolveComponent("FmMenuItem"), d = 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, h) => (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
- g[0] || (g[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: h === 0,
1060
- onClick: (p) => 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: h === e.rows.length - 1,
1072
- onClick: (p) => 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: (p) => r.$emit("remove", s.channel)
1084
- }, null, 8, ["onClick"])
1085
- ], 8, _hoisted_13$1)
1086
- ])
1087
- ]))), 128)),
1088
- unref(i) ? (openBlock(), createBlock(d, {
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: (h) => 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 y = "unavailable";
1172
- return d.pushAvailability === "checking" ? y = "checking" : d.pushAvailability === "non-native" && (y = "requiresNativeApp"), o("connect.campaign.broadcast.pushAvailability." + y);
1173
- });
1174
- function g() {
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(), d = e, s = l, h = ref(!1), p = ref("SMS"), f = computed(() => {
1185
- const y = d.modelValue;
1186
- return y && "channels" in y ? y : toDelivery({ message: y });
1187
- });
1188
- function k(y) {
1189
- s("update:model-value", y);
1190
- }
1191
- function v(y) {
1192
- return o(`connect.campaign.broadcast.channel.${y}`);
1193
- }
1194
- const m = {
1195
- SMS: "chat",
1196
- WHATSAPP: "chat",
1197
- EMAIL: "mail",
1198
- APP_INBOX: "inbox",
1199
- PUSH: "notifications"
1200
- };
1201
- function c(y) {
1202
- return m[y];
1203
- }
1204
- const u = computed(() => f.value.mode === "fallback"), b = computed(
1205
- () => d.variables.filter(
1206
- (y) => d.triggerType == "SCHEDULE" ? !y.startsWith("transaction.") : !0
1207
- )
1208
- ), E = useChannelFlag();
1209
- function V(y) {
1210
- return E(y) === "off" ? !1 : y === "PUSH" ? d.pushAvailability === "native" : y === "WHATSAPP" ? h.value : !0;
1211
- }
1212
- const S = ["fallback", "all"];
1213
- function N(y) {
1214
- y !== f.value.mode && k(setMode(f.value, y));
1215
- }
1216
- const C = ref(null);
1217
- function T(y) {
1218
- var $;
1219
- const x = ($ = C.value) == null ? void 0 : $[y];
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 R = computed(
1228
- () => (
1229
- // A flagged-off channel stays visible while selected, so it can be removed.
1230
- CHANNEL_DISPLAY_ORDER.filter(
1231
- (y) => E(y) === "on" || f.value.channels.includes(y)
1232
- ).map((y) => {
1233
- const x = f.value.channels.includes(y), $ = T(y);
1234
- let F = o("connect.campaign.broadcast.freeChannel");
1235
- return isPaidChannel(y) && (F = $ ? o("connect.campaign.broadcast.perMessage", { price: $ }) : null), {
1236
- channel: y,
1237
- label: v(y),
1238
- selected: x,
1239
- available: V(y),
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: u.value ? f.value.channels[0] === y : x,
1244
- usedAsFallback: u.value && f.value.channels.indexOf(y) > 0
1245
- };
1246
- })
1247
- )
1248
- );
1249
- async function w(y) {
1250
- if (u.value) {
1251
- await O(y);
1252
- return;
1253
- }
1254
- if (f.value.channels.includes(y)) {
1255
- await I(y);
1256
- return;
1257
- }
1258
- V(y) && k(addChannel(f.value, y, b.value));
1259
- }
1260
- async function O(y) {
1261
- if (!V(y)) return;
1262
- const x = f.value.channels[0];
1263
- x !== y && (x && hasDraft(f.value, x) && !await prompt.remove(
1264
- o("connect.campaign.broadcast.replaceChannelConfirm", {
1265
- channel: v(x),
1266
- next: v(y)
1267
- })
1268
- ) || V(y) && (k(setPrimaryChannel(f.value, y, b.value)), p.value = y));
1269
- }
1270
- async function I(y) {
1271
- if (hasDraft(f.value, y) && !await prompt.remove(
1272
- o("connect.campaign.broadcast.removeChannelConfirm", {
1273
- channel: v(y)
1274
- })
1275
- ))
1276
- return;
1277
- const x = removeChannel(f.value, y);
1278
- k(x), p.value === y && (p.value = x.channels[0] ?? "SMS");
1279
- }
1280
- function Y(y, x) {
1281
- k(moveChannel(f.value, y, x));
1282
- }
1283
- function j(y) {
1284
- V(y) && k(addChannel(f.value, y, b.value));
1285
- }
1286
- const G = computed(
1287
- () => f.value.channels.slice(1).map((y, x) => ({
1288
- channel: y,
1289
- label: v(y),
1290
- position: x + 2,
1291
- complete: !d.showValidation || isChannelComplete(f.value, y)
1292
- }))
1293
- ), q = computed(
1294
- () => CHANNEL_DISPLAY_ORDER.filter(
1295
- (y) => !f.value.channels.includes(y) && V(y)
1296
- ).map((y) => ({
1297
- channel: y,
1298
- label: v(y)
1299
- }))
1300
- ), U = computed(
1301
- () => f.value.channels.map((y, x) => {
1302
- let $ = o("connect.campaign.broadcast.tab.sendsToEligible");
1303
- u.value && ($ = o(
1304
- x === 0 ? "connect.campaign.broadcast.tab.firstAttempt" : "connect.campaign.broadcast.tab.ifNotReached"
1305
- ));
1306
- let F;
1307
- return x > 0 && (F = u.value ? "→" : "+"), {
1308
- key: y,
1309
- label: v(y),
1310
- sub: $,
1311
- complete: !d.showValidation || isChannelComplete(f.value, y),
1312
- step: u.value ? x + 1 : void 0,
1313
- connector: F
1314
- };
1315
- })
1316
- );
1317
- watchEffect(() => {
1318
- const y = U.value.map((x) => x.key);
1319
- y.length && !y.includes(p.value) && (p.value = y[0]);
1320
- });
1321
- const D = computed(() => p.value), Z = computed(() => {
1322
- const y = D.value;
1323
- if (!(y === "APP_INBOX" || y === "PUSH"))
1324
- return f.value.content[y];
1325
- }), L = computed(
1326
- () => f.value.content.APP_INBOX
1327
- ), M = computed(
1328
- () => f.value.content.PUSH
1329
- );
1330
- function W(y) {
1331
- k(setChannelContent(f.value, "APP_INBOX", y));
1332
- }
1333
- function X(y) {
1334
- V("PUSH") && k(setChannelContent(f.value, "PUSH", y));
1335
- }
1336
- function K(y, x) {
1337
- y === "APP_INBOX" || y === "PUSH" || k(setChannelContent(f.value, y, { ...x, channel: y }));
1338
- }
1339
- const H = computed(
1340
- () => f.value.channels.filter(isPaidChannel)
1341
- ), J = computed(() => {
1342
- var x, $, F;
1343
- const y = ((x = n.membership) == null ? void 0 : x.brand) || ((F = ($ = a.currentBusiness) == null ? void 0 : $.value) == null ? void 0 : F.name) || "";
1344
- return getSmsMessageMetrics({ brandName: y, content: "" }).prefix;
1345
- }), Q = `${define_appEndpoint_default.licensePortalUrl}settings?businessId=${SvcConfig.businessId}`;
1346
- async function ee() {
1347
- try {
1348
- const y = await membershipApi.getWhatsappNumbers();
1349
- h.value = y.some(
1350
- (x) => {
1351
- var $;
1352
- return ($ = x == null ? void 0 : x.default) == null ? void 0 : $.includes("Marketing");
1353
- }
1354
- );
1355
- } catch (y) {
1356
- console.error("Failed to fetch WhatsApp numbers:", y);
1357
- }
1358
- }
1359
- return onMounted(async () => {
1360
- const y = f.value.channels[0];
1361
- y && (p.value = y), campaignApi.readBroadcastCreditSummary().then((x) => C.value = x.prices).catch(() => C.value = null), await ee();
1362
- }), (y, 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(S, (B) => createVNode(F, {
1372
- key: B,
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(f).mode === B,
1376
- "hover:bg-fm-color-opacity-sm": unref(f).mode !== B
1377
- }]),
1378
- onClick: (P) => N(B)
1379
- }, {
1380
- default: withCtx(() => [
1381
- createElementVNode("div", _hoisted_6$3, [
1382
- createElementVNode("div", _hoisted_7$3, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${B}.label`)), 1),
1383
- unref(f).mode === B ? (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.${B}.description`)), 1)
1391
- ]),
1392
- _: 2
1393
- }, 1032, ["class", "onClick"])), 64))
1394
- ]),
1395
- unref(f).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(u) ? 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(R), (B) => (openBlock(), createBlock(F, {
1408
- key: B.channel,
1409
- variant: "outlined",
1410
- class: normalizeClass(["flex h-full flex-col gap-12 p-16", [
1411
- B.checked ? "!border-fm-color-primary bg-fm-color-system-warning-100" : "",
1412
- B.available ? "cursor-pointer" : "cursor-not-allowed bg-fm-color-neutral-gray-100"
1413
- ]]),
1414
- "aria-disabled": B.channel === "PUSH" ? void 0 : !B.available,
1415
- onClick: (P) => w(B.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
- B.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(B.channel),
1427
- size: "md"
1428
- }, null, 8, ["name"])
1429
- ], 2),
1430
- B.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(u) ? "rounded-full" : "rounded-[4px]",
1434
- B.checked ? "border-fm-color-primary bg-fm-color-primary text-fm-color-typo-white" : "border-fm-color-neutral-gray-300 bg-fm-color-neutral-white"
1435
- ]])
1436
- }, [
1437
- B.checked && !unref(u) ? (openBlock(), createBlock($, {
1438
- key: 0,
1439
- name: "check",
1440
- size: "sm"
1441
- })) : B.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", B.available ? "" : "text-fm-color-typo-disabled"])
1447
- }, toDisplayString(B.label), 3),
1448
- B.available && B.rateNote ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(B.rateNote), 1)) : createCommentVNode("", !0),
1449
- B.available ? B.usedAsFallback ? (openBlock(), createElementBlock("div", _hoisted_17, toDisplayString(unref(o)("connect.campaign.broadcast.usedAsFallback")), 1)) : createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_16, toDisplayString(B.channel === "PUSH" ? unref(r) : unref(o)("connect.campaign.broadcast.notSetUp")), 1))
1450
- ]),
1451
- B.channel === "WHATSAPP" && !B.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
- B.channel === "PUSH" && !B.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(g, ["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
- B.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(f).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(f).channels.length ? (openBlock(), createElementBlock("div", _hoisted_19, toDisplayString(unref(o)("connect.campaign.broadcast.selectChannelRequired")), 1)) : createCommentVNode("", !0),
1482
- unref(u) && unref(f).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(f).channels.length ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_23, toDisplayString(unref(o)("connect.campaign.broadcast.noChannelContent")), 1)),
1501
- unref(f).channels.length ? (openBlock(), createBlock(_sfc_main$h, {
1502
- key: 2,
1503
- modelValue: unref(p),
1504
- "onUpdate:modelValue": x[3] || (x[3] = (B) => isRef(p) ? p.value = B : null),
1505
- tabs: unref(U)
1506
- }, null, 8, ["modelValue", "tabs"])) : createCommentVNode("", !0),
1507
- unref(f).channels.includes(unref(p)) ? (openBlock(), createElementBlock("div", _hoisted_24, [
1508
- createElementVNode("div", _hoisted_25, [
1509
- unref(p) === "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(p) === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_26, toDisplayString(unref(r)), 1)) : unref(p) === "APP_INBOX" && unref(L) ? (openBlock(), createBlock(_sfc_main$j, {
1515
- key: 2,
1516
- "model-value": unref(L),
1517
- variables: unref(b),
1518
- "show-validation": e.showValidation,
1519
- "onUpdate:modelValue": W
1520
- }, null, 8, ["model-value", "variables", "show-validation"])) : unref(p) !== "APP_INBOX" ? (openBlock(), createBlock(_sfc_main$s, {
1521
- key: unref(p),
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(b),
1528
- placeholder: e.placeholder,
1529
- "onUpdate:modelValue": x[4] || (x[4] = (B) => K(unref(D), B))
1530
- }, null, 8, ["model-value", "trigger-type", "variables", "placeholder"])) : createCommentVNode("", !0)
1531
- ]),
1532
- createVNode(_sfc_main$g, {
1533
- target: unref(p),
1534
- content: unref(f).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, g = useCoreStore(), a = computed(
1562
- () => CountryTimezone[g.currentCountry.value || "MY"]
1563
- );
1564
- function n() {
1565
- const m = RuleBuilder.getRules(i.modelValue);
1566
- return m.length == 0 ? "fixed" : m.some(
1567
- (c) => isRuleEntry(c) && RuleBuilder.simplify(c).operator == "_rrule"
1568
- ) ? "repeating" : "fixed";
1569
- }
1570
- const d = ref(n()), s = ref(!1), h = computed(() => [
1571
- { label: o("connect.template.rule.schedule.fixed"), value: "fixed" },
1572
- { label: o("connect.template.rule.schedule.repeating"), value: "repeating" }
1573
- ]), p = computed(() => {
1574
- const m = RuleBuilder.getRules(i.modelValue), c = m.find(
1575
- (b) => isRuleEntry(b) && RuleBuilder.simplify(b).property == "trigger.date"
1576
- ), u = m.find(
1577
- (b) => isRuleEntry(b) && RuleBuilder.simplify(b).property == "trigger.time"
1578
- );
1579
- return {
1580
- date: c ? RuleBuilder.simplify(c).equator : null,
1581
- time: u ? RuleBuilder.simplify(u).equator : null
1582
- };
1583
- }), f = 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(m) {
1592
- const c = m.value, u = 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
- u
1612
- )
1613
- ), d.value = c;
1614
- }
1615
- function v(m) {
1616
- d.value == "fixed" ? r(
1617
- "update:model-value",
1618
- RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
1619
- RuleBuilder.constructEntry(
1620
- "trigger.date",
1621
- "_isOnDate",
1622
- m.date
1623
- ),
1624
- RuleBuilder.constructEntry(
1625
- "trigger.time",
1626
- "_isOnTime",
1627
- m.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
- m.date
1637
- ),
1638
- RuleBuilder.constructEntry(
1639
- "trigger.time",
1640
- "_isOnTime",
1641
- m.time
1642
- )
1643
- ])
1644
- );
1645
- }
1646
- return (m, c) => {
1647
- const u = resolveComponent("FmButtonGroup"), b = resolveComponent("FmTimePicker"), E = resolveComponent("FmIcon"), V = resolveComponent("FmTooltip"), S = resolveComponent("FmField"), N = resolveComponent("FmCard"), C = resolveComponent("FmPopover"), T = resolveComponent("FmDatePicker"), R = resolveComponent("FmHelperText");
1648
- return openBlock(), createElementBlock(Fragment, null, [
1649
- createVNode(u, {
1650
- items: unref(h),
1651
- "model-value": unref(h).find((w) => w.value === unref(d)) ?? 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(b, {
1658
- label: unref(o)("connect.template.rule.schedule.notify_time"),
1659
- "model-value": unref(p).time,
1660
- "onUpdate:modelValue": c[0] || (c[0] = (w) => v({ date: unref(p).date, time: w })),
1661
- "helper-text": unref(p).time ? void 0 : unref(o)("connect.template.rule.schedule.time_required"),
1662
- "helper-state": unref(p).time ? void 0 : "error"
1663
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"]),
1664
- unref(d) == "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(p).date ? (openBlock(), createBlock(V, {
1668
- key: 0,
1669
- "z-index": 9999,
1670
- content: unref(SummarizeRrule)(unref(RRule).fromString(unref(p).date).options)
1671
- }, {
1672
- default: withCtx(() => [
1673
- createVNode(E, {
1674
- name: "info",
1675
- size: "sm",
1676
- outline: !0
1677
- })
1678
- ]),
1679
- _: 1
1680
- }, 8, ["content"])) : createCommentVNode("", !0)
1681
- ]),
1682
- createVNode(C, {
1683
- "show-popover": unref(s),
1684
- onPopoverChanged: c[3] || (c[3] = (w) => s.value = w)
1685
- }, {
1686
- "popover-button": withCtx(() => [
1687
- createVNode(S, {
1688
- class: "cursor-pointer",
1689
- "helper-text": unref(p).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
1690
- "helper-state": unref(p).date ? void 0 : "error"
1691
- }, {
1692
- default: withCtx(() => [
1693
- createElementVNode("div", _hoisted_5$5, toDisplayString(unref(p).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(p).date).options) : unref(o)("connect.template.rule.schedule.set_repeating_date")), 1)
1694
- ]),
1695
- _: 1
1696
- }, 8, ["helper-text", "helper-state"])
1697
- ]),
1698
- default: withCtx(() => [
1699
- createVNode(N, { class: "elevated p-8 w-[450px]" }, {
1700
- default: withCtx(() => [
1701
- createVNode(_sfc_main$t, {
1702
- "apply-button": !0,
1703
- "model-value": unref(p).date || "",
1704
- onCancel: c[1] || (c[1] = (w) => s.value = !1),
1705
- "onUpdate:modelValue": c[2] || (c[2] = (w) => (v({ date: w, time: unref(p).time }), s.value = !1))
1706
- }, null, 8, ["model-value"])
1707
- ]),
1708
- _: 1
1709
- })
1710
- ]),
1711
- _: 1
1712
- }, 8, ["show-popover"])
1713
- ])) : (openBlock(), createBlock(T, {
1714
- key: 1,
1715
- label: unref(o)("connect.template.rule.schedule.notify_date"),
1716
- "model-value": unref(p).date || "",
1717
- "onUpdate:modelValue": c[4] || (c[4] = (w) => v({ date: w, time: unref(p).time })),
1718
- "helper-text": unref(p).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
1719
- "helper-state": unref(p).date ? void 0 : "error"
1720
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"]))
1721
- ]),
1722
- unref(p).date && unref(p).time && unref(f) ? (openBlock(), createBlock(R, {
1723
- key: 0,
1724
- text: `${unref(moment)(unref(f)).isAfter(unref(moment)()) ? unref(o)("connect.template.rule.schedule.next_notification") : unref(o)("connect.template.rule.schedule.last_trigger_on")} ${unref(moment)(unref(f)).format("dddd, DD MMM YYYY")} at
1725
- ${unref(moment)(unref(f)).format("hh:mmA")}(UTC${unref(moment).tz(unref(a)).format("Z")}) (${unref(moment)(unref(f)).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, g = 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 d = 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(g), (s) => (openBlock(), createBlock(d, {
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(g).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, g = ref(!1), a = ref(), n = ref(), d = ref(0), s = computed(() => {
1791
- var m;
1792
- return ((m = i.loyaltyRewards.items.find(
1793
- (c) => {
1794
- var u;
1795
- return c.value === ((u = a.value) == null ? void 0 : u.collectible);
1796
- }
1797
- )) == null ? void 0 : m.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
1798
- }), h = computed(() => {
1799
- const v = s.value.safeParse(a.value);
1800
- return v.success ? [] : v.error.errors;
1801
- });
1802
- function p(v, m, c) {
1803
- v && (a.value = m, d.value = c), g.value = v;
1804
- }
1805
- const f = o;
1806
- async function k() {
1807
- const v = s.value.safeParse(a.value);
1808
- v.success && (await r(
1809
- async () => {
1810
- v.data.type === "VOUCHER" && n.value && (v.data.collectibleConfig.image = await firebaseStorage.update(
1811
- v.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1812
- n.value
1813
- ));
1814
- },
1815
- {
1816
- message: "Uploading reward image",
1817
- successMessage: "Reward image updated"
1818
- }
1819
- ), f("update:model-value", v.data, d.value));
1820
- }
1821
- return l({
1822
- showSheet: p
1823
- }), (v, m) => {
1824
- const c = resolveComponent("FmSelect"), u = resolveComponent("FmStepperField"), b = resolveComponent("FmButton"), E = resolveComponent("FmSideSheet");
1825
- return openBlock(), createBlock(E, {
1826
- "max-width": 560,
1827
- modelValue: unref(g),
1828
- "onUpdate:modelValue": [
1829
- m[9] || (m[9] = (V) => isRef(g) ? g.value = V : null),
1830
- m[10] || (m[10] = (V) => g.value = V)
1831
- ],
1832
- header: "Edit reward",
1833
- "dismiss-away": ""
1834
- }, {
1835
- "side-sheet-footer": withCtx(() => [
1836
- createElementVNode("div", _hoisted_2$8, [
1837
- createVNode(b, {
1838
- variant: "primary",
1839
- type: "button",
1840
- disabled: unref(h).length > 0,
1841
- label: "Confirm",
1842
- onClick: m[7] || (m[7] = (V) => k())
1843
- }, null, 8, ["disabled"]),
1844
- createVNode(b, {
1845
- variant: "secondary",
1846
- type: "button",
1847
- label: "Cancel",
1848
- onClick: m[8] || (m[8] = (V) => g.value = !1)
1849
- })
1850
- ])
1851
- ]),
1852
- default: withCtx(() => {
1853
- var V, S, N;
1854
- return [
1855
- unref(a) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
1856
- createVNode(c, {
1857
- label: "Reward Type",
1858
- items: [
1859
- { label: "No Reward", value: "NO_REWARD" },
1860
- { label: "Voucher", value: "VOUCHER" },
1861
- { label: "Loyalty", value: "LOYALTY" }
1862
- ],
1863
- "model-value": unref(a).type,
1864
- "onUpdate:modelValue": m[0] || (m[0] = (C) => {
1865
- C == "NO_REWARD" ? a.value = {
1866
- type: "NO_REWARD",
1867
- collectible: null,
1868
- weight: 1
1869
- } : C === "VOUCHER" ? a.value = {
1870
- collectible: null,
1871
- type: "VOUCHER",
1872
- collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1873
- business: unref(useCoreStore)().currentBusiness.value._id
1874
- }),
1875
- earningOption: {
1876
- amount: 1,
1877
- type: "FIXED"
1878
- },
1879
- validityOption: {
1880
- validForDay: 7
1881
- },
1882
- weight: 1
1883
- } : a.value = {
1884
- collectible: unref(i).loyaltyRewards.raw[0]._id,
1885
- type: "LOYALTY",
1886
- earningOption: {
1887
- amount: 1,
1888
- type: "FIXED"
1889
- },
1890
- validityOption: {
1891
- validForDay: 7
1892
- },
1893
- weight: 1
1894
- };
1895
- })
1896
- }, null, 8, ["model-value"]),
1897
- unref(a).type == "LOYALTY" ? (openBlock(), createBlock(c, {
1898
- key: 0,
1899
- label: "Loyalty type",
1900
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "collectible", [unref(a).type])],
1901
- items: unref(i).loyaltyRewards.items,
1902
- "model-value": unref(a).collectible,
1903
- "onUpdate:modelValue": m[1] || (m[1] = (C) => unref(a).collectible = C)
1904
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1905
- createVNode(u, {
1906
- label: "Weight",
1907
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "weight", [unref(a).type])],
1908
- "model-value": unref(a).weight,
1909
- "onUpdate:modelValue": m[2] || (m[2] = (C) => a.value = {
1910
- ...unref(a),
1911
- weight: C
1912
- })
1913
- }, null, 8, ["rules", "model-value"]),
1914
- unref(a).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1915
- ((V = unref(i).loyaltyRewards.items.find(
1916
- (C) => {
1917
- var T;
1918
- return C.value === ((T = unref(a)) == null ? void 0 : T.collectible);
1919
- }
1920
- )) == null ? void 0 : V.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1921
- m[11] || (m[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1922
- createVNode(_sfc_main$u, {
1923
- class: "mt-[-8px]",
1924
- rules: [
1925
- unref(ZodHelper).ruleAtPath(unref(s), "earningOption", [unref(a).type])
1926
- ],
1927
- "helper-state": unref(ZodHelper).helperState(unref(h), "earningOption"),
1928
- "error-text": unref(ZodHelper).helperText(unref(h), "earningOption"),
1929
- "fixed-type": !0,
1930
- "model-value": unref(a).earningOption,
1931
- "onUpdate:modelValue": m[3] || (m[3] = (C) => a.value = {
1932
- ...unref(a),
1933
- earningOption: C
1934
- })
1935
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
1936
- ], 64)) : createCommentVNode("", !0),
1937
- m[12] || (m[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
1938
- createVNode(_sfc_main$v, {
1939
- type: unref(a).type === "LOYALTY" ? "custom" : "range",
1940
- "for-credit": unref(a).type === "LOYALTY" && ((S = unref(i).loyaltyRewards.items.find(
1941
- (C) => {
1942
- var T;
1943
- return C.value === ((T = unref(a)) == null ? void 0 : T.collectible);
1944
- }
1945
- )) == null ? void 0 : S.raw.type) === "CREDIT",
1946
- class: "!gap-24",
1947
- rules: [unref(ZodHelper).ruleAtPath(unref(s), "validityOption", [unref(a).type])],
1948
- "model-value": unref(a).validityOption,
1949
- "onUpdate:modelValue": m[4] || (m[4] = (C) => a.value = {
1950
- ...unref(a),
1951
- validityOption: C
1952
- })
1953
- }, null, 8, ["type", "for-credit", "rules", "model-value"])
1954
- ], 64)) : createCommentVNode("", !0),
1955
- unref(a).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$w, {
1956
- key: 2,
1957
- "reward-image": unref(n),
1958
- "model-value": ((N = unref(a)) == null ? void 0 : N.collectibleConfig) ?? void 0,
1959
- "onUpdate:modelValue": m[5] || (m[5] = (C) => a.value = {
1960
- ...unref(a),
1961
- collectibleConfig: C
1962
- }),
1963
- "onUpdate:rewardImage": m[6] || (m[6] = (C) => n.value = C)
1964
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1965
- createVNode(JsonViewer, { json: unref(h) }, null, 8, ["json"])
1966
- ])) : createCommentVNode("", !0)
1967
- ];
1968
- }),
1969
- _: 1
1970
- }, 8, ["modelValue"]);
1971
- };
1972
- }
1973
- });
1974
- function isNullOrEmpty(e) {
1975
- return e == null || e === "";
1976
- }
1977
- 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({
1978
- __name: "RewardPoolInput",
1979
- props: {
1980
- modelValue: {
1981
- type: Array,
1982
- default: () => [
1983
- {
1984
- collectible: null,
1985
- type: "NO_REWARD",
1986
- weight: 1
1987
- }
1988
- ]
1989
- }
1990
- },
1991
- emits: ["update:model-value"],
1992
- setup(e, { emit: l }) {
1993
- const o = e, i = l, r = useMembershipStore(), { t: g } = useI18n(), a = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), n = computed(() => o.modelValue ?? []), d = computed(() => {
1994
- const m = a.safeParse(n.value);
1995
- return m.success ? [] : m.error.errors;
1996
- }), s = ref();
1997
- function h(m, c) {
1998
- var b;
1999
- const u = [...n.value];
2000
- u[c] = m, (b = s.value) == null || b.showSheet(!1), i("update:model-value", u);
2001
- }
2002
- function p(m) {
2003
- const c = m.type == "VOUCHER" ? m.collectibleConfig : r.collectibles.find(
2004
- (E) => E._id.toString() == m.collectible
2005
- ), u = CollectionUtils.formattedType((c == null ? void 0 : c.name) || ""), b = m.weight;
2006
- return {
2007
- label: isNullOrEmpty(u) ? "NO REWARD" : u,
2008
- sublabel: `${b} (${(b / n.value.reduce((E, V) => E + V.weight, 0) * 100).toFixed(2)}%)`
2009
- };
2010
- }
2011
- function f(m) {
2012
- var u;
2013
- const c = [...n.value];
2014
- (u = s.value) == null || u.showSheet(!0, c[m], m);
2015
- }
2016
- function k(m) {
2017
- const c = [...n.value];
2018
- c.splice(m, 1), i("update:model-value", c);
2019
- }
2020
- function v() {
2021
- var m;
2022
- (m = s.value) == null || m.showSheet(
2023
- !0,
2024
- {
2025
- type: "NO_REWARD",
2026
- collectible: null,
2027
- weight: 1
2028
- },
2029
- n.value.length
2030
- );
2031
- }
2032
- return (m, c) => {
2033
- const u = resolveComponent("FmButton"), b = resolveComponent("FmCard"), E = resolveComponent("FmHelperText");
2034
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
2035
- createElementVNode("div", _hoisted_2$7, toDisplayString(unref(g)("connect.template.configure_reward_type")), 1),
2036
- createVNode(u, {
2037
- label: unref(g)("connect.campaign.rewardPool.addReward"),
2038
- onClick: c[0] || (c[0] = (V) => v()),
2039
- variant: "plain",
2040
- icon: "add"
2041
- }, null, 8, ["label"]),
2042
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (V, S) => (openBlock(), createBlock(b, {
2043
- key: S,
2044
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2045
- variant: "outlined",
2046
- onClick: (N) => f(S)
2047
- }, {
2048
- default: withCtx(() => {
2049
- var N;
2050
- return [
2051
- createElementVNode("div", null, [
2052
- createElementVNode("div", _hoisted_3$6, toDisplayString(V.type == "LOYALTY" ? (N = V == null ? void 0 : V.earningOption) == null ? void 0 : N.amount : "") + " " + toDisplayString(p(V).label), 1),
2053
- createElementVNode("div", _hoisted_4$5, toDisplayString(p(V).sublabel), 1)
2054
- ]),
2055
- createVNode(u, {
2056
- icon: "delete",
2057
- variant: "tertiary",
2058
- onClick: (C) => (C.stopPropagation(), k(S))
2059
- }, null, 8, ["onClick"])
2060
- ];
2061
- }),
2062
- _: 2
2063
- }, 1032, ["onClick"]))), 128)),
2064
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d).filter((V) => V.path.join(".") == ""), (V) => (openBlock(), createBlock(E, {
2065
- key: V.message,
2066
- text: V.message,
2067
- state: "error"
2068
- }, null, 8, ["text"]))), 128)),
2069
- createVNode(_sfc_main$b, {
2070
- ref_key: "sheetRef",
2071
- ref: s,
2072
- "onUpdate:modelValue": h
2073
- }, null, 512)
2074
- ]);
2075
- };
2076
- }
2077
- }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
2078
- key: 0,
2079
- class: "grid grid-cols-2 gap-16"
2080
- }, _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({
2081
- __name: "PromotionGameTypeInput",
2082
- props: {
2083
- modelValue: {
2084
- type: Object
2085
- }
2086
- },
2087
- emits: ["update:model-value"],
2088
- setup(e, { emit: l }) {
2089
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => [
2090
- {
2091
- label: o("connect.template.promotion_game.rock_paper_scissors.label"),
2092
- description: o("connect.template.promotion_game.rock_paper_scissors.description"),
2093
- value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
2094
- }
2095
- ]);
2096
- return (a, n) => {
2097
- var p, f, k;
2098
- const d = resolveComponent("FmSwitch"), s = resolveComponent("FmCard"), h = resolveComponent("FmHelperText");
2099
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
2100
- createVNode(d, {
2101
- label: unref(o)("connect.template.promotion_game.enable"),
2102
- "model-value": !!((p = e.modelValue) != null && p.gameType),
2103
- "onUpdate:modelValue": n[0] || (n[0] = (v) => v ? r("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : r("update:model-value", null))
2104
- }, null, 8, ["label", "model-value"]),
2105
- ((f = e.modelValue) == null ? void 0 : f.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
2106
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (v) => {
2107
- var m, c;
2108
- return openBlock(), createBlock(s, {
2109
- variant: "outlined",
2110
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2111
- "col-span-2": unref(g).length == 1,
2112
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((m = e.modelValue) == null ? void 0 : m.gameType) == v.value,
2113
- "hover:bg-fm-color-opacity-sm": ((c = e.modelValue) == null ? void 0 : c.gameType) != v.value
2114
- }]),
2115
- onClick: () => {
2116
- var u;
2117
- ((u = i.modelValue) == null ? void 0 : u.gameType) != v.value && r("update:model-value", { gameType: v.value });
2118
- },
2119
- key: v.value
2120
- }, {
2121
- default: withCtx(() => [
2122
- createElementVNode("div", _hoisted_3$5, toDisplayString(v.label), 1),
2123
- createElementVNode("div", _hoisted_4$4, toDisplayString(v.description), 1)
2124
- ]),
2125
- _: 2
2126
- }, 1032, ["class", "onClick"]);
2127
- }), 128))
2128
- ])) : createCommentVNode("", !0),
2129
- ((k = e.modelValue) == null ? void 0 : k.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(h, {
2130
- key: 1,
2131
- text: unref(o)("connect.template.promotion_game.rock_paper_scissors.warning"),
2132
- state: "warning"
2133
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2134
- ]);
2135
- };
2136
- }
2137
- }), _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({
2138
- __name: "MissionTypeInput",
2139
- props: {
2140
- modelValue: {
2141
- type: String
2142
- }
2143
- },
2144
- emits: ["update:model-value"],
2145
- setup(e, { emit: l }) {
2146
- const { t: o } = useI18n(), i = e, r = l, g = computed(() => [
2147
- {
2148
- label: o("connect.campaign.mission.typeOption.STAMP.label"),
2149
- description: o("connect.campaign.mission.typeOption.STAMP.description"),
2150
- value: F_MISSION_TYPE.enum.STAMP
2151
- },
2152
- {
2153
- label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
2154
- description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
2155
- value: F_MISSION_TYPE.enum.PROGRESSIVE
2156
- }
2157
- ]);
2158
- return (a, n) => {
2159
- const d = resolveComponent("FmCard");
2160
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
2161
- createElementVNode("div", _hoisted_2$5, toDisplayString(unref(o)("connect.template.select_game")), 1),
2162
- createElementVNode("div", _hoisted_3$4, [
2163
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (s) => (openBlock(), createBlock(d, {
2164
- variant: "outlined",
2165
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2166
- "col-span-2": unref(g).length == 1,
2167
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == s.value,
2168
- "hover:bg-fm-color-opacity-sm": e.modelValue != s.value
2169
- }]),
2170
- onClick: () => {
2171
- i.modelValue != s.value && r("update:model-value", s.value);
2172
- },
2173
- key: s.value
2174
- }, {
2175
- default: withCtx(() => [
2176
- createElementVNode("div", _hoisted_4$3, toDisplayString(s.label), 1),
2177
- createElementVNode("div", _hoisted_5$3, toDisplayString(s.description), 1)
2178
- ]),
2179
- _: 2
2180
- }, 1032, ["class", "onClick"]))), 128))
2181
- ])
2182
- ]);
2183
- };
2184
- }
2185
- }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
2186
- __name: "MissionEndInput",
2187
- props: {
2188
- modelValue: {
2189
- type: [String, Number]
2190
- },
2191
- helperText: {
2192
- type: String
2193
- },
2194
- helperState: {
2195
- type: String
2196
- }
2197
- },
2198
- emits: ["update:model-value"],
2199
- setup(e, { emit: l }) {
2200
- const o = l;
2201
- return (i, r) => {
2202
- const g = resolveComponent("FmStepperField");
2203
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
2204
- 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)),
2205
- createVNode(g, {
2206
- label: "Maximum to collect",
2207
- "model-value": e.modelValue || null,
2208
- "onUpdate:modelValue": r[0] || (r[0] = (a) => o("update:model-value", a)),
2209
- "helper-text": e.helperText || "Set the threshold required for reward eligibility",
2210
- "helper-state": e.helperState || "none"
2211
- }, null, 8, ["model-value", "helper-text", "helper-state"])
2212
- ]);
2213
- };
2214
- }
2215
- }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
2216
- __name: "EditMissionPoolSheet",
2217
- props: {
2218
- maxThreshold: {
2219
- type: Number,
2220
- required: !0
2221
- }
2222
- },
2223
- emits: ["update:model-value"],
2224
- setup(e, { expose: l, emit: o }) {
2225
- const i = e, r = useMembershipStore(), { minor: g } = useLoading, a = ref(!1), n = ref(), d = ref(), s = ref(0), h = computed(() => {
2226
- var u;
2227
- return ((u = r.loyaltyRewards.items.find(
2228
- (b) => {
2229
- var E;
2230
- return b.value === ((E = n.value) == null ? void 0 : E.collectible);
2231
- }
2232
- )) == null ? void 0 : u.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
2233
- }), p = computed(() => {
2234
- const c = h.value.safeParse(n.value);
2235
- return c.success ? [] : c.error.errors;
2236
- });
2237
- function f(c, u, b) {
2238
- c && (n.value = u, s.value = b), a.value = c;
2239
- }
2240
- const k = o;
2241
- async function v() {
2242
- const c = h.value.safeParse(n.value);
2243
- c.success && (await g(
2244
- async () => {
2245
- c.data.type === "VOUCHER" && d.value && (c.data.collectibleConfig.image = await firebaseStorage.update(
2246
- c.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, d.value),
2247
- d.value
2248
- ));
2249
- },
2250
- {
2251
- message: "Uploading reward image",
2252
- successMessage: "Reward image updated"
2253
- }
2254
- ), k("update:model-value", c.data, s.value));
2255
- }
2256
- const m = ref();
2257
- return l({
2258
- showSheet: f
2259
- }), (c, u) => {
2260
- const b = resolveComponent("FmStepperField"), E = resolveComponent("FmSelect"), V = resolveComponent("FmForm"), S = resolveComponent("FmButton"), N = resolveComponent("FmSideSheet");
2261
- return openBlock(), createBlock(N, {
2262
- "max-width": 560,
2263
- modelValue: unref(a),
2264
- "onUpdate:modelValue": [
2265
- u[10] || (u[10] = (C) => isRef(a) ? a.value = C : null),
2266
- u[11] || (u[11] = (C) => a.value = C)
2267
- ],
2268
- header: "Edit reward",
2269
- "dismiss-away": ""
2270
- }, {
2271
- "side-sheet-footer": withCtx(() => [
2272
- createElementVNode("div", _hoisted_1$6, [
2273
- createVNode(S, {
2274
- variant: "primary",
2275
- type: "button",
2276
- label: "Confirm",
2277
- disabled: unref(p).length > 0,
2278
- onClick: u[8] || (u[8] = async () => {
2279
- var C;
2280
- return (C = unref(m)) == null ? void 0 : C.validateInputs();
2281
- })
2282
- }, null, 8, ["disabled"]),
2283
- createVNode(S, {
2284
- variant: "secondary",
2285
- type: "button",
2286
- label: "Cancel",
2287
- onClick: u[9] || (u[9] = (C) => a.value = !1)
2288
- })
2289
- ])
2290
- ]),
2291
- default: withCtx(() => [
2292
- createVNode(JsonViewer, { json: unref(n) }, null, 8, ["json"]),
2293
- unref(n) ? (openBlock(), createBlock(V, {
2294
- key: 0,
2295
- class: "flex flex-col gap-y-24",
2296
- ref_key: "formRef",
2297
- ref: m,
2298
- onValidationSuccess: u[7] || (u[7] = (C) => v())
2299
- }, {
2300
- default: withCtx(() => {
2301
- var C, T;
2302
- return [
2303
- unref(n).type ? (openBlock(), createBlock(b, {
2304
- key: 0,
2305
- label: "Threshold",
2306
- rules: [
2307
- unref(ZodHelper).toRule(
2308
- unref(z).number().min(1).max(
2309
- i.maxThreshold,
2310
- `Number cannot be more than ${i.maxThreshold}`
2311
- )
2312
- )
2313
- ],
2314
- "model-value": unref(n).threshold,
2315
- "onUpdate:modelValue": u[0] || (u[0] = (R) => n.value = {
2316
- ...unref(n),
2317
- threshold: R
2318
- })
2319
- }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
2320
- createVNode(E, {
2321
- label: "Reward Type",
2322
- items: [
2323
- { label: "Voucher", value: "VOUCHER" },
2324
- { label: "Loyalty", value: "LOYALTY" }
2325
- ],
2326
- "model-value": unref(n).type,
2327
- "onUpdate:modelValue": u[1] || (u[1] = (R) => {
2328
- var w, O;
2329
- R === "VOUCHER" ? n.value = {
2330
- collectible: null,
2331
- type: "VOUCHER",
2332
- collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
2333
- business: unref(useCoreStore)().currentBusiness.value._id
2334
- }),
2335
- earningOption: {
2336
- amount: 1,
2337
- type: "FIXED"
2338
- },
2339
- validityOption: {
2340
- validForDay: 7
2341
- },
2342
- threshold: (w = unref(n)) == null ? void 0 : w.threshold
2343
- } : n.value = {
2344
- collectible: unref(r).loyaltyRewards.raw[0]._id,
2345
- type: "LOYALTY",
2346
- earningOption: {
2347
- amount: 1,
2348
- type: "FIXED"
2349
- },
2350
- validityOption: {
2351
- validForDay: 7
2352
- },
2353
- threshold: (O = unref(n)) == null ? void 0 : O.threshold
2354
- };
2355
- })
2356
- }, null, 8, ["model-value"]),
2357
- unref(n).type == "LOYALTY" ? (openBlock(), createBlock(E, {
2358
- key: 1,
2359
- label: "Loyalty type",
2360
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "collectible", [unref(n).type])],
2361
- items: unref(r).loyaltyRewards.items,
2362
- "model-value": unref(n).collectible,
2363
- "onUpdate:modelValue": u[2] || (u[2] = (R) => unref(n).collectible = R)
2364
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
2365
- unref(n).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2366
- u[12] || (u[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
2367
- createVNode(_sfc_main$u, {
2368
- class: "mt-[-8px]",
2369
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "earningOption", [unref(n).type])],
2370
- "helper-state": unref(ZodHelper).helperState(unref(p), "earningOption"),
2371
- "error-text": unref(ZodHelper).helperText(unref(p), "earningOption"),
2372
- "fixed-type": !0,
2373
- "model-value": unref(n).earningOption,
2374
- "onUpdate:modelValue": u[3] || (u[3] = (R) => n.value = {
2375
- ...unref(n),
2376
- earningOption: R
2377
- })
2378
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
2379
- createVNode(_sfc_main$v, {
2380
- class: "!gap-24",
2381
- type: unref(n).type === "LOYALTY" ? "custom" : "range",
2382
- "for-credit": unref(n).type === "LOYALTY" && ((C = unref(r).loyaltyRewards.items.find(
2383
- (R) => {
2384
- var w;
2385
- return R.value === ((w = unref(n)) == null ? void 0 : w.collectible);
2386
- }
2387
- )) == null ? void 0 : C.raw.type) === "CREDIT",
2388
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "validityOption", [unref(n).type])],
2389
- "model-value": unref(n).validityOption,
2390
- "onUpdate:modelValue": u[4] || (u[4] = (R) => n.value = {
2391
- ...unref(n),
2392
- validityOption: R
2393
- })
2394
- }, null, 8, ["type", "for-credit", "rules", "model-value"])
2395
- ], 64)) : createCommentVNode("", !0),
2396
- unref(n).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$w, {
2397
- key: 3,
2398
- "reward-image": unref(d),
2399
- "model-value": ((T = unref(n)) == null ? void 0 : T.collectibleConfig) ?? void 0,
2400
- "onUpdate:modelValue": u[5] || (u[5] = (R) => n.value = {
2401
- ...unref(n),
2402
- collectibleConfig: R
2403
- }),
2404
- "onUpdate:rewardImage": u[6] || (u[6] = (R) => d.value = R)
2405
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
2406
- createVNode(JsonViewer, { json: unref(p) }, null, 8, ["json"])
2407
- ];
2408
- }),
2409
- _: 1
2410
- }, 512)) : createCommentVNode("", !0)
2411
- ]),
2412
- _: 1
2413
- }, 8, ["modelValue"]);
2414
- };
2415
- }
2416
- }), _hoisted_1$5 = {
2417
- key: 0,
2418
- class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
2419
- }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
2420
- __name: "MissionProgress",
2421
- props: {
2422
- type: {
2423
- type: String,
2424
- required: !0
2425
- },
2426
- maxRange: {
2427
- type: Number,
2428
- required: !0
2429
- },
2430
- currentRange: {
2431
- type: Number,
2432
- default: 0
2433
- },
2434
- markers: {
2435
- type: Array,
2436
- default: () => []
2437
- }
2438
- },
2439
- setup(e) {
2440
- const l = e, { maxRange: o, currentRange: i, markers: r } = toRefs(l), g = computed(
2441
- () => Math.min(i.value / o.value * 100, 100)
2442
- ), a = (n) => n / o.value * 100;
2443
- return (n, d) => {
2444
- const s = resolveComponent("FmIcon");
2445
- return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
2446
- (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(o), 40), (h) => (openBlock(), createBlock(s, {
2447
- class: normalizeClass(
2448
- unref(i) >= h ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
2449
- ),
2450
- outline: unref(i) < h,
2451
- key: h,
2452
- name: unref(r).some((p) => p === h) ? "featured_seasonal_and_gifts" : "check_circle"
2453
- }, null, 8, ["class", "outline", "name"]))), 128))
2454
- ])) : (openBlock(), createElementBlock("div", {
2455
- key: 1,
2456
- class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
2457
- }, [
2458
- createElementVNode("div", {
2459
- class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
2460
- style: normalizeStyle({ width: unref(g) + "%" })
2461
- }, null, 4),
2462
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(r), (h, p) => (openBlock(), createElementBlock("div", {
2463
- key: p,
2464
- class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
2465
- style: normalizeStyle({ left: a(h) + "%" })
2466
- }, [
2467
- createElementVNode("div", _hoisted_2$4, [
2468
- createElementVNode("div", {
2469
- class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
2470
- }),
2471
- d[0] || (d[0] = createElementVNode("div", null, "🎁", -1))
2472
- ])
2473
- ], 4))), 128))
2474
- ]));
2475
- };
2476
- }
2477
- }), isObject = (e) => e !== null && typeof e == "object";
2478
- function changeKeysFactory(e) {
2479
- return function l(o, i = 1, r) {
2480
- if (i === 0 || !isObject(o))
2481
- return o;
2482
- if (Array.isArray(o))
2483
- return o.map((a) => l(a, i - 1, r));
2484
- const g = Object.create(Object.getPrototypeOf(o));
2485
- return Object.keys(o).forEach((a) => {
2486
- const n = o[a], d = e(a, r), s = l(n, i - 1, r);
2487
- g[d] = s;
2488
- }), g;
2489
- };
2490
- }
2491
- 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({
2492
- __name: "MissionPoolInput",
2493
- props: {
2494
- modelValue: {
2495
- type: Array,
2496
- default: () => []
2497
- },
2498
- mission: {
2499
- type: Object,
2500
- required: !0
2501
- }
2502
- },
2503
- emits: ["update:model-value"],
2504
- setup(e, { emit: l }) {
2505
- const { t: o } = useI18n(), i = e, r = l, g = useMembershipStore(), a = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), n = computed(
2506
- () => i.modelValue.sort((c, u) => c.threshold - u.threshold) ?? []
2507
- ), d = computed(() => {
2508
- const c = a.safeParse(n.value);
2509
- return c.success ? [] : c.error.errors;
2510
- }), s = ref();
2511
- function h(c, u) {
2512
- var E;
2513
- const b = [...n.value];
2514
- b[u] = c, (E = s.value) == null || E.showSheet(!1), r("update:model-value", b);
2515
- }
2516
- function p(c) {
2517
- const u = c.type == "VOUCHER" ? c.collectibleConfig : g.collectibles.find(
2518
- (V) => V._id.toString() == c.collectible
2519
- ), b = CollectionUtils.formattedType((u == null ? void 0 : u.name) || ""), E = c.earningOption.type == "FIXED" ? o("connect.template.mission_pool.reward_sublabel_fixed", {
2520
- threshold: c.threshold,
2521
- amount: c.earningOption.amount
2522
- }) : o("connect.template.mission_pool.reward_sublabel_per_spend", {
2523
- threshold: c.threshold,
2524
- amount: c.earningOption.amount,
2525
- every: c.earningOption.every
2526
- });
2527
- return {
2528
- label: isNullOrEmpty(b) ? o("connect.template.mission_pool.no_reward") : b,
2529
- sublabel: E
2530
- };
2531
- }
2532
- function f(c) {
2533
- var b;
2534
- const u = [...n.value];
2535
- (b = s.value) == null || b.showSheet(!0, u[c], c);
2536
- }
2537
- function k(c) {
2538
- const u = [...n.value];
2539
- u.splice(c, 1), r("update:model-value", u);
2540
- }
2541
- function v() {
2542
- var c;
2543
- (c = s.value) == null || c.showSheet(
2544
- !0,
2545
- {
2546
- type: "LOYALTY",
2547
- collectible: g.loyaltyRewards.items[0].value,
2548
- threshold: null,
2549
- validityOption: {
2550
- validForDay: 7
2551
- },
2552
- earningOption: {
2553
- type: "FIXED",
2554
- amount: 1
2555
- }
2556
- },
2557
- n.value.length
2558
- );
2559
- }
2560
- function m(c) {
2561
- var u, b;
2562
- return c.type == "VOUCHER" ? (u = c.collectibleConfig) == null ? void 0 : u.name : sentenceCase(
2563
- ((b = g.loyaltyRewards.items.find(
2564
- (E) => E.value == c.collectible
2565
- )) == null ? void 0 : b.label) || ""
2566
- );
2567
- }
2568
- return (c, u) => {
2569
- const b = resolveComponent("FmButton"), E = resolveComponent("FmCard"), V = resolveComponent("FmHelperText");
2570
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2571
- createElementVNode("div", _hoisted_2$3, toDisplayString(unref(o)("connect.template.configure_reward_customer")), 1),
2572
- createVNode(b, {
2573
- label: unref(o)("connect.template.mission_pool.add_reward"),
2574
- onClick: u[0] || (u[0] = (S) => v()),
2575
- variant: "plain",
2576
- icon: "add"
2577
- }, null, 8, ["label"]),
2578
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (S, N) => (openBlock(), createBlock(E, {
2579
- key: N,
2580
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2581
- variant: "outlined",
2582
- onClick: (C) => f(N)
2583
- }, {
2584
- default: withCtx(() => [
2585
- createElementVNode("div", null, [
2586
- createElementVNode("div", _hoisted_3$3, toDisplayString(p(S).label), 1),
2587
- createElementVNode("div", _hoisted_4$2, toDisplayString(p(S).sublabel), 1)
2588
- ]),
2589
- createVNode(b, {
2590
- icon: "delete",
2591
- variant: "tertiary",
2592
- onClick: (C) => (C.stopPropagation(), k(N))
2593
- }, null, 8, ["onClick"])
2594
- ]),
2595
- _: 2
2596
- }, 1032, ["onClick"]))), 128)),
2597
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d).filter((S) => S.path.join(".") == ""), (S) => (openBlock(), createBlock(V, {
2598
- key: S.message,
2599
- text: S.message,
2600
- state: "error"
2601
- }, null, 8, ["text"]))), 128)),
2602
- createElementVNode("div", _hoisted_5$2, toDisplayString(unref(o)("connect.template.mission_pool.preview")), 1),
2603
- (openBlock(), createBlock(E, {
2604
- key: 0,
2605
- variant: "outlined",
2606
- class: "p-24 space-y-16 w-fit"
2607
- }, {
2608
- default: withCtx(() => {
2609
- var S, N;
2610
- return [
2611
- createElementVNode("div", _hoisted_6$2, [
2612
- createElementVNode("div", null, [
2613
- createElementVNode("div", _hoisted_7$2, toDisplayString(unref(o)("connect.template.mission_pool.collect_stamps", { end: e.mission.end })) + " " + toDisplayString(((S = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : S.earningOption.amount) > 1 ? (N = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : N.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? m(e.modelValue[e.modelValue.length - 1]) : ""), 1),
2614
- createElementVNode("div", _hoisted_8$2, toDisplayString(unref(o)("connect.template.mission_pool.earn_stamp")), 1)
2615
- ])
2616
- ]),
2617
- createElementVNode("div", _hoisted_9$2, [
2618
- createVNode(_sfc_main$5, {
2619
- type: e.mission.type,
2620
- "max-range": e.mission.end,
2621
- currentRange: e.mission.end / 4,
2622
- markers: e.modelValue.map((C) => C.threshold)
2623
- }, null, 8, ["type", "max-range", "currentRange", "markers"]),
2624
- e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_10$2, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
2625
- ])
2626
- ];
2627
- }),
2628
- _: 1
2629
- })),
2630
- createVNode(_sfc_main$6, {
2631
- ref_key: "sheetRef",
2632
- ref: s,
2633
- "onUpdate:modelValue": h,
2634
- "max-threshold": e.mission.end
2635
- }, null, 8, ["max-threshold"])
2636
- ]);
2637
- };
2638
- }
2639
- }), _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({
2640
- __name: "MissionInput",
2641
- props: {
2642
- modelValue: Object
2643
- },
2644
- emits: ["update:model-value"],
2645
- setup(e, { emit: l }) {
2646
- const { t: o } = useI18n(), i = e, r = computed(() => {
2647
- const n = FdoMission.safeParse(i.modelValue);
2648
- return n.success ? [] : n.error.errors;
2649
- }), g = computed(() => [
2650
- {
2651
- label: o("connect.campaign.mission.typeOption.STAMP.label"),
2652
- description: o("connect.campaign.mission.typeOption.STAMP.description"),
2653
- value: F_MISSION_TYPE.enum.STAMP
2654
- },
2655
- {
2656
- label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
2657
- description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
2658
- value: F_MISSION_TYPE.enum.PROGRESSIVE
2659
- }
2660
- ]), a = l;
2661
- return (n, d) => {
2662
- var p;
2663
- const s = resolveComponent("FmCard"), h = resolveComponent("FmStepperField");
2664
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
2665
- createElementVNode("div", _hoisted_2$2, [
2666
- createElementVNode("div", _hoisted_3$2, toDisplayString(unref(o)("connect.campaign.mission.missionType")), 1),
2667
- createElementVNode("div", _hoisted_4$1, toDisplayString(unref(o)("connect.template.select_game")), 1),
2668
- createElementVNode("div", _hoisted_5$1, [
2669
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(g), (f) => {
2670
- var k, v;
2671
- return openBlock(), createBlock(s, {
2672
- variant: "outlined",
2673
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2674
- "col-span-2": unref(g).length == 1,
2675
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((k = e.modelValue) == null ? void 0 : k.type) == f.value,
2676
- "hover:bg-fm-color-opacity-sm": ((v = e.modelValue) == null ? void 0 : v.type) != f.value
2677
- }]),
2678
- onClick: () => {
2679
- var m, c;
2680
- ((m = e.modelValue) == null ? void 0 : m.type) != f.value && a("update:model-value", {
2681
- ...e.modelValue,
2682
- type: f.value,
2683
- end: ((c = e.modelValue) == null ? void 0 : c.end) || 1
2684
- });
2685
- },
2686
- key: f.value
2687
- }, {
2688
- default: withCtx(() => [
2689
- createElementVNode("div", _hoisted_6$1, toDisplayString(f.label), 1),
2690
- createElementVNode("div", _hoisted_7$1, toDisplayString(f.description), 1)
2691
- ]),
2692
- _: 2
2693
- }, 1032, ["class", "onClick"]);
2694
- }), 128))
2695
- ])
2696
- ]),
2697
- createElementVNode("div", _hoisted_8$1, [
2698
- createElementVNode("div", _hoisted_9$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequired")), 1),
2699
- createElementVNode("div", _hoisted_10$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequiredDescription")), 1),
2700
- createVNode(h, {
2701
- label: unref(o)("connect.campaign.mission.maximumToCollect"),
2702
- "model-value": ((p = e.modelValue) == null ? void 0 : p.end) || null,
2703
- "onUpdate:modelValue": d[0] || (d[0] = (f) => {
2704
- var k;
2705
- return a("update:model-value", {
2706
- ...e.modelValue,
2707
- type: ((k = e.modelValue) == null ? void 0 : k.type) || "STAMP",
2708
- end: f
2709
- });
2710
- }),
2711
- "helper-text": unref(ZodHelper).helperText(unref(r), "end") || unref(o)("connect.campaign.mission.thresholdHelperText"),
2712
- "helper-state": unref(ZodHelper).helperState(unref(r), "end") || "none"
2713
- }, null, 8, ["label", "model-value", "helper-text", "helper-state"])
2714
- ])
2715
- ]);
2716
- };
2717
- }
2718
- });
2719
- function useLocaleText() {
2720
- const { locale: e, t: l } = useI18n();
2721
- function o(i, r) {
2722
- return i ? i[e.value] ?? i["en-US"] ?? l(r) : l(r);
2723
- }
2724
- return { getLocaleText: o };
2725
- }
2726
- const _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
2727
- __name: "TemplateInput",
2728
- props: {
2729
- pushAvailability: {
2730
- type: String,
2731
- default: "checking"
2732
- },
2733
- field: { type: Object, required: !0 },
2734
- modelValue: {
2735
- type: Object
2736
- },
2737
- schema: {
2738
- type: Object
2739
- },
2740
- extras: {
2741
- type: Object
2742
- },
2743
- helperText: {
2744
- type: String
2745
- },
2746
- disabled: {
2747
- type: Boolean,
2748
- default: !1
2749
- },
2750
- campaignType: {
2751
- type: String,
2752
- default: void 0
2753
- },
2754
- /** False until the form has been submitted, for fields that validate late. */
2755
- showValidation: {
2756
- type: Boolean,
2757
- default: !0
2758
- }
2759
- },
2760
- emits: ["retry-push", "update:model-value", "update:file"],
2761
- setup(e, { emit: l }) {
2762
- const { t: o } = useI18n(), { getLocaleText: i } = useLocaleText(), r = e, g = l;
2763
- function a(h) {
2764
- switch (r.field.type) {
2765
- case "timeframe":
2766
- const p = h.startDate ? hooks(h.startDate).startOf("day").toISOString() : void 0, f = h.endDate ? hooks(h.endDate).endOf("day").toISOString() : void 0;
2767
- g("update:model-value", {
2768
- type: "timeframe",
2769
- property: "__now",
2770
- start: p,
2771
- end: f
2772
- });
2773
- break;
2774
- case "image": {
2775
- g(
2776
- "update:file",
2777
- h,
2778
- n.value || firebaseStorage.collectibleImagePath(void 0, h)
2779
- );
2780
- break;
2781
- }
2782
- default:
2783
- g("update:model-value", h);
2784
- break;
2785
- }
2786
- }
2787
- const n = computed(() => {
2788
- switch (r.field.type) {
2789
- case "timeframe": {
2790
- const h = r.modelValue;
2791
- return {
2792
- startDate: h != null && h.start ? hooks(h == null ? void 0 : h.start).format("YYYY-MM-DD") : null,
2793
- endDate: h != null && h.end ? hooks(h == null ? void 0 : h.end).format("YYYY-MM-DD") : null
2794
- };
2795
- }
2796
- default:
2797
- return r.modelValue;
2798
- }
2799
- });
2800
- function d() {
2801
- if (!s.value.schema) return [];
2802
- const h = s.value.schema.safeParse(r.modelValue);
2803
- return h.success ? [] : h.error.errors;
2804
- }
2805
- const s = computed(() => ({
2806
- schema: r.schema,
2807
- unwrapped: r.schema ? ZodHelper.unwrap(r.schema) : void 0,
2808
- rules: r.schema ? [ZodHelper.ruleAtPath(r.schema, "")] : void 0,
2809
- labelMark: r.schema && ZodHelper.isRequired(r.schema) == !1 ? "optional" : void 0,
2810
- zodLabel: r.schema ? ZodHelper.toInputLabel(
2811
- r.schema,
2812
- i(r.field.label_locale, r.field.label ?? "")
2813
- ) : void 0
2814
- }));
2815
- return (h, p) => {
2816
- var u, b, E, V, S;
2817
- const f = resolveComponent("FmTextField"), k = resolveComponent("FmStepperField"), v = resolveComponent("FmTextarea"), m = resolveComponent("FmHelperText"), c = resolveComponent("FmSwitch");
2818
- return e.field.type === "text" ? (openBlock(), createBlock(f, {
2819
- key: 0,
2820
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2821
- "label-mark": unref(s).labelMark,
2822
- rules: unref(s).rules,
2823
- "model-value": unref(n),
2824
- "onUpdate:modelValue": a,
2825
- "helper-state": e.helperText ? "error" : void 0,
2826
- "helper-text": e.helperText
2827
- }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2828
- createVNode(JsonViewer, {
2829
- json: { schema: unref(s).unwrapped, props: r }
2830
- }, null, 8, ["json"]),
2831
- createVNode(k, {
2832
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2833
- "label-mark": e.field.isRuleChildren ? void 0 : unref(s).labelMark,
2834
- "model-value": unref(n),
2835
- rules: e.field.isRuleChildren ? [] : unref(s).rules,
2836
- "onUpdate:modelValue": a,
2837
- "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
2838
- "helper-text": e.field.isRuleChildren ? e.helperText : void 0
2839
- }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
2840
- ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(v, {
2841
- key: 2,
2842
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2843
- "label-mark": unref(s).labelMark,
2844
- rules: unref(s).rules,
2845
- "model-value": unref(n),
2846
- "onUpdate:modelValue": a,
2847
- "show-word-count": "",
2848
- "max-length": (S = (V = (E = (b = (u = unref(s)) == null ? void 0 : u.unwrapped) == null ? void 0 : b._def) == null ? void 0 : E.checks) == null ? void 0 : V.find((N) => N.kind == "max")) == null ? void 0 : S.value
2849
- }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$m, {
2850
- key: 3,
2851
- "campaign-type": e.extras,
2852
- "model-value": unref(n),
2853
- disabled: e.disabled,
2854
- "onUpdate:modelValue": a
2855
- }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
2856
- createVNode(_sfc_main$k, {
2857
- "model-value": unref(n),
2858
- "onUpdate:modelValue": a
2859
- }, null, 8, ["model-value"]),
2860
- createVNode(m, {
2861
- class: "!mt-[8px]",
2862
- text: unref(ZodHelper).helperText(d(), ""),
2863
- state: unref(ZodHelper).helperState(d(), "")
2864
- }, null, 8, ["text", "state"])
2865
- ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$x, {
2866
- key: 5,
2867
- thumbnail: unref(n),
2868
- "aspect-ratio": "16 / 9",
2869
- class: "w-1/2 xs:w-2/3",
2870
- "onUpdate:file": a
2871
- }, {
2872
- label: withCtx(() => [
2873
- (openBlock(), createBlock(resolveDynamicComponent(unref(s).zodLabel)))
2874
- ]),
2875
- _: 1
2876
- }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(c, {
2877
- key: 6,
2878
- label: unref(i)(e.field.label_locale, e.field.label ?? ""),
2879
- "label-placement": "right",
2880
- sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
2881
- "label-mark": unref(s).labelMark,
2882
- rules: unref(s).rules,
2883
- "model-value": unref(n),
2884
- "onUpdate:modelValue": a
2885
- }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$y, {
2886
- key: 7,
2887
- "model-value": unref(n),
2888
- "onUpdate:modelValue": a,
2889
- "no-campaign": !1,
2890
- schema: unref(s).schema,
2891
- "is-mission": e.extras === "MISSION"
2892
- }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$z, {
2893
- key: 8,
2894
- "model-value": unref(n),
2895
- "onUpdate:modelValue": a
2896
- }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
2897
- createVNode(_sfc_main$A, {
2898
- "model-value": unref(n),
2899
- "onUpdate:modelValue": a,
2900
- "can-set-auto-apply": e.field.property == "campaign.effect"
2901
- }, null, 8, ["model-value", "can-set-auto-apply"]),
2902
- unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(m, {
2903
- key: 0,
2904
- class: "!mt-[8px]",
2905
- text: unref(o)("connect.campaign.common.effect_required"),
2906
- state: "error"
2907
- }, null, 8, ["text"]))
2908
- ], 64)) : e.field.type === "message" ? (openBlock(), createElementBlock(Fragment, { key: 10 }, [
2909
- e.field.property === "campaign.message" ? (openBlock(), createBlock(_sfc_main$e, {
2910
- key: 0,
2911
- "push-availability": e.pushAvailability,
2912
- onRetryPush: p[0] || (p[0] = (N) => g("retry-push")),
2913
- "show-validation": e.showValidation,
2914
- "model-value": unref(n),
2915
- "onUpdate:modelValue": a,
2916
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2917
- "trigger-type": e.field.extras,
2918
- "helper-state": unref(ZodHelper).helperState(d(), "")
2919
- }, null, 8, ["push-availability", "show-validation", "model-value", "helper-text", "trigger-type", "helper-state"])) : (openBlock(), createBlock(_sfc_main$s, {
2920
- key: 1,
2921
- "allow-email": !0,
2922
- "allow-whatsapp": !0,
2923
- "model-value": unref(n),
2924
- "onUpdate:modelValue": a,
2925
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2926
- "trigger-type": e.field.extras,
2927
- "helper-state": unref(ZodHelper).helperState(d(), "")
2928
- }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"]))
2929
- ], 64)) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$u, {
2930
- key: 11,
2931
- "model-value": unref(n),
2932
- "onUpdate:modelValue": a,
2933
- extras: e.extras,
2934
- "error-text": e.helperText
2935
- }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$v, {
2936
- key: 12,
2937
- type: "custom",
2938
- "model-value": unref(n),
2939
- "onUpdate:modelValue": a,
2940
- "helper-text": e.helperText || unref(ZodHelper).helperText(d(), ""),
2941
- "for-credit": r.campaignType === "CREDIT"
2942
- }, null, 8, ["model-value", "helper-text", "for-credit"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$c, {
2943
- key: 13,
2944
- "model-value": unref(n),
2945
- "onUpdate:modelValue": a
2946
- }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
2947
- key: 14,
2948
- "model-value": unref(n),
2949
- "onUpdate:modelValue": a
2950
- }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
2951
- key: 15,
2952
- "model-value": unref(n),
2953
- "onUpdate:modelValue": a
2954
- }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
2955
- key: 16,
2956
- "model-value": unref(n),
2957
- "onUpdate:modelValue": a
2958
- }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
2959
- key: 17,
2960
- "model-value": unref(n),
2961
- "onUpdate:modelValue": a,
2962
- "helper-text": unref(ZodHelper).helperText(d(), ""),
2963
- "helper-state": unref(ZodHelper).helperState(d(), "")
2964
- }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
2965
- key: 18,
2966
- "model-value": unref(n),
2967
- "onUpdate:modelValue": a,
2968
- mission: e.extras.mission
2969
- }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
2970
- createVNode(_sfc_main$d, {
2971
- "model-value": unref(n),
2972
- "onUpdate:modelValue": a,
2973
- "start-date": e.extras.start,
2974
- "end-date": e.extras.end
2975
- }, null, 8, ["model-value", "start-date", "end-date"]),
2976
- e.helperText ? (openBlock(), createBlock(m, {
2977
- key: 0,
2978
- class: "!mt-[8px]",
2979
- text: e.helperText,
2980
- state: "error"
2981
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2982
- ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
2983
- createVNode(_sfc_main$B, {
2984
- "model-value": unref(n),
2985
- "onUpdate:modelValue": a
2986
- }, null, 8, ["model-value"]),
2987
- e.helperText ? (openBlock(), createBlock(m, {
2988
- key: 0,
2989
- class: "!mt-[8px]",
2990
- text: e.helperText,
2991
- state: "error"
2992
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2993
- ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
2994
- e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(n).rules.g_time).length > 0 ? (openBlock(), createBlock(m, {
2995
- key: 0,
2996
- state: "warning",
2997
- text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
2998
- }, null, 8, ["text"])) : createCommentVNode("", !0),
2999
- createVNode(_sfc_main$o, {
3000
- "model-value": unref(n),
3001
- "onUpdate:modelValue": a
3002
- }, null, 8, ["model-value"]),
3003
- e.helperText ? (openBlock(), createBlock(m, {
3004
- key: 1,
3005
- class: "!mt-[8px]",
3006
- text: e.helperText,
3007
- state: "error"
3008
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3009
- ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
3010
- createVNode(_sfc_main$C, {
3011
- "model-value": unref(n),
3012
- "onUpdate:modelValue": a
3013
- }, null, 8, ["model-value"]),
3014
- e.helperText ? (openBlock(), createBlock(m, {
3015
- key: 0,
3016
- class: "!mt-[8px]",
3017
- text: e.helperText,
3018
- state: "error"
3019
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3020
- ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
3021
- createVNode(_sfc_main$D, {
3022
- "model-value": unref(n),
3023
- "onUpdate:modelValue": a
3024
- }, null, 8, ["model-value"]),
3025
- e.helperText ? (openBlock(), createBlock(m, {
3026
- key: 0,
3027
- class: "!mt-[8px]",
3028
- text: e.helperText,
3029
- state: "error"
3030
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3031
- ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
3032
- createVNode(_sfc_main$n, {
3033
- "model-value": unref(n),
3034
- "onUpdate:modelValue": a
3035
- }, null, 8, ["model-value"]),
3036
- e.helperText ? (openBlock(), createBlock(m, {
3037
- key: 0,
3038
- class: "!mt-[8px]",
3039
- text: e.helperText,
3040
- state: "error"
3041
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3042
- ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
3043
- createVNode(_sfc_main$9, {
3044
- "model-value": unref(n),
3045
- "onUpdate:modelValue": a
3046
- }, null, 8, ["model-value"]),
3047
- e.helperText ? (openBlock(), createBlock(m, {
3048
- key: 0,
3049
- class: "!mt-[8px]",
3050
- text: e.helperText,
3051
- state: "error"
3052
- }, null, 8, ["text"])) : createCommentVNode("", !0)
3053
- ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(r.field), 1));
3054
- };
3055
- }
3056
- }), _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({
3057
- __name: "CampaignSummary",
3058
- props: {
3059
- data: {
3060
- type: Object,
3061
- required: !0
3062
- }
3063
- },
3064
- setup(e) {
3065
- const { t: l, te: o } = useI18n();
3066
- function i(r) {
3067
- return o(r) || o(r, "en-US");
3068
- }
3069
- return (r, g) => {
3070
- const a = resolveComponent("FmCard");
3071
- return openBlock(), createBlock(a, {
3072
- variant: "outlined",
3073
- class: "p-16 space-y-8"
3074
- }, {
3075
- default: withCtx(() => [
3076
- createElementVNode("div", _hoisted_1$1, toDisplayString(unref(l)("connect.campaign.common.summary")), 1),
3077
- g[0] || (g[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
3078
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (n, d) => (openBlock(), createElementBlock("div", {
3079
- class: "space-y-4",
3080
- key: d
3081
- }, [
3082
- n ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3083
- createElementVNode("div", _hoisted_2$1, toDisplayString(unref(l)(`${d}`)), 1),
3084
- createElementVNode("div", _hoisted_3$1, toDisplayString(i(`${n}`) ? unref(l)(`${n}`) : n), 1)
3085
- ], 64)) : createCommentVNode("", !0)
3086
- ]))), 128))
3087
- ]),
3088
- _: 1
3089
- });
3090
- };
3091
- }
3092
- }), _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 = {
3093
- key: 0,
3094
- class: "max-w-6xl mx-auto"
3095
- }, _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({
3096
- __name: "EditCampaignSheet",
3097
- emits: ["submit:model-value"],
3098
- setup(__props, { expose: __expose, emit: __emit }) {
3099
- const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), { getLocaleText } = useLocaleText(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
3100
- TEMPLATES.VOUCHER
3101
- ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign"), campaignType = ref("VOUCHER"), pushAvailability = ref("checking");
3102
- let availabilityRequest = 0;
3103
- async function checkPushAvailability() {
3104
- const e = ++availabilityRequest, l = SvcConfig.getBusinessId();
3105
- pushAvailability.value = "checking";
3106
- try {
3107
- if (!l) throw new Error("Business ID is unavailable");
3108
- const i = await getNativeApp(l);
3109
- o() && (pushAvailability.value = i ? "native" : "non-native");
3110
- } catch {
3111
- o() && (pushAvailability.value = "failed");
3112
- }
3113
- function o() {
3114
- return e === availabilityRequest && sheetVisible.value && campaignType.value === "BROADCAST" && SvcConfig.getBusinessId() === l;
3115
- }
3116
- }
3117
- watch(
3118
- sheetVisible,
3119
- (e) => {
3120
- e || ++availabilityRequest;
3121
- },
3122
- { flush: "sync" }
3123
- ), onBeforeUnmount(() => {
3124
- ++availabilityRequest;
3125
- });
3126
- const pushBlocked = computed(
3127
- () => {
3128
- var e;
3129
- return campaignType.value === "BROADCAST" && toDelivery(((e = data.value) == null ? void 0 : e.campaign) ?? {}).channels.includes("PUSH") && pushAvailability.value !== "native";
3130
- }
3131
- );
3132
- async function showSheet(visible, type, campaign, selectedTemplate) {
3133
- var e, l, o;
3134
- if (sheetVisible.value = visible, campaignType.value = type, ++availabilityRequest, !!visible) {
3135
- type === "BROADCAST" && checkPushAvailability();
3136
- try {
3137
- isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
3138
- } catch {
3139
- } finally {
3140
- await new Promise((i) => setTimeout(i, 120)), isLoading.value = !1;
3141
- }
3142
- template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((i, r) => {
3143
- var g;
3144
- if (i.campaign.type === "VOUCHER" && i.campaign.code) {
3145
- const a = (g = i.campaign._id) == null ? void 0 : g.toString();
3146
- useCampaignStore().campaigns.voucher.some(
3147
- (n) => n.code === i.campaign.code && n._id.toString() !== a
3148
- ) && r.addIssue({
3149
- code: "custom",
3150
- message: "Code already exists, please use another code",
3151
- path: ["campaign", "code"]
3152
- });
3153
- }
3154
- })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
3155
- ...(l = template.value) == null ? void 0 : l.defaultValue
3156
- }), "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", {
3157
- typeName: t(`connect.campaign.common.typeName.${type}`)
3158
- }) : t("connect.campaign.common.create_campaign_title", {
3159
- typeName: t(`connect.campaign.common.typeName.${type}`)
3160
- });
3161
- }
3162
- }
3163
- async function hideSheet() {
3164
- Dialog.open({
3165
- title: t("connect.campaign.common.unsaved_changes"),
3166
- message: t("connect.campaign.common.unsaved_changes"),
3167
- primaryActions: {
3168
- text: t("connect.campaign.common.unsaved_changes_confirm"),
3169
- close: !0
3170
- },
3171
- secondaryActions: {
3172
- text: t("connect.campaign.common.unsaved_changes_cancel"),
3173
- close: !1
3174
- }
3175
- }).onPrimary(() => {
3176
- sheetVisible.value = !1;
3177
- }).onSecondary(() => {
3178
- Dialog.close();
3179
- });
3180
- }
3181
- const emits = __emit, errors = computed(() => {
3182
- const e = schema.value.superRefine(campaignRefinement).safeParse(data.value), l = e.success ? [] : [...e.error.errors];
3183
- return pushBlocked.value && l.push({
3184
- code: "custom",
3185
- path: ["campaign", "delivery", "channels"],
3186
- message: t(
3187
- "connect.campaign.broadcast.pushAvailability.removeBeforeSave"
3188
- )
3189
- }), l;
3190
- });
3191
- function stepErrors(e = currentStep.value - 1) {
3192
- const l = template.value.steps[e].groups.flatMap(
3193
- (o) => o.fields.map((i) => schemaPathForField(i.property))
3194
- );
3195
- return errors.value.filter(
3196
- (o) => l.some((i) => o.path.join(".").includes(i))
3197
- );
3198
- }
3199
- const validateOnSubmit = computed(() => campaignType.value === "BROADCAST"), submitAttempted = ref(!1), showValidation = computed(
3200
- () => !validateOnSubmit.value || submitAttempted.value
3201
- ), visibleErrors = computed(
3202
- () => showValidation.value ? errors.value : []
3203
- );
3204
- function hasVisibleStepErrors(e) {
3205
- return showValidation.value && stepErrors(e).length > 0;
3206
- }
3207
- function isNextDisabled() {
3208
- return validateOnSubmit.value ? !1 : currentStep.value - 1 < template.value.steps.length - 1 ? stepErrors().length > 0 : errors.value.length > 0;
3209
- }
3210
- function onNext() {
3211
- if (stepErrors().length > 0) {
3212
- submitAttempted.value = !0;
3213
- return;
3214
- }
3215
- submitAttempted.value = !1, currentStep.value++;
3216
- }
3217
- __expose({ showSheet });
3218
- function showSummaryDialog() {
3219
- Dialog.open({
3220
- title: "",
3221
- dialogComponent: _sfc_main$1,
3222
- dialogComponentProps: {
3223
- data: data.value
3224
- }
3225
- });
3226
- }
3227
- const broadcastDelivery = computed(
3228
- () => {
3229
- var e;
3230
- return (e = data.value) != null && e.campaign ? toDelivery(data.value.campaign) : void 0;
3231
- }
3232
- );
3233
- function valueForField(e) {
3234
- return e === "campaign.message" ? broadcastDelivery.value : _.get(data.value, e);
3235
- }
3236
- function schemaPathForField(e) {
3237
- return e === "campaign.message" ? "campaign.delivery" : e;
3238
- }
3239
- function onUpdateProperty(e, l) {
3240
- var o, i, r, g, a, n, d, s;
3241
- if (e === "campaign.message" && l && "channels" in l) {
3242
- _.set(data.value, "campaign.delivery", l);
3243
- const h = toLegacyMessage(l);
3244
- h ? _.set(data.value, "campaign.message", h) : delete data.value.campaign.message;
3245
- return;
3246
- }
3247
- if (_.set(data.value, e, l), e == "campaign.event.type") {
3248
- const p = ((g = (r = (i = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : i.campaign) == null ? void 0 : r.event) == null ? void 0 : g.rule) ? _.cloneDeep({
3249
- ...(s = (d = (n = (a = template.value) == null ? void 0 : a.defaultValue) == null ? void 0 : n.campaign) == null ? void 0 : d.event) == null ? void 0 : s.rule
3250
- }) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
3251
- RuleBuilder.scaffoldGroup("g_schedule"),
3252
- RuleBuilder.scaffoldGroup("g_time"),
3253
- RuleBuilder.scaffoldGroup("g_user"),
3254
- RuleBuilder.scaffoldGroup("g_bill")
3255
- ]), f = RuleBuilder.setRuleToGroup(
3256
- RuleBuilder.scaffoldGroup("g_schedule"),
3257
- [
3258
- RuleBuilder.constructEntry(
3259
- "trigger.date",
3260
- "_rrule",
3261
- "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
3262
- ),
3263
- RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
3264
- ],
3265
- "&&"
3266
- );
3267
- if (l != "SCHEDULE") {
3268
- _.set(data.value, "campaign.event.rule", p);
3269
- return;
3270
- }
3271
- _.set(
3272
- data.value,
3273
- "campaign.event.rule",
3274
- RuleBuilder.setRuleToGroup(p, f)
3275
- );
3276
- }
3277
- e == "campaign.notify" && l == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
3278
- }
3279
- async function onUpdateFile(e, l) {
3280
- return e ? await minor(async () => firebaseStorage.update(l, e), {
3281
- message: `${e ? "Uploading" : "Removing"} file`,
3282
- successMessage: `File ${e ? "uploaded" : "removed"} successfully`
3283
- }) : "";
3284
- }
3285
- function isDisable(e) {
3286
- var l, o;
3287
- switch (e == null ? void 0 : e.property) {
3288
- case "campaign.event.type":
3289
- return ((o = (l = data.value) == null ? void 0 : l.campaign) == null ? void 0 : o._id) || !1;
3290
- default:
3291
- return !1;
3292
- }
3293
- }
3294
- function onSubmit() {
3295
- if (submitAttempted.value = !0, pushBlocked.value) return;
3296
- const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
3297
- e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
3298
- }
3299
- return (e, l) => {
3300
- const o = resolveComponent("FmButton"), i = resolveComponent("FmStep"), r = resolveComponent("FmStepper"), g = resolveComponent("FmCard"), a = resolveComponent("FmTopSheet");
3301
- return openBlock(), createBlock(a, {
3302
- "fullscreen-size": "lg",
3303
- modelValue: unref(sheetVisible),
3304
- "onUpdate:modelValue": [
3305
- l[7] || (l[7] = (n) => isRef(sheetVisible) ? sheetVisible.value = n : null),
3306
- l[8] || (l[8] = (n) => sheetVisible.value = n)
3307
- ]
3308
- }, createSlots({
3309
- "top-sheet-header": withCtx(() => [
3310
- createElementVNode("div", _hoisted_1, [
3311
- createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
3312
- createElementVNode("div", _hoisted_2, [
3313
- createVNode(o, {
3314
- onClick: l[0] || (l[0] = (n) => hideSheet()),
3315
- label: unref(t)("connect.campaign.common.cancel"),
3316
- variant: "tertiary"
3317
- }, null, 8, ["label"]),
3318
- createVNode(o, {
3319
- onClick: onSubmit,
3320
- label: unref(t)("connect.campaign.common.save"),
3321
- disabled: !unref(validateOnSubmit) && unref(errors).length > 0
3322
- }, null, 8, ["label", "disabled"])
3323
- ])
3324
- ])
3325
- ]),
3326
- _: 2
3327
- }, [
3328
- unref(isLoading) ? {
3329
- name: "default",
3330
- fn: withCtx(() => [
3331
- createElementVNode("div", _hoisted_9, [
3332
- createElementVNode("div", _hoisted_10, [
3333
- createElementVNode("div", _hoisted_11, [
3334
- l[9] || (l[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
3335
- createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
3336
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
3337
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
3338
- createElementVNode("div", { class: "space-y-3" }, [
3339
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
3340
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
3341
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3342
- ]),
3343
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3344
- ]),
3345
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
3346
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
3347
- createElementVNode("div", { class: "space-y-3" }, [
3348
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
3349
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
3350
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3351
- ]),
3352
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
3353
- ])
3354
- ])
3355
- ], -1)),
3356
- createVNode(g, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
3357
- ])
3358
- ])
3359
- ])
3360
- ]),
3361
- key: "1"
3362
- } : {
3363
- name: "default",
3364
- fn: withCtx(() => [
3365
- unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
3366
- createVNode(r, {
3367
- modelValue: unref(currentStep),
3368
- "onUpdate:modelValue": l[1] || (l[1] = (n) => isRef(currentStep) ? currentStep.value = n : null),
3369
- orientation: "horizontal",
3370
- class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
3371
- }, {
3372
- default: withCtx(() => [
3373
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, d) => (openBlock(), createBlock(i, {
3374
- key: n.name,
3375
- title: unref(getLocaleText)(n.name_locale, n.name),
3376
- value: d + 1,
3377
- error: () => hasVisibleStepErrors(d),
3378
- complete: () => d + 1 <= unref(currentStep)
3379
- }, null, 8, ["title", "value", "error", "complete"]))), 128))
3380
- ]),
3381
- _: 1
3382
- }, 8, ["modelValue"]),
3383
- createElementVNode("div", _hoisted_4, [
3384
- createVNode(o, {
3385
- icon: "close",
3386
- variant: "tertiary",
3387
- onClick: l[2] || (l[2] = (n) => sheetVisible.value = !1)
3388
- }),
3389
- createVNode(r, {
3390
- modelValue: unref(currentStep),
3391
- "onUpdate:modelValue": l[3] || (l[3] = (n) => isRef(currentStep) ? currentStep.value = n : null),
3392
- orientation: "horizontal",
3393
- class: "flex-1"
3394
- }, {
3395
- default: withCtx(() => [
3396
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, d) => (openBlock(), createBlock(i, {
3397
- key: n.name,
3398
- title: unref(sheetTitle),
3399
- description: unref(getLocaleText)(n.name_locale, n.name),
3400
- value: d + 1,
3401
- error: () => hasVisibleStepErrors(d),
3402
- complete: () => d + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
3403
- }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
3404
- ]),
3405
- _: 1
3406
- }, 8, ["modelValue"]),
3407
- createVNode(o, {
3408
- icon: "info",
3409
- variant: "tertiary",
3410
- onClick: l[4] || (l[4] = () => showSummaryDialog())
3411
- })
3412
- ]),
3413
- createElementVNode("div", _hoisted_5, [
3414
- createElementVNode("div", _hoisted_6, [
3415
- createVNode(JsonViewer, {
3416
- json: {
3417
- data: unref(data),
3418
- errors: unref(errors).map(
3419
- (n) => `${n.path.join(".")} - ${n.message}`
3420
- ),
3421
- stepErrors: stepErrors().map(
3422
- (n) => `${n.path.join(".")} - ${n.message}`
3423
- ),
3424
- schema: unref(schema)
3425
- }
3426
- }, null, 8, ["json"]),
3427
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
3428
- (n) => n.fields.length && (!n.condition || (Array.isArray(n.condition) ? n.condition.every((d) => unref(_).get(unref(data), d.property) == d.value == (d.not != !0)) : unref(_).get(unref(data), n.condition.property) == n.condition.value == (n.condition.not != !0)))
3429
- ), (n, d) => (openBlock(), createElementBlock("div", {
3430
- key: d,
3431
- class: "space-y-24"
3432
- }, [
3433
- createElementVNode("div", _hoisted_7, toDisplayString(unref(getLocaleText)(n.name_locale, n.name ?? "")), 1),
3434
- (openBlock(!0), createElementBlock(Fragment, null, renderList(n.fields, (s, h) => (openBlock(), createElementBlock("div", { key: h }, [
3435
- (openBlock(), createBlock(_sfc_main$2, {
3436
- key: h,
3437
- field: s,
3438
- modelValue: valueForField(s.property),
3439
- disabled: isDisable(s),
3440
- "campaign-type": unref(campaignType),
3441
- "show-validation": unref(showValidation),
3442
- "push-availability": unref(pushAvailability),
3443
- onRetryPush: checkPushAvailability,
3444
- "onUpdate:modelValue": (p) => onUpdateProperty(s.property, p),
3445
- "onUpdate:file": async (p, f) => {
3446
- const k = await onUpdateFile(p, f);
3447
- onUpdateProperty(s.property, k || "");
3448
- },
3449
- schema: unref(ZodHelper).typeAtPath(
3450
- unref(schema),
3451
- schemaPathForField(s.property),
3452
- unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
3453
- ),
3454
- "helper-state": unref(ZodHelper).helperState(
3455
- unref(visibleErrors),
3456
- schemaPathForField(s.property)
3457
- ),
3458
- "helper-text": unref(ZodHelper).helperText(
3459
- unref(visibleErrors),
3460
- schemaPathForField(s.property)
3461
- ),
3462
- extras: s.extras != null ? s.extras == "" ? unref(data) : unref(_).get(unref(data), s.extras) : void 0
3463
- }, null, 8, ["field", "modelValue", "disabled", "campaign-type", "show-validation", "push-availability", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
3464
- ]))), 128))
3465
- ]))), 128)),
3466
- createElementVNode("div", _hoisted_8, [
3467
- createVNode(o, {
3468
- label: unref(t)("connect.common.back"),
3469
- variant: "tertiary",
3470
- disabled: unref(currentStep) == 1,
3471
- onClick: l[5] || (l[5] = (n) => currentStep.value--)
3472
- }, null, 8, ["label", "disabled"]),
3473
- createVNode(o, {
3474
- disabled: isNextDisabled(),
3475
- label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? unref(t)("connect.common.next") : unref(t)("connect.common.submit"),
3476
- onClick: l[6] || (l[6] = (n) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? onNext() : onSubmit())
3477
- }, null, 8, ["disabled", "label"])
3478
- ])
3479
- ]),
3480
- createVNode(_sfc_main$1, {
3481
- data: unref(data),
3482
- class: "xs:hidden"
3483
- }, null, 8, ["data"])
3484
- ])
3485
- ])) : createCommentVNode("", !0)
3486
- ]),
3487
- key: "0"
3488
- }
3489
- ]), 1032, ["modelValue"]);
3490
- };
3491
- }
3492
- });
3493
- export {
3494
- _sfc_main as _,
3495
- useLocaleText as u
3496
- };