@feedmepos/mf-connect 0.1.126-prod → 0.1.127-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 (155) hide show
  1. package/dist/{App-DRHHPaMz.js → App-CLrxVFgX.js} +224 -216
  2. package/dist/AuditLogs-DYlfToAk.js +2016 -0
  3. package/dist/{Bin-FkcYLSTm.js → Bin-C0CugBW4.js} +8 -8
  4. package/dist/{Broadcast-Cgqp_BMa.js → Broadcast-DhVQa_WW.js} +22 -21
  5. package/dist/{CampaignAnalytic-kKZ_BwW0.js → CampaignAnalytic-6jeG5U90.js} +97 -97
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CX0mWLjO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cxydrkof.js} +9 -10
  7. package/dist/{Card-Bu1y37hV.js → Card-cpLj34Oy.js} +23 -23
  8. package/dist/{Collections-B3mJkBCT.js → Collections-CdRpJuHO.js} +197 -185
  9. package/dist/{Credit-Bn-2EcVy.js → Credit-E_N_yfnJ.js} +21 -20
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-Cz7pZ7LD.js → DateRangeChip.vue_vue_type_script_setup_true_lang-Dq-2vUqT.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSXO2bYC.js +4584 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-B7XBiv4l.js → EffectSheet.vue_vue_type_style_index_0_lang-BeQZjLIw.js} +33 -33
  13. package/dist/{Experience-CunbmoAu.js → Experience-D9i0ax4C.js} +32 -31
  14. package/dist/{FileSaver.min-ChFSxYyS.js → FileSaver.min-BOE2RBne.js} +1 -1
  15. package/dist/{Game-dFDwx_UJ.js → Game-CirwX_l1.js} +19 -18
  16. package/dist/{GiftCardSetup-DYpEqqX0.js → GiftCardSetup-DpJb_azW.js} +31 -31
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-DxJdI6gc.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-ff6Nfvxe.js} +140 -128
  18. package/dist/{Goals-DuZzgM_K.js → Goals-TejbPs-I.js} +4 -4
  19. package/dist/Grab-CeUX-LlF.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-lDulspkF.js → ImageInput.vue_vue_type_script_setup_true_lang-CnZzRDGS.js} +1 -1
  21. package/dist/{Index-BxB2ohT0.js → Index-gqWBDZBN.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-9sKJE1A5.js → LocationPicker.vue_vue_type_script_setup_true_lang-CzobgD7L.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CxBNYzcz.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DgeD1RQq.js} +1 -1
  24. package/dist/{LoyaltyDashboard-DQzGvQ7j.js → LoyaltyDashboard-R22oQHTd.js} +82 -82
  25. package/dist/{MainLayout-MAZ1S06H.js → MainLayout-pJBEBaM-.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-CeF3LU-N.js → MainLayout.vue_vue_type_script_setup_true_lang-IX_utv2Z.js} +3 -3
  27. package/dist/{Marketing-ACF6F7be.js → Marketing-5gMwO1jV.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-B8NfkoHg.js → MarketingMaterialEdit-BaHNX_qE.js} +214 -211
  29. package/dist/{Member-rLxDUOr8.js → Member-Cd0oraEq.js} +7 -7
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DzyM1fW_.js +1322 -0
  31. package/dist/{MemberImportHistory-BuG6DmdV.js → MemberImportHistory-C_RkY3fg.js} +7 -7
  32. package/dist/{MemberList-CC6zm_I6.js → MemberList-CJK1akUC.js} +103 -105
  33. package/dist/{MemberTransactions-Bw2xu6jZ.js → MemberTransactions-DP6schuy.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Cav8gQUK.js → MessageInput.vue_vue_type_script_setup_true_lang-BaivunRx.js} +12 -12
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8wdY4FnI.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DOdYyPp2.js} +1 -1
  36. package/dist/{Mission-DnEcbALs.js → Mission-DJ40IcG9.js} +22 -21
  37. package/dist/{Overview-DShFohlk.js → Overview-CaQlLSBg.js} +145 -144
  38. package/dist/{Overview-COytI5xN.js → Overview-DXHjNmIO.js} +21 -21
  39. package/dist/{Point-CWYwlx0i.js → Point-D0Qqmgai.js} +22 -21
  40. package/dist/{Promotion-LBrQYtad.js → Promotion-CQU2-tpG.js} +137 -131
  41. package/dist/{Queue-DKg5EvDM.js → Queue-B-Uki3qh.js} +46 -46
  42. package/dist/{Record--lYpawLN.js → Record-BvQ0nVja.js} +9 -9
  43. package/dist/{Review-C4pNmJ7n.js → Review-DMfBPU_D.js} +2 -2
  44. package/dist/ReviewFacebookCallback-Bq6JQ7LR.js +225 -0
  45. package/dist/{ReviewGoogleCallback-ge8fL_A-.js → ReviewGoogleCallback-Bg9PFxog.js} +5 -5
  46. package/dist/{Reward-B67r1Bpz.js → Reward-CNC0z98e.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Bt0Kx2--.js → RewardGroup.vue_vue_type_script_setup_true_lang-DXr-5wJE.js} +14 -14
  48. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-OznhirAU.js +1923 -0
  49. package/dist/{Segment-DeSC3z5G.js → Segment-V0ZQJkN-.js} +304 -307
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DdjC7X1V.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BmFp2pst.js} +15 -15
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Crys59UO.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-C0IbEZMG.js} +4 -4
  52. package/dist/{Setting-DiDcMU5E.js → Setting-DCb6IIrk.js} +17 -17
  53. package/dist/{SettingAdvertisements-3wMI9egH.js → SettingAdvertisements-Dc9XfzVl.js} +12 -12
  54. package/dist/Settings-BIjIfmFI.js +286 -0
  55. package/dist/{Store-DgefqByH.js → Store-DkoB_5IF.js} +29 -29
  56. package/dist/{StoreRewards-CS2h5RVB.js → StoreRewards-a4ujLMfY.js} +15 -15
  57. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-gPR8sn4k.js → StoreTransactions.vue_vue_type_script_setup_true_lang-UbMY0RzG.js} +25 -25
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BWjb1wHV.js +7007 -0
  59. package/dist/{Tier-Cye6888q.js → Tier-1WKuUirS.js} +2583 -688
  60. package/dist/{Title-B1eJh5oy.js → Title-CznZg4jL.js} +96 -95
  61. package/dist/{Transaction-ouzdsBUx.js → Transaction-DBRQDmA3.js} +2 -2
  62. package/dist/{Upselling-CdQd2Fuk.js → Upselling-CjZvUUqn.js} +3 -3
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BSlxe1Hf.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DS4hdSE9.js} +26 -26
  64. package/dist/{Voucher-CJJt8VlJ.js → Voucher-Di6VhoSM.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BzbNaK6H.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BjSzCnBw.js} +12 -12
  66. package/dist/{WhatsappAccount-DIxSP6Tp.js → WhatsappAccount-DdXadlHI.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-L9Y5lAft.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Cnlvi-GG.js} +1 -1
  68. package/dist/WhatsappBot-DwhQmZLJ.js +882 -0
  69. package/dist/{WhatsappBotLogs-D8IfLHk3.js → WhatsappBotLogs-BAglKUAZ.js} +66 -66
  70. package/dist/WhatsappBotSettings-DslJTj2X.js +945 -0
  71. package/dist/{WhatsappLayout-3rWwmGRd.js → WhatsappLayout-14847AOz.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-C3N-loYJ.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-otzgv6Jh.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-D1dORvMi.js → ZodTextField.vue_vue_type_script_setup_true_lang-BEY-LOVu.js} +2 -2
  74. package/dist/{app-BXqas0p1.js → app-KbxCI4gY.js} +4204 -3400
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-DQCZiS2E.js → base.export-DH8OxNrx.js} +2 -2
  77. package/dist/business-DuKNr9P7.js +83 -0
  78. package/dist/{campaign-C2X6aa7B.js → campaign-DR5xHhgA.js} +31 -25
  79. package/dist/{campaign-DASPASQ0.js → campaign-Ddv-RZgo.js} +121 -94
  80. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-DsaSpHDQ.js} +3 -2
  81. package/dist/campaign.fn-CJlEovlZ.js +776 -0
  82. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-CDHT9uk3.js} +1 -1
  83. package/dist/{collection.fn-C7jNdh0A.js → collection.fn-DTZs-hUX.js} +2 -2
  84. package/dist/{currency-BvBM_Io9.js → currency-1-Yhpyv5.js} +1 -1
  85. package/dist/duplicateCampaign-BncSxYSg.js +51 -0
  86. package/dist/{effect-BA1yh6Mj.js → effect-TTD5--LN.js} +1 -1
  87. package/dist/{email-addresses-haS5P7hq.js → email-addresses-pxXp67Al.js} +2 -2
  88. package/dist/{feature-flag-B4bJnuei.js → feature-flag-CFVZl4ed.js} +84 -84
  89. package/dist/google-BQK68wbe.js +5 -0
  90. package/dist/{helper-BtTBvFuA.js → helper-BC_Cl5VR.js} +1 -1
  91. package/dist/{index-ChGZ_S3V.js → index-42Wl_5UE.js} +1 -1
  92. package/dist/{index-Dm2Dvxph.js → index-BRl7Besd.js} +23 -23
  93. package/dist/{index-DAtVp1NI.js → index-BxUMqeaY.js} +2700 -2614
  94. package/dist/{index-Dg972Dfv.js → index-ByFFDLTo.js} +1 -1
  95. package/dist/{index-DtbR7I4C.js → index-CBKbnJRo.js} +9 -9
  96. package/dist/index-CGtlXLTG.js +10767 -0
  97. package/dist/{index-CH-uRaZH.js → index-CRKdLbXL.js} +71 -52
  98. package/dist/{index-B1dAoOWi.js → index-CaHkqz0W.js} +19 -6
  99. package/dist/{index-DeomfIu9.js → index-CcXMYJxc.js} +609 -252
  100. package/dist/{index-B6A6sHpy.js → index-CkiP4iG6.js} +1 -1
  101. package/dist/{index-g_SHjVWE.js → index-D1iOPNg3.js} +1 -1
  102. package/dist/{index-D-D0s8PB.js → index-D2Nq0UoL.js} +381 -235
  103. package/dist/index-D4nA0Z7e.js +19528 -0
  104. package/dist/{index-BV-YiCDM.js → index-DHw8wo7T.js} +2 -2
  105. package/dist/{index-C2rjmdar.js → index-DKOoRHPf.js} +4 -4
  106. package/dist/{index-Q-iHraJ3.js → index-DcbPYZkw.js} +26 -19
  107. package/dist/{index-C7UBk5gq.js → index-DjwrfZk3.js} +35 -17
  108. package/dist/{index-BvFq5REc.js → index-EuZfRdBT.js} +10 -10
  109. package/dist/{index-CJ-BZCvB.js → index-H4XJDOoT.js} +1315 -1243
  110. package/dist/{index-CXznvd79.js → index-ImU7YXN7.js} +4 -4
  111. package/dist/{index-BRTy6G9c.js → index-N4EzkcEu.js} +2 -2
  112. package/dist/{index-CBfVFFME.js → index-j7eLKJK3.js} +198 -198
  113. package/dist/{index.esm2017-B7iE1Ggr.js → index.esm2017-CBo4j3U1.js} +93 -93
  114. package/dist/{loading-BvlSfSVK.js → loading-COAu2l7W.js} +1 -1
  115. package/dist/{lodash-Daey2k0N.js → lodash-Bu1ipIkR.js} +1 -1
  116. package/dist/{member-import-CF9aym_y.js → member-import-CkiTJIqy.js} +2 -2
  117. package/dist/{membership-DfG-fl80.js → membership-BSEeYyiz.js} +3 -3
  118. package/dist/{money-SBIQhxqf.js → money-BOaGQSGa.js} +1 -1
  119. package/dist/{number-Cp1bFK9U.js → number-B2AC2EMT.js} +1 -1
  120. package/dist/objectid-BKw48v5L.js +145 -0
  121. package/dist/{onboarding-bjc7C8O-.js → onboarding-ClA8xAnH.js} +25 -25
  122. package/dist/{onboardingSetup-BAu9TDI6.js → onboardingSetup-DHjnq0H1.js} +2 -2
  123. package/dist/{plugins-Def73Eyk.js → plugins-DewN43sP.js} +3 -3
  124. package/dist/{reward-KecVeztH.js → reward-deDdPQiR.js} +1 -1
  125. package/dist/{rule-kMIC0vOi.js → rule-B8ifutnO.js} +572 -492
  126. package/dist/style.css +1 -1
  127. package/dist/template-z3VMmWei.js +227 -0
  128. package/dist/timezone-BxJDy-bY.js +19 -0
  129. package/dist/{transaction.fn-Bjy5utxD.js → transaction.fn-CBBhq01K.js} +2 -2
  130. package/dist/{trigger-DnnOJVUi.js → trigger-B_quLwWr.js} +9 -9
  131. package/dist/{useMarketingMaterialActions-DMrNOpok.js → useMarketingMaterialActions-DqoRLx1M.js} +4 -4
  132. package/dist/{usePagination-BCY4a-dh.js → usePagination-Q1fPttcp.js} +1 -1
  133. package/dist/{user-BTc0S1Vx.js → user-Bw6h9xn-.js} +1 -1
  134. package/dist/vue-i18n-DpCS1FnK.js +2365 -0
  135. package/dist/{xlsx-DR5oLrEs.js → xlsx--toeD6hC.js} +1 -1
  136. package/dist/{zod-CMq39HWn.js → zod-BkNAcpay.js} +1 -1
  137. package/package.json +6 -2
  138. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DIUEjCFW.js +0 -3638
  139. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-Bq3UKX7v.js +0 -1308
  140. package/dist/ReviewFacebookCallback-BYXwKQNG.js +0 -238
  141. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-fLtn32Rw.js +0 -1884
  142. package/dist/Settings-BR6Y1DBZ.js +0 -179
  143. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Cjnkpd1j.js +0 -142
  144. package/dist/WhatsappBot-BXxoaz7-.js +0 -878
  145. package/dist/WhatsappBotSettings-Bq9C7pNZ.js +0 -704
  146. package/dist/business-RsRhXSh8.js +0 -82
  147. package/dist/campaign.fn-BEX99lsa.js +0 -776
  148. package/dist/google-C3S8u0mT.js +0 -4
  149. package/dist/index-C_H8jFYf.js +0 -2743
  150. package/dist/index-D9zjHXFU.js +0 -27551
  151. package/dist/objectid-BMRA1fIL.js +0 -145
  152. package/dist/rule-builder-DgU6P24U.js +0 -102
  153. package/dist/template-BH9vS8A9.js +0 -275
  154. package/dist/timezone-CMX1sJ0a.js +0 -20
  155. package/dist/vue-i18n-7BKLPLxj.js +0 -2365
@@ -0,0 +1,4584 @@
1
+ import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, createCommentVNode, computed, onMounted, toDisplayString, createBlock, withCtx, Fragment, renderList, withModifiers, isRef, createTextVNode, normalizeClass, watchEffect, resolveDynamicComponent, toRefs, normalizeStyle, nextTick, onBeforeUnmount, createSlots } from "vue";
2
+ import { _ } from "./lodash-Bu1ipIkR.js";
3
+ import { f as axios, c as core, S as SvcConfig } from "./index-EuZfRdBT.js";
4
+ import { z, S as S6, h as Zh } from "./app-KbxCI4gY.js";
5
+ import { Z as ZodHelper } from "./zod-BkNAcpay.js";
6
+ import { z as z$1 } from "./index-CGtlXLTG.js";
7
+ import { d as FdoGroup, F as F_RUNNABLE_CAMPAIGN_TYPE, e as FdtoRunnableCampaign, f as FdoCreditLoyaltyReward, g as FdtoRandomReward, h as F_MISSION_TYPE, i as FdoThresholdCreditReward, j as FdtoThresholdReward, k as FdoMission } from "./index-D2Nq0UoL.js";
8
+ import { F as FdoObjectId } from "./index-D4nA0Z7e.js";
9
+ import { F as FdtoCollectibleConfig } from "./index-BxUMqeaY.js";
10
+ import { a as isRuleGroup, R as RuleBuilder, s as stripRruleDtstartExceptSchedule, i as isRuleEntry, T as TEMPLATES } from "./index-CcXMYJxc.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-j7eLKJK3.js";
12
+ import { e as CHANNEL_DISPLAY_ORDER, i as isPaidChannel, f as isChannelComplete, h as setMode, j as addChannel, k as hasDraft, l as setPrimaryChannel, r as removeChannel, m as moveChannel, n as setChannelContent, o as getCampaignSummaryObject, p as normaliseBroadcastDelivery } from "./campaign-Ddv-RZgo.js";
13
+ import { u as useMembershipStore } from "./membership-BSEeYyiz.js";
14
+ import { u as useBusinessStore } from "./business-DuKNr9P7.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-DsaSpHDQ.js";
18
+ import { _ as _sfc_main$D } from "./ImageInput.vue_vue_type_script_setup_true_lang-CnZzRDGS.js";
19
+ import { _ as _sfc_main$B, a as _sfc_main$E, b as _sfc_main$G } from "./EffectSheet.vue_vue_type_style_index_0_lang-BeQZjLIw.js";
20
+ import { _ as _sfc_main$F } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-BWjb1wHV.js";
21
+ import { p as prompt, f as firebaseStorage } from "./plugins-DewN43sP.js";
22
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-CHgC5LLL.js";
23
+ import { _ as _sfc_main$H } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-DS4hdSE9.js";
24
+ import { a as _sfc_main$v, _ as _sfc_main$z } from "./RuleGroup.vue_vue_type_script_setup_true_lang-OznhirAU.js";
25
+ import { u as useI18n } from "./vue-i18n-DpCS1FnK.js";
26
+ import { T as TypeToTriggerOptions, _ as _sfc_main$I, a as _sfc_main$J } from "./trigger-B_quLwWr.js";
27
+ import { D as DEFAULT_MESSAGE_VARIABLES, a as _sfc_main$w, g as getSmsMessageMetrics, _ as _sfc_main$x, b as _sfc_main$y } from "./MessageInput.vue_vue_type_script_setup_true_lang-BaivunRx.js";
28
+ import { useDialog } from "@feedmepos/ui-library";
29
+ import { useCoreStore } from "@feedmepos/mf-common";
30
+ import { c as campaignApi } from "./index-DHw8wo7T.js";
31
+ import { m as membershipApi } from "./index-CaHkqz0W.js";
32
+ import { a as useChannelFlag } from "./feature-flag-CFVZl4ed.js";
33
+ import { m as moment } from "./index-CkiP4iG6.js";
34
+ import { c as calculateNextScheduleAt, R as RRule, S as SummarizeRrule, g as getRruleAnchorDate } from "./rule-B8ifutnO.js";
35
+ import { F as F_COUNTRY_TIMEZONE } from "./timezone-BxJDy-bY.js";
36
+ import { _ as _sfc_main$A, a as _sfc_main$C } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-BjSzCnBw.js";
37
+ import "./index-H4XJDOoT.js";
38
+ import "./index-DKOoRHPf.js";
39
+ import "./index-CRKdLbXL.js";
40
+ import "./index-DcbPYZkw.js";
41
+ import { a as F_GAME_TYPE } from "./collectible.enum-CDHT9uk3.js";
42
+ import { u as useLoading } from "./loading-COAu2l7W.js";
43
+ import { i as initCollectibleConfig } from "./helper-BC_Cl5VR.js";
44
+ import { C as CollectionUtils } from "./collection.fn-DTZs-hUX.js";
45
+ import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
46
+ import { u as useCampaignStore } from "./campaign-DR5xHhgA.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.feedmedev.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, r) {
61
+ var d, p;
62
+ if (console.log(e, r), !e) return;
63
+ const o = e.campaign;
64
+ if (!o) return;
65
+ const m = o.event.rule;
66
+ if (!m || !isRuleGroup(m)) {
67
+ r.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 && r.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 l = (d = o.config) == null ? void 0 : d.validityOption;
91
+ (!l || ["validForDay", "validBefore"].every((a) => l[a] == null)) && r.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((l, n) => {
103
+ (l.threshold < 0 || l.threshold > o.mission.end) && r.addIssue({
104
+ code: "custom",
105
+ path: ["campaign", "rewards", n, "threshold"],
106
+ params: {
107
+ i18n: "connectZodCustom:campaign.reward_threshold_range"
108
+ }
109
+ });
110
+ }), (p = o.config) != null && p.validityOption.followFirstReceive || r.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 (!m.rules.g_schedule) {
120
+ r.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 l = RuleBuilder.getRules(
131
+ m.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 == l.length && n.every((u) => l.some((y) => {
143
+ const f = RuleBuilder.simplify(y);
144
+ return f.property === u.property && u.operator.includes(f.operator);
145
+ })) || r.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" && r.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 m = e.configs;
170
+ m.extras.targetLocation = e.campaign.targetLocation;
171
+ const d = Math.max(
172
+ e.campaign.earningOption.amount,
173
+ m.options.maxUse ?? 1
174
+ );
175
+ e.campaign.earningOption.amount = d, m.options.maxUse = d, e.campaign.earningOption = {
176
+ type: "FIXED",
177
+ amount: 1
178
+ };
179
+ }
180
+ if (e.campaign.type == "MISSION" && "configs" in e) {
181
+ const m = e.configs;
182
+ m.options.validityOption = (o = e.campaign.config) == null ? void 0 : o.validityOption;
183
+ }
184
+ const r = e.campaign.event;
185
+ return r.type != "BILL_COMPLETED" && r.rule && isRuleGroup(r.rule) && (r.rule = RuleBuilder.removeEntry(r.rule, "g_bill"), e.campaign.event = r), r.rule && isRuleGroup(r.rule) && (r.rule = stripRruleDtstartExceptSchedule(r.rule), e.campaign.event = r), e;
186
+ }
187
+ function GenerateCampaignReq(e) {
188
+ const r = 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: r,
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: r,
204
+ templateId: FdoObjectId
205
+ });
206
+ case "POINT":
207
+ return z$1.object({
208
+ campaign: r,
209
+ templateId: FdoObjectId
210
+ });
211
+ case "CREDIT":
212
+ return z$1.object({
213
+ campaign: r,
214
+ templateId: FdoObjectId
215
+ });
216
+ case "BROADCAST":
217
+ return z$1.object({
218
+ campaign: r.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: r,
227
+ templateId: FdoObjectId
228
+ });
229
+ case "REWARD_POOL":
230
+ return z$1.object({
231
+ campaign: r,
232
+ templateId: FdoObjectId,
233
+ updateCollections: z$1.boolean().optional()
234
+ });
235
+ case "GAME":
236
+ return z$1.object({
237
+ campaign: r,
238
+ configs: FdtoCollectibleConfig,
239
+ templateId: FdoObjectId,
240
+ updateCollections: z$1.boolean().optional()
241
+ });
242
+ case "MISSION":
243
+ return z$1.object({
244
+ campaign: r,
245
+ configs: FdtoCollectibleConfig,
246
+ templateId: FdoObjectId,
247
+ updateCollections: z$1.boolean().optional()
248
+ });
249
+ case "GRAB":
250
+ return z$1.object({
251
+ campaign: r,
252
+ templateId: FdoObjectId
253
+ });
254
+ default:
255
+ throw new Error("Not implemented");
256
+ }
257
+ }
258
+ FdoGroup.extend({
259
+ _id: FdoObjectId.optional(),
260
+ name: z$1.string().min(1).max(300),
261
+ business: FdoObjectId.optional(),
262
+ campaigns: z$1.array(FdoObjectId).optional()
263
+ });
264
+ const CampaignDtos = {
265
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.VOUCHER]: GenerateCampaignReq("VOUCHER"),
266
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.PROMOTION]: GenerateCampaignReq("PROMOTION"),
267
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.POINT]: GenerateCampaignReq("POINT"),
268
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.CREDIT]: GenerateCampaignReq("CREDIT"),
269
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.BROADCAST]: GenerateCampaignReq("BROADCAST"),
270
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.COIN]: GenerateCampaignReq("COIN"),
271
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.REWARD_POOL]: GenerateCampaignReq("REWARD_POOL"),
272
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.GAME]: GenerateCampaignReq("GAME"),
273
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.MISSION]: GenerateCampaignReq("MISSION"),
274
+ [F_RUNNABLE_CAMPAIGN_TYPE.enum.GRAB]: GenerateCampaignReq("GRAB")
275
+ };
276
+ function summarizeGrabDiscount(e) {
277
+ if (!e)
278
+ return null;
279
+ const r = core.Config.getCountry().currency.symbol;
280
+ function o(l) {
281
+ switch (l.scope.type) {
282
+ case "order":
283
+ return "Bill discount";
284
+ case "items":
285
+ return l.type.startsWith("bundle") ? m(l.type) : "Item discount";
286
+ case "categories":
287
+ return "Category discount";
288
+ default:
289
+ return "Discount";
290
+ }
291
+ }
292
+ function m(l) {
293
+ switch (l) {
294
+ case "bundleSameFixPrice":
295
+ return "Bundle (same item) - Fixed price";
296
+ case "bundleDiffFixPrice":
297
+ return "Bundle (different items) - Fixed price";
298
+ case "bundleSameNet":
299
+ return "Bundle (same item) - Amount off";
300
+ case "bundleDiffNet":
301
+ return "Bundle (different items) - Amount off";
302
+ case "bundleSamePercentage":
303
+ return "Bundle (same item) - Percentage off";
304
+ case "bundleDiffPercentage":
305
+ return "Bundle (different items) - Percentage off";
306
+ default:
307
+ return "Bundle discount";
308
+ }
309
+ }
310
+ function d(l) {
311
+ switch (l.type) {
312
+ case "percentage":
313
+ case "bundleSamePercentage":
314
+ case "bundleDiffPercentage":
315
+ return `${l.value}% discount`;
316
+ case "net":
317
+ case "bundleSameNet":
318
+ case "bundleDiffNet":
319
+ return `${r}${l.value} discount`;
320
+ case "bundleSameFixPrice":
321
+ case "bundleDiffFixPrice":
322
+ return `${r}${l.value} fixed price`;
323
+ case "delivery":
324
+ return "Delivery fee discount";
325
+ case "freeItem":
326
+ return "Free item";
327
+ default:
328
+ return `${r}${l.value} discount`;
329
+ }
330
+ }
331
+ function p(l) {
332
+ return l.cap && l.cap > 0 ? `capped at ${r}${l.cap}` : null;
333
+ }
334
+ return {
335
+ type: o(e),
336
+ adjustment: d(e),
337
+ cap: p(e)
338
+ };
339
+ }
340
+ const _hoisted_1$s = {
341
+ key: 0,
342
+ class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
343
+ }, _hoisted_2$o = { class: "flex items-center justify-between" }, _hoisted_3$l = { class: "flex items-center gap-8" }, _hoisted_4$l = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 p-16" }, _hoisted_5$i = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$u = /* @__PURE__ */ defineComponent({
344
+ __name: "GrabItemSelectionInline",
345
+ props: {
346
+ visible: { type: Boolean },
347
+ initialValue: {},
348
+ filterItems: { type: Function }
349
+ },
350
+ emits: ["confirm", "cancel"],
351
+ setup(e, { emit: r }) {
352
+ const o = e, m = r, d = ref();
353
+ watch(
354
+ () => o.visible,
355
+ (a) => {
356
+ var u, y;
357
+ !a && d.value && ((y = (u = d.value).setSelectedItems) == null || y.call(u, o.initialValue || []));
358
+ }
359
+ );
360
+ function p() {
361
+ var a;
362
+ (a = d.value) == null || a.onConfirm();
363
+ }
364
+ function l() {
365
+ m("cancel");
366
+ }
367
+ function n(a) {
368
+ m("confirm", a);
369
+ }
370
+ return (a, u) => {
371
+ const y = resolveComponent("FmIcon"), f = resolveComponent("FmButton");
372
+ return e.visible ? (openBlock(), createElementBlock("div", _hoisted_1$s, [
373
+ createElementVNode("div", _hoisted_2$o, [
374
+ createElementVNode("div", _hoisted_3$l, [
375
+ createVNode(y, {
376
+ name: "restaurant",
377
+ size: "md"
378
+ }),
379
+ u[0] || (u[0] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Items", -1))
380
+ ]),
381
+ createVNode(f, {
382
+ icon: "close",
383
+ variant: "tertiary",
384
+ onClick: l
385
+ })
386
+ ]),
387
+ u[1] || (u[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which items this discount applies to. For bundle discounts, select multiple items that can be bundled together. ", -1)),
388
+ createElementVNode("div", _hoisted_4$l, [
389
+ createVNode(unref(S6), {
390
+ ref_key: "selectItemRef",
391
+ ref: d,
392
+ "initial-value": e.initialValue,
393
+ "filter-items": e.filterItems,
394
+ "on-complete": n,
395
+ "max-height": 300
396
+ }, null, 8, ["initial-value", "filter-items"])
397
+ ]),
398
+ createElementVNode("div", _hoisted_5$i, [
399
+ createVNode(f, {
400
+ variant: "secondary",
401
+ label: "Cancel",
402
+ onClick: l
403
+ }),
404
+ createVNode(f, {
405
+ variant: "primary",
406
+ label: "Confirm Selection",
407
+ onClick: p
408
+ })
409
+ ])
410
+ ])) : createCommentVNode("", !0);
411
+ };
412
+ }
413
+ }), _hoisted_1$r = {
414
+ key: 0,
415
+ class: "bg-fm-color-neutral-gray-50 border border-fm-color-neutral-gray-200 rounded-8 p-16 space-y-16"
416
+ }, _hoisted_2$n = { class: "flex items-center justify-between" }, _hoisted_3$k = { class: "flex items-center gap-8" }, _hoisted_4$k = { class: "flex gap-16 items-center flex-wrap" }, _hoisted_5$h = { class: "flex gap-8 items-center" }, _hoisted_6$d = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_7$b = { class: "bg-white border border-fm-color-neutral-gray-200 rounded-8 max-h-[300px] overflow-y-auto" }, _hoisted_8$a = { class: "flex items-center gap-12" }, _hoisted_9$9 = { class: "fm-typo-en-body-md-600" }, _hoisted_10$8 = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_11$6 = {
417
+ key: 1,
418
+ class: "p-24 text-center"
419
+ }, _hoisted_12$5 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_13$5 = { class: "flex justify-end gap-8 pt-8 border-t border-fm-color-neutral-gray-200" }, _sfc_main$t = /* @__PURE__ */ defineComponent({
420
+ __name: "GrabCategorySelectionInline",
421
+ props: {
422
+ visible: { type: Boolean },
423
+ initialValue: {}
424
+ },
425
+ emits: ["confirm", "cancel"],
426
+ setup(e, { emit: r }) {
427
+ const o = e, m = r, d = Zh(), p = ref({}), l = ref(""), n = computed(() => {
428
+ const i = d.menu.value;
429
+ return i ? i.modules.category.map((c) => ({
430
+ id: c._id,
431
+ name: c.name
432
+ })) : [];
433
+ }), a = computed(() => {
434
+ if (!l.value) return n.value;
435
+ const i = l.value.toLowerCase();
436
+ return n.value.filter(
437
+ (c) => c.name.toLowerCase().includes(i)
438
+ );
439
+ }), u = computed(() => Object.values(p.value).filter(Boolean).length);
440
+ function y() {
441
+ p.value = n.value.reduce(
442
+ (i, c) => (i[c.id] = o.initialValue.includes(c.id), i),
443
+ {}
444
+ );
445
+ }
446
+ watch([() => o.visible, () => o.initialValue], () => {
447
+ o.visible && y();
448
+ }), onMounted(async () => {
449
+ await d.store.getMenu(), y();
450
+ });
451
+ function f(i) {
452
+ p.value[i] = !p.value[i];
453
+ }
454
+ function s() {
455
+ const i = u.value === a.value.length;
456
+ a.value.forEach((c) => {
457
+ p.value[c.id] = !i;
458
+ });
459
+ }
460
+ function k() {
461
+ Object.keys(p.value).forEach((i) => {
462
+ p.value[i] = !1;
463
+ });
464
+ }
465
+ function x() {
466
+ const i = Object.entries(p.value).filter(([, c]) => c).map(([c]) => c);
467
+ m("confirm", i);
468
+ }
469
+ function h() {
470
+ m("cancel");
471
+ }
472
+ const v = computed(() => a.value.length > 0 && a.value.every(
473
+ (i) => p.value[i.id]
474
+ ));
475
+ return (i, c) => {
476
+ const C = resolveComponent("FmIcon"), V = resolveComponent("FmButton"), $ = resolveComponent("FmTextField"), S = resolveComponent("FmCheckbox"), w = resolveComponent("FmListItem"), R = resolveComponent("FmList");
477
+ return e.visible ? (openBlock(), createElementBlock("div", _hoisted_1$r, [
478
+ createElementVNode("div", _hoisted_2$n, [
479
+ createElementVNode("div", _hoisted_3$k, [
480
+ createVNode(C, {
481
+ name: "category",
482
+ size: "md"
483
+ }),
484
+ c[2] || (c[2] = createElementVNode("h3", { class: "fm-typo-en-body-lg-600" }, "Select Categories", -1))
485
+ ]),
486
+ createVNode(V, {
487
+ icon: "close",
488
+ variant: "tertiary",
489
+ onClick: h
490
+ })
491
+ ]),
492
+ c[3] || (c[3] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which categories this discount applies to. The discount will be available for all items within the selected categories. ", -1)),
493
+ createElementVNode("div", _hoisted_4$k, [
494
+ createElementVNode("div", _hoisted_5$h, [
495
+ createVNode(V, {
496
+ icon: "select_all",
497
+ variant: "tertiary",
498
+ size: "small",
499
+ label: `${v.value ? "Deselect" : "Select"} All`,
500
+ onClick: s
501
+ }, null, 8, ["label"]),
502
+ createVNode(V, {
503
+ icon: "sync",
504
+ variant: "tertiary",
505
+ size: "small",
506
+ label: "Clear",
507
+ onClick: k
508
+ }),
509
+ createElementVNode("span", _hoisted_6$d, toDisplayString(u.value) + " selected ", 1)
510
+ ]),
511
+ createVNode($, {
512
+ modelValue: l.value,
513
+ "onUpdate:modelValue": c[0] || (c[0] = (F) => l.value = F),
514
+ placeholder: "Search categories",
515
+ "leading-icon": { name: "search", color: "" },
516
+ class: "flex-1 min-w-[200px]"
517
+ }, null, 8, ["modelValue"])
518
+ ]),
519
+ createElementVNode("div", _hoisted_7$b, [
520
+ a.value.length > 0 ? (openBlock(), createBlock(R, { key: 0 }, {
521
+ default: withCtx(() => [
522
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(a.value, (F) => (openBlock(), createBlock(w, {
523
+ key: F.id,
524
+ clickable: !0,
525
+ onClick: (M) => f(F.id)
526
+ }, {
527
+ leading: withCtx(() => [
528
+ createVNode(S, {
529
+ "model-value": p.value[F.id] || !1,
530
+ value: F.id,
531
+ "onUpdate:modelValue": (M) => f(F.id),
532
+ onClick: c[1] || (c[1] = withModifiers(() => {
533
+ }, ["stop"]))
534
+ }, null, 8, ["model-value", "value", "onUpdate:modelValue"])
535
+ ]),
536
+ default: withCtx(() => [
537
+ createElementVNode("div", _hoisted_8$a, [
538
+ createVNode(C, {
539
+ name: "category",
540
+ size: "sm",
541
+ class: "text-fm-color-typo-secondary"
542
+ }),
543
+ createElementVNode("div", null, [
544
+ createElementVNode("div", _hoisted_9$9, toDisplayString(F.name), 1),
545
+ createElementVNode("div", _hoisted_10$8, " ID: " + toDisplayString(F.id), 1)
546
+ ])
547
+ ])
548
+ ]),
549
+ _: 2
550
+ }, 1032, ["onClick"]))), 128))
551
+ ]),
552
+ _: 1
553
+ })) : (openBlock(), createElementBlock("div", _hoisted_11$6, [
554
+ createElementVNode("div", _hoisted_12$5, toDisplayString(l.value ? "No categories found matching your search." : "No categories available."), 1)
555
+ ]))
556
+ ]),
557
+ createElementVNode("div", _hoisted_13$5, [
558
+ createVNode(V, {
559
+ variant: "secondary",
560
+ label: "Cancel",
561
+ onClick: h
562
+ }),
563
+ createVNode(V, {
564
+ variant: "primary",
565
+ label: `Confirm Selection (${u.value})`,
566
+ disabled: u.value === 0,
567
+ onClick: x
568
+ }, null, 8, ["label", "disabled"])
569
+ ])
570
+ ])) : createCommentVNode("", !0);
571
+ };
572
+ }
573
+ }), _hoisted_1$q = { class: "space-y-8" }, _hoisted_2$m = {
574
+ key: 1,
575
+ class: "border-1 rounded-md flex gap-16 items-center justify-between px-16 py-12"
576
+ }, _hoisted_3$j = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$j = { class: "text-fm-color-typo-secondary" }, _hoisted_5$g = { key: 0 }, _hoisted_6$c = { class: "space-y-24" }, _hoisted_7$a = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary mt-4" }, _hoisted_8$9 = { key: 0 }, _hoisted_9$8 = { class: "fm-typo-en-body-md-600 mb-8 block" }, _hoisted_10$7 = { key: 1 }, _hoisted_11$5 = { key: 2 }, _hoisted_12$4 = { key: 0 }, _hoisted_13$4 = { class: "space-y-8" }, _hoisted_14$4 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_15$3 = { class: "flex items-center gap-8" }, _hoisted_16$2 = { class: "fm-typo-en-body-md-400" }, _hoisted_17$2 = { key: 3 }, _hoisted_18$2 = { key: 0 }, _hoisted_19$2 = { class: "space-y-8" }, _hoisted_20$2 = { class: "flex items-center justify-between p-12 border border-fm-color-neutral-gray-200 fm-corner-radius-md" }, _hoisted_21$1 = { class: "flex items-center gap-8" }, _hoisted_22$1 = { class: "fm-typo-en-body-md-400" }, _hoisted_23$1 = {
577
+ key: 0,
578
+ class: "mt-16 p-12 bg-fm-color-feedback-error-light rounded-8 border border-fm-color-feedback-error-main"
579
+ }, _hoisted_24$1 = { class: "flex items-center gap-8 mb-8 text-fm-color-system-error-300" }, _hoisted_25$1 = { class: "space-y-4" }, _hoisted_26$1 = { class: "flex gap-16" }, _sfc_main$s = /* @__PURE__ */ defineComponent({
580
+ __name: "GrabEffectSheet",
581
+ props: {
582
+ modelValue: { type: Object }
583
+ },
584
+ emits: ["update:model-value"],
585
+ setup(e, { emit: r }) {
586
+ const o = e, m = r, d = Zh(), p = ref(!1), l = ref(!1), n = ref(!1), a = ref({
587
+ type: "net",
588
+ value: 0,
589
+ scope: {
590
+ type: "order"
591
+ }
592
+ });
593
+ watch(
594
+ () => o.modelValue,
595
+ (b) => {
596
+ b && (a.value = { ...b });
597
+ },
598
+ { immediate: !0 }
599
+ ), onMounted(async () => {
600
+ await d.store.getMenu();
601
+ });
602
+ const u = computed(() => {
603
+ var b;
604
+ return !(!a.value.type || !((b = a.value.scope) != null && b.type) || s(a.value.type) && (!a.value.value || a.value.value <= 0) || (a.value.scope.type === "items" || a.value.scope.type === "category") && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0));
605
+ });
606
+ async function y(b) {
607
+ b.stopPropagation(), await prompt.remove("Are you sure you want to remove this discount?") && m("update:model-value", null);
608
+ }
609
+ function f() {
610
+ var b;
611
+ return C(((b = a.value.scope) == null ? void 0 : b.type) || "order");
612
+ }
613
+ function s(b) {
614
+ return b && !["freeItem", "delivery"].includes(b);
615
+ }
616
+ function k(b) {
617
+ return b && ["percentage", "bundleSamePercentage", "bundleDiffPercentage"].includes(
618
+ b
619
+ );
620
+ }
621
+ function x(b) {
622
+ return b != null && b.includes("Percentage") ? "Discount percentage" : b != null && b.includes("FixPrice") ? "Bundle fixed price" : b === "percentage" ? "Discount percentage" : "Discount amount";
623
+ }
624
+ function h(b) {
625
+ return b != null && b.includes("Percentage") || b === "percentage" ? "10" : "5.00";
626
+ }
627
+ function v(b) {
628
+ return b != null && b.includes("Percentage") || b === "percentage" ? "%" : "$";
629
+ }
630
+ function i(b, B) {
631
+ a.value = {
632
+ ...a.value,
633
+ [b]: B
634
+ };
635
+ }
636
+ function c(b, B) {
637
+ var O;
638
+ const D = {
639
+ ...a.value.scope,
640
+ [b]: B
641
+ };
642
+ if (a.value = {
643
+ ...a.value,
644
+ scope: D
645
+ }, b === "type") {
646
+ const A = C(B);
647
+ A.some(
648
+ (j) => j.value === a.value.type
649
+ ) || (a.value = {
650
+ ...a.value,
651
+ type: ((O = A[0]) == null ? void 0 : O.value) || "net",
652
+ // Reset value and cap when changing to incompatible type
653
+ value: 0,
654
+ cap: void 0
655
+ });
656
+ }
657
+ }
658
+ function C(b) {
659
+ switch (b) {
660
+ case "order":
661
+ return [
662
+ { label: "Amount off", value: "net" },
663
+ { label: "Percentage off", value: "percentage" },
664
+ { label: "Delivery fee off", value: "delivery" }
665
+ ];
666
+ case "category":
667
+ return [
668
+ { label: "Amount off", value: "net" },
669
+ { label: "Percentage off", value: "percentage" }
670
+ ];
671
+ case "items":
672
+ return [
673
+ { label: "Amount off", value: "net" },
674
+ { label: "Percentage off", value: "percentage" },
675
+ { label: "Free item", value: "freeItem" },
676
+ {
677
+ label: "Bundle (same item) - Fixed price",
678
+ value: "bundleSameFixPrice"
679
+ },
680
+ { label: "Bundle (same item) - Amount off", value: "bundleSameNet" },
681
+ {
682
+ label: "Bundle (same item) - Percentage off",
683
+ value: "bundleSamePercentage"
684
+ },
685
+ {
686
+ label: "Bundle (different items) - Fixed price",
687
+ value: "bundleDiffFixPrice"
688
+ },
689
+ {
690
+ label: "Bundle (different items) - Amount off",
691
+ value: "bundleDiffNet"
692
+ },
693
+ {
694
+ label: "Bundle (different items) - Percentage off",
695
+ value: "bundleDiffPercentage"
696
+ }
697
+ ];
698
+ default:
699
+ return [
700
+ { label: "Amount off", value: "net" },
701
+ { label: "Percentage off", value: "percentage" }
702
+ ];
703
+ }
704
+ }
705
+ function V(b) {
706
+ switch (b) {
707
+ case "order":
708
+ return "Applies to entire order. Available: Amount off, Percentage off, Delivery fee discount.";
709
+ case "category":
710
+ return "Applies to specific item categories. Available: Amount off, Percentage off, Free item.";
711
+ case "items":
712
+ return "Applies to specific items. Available: Basic discounts, Bundle offers (same/different items).";
713
+ default:
714
+ return "Select how you want to apply the discount.";
715
+ }
716
+ }
717
+ function $() {
718
+ var b;
719
+ return ((b = a.value.scope) == null ? void 0 : b.type) === "items";
720
+ }
721
+ function S() {
722
+ var b;
723
+ return ((b = a.value.scope) == null ? void 0 : b.type) === "category";
724
+ }
725
+ function w() {
726
+ var D;
727
+ const b = (D = a.value.scope) == null ? void 0 : D.objectIDs;
728
+ if (!b || b.length === 0)
729
+ return "No items selected";
730
+ const B = d.menu.value;
731
+ return B && b.length <= 3 ? b.map((A) => {
732
+ const P = B.modules.item.find((j) => j._id === A);
733
+ return P ? (P.name2 || P.name).trim() : `Item ${A}`;
734
+ }).join(", ") : b.length === 1 ? "1 item selected" : `${b.length} items selected`;
735
+ }
736
+ function R() {
737
+ var D;
738
+ const b = (D = a.value.scope) == null ? void 0 : D.objectIDs;
739
+ if (!b || b.length === 0)
740
+ return "No categories selected";
741
+ const B = d.menu.value;
742
+ return B && b.length <= 3 ? b.map((A) => {
743
+ const P = B.modules.category.find((j) => j._id === A);
744
+ return P ? P.name : `Category ${A}`;
745
+ }).join(", ") : b.length === 1 ? "1 category selected" : `${b.length} categories selected`;
746
+ }
747
+ function F() {
748
+ l.value = !0;
749
+ }
750
+ function M() {
751
+ n.value = !0;
752
+ }
753
+ function H(b) {
754
+ c("objectIDs", b), l.value = !1;
755
+ }
756
+ function I(b) {
757
+ c("objectIDs", b), n.value = !1;
758
+ }
759
+ function X() {
760
+ l.value = !1;
761
+ }
762
+ function K() {
763
+ n.value = !1;
764
+ }
765
+ const Z = computed(() => {
766
+ var B, D, O;
767
+ const b = [];
768
+ return a.value.type || b.push("Discount type is required"), (B = a.value.scope) != null && B.type || b.push("Scope type is required"), s(a.value.type) && (!a.value.value || a.value.value <= 0) && b.push("Discount amount must be greater than 0"), ((D = a.value.scope) == null ? void 0 : D.type) === "items" && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0) && b.push("Please select at least one item"), ((O = a.value.scope) == null ? void 0 : O.type) === "category" && (!a.value.scope.objectIDs || a.value.scope.objectIDs.length === 0) && b.push("Please select at least one category"), b;
769
+ });
770
+ function J() {
771
+ m("update:model-value", a.value), p.value = !1;
772
+ }
773
+ const W = [
774
+ { label: "Bill discount", value: "order" },
775
+ { label: "Item discount", value: "items" },
776
+ { label: "Category discount", value: "category" }
777
+ ];
778
+ return (b, B) => {
779
+ const D = resolveComponent("FmButton"), O = resolveComponent("FmSelect"), A = resolveComponent("FmStepperField"), P = resolveComponent("FmIcon"), j = resolveComponent("FmSideSheet");
780
+ return openBlock(), createBlock(j, {
781
+ "max-width": 550,
782
+ header: "Apply discount",
783
+ modelValue: unref(p),
784
+ "onUpdate:modelValue": [
785
+ B[5] || (B[5] = (U) => isRef(p) ? p.value = U : null),
786
+ B[6] || (B[6] = (U) => p.value = U)
787
+ ]
788
+ }, {
789
+ "side-sheet-button": withCtx(() => {
790
+ var U, G, Y, q;
791
+ return [
792
+ createElementVNode("div", _hoisted_1$q, [
793
+ B[7] || (B[7] = createElementVNode("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Configure the Grab campaign discount you want to offer your customers. ", -1)),
794
+ e.modelValue ? (openBlock(), createElementBlock("div", _hoisted_2$m, [
795
+ createElementVNode("div", _hoisted_3$j, [
796
+ createElementVNode("div", null, toDisplayString((U = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : U.type), 1),
797
+ createElementVNode("div", _hoisted_4$j, [
798
+ createTextVNode(toDisplayString((G = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : G.adjustment) + " ", 1),
799
+ (Y = unref(summarizeGrabDiscount)(e.modelValue)) != null && Y.cap ? (openBlock(), createElementBlock("span", _hoisted_5$g, toDisplayString((q = unref(summarizeGrabDiscount)(e.modelValue)) == null ? void 0 : q.cap), 1)) : createCommentVNode("", !0)
800
+ ])
801
+ ]),
802
+ createVNode(D, {
803
+ icon: "delete",
804
+ "icon-color": "neutral-gray-400",
805
+ variant: "tertiary",
806
+ onClick: y
807
+ })
808
+ ])) : (openBlock(), createBlock(D, {
809
+ key: 0,
810
+ label: "Apply Grab discount",
811
+ icon: "add",
812
+ "icon-color": "primary",
813
+ variant: "secondary",
814
+ class: "border-fm-color-primary text-fm-color-primary"
815
+ }))
816
+ ])
817
+ ];
818
+ }),
819
+ "side-sheet-footer": withCtx(() => [
820
+ createElementVNode("div", _hoisted_26$1, [
821
+ createVNode(D, {
822
+ variant: "secondary",
823
+ label: "Cancel",
824
+ class: "flex-1",
825
+ onClick: B[4] || (B[4] = (U) => p.value = !1)
826
+ }),
827
+ createVNode(D, {
828
+ variant: "primary",
829
+ label: unref(u) ? "Confirm" : "Complete Required Fields",
830
+ class: "flex-1",
831
+ disabled: !unref(u),
832
+ onClick: J
833
+ }, null, 8, ["label", "disabled"])
834
+ ])
835
+ ]),
836
+ default: withCtx(() => {
837
+ var U, G, Y, q;
838
+ return [
839
+ createElementVNode("div", _hoisted_6$c, [
840
+ createElementVNode("div", null, [
841
+ B[8] || (B[8] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Campaign type", -1)),
842
+ createVNode(O, {
843
+ "model-value": ((U = unref(a).scope) == null ? void 0 : U.type) || "order",
844
+ "onUpdate:modelValue": B[0] || (B[0] = (g) => c("type", g)),
845
+ placeholder: "Select campaign type",
846
+ items: W
847
+ }, null, 8, ["model-value"]),
848
+ createElementVNode("div", _hoisted_7$a, toDisplayString(V((G = unref(a).scope) == null ? void 0 : G.type)), 1)
849
+ ]),
850
+ createElementVNode("div", null, [
851
+ B[9] || (B[9] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount type", -1)),
852
+ createVNode(O, {
853
+ "model-value": unref(a).type,
854
+ "onUpdate:modelValue": B[1] || (B[1] = (g) => i("type", g)),
855
+ placeholder: "Select discount type",
856
+ items: f()
857
+ }, null, 8, ["model-value", "items"])
858
+ ]),
859
+ s(unref(a).type) ? (openBlock(), createElementBlock("div", _hoisted_8$9, [
860
+ createElementVNode("label", _hoisted_9$8, toDisplayString(x(unref(a).type)), 1),
861
+ createVNode(A, {
862
+ modelValue: unref(a).value,
863
+ "onUpdate:modelValue": B[2] || (B[2] = (g) => unref(a).value = g),
864
+ placeholder: h(unref(a).type),
865
+ suffix: v(unref(a).type),
866
+ type: "number"
867
+ }, null, 8, ["modelValue", "placeholder", "suffix"])
868
+ ])) : createCommentVNode("", !0),
869
+ k(unref(a).type) ? (openBlock(), createElementBlock("div", _hoisted_10$7, [
870
+ B[10] || (B[10] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Discount cap (optional)", -1)),
871
+ createVNode(A, {
872
+ modelValue: unref(a).cap,
873
+ "onUpdate:modelValue": B[3] || (B[3] = (g) => unref(a).cap = g),
874
+ placeholder: "Maximum discount amount",
875
+ type: "number"
876
+ }, null, 8, ["modelValue"])
877
+ ])) : createCommentVNode("", !0),
878
+ $() ? (openBlock(), createElementBlock("div", _hoisted_11$5, [
879
+ unref(l) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_12$4, [
880
+ B[12] || (B[12] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Items", -1)),
881
+ createElementVNode("div", _hoisted_13$4, [
882
+ createElementVNode("div", _hoisted_14$4, [
883
+ createElementVNode("div", _hoisted_15$3, [
884
+ createVNode(P, {
885
+ name: "restaurant",
886
+ size: "md"
887
+ }),
888
+ createElementVNode("span", _hoisted_16$2, toDisplayString(w()), 1)
889
+ ]),
890
+ createVNode(D, {
891
+ variant: "secondary",
892
+ label: "Select Items",
893
+ icon: "chevron_right",
894
+ onClick: F
895
+ })
896
+ ]),
897
+ B[11] || (B[11] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which items this discount applies to. Bundle discounts require multiple items. ", -1))
898
+ ])
899
+ ])),
900
+ createVNode(_sfc_main$u, {
901
+ visible: unref(l),
902
+ "initial-value": ((Y = unref(a).scope) == null ? void 0 : Y.objectIDs) || [],
903
+ onConfirm: H,
904
+ onCancel: X
905
+ }, null, 8, ["visible", "initial-value"])
906
+ ])) : createCommentVNode("", !0),
907
+ S() ? (openBlock(), createElementBlock("div", _hoisted_17$2, [
908
+ unref(n) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_18$2, [
909
+ B[14] || (B[14] = createElementVNode("label", { class: "fm-typo-en-body-md-600 mb-8 block" }, "Select Categories", -1)),
910
+ createElementVNode("div", _hoisted_19$2, [
911
+ createElementVNode("div", _hoisted_20$2, [
912
+ createElementVNode("div", _hoisted_21$1, [
913
+ createVNode(P, {
914
+ name: "category",
915
+ size: "md"
916
+ }),
917
+ createElementVNode("span", _hoisted_22$1, toDisplayString(R()), 1)
918
+ ]),
919
+ createVNode(D, {
920
+ variant: "secondary",
921
+ label: "Select Categories",
922
+ icon: "chevron_right",
923
+ onClick: M
924
+ })
925
+ ]),
926
+ B[13] || (B[13] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Choose which categories this discount applies to. ", -1))
927
+ ])
928
+ ])),
929
+ createVNode(_sfc_main$t, {
930
+ visible: unref(n),
931
+ "initial-value": ((q = unref(a).scope) == null ? void 0 : q.objectIDs) || [],
932
+ onConfirm: I,
933
+ onCancel: K
934
+ }, null, 8, ["visible", "initial-value"])
935
+ ])) : createCommentVNode("", !0)
936
+ ]),
937
+ unref(Z).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_23$1, [
938
+ createElementVNode("div", _hoisted_24$1, [
939
+ createVNode(P, { name: "warning" }),
940
+ B[15] || (B[15] = createElementVNode("span", { class: "fm-typo-en-body-sm-600" }, "Please fix the following issues:", -1))
941
+ ]),
942
+ createElementVNode("ul", _hoisted_25$1, [
943
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(Z), (g) => (openBlock(), createElementBlock("li", {
944
+ key: g,
945
+ class: "fm-typo-en-body-sm-400 text-fm-color-feedback-error-main flex items-start gap-8"
946
+ }, [
947
+ B[16] || (B[16] = createElementVNode("span", { class: "w-4 h-4 bg-fm-color-feedback-error-main rounded-full mt-6 flex-shrink-0" }, null, -1)),
948
+ createTextVNode(" " + toDisplayString(g), 1)
949
+ ]))), 128))
950
+ ])
951
+ ])) : createCommentVNode("", !0)
952
+ ];
953
+ }),
954
+ _: 1
955
+ }, 8, ["modelValue"]);
956
+ };
957
+ }
958
+ }), GrabEffectSheet = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-cf604dd7"]]), _hoisted_1$p = { class: "space-y-24" }, _sfc_main$r = /* @__PURE__ */ defineComponent({
959
+ __name: "TimeRuleGroup",
960
+ props: {
961
+ modelValue: {
962
+ type: Object,
963
+ default: () => {
964
+ }
965
+ }
966
+ },
967
+ emits: ["update:model-value"],
968
+ setup(e, { emit: r }) {
969
+ const { t: o } = useI18n(), m = e, d = r, p = ref(
970
+ !m.modelValue || !m.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(m.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
971
+ );
972
+ watch(p, async (n, a) => {
973
+ var u;
974
+ if (a == "custom" && n == "all_time" && RuleBuilder.getRules((u = m.modelValue) == null ? void 0 : u.rules.g_time).length > 0) {
975
+ const y = await prompt.confirm(
976
+ o("connect.template.rule.time.confirm_remove"),
977
+ o("connect.common.confirm"),
978
+ o("connect.common.confirm"),
979
+ o("connect.common.cancel")
980
+ );
981
+ y && d(
982
+ "update:model-value",
983
+ RuleBuilder.setRuleToGroup(
984
+ m.modelValue ?? RuleBuilder.scaffoldGroup(),
985
+ RuleBuilder.scaffoldGroup("g_time")
986
+ )
987
+ ), p.value = y ? n : a;
988
+ }
989
+ });
990
+ async function l(n) {
991
+ var a;
992
+ if (n == "custom" && RuleBuilder.getRules((a = m.modelValue) == null ? void 0 : a.rules.g_time).length > 0) {
993
+ if (!await prompt.confirm(
994
+ o("connect.template.rule.time.confirm_remove"),
995
+ o("connect.common.confirm"),
996
+ o("connect.common.confirm"),
997
+ o("connect.common.cancel")
998
+ )) {
999
+ p.value = "all_time";
1000
+ return;
1001
+ }
1002
+ d(
1003
+ "update:model-value",
1004
+ RuleBuilder.setRuleToGroup(
1005
+ m.modelValue ?? RuleBuilder.scaffoldGroup(),
1006
+ RuleBuilder.scaffoldGroup("g_time")
1007
+ )
1008
+ );
1009
+ }
1010
+ }
1011
+ return (n, a) => {
1012
+ var f;
1013
+ const u = resolveComponent("FmRadio"), y = resolveComponent("FmRadioGroup");
1014
+ return openBlock(), createElementBlock("div", _hoisted_1$p, [
1015
+ createVNode(y, {
1016
+ modelValue: unref(p),
1017
+ "onUpdate:modelValue": [
1018
+ a[0] || (a[0] = (s) => isRef(p) ? p.value = s : null),
1019
+ a[1] || (a[1] = (s) => l(s))
1020
+ ]
1021
+ }, {
1022
+ default: withCtx(() => [
1023
+ createVNode(u, {
1024
+ label: unref(o)("connect.template.rule.time.all_time"),
1025
+ value: "all_time"
1026
+ }, null, 8, ["label"]),
1027
+ createVNode(u, {
1028
+ label: unref(o)("connect.template.rule.time.custom"),
1029
+ value: "custom"
1030
+ }, null, 8, ["label"])
1031
+ ]),
1032
+ _: 1
1033
+ }, 8, ["modelValue"]),
1034
+ unref(p) == "custom" ? (openBlock(), createBlock(_sfc_main$v, {
1035
+ key: 0,
1036
+ class: "!mt-[0px]",
1037
+ "include-only": "trigger",
1038
+ "trigger-type": "SCHEDULE",
1039
+ "model-value": ((f = e.modelValue) == null ? void 0 : f.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
1040
+ "onUpdate:modelValue": a[2] || (a[2] = (s) => d(
1041
+ "update:model-value",
1042
+ unref(RuleBuilder).setRuleToGroup(
1043
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
1044
+ s,
1045
+ "&&"
1046
+ )
1047
+ ))
1048
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0)
1049
+ ]);
1050
+ };
1051
+ }
1052
+ }), _sfc_main$q = /* @__PURE__ */ defineComponent({
1053
+ __name: "BirthdayInput",
1054
+ props: {
1055
+ modelValue: {
1056
+ type: Object
1057
+ }
1058
+ },
1059
+ emits: ["update:model-value"],
1060
+ setup(e, { emit: r }) {
1061
+ const { t: o } = useI18n(), m = e, d = r, p = computed(() => {
1062
+ const { property: l, operator: n, equator: a } = RuleBuilder.simplify(
1063
+ m.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
1064
+ op: "before",
1065
+ x: 1
1066
+ })
1067
+ );
1068
+ return {
1069
+ property: l,
1070
+ operator: n,
1071
+ equator: a
1072
+ };
1073
+ });
1074
+ return (l, n) => {
1075
+ const a = resolveComponent("FmRadio"), u = resolveComponent("FmStepperField");
1076
+ return openBlock(), createElementBlock("div", null, [
1077
+ createVNode(a, {
1078
+ label: unref(o)("connect.template.rule.birthday.on_birthday"),
1079
+ value: "_isRange-day",
1080
+ "model-value": `${unref(p).operator}-${unref(p).equator.unit}`,
1081
+ "onUpdate:modelValue": n[0] || (n[0] = () => {
1082
+ d(
1083
+ "update:model-value",
1084
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
1085
+ op: "this",
1086
+ unit: "day",
1087
+ ignoreYear: !0
1088
+ })
1089
+ );
1090
+ })
1091
+ }, null, 8, ["label", "model-value"]),
1092
+ createVNode(a, {
1093
+ label: unref(o)("connect.template.rule.birthday.days_before"),
1094
+ value: "_isDay",
1095
+ "model-value": unref(p).operator,
1096
+ "onUpdate:modelValue": n[1] || (n[1] = () => {
1097
+ d(
1098
+ "update:model-value",
1099
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
1100
+ op: "after",
1101
+ x: 1,
1102
+ ignoreYear: !0
1103
+ })
1104
+ );
1105
+ })
1106
+ }, null, 8, ["label", "model-value"]),
1107
+ unref(p).operator == "_isDay" ? (openBlock(), createBlock(u, {
1108
+ key: 0,
1109
+ label: unref(o)("connect.template.rule.birthday.days_before_label"),
1110
+ "show-steppers": !1,
1111
+ "model-value": unref(p).equator.x,
1112
+ "onUpdate:modelValue": n[2] || (n[2] = (y) => d(
1113
+ "update:model-value",
1114
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
1115
+ op: "after",
1116
+ x: y,
1117
+ ignoreYear: !0
1118
+ })
1119
+ ))
1120
+ }, null, 8, ["label", "model-value"])) : createCommentVNode("", !0),
1121
+ createVNode(a, {
1122
+ label: unref(o)("connect.template.rule.birthday.in_birthday_week"),
1123
+ value: "_isRange-week",
1124
+ "model-value": `${unref(p).operator}-${unref(p).equator.unit}`,
1125
+ "onUpdate:modelValue": n[3] || (n[3] = () => {
1126
+ d(
1127
+ "update:model-value",
1128
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
1129
+ op: "this",
1130
+ unit: "week",
1131
+ ignoreYear: !0
1132
+ })
1133
+ );
1134
+ })
1135
+ }, null, 8, ["label", "model-value"]),
1136
+ createVNode(a, {
1137
+ label: unref(o)("connect.template.rule.birthday.in_birthday_month"),
1138
+ value: "_isRange-month",
1139
+ "model-value": `${unref(p).operator}-${unref(p).equator.unit}`,
1140
+ "onUpdate:modelValue": n[4] || (n[4] = () => {
1141
+ d(
1142
+ "update:model-value",
1143
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
1144
+ op: "this",
1145
+ unit: "month",
1146
+ ignoreYear: !0
1147
+ })
1148
+ );
1149
+ })
1150
+ }, null, 8, ["label", "model-value"])
1151
+ ]);
1152
+ };
1153
+ }
1154
+ }), _hoisted_1$o = { class: "space-y-16" }, _hoisted_2$l = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$i = { class: "grid grid-cols-3 gap-16" }, _hoisted_4$i = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$f = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$p = /* @__PURE__ */ defineComponent({
1155
+ __name: "CampaignTriggerInput",
1156
+ props: {
1157
+ campaignType: {
1158
+ type: String,
1159
+ required: !0
1160
+ },
1161
+ modelValue: {
1162
+ type: String
1163
+ },
1164
+ disabled: {
1165
+ type: Boolean,
1166
+ default: !1
1167
+ }
1168
+ },
1169
+ emits: ["update:model-value"],
1170
+ setup(e, { emit: r }) {
1171
+ const { t: o } = useI18n(), m = e, d = r, p = computed(() => m.disabled ? TypeToTriggerOptions[m.campaignType].filter(
1172
+ (l) => l.value == m.modelValue
1173
+ ) : TypeToTriggerOptions[m.campaignType]);
1174
+ return (l, n) => {
1175
+ const a = resolveComponent("FmCard");
1176
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [
1177
+ createElementVNode("div", _hoisted_2$l, toDisplayString(unref(o)("connect.campaign.trigger.description")), 1),
1178
+ createElementVNode("div", _hoisted_3$i, [
1179
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(p), (u) => (openBlock(), createBlock(a, {
1180
+ variant: "outlined",
1181
+ disabled: m.disabled,
1182
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1183
+ "col-span-3": unref(p).length == 1,
1184
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == u.value,
1185
+ "hover:bg-fm-color-opacity-sm": e.modelValue != u.value
1186
+ }]),
1187
+ onClick: () => {
1188
+ m.modelValue != u.value && !m.disabled && d("update:model-value", u.value);
1189
+ },
1190
+ key: u.name
1191
+ }, {
1192
+ default: withCtx(() => [
1193
+ createElementVNode("div", _hoisted_4$i, toDisplayString(u.name), 1),
1194
+ createElementVNode("div", _hoisted_5$f, toDisplayString(u.description), 1)
1195
+ ]),
1196
+ _: 2
1197
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
1198
+ ])
1199
+ ]);
1200
+ };
1201
+ }
1202
+ }), _sfc_main$o = /* @__PURE__ */ defineComponent({
1203
+ __name: "DateInput",
1204
+ props: {
1205
+ label: {
1206
+ type: String,
1207
+ required: !1
1208
+ },
1209
+ modelValue: {
1210
+ type: Object,
1211
+ required: !1
1212
+ }
1213
+ },
1214
+ emits: ["update:model-value"],
1215
+ setup(e, { emit: r }) {
1216
+ const o = r;
1217
+ return (m, d) => {
1218
+ const p = resolveComponent("FmButton"), l = resolveComponent("FmField"), n = resolveComponent("FmDatePicker");
1219
+ return openBlock(), createBlock(n, {
1220
+ label: e.label,
1221
+ "model-value": e.modelValue || "",
1222
+ "onUpdate:modelValue": d[1] || (d[1] = (a) => o("update:model-value", a))
1223
+ }, {
1224
+ "trigger-button": withCtx(({ opened: a }) => [
1225
+ createVNode(l, {
1226
+ class: "flex items-center",
1227
+ "prepend-icon": "calendar_month",
1228
+ "icon-outlined": !a
1229
+ }, {
1230
+ append: withCtx(() => [
1231
+ e.modelValue ? (openBlock(), createBlock(p, {
1232
+ key: 0,
1233
+ variant: "tertiary",
1234
+ icon: "clear",
1235
+ onClick: d[0] || (d[0] = (u) => (u.stopPropagation(), o("update:model-value", null)))
1236
+ })) : createCommentVNode("", !0)
1237
+ ]),
1238
+ default: withCtx(() => [
1239
+ createElementVNode("div", {
1240
+ class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
1241
+ }, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
1242
+ ]),
1243
+ _: 1
1244
+ }, 8, ["icon-outlined"])
1245
+ ]),
1246
+ _: 1
1247
+ }, 8, ["label", "model-value"]);
1248
+ };
1249
+ }
1250
+ }), _hoisted_1$n = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$k = { class: "flex-1 xs:w-full" }, _hoisted_3$h = { class: "mt-5 xs:hidden" }, _hoisted_4$h = { class: "flex-1 xs:w-full" }, _sfc_main$n = /* @__PURE__ */ defineComponent({
1251
+ __name: "DateRangeInput",
1252
+ props: {
1253
+ modelValue: {
1254
+ type: Object,
1255
+ required: !1
1256
+ }
1257
+ },
1258
+ emits: ["update:model-value"],
1259
+ setup(e, { emit: r }) {
1260
+ const { t: o } = useI18n(), m = r;
1261
+ return (d, p) => {
1262
+ var l, n;
1263
+ return openBlock(), createElementBlock("div", _hoisted_1$n, [
1264
+ createElementVNode("div", _hoisted_2$k, [
1265
+ createVNode(_sfc_main$o, {
1266
+ "model-value": ((l = e.modelValue) == null ? void 0 : l.startDate) ?? null,
1267
+ label: unref(o)("connect.common.startDate"),
1268
+ "onUpdate:modelValue": p[0] || (p[0] = (a) => {
1269
+ var u;
1270
+ return m("update:model-value", {
1271
+ startDate: a,
1272
+ endDate: ((u = e.modelValue) == null ? void 0 : u.endDate) ?? null
1273
+ });
1274
+ })
1275
+ }, null, 8, ["model-value", "label"])
1276
+ ]),
1277
+ createElementVNode("div", _hoisted_3$h, toDisplayString(unref(o)("connect.common.to")), 1),
1278
+ createElementVNode("div", _hoisted_4$h, [
1279
+ createVNode(_sfc_main$o, {
1280
+ "model-value": ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null,
1281
+ label: unref(o)("connect.common.endDate"),
1282
+ "onUpdate:modelValue": p[1] || (p[1] = (a) => {
1283
+ var u;
1284
+ return m("update:model-value", {
1285
+ startDate: ((u = e.modelValue) == null ? void 0 : u.startDate) ?? null,
1286
+ endDate: a
1287
+ });
1288
+ })
1289
+ }, null, 8, ["model-value", "label"])
1290
+ ])
1291
+ ]);
1292
+ };
1293
+ }
1294
+ }), _hoisted_1$m = { class: "flex flex-col gap-16" }, _hoisted_2$j = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$g = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$g = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$e = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$b = { class: "flex items-center justify-between gap-8" }, _hoisted_7$9 = { class: "fm-typo-en-body-lg-400" }, _hoisted_8$8 = { 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$m = /* @__PURE__ */ defineComponent({
1295
+ __name: "AppInboxInput",
1296
+ props: {
1297
+ modelValue: {
1298
+ type: Object,
1299
+ required: !0
1300
+ },
1301
+ variables: {
1302
+ type: Array,
1303
+ default: () => [...DEFAULT_MESSAGE_VARIABLES]
1304
+ },
1305
+ /** False until the form is submitted; broadcasts validate on submit. */
1306
+ showValidation: {
1307
+ type: Boolean,
1308
+ default: !0
1309
+ }
1310
+ },
1311
+ emits: ["update:model-value"],
1312
+ setup(e, { emit: r }) {
1313
+ const { t: o } = useI18n(), m = e, d = r;
1314
+ function p(k) {
1315
+ d("update:model-value", { ...m.modelValue, ...k });
1316
+ }
1317
+ function l(k, x) {
1318
+ return k >= x ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
1319
+ }
1320
+ const n = computed(() => m.modelValue.buttons ?? []), a = computed(() => {
1321
+ var k;
1322
+ return ((k = m.modelValue.content) == null ? void 0 : k.length) ?? 0;
1323
+ });
1324
+ function u(k, x) {
1325
+ p({
1326
+ buttons: n.value.map(
1327
+ (h, v) => v === k ? { ...h, ...x } : h
1328
+ )
1329
+ });
1330
+ }
1331
+ function y() {
1332
+ n.value.length >= MAX_BUTTONS || p({ buttons: [...n.value, { label: "", url: "" }] });
1333
+ }
1334
+ function f(k) {
1335
+ var v;
1336
+ if (!m.showValidation) return { label: void 0, url: void 0 };
1337
+ const x = (v = k.url) == null ? void 0 : v.trim();
1338
+ let h;
1339
+ return x ? FdoBroadcastUrl.safeParse(x).success || (h = o("connect.campaign.push.linkUrlInvalid")) : h = o("connect.campaign.appInbox.buttonUrlRequired"), {
1340
+ label: k.label.trim() ? void 0 : o("connect.campaign.appInbox.buttonLabelRequired"),
1341
+ url: h
1342
+ };
1343
+ }
1344
+ function s(k) {
1345
+ p({ buttons: n.value.filter((x, h) => h !== k) });
1346
+ }
1347
+ return (k, x) => {
1348
+ const h = resolveComponent("FmTextField"), v = resolveComponent("FmButton");
1349
+ return openBlock(), createElementBlock("div", _hoisted_1$m, [
1350
+ createElementVNode("div", null, [
1351
+ createElementVNode("div", _hoisted_2$j, [
1352
+ createElementVNode("span", _hoisted_3$g, toDisplayString(unref(o)("connect.campaign.appInbox.title")), 1),
1353
+ createElementVNode("span", {
1354
+ class: normalizeClass(["fm-typo-en-body-sm-400", l(e.modelValue.title.length, TITLE_WARN_AT$1)])
1355
+ }, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT$1), 3)
1356
+ ]),
1357
+ createVNode(h, {
1358
+ "model-value": e.modelValue.title,
1359
+ "max-length": TITLE_LIMIT$1,
1360
+ placeholder: unref(o)("connect.campaign.appInbox.titlePlaceholder"),
1361
+ "onUpdate:modelValue": x[0] || (x[0] = (i) => p({ title: i }))
1362
+ }, null, 8, ["model-value", "placeholder"])
1363
+ ]),
1364
+ createElementVNode("div", null, [
1365
+ createElementVNode("div", _hoisted_4$g, [
1366
+ createElementVNode("span", _hoisted_5$e, toDisplayString(unref(o)("connect.campaign.appInbox.previewText")), 1),
1367
+ createElementVNode("span", {
1368
+ class: normalizeClass(["fm-typo-en-body-sm-400", l(e.modelValue.previewText.length, PREVIEW_WARN_AT)])
1369
+ }, toDisplayString(e.modelValue.previewText.length) + " / " + toDisplayString(PREVIEW_LIMIT), 3)
1370
+ ]),
1371
+ createVNode(h, {
1372
+ "model-value": e.modelValue.previewText,
1373
+ "max-length": PREVIEW_LIMIT,
1374
+ placeholder: unref(o)("connect.campaign.appInbox.previewTextPlaceholder"),
1375
+ "onUpdate:modelValue": x[1] || (x[1] = (i) => p({ previewText: i }))
1376
+ }, null, 8, ["model-value", "placeholder"])
1377
+ ]),
1378
+ createElementVNode("div", _hoisted_6$b, [
1379
+ createElementVNode("div", null, [
1380
+ createElementVNode("div", _hoisted_7$9, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessage")), 1),
1381
+ createElementVNode("div", _hoisted_8$8, toDisplayString(unref(o)("connect.campaign.appInbox.bodyMessageDescription")), 1),
1382
+ createElementVNode("div", {
1383
+ class: normalizeClass([
1384
+ "mt-[2px] fm-typo-en-body-sm-400",
1385
+ unref(a) > unref(APP_INBOX_BODY_LIMIT) ? "text-fm-color-system-error-400" : "text-fm-color-typo-secondary"
1386
+ ])
1387
+ }, toDisplayString(unref(a)) + " / " + toDisplayString(unref(APP_INBOX_BODY_LIMIT)), 3)
1388
+ ]),
1389
+ createVNode(_sfc_main$w, {
1390
+ html: e.modelValue.content,
1391
+ variables: e.variables,
1392
+ "media-limit": 1,
1393
+ "button-label": unref(o)("connect.campaign.appInbox.editBodyMessage"),
1394
+ "onUpdate:html": x[2] || (x[2] = (i) => p({ content: i.html }))
1395
+ }, null, 8, ["html", "variables", "button-label"])
1396
+ ]),
1397
+ createElementVNode("div", _hoisted_9$7, [
1398
+ createElementVNode("div", _hoisted_10$6, [
1399
+ createElementVNode("span", _hoisted_11$4, toDisplayString(unref(o)("connect.campaign.appInbox.buttons")), 1),
1400
+ createElementVNode("span", _hoisted_12$3, toDisplayString(unref(n).length) + " / " + toDisplayString(MAX_BUTTONS), 1)
1401
+ ]),
1402
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (i, c) => (openBlock(), createElementBlock("div", {
1403
+ key: c,
1404
+ class: "flex flex-wrap items-start gap-8"
1405
+ }, [
1406
+ createElementVNode("div", _hoisted_13$3, [
1407
+ createVNode(h, {
1408
+ "model-value": i.label,
1409
+ "max-length": 20,
1410
+ placeholder: unref(o)("connect.campaign.appInbox.buttonLabel"),
1411
+ "helper-state": f(i).label ? "error" : "none",
1412
+ "helper-text": f(i).label,
1413
+ "onUpdate:modelValue": (C) => u(c, { label: C })
1414
+ }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
1415
+ ]),
1416
+ createElementVNode("div", _hoisted_14$3, [
1417
+ createVNode(h, {
1418
+ "model-value": i.url ?? "",
1419
+ inputmode: "url",
1420
+ placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
1421
+ "helper-state": f(i).url ? "error" : "none",
1422
+ "helper-text": f(i).url,
1423
+ "onUpdate:modelValue": (C) => u(c, { url: C.trim() })
1424
+ }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text", "onUpdate:modelValue"])
1425
+ ]),
1426
+ createVNode(v, {
1427
+ icon: "delete",
1428
+ "icon-color": "neutral-gray-400",
1429
+ variant: "tertiary",
1430
+ onClick: (C) => s(c)
1431
+ }, null, 8, ["onClick"])
1432
+ ]))), 128)),
1433
+ unref(n).length < MAX_BUTTONS ? (openBlock(), createBlock(v, {
1434
+ key: 0,
1435
+ variant: "tertiary",
1436
+ icon: "add",
1437
+ label: unref(o)("connect.campaign.appInbox.addButton"),
1438
+ onClick: y
1439
+ }, null, 8, ["label"])) : createCommentVNode("", !0)
1440
+ ])
1441
+ ]);
1442
+ };
1443
+ }
1444
+ }), _hoisted_1$l = { class: "flex flex-col gap-16" }, _hoisted_2$i = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_3$f = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_4$f = { class: "mb-[6px] flex items-baseline justify-between" }, _hoisted_5$d = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_6$a = { class: "mb-[6px] fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, _hoisted_7$8 = {
1445
+ key: 0,
1446
+ class: "mt-4 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1447
+ }, _hoisted_8$7 = {
1448
+ key: 1,
1449
+ class: "mt-12"
1450
+ }, _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$l = /* @__PURE__ */ defineComponent({
1451
+ __name: "PushInput",
1452
+ props: {
1453
+ modelValue: {
1454
+ type: Object,
1455
+ required: !0
1456
+ },
1457
+ /** False until the form is submitted; broadcasts validate on submit. */
1458
+ showValidation: {
1459
+ type: Boolean,
1460
+ default: !0
1461
+ }
1462
+ },
1463
+ emits: ["update:model-value"],
1464
+ setup(e, { emit: r }) {
1465
+ const { t: o } = useI18n(), m = e, d = r, p = F_PUSH_DESTINATION.options, l = computed(() => m.modelValue.destination === "EXTERNAL"), n = computed(() => {
1466
+ var s;
1467
+ if (!m.showValidation || !l.value) return;
1468
+ const f = (s = m.modelValue.url) == null ? void 0 : s.trim();
1469
+ return f ? FdoBroadcastUrl.safeParse(f).success ? void 0 : o("connect.campaign.push.linkUrlInvalid") : o("connect.campaign.push.linkUrlRequired");
1470
+ });
1471
+ function a(f) {
1472
+ d("update:model-value", { ...m.modelValue, ...f });
1473
+ }
1474
+ function u(f) {
1475
+ a(f === "EXTERNAL" ? { destination: f } : { destination: f, url: null });
1476
+ }
1477
+ function y(f, s) {
1478
+ return f >= s ? "text-fm-color-system-warning-400" : "text-fm-color-typo-secondary";
1479
+ }
1480
+ return (f, s) => {
1481
+ const k = resolveComponent("FmTextField"), x = resolveComponent("FmTextarea"), h = resolveComponent("FmSelect");
1482
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
1483
+ createElementVNode("div", null, [
1484
+ createElementVNode("div", _hoisted_2$i, [
1485
+ createElementVNode("span", _hoisted_3$f, toDisplayString(unref(o)("connect.campaign.push.title")), 1),
1486
+ createElementVNode("span", {
1487
+ class: normalizeClass(["fm-typo-en-body-sm-400", y(e.modelValue.title.length, TITLE_WARN_AT)])
1488
+ }, toDisplayString(e.modelValue.title.length) + " / " + toDisplayString(TITLE_LIMIT), 3)
1489
+ ]),
1490
+ createVNode(k, {
1491
+ "model-value": e.modelValue.title,
1492
+ "max-length": TITLE_LIMIT,
1493
+ placeholder: unref(o)("connect.campaign.push.titlePlaceholder"),
1494
+ "onUpdate:modelValue": s[0] || (s[0] = (v) => a({ title: v }))
1495
+ }, null, 8, ["model-value", "placeholder"])
1496
+ ]),
1497
+ createElementVNode("div", null, [
1498
+ createElementVNode("div", _hoisted_4$f, [
1499
+ createElementVNode("span", _hoisted_5$d, toDisplayString(unref(o)("connect.campaign.push.body")), 1),
1500
+ createElementVNode("span", {
1501
+ class: normalizeClass(["fm-typo-en-body-sm-400", y(e.modelValue.body.length, BODY_WARN_AT)])
1502
+ }, toDisplayString(e.modelValue.body.length) + " / " + toDisplayString(BODY_LIMIT), 3)
1503
+ ]),
1504
+ createVNode(x, {
1505
+ "model-value": e.modelValue.body,
1506
+ "max-length": BODY_LIMIT,
1507
+ placeholder: unref(o)("connect.campaign.push.bodyPlaceholder"),
1508
+ "onUpdate:modelValue": s[1] || (s[1] = (v) => a({ body: v }))
1509
+ }, null, 8, ["model-value", "placeholder"])
1510
+ ]),
1511
+ createElementVNode("div", null, [
1512
+ createElementVNode("div", _hoisted_6$a, toDisplayString(unref(o)("connect.campaign.push.link")), 1),
1513
+ createVNode(h, {
1514
+ "model-value": e.modelValue.destination ?? "NONE",
1515
+ items: unref(p).map((v) => ({
1516
+ label: unref(o)(`connect.campaign.appInbox.destination.${v}`),
1517
+ value: v
1518
+ })),
1519
+ "onUpdate:modelValue": s[2] || (s[2] = (v) => u(v))
1520
+ }, null, 8, ["model-value", "items"]),
1521
+ unref(l) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_7$8, toDisplayString(unref(o)("connect.campaign.push.linkHelper")), 1)),
1522
+ unref(l) ? (openBlock(), createElementBlock("div", _hoisted_8$7, [
1523
+ createElementVNode("div", _hoisted_9$6, toDisplayString(unref(o)("connect.campaign.push.linkUrl")), 1),
1524
+ createVNode(k, {
1525
+ "model-value": e.modelValue.url ?? "",
1526
+ inputmode: "url",
1527
+ placeholder: unref(o)("connect.campaign.push.linkUrlPlaceholder"),
1528
+ "helper-state": unref(n) ? "error" : "none",
1529
+ "helper-text": unref(n),
1530
+ "onUpdate:modelValue": s[3] || (s[3] = (v) => a({ url: v.trim() || null }))
1531
+ }, null, 8, ["model-value", "placeholder", "helper-state", "helper-text"])
1532
+ ])) : createCommentVNode("", !0)
1533
+ ])
1534
+ ]);
1535
+ };
1536
+ }
1537
+ }), _hoisted_1$k = { class: "flex items-stretch overflow-x-auto pb-4" }, _hoisted_2$h = {
1538
+ key: 0,
1539
+ class: "flex flex-none items-center px-8 fm-typo-en-body-lg-600 text-fm-color-neutral-gray-300",
1540
+ "aria-hidden": "true"
1541
+ }, _hoisted_3$e = ["aria-current", "onClick"], _hoisted_4$e = { class: "flex items-center gap-[6px]" }, _hoisted_5$c = ["title"], _hoisted_6$9 = { class: "mt-[3px] block text-[11px] leading-[1.3] text-fm-color-typo-secondary" }, _sfc_main$k = /* @__PURE__ */ defineComponent({
1542
+ __name: "ChannelContentTabs",
1543
+ props: {
1544
+ tabs: {},
1545
+ modelValue: {}
1546
+ },
1547
+ emits: ["update:model-value"],
1548
+ setup(e) {
1549
+ const { t: r } = useI18n();
1550
+ return (o, m) => (openBlock(), createElementBlock("div", _hoisted_1$k, [
1551
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(e.tabs, (d) => (openBlock(), createElementBlock("div", {
1552
+ key: d.key,
1553
+ class: "flex flex-none items-center"
1554
+ }, [
1555
+ d.connector ? (openBlock(), createElementBlock("span", _hoisted_2$h, toDisplayString(d.connector), 1)) : createCommentVNode("", !0),
1556
+ createElementVNode("button", {
1557
+ type: "button",
1558
+ class: normalizeClass([
1559
+ "min-w-[132px] flex-none rounded-[10px] border px-[14px] py-[10px] text-left transition-colors",
1560
+ e.modelValue === d.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"
1561
+ ]),
1562
+ "aria-current": e.modelValue === d.key ? "true" : void 0,
1563
+ onClick: (p) => o.$emit("update:model-value", d.key)
1564
+ }, [
1565
+ createElementVNode("span", _hoisted_4$e, [
1566
+ d.step ? (openBlock(), createElementBlock("span", {
1567
+ key: 0,
1568
+ class: normalizeClass([
1569
+ "flex h-[18px] w-[18px] flex-none items-center justify-center rounded-full text-[10.5px] font-semibold leading-[18px]",
1570
+ e.modelValue === d.key ? "bg-fm-color-primary text-fm-color-typo-white" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
1571
+ ])
1572
+ }, toDisplayString(d.step), 3)) : createCommentVNode("", !0),
1573
+ createElementVNode("span", {
1574
+ class: normalizeClass([
1575
+ "truncate text-[12.5px] font-semibold leading-[1.3]",
1576
+ e.modelValue === d.key ? "text-fm-color-primary" : "text-fm-color-typo-primary"
1577
+ ])
1578
+ }, toDisplayString(d.label), 3),
1579
+ d.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", {
1580
+ key: 1,
1581
+ class: "h-[7px] w-[7px] flex-none rounded-full bg-fm-color-system-error-400",
1582
+ title: unref(r)("connect.campaign.broadcast.messageMissing")
1583
+ }, null, 8, _hoisted_5$c))
1584
+ ]),
1585
+ createElementVNode("span", _hoisted_6$9, toDisplayString(d.sub), 1)
1586
+ ], 10, _hoisted_3$e)
1587
+ ]))), 128))
1588
+ ]));
1589
+ }
1590
+ }), _hoisted_1$j = {
1591
+ key: 0,
1592
+ class: "flex w-[264px] shrink-0 flex-col gap-8"
1593
+ }, _hoisted_2$g = { class: "fm-typo-en-body-md-600" }, _hoisted_3$d = { class: "flex justify-center py-8" }, _hoisted_4$d = {
1594
+ key: 0,
1595
+ class: "px-12 pb-16 pt-16"
1596
+ }, _hoisted_5$b = { class: "mb-12 text-center text-[11px] text-[rgba(255,255,255,0.6)]" }, _hoisted_6$8 = { class: "rounded-[14px] border border-[rgba(255,255,255,0.12)] bg-[rgba(255,255,255,0.14)] p-12 backdrop-blur" }, _hoisted_7$7 = { class: "fm-typo-en-body-md-600 text-fm-color-typo-white line-clamp-2" }, _hoisted_8$6 = { class: "mt-[2px] fm-typo-en-body-sm-400 text-[rgba(255,255,255,0.72)] line-clamp-3" }, _hoisted_9$5 = {
1597
+ key: 1,
1598
+ class: "px-12 pb-16"
1599
+ }, _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 = {
1600
+ key: 2,
1601
+ class: "mt-12 flex flex-col gap-[6px]"
1602
+ }, _hoisted_17$1 = {
1603
+ key: 2,
1604
+ class: "px-12 pb-16"
1605
+ }, _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$j = /* @__PURE__ */ defineComponent({
1606
+ __name: "ChannelPreview",
1607
+ props: {
1608
+ target: {},
1609
+ content: {},
1610
+ senderPrefix: {}
1611
+ },
1612
+ setup(e) {
1613
+ const { t: r } = useI18n(), o = e, m = computed(
1614
+ () => o.target === "PUSH" ? o.content : void 0
1615
+ ), d = computed(
1616
+ () => o.target === "APP_INBOX" ? o.content : void 0
1617
+ ), p = computed(
1618
+ () => o.target === "SMS" || o.target === "WHATSAPP" ? o.content : void 0
1619
+ ), l = computed(() => {
1620
+ var f, s;
1621
+ const y = (s = (f = p.value) == null ? void 0 : f.content) == null ? void 0 : s.trim();
1622
+ return y ? o.senderPrefix ? `${o.senderPrefix}${y}` : y : r("connect.campaign.broadcast.preview.emptyText");
1623
+ }), n = computed(() => {
1624
+ var f;
1625
+ const y = ((f = d.value) == null ? void 0 : f.content) ?? "";
1626
+ return y.trim() ? `<!doctype html><meta charset="utf-8"><base target="_blank"><style>
1627
+ html,body{margin:0;font:400 12px/1.5 Inter,system-ui,sans-serif;color:#1C1C1E;word-break:break-word}
1628
+ img{max-width:100%;height:auto}
1629
+ </style>${y}` : "";
1630
+ }), a = computed(() => {
1631
+ const y = /* @__PURE__ */ new Date(), f = y.toLocaleDateString(void 0, {
1632
+ weekday: "short",
1633
+ day: "2-digit",
1634
+ month: "short"
1635
+ }), s = y.toLocaleTimeString(void 0, {
1636
+ hour: "2-digit",
1637
+ minute: "2-digit"
1638
+ });
1639
+ return `${f} · ${s}`;
1640
+ }), u = computed(() => o.target === "PUSH" ? r("connect.campaign.broadcast.preview.note.push") : o.target === "APP_INBOX" ? r("connect.campaign.broadcast.preview.note.inbox") : r("connect.campaign.broadcast.preview.note.text"));
1641
+ return (y, f) => {
1642
+ var s, k, x, h, v, i, c, C, V, $, S;
1643
+ return e.target !== "EMAIL" ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
1644
+ createElementVNode("div", _hoisted_2$g, toDisplayString(unref(r)("connect.campaign.broadcast.preview.title")), 1),
1645
+ createElementVNode("div", {
1646
+ class: normalizeClass([
1647
+ "overflow-hidden rounded-[22px] border border-fm-color-neutral-gray-100",
1648
+ e.target === "PUSH" ? "bg-fm-color-neutral-black" : "bg-fm-color-neutral-white"
1649
+ ])
1650
+ }, [
1651
+ createElementVNode("div", _hoisted_3$d, [
1652
+ createElementVNode("div", {
1653
+ class: normalizeClass([
1654
+ "h-4 w-40 rounded-full",
1655
+ e.target === "PUSH" ? "bg-fm-color-neutral-gray-400" : "bg-fm-color-neutral-gray-100"
1656
+ ])
1657
+ }, null, 2)
1658
+ ]),
1659
+ e.target === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_4$d, [
1660
+ createElementVNode("div", _hoisted_5$b, toDisplayString(unref(a)), 1),
1661
+ createElementVNode("div", _hoisted_6$8, [
1662
+ createElementVNode("div", _hoisted_7$7, toDisplayString(((k = (s = unref(m)) == null ? void 0 : s.title) == null ? void 0 : k.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyTitle")), 1),
1663
+ createElementVNode("div", _hoisted_8$6, toDisplayString(((h = (x = unref(m)) == null ? void 0 : x.body) == null ? void 0 : h.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyBody")), 1)
1664
+ ])
1665
+ ])) : e.target === "APP_INBOX" ? (openBlock(), createElementBlock("div", _hoisted_9$5, [
1666
+ createElementVNode("div", _hoisted_10$5, toDisplayString(unref(r)("connect.campaign.broadcast.preview.inboxHeading")), 1),
1667
+ createElementVNode("div", _hoisted_11$3, [
1668
+ createElementVNode("div", _hoisted_12$2, toDisplayString(((i = (v = unref(d)) == null ? void 0 : v.title) == null ? void 0 : i.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyTitle")), 1),
1669
+ createElementVNode("div", _hoisted_13$2, toDisplayString(((C = (c = unref(d)) == null ? void 0 : c.previewText) == null ? void 0 : C.trim()) || unref(r)("connect.campaign.broadcast.preview.emptyBody")), 1),
1670
+ (V = unref(d)) != null && V.imageUrl ? (openBlock(), createElementBlock("img", {
1671
+ key: 0,
1672
+ src: unref(d).imageUrl,
1673
+ alt: "",
1674
+ class: "mt-8 w-full rounded-[8px]"
1675
+ }, null, 8, _hoisted_14$2)) : createCommentVNode("", !0),
1676
+ unref(n) ? (openBlock(), createElementBlock("iframe", {
1677
+ key: 1,
1678
+ srcdoc: unref(n),
1679
+ sandbox: "",
1680
+ referrerpolicy: "no-referrer",
1681
+ class: "mt-8 h-[120px] w-full border-0",
1682
+ title: unref(r)("connect.campaign.broadcast.preview.bodyFrameTitle")
1683
+ }, null, 8, _hoisted_15$2)) : createCommentVNode("", !0),
1684
+ (S = ($ = unref(d)) == null ? void 0 : $.buttons) != null && S.length ? (openBlock(), createElementBlock("div", _hoisted_16$1, [
1685
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d).buttons, (w, R) => (openBlock(), createElementBlock("div", {
1686
+ key: R,
1687
+ class: "rounded-[8px] bg-fm-color-primary px-12 py-8 text-center fm-typo-en-body-sm-400 text-fm-color-typo-white"
1688
+ }, toDisplayString(w.label || unref(r)("connect.campaign.appInbox.buttonLabel")), 1))), 128))
1689
+ ])) : createCommentVNode("", !0)
1690
+ ])
1691
+ ])) : (openBlock(), createElementBlock("div", _hoisted_17$1, [
1692
+ createElementVNode("div", _hoisted_18$1, toDisplayString(unref(r)(`connect.campaign.broadcast.channel.${e.target}`)), 1),
1693
+ createElementVNode("div", _hoisted_19$1, toDisplayString(unref(l)), 1)
1694
+ ]))
1695
+ ], 2),
1696
+ createElementVNode("div", _hoisted_20$1, toDisplayString(unref(u)), 1)
1697
+ ])) : createCommentVNode("", !0);
1698
+ };
1699
+ }
1700
+ }), _hoisted_1$i = { class: "flex flex-col gap-12 pt-8" }, _hoisted_2$f = { class: "flex flex-wrap items-baseline justify-between gap-16" }, _hoisted_3$c = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$c = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, _hoisted_5$a = { 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$7 = { class: "min-w-0 flex-1" }, _hoisted_7$6 = { class: "flex flex-wrap items-center gap-[10px]" }, _hoisted_8$5 = { class: "fm-typo-en-body-md-600" }, _hoisted_9$4 = {
1701
+ key: 0,
1702
+ class: "inline-flex items-center gap-[5px] fm-typo-en-body-sm-400 text-fm-color-system-error-400"
1703
+ }, _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 = {
1704
+ type: "button",
1705
+ 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"
1706
+ }, _hoisted_15$1 = {
1707
+ key: 1,
1708
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1709
+ }, _sfc_main$i = /* @__PURE__ */ defineComponent({
1710
+ __name: "FallbackChannelList",
1711
+ props: {
1712
+ rows: {},
1713
+ addable: {}
1714
+ },
1715
+ emits: ["move", "remove", "add"],
1716
+ setup(e) {
1717
+ const { t: r } = useI18n(), o = e, m = computed(() => o.addable.length > 0);
1718
+ return (d, p) => {
1719
+ const l = resolveComponent("FmButton"), n = resolveComponent("FmMenuItem"), a = resolveComponent("FmMenu");
1720
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
1721
+ createElementVNode("div", _hoisted_2$f, [
1722
+ createElementVNode("span", _hoisted_3$c, toDisplayString(unref(r)("connect.campaign.broadcast.fallbackChannels")), 1),
1723
+ createElementVNode("span", _hoisted_4$c, toDisplayString(unref(r)("connect.campaign.broadcast.fallbackChannelsHint")), 1)
1724
+ ]),
1725
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(e.rows, (u, y) => (openBlock(), createElementBlock("div", {
1726
+ key: u.channel,
1727
+ class: "flex flex-wrap items-center gap-12 rounded-[8px] border border-fm-color-neutral-gray-100 px-16 py-[14px]"
1728
+ }, [
1729
+ createElementVNode("span", _hoisted_5$a, toDisplayString(u.position), 1),
1730
+ createElementVNode("span", _hoisted_6$7, [
1731
+ createElementVNode("span", _hoisted_7$6, [
1732
+ createElementVNode("span", _hoisted_8$5, toDisplayString(u.label), 1),
1733
+ u.complete ? createCommentVNode("", !0) : (openBlock(), createElementBlock("span", _hoisted_9$4, [
1734
+ p[0] || (p[0] = createElementVNode("span", { class: "h-[6px] w-[6px] rounded-full bg-fm-color-system-error-400" }, null, -1)),
1735
+ createTextVNode(" " + toDisplayString(unref(r)("connect.campaign.broadcast.messageMissing")), 1)
1736
+ ]))
1737
+ ])
1738
+ ]),
1739
+ createElementVNode("span", _hoisted_10$4, [
1740
+ createElementVNode("span", {
1741
+ title: unref(r)("connect.campaign.broadcast.moveUp"),
1742
+ class: "flex"
1743
+ }, [
1744
+ createVNode(l, {
1745
+ icon: "arrow_upward",
1746
+ "icon-color": "neutral-gray-400",
1747
+ variant: "tertiary",
1748
+ disabled: y === 0,
1749
+ onClick: (f) => d.$emit("move", u.channel, -1)
1750
+ }, null, 8, ["disabled", "onClick"])
1751
+ ], 8, _hoisted_11$2),
1752
+ createElementVNode("span", {
1753
+ title: unref(r)("connect.campaign.broadcast.moveDown"),
1754
+ class: "flex"
1755
+ }, [
1756
+ createVNode(l, {
1757
+ icon: "arrow_downward",
1758
+ "icon-color": "neutral-gray-400",
1759
+ variant: "tertiary",
1760
+ disabled: y === e.rows.length - 1,
1761
+ onClick: (f) => d.$emit("move", u.channel, 1)
1762
+ }, null, 8, ["disabled", "onClick"])
1763
+ ], 8, _hoisted_12$1),
1764
+ createElementVNode("span", {
1765
+ title: unref(r)("connect.campaign.broadcast.removeChannel"),
1766
+ class: "flex"
1767
+ }, [
1768
+ createVNode(l, {
1769
+ icon: "delete",
1770
+ "icon-color": "neutral-gray-400",
1771
+ variant: "tertiary",
1772
+ onClick: (f) => d.$emit("remove", u.channel)
1773
+ }, null, 8, ["onClick"])
1774
+ ], 8, _hoisted_13$1)
1775
+ ])
1776
+ ]))), 128)),
1777
+ unref(m) ? (openBlock(), createBlock(a, {
1778
+ key: 0,
1779
+ placement: "bottom-start"
1780
+ }, {
1781
+ "menu-button": withCtx(() => [
1782
+ createElementVNode("button", _hoisted_14$1, " + " + toDisplayString(unref(r)("connect.campaign.broadcast.addFallbackChannel")), 1)
1783
+ ]),
1784
+ default: withCtx(() => [
1785
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(e.addable, (u) => (openBlock(), createBlock(n, {
1786
+ key: u.channel,
1787
+ label: u.label,
1788
+ onClick: (y) => d.$emit("add", u.channel)
1789
+ }, null, 8, ["label", "onClick"]))), 128))
1790
+ ]),
1791
+ _: 1
1792
+ })) : (openBlock(), createElementBlock("div", _hoisted_15$1, toDisplayString(unref(r)("connect.campaign.broadcast.allChannelsAdded")), 1))
1793
+ ]);
1794
+ };
1795
+ }
1796
+ });
1797
+ var define_appEndpoint_default = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "feedmedev.vip", crmUrl: "crm.feedmedev.cc", paymentPortalUrl: "https://portal.feedmedev.cc/payment/payout-account", licensePortalUrl: "https://license.feedmedev.cc/", marketingV1Portal: "https://marketing-v1.feedmedev.cc", voucherAppUrl: "https://voucher.feedmedev.cc/" };
1798
+ const _hoisted_1$h = { class: "flex flex-col gap-[28px]" }, _hoisted_2$e = { class: "flex flex-col gap-[14px]" }, _hoisted_3$b = { class: "fm-typo-en-body-lg-600" }, _hoisted_4$b = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$9 = { class: "grid gap-12 md:grid-cols-2 lg:grid-cols-2" }, _hoisted_6$6 = { class: "flex items-start justify-between gap-12" }, _hoisted_7$5 = { class: "fm-typo-en-title-sm-800" }, _hoisted_8$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_9$3 = {
1799
+ key: 0,
1800
+ class: "flex items-start gap-8 fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1801
+ }, _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 = {
1802
+ key: 1,
1803
+ class: "h-[8px] w-[8px] rounded-full bg-fm-color-neutral-white"
1804
+ }, _hoisted_15 = {
1805
+ key: 0,
1806
+ class: "mt-[3px] fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1807
+ }, _hoisted_16 = {
1808
+ key: 1,
1809
+ 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"
1810
+ }, _hoisted_17 = {
1811
+ key: 2,
1812
+ 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"
1813
+ }, _hoisted_18 = {
1814
+ key: 0,
1815
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-warning-400"
1816
+ }, _hoisted_19 = {
1817
+ key: 1,
1818
+ class: "fm-typo-en-body-sm-400 text-fm-color-system-error-400"
1819
+ }, _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 = {
1820
+ key: 1,
1821
+ 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"
1822
+ }, _hoisted_24 = {
1823
+ key: 3,
1824
+ class: "flex flex-wrap items-start gap-24"
1825
+ }, _hoisted_25 = { class: "min-w-0 flex-1 basis-[340px]" }, _hoisted_26 = {
1826
+ key: 1,
1827
+ class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary"
1828
+ }, _sfc_main$h = /* @__PURE__ */ defineComponent({
1829
+ __name: "BroadcastDeliveryInput",
1830
+ props: {
1831
+ pushAvailability: {
1832
+ type: String,
1833
+ default: "checking"
1834
+ },
1835
+ /** Either the new delivery shape or a legacy single-channel message. */
1836
+ modelValue: {
1837
+ type: Object,
1838
+ default: void 0
1839
+ },
1840
+ triggerType: {
1841
+ type: String,
1842
+ default: () => "SCHEDULE"
1843
+ },
1844
+ variables: {
1845
+ type: Object,
1846
+ default: () => [...DEFAULT_MESSAGE_VARIABLES]
1847
+ },
1848
+ helperText: { type: String },
1849
+ /**
1850
+ * False until the merchant tries to proceed. Broadcasts validate on submit,
1851
+ * so incomplete-channel markers stay hidden while the form is being filled.
1852
+ */
1853
+ showValidation: { type: Boolean, default: !0 },
1854
+ helperState: { type: String },
1855
+ placeholder: { type: String }
1856
+ },
1857
+ emits: ["retry-push", "update:model-value"],
1858
+ setup(e, { emit: r }) {
1859
+ const { t: o } = useI18n(), m = useDialog(), d = computed(() => {
1860
+ let g = "unavailable";
1861
+ return a.pushAvailability === "checking" ? g = "checking" : a.pushAvailability === "non-native" && (g = "requiresNativeApp"), o("connect.campaign.broadcast.pushAvailability." + g);
1862
+ });
1863
+ function p() {
1864
+ m.open({
1865
+ title: o("connect.campaign.broadcast.pushAvailability.contactSales"),
1866
+ message: o("connect.campaign.broadcast.pushAvailability.dialogMessage"),
1867
+ primaryActions: {
1868
+ text: o("connect.campaign.broadcast.pushAvailability.close"),
1869
+ close: !0
1870
+ }
1871
+ });
1872
+ }
1873
+ const l = useCoreStore(), n = useMembershipStore(), a = e, u = r, y = ref(!1), f = ref("SMS"), s = computed(() => {
1874
+ const g = a.modelValue;
1875
+ return g && "channels" in g ? g : toDelivery({ message: g });
1876
+ });
1877
+ function k(g) {
1878
+ u("update:model-value", g);
1879
+ }
1880
+ function x(g) {
1881
+ return o(`connect.campaign.broadcast.channel.${g}`);
1882
+ }
1883
+ const h = {
1884
+ SMS: "chat",
1885
+ WHATSAPP: "chat",
1886
+ EMAIL: "mail",
1887
+ APP_INBOX: "inbox",
1888
+ PUSH: "notifications"
1889
+ };
1890
+ function v(g) {
1891
+ return h[g];
1892
+ }
1893
+ const i = computed(() => s.value.mode === "fallback"), c = computed(
1894
+ () => a.variables.filter(
1895
+ (g) => a.triggerType == "SCHEDULE" ? !g.startsWith("transaction.") : !0
1896
+ )
1897
+ ), C = useChannelFlag();
1898
+ function V(g) {
1899
+ return C(g) === "off" ? !1 : g === "PUSH" ? a.pushAvailability === "native" : g === "WHATSAPP" ? y.value : !0;
1900
+ }
1901
+ const $ = ["fallback", "all"];
1902
+ function S(g) {
1903
+ g !== s.value.mode && k(setMode(s.value, g));
1904
+ }
1905
+ const w = ref(null);
1906
+ function R(g) {
1907
+ var T;
1908
+ const E = (T = w.value) == null ? void 0 : T[g];
1909
+ return E ? new Intl.NumberFormat(void 0, {
1910
+ style: "currency",
1911
+ currency: E.currency,
1912
+ minimumFractionDigits: E.precision,
1913
+ maximumFractionDigits: E.precision
1914
+ }).format(E.amount / 10 ** E.precision) : null;
1915
+ }
1916
+ const F = computed(
1917
+ () => (
1918
+ // A flagged-off channel stays visible while selected, so it can be removed.
1919
+ CHANNEL_DISPLAY_ORDER.filter(
1920
+ (g) => C(g) === "on" || s.value.channels.includes(g)
1921
+ ).map((g) => {
1922
+ const E = s.value.channels.includes(g), T = R(g);
1923
+ let L = o("connect.campaign.broadcast.freeChannel");
1924
+ return isPaidChannel(g) && (L = T ? o("connect.campaign.broadcast.perMessage", { price: T }) : null), {
1925
+ channel: g,
1926
+ label: x(g),
1927
+ selected: E,
1928
+ available: V(g),
1929
+ rateNote: L,
1930
+ // In fallback mode the grid is a radio for the primary channel, so only
1931
+ // the primary reads as checked; a fallback is tagged instead.
1932
+ checked: i.value ? s.value.channels[0] === g : E,
1933
+ usedAsFallback: i.value && s.value.channels.indexOf(g) > 0
1934
+ };
1935
+ })
1936
+ )
1937
+ );
1938
+ async function M(g) {
1939
+ if (i.value) {
1940
+ await H(g);
1941
+ return;
1942
+ }
1943
+ if (s.value.channels.includes(g)) {
1944
+ await I(g);
1945
+ return;
1946
+ }
1947
+ V(g) && k(addChannel(s.value, g, c.value));
1948
+ }
1949
+ async function H(g) {
1950
+ if (!V(g)) return;
1951
+ const E = s.value.channels[0];
1952
+ E !== g && (E && hasDraft(s.value, E) && !await prompt.remove(
1953
+ o("connect.campaign.broadcast.replaceChannelConfirm", {
1954
+ channel: x(E),
1955
+ next: x(g)
1956
+ })
1957
+ ) || V(g) && (k(setPrimaryChannel(s.value, g, c.value)), f.value = g));
1958
+ }
1959
+ async function I(g) {
1960
+ if (hasDraft(s.value, g) && !await prompt.remove(
1961
+ o("connect.campaign.broadcast.removeChannelConfirm", {
1962
+ channel: x(g)
1963
+ })
1964
+ ))
1965
+ return;
1966
+ const E = removeChannel(s.value, g);
1967
+ k(E), f.value === g && (f.value = E.channels[0] ?? "SMS");
1968
+ }
1969
+ function X(g, E) {
1970
+ k(moveChannel(s.value, g, E));
1971
+ }
1972
+ function K(g) {
1973
+ V(g) && k(addChannel(s.value, g, c.value));
1974
+ }
1975
+ const Z = computed(
1976
+ () => s.value.channels.slice(1).map((g, E) => ({
1977
+ channel: g,
1978
+ label: x(g),
1979
+ position: E + 2,
1980
+ complete: !a.showValidation || isChannelComplete(s.value, g)
1981
+ }))
1982
+ ), J = computed(
1983
+ () => CHANNEL_DISPLAY_ORDER.filter(
1984
+ (g) => !s.value.channels.includes(g) && V(g)
1985
+ ).map((g) => ({
1986
+ channel: g,
1987
+ label: x(g)
1988
+ }))
1989
+ ), W = computed(
1990
+ () => s.value.channels.map((g, E) => {
1991
+ let T = o("connect.campaign.broadcast.tab.sendsToEligible");
1992
+ i.value && (T = o(
1993
+ E === 0 ? "connect.campaign.broadcast.tab.firstAttempt" : "connect.campaign.broadcast.tab.ifNotReached"
1994
+ ));
1995
+ let L;
1996
+ return E > 0 && (L = i.value ? "→" : "+"), {
1997
+ key: g,
1998
+ label: x(g),
1999
+ sub: T,
2000
+ complete: !a.showValidation || isChannelComplete(s.value, g),
2001
+ step: i.value ? E + 1 : void 0,
2002
+ connector: L
2003
+ };
2004
+ })
2005
+ );
2006
+ watchEffect(() => {
2007
+ const g = W.value.map((E) => E.key);
2008
+ g.length && !g.includes(f.value) && (f.value = g[0]);
2009
+ });
2010
+ const b = computed(() => f.value), B = computed(() => {
2011
+ const g = b.value;
2012
+ if (!(g === "APP_INBOX" || g === "PUSH"))
2013
+ return s.value.content[g];
2014
+ }), D = computed(
2015
+ () => s.value.content.APP_INBOX
2016
+ ), O = computed(
2017
+ () => s.value.content.PUSH
2018
+ );
2019
+ function A(g) {
2020
+ k(setChannelContent(s.value, "APP_INBOX", g));
2021
+ }
2022
+ function P(g) {
2023
+ V("PUSH") && k(setChannelContent(s.value, "PUSH", g));
2024
+ }
2025
+ function j(g, E) {
2026
+ g === "APP_INBOX" || g === "PUSH" || k(setChannelContent(s.value, g, { ...E, channel: g }));
2027
+ }
2028
+ const U = computed(
2029
+ () => s.value.channels.filter(isPaidChannel)
2030
+ ), G = computed(() => {
2031
+ var E, T, L;
2032
+ const g = ((E = n.membership) == null ? void 0 : E.brand) || ((L = (T = l.currentBusiness) == null ? void 0 : T.value) == null ? void 0 : L.name) || "";
2033
+ return getSmsMessageMetrics({ brandName: g, content: "" }).prefix;
2034
+ }), Y = `${define_appEndpoint_default.licensePortalUrl}settings?businessId=${SvcConfig.businessId}`;
2035
+ async function q() {
2036
+ try {
2037
+ const g = await membershipApi.getWhatsappNumbers();
2038
+ y.value = g.some(
2039
+ (E) => {
2040
+ var T;
2041
+ return (T = E == null ? void 0 : E.default) == null ? void 0 : T.includes("Marketing");
2042
+ }
2043
+ );
2044
+ } catch (g) {
2045
+ console.error("Failed to fetch WhatsApp numbers:", g);
2046
+ }
2047
+ }
2048
+ return onMounted(async () => {
2049
+ const g = s.value.channels[0];
2050
+ g && (f.value = g), campaignApi.readBroadcastCreditSummary().then((E) => w.value = E.prices).catch(() => w.value = null), await q();
2051
+ }), (g, E) => {
2052
+ const T = resolveComponent("FmIcon"), L = resolveComponent("FmCard"), Q = resolveComponent("FmButton");
2053
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
2054
+ createElementVNode("div", _hoisted_2$e, [
2055
+ createElementVNode("div", null, [
2056
+ createElementVNode("div", _hoisted_3$b, toDisplayString(unref(o)("connect.campaign.broadcast.delivery")), 1),
2057
+ createElementVNode("div", _hoisted_4$b, toDisplayString(unref(o)("connect.campaign.broadcast.deliveryDescription")), 1)
2058
+ ]),
2059
+ createElementVNode("div", _hoisted_5$9, [
2060
+ (openBlock(), createElementBlock(Fragment, null, renderList($, (N) => createVNode(L, {
2061
+ key: N,
2062
+ variant: "outlined",
2063
+ class: normalizeClass(["h-full cursor-pointer select-none p-16 space-y-8", {
2064
+ "border-fm-color-primary bg-fm-color-system-warning-100": unref(s).mode === N,
2065
+ "hover:bg-fm-color-opacity-sm": unref(s).mode !== N
2066
+ }]),
2067
+ onClick: (ee) => S(N)
2068
+ }, {
2069
+ default: withCtx(() => [
2070
+ createElementVNode("div", _hoisted_6$6, [
2071
+ createElementVNode("div", _hoisted_7$5, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${N}.label`)), 1),
2072
+ unref(s).mode === N ? (openBlock(), createBlock(T, {
2073
+ key: 0,
2074
+ name: "check_circle",
2075
+ size: "md",
2076
+ class: "shrink-0 text-fm-color-primary"
2077
+ })) : createCommentVNode("", !0)
2078
+ ]),
2079
+ createElementVNode("div", _hoisted_8$4, toDisplayString(unref(o)(`connect.campaign.broadcast.mode.${N}.description`)), 1)
2080
+ ]),
2081
+ _: 2
2082
+ }, 1032, ["class", "onClick"])), 64))
2083
+ ]),
2084
+ unref(s).channels.length < 2 ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
2085
+ createVNode(T, {
2086
+ name: "info",
2087
+ size: "sm",
2088
+ class: "mt-[2px]"
2089
+ }),
2090
+ createElementVNode("span", null, toDisplayString(unref(o)("connect.campaign.broadcast.singleChannelNote")), 1)
2091
+ ])) : createCommentVNode("", !0)
2092
+ ]),
2093
+ createElementVNode("div", _hoisted_10$3, [
2094
+ createElementVNode("div", _hoisted_11$1, toDisplayString(unref(i) ? unref(o)("connect.campaign.broadcast.primaryChannel") : unref(o)("connect.campaign.broadcast.channels")), 1),
2095
+ createElementVNode("div", _hoisted_12, [
2096
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(F), (N) => (openBlock(), createBlock(L, {
2097
+ key: N.channel,
2098
+ variant: "outlined",
2099
+ class: normalizeClass(["flex h-full flex-col gap-12 p-16", [
2100
+ N.checked ? "!border-fm-color-primary bg-fm-color-system-warning-100" : "",
2101
+ N.available ? "cursor-pointer" : "cursor-not-allowed bg-fm-color-neutral-gray-100"
2102
+ ]]),
2103
+ "aria-disabled": N.channel === "PUSH" ? void 0 : !N.available,
2104
+ onClick: (ee) => M(N.channel)
2105
+ }, {
2106
+ default: withCtx(() => [
2107
+ createElementVNode("div", _hoisted_13, [
2108
+ createElementVNode("span", {
2109
+ class: normalizeClass([
2110
+ "flex h-[34px] w-[34px] flex-none items-center justify-center rounded-[8px]",
2111
+ N.available ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-200 text-fm-color-neutral-gray-400"
2112
+ ])
2113
+ }, [
2114
+ createVNode(T, {
2115
+ name: v(N.channel),
2116
+ size: "md"
2117
+ }, null, 8, ["name"])
2118
+ ], 2),
2119
+ N.available ? (openBlock(), createElementBlock("span", {
2120
+ key: 0,
2121
+ class: normalizeClass(["flex h-[22px] w-[22px] flex-none items-center justify-center border-2 transition-colors", [
2122
+ unref(i) ? "rounded-full" : "rounded-[4px]",
2123
+ N.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"
2124
+ ]])
2125
+ }, [
2126
+ N.checked && !unref(i) ? (openBlock(), createBlock(T, {
2127
+ key: 0,
2128
+ name: "check",
2129
+ size: "sm"
2130
+ })) : N.checked ? (openBlock(), createElementBlock("span", _hoisted_14)) : createCommentVNode("", !0)
2131
+ ], 2)) : createCommentVNode("", !0)
2132
+ ]),
2133
+ createElementVNode("div", null, [
2134
+ createElementVNode("div", {
2135
+ class: normalizeClass(["fm-typo-en-body-md-600", N.available ? "" : "text-fm-color-typo-disabled"])
2136
+ }, toDisplayString(N.label), 3),
2137
+ N.available && N.rateNote ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(N.rateNote), 1)) : createCommentVNode("", !0),
2138
+ N.available ? N.usedAsFallback ? (openBlock(), createElementBlock("div", _hoisted_17, toDisplayString(unref(o)("connect.campaign.broadcast.usedAsFallback")), 1)) : createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_16, toDisplayString(N.channel === "PUSH" ? unref(d) : unref(o)("connect.campaign.broadcast.notSetUp")), 1))
2139
+ ]),
2140
+ N.channel === "WHATSAPP" && !N.available ? (openBlock(), createElementBlock("a", {
2141
+ key: 0,
2142
+ href: Y,
2143
+ target: "_blank",
2144
+ class: "mt-auto fm-typo-en-body-sm-400 text-fm-color-secondary-blueberry underline",
2145
+ onClick: E[0] || (E[0] = withModifiers(() => {
2146
+ }, ["stop"]))
2147
+ }, toDisplayString(unref(o)("connect.campaign.messageInput.manageWhatsappChannel")), 1)) : createCommentVNode("", !0),
2148
+ N.channel === "PUSH" && !N.available ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2149
+ e.pushAvailability === "non-native" ? (openBlock(), createBlock(Q, {
2150
+ key: 0,
2151
+ label: unref(o)("connect.campaign.broadcast.pushAvailability.contactSales"),
2152
+ onClick: withModifiers(p, ["stop"])
2153
+ }, null, 8, ["label"])) : createCommentVNode("", !0),
2154
+ e.pushAvailability === "failed" ? (openBlock(), createBlock(Q, {
2155
+ key: 1,
2156
+ label: unref(o)("connect.campaign.broadcast.pushAvailability.retry"),
2157
+ onClick: E[1] || (E[1] = withModifiers((ee) => u("retry-push"), ["stop"]))
2158
+ }, null, 8, ["label"])) : createCommentVNode("", !0),
2159
+ N.selected ? (openBlock(), createBlock(Q, {
2160
+ key: 2,
2161
+ label: unref(o)("connect.campaign.broadcast.pushAvailability.removePush"),
2162
+ onClick: E[2] || (E[2] = withModifiers((ee) => I("PUSH"), ["stop"]))
2163
+ }, null, 8, ["label"])) : createCommentVNode("", !0)
2164
+ ], 64)) : createCommentVNode("", !0)
2165
+ ]),
2166
+ _: 2
2167
+ }, 1032, ["class", "aria-disabled", "onClick"]))), 128))
2168
+ ]),
2169
+ unref(s).channels.includes("PUSH") && !V("PUSH") ? (openBlock(), createElementBlock("div", _hoisted_18, toDisplayString(unref(o)("connect.campaign.broadcast.pushAvailability.removeBeforeSave")), 1)) : createCommentVNode("", !0),
2170
+ e.showValidation && !unref(s).channels.length ? (openBlock(), createElementBlock("div", _hoisted_19, toDisplayString(unref(o)("connect.campaign.broadcast.selectChannelRequired")), 1)) : createCommentVNode("", !0),
2171
+ unref(i) && unref(s).channels.length ? (openBlock(), createBlock(_sfc_main$i, {
2172
+ key: 2,
2173
+ rows: unref(Z),
2174
+ addable: unref(J),
2175
+ onMove: X,
2176
+ onRemove: I,
2177
+ onAdd: K
2178
+ }, null, 8, ["rows", "addable"])) : createCommentVNode("", !0)
2179
+ ]),
2180
+ createElementVNode("div", _hoisted_20, [
2181
+ createElementVNode("div", null, [
2182
+ createElementVNode("div", _hoisted_21, toDisplayString(unref(o)("connect.campaign.broadcast.content")), 1),
2183
+ createElementVNode("div", _hoisted_22, toDisplayString(unref(o)("connect.campaign.broadcast.contentDescription")), 1)
2184
+ ]),
2185
+ unref(U).length ? (openBlock(), createBlock(_sfc_main$x, {
2186
+ key: 0,
2187
+ channels: unref(U)
2188
+ }, null, 8, ["channels"])) : createCommentVNode("", !0),
2189
+ unref(s).channels.length ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_23, toDisplayString(unref(o)("connect.campaign.broadcast.noChannelContent")), 1)),
2190
+ unref(s).channels.length ? (openBlock(), createBlock(_sfc_main$k, {
2191
+ key: 2,
2192
+ modelValue: unref(f),
2193
+ "onUpdate:modelValue": E[3] || (E[3] = (N) => isRef(f) ? f.value = N : null),
2194
+ tabs: unref(W)
2195
+ }, null, 8, ["modelValue", "tabs"])) : createCommentVNode("", !0),
2196
+ unref(s).channels.includes(unref(f)) ? (openBlock(), createElementBlock("div", _hoisted_24, [
2197
+ createElementVNode("div", _hoisted_25, [
2198
+ unref(f) === "PUSH" && unref(O) && V("PUSH") ? (openBlock(), createBlock(_sfc_main$l, {
2199
+ key: 0,
2200
+ "model-value": unref(O),
2201
+ "show-validation": e.showValidation,
2202
+ "onUpdate:modelValue": P
2203
+ }, null, 8, ["model-value", "show-validation"])) : unref(f) === "PUSH" ? (openBlock(), createElementBlock("div", _hoisted_26, toDisplayString(unref(d)), 1)) : unref(f) === "APP_INBOX" && unref(D) ? (openBlock(), createBlock(_sfc_main$m, {
2204
+ key: 2,
2205
+ "model-value": unref(D),
2206
+ variables: unref(c),
2207
+ "show-validation": e.showValidation,
2208
+ "onUpdate:modelValue": A
2209
+ }, null, 8, ["model-value", "variables", "show-validation"])) : unref(f) !== "APP_INBOX" ? (openBlock(), createBlock(_sfc_main$y, {
2210
+ key: unref(f),
2211
+ "model-value": unref(B),
2212
+ "allow-email": !1,
2213
+ "allow-whatsapp": !1,
2214
+ "hide-credit-card": !0,
2215
+ "trigger-type": e.triggerType,
2216
+ variables: unref(c),
2217
+ placeholder: e.placeholder,
2218
+ "onUpdate:modelValue": E[4] || (E[4] = (N) => j(unref(b), N))
2219
+ }, null, 8, ["model-value", "trigger-type", "variables", "placeholder"])) : createCommentVNode("", !0)
2220
+ ]),
2221
+ createVNode(_sfc_main$j, {
2222
+ target: unref(f),
2223
+ content: unref(s).content[unref(b)],
2224
+ "sender-prefix": unref(G)
2225
+ }, null, 8, ["target", "content", "sender-prefix"])
2226
+ ])) : createCommentVNode("", !0)
2227
+ ])
2228
+ ]);
2229
+ };
2230
+ }
2231
+ }), _hoisted_1$g = { class: "space-y-8" }, _hoisted_2$d = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$a = {
2232
+ key: 0,
2233
+ class: "space-y-4"
2234
+ }, _hoisted_4$a = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$8 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
2235
+ __name: "ScheduleRuleInput",
2236
+ props: {
2237
+ modelValue: {
2238
+ type: Object,
2239
+ required: !0
2240
+ },
2241
+ startDate: {
2242
+ type: String
2243
+ },
2244
+ endDate: {
2245
+ type: String
2246
+ }
2247
+ },
2248
+ emits: ["update:model-value"],
2249
+ setup(e, { emit: r }) {
2250
+ const { t: o } = useI18n(), m = e, d = r, p = useCoreStore(), l = computed(
2251
+ () => F_COUNTRY_TIMEZONE[p.currentCountry.value || "MY"]
2252
+ );
2253
+ function n() {
2254
+ const i = RuleBuilder.getRules(m.modelValue);
2255
+ return i.length == 0 ? "fixed" : i.some(
2256
+ (c) => isRuleEntry(c) && RuleBuilder.simplify(c).operator == "_rrule"
2257
+ ) ? "repeating" : "fixed";
2258
+ }
2259
+ const a = ref(n()), u = ref(!1), y = ref(!1), f = computed(() => [
2260
+ { label: o("connect.template.rule.schedule.fixed"), value: "fixed" },
2261
+ { label: o("connect.template.rule.schedule.repeating"), value: "repeating" }
2262
+ ]), s = computed(() => {
2263
+ const i = RuleBuilder.getRules(m.modelValue), c = i.find(
2264
+ (V) => isRuleEntry(V) && RuleBuilder.simplify(V).property == "trigger.date"
2265
+ ), C = i.find(
2266
+ (V) => isRuleEntry(V) && RuleBuilder.simplify(V).property == "trigger.time"
2267
+ );
2268
+ return {
2269
+ date: c ? RuleBuilder.simplify(c).equator : null,
2270
+ time: C ? RuleBuilder.simplify(C).equator : null
2271
+ };
2272
+ }), k = computed(
2273
+ () => calculateNextScheduleAt(
2274
+ m.modelValue,
2275
+ /* @__PURE__ */ new Date(),
2276
+ m.startDate ? new Date(m.startDate) : /* @__PURE__ */ new Date(),
2277
+ m.endDate ? new Date(m.endDate) : void 0
2278
+ )
2279
+ );
2280
+ function x(i, c) {
2281
+ d(
2282
+ "update:model-value",
2283
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
2284
+ RuleBuilder.constructEntry("trigger.date", "_rrule", i),
2285
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", c ?? "00:00")
2286
+ ])
2287
+ );
2288
+ }
2289
+ watch(
2290
+ () => m.startDate,
2291
+ (i, c) => {
2292
+ if (!i || i === c || a.value !== "repeating" || !s.value.date) return;
2293
+ const C = RRule.fromString(s.value.date), V = new RRule({
2294
+ ...C.origOptions,
2295
+ dtstart: new Date(i)
2296
+ }).toString();
2297
+ V !== s.value.date && (x(V, s.value.time), y.value = !0);
2298
+ }
2299
+ );
2300
+ function h(i) {
2301
+ const c = i.value, C = getRruleAnchorDate({
2302
+ startDate: m.startDate ? new Date(m.startDate) : void 0
2303
+ }), V = c == "fixed" ? [
2304
+ RuleBuilder.constructEntry(
2305
+ "trigger.date",
2306
+ "_isOnDate",
2307
+ (/* @__PURE__ */ new Date()).toISOString()
2308
+ ),
2309
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
2310
+ ] : [
2311
+ RuleBuilder.constructEntry(
2312
+ "trigger.date",
2313
+ "_rrule",
2314
+ new RRule({
2315
+ dtstart: C,
2316
+ freq: RRule.DAILY,
2317
+ interval: 1,
2318
+ byhour: 0,
2319
+ byminute: 0,
2320
+ bysecond: 0,
2321
+ wkst: RRule.SU
2322
+ }).toString()
2323
+ ),
2324
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
2325
+ ];
2326
+ d(
2327
+ "update:model-value",
2328
+ RuleBuilder.setRuleToGroup(
2329
+ RuleBuilder.scaffoldGroup("g_schedule"),
2330
+ V
2331
+ )
2332
+ ), a.value = c, y.value = !1;
2333
+ }
2334
+ function v(i) {
2335
+ a.value == "fixed" ? d(
2336
+ "update:model-value",
2337
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
2338
+ RuleBuilder.constructEntry(
2339
+ "trigger.date",
2340
+ "_isOnDate",
2341
+ i.date
2342
+ ),
2343
+ RuleBuilder.constructEntry(
2344
+ "trigger.time",
2345
+ "_isOnTime",
2346
+ i.time
2347
+ )
2348
+ ])
2349
+ ) : x(i.date, i.time), y.value = !1;
2350
+ }
2351
+ return (i, c) => {
2352
+ const C = resolveComponent("FmButtonGroup"), V = resolveComponent("FmTimePicker"), $ = resolveComponent("FmIcon"), S = resolveComponent("FmTooltip"), w = resolveComponent("FmField"), R = resolveComponent("FmCard"), F = resolveComponent("FmPopover"), M = resolveComponent("FmDatePicker"), H = resolveComponent("FmHelperText");
2353
+ return openBlock(), createElementBlock(Fragment, null, [
2354
+ createVNode(C, {
2355
+ items: unref(f),
2356
+ "model-value": unref(f).find((I) => I.value === unref(a)) ?? null,
2357
+ "onUpdate:modelValue": h,
2358
+ class: "mb-8"
2359
+ }, null, 8, ["items", "model-value"]),
2360
+ createElementVNode("div", _hoisted_1$g, [
2361
+ createElementVNode("div", _hoisted_2$d, [
2362
+ createVNode(V, {
2363
+ label: unref(o)("connect.template.rule.schedule.notify_time"),
2364
+ "model-value": unref(s).time,
2365
+ "onUpdate:modelValue": c[0] || (c[0] = (I) => v({ date: unref(s).date, time: I })),
2366
+ "helper-text": unref(s).time ? void 0 : unref(o)("connect.template.rule.schedule.time_required"),
2367
+ "helper-state": unref(s).time ? void 0 : "error"
2368
+ }, null, 8, ["label", "model-value", "helper-text", "helper-state"]),
2369
+ unref(a) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$a, [
2370
+ createElementVNode("div", _hoisted_4$a, [
2371
+ createElementVNode("div", null, toDisplayString(unref(o)("connect.template.rule.schedule.notify_date")), 1),
2372
+ unref(s).date ? (openBlock(), createBlock(S, {
2373
+ key: 0,
2374
+ "z-index": 9999,
2375
+ content: unref(SummarizeRrule)(unref(RRule).fromString(unref(s).date).options)
2376
+ }, {
2377
+ default: withCtx(() => [
2378
+ createVNode($, {
2379
+ name: "info",
2380
+ size: "sm",
2381
+ outline: !0
2382
+ })
2383
+ ]),
2384
+ _: 1
2385
+ }, 8, ["content"])) : createCommentVNode("", !0)
2386
+ ]),
2387
+ createVNode(F, {
2388
+ "show-popover": unref(u),
2389
+ onPopoverChanged: c[3] || (c[3] = (I) => u.value = I)
2390
+ }, {
2391
+ "popover-button": withCtx(() => [
2392
+ createVNode(w, {
2393
+ class: "cursor-pointer",
2394
+ "helper-text": unref(s).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
2395
+ "helper-state": unref(s).date ? void 0 : "error"
2396
+ }, {
2397
+ default: withCtx(() => [
2398
+ createElementVNode("div", _hoisted_5$8, toDisplayString(unref(s).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(s).date).options) : unref(o)("connect.template.rule.schedule.set_repeating_date")), 1)
2399
+ ]),
2400
+ _: 1
2401
+ }, 8, ["helper-text", "helper-state"])
2402
+ ]),
2403
+ default: withCtx(() => [
2404
+ createVNode(R, { class: "elevated p-8 w-[450px]" }, {
2405
+ default: withCtx(() => [
2406
+ createVNode(_sfc_main$z, {
2407
+ "apply-button": !0,
2408
+ "model-value": unref(s).date || "",
2409
+ "start-date": e.startDate ? new Date(e.startDate) : /* @__PURE__ */ new Date(),
2410
+ onCancel: c[1] || (c[1] = (I) => u.value = !1),
2411
+ "onUpdate:modelValue": c[2] || (c[2] = (I) => (v({ date: I, time: unref(s).time }), u.value = !1))
2412
+ }, null, 8, ["model-value", "start-date"])
2413
+ ]),
2414
+ _: 1
2415
+ })
2416
+ ]),
2417
+ _: 1
2418
+ }, 8, ["show-popover"])
2419
+ ])) : (openBlock(), createBlock(M, {
2420
+ key: 1,
2421
+ label: unref(o)("connect.template.rule.schedule.notify_date"),
2422
+ "model-value": unref(s).date || "",
2423
+ "onUpdate:modelValue": c[4] || (c[4] = (I) => v({ date: I, time: unref(s).time })),
2424
+ "helper-text": unref(s).date ? void 0 : unref(o)("connect.template.rule.schedule.date_required"),
2425
+ "helper-state": unref(s).date ? void 0 : "error"
2426
+ }, null, 8, ["label", "model-value", "helper-text", "helper-state"]))
2427
+ ]),
2428
+ unref(s).date && unref(s).time && unref(k) ? (openBlock(), createBlock(H, {
2429
+ key: 0,
2430
+ text: `${unref(moment)(unref(k)).isAfter(unref(moment)()) ? unref(o)("connect.template.rule.schedule.next_notification") : unref(o)("connect.template.rule.schedule.last_trigger_on")} ${unref(moment)(unref(k)).format("dddd, DD MMM YYYY")} at
2431
+ ${unref(moment)(unref(k)).format("hh:mmA")}(UTC${unref(moment).tz(unref(l)).format("Z")}) (${unref(moment)(unref(k)).fromNow()})`
2432
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
2433
+ unref(y) ? (openBlock(), createBlock(H, {
2434
+ key: 1,
2435
+ text: "Repeating schedule was updated to stay anchored to the campaign start date.",
2436
+ state: "warning"
2437
+ })) : createCommentVNode("", !0)
2438
+ ])
2439
+ ], 64);
2440
+ };
2441
+ }
2442
+ }), _hoisted_1$f = { class: "space-y-16" }, _hoisted_2$c = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$9 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$9 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$f = /* @__PURE__ */ defineComponent({
2443
+ __name: "GameTypeInput",
2444
+ props: {
2445
+ modelValue: {
2446
+ type: String
2447
+ }
2448
+ },
2449
+ emits: ["update:model-value"],
2450
+ setup(e, { emit: r }) {
2451
+ const { t: o } = useI18n(), m = e, d = r, p = computed(
2452
+ () => [
2453
+ {
2454
+ label: o("connect.campaign.gameType.option.FORTUNE_WHEEL.label"),
2455
+ description: o("connect.campaign.gameType.option.FORTUNE_WHEEL.description"),
2456
+ value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
2457
+ hidden: !1
2458
+ },
2459
+ {
2460
+ label: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.label"),
2461
+ description: o("connect.campaign.gameType.option.ROCK_PAPER_SCISSORS.description"),
2462
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
2463
+ hidden: !0
2464
+ }
2465
+ ].filter((l) => !l.hidden)
2466
+ );
2467
+ return (l, n) => {
2468
+ const a = resolveComponent("FmCard");
2469
+ return openBlock(), createElementBlock("div", _hoisted_1$f, [
2470
+ createElementVNode("div", _hoisted_2$c, toDisplayString(unref(o)("connect.template.select_game")), 1),
2471
+ createElementVNode("div", _hoisted_3$9, [
2472
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(p), (u) => (openBlock(), createBlock(a, {
2473
+ variant: "outlined",
2474
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2475
+ "col-span-2": unref(p).length == 1,
2476
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == u.value,
2477
+ "hover:bg-fm-color-opacity-sm": e.modelValue != u.value
2478
+ }]),
2479
+ onClick: () => {
2480
+ m.modelValue != u.value && d("update:model-value", u.value);
2481
+ },
2482
+ key: u.value
2483
+ }, {
2484
+ default: withCtx(() => [
2485
+ createElementVNode("div", _hoisted_4$9, toDisplayString(u.label), 1),
2486
+ createElementVNode("div", _hoisted_5$7, toDisplayString(u.description), 1)
2487
+ ]),
2488
+ _: 2
2489
+ }, 1032, ["class", "onClick"]))), 128))
2490
+ ])
2491
+ ]);
2492
+ };
2493
+ }
2494
+ }), _hoisted_1$e = {
2495
+ key: 0,
2496
+ class: "flex flex-col gap-y-24"
2497
+ }, _hoisted_2$b = { class: "flex gap-8 items-center justify-start" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
2498
+ __name: "EditRewardPoolSheet",
2499
+ emits: ["update:model-value"],
2500
+ setup(e, { expose: r, emit: o }) {
2501
+ const m = useMembershipStore(), { minor: d } = useLoading, p = ref(!1), l = ref(), n = ref(), a = ref(0), u = computed(
2502
+ () => {
2503
+ var v;
2504
+ return (v = m.loyaltyRewards.items.find(
2505
+ (i) => {
2506
+ var c;
2507
+ return i.value === ((c = l.value) == null ? void 0 : c.collectible);
2508
+ }
2509
+ )) == null ? void 0 : v.raw.type;
2510
+ }
2511
+ ), y = computed(
2512
+ () => {
2513
+ var v;
2514
+ return ((v = l.value) == null ? void 0 : v.type) === "LOYALTY" && (u.value === "CREDIT" || u.value === "TITLE");
2515
+ }
2516
+ ), f = computed(
2517
+ () => y.value ? FdoCreditLoyaltyReward : FdtoRandomReward
2518
+ ), s = computed(() => {
2519
+ const v = f.value.safeParse(l.value);
2520
+ return v.success ? [] : v.error.errors;
2521
+ });
2522
+ function k(v, i, c) {
2523
+ v && (l.value = i, a.value = c), p.value = v;
2524
+ }
2525
+ const x = o;
2526
+ async function h() {
2527
+ const v = f.value.safeParse(l.value);
2528
+ v.success && (await d(
2529
+ async () => {
2530
+ v.data.type === "VOUCHER" && n.value && (v.data.collectibleConfig.image = await firebaseStorage.update(
2531
+ v.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
2532
+ n.value
2533
+ ));
2534
+ },
2535
+ {
2536
+ message: "Uploading reward image",
2537
+ successMessage: "Reward image updated"
2538
+ }
2539
+ ), x("update:model-value", v.data, a.value));
2540
+ }
2541
+ return r({
2542
+ showSheet: k
2543
+ }), (v, i) => {
2544
+ const c = resolveComponent("FmSelect"), C = resolveComponent("FmStepperField"), V = resolveComponent("FmButton"), $ = resolveComponent("FmSideSheet");
2545
+ return openBlock(), createBlock($, {
2546
+ "max-width": 560,
2547
+ modelValue: unref(p),
2548
+ "onUpdate:modelValue": [
2549
+ i[9] || (i[9] = (S) => isRef(p) ? p.value = S : null),
2550
+ i[10] || (i[10] = (S) => p.value = S)
2551
+ ],
2552
+ header: "Edit reward",
2553
+ "dismiss-away": ""
2554
+ }, {
2555
+ "side-sheet-footer": withCtx(() => [
2556
+ createElementVNode("div", _hoisted_2$b, [
2557
+ createVNode(V, {
2558
+ variant: "primary",
2559
+ type: "button",
2560
+ disabled: unref(s).length > 0,
2561
+ label: "Confirm",
2562
+ onClick: i[7] || (i[7] = (S) => h())
2563
+ }, null, 8, ["disabled"]),
2564
+ createVNode(V, {
2565
+ variant: "secondary",
2566
+ type: "button",
2567
+ label: "Cancel",
2568
+ onClick: i[8] || (i[8] = (S) => p.value = !1)
2569
+ })
2570
+ ])
2571
+ ]),
2572
+ default: withCtx(() => {
2573
+ var S;
2574
+ return [
2575
+ unref(l) ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
2576
+ createVNode(c, {
2577
+ label: "Reward Type",
2578
+ items: [
2579
+ { label: "No Reward", value: "NO_REWARD" },
2580
+ { label: "Voucher", value: "VOUCHER" },
2581
+ { label: "Loyalty", value: "LOYALTY" }
2582
+ ],
2583
+ "model-value": unref(l).type,
2584
+ "onUpdate:modelValue": i[0] || (i[0] = (w) => {
2585
+ w == "NO_REWARD" ? l.value = {
2586
+ type: "NO_REWARD",
2587
+ collectible: null,
2588
+ weight: 1
2589
+ } : w === "VOUCHER" ? l.value = {
2590
+ collectible: null,
2591
+ type: "VOUCHER",
2592
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
2593
+ business: unref(useCoreStore)().currentBusiness.value._id
2594
+ }),
2595
+ earningOption: {
2596
+ amount: 1,
2597
+ type: "FIXED"
2598
+ },
2599
+ validityOption: {
2600
+ validForDay: 7
2601
+ },
2602
+ weight: 1
2603
+ } : l.value = {
2604
+ collectible: unref(m).loyaltyRewards.raw[0]._id,
2605
+ type: "LOYALTY",
2606
+ earningOption: {
2607
+ amount: 1,
2608
+ type: "FIXED"
2609
+ },
2610
+ validityOption: {
2611
+ validForDay: 7
2612
+ },
2613
+ weight: 1
2614
+ };
2615
+ })
2616
+ }, null, 8, ["model-value"]),
2617
+ unref(l).type == "LOYALTY" ? (openBlock(), createBlock(c, {
2618
+ key: 0,
2619
+ label: "Loyalty type",
2620
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "collectible", [unref(l).type])],
2621
+ items: unref(m).loyaltyRewards.items,
2622
+ "model-value": unref(l).collectible,
2623
+ "onUpdate:modelValue": i[1] || (i[1] = (w) => unref(l).collectible = w)
2624
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
2625
+ createVNode(C, {
2626
+ label: "Weight",
2627
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "weight", [unref(l).type])],
2628
+ "model-value": unref(l).weight,
2629
+ "onUpdate:modelValue": i[2] || (i[2] = (w) => l.value = {
2630
+ ...unref(l),
2631
+ weight: w
2632
+ })
2633
+ }, null, 8, ["rules", "model-value"]),
2634
+ unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2635
+ unref(u) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2636
+ i[11] || (i[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
2637
+ createVNode(_sfc_main$A, {
2638
+ class: "mt-[-8px]",
2639
+ rules: [
2640
+ unref(ZodHelper).ruleAtPath(unref(f), "earningOption", [unref(l).type])
2641
+ ],
2642
+ "helper-state": unref(ZodHelper).helperState(unref(s), "earningOption"),
2643
+ "error-text": unref(ZodHelper).helperText(unref(s), "earningOption"),
2644
+ "fixed-type": !0,
2645
+ "model-value": unref(l).earningOption,
2646
+ "onUpdate:modelValue": i[3] || (i[3] = (w) => l.value = {
2647
+ ...unref(l),
2648
+ earningOption: w
2649
+ })
2650
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
2651
+ ], 64)) : createCommentVNode("", !0),
2652
+ i[12] || (i[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
2653
+ createVNode(_sfc_main$B, {
2654
+ type: unref(l).type === "LOYALTY" ? "custom" : "range",
2655
+ "for-credit": unref(y),
2656
+ class: "!gap-24",
2657
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "validityOption", [unref(l).type])],
2658
+ "model-value": unref(l).validityOption,
2659
+ "onUpdate:modelValue": i[4] || (i[4] = (w) => l.value = {
2660
+ ...unref(l),
2661
+ validityOption: w
2662
+ })
2663
+ }, null, 8, ["type", "for-credit", "rules", "model-value"])
2664
+ ], 64)) : createCommentVNode("", !0),
2665
+ unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$C, {
2666
+ key: 2,
2667
+ "reward-image": unref(n),
2668
+ "model-value": ((S = unref(l)) == null ? void 0 : S.collectibleConfig) ?? void 0,
2669
+ "onUpdate:modelValue": i[5] || (i[5] = (w) => l.value = {
2670
+ ...unref(l),
2671
+ collectibleConfig: w
2672
+ }),
2673
+ "onUpdate:rewardImage": i[6] || (i[6] = (w) => n.value = w)
2674
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
2675
+ createVNode(JsonViewer, { json: unref(s) }, null, 8, ["json"])
2676
+ ])) : createCommentVNode("", !0)
2677
+ ];
2678
+ }),
2679
+ _: 1
2680
+ }, 8, ["modelValue"]);
2681
+ };
2682
+ }
2683
+ });
2684
+ function isNullOrEmpty(e) {
2685
+ return e == null || e === "";
2686
+ }
2687
+ const _hoisted_1$d = { class: "space-y-16" }, _hoisted_2$a = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$8 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$8 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
2688
+ __name: "RewardPoolInput",
2689
+ props: {
2690
+ modelValue: {
2691
+ type: Array,
2692
+ default: () => [
2693
+ {
2694
+ collectible: null,
2695
+ type: "NO_REWARD",
2696
+ weight: 1
2697
+ }
2698
+ ]
2699
+ }
2700
+ },
2701
+ emits: ["update:model-value"],
2702
+ setup(e, { emit: r }) {
2703
+ const o = e, m = r, d = useMembershipStore(), { t: p } = useI18n(), l = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), n = computed(() => o.modelValue ?? []), a = computed(() => {
2704
+ const h = l.safeParse(n.value);
2705
+ return h.success ? [] : h.error.errors;
2706
+ }), u = ref();
2707
+ function y(h, v) {
2708
+ var c;
2709
+ const i = [...n.value];
2710
+ i[v] = h, (c = u.value) == null || c.showSheet(!1), m("update:model-value", i);
2711
+ }
2712
+ function f(h) {
2713
+ const v = h.type == "VOUCHER" ? h.collectibleConfig : d.collectibles.find(
2714
+ (C) => C._id.toString() == h.collectible
2715
+ ), i = CollectionUtils.formattedType((v == null ? void 0 : v.name) || ""), c = h.weight;
2716
+ return {
2717
+ label: isNullOrEmpty(i) ? "NO REWARD" : i,
2718
+ sublabel: `${c} (${(c / n.value.reduce((C, V) => C + V.weight, 0) * 100).toFixed(2)}%)`
2719
+ };
2720
+ }
2721
+ function s(h) {
2722
+ var i;
2723
+ const v = [...n.value];
2724
+ (i = u.value) == null || i.showSheet(!0, v[h], h);
2725
+ }
2726
+ function k(h) {
2727
+ const v = [...n.value];
2728
+ v.splice(h, 1), m("update:model-value", v);
2729
+ }
2730
+ function x() {
2731
+ var h;
2732
+ (h = u.value) == null || h.showSheet(
2733
+ !0,
2734
+ {
2735
+ type: "NO_REWARD",
2736
+ collectible: null,
2737
+ weight: 1
2738
+ },
2739
+ n.value.length
2740
+ );
2741
+ }
2742
+ return (h, v) => {
2743
+ const i = resolveComponent("FmButton"), c = resolveComponent("FmCard"), C = resolveComponent("FmHelperText");
2744
+ return openBlock(), createElementBlock("div", _hoisted_1$d, [
2745
+ createElementVNode("div", _hoisted_2$a, toDisplayString(unref(p)("connect.template.configure_reward_type")), 1),
2746
+ createVNode(i, {
2747
+ label: unref(p)("connect.campaign.rewardPool.addReward"),
2748
+ onClick: v[0] || (v[0] = (V) => x()),
2749
+ variant: "plain",
2750
+ icon: "add"
2751
+ }, null, 8, ["label"]),
2752
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), (V, $) => (openBlock(), createBlock(c, {
2753
+ key: $,
2754
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2755
+ variant: "outlined",
2756
+ onClick: (S) => s($)
2757
+ }, {
2758
+ default: withCtx(() => {
2759
+ var S;
2760
+ return [
2761
+ createElementVNode("div", null, [
2762
+ createElementVNode("div", _hoisted_3$8, toDisplayString(V.type == "LOYALTY" ? (S = V == null ? void 0 : V.earningOption) == null ? void 0 : S.amount : "") + " " + toDisplayString(f(V).label), 1),
2763
+ createElementVNode("div", _hoisted_4$8, toDisplayString(f(V).sublabel), 1)
2764
+ ]),
2765
+ createVNode(i, {
2766
+ icon: "delete",
2767
+ variant: "tertiary",
2768
+ onClick: (w) => (w.stopPropagation(), k($))
2769
+ }, null, 8, ["onClick"])
2770
+ ];
2771
+ }),
2772
+ _: 2
2773
+ }, 1032, ["onClick"]))), 128)),
2774
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a).filter((V) => V.path.join(".") == ""), (V) => (openBlock(), createBlock(C, {
2775
+ key: V.message,
2776
+ text: V.message,
2777
+ state: "error"
2778
+ }, null, 8, ["text"]))), 128)),
2779
+ createVNode(_sfc_main$e, {
2780
+ ref_key: "sheetRef",
2781
+ ref: u,
2782
+ "onUpdate:modelValue": y
2783
+ }, null, 512)
2784
+ ]);
2785
+ };
2786
+ }
2787
+ }), _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = {
2788
+ key: 0,
2789
+ class: "grid grid-cols-2 gap-16"
2790
+ }, _hoisted_3$7 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
2791
+ __name: "PromotionGameTypeInput",
2792
+ props: {
2793
+ modelValue: {
2794
+ type: Object
2795
+ }
2796
+ },
2797
+ emits: ["update:model-value"],
2798
+ setup(e, { emit: r }) {
2799
+ const { t: o } = useI18n(), m = e, d = r, p = computed(() => [
2800
+ {
2801
+ label: o("connect.template.promotion_game.rock_paper_scissors.label"),
2802
+ description: o("connect.template.promotion_game.rock_paper_scissors.description"),
2803
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
2804
+ }
2805
+ ]);
2806
+ return (l, n) => {
2807
+ var f, s, k;
2808
+ const a = resolveComponent("FmSwitch"), u = resolveComponent("FmCard"), y = resolveComponent("FmHelperText");
2809
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
2810
+ createVNode(a, {
2811
+ label: unref(o)("connect.template.promotion_game.enable"),
2812
+ "model-value": !!((f = e.modelValue) != null && f.gameType),
2813
+ "onUpdate:modelValue": n[0] || (n[0] = (x) => x ? d("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : d("update:model-value", null))
2814
+ }, null, 8, ["label", "model-value"]),
2815
+ ((s = e.modelValue) == null ? void 0 : s.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$9, [
2816
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(p), (x) => {
2817
+ var h, v;
2818
+ return openBlock(), createBlock(u, {
2819
+ variant: "outlined",
2820
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2821
+ "col-span-2": unref(p).length == 1,
2822
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((h = e.modelValue) == null ? void 0 : h.gameType) == x.value,
2823
+ "hover:bg-fm-color-opacity-sm": ((v = e.modelValue) == null ? void 0 : v.gameType) != x.value
2824
+ }]),
2825
+ onClick: () => {
2826
+ var i;
2827
+ ((i = m.modelValue) == null ? void 0 : i.gameType) != x.value && d("update:model-value", { gameType: x.value });
2828
+ },
2829
+ key: x.value
2830
+ }, {
2831
+ default: withCtx(() => [
2832
+ createElementVNode("div", _hoisted_3$7, toDisplayString(x.label), 1),
2833
+ createElementVNode("div", _hoisted_4$7, toDisplayString(x.description), 1)
2834
+ ]),
2835
+ _: 2
2836
+ }, 1032, ["class", "onClick"]);
2837
+ }), 128))
2838
+ ])) : createCommentVNode("", !0),
2839
+ ((k = e.modelValue) == null ? void 0 : k.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(y, {
2840
+ key: 1,
2841
+ text: unref(o)("connect.template.promotion_game.rock_paper_scissors.warning"),
2842
+ state: "warning"
2843
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2844
+ ]);
2845
+ };
2846
+ }
2847
+ }), _hoisted_1$b = { class: "space-y-8" }, _hoisted_2$8 = { class: "grid gap-16 grid-cols-2" }, _hoisted_3$6 = { class: "space-y-6" }, _hoisted_4$6 = { class: "space-y-8" }, _hoisted_5$6 = { class: "fm-typo-en-body-lg-600" }, _hoisted_6$5 = { class: "flex items-center space-x-3" }, _hoisted_7$4 = {
2848
+ key: 0,
2849
+ class: "ml-6 space-y-2"
2850
+ }, _sfc_main$b = /* @__PURE__ */ defineComponent({
2851
+ __name: "GrabConditionsInput",
2852
+ props: {
2853
+ modelValue: {
2854
+ type: Object
2855
+ },
2856
+ schema: {
2857
+ type: Object,
2858
+ default: () => z.any()
2859
+ }
2860
+ },
2861
+ emits: ["update:model-value"],
2862
+ setup(e, { emit: r }) {
2863
+ const { t: o } = useI18n(), m = e, d = r, p = ref(m.modelValue ?? {}), l = ref(
2864
+ (() => {
2865
+ const f = {};
2866
+ return p.value.workingHour && Object.keys(p.value.workingHour).forEach((s) => {
2867
+ const k = p.value.workingHour[s];
2868
+ k && "periods" in k && Array.isArray(k.periods) ? f[s] = k.periods : Array.isArray(k) && (f[s] = k);
2869
+ }), f;
2870
+ })()
2871
+ ), n = [
2872
+ { key: "mon", label: "Monday" },
2873
+ { key: "tue", label: "Tuesday" },
2874
+ { key: "wed", label: "Wednesday" },
2875
+ { key: "thu", label: "Thursday" },
2876
+ { key: "fri", label: "Friday" },
2877
+ { key: "sat", label: "Saturday" },
2878
+ { key: "sun", label: "Sunday" }
2879
+ ], a = (f) => {
2880
+ l.value[f] || (l.value[f] = []), l.value[f].push({
2881
+ startTime: "00:00",
2882
+ endTime: "23:59"
2883
+ }), y();
2884
+ }, u = (f, s) => {
2885
+ l.value[f] && l.value[f].length > s && (l.value[f].splice(s, 1), l.value[f].length === 0 && delete l.value[f], y());
2886
+ }, y = () => {
2887
+ const f = Object.keys(l.value).reduce(
2888
+ (s, k) => (l.value[k] && l.value[k].length > 0 && (s[k] = {
2889
+ periods: l.value[k]
2890
+ }), s),
2891
+ {}
2892
+ );
2893
+ p.value.workingHour = Object.keys(f).length > 0 ? f : void 0;
2894
+ };
2895
+ return watch(p, () => d("update:model-value", p.value), { deep: !0 }), watch(l, y, { deep: !0 }), (f, s) => {
2896
+ const k = resolveComponent("FmSelect"), x = resolveComponent("FmStepperField"), h = resolveComponent("FmCheckbox"), v = resolveComponent("FmTimePicker"), i = resolveComponent("FmButton");
2897
+ return openBlock(), createElementBlock("div", _hoisted_1$b, [
2898
+ createElementVNode("div", _hoisted_2$8, [
2899
+ createVNode(k, {
2900
+ label: unref(o)("connect.template.eaterType"),
2901
+ modelValue: unref(p).eaterType,
2902
+ "onUpdate:modelValue": s[0] || (s[0] = (c) => unref(p).eaterType = c),
2903
+ items: [
2904
+ { label: unref(o)("connect.template.allEaters"), value: "all" },
2905
+ { label: unref(o)("connect.template.newEatersOnly"), value: "new" },
2906
+ {
2907
+ label: unref(o)("connect.template.existingEatersOnly"),
2908
+ value: "existing"
2909
+ }
2910
+ ],
2911
+ rules: [unref(ZodHelper).ruleAtPath(e.schema, "eaterType")]
2912
+ }, null, 8, ["label", "modelValue", "items", "rules"]),
2913
+ createVNode(x, {
2914
+ modelValue: unref(p).minBasketAmount,
2915
+ "onUpdate:modelValue": s[1] || (s[1] = (c) => unref(p).minBasketAmount = c),
2916
+ "show-steppers": !1,
2917
+ rules: [unref(ZodHelper).ruleAtPath(e.schema, "minBasketAmount")]
2918
+ }, {
2919
+ label: withCtx(() => [
2920
+ (openBlock(), createBlock(resolveDynamicComponent(
2921
+ unref(ZodHelper).toInputLabel(
2922
+ unref(ZodHelper).typeAtPath(e.schema, "minBasketAmount"),
2923
+ unref(o)("connect.template.minBasketAmount")
2924
+ )
2925
+ )))
2926
+ ]),
2927
+ _: 1
2928
+ }, 8, ["modelValue", "rules"]),
2929
+ createVNode(x, {
2930
+ modelValue: unref(p).bundleQuantity,
2931
+ "onUpdate:modelValue": s[2] || (s[2] = (c) => unref(p).bundleQuantity = c),
2932
+ "show-steppers": !1,
2933
+ rules: [unref(ZodHelper).ruleAtPath(e.schema, "bundleQuantity")]
2934
+ }, {
2935
+ label: withCtx(() => [
2936
+ (openBlock(), createBlock(resolveDynamicComponent(
2937
+ unref(ZodHelper).toInputLabel(
2938
+ unref(ZodHelper).typeAtPath(e.schema, "bundleQuantity"),
2939
+ unref(o)("connect.template.bundleQuantity")
2940
+ )
2941
+ )))
2942
+ ]),
2943
+ _: 1
2944
+ }, 8, ["modelValue", "rules"])
2945
+ ]),
2946
+ createElementVNode("div", _hoisted_3$6, [
2947
+ createElementVNode("div", _hoisted_4$6, [
2948
+ createElementVNode("div", _hoisted_5$6, toDisplayString(unref(o)("connect.template.operationHours")), 1),
2949
+ (openBlock(), createElementBlock(Fragment, null, renderList(n, (c) => createElementVNode("div", {
2950
+ key: c.key,
2951
+ class: "space-y-2"
2952
+ }, [
2953
+ createElementVNode("div", _hoisted_6$5, [
2954
+ createVNode(h, {
2955
+ label: c.label,
2956
+ "model-value": !!(unref(l)[c.key] && unref(l)[c.key].length > 0),
2957
+ "onUpdate:modelValue": (C) => {
2958
+ C ? a(c.key) : (unref(l)[c.key] = [], delete unref(l)[c.key], y());
2959
+ }
2960
+ }, null, 8, ["label", "model-value", "onUpdate:modelValue"])
2961
+ ]),
2962
+ unref(l)[c.key] && unref(l)[c.key].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_7$4, [
2963
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l)[c.key] || [], (C, V) => (openBlock(), createElementBlock("div", {
2964
+ key: V,
2965
+ class: "flex items-center space-x-2 w-100"
2966
+ }, [
2967
+ createVNode(v, {
2968
+ "model-value": C.startTime || "",
2969
+ "onUpdate:modelValue": ($) => {
2970
+ unref(l)[c.key] && unref(l)[c.key][V] && (unref(l)[c.key][V].startTime = $ || "", y());
2971
+ }
2972
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
2973
+ s[3] || (s[3] = createElementVNode("span", null, "to", -1)),
2974
+ createVNode(v, {
2975
+ "model-value": C.endTime || "",
2976
+ "onUpdate:modelValue": ($) => {
2977
+ unref(l)[c.key] && unref(l)[c.key][V] && (unref(l)[c.key][V].endTime = $ || "", y());
2978
+ }
2979
+ }, null, 8, ["model-value", "onUpdate:modelValue"]),
2980
+ createVNode(i, {
2981
+ variant: "tertiary",
2982
+ size: "sm",
2983
+ onClick: ($) => u(c.key, V),
2984
+ icon: "close"
2985
+ }, null, 8, ["onClick"]),
2986
+ V === 0 ? (openBlock(), createBlock(i, {
2987
+ key: 0,
2988
+ onClick: ($) => a(c.key),
2989
+ icon: "add",
2990
+ variant: "plain"
2991
+ }, null, 8, ["onClick"])) : createCommentVNode("", !0)
2992
+ ]))), 128))
2993
+ ])) : createCommentVNode("", !0)
2994
+ ])), 64))
2995
+ ])
2996
+ ])
2997
+ ]);
2998
+ };
2999
+ }
3000
+ }), GrabConditionsInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-7f17ebe8"]]), _hoisted_1$a = { class: "space-y-8" }, _hoisted_2$7 = { class: "grid gap-16 grid-cols-2" }, _sfc_main$a = /* @__PURE__ */ defineComponent({
3001
+ __name: "GrabQuotaInput",
3002
+ props: {
3003
+ modelValue: {
3004
+ type: Object
3005
+ },
3006
+ schema: {
3007
+ type: Object,
3008
+ default: () => z.any()
3009
+ }
3010
+ },
3011
+ emits: ["update:model-value"],
3012
+ setup(e, { emit: r }) {
3013
+ const { t: o } = useI18n(), m = e, d = r, p = ref(m.modelValue ?? {});
3014
+ return watch(p, () => d("update:model-value", p.value)), (l, n) => {
3015
+ const a = resolveComponent("FmStepperField");
3016
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
3017
+ createElementVNode("div", _hoisted_2$7, [
3018
+ createVNode(a, {
3019
+ modelValue: unref(p).totalCount,
3020
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => unref(p).totalCount = u),
3021
+ "show-steppers": !1,
3022
+ rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCount")]
3023
+ }, {
3024
+ label: withCtx(() => [
3025
+ (openBlock(), createBlock(resolveDynamicComponent(
3026
+ unref(ZodHelper).toInputLabel(
3027
+ unref(ZodHelper).typeAtPath(e.schema, "totalCount"),
3028
+ unref(o)("connect.template.totalCount")
3029
+ )
3030
+ )))
3031
+ ]),
3032
+ _: 1
3033
+ }, 8, ["modelValue", "rules"]),
3034
+ createVNode(a, {
3035
+ modelValue: unref(p).totalCountPerUser,
3036
+ "onUpdate:modelValue": n[1] || (n[1] = (u) => unref(p).totalCountPerUser = u),
3037
+ "show-steppers": !1,
3038
+ rules: [unref(ZodHelper).ruleAtPath(e.schema, "totalCountPerUser")]
3039
+ }, {
3040
+ label: withCtx(() => [
3041
+ (openBlock(), createBlock(resolveDynamicComponent(
3042
+ unref(ZodHelper).toInputLabel(
3043
+ unref(ZodHelper).typeAtPath(e.schema, "totalCountPerUser"),
3044
+ unref(o)("connect.template.totalCountPerUser")
3045
+ )
3046
+ )))
3047
+ ]),
3048
+ _: 1
3049
+ }, 8, ["modelValue", "rules"])
3050
+ ])
3051
+ ]);
3052
+ };
3053
+ }
3054
+ }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$5 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$5 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
3055
+ __name: "MissionTypeInput",
3056
+ props: {
3057
+ modelValue: {
3058
+ type: String
3059
+ }
3060
+ },
3061
+ emits: ["update:model-value"],
3062
+ setup(e, { emit: r }) {
3063
+ const { t: o } = useI18n(), m = e, d = r, p = computed(() => [
3064
+ {
3065
+ label: o("connect.campaign.mission.typeOption.STAMP.label"),
3066
+ description: o("connect.campaign.mission.typeOption.STAMP.description"),
3067
+ value: F_MISSION_TYPE.enum.STAMP
3068
+ },
3069
+ {
3070
+ label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
3071
+ description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
3072
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
3073
+ }
3074
+ ]);
3075
+ return (l, n) => {
3076
+ const a = resolveComponent("FmCard");
3077
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
3078
+ createElementVNode("div", _hoisted_2$6, toDisplayString(unref(o)("connect.template.select_game")), 1),
3079
+ createElementVNode("div", _hoisted_3$5, [
3080
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(p), (u) => (openBlock(), createBlock(a, {
3081
+ variant: "outlined",
3082
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
3083
+ "col-span-2": unref(p).length == 1,
3084
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == u.value,
3085
+ "hover:bg-fm-color-opacity-sm": e.modelValue != u.value
3086
+ }]),
3087
+ onClick: () => {
3088
+ m.modelValue != u.value && d("update:model-value", u.value);
3089
+ },
3090
+ key: u.value
3091
+ }, {
3092
+ default: withCtx(() => [
3093
+ createElementVNode("div", _hoisted_4$5, toDisplayString(u.label), 1),
3094
+ createElementVNode("div", _hoisted_5$5, toDisplayString(u.description), 1)
3095
+ ]),
3096
+ _: 2
3097
+ }, 1032, ["class", "onClick"]))), 128))
3098
+ ])
3099
+ ]);
3100
+ };
3101
+ }
3102
+ }), _hoisted_1$8 = { class: "space-y-16" }, _sfc_main$8 = /* @__PURE__ */ defineComponent({
3103
+ __name: "MissionEndInput",
3104
+ props: {
3105
+ modelValue: {
3106
+ type: [String, Number]
3107
+ },
3108
+ helperText: {
3109
+ type: String
3110
+ },
3111
+ helperState: {
3112
+ type: String
3113
+ }
3114
+ },
3115
+ emits: ["update:model-value"],
3116
+ setup(e, { emit: r }) {
3117
+ const o = r;
3118
+ return (m, d) => {
3119
+ const p = resolveComponent("FmStepperField");
3120
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
3121
+ d[1] || (d[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)),
3122
+ createVNode(p, {
3123
+ label: "Maximum to collect",
3124
+ "model-value": e.modelValue || null,
3125
+ "onUpdate:modelValue": d[0] || (d[0] = (l) => o("update:model-value", l)),
3126
+ "helper-text": e.helperText || "Set the threshold required for reward eligibility",
3127
+ "helper-state": e.helperState || "none"
3128
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
3129
+ ]);
3130
+ };
3131
+ }
3132
+ }), _hoisted_1$7 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
3133
+ __name: "EditMissionPoolSheet",
3134
+ props: {
3135
+ maxThreshold: {
3136
+ type: Number,
3137
+ required: !0
3138
+ }
3139
+ },
3140
+ emits: ["update:model-value"],
3141
+ setup(e, { expose: r, emit: o }) {
3142
+ const m = e, d = useMembershipStore(), { minor: p } = useLoading, l = ref(!1), n = ref(), a = ref(), u = ref(0), y = computed(() => {
3143
+ var c, C;
3144
+ const i = (c = d.loyaltyRewards.items.find(
3145
+ (V) => {
3146
+ var $;
3147
+ return V.value === (($ = n.value) == null ? void 0 : $.collectible);
3148
+ }
3149
+ )) == null ? void 0 : c.raw.type;
3150
+ return ((C = n.value) == null ? void 0 : C.type) === "LOYALTY" && (i === "CREDIT" || i === "TITLE");
3151
+ }), f = computed(
3152
+ () => y.value ? FdoThresholdCreditReward : FdtoThresholdReward
3153
+ ), s = computed(() => {
3154
+ const i = f.value.safeParse(n.value);
3155
+ return i.success ? [] : i.error.errors;
3156
+ });
3157
+ function k(i, c, C) {
3158
+ i && (n.value = c, u.value = C), l.value = i;
3159
+ }
3160
+ const x = o;
3161
+ async function h() {
3162
+ const i = f.value.safeParse(n.value);
3163
+ i.success && (await p(
3164
+ async () => {
3165
+ i.data.type === "VOUCHER" && a.value && (i.data.collectibleConfig.image = await firebaseStorage.update(
3166
+ i.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, a.value),
3167
+ a.value
3168
+ ));
3169
+ },
3170
+ {
3171
+ message: "Uploading reward image",
3172
+ successMessage: "Reward image updated"
3173
+ }
3174
+ ), x("update:model-value", i.data, u.value));
3175
+ }
3176
+ const v = ref();
3177
+ return r({
3178
+ showSheet: k
3179
+ }), (i, c) => {
3180
+ const C = resolveComponent("FmStepperField"), V = resolveComponent("FmSelect"), $ = resolveComponent("FmForm"), S = resolveComponent("FmButton"), w = resolveComponent("FmSideSheet");
3181
+ return openBlock(), createBlock(w, {
3182
+ "max-width": 560,
3183
+ modelValue: unref(l),
3184
+ "onUpdate:modelValue": [
3185
+ c[10] || (c[10] = (R) => isRef(l) ? l.value = R : null),
3186
+ c[11] || (c[11] = (R) => l.value = R)
3187
+ ],
3188
+ header: "Edit reward",
3189
+ "dismiss-away": ""
3190
+ }, {
3191
+ "side-sheet-footer": withCtx(() => [
3192
+ createElementVNode("div", _hoisted_1$7, [
3193
+ createVNode(S, {
3194
+ variant: "primary",
3195
+ type: "button",
3196
+ label: "Confirm",
3197
+ disabled: unref(s).length > 0,
3198
+ onClick: c[8] || (c[8] = async () => {
3199
+ var R;
3200
+ return (R = unref(v)) == null ? void 0 : R.validateInputs();
3201
+ })
3202
+ }, null, 8, ["disabled"]),
3203
+ createVNode(S, {
3204
+ variant: "secondary",
3205
+ type: "button",
3206
+ label: "Cancel",
3207
+ onClick: c[9] || (c[9] = (R) => l.value = !1)
3208
+ })
3209
+ ])
3210
+ ]),
3211
+ default: withCtx(() => [
3212
+ createVNode(JsonViewer, { json: unref(n) }, null, 8, ["json"]),
3213
+ unref(n) ? (openBlock(), createBlock($, {
3214
+ key: 0,
3215
+ class: "flex flex-col gap-y-24",
3216
+ ref_key: "formRef",
3217
+ ref: v,
3218
+ onValidationSuccess: c[7] || (c[7] = (R) => h())
3219
+ }, {
3220
+ default: withCtx(() => {
3221
+ var R;
3222
+ return [
3223
+ unref(n).type ? (openBlock(), createBlock(C, {
3224
+ key: 0,
3225
+ label: "Threshold",
3226
+ rules: [
3227
+ unref(ZodHelper).toRule(
3228
+ unref(z).number().min(1).max(
3229
+ m.maxThreshold,
3230
+ `Number cannot be more than ${m.maxThreshold}`
3231
+ )
3232
+ )
3233
+ ],
3234
+ "model-value": unref(n).threshold,
3235
+ "onUpdate:modelValue": c[0] || (c[0] = (F) => n.value = {
3236
+ ...unref(n),
3237
+ threshold: F
3238
+ })
3239
+ }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
3240
+ createVNode(V, {
3241
+ label: "Reward Type",
3242
+ items: [
3243
+ { label: "Voucher", value: "VOUCHER" },
3244
+ { label: "Loyalty", value: "LOYALTY" }
3245
+ ],
3246
+ "model-value": unref(n).type,
3247
+ "onUpdate:modelValue": c[1] || (c[1] = (F) => {
3248
+ var M, H;
3249
+ F === "VOUCHER" ? n.value = {
3250
+ collectible: null,
3251
+ type: "VOUCHER",
3252
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
3253
+ business: unref(useCoreStore)().currentBusiness.value._id
3254
+ }),
3255
+ earningOption: {
3256
+ amount: 1,
3257
+ type: "FIXED"
3258
+ },
3259
+ validityOption: {
3260
+ validForDay: 7
3261
+ },
3262
+ threshold: (M = unref(n)) == null ? void 0 : M.threshold
3263
+ } : n.value = {
3264
+ collectible: unref(d).loyaltyRewards.raw[0]._id,
3265
+ type: "LOYALTY",
3266
+ earningOption: {
3267
+ amount: 1,
3268
+ type: "FIXED"
3269
+ },
3270
+ validityOption: {
3271
+ validForDay: 7
3272
+ },
3273
+ threshold: (H = unref(n)) == null ? void 0 : H.threshold
3274
+ };
3275
+ })
3276
+ }, null, 8, ["model-value"]),
3277
+ unref(n).type == "LOYALTY" ? (openBlock(), createBlock(V, {
3278
+ key: 1,
3279
+ label: "Loyalty type",
3280
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "collectible", [unref(n).type])],
3281
+ items: unref(d).loyaltyRewards.items,
3282
+ "model-value": unref(n).collectible,
3283
+ "onUpdate:modelValue": c[2] || (c[2] = (F) => unref(n).collectible = F)
3284
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
3285
+ unref(n).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
3286
+ c[12] || (c[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
3287
+ createVNode(_sfc_main$A, {
3288
+ class: "mt-[-8px]",
3289
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "earningOption", [unref(n).type])],
3290
+ "helper-state": unref(ZodHelper).helperState(unref(s), "earningOption"),
3291
+ "error-text": unref(ZodHelper).helperText(unref(s), "earningOption"),
3292
+ "fixed-type": !0,
3293
+ "model-value": unref(n).earningOption,
3294
+ "onUpdate:modelValue": c[3] || (c[3] = (F) => n.value = {
3295
+ ...unref(n),
3296
+ earningOption: F
3297
+ })
3298
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
3299
+ createVNode(_sfc_main$B, {
3300
+ class: "!gap-24",
3301
+ type: unref(n).type === "LOYALTY" ? "custom" : "range",
3302
+ "for-credit": unref(y),
3303
+ rules: [unref(ZodHelper).ruleAtPath(unref(f), "validityOption", [unref(n).type])],
3304
+ "model-value": unref(n).validityOption,
3305
+ "onUpdate:modelValue": c[4] || (c[4] = (F) => n.value = {
3306
+ ...unref(n),
3307
+ validityOption: F
3308
+ })
3309
+ }, null, 8, ["type", "for-credit", "rules", "model-value"])
3310
+ ], 64)) : createCommentVNode("", !0),
3311
+ unref(n).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$C, {
3312
+ key: 3,
3313
+ "reward-image": unref(a),
3314
+ "model-value": ((R = unref(n)) == null ? void 0 : R.collectibleConfig) ?? void 0,
3315
+ "onUpdate:modelValue": c[5] || (c[5] = (F) => n.value = {
3316
+ ...unref(n),
3317
+ collectibleConfig: F
3318
+ }),
3319
+ "onUpdate:rewardImage": c[6] || (c[6] = (F) => a.value = F)
3320
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
3321
+ createVNode(JsonViewer, { json: unref(s) }, null, 8, ["json"])
3322
+ ];
3323
+ }),
3324
+ _: 1
3325
+ }, 512)) : createCommentVNode("", !0)
3326
+ ]),
3327
+ _: 1
3328
+ }, 8, ["modelValue"]);
3329
+ };
3330
+ }
3331
+ }), _hoisted_1$6 = {
3332
+ key: 0,
3333
+ class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
3334
+ }, _hoisted_2$5 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
3335
+ __name: "MissionProgress",
3336
+ props: {
3337
+ type: {
3338
+ type: String,
3339
+ required: !0
3340
+ },
3341
+ maxRange: {
3342
+ type: Number,
3343
+ required: !0
3344
+ },
3345
+ currentRange: {
3346
+ type: Number,
3347
+ default: 0
3348
+ },
3349
+ markers: {
3350
+ type: Array,
3351
+ default: () => []
3352
+ }
3353
+ },
3354
+ setup(e) {
3355
+ const r = e, { maxRange: o, currentRange: m, markers: d } = toRefs(r), p = computed(
3356
+ () => Math.min(m.value / o.value * 100, 100)
3357
+ ), l = (n) => n / o.value * 100;
3358
+ return (n, a) => {
3359
+ const u = resolveComponent("FmIcon");
3360
+ return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$6, [
3361
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(o), 40), (y) => (openBlock(), createBlock(u, {
3362
+ class: normalizeClass(
3363
+ unref(m) >= y ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
3364
+ ),
3365
+ outline: unref(m) < y,
3366
+ key: y,
3367
+ name: unref(d).some((f) => f === y) ? "featured_seasonal_and_gifts" : "check_circle"
3368
+ }, null, 8, ["class", "outline", "name"]))), 128))
3369
+ ])) : (openBlock(), createElementBlock("div", {
3370
+ key: 1,
3371
+ class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
3372
+ }, [
3373
+ createElementVNode("div", {
3374
+ class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
3375
+ style: normalizeStyle({ width: unref(p) + "%" })
3376
+ }, null, 4),
3377
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(d), (y, f) => (openBlock(), createElementBlock("div", {
3378
+ key: f,
3379
+ class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
3380
+ style: normalizeStyle({ left: l(y) + "%" })
3381
+ }, [
3382
+ createElementVNode("div", _hoisted_2$5, [
3383
+ createElementVNode("div", {
3384
+ class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
3385
+ }),
3386
+ a[0] || (a[0] = createElementVNode("div", null, "🎁", -1))
3387
+ ])
3388
+ ], 4))), 128))
3389
+ ]));
3390
+ };
3391
+ }
3392
+ }), isObject = (e) => e !== null && typeof e == "object";
3393
+ function changeKeysFactory(e) {
3394
+ return function r(o, m = 1, d) {
3395
+ if (m === 0 || !isObject(o))
3396
+ return o;
3397
+ if (Array.isArray(o))
3398
+ return o.map((l) => r(l, m - 1, d));
3399
+ const p = Object.create(Object.getPrototypeOf(o));
3400
+ return Object.keys(o).forEach((l) => {
3401
+ const n = o[l], a = e(l, d), u = r(n, m - 1, d);
3402
+ p[a] = u;
3403
+ }), p;
3404
+ };
3405
+ }
3406
+ const sentenceCase = changeKeysFactory(sentenceCase$1), _hoisted_1$5 = { class: "space-y-16" }, _hoisted_2$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_3$4 = { class: "fm-typo-en-body-lg-400" }, _hoisted_4$4 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_5$4 = { class: "fm-typo-en-title-sm-800" }, _hoisted_6$4 = { class: "flex items-center gap-4" }, _hoisted_7$3 = { class: "fm-typo-en-body-lg-600" }, _hoisted_8$3 = { 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$5 = /* @__PURE__ */ defineComponent({
3407
+ __name: "MissionPoolInput",
3408
+ props: {
3409
+ modelValue: {
3410
+ type: Array,
3411
+ default: () => []
3412
+ },
3413
+ mission: {
3414
+ type: Object,
3415
+ required: !0
3416
+ }
3417
+ },
3418
+ emits: ["update:model-value"],
3419
+ setup(e, { emit: r }) {
3420
+ const { t: o } = useI18n(), m = e, d = r, p = useMembershipStore(), l = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), n = computed(
3421
+ () => m.modelValue.sort((v, i) => v.threshold - i.threshold) ?? []
3422
+ ), a = computed(() => {
3423
+ const v = l.safeParse(n.value);
3424
+ return v.success ? [] : v.error.errors;
3425
+ }), u = ref();
3426
+ function y(v, i) {
3427
+ var C;
3428
+ const c = [...n.value];
3429
+ c[i] = v, (C = u.value) == null || C.showSheet(!1), d("update:model-value", c);
3430
+ }
3431
+ function f(v) {
3432
+ const i = v.type == "VOUCHER" ? v.collectibleConfig : p.collectibles.find(
3433
+ (V) => V._id.toString() == v.collectible
3434
+ ), c = CollectionUtils.formattedType((i == null ? void 0 : i.name) || ""), C = v.earningOption.type == "FIXED" ? o("connect.template.mission_pool.reward_sublabel_fixed", {
3435
+ threshold: v.threshold,
3436
+ amount: v.earningOption.amount
3437
+ }) : o("connect.template.mission_pool.reward_sublabel_per_spend", {
3438
+ threshold: v.threshold,
3439
+ amount: v.earningOption.amount,
3440
+ every: v.earningOption.every
3441
+ });
3442
+ return {
3443
+ label: isNullOrEmpty(c) ? o("connect.template.mission_pool.no_reward") : c,
3444
+ sublabel: C
3445
+ };
3446
+ }
3447
+ function s(v) {
3448
+ var c;
3449
+ const i = [...n.value];
3450
+ (c = u.value) == null || c.showSheet(!0, i[v], v);
3451
+ }
3452
+ function k(v) {
3453
+ const i = [...n.value];
3454
+ i.splice(v, 1), d("update:model-value", i);
3455
+ }
3456
+ function x() {
3457
+ var v;
3458
+ (v = u.value) == null || v.showSheet(
3459
+ !0,
3460
+ {
3461
+ type: "LOYALTY",
3462
+ collectible: p.loyaltyRewards.items[0].value,
3463
+ threshold: null,
3464
+ validityOption: {
3465
+ validForDay: 7
3466
+ },
3467
+ earningOption: {
3468
+ type: "FIXED",
3469
+ amount: 1
3470
+ }
3471
+ },
3472
+ n.value.length
3473
+ );
3474
+ }
3475
+ function h(v) {
3476
+ var i, c;
3477
+ return v.type == "VOUCHER" ? (i = v.collectibleConfig) == null ? void 0 : i.name : sentenceCase(
3478
+ ((c = p.loyaltyRewards.items.find(
3479
+ (C) => C.value == v.collectible
3480
+ )) == null ? void 0 : c.label) || ""
3481
+ );
3482
+ }
3483
+ return (v, i) => {
3484
+ const c = resolveComponent("FmButton"), C = resolveComponent("FmCard"), V = resolveComponent("FmHelperText");
3485
+ return openBlock(), createElementBlock("div", _hoisted_1$5, [
3486
+ createElementVNode("div", _hoisted_2$4, toDisplayString(unref(o)("connect.template.configure_reward_customer")), 1),
3487
+ createVNode(c, {
3488
+ label: unref(o)("connect.template.mission_pool.add_reward"),
3489
+ onClick: i[0] || (i[0] = ($) => x()),
3490
+ variant: "plain",
3491
+ icon: "add"
3492
+ }, null, 8, ["label"]),
3493
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(n), ($, S) => (openBlock(), createBlock(C, {
3494
+ key: S,
3495
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
3496
+ variant: "outlined",
3497
+ onClick: (w) => s(S)
3498
+ }, {
3499
+ default: withCtx(() => [
3500
+ createElementVNode("div", null, [
3501
+ createElementVNode("div", _hoisted_3$4, toDisplayString(f($).label), 1),
3502
+ createElementVNode("div", _hoisted_4$4, toDisplayString(f($).sublabel), 1)
3503
+ ]),
3504
+ createVNode(c, {
3505
+ icon: "delete",
3506
+ variant: "tertiary",
3507
+ onClick: (w) => (w.stopPropagation(), k(S))
3508
+ }, null, 8, ["onClick"])
3509
+ ]),
3510
+ _: 2
3511
+ }, 1032, ["onClick"]))), 128)),
3512
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a).filter(($) => $.path.join(".") == ""), ($) => (openBlock(), createBlock(V, {
3513
+ key: $.message,
3514
+ text: $.message,
3515
+ state: "error"
3516
+ }, null, 8, ["text"]))), 128)),
3517
+ createElementVNode("div", _hoisted_5$4, toDisplayString(unref(o)("connect.template.mission_pool.preview")), 1),
3518
+ (openBlock(), createBlock(C, {
3519
+ key: 0,
3520
+ variant: "outlined",
3521
+ class: "p-24 space-y-16 w-fit"
3522
+ }, {
3523
+ default: withCtx(() => {
3524
+ var $, S;
3525
+ return [
3526
+ createElementVNode("div", _hoisted_6$4, [
3527
+ createElementVNode("div", null, [
3528
+ createElementVNode("div", _hoisted_7$3, toDisplayString(unref(o)("connect.template.mission_pool.collect_stamps", { end: e.mission.end })) + " " + toDisplayString((($ = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : $.earningOption.amount) > 1 ? (S = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : S.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? h(e.modelValue[e.modelValue.length - 1]) : ""), 1),
3529
+ createElementVNode("div", _hoisted_8$3, toDisplayString(unref(o)("connect.template.mission_pool.earn_stamp")), 1)
3530
+ ])
3531
+ ]),
3532
+ createElementVNode("div", _hoisted_9$2, [
3533
+ createVNode(_sfc_main$6, {
3534
+ type: e.mission.type,
3535
+ "max-range": e.mission.end,
3536
+ currentRange: e.mission.end / 4,
3537
+ markers: e.modelValue.map((w) => w.threshold)
3538
+ }, null, 8, ["type", "max-range", "currentRange", "markers"]),
3539
+ e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_10$2, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
3540
+ ])
3541
+ ];
3542
+ }),
3543
+ _: 1
3544
+ })),
3545
+ createVNode(_sfc_main$7, {
3546
+ ref_key: "sheetRef",
3547
+ ref: u,
3548
+ "onUpdate:modelValue": y,
3549
+ "max-threshold": e.mission.end
3550
+ }, null, 8, ["max-threshold"])
3551
+ ]);
3552
+ };
3553
+ }
3554
+ }), _hoisted_1$4 = { class: "space-y-16" }, _hoisted_2$3 = { class: "space-y-8" }, _hoisted_3$3 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_5$3 = { class: "grid grid-cols-2 gap-16" }, _hoisted_6$3 = { class: "fm-typo-en-title-sm-800" }, _hoisted_7$2 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_8$2 = { 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$4 = /* @__PURE__ */ defineComponent({
3555
+ __name: "MissionInput",
3556
+ props: {
3557
+ modelValue: Object
3558
+ },
3559
+ emits: ["update:model-value"],
3560
+ setup(e, { emit: r }) {
3561
+ const { t: o } = useI18n(), m = e, d = computed(() => {
3562
+ const n = FdoMission.safeParse(m.modelValue);
3563
+ return n.success ? [] : n.error.errors;
3564
+ }), p = computed(() => [
3565
+ {
3566
+ label: o("connect.campaign.mission.typeOption.STAMP.label"),
3567
+ description: o("connect.campaign.mission.typeOption.STAMP.description"),
3568
+ value: F_MISSION_TYPE.enum.STAMP
3569
+ },
3570
+ {
3571
+ label: o("connect.campaign.mission.typeOption.PROGRESSIVE.label"),
3572
+ description: o("connect.campaign.mission.typeOption.PROGRESSIVE.description"),
3573
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
3574
+ }
3575
+ ]), l = r;
3576
+ return (n, a) => {
3577
+ var f;
3578
+ const u = resolveComponent("FmCard"), y = resolveComponent("FmStepperField");
3579
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
3580
+ createElementVNode("div", _hoisted_2$3, [
3581
+ createElementVNode("div", _hoisted_3$3, toDisplayString(unref(o)("connect.campaign.mission.missionType")), 1),
3582
+ createElementVNode("div", _hoisted_4$3, toDisplayString(unref(o)("connect.template.select_game")), 1),
3583
+ createElementVNode("div", _hoisted_5$3, [
3584
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(p), (s) => {
3585
+ var k, x;
3586
+ return openBlock(), createBlock(u, {
3587
+ variant: "outlined",
3588
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
3589
+ "col-span-2": unref(p).length == 1,
3590
+ "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) == s.value,
3591
+ "hover:bg-fm-color-opacity-sm": ((x = e.modelValue) == null ? void 0 : x.type) != s.value
3592
+ }]),
3593
+ onClick: () => {
3594
+ var h, v;
3595
+ ((h = e.modelValue) == null ? void 0 : h.type) != s.value && l("update:model-value", {
3596
+ ...e.modelValue,
3597
+ type: s.value,
3598
+ end: ((v = e.modelValue) == null ? void 0 : v.end) || 1
3599
+ });
3600
+ },
3601
+ key: s.value
3602
+ }, {
3603
+ default: withCtx(() => [
3604
+ createElementVNode("div", _hoisted_6$3, toDisplayString(s.label), 1),
3605
+ createElementVNode("div", _hoisted_7$2, toDisplayString(s.description), 1)
3606
+ ]),
3607
+ _: 2
3608
+ }, 1032, ["class", "onClick"]);
3609
+ }), 128))
3610
+ ])
3611
+ ]),
3612
+ createElementVNode("div", _hoisted_8$2, [
3613
+ createElementVNode("div", _hoisted_9$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequired")), 1),
3614
+ createElementVNode("div", _hoisted_10$1, toDisplayString(unref(o)("connect.campaign.mission.collectionsRequiredDescription")), 1),
3615
+ createVNode(y, {
3616
+ label: unref(o)("connect.campaign.mission.maximumToCollect"),
3617
+ "model-value": ((f = e.modelValue) == null ? void 0 : f.end) || null,
3618
+ "onUpdate:modelValue": a[0] || (a[0] = (s) => {
3619
+ var k;
3620
+ return l("update:model-value", {
3621
+ ...e.modelValue,
3622
+ type: ((k = e.modelValue) == null ? void 0 : k.type) || "STAMP",
3623
+ end: s
3624
+ });
3625
+ }),
3626
+ "helper-text": unref(ZodHelper).helperText(unref(d), "end") || unref(o)("connect.campaign.mission.thresholdHelperText"),
3627
+ "helper-state": unref(ZodHelper).helperState(unref(d), "end") || "none"
3628
+ }, null, 8, ["label", "model-value", "helper-text", "helper-state"])
3629
+ ])
3630
+ ]);
3631
+ };
3632
+ }
3633
+ });
3634
+ function useLocaleText() {
3635
+ const { locale: e, t: r } = useI18n();
3636
+ function o(m, d) {
3637
+ return m ? m[e.value] ?? m["en-US"] ?? r(d) : r(d);
3638
+ }
3639
+ return { getLocaleText: o };
3640
+ }
3641
+ const _hoisted_1$3 = { key: 29 }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
3642
+ __name: "TemplateInput",
3643
+ props: {
3644
+ pushAvailability: {
3645
+ type: String,
3646
+ default: "checking"
3647
+ },
3648
+ field: { type: Object, required: !0 },
3649
+ modelValue: {
3650
+ type: Object
3651
+ },
3652
+ schema: {
3653
+ type: Object
3654
+ },
3655
+ extras: {
3656
+ type: Object
3657
+ },
3658
+ helperText: {
3659
+ type: String
3660
+ },
3661
+ disabled: {
3662
+ type: Boolean,
3663
+ default: !1
3664
+ },
3665
+ campaignType: {
3666
+ type: String,
3667
+ default: void 0
3668
+ },
3669
+ /** False until the form has been submitted, for fields that validate late. */
3670
+ showValidation: {
3671
+ type: Boolean,
3672
+ default: !0
3673
+ }
3674
+ },
3675
+ emits: ["retry-push", "update:model-value", "update:file"],
3676
+ setup(e, { emit: r }) {
3677
+ const { t: o } = useI18n(), { getLocaleText: m } = useLocaleText(), d = e, p = r;
3678
+ function l(y) {
3679
+ switch (d.field.type) {
3680
+ case "timeframe":
3681
+ const f = y.startDate ? hooks(y.startDate).startOf("day").toISOString() : void 0, s = y.endDate ? hooks(y.endDate).endOf("day").toISOString() : void 0;
3682
+ p("update:model-value", {
3683
+ type: "timeframe",
3684
+ property: "__now",
3685
+ start: f,
3686
+ end: s
3687
+ });
3688
+ break;
3689
+ case "image": {
3690
+ p(
3691
+ "update:file",
3692
+ y,
3693
+ n.value || firebaseStorage.collectibleImagePath(void 0, y)
3694
+ );
3695
+ break;
3696
+ }
3697
+ default:
3698
+ p("update:model-value", y);
3699
+ break;
3700
+ }
3701
+ }
3702
+ const n = computed(() => {
3703
+ switch (d.field.type) {
3704
+ case "timeframe": {
3705
+ const y = d.modelValue;
3706
+ return {
3707
+ startDate: y != null && y.start ? hooks(y == null ? void 0 : y.start).format("YYYY-MM-DD") : null,
3708
+ endDate: y != null && y.end ? hooks(y == null ? void 0 : y.end).format("YYYY-MM-DD") : null
3709
+ };
3710
+ }
3711
+ default:
3712
+ return d.modelValue;
3713
+ }
3714
+ });
3715
+ function a() {
3716
+ if (!u.value.schema) return [];
3717
+ const y = u.value.schema.safeParse(d.modelValue);
3718
+ return y.success ? [] : y.error.errors;
3719
+ }
3720
+ const u = computed(() => ({
3721
+ schema: d.schema,
3722
+ unwrapped: d.schema ? ZodHelper.unwrap(d.schema) : void 0,
3723
+ rules: d.schema ? [ZodHelper.ruleAtPath(d.schema, "")] : void 0,
3724
+ labelMark: d.schema && ZodHelper.isRequired(d.schema) == !1 ? "optional" : void 0,
3725
+ zodLabel: d.schema ? ZodHelper.toInputLabel(
3726
+ d.schema,
3727
+ m(d.field.label_locale, d.field.label ?? "")
3728
+ ) : void 0
3729
+ }));
3730
+ return (y, f) => {
3731
+ var i, c, C, V, $;
3732
+ const s = resolveComponent("FmTextField"), k = resolveComponent("FmStepperField"), x = resolveComponent("FmTextarea"), h = resolveComponent("FmHelperText"), v = resolveComponent("FmSwitch");
3733
+ return e.field.type === "text" ? (openBlock(), createBlock(s, {
3734
+ key: 0,
3735
+ label: unref(m)(e.field.label_locale, e.field.label ?? ""),
3736
+ "label-mark": unref(u).labelMark,
3737
+ rules: unref(u).rules,
3738
+ "model-value": unref(n),
3739
+ "onUpdate:modelValue": l,
3740
+ "helper-state": e.helperText ? "error" : void 0,
3741
+ "helper-text": e.helperText
3742
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3743
+ createVNode(JsonViewer, {
3744
+ json: { schema: unref(u).unwrapped, props: d }
3745
+ }, null, 8, ["json"]),
3746
+ createVNode(k, {
3747
+ label: unref(m)(e.field.label_locale, e.field.label ?? ""),
3748
+ "label-mark": e.field.isRuleChildren ? void 0 : unref(u).labelMark,
3749
+ "model-value": unref(n),
3750
+ rules: e.field.isRuleChildren ? [] : unref(u).rules,
3751
+ "onUpdate:modelValue": l,
3752
+ "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
3753
+ "helper-text": e.field.isRuleChildren ? e.helperText : void 0
3754
+ }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
3755
+ ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(x, {
3756
+ key: 2,
3757
+ label: unref(m)(e.field.label_locale, e.field.label ?? ""),
3758
+ "label-mark": unref(u).labelMark,
3759
+ rules: unref(u).rules,
3760
+ "model-value": unref(n),
3761
+ "onUpdate:modelValue": l,
3762
+ "show-word-count": "",
3763
+ "max-length": ($ = (V = (C = (c = (i = unref(u)) == null ? void 0 : i.unwrapped) == null ? void 0 : c._def) == null ? void 0 : C.checks) == null ? void 0 : V.find((S) => S.kind == "max")) == null ? void 0 : $.value
3764
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$p, {
3765
+ key: 3,
3766
+ "campaign-type": e.extras,
3767
+ "model-value": unref(n),
3768
+ disabled: e.disabled,
3769
+ "onUpdate:modelValue": l
3770
+ }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
3771
+ createVNode(_sfc_main$n, {
3772
+ "model-value": unref(n),
3773
+ "onUpdate:modelValue": l
3774
+ }, null, 8, ["model-value"]),
3775
+ createVNode(h, {
3776
+ class: "!mt-[8px]",
3777
+ text: unref(ZodHelper).helperText(a(), ""),
3778
+ state: unref(ZodHelper).helperState(a(), "")
3779
+ }, null, 8, ["text", "state"])
3780
+ ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$D, {
3781
+ key: 5,
3782
+ thumbnail: unref(n),
3783
+ "aspect-ratio": "16 / 9",
3784
+ class: "w-1/2 xs:w-2/3",
3785
+ "onUpdate:file": l
3786
+ }, {
3787
+ label: withCtx(() => [
3788
+ (openBlock(), createBlock(resolveDynamicComponent(unref(u).zodLabel)))
3789
+ ]),
3790
+ _: 1
3791
+ }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(v, {
3792
+ key: 6,
3793
+ label: unref(m)(e.field.label_locale, e.field.label ?? ""),
3794
+ "label-placement": "right",
3795
+ sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
3796
+ "label-mark": unref(u).labelMark,
3797
+ rules: unref(u).rules,
3798
+ "model-value": unref(n),
3799
+ "onUpdate:modelValue": l
3800
+ }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$E, {
3801
+ key: 7,
3802
+ "model-value": unref(n),
3803
+ "onUpdate:modelValue": l,
3804
+ "no-campaign": !1,
3805
+ schema: unref(u).schema,
3806
+ "is-mission": e.extras === "MISSION"
3807
+ }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "grab_conditions" ? (openBlock(), createBlock(GrabConditionsInput, {
3808
+ key: 8,
3809
+ "model-value": unref(n),
3810
+ "onUpdate:modelValue": l,
3811
+ schema: unref(u).schema
3812
+ }, null, 8, ["model-value", "schema"])) : e.field.type === "grab_quota" ? (openBlock(), createBlock(_sfc_main$a, {
3813
+ key: 9,
3814
+ "model-value": unref(n),
3815
+ "onUpdate:modelValue": l,
3816
+ schema: unref(u).schema
3817
+ }, null, 8, ["model-value", "schema"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$F, {
3818
+ key: 10,
3819
+ "model-value": unref(n),
3820
+ "onUpdate:modelValue": l
3821
+ }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 11 }, [
3822
+ createVNode(_sfc_main$G, {
3823
+ "model-value": unref(n),
3824
+ "onUpdate:modelValue": l,
3825
+ "can-set-auto-apply": e.field.property == "campaign.effect"
3826
+ }, null, 8, ["model-value", "can-set-auto-apply"]),
3827
+ unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(h, {
3828
+ key: 0,
3829
+ class: "!mt-[8px]",
3830
+ text: unref(o)("connect.campaign.common.effect_required"),
3831
+ state: "error"
3832
+ }, null, 8, ["text"]))
3833
+ ], 64)) : e.field.type == "grab_effect" ? (openBlock(), createElementBlock(Fragment, { key: 12 }, [
3834
+ createVNode(GrabEffectSheet, {
3835
+ "model-value": unref(n),
3836
+ "onUpdate:modelValue": l
3837
+ }, null, 8, ["model-value"]),
3838
+ unref(n) ? createCommentVNode("", !0) : (openBlock(), createBlock(h, {
3839
+ key: 0,
3840
+ class: "!mt-[8px]",
3841
+ text: unref(o)("connect.campaign.common.effect_required"),
3842
+ state: "error"
3843
+ }, null, 8, ["text"]))
3844
+ ], 64)) : e.field.type === "message" ? (openBlock(), createElementBlock(Fragment, { key: 13 }, [
3845
+ e.field.property === "campaign.message" ? (openBlock(), createBlock(_sfc_main$h, {
3846
+ key: 0,
3847
+ "push-availability": e.pushAvailability,
3848
+ onRetryPush: f[0] || (f[0] = (S) => p("retry-push")),
3849
+ "show-validation": e.showValidation,
3850
+ "model-value": unref(n),
3851
+ "onUpdate:modelValue": l,
3852
+ "helper-text": unref(ZodHelper).helperText(a(), ""),
3853
+ "trigger-type": e.field.extras,
3854
+ "helper-state": unref(ZodHelper).helperState(a(), "")
3855
+ }, null, 8, ["push-availability", "show-validation", "model-value", "helper-text", "trigger-type", "helper-state"])) : (openBlock(), createBlock(_sfc_main$y, {
3856
+ key: 1,
3857
+ "allow-email": !0,
3858
+ "allow-whatsapp": !0,
3859
+ "model-value": unref(n),
3860
+ "onUpdate:modelValue": l,
3861
+ "helper-text": unref(ZodHelper).helperText(a(), ""),
3862
+ "trigger-type": e.field.extras,
3863
+ "helper-state": unref(ZodHelper).helperState(a(), "")
3864
+ }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"]))
3865
+ ], 64)) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$A, {
3866
+ key: 14,
3867
+ "model-value": unref(n),
3868
+ "onUpdate:modelValue": l,
3869
+ extras: e.extras,
3870
+ "error-text": e.helperText
3871
+ }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$B, {
3872
+ key: 15,
3873
+ type: "custom",
3874
+ "model-value": unref(n),
3875
+ "onUpdate:modelValue": l,
3876
+ "helper-text": e.helperText || unref(ZodHelper).helperText(a(), ""),
3877
+ "for-credit": d.campaignType === "CREDIT"
3878
+ }, null, 8, ["model-value", "helper-text", "for-credit"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$f, {
3879
+ key: 16,
3880
+ "model-value": unref(n),
3881
+ "onUpdate:modelValue": l
3882
+ }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$d, {
3883
+ key: 17,
3884
+ "model-value": unref(n),
3885
+ "onUpdate:modelValue": l
3886
+ }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$4, {
3887
+ key: 18,
3888
+ "model-value": unref(n),
3889
+ "onUpdate:modelValue": l
3890
+ }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$9, {
3891
+ key: 19,
3892
+ "model-value": unref(n),
3893
+ "onUpdate:modelValue": l
3894
+ }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$8, {
3895
+ key: 20,
3896
+ "model-value": unref(n),
3897
+ "onUpdate:modelValue": l,
3898
+ "helper-text": unref(ZodHelper).helperText(a(), ""),
3899
+ "helper-state": unref(ZodHelper).helperState(a(), "")
3900
+ }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$5, {
3901
+ key: 21,
3902
+ "model-value": unref(n),
3903
+ "onUpdate:modelValue": l,
3904
+ mission: e.extras.mission
3905
+ }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
3906
+ createVNode(_sfc_main$g, {
3907
+ "model-value": unref(n),
3908
+ "onUpdate:modelValue": l,
3909
+ "start-date": e.extras.start,
3910
+ "end-date": e.extras.end
3911
+ }, null, 8, ["model-value", "start-date", "end-date"]),
3912
+ e.helperText ? (openBlock(), createBlock(h, {
3913
+ key: 0,
3914
+ class: "!mt-[8px]",
3915
+ text: e.helperText,
3916
+ state: "error"
3917
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3918
+ ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
3919
+ createVNode(_sfc_main$H, {
3920
+ "model-value": unref(n),
3921
+ "onUpdate:modelValue": l
3922
+ }, null, 8, ["model-value"]),
3923
+ e.helperText ? (openBlock(), createBlock(h, {
3924
+ key: 0,
3925
+ class: "!mt-[8px]",
3926
+ text: e.helperText,
3927
+ state: "error"
3928
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3929
+ ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
3930
+ e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(n).rules.g_time).length > 0 ? (openBlock(), createBlock(h, {
3931
+ key: 0,
3932
+ state: "warning",
3933
+ text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
3934
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
3935
+ createVNode(_sfc_main$r, {
3936
+ "model-value": unref(n),
3937
+ "onUpdate:modelValue": l
3938
+ }, null, 8, ["model-value"]),
3939
+ e.helperText ? (openBlock(), createBlock(h, {
3940
+ key: 1,
3941
+ class: "!mt-[8px]",
3942
+ text: e.helperText,
3943
+ state: "error"
3944
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3945
+ ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
3946
+ createVNode(_sfc_main$I, {
3947
+ "model-value": unref(n),
3948
+ "onUpdate:modelValue": l
3949
+ }, null, 8, ["model-value"]),
3950
+ e.helperText ? (openBlock(), createBlock(h, {
3951
+ key: 0,
3952
+ class: "!mt-[8px]",
3953
+ text: e.helperText,
3954
+ state: "error"
3955
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3956
+ ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 26 }, [
3957
+ createVNode(_sfc_main$J, {
3958
+ "model-value": unref(n),
3959
+ "onUpdate:modelValue": l
3960
+ }, null, 8, ["model-value"]),
3961
+ e.helperText ? (openBlock(), createBlock(h, {
3962
+ key: 0,
3963
+ class: "!mt-[8px]",
3964
+ text: e.helperText,
3965
+ state: "error"
3966
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3967
+ ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 27 }, [
3968
+ createVNode(_sfc_main$q, {
3969
+ "model-value": unref(n),
3970
+ "onUpdate:modelValue": l
3971
+ }, null, 8, ["model-value"]),
3972
+ e.helperText ? (openBlock(), createBlock(h, {
3973
+ key: 0,
3974
+ class: "!mt-[8px]",
3975
+ text: e.helperText,
3976
+ state: "error"
3977
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3978
+ ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 28 }, [
3979
+ createVNode(_sfc_main$c, {
3980
+ "model-value": unref(n),
3981
+ "onUpdate:modelValue": l
3982
+ }, null, 8, ["model-value"]),
3983
+ e.helperText ? (openBlock(), createBlock(h, {
3984
+ key: 0,
3985
+ class: "!mt-[8px]",
3986
+ text: e.helperText,
3987
+ state: "error"
3988
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
3989
+ ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$3, toDisplayString(d.field), 1));
3990
+ };
3991
+ }
3992
+ }), _hoisted_1$2 = { class: "space-y-4" }, _hoisted_2$2 = {
3993
+ id: "location-list-title",
3994
+ class: "fm-typo-en-title-sm-800"
3995
+ }, _hoisted_3$2 = { class: "block fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_4$2 = ["aria-label"], _hoisted_5$2 = ["title"], _hoisted_6$2 = ["title"], _hoisted_7$1 = {
3996
+ key: 1,
3997
+ class: "p-16 fm-typo-en-body-md-400 text-fm-color-typo-secondary"
3998
+ }, _hoisted_8$1 = { class: "flex justify-end" }, ROW_HEIGHT = 44, VIEWPORT_HEIGHT = 352, OVERSCAN = 6, _sfc_main$2 = /* @__PURE__ */ defineComponent({
3999
+ __name: "LocationListDialog",
4000
+ props: {
4001
+ rows: {},
4002
+ total: {},
4003
+ unavailable: {}
4004
+ },
4005
+ setup(e) {
4006
+ const r = e, o = useDialog(), { t: m } = useI18n(), d = ref(""), p = ref(0), l = ref(), n = computed(() => {
4007
+ const y = d.value.trim().toLowerCase();
4008
+ return y ? r.rows.filter(
4009
+ (f) => {
4010
+ var s;
4011
+ return f.name.toLowerCase().includes(y) || ((s = f.code) == null ? void 0 : s.toLowerCase().includes(y));
4012
+ }
4013
+ ) : r.rows;
4014
+ }), a = computed(
4015
+ () => Math.max(0, Math.floor(p.value / ROW_HEIGHT) - OVERSCAN)
4016
+ ), u = computed(() => {
4017
+ const y = Math.ceil((p.value + VIEWPORT_HEIGHT) / ROW_HEIGHT);
4018
+ return n.value.slice(a.value, y + OVERSCAN);
4019
+ });
4020
+ return watch(d, () => {
4021
+ p.value = 0, l.value && (l.value.scrollTop = 0);
4022
+ }), (y, f) => {
4023
+ const s = resolveComponent("FmTextField"), k = resolveComponent("FmButton"), x = resolveComponent("FmCard");
4024
+ return openBlock(), createBlock(x, {
4025
+ class: "flex flex-col gap-12 p-24 xs:p-16 w-[640px] max-w-[calc(100vw-32px)] min-w-0",
4026
+ role: "dialog",
4027
+ "aria-labelledby": "location-list-title"
4028
+ }, {
4029
+ default: withCtx(() => [
4030
+ createElementVNode("div", _hoisted_1$2, [
4031
+ createElementVNode("h2", _hoisted_2$2, toDisplayString(unref(m)("connect.campaign.common.available_at")), 1),
4032
+ createElementVNode("output", _hoisted_3$2, [
4033
+ createTextVNode(toDisplayString(unref(d).trim() ? unref(m)("connect.campaign.common.locations_match", {
4034
+ count: unref(n).length.toLocaleString(),
4035
+ total: e.total.toLocaleString()
4036
+ }) : unref(m)("connect.campaign.common.locations_count", {
4037
+ count: e.rows.length.toLocaleString(),
4038
+ total: e.total.toLocaleString()
4039
+ })) + " ", 1),
4040
+ e.unavailable ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4041
+ createTextVNode(" , " + toDisplayString(unref(m)("connect.campaign.common.locations_unavailable", {
4042
+ count: e.unavailable.toLocaleString()
4043
+ })), 1)
4044
+ ], 64)) : createCommentVNode("", !0)
4045
+ ])
4046
+ ]),
4047
+ createVNode(s, {
4048
+ modelValue: unref(d),
4049
+ "onUpdate:modelValue": f[0] || (f[0] = (h) => isRef(d) ? d.value = h : null),
4050
+ label: unref(m)("connect.setting.location.searchLocations"),
4051
+ placeholder: unref(m)("connect.setting.location.searchLocations")
4052
+ }, null, 8, ["modelValue", "label", "placeholder"]),
4053
+ createElementVNode("div", {
4054
+ ref_key: "listEl",
4055
+ ref: l,
4056
+ class: "overflow-y-auto border-y border-fm-color-neutral-gray-100",
4057
+ style: normalizeStyle({ height: `min(${VIEWPORT_HEIGHT}px, 50vh)` }),
4058
+ onScrollPassive: f[1] || (f[1] = (h) => p.value = h.target.scrollTop)
4059
+ }, [
4060
+ unref(n).length ? (openBlock(), createElementBlock("ul", {
4061
+ key: 0,
4062
+ class: "relative m-0 p-0 list-none",
4063
+ "aria-label": unref(m)("connect.campaign.common.available_at"),
4064
+ style: normalizeStyle({ height: `${unref(n).length * ROW_HEIGHT}px` })
4065
+ }, [
4066
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (h, v) => (openBlock(), createElementBlock("li", {
4067
+ key: h.id,
4068
+ class: "absolute left-0 right-0 flex items-center gap-12 px-8 border-b border-fm-color-neutral-gray-100 fm-typo-en-body-md-400",
4069
+ style: normalizeStyle({
4070
+ height: `${ROW_HEIGHT}px`,
4071
+ top: `${(unref(a) + v) * ROW_HEIGHT}px`
4072
+ })
4073
+ }, [
4074
+ h.code ? (openBlock(), createElementBlock("span", {
4075
+ key: 0,
4076
+ title: h.code,
4077
+ class: "w-[72px] shrink-0 truncate text-fm-color-typo-secondary"
4078
+ }, toDisplayString(h.code), 9, _hoisted_5$2)) : createCommentVNode("", !0),
4079
+ createElementVNode("span", {
4080
+ class: "min-w-0 truncate fm-typo-en-body-md-600",
4081
+ title: h.name
4082
+ }, toDisplayString(h.name), 9, _hoisted_6$2)
4083
+ ], 4))), 128))
4084
+ ], 12, _hoisted_4$2)) : (openBlock(), createElementBlock("div", _hoisted_7$1, toDisplayString(e.rows.length ? unref(m)("connect.campaign.common.locations_no_match") : unref(m)("connect.campaign.common.no_location")), 1))
4085
+ ], 36),
4086
+ createElementVNode("div", _hoisted_8$1, [
4087
+ createVNode(k, {
4088
+ label: unref(m)("connect.campaign.common.locations_close"),
4089
+ onClick: f[2] || (f[2] = (h) => unref(o).close())
4090
+ }, null, 8, ["label"])
4091
+ ])
4092
+ ]),
4093
+ _: 1
4094
+ });
4095
+ };
4096
+ }
4097
+ }), _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 = {
4098
+ key: 0,
4099
+ class: "flex flex-wrap items-baseline gap-12"
4100
+ }, _hoisted_4$1 = { class: "fm-typo-en-body-lg-600" }, _hoisted_5$1 = ["onClick"], _hoisted_6$1 = {
4101
+ key: 1,
4102
+ class: "fm-typo-en-body-lg-600"
4103
+ }, _sfc_main$1 = /* @__PURE__ */ defineComponent({
4104
+ __name: "CampaignSummary",
4105
+ props: {
4106
+ inDialog: {
4107
+ type: Boolean,
4108
+ default: !1
4109
+ },
4110
+ data: {
4111
+ type: Object,
4112
+ required: !0
4113
+ }
4114
+ },
4115
+ setup(e) {
4116
+ const { t: r, te: o } = useI18n(), m = useDialog();
4117
+ async function d(n) {
4118
+ l.inDialog && (m.close(), await nextTick()), m.open({
4119
+ title: "",
4120
+ dialogComponent: _sfc_main$2,
4121
+ dialogComponentProps: {
4122
+ rows: n.rows,
4123
+ total: n.total,
4124
+ unavailable: n.unavailable
4125
+ }
4126
+ });
4127
+ }
4128
+ function p(n) {
4129
+ return o(n) || o(n, "en-US");
4130
+ }
4131
+ const l = e;
4132
+ return (n, a) => {
4133
+ const u = resolveComponent("FmCard");
4134
+ return openBlock(), createBlock(u, {
4135
+ variant: "outlined",
4136
+ class: "p-16 space-y-8"
4137
+ }, {
4138
+ default: withCtx(() => [
4139
+ createElementVNode("div", _hoisted_1$1, toDisplayString(unref(r)("connect.campaign.common.summary")), 1),
4140
+ a[0] || (a[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
4141
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (y, f) => (openBlock(), createElementBlock("div", {
4142
+ class: "space-y-4",
4143
+ key: f
4144
+ }, [
4145
+ y ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4146
+ createElementVNode("div", _hoisted_2$1, toDisplayString(unref(r)(`${f}`)), 1),
4147
+ typeof y == "object" ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
4148
+ createElementVNode("span", _hoisted_4$1, [
4149
+ createTextVNode(toDisplayString(unref(r)("connect.campaign.common.locations_count", {
4150
+ count: y.rows.length.toLocaleString(),
4151
+ total: y.total.toLocaleString()
4152
+ })) + " ", 1),
4153
+ y.unavailable ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4154
+ createTextVNode(" , " + toDisplayString(unref(r)("connect.campaign.common.locations_unavailable", {
4155
+ count: y.unavailable.toLocaleString()
4156
+ })), 1)
4157
+ ], 64)) : createCommentVNode("", !0)
4158
+ ]),
4159
+ createElementVNode("button", {
4160
+ type: "button",
4161
+ class: "fm-typo-en-body-lg-600 text-fm-color-primary py-12 -my-12 px-8 -mx-8 underline underline-offset-2 hover:opacity-80 focus-visible:outline focus-visible:outline-2 focus-visible:outline-fm-color-primary rounded-sm",
4162
+ onClick: (s) => d(y)
4163
+ }, toDisplayString(unref(r)("connect.campaign.common.locations_view")), 9, _hoisted_5$1)
4164
+ ])) : (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(p(`${y}`) ? unref(r)(`${y}`) : y), 1))
4165
+ ], 64)) : createCommentVNode("", !0)
4166
+ ]))), 128))
4167
+ ]),
4168
+ _: 1
4169
+ });
4170
+ };
4171
+ }
4172
+ }), _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 = {
4173
+ key: 0,
4174
+ class: "max-w-6xl mx-auto"
4175
+ }, _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({
4176
+ __name: "EditCampaignSheet",
4177
+ emits: ["submit:model-value"],
4178
+ setup(__props, { expose: __expose, emit: __emit }) {
4179
+ const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), { getLocaleText } = useLocaleText(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
4180
+ TEMPLATES.VOUCHER
4181
+ ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign"), campaignType = ref("VOUCHER"), pushAvailability = ref("checking");
4182
+ let availabilityRequest = 0;
4183
+ async function checkPushAvailability() {
4184
+ const e = ++availabilityRequest, r = SvcConfig.getBusinessId();
4185
+ pushAvailability.value = "checking";
4186
+ try {
4187
+ if (!r) throw new Error("Business ID is unavailable");
4188
+ const m = await getNativeApp(r);
4189
+ o() && (pushAvailability.value = m ? "native" : "non-native");
4190
+ } catch {
4191
+ o() && (pushAvailability.value = "failed");
4192
+ }
4193
+ function o() {
4194
+ return e === availabilityRequest && sheetVisible.value && campaignType.value === "BROADCAST" && SvcConfig.getBusinessId() === r;
4195
+ }
4196
+ }
4197
+ watch(
4198
+ sheetVisible,
4199
+ (e) => {
4200
+ e || ++availabilityRequest;
4201
+ },
4202
+ { flush: "sync" }
4203
+ ), onBeforeUnmount(() => {
4204
+ ++availabilityRequest;
4205
+ });
4206
+ const pushBlocked = computed(
4207
+ () => {
4208
+ var e;
4209
+ return campaignType.value === "BROADCAST" && toDelivery(((e = data.value) == null ? void 0 : e.campaign) ?? {}).channels.includes("PUSH") && pushAvailability.value !== "native";
4210
+ }
4211
+ );
4212
+ async function showSheet(visible, type, campaign, selectedTemplate) {
4213
+ var e, r, o;
4214
+ if (sheetVisible.value = visible, campaignType.value = type, ++availabilityRequest, !!visible) {
4215
+ type === "BROADCAST" && checkPushAvailability();
4216
+ try {
4217
+ isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
4218
+ } catch {
4219
+ } finally {
4220
+ await new Promise((m) => setTimeout(m, 120)), isLoading.value = !1;
4221
+ }
4222
+ template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((m, d) => {
4223
+ var p;
4224
+ if (m.campaign.type === "VOUCHER" && m.campaign.code) {
4225
+ const l = (p = m.campaign._id) == null ? void 0 : p.toString();
4226
+ useCampaignStore().campaigns.voucher.some(
4227
+ (n) => n.code === m.campaign.code && n._id.toString() !== l
4228
+ ) && d.addIssue({
4229
+ code: "custom",
4230
+ message: "Code already exists, please use another code",
4231
+ path: ["campaign", "code"]
4232
+ });
4233
+ }
4234
+ })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
4235
+ ...(r = template.value) == null ? void 0 : r.defaultValue
4236
+ }), "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", {
4237
+ typeName: t(`connect.campaign.common.typeName.${type}`)
4238
+ }) : t("connect.campaign.common.create_campaign_title", {
4239
+ typeName: t(`connect.campaign.common.typeName.${type}`)
4240
+ });
4241
+ }
4242
+ }
4243
+ async function hideSheet() {
4244
+ Dialog.open({
4245
+ title: t("connect.campaign.common.unsaved_changes"),
4246
+ message: t("connect.campaign.common.unsaved_changes"),
4247
+ primaryActions: {
4248
+ text: t("connect.campaign.common.unsaved_changes_confirm"),
4249
+ close: !0
4250
+ },
4251
+ secondaryActions: {
4252
+ text: t("connect.campaign.common.unsaved_changes_cancel"),
4253
+ close: !1
4254
+ }
4255
+ }).onPrimary(() => {
4256
+ sheetVisible.value = !1;
4257
+ }).onSecondary(() => {
4258
+ Dialog.close();
4259
+ });
4260
+ }
4261
+ const emits = __emit, errors = computed(() => {
4262
+ const e = schema.value.superRefine(campaignRefinement).safeParse(data.value), r = e.success ? [] : [...e.error.errors];
4263
+ return pushBlocked.value && r.push({
4264
+ code: "custom",
4265
+ path: ["campaign", "delivery", "channels"],
4266
+ message: t(
4267
+ "connect.campaign.broadcast.pushAvailability.removeBeforeSave"
4268
+ )
4269
+ }), r;
4270
+ });
4271
+ function stepErrors(e = currentStep.value - 1) {
4272
+ const r = template.value.steps[e].groups.flatMap(
4273
+ (o) => o.fields.map((m) => schemaPathForField(m.property))
4274
+ );
4275
+ return errors.value.filter(
4276
+ (o) => r.some((m) => o.path.join(".").includes(m))
4277
+ );
4278
+ }
4279
+ const validateOnSubmit = computed(() => campaignType.value === "BROADCAST"), submitAttempted = ref(!1), showValidation = computed(
4280
+ () => !validateOnSubmit.value || submitAttempted.value
4281
+ ), visibleErrors = computed(
4282
+ () => showValidation.value ? errors.value : []
4283
+ );
4284
+ function hasVisibleStepErrors(e) {
4285
+ return showValidation.value && stepErrors(e).length > 0;
4286
+ }
4287
+ function isNextDisabled() {
4288
+ return validateOnSubmit.value ? !1 : currentStep.value - 1 < template.value.steps.length - 1 ? stepErrors().length > 0 : errors.value.length > 0;
4289
+ }
4290
+ function onNext() {
4291
+ if (stepErrors().length > 0) {
4292
+ submitAttempted.value = !0;
4293
+ return;
4294
+ }
4295
+ submitAttempted.value = !1, currentStep.value++;
4296
+ }
4297
+ __expose({ showSheet });
4298
+ function showSummaryDialog() {
4299
+ Dialog.open({
4300
+ title: "",
4301
+ dialogComponent: _sfc_main$1,
4302
+ dialogComponentProps: {
4303
+ data: data.value,
4304
+ inDialog: !0
4305
+ }
4306
+ });
4307
+ }
4308
+ const broadcastDelivery = computed(
4309
+ () => {
4310
+ var e;
4311
+ return (e = data.value) != null && e.campaign ? toDelivery(data.value.campaign) : void 0;
4312
+ }
4313
+ );
4314
+ function valueForField(e) {
4315
+ return e === "campaign.message" ? broadcastDelivery.value : _.get(data.value, e);
4316
+ }
4317
+ function schemaPathForField(e) {
4318
+ return e === "campaign.message" ? "campaign.delivery" : e;
4319
+ }
4320
+ function onUpdateProperty(e, r) {
4321
+ var o, m, d, p, l, n, a, u;
4322
+ if (e === "campaign.message" && r && "channels" in r) {
4323
+ _.set(data.value, "campaign.delivery", r);
4324
+ const y = toLegacyMessage(r);
4325
+ y ? _.set(data.value, "campaign.message", y) : delete data.value.campaign.message;
4326
+ return;
4327
+ }
4328
+ if (_.set(data.value, e, r), e == "campaign.event.type") {
4329
+ const f = ((p = (d = (m = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : m.campaign) == null ? void 0 : d.event) == null ? void 0 : p.rule) ? _.cloneDeep({
4330
+ ...(u = (a = (n = (l = template.value) == null ? void 0 : l.defaultValue) == null ? void 0 : n.campaign) == null ? void 0 : a.event) == null ? void 0 : u.rule
4331
+ }) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
4332
+ RuleBuilder.scaffoldGroup("g_schedule"),
4333
+ RuleBuilder.scaffoldGroup("g_time"),
4334
+ RuleBuilder.scaffoldGroup("g_user"),
4335
+ RuleBuilder.scaffoldGroup("g_bill")
4336
+ ]), s = RuleBuilder.setRuleToGroup(
4337
+ RuleBuilder.scaffoldGroup("g_schedule"),
4338
+ [
4339
+ RuleBuilder.constructEntry(
4340
+ "trigger.date",
4341
+ "_rrule",
4342
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
4343
+ ),
4344
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
4345
+ ],
4346
+ "&&"
4347
+ );
4348
+ if (r != "SCHEDULE") {
4349
+ _.set(data.value, "campaign.event.rule", f);
4350
+ return;
4351
+ }
4352
+ _.set(
4353
+ data.value,
4354
+ "campaign.event.rule",
4355
+ RuleBuilder.setRuleToGroup(f, s)
4356
+ );
4357
+ }
4358
+ e == "campaign.notify" && r == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
4359
+ }
4360
+ async function onUpdateFile(e, r) {
4361
+ return e ? await minor(async () => firebaseStorage.update(r, e), {
4362
+ message: `${e ? "Uploading" : "Removing"} file`,
4363
+ successMessage: `File ${e ? "uploaded" : "removed"} successfully`
4364
+ }) : "";
4365
+ }
4366
+ function isDisable(e) {
4367
+ var r, o;
4368
+ switch (e == null ? void 0 : e.property) {
4369
+ case "campaign.event.type":
4370
+ return ((o = (r = data.value) == null ? void 0 : r.campaign) == null ? void 0 : o._id) || !1;
4371
+ default:
4372
+ return !1;
4373
+ }
4374
+ }
4375
+ async function onSubmit() {
4376
+ if (submitAttempted.value = !0, pushBlocked.value) return;
4377
+ const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
4378
+ if (!e.success)
4379
+ return;
4380
+ const r = await emits(
4381
+ "submit:model-value",
4382
+ cleanPF(JSON.parse(JSON.stringify(e.data)))
4383
+ );
4384
+ (r || r === void 0) && (sheetVisible.value = !1);
4385
+ }
4386
+ return (e, r) => {
4387
+ const o = resolveComponent("FmButton"), m = resolveComponent("FmStep"), d = resolveComponent("FmStepper"), p = resolveComponent("FmCard"), l = resolveComponent("FmTopSheet");
4388
+ return openBlock(), createBlock(l, {
4389
+ "fullscreen-size": "lg",
4390
+ modelValue: unref(sheetVisible),
4391
+ "onUpdate:modelValue": [
4392
+ r[7] || (r[7] = (n) => isRef(sheetVisible) ? sheetVisible.value = n : null),
4393
+ r[8] || (r[8] = (n) => sheetVisible.value = n)
4394
+ ]
4395
+ }, createSlots({
4396
+ "top-sheet-header": withCtx(() => [
4397
+ createElementVNode("div", _hoisted_1, [
4398
+ createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
4399
+ createElementVNode("div", _hoisted_2, [
4400
+ createVNode(o, {
4401
+ onClick: r[0] || (r[0] = (n) => hideSheet()),
4402
+ label: unref(t)("connect.campaign.common.cancel"),
4403
+ variant: "tertiary"
4404
+ }, null, 8, ["label"]),
4405
+ createVNode(o, {
4406
+ onClick: onSubmit,
4407
+ label: unref(t)("connect.campaign.common.save"),
4408
+ disabled: !unref(validateOnSubmit) && unref(errors).length > 0
4409
+ }, null, 8, ["label", "disabled"])
4410
+ ])
4411
+ ])
4412
+ ]),
4413
+ _: 2
4414
+ }, [
4415
+ unref(isLoading) ? {
4416
+ name: "default",
4417
+ fn: withCtx(() => [
4418
+ createElementVNode("div", _hoisted_9, [
4419
+ createElementVNode("div", _hoisted_10, [
4420
+ createElementVNode("div", _hoisted_11, [
4421
+ r[9] || (r[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
4422
+ createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
4423
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
4424
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
4425
+ createElementVNode("div", { class: "space-y-3" }, [
4426
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
4427
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
4428
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
4429
+ ]),
4430
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
4431
+ ]),
4432
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
4433
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
4434
+ createElementVNode("div", { class: "space-y-3" }, [
4435
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
4436
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
4437
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
4438
+ ]),
4439
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
4440
+ ])
4441
+ ])
4442
+ ], -1)),
4443
+ createVNode(p, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
4444
+ ])
4445
+ ])
4446
+ ])
4447
+ ]),
4448
+ key: "1"
4449
+ } : {
4450
+ name: "default",
4451
+ fn: withCtx(() => [
4452
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
4453
+ createVNode(d, {
4454
+ modelValue: unref(currentStep),
4455
+ "onUpdate:modelValue": r[1] || (r[1] = (n) => isRef(currentStep) ? currentStep.value = n : null),
4456
+ orientation: "horizontal",
4457
+ class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
4458
+ }, {
4459
+ default: withCtx(() => [
4460
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, a) => (openBlock(), createBlock(m, {
4461
+ key: n.name,
4462
+ title: unref(getLocaleText)(n.name_locale, n.name),
4463
+ value: a + 1,
4464
+ error: () => hasVisibleStepErrors(a),
4465
+ complete: () => a + 1 <= unref(currentStep)
4466
+ }, null, 8, ["title", "value", "error", "complete"]))), 128))
4467
+ ]),
4468
+ _: 1
4469
+ }, 8, ["modelValue"]),
4470
+ createElementVNode("div", _hoisted_4, [
4471
+ createVNode(o, {
4472
+ icon: "close",
4473
+ variant: "tertiary",
4474
+ onClick: r[2] || (r[2] = (n) => sheetVisible.value = !1)
4475
+ }),
4476
+ createVNode(d, {
4477
+ modelValue: unref(currentStep),
4478
+ "onUpdate:modelValue": r[3] || (r[3] = (n) => isRef(currentStep) ? currentStep.value = n : null),
4479
+ orientation: "horizontal",
4480
+ class: "flex-1"
4481
+ }, {
4482
+ default: withCtx(() => [
4483
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (n, a) => (openBlock(), createBlock(m, {
4484
+ key: n.name,
4485
+ title: unref(sheetTitle),
4486
+ description: unref(getLocaleText)(n.name_locale, n.name),
4487
+ value: a + 1,
4488
+ error: () => hasVisibleStepErrors(a),
4489
+ complete: () => a + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
4490
+ }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
4491
+ ]),
4492
+ _: 1
4493
+ }, 8, ["modelValue"]),
4494
+ createVNode(o, {
4495
+ icon: "info",
4496
+ variant: "tertiary",
4497
+ onClick: r[4] || (r[4] = () => showSummaryDialog())
4498
+ })
4499
+ ]),
4500
+ createElementVNode("div", _hoisted_5, [
4501
+ createElementVNode("div", _hoisted_6, [
4502
+ createVNode(JsonViewer, {
4503
+ json: {
4504
+ data: unref(data),
4505
+ errors: unref(errors).map(
4506
+ (n) => `${n.path.join(".")} - ${n.message}`
4507
+ ),
4508
+ stepErrors: stepErrors().map(
4509
+ (n) => `${n.path.join(".")} - ${n.message}`
4510
+ ),
4511
+ schema: unref(schema)
4512
+ }
4513
+ }, null, 8, ["json"]),
4514
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
4515
+ (n) => n.fields.length && (!n.condition || (Array.isArray(n.condition) ? n.condition.every((a) => unref(_).get(unref(data), a.property) == a.value == (a.not != !0)) : unref(_).get(unref(data), n.condition.property) == n.condition.value == (n.condition.not != !0)))
4516
+ ), (n, a) => (openBlock(), createElementBlock("div", {
4517
+ key: a,
4518
+ class: "space-y-24"
4519
+ }, [
4520
+ createElementVNode("div", _hoisted_7, toDisplayString(unref(getLocaleText)(n.name_locale, n.name ?? "")), 1),
4521
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(n.fields, (u, y) => (openBlock(), createElementBlock("div", { key: y }, [
4522
+ (openBlock(), createBlock(_sfc_main$3, {
4523
+ key: y,
4524
+ field: u,
4525
+ modelValue: valueForField(u.property),
4526
+ disabled: isDisable(u),
4527
+ "campaign-type": unref(campaignType),
4528
+ "show-validation": unref(showValidation),
4529
+ "push-availability": unref(pushAvailability),
4530
+ onRetryPush: checkPushAvailability,
4531
+ "onUpdate:modelValue": (f) => onUpdateProperty(u.property, f),
4532
+ "onUpdate:file": async (f, s) => {
4533
+ const k = await onUpdateFile(f, s);
4534
+ onUpdateProperty(u.property, k || "");
4535
+ },
4536
+ schema: unref(ZodHelper).typeAtPath(
4537
+ unref(schema),
4538
+ schemaPathForField(u.property),
4539
+ unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
4540
+ ),
4541
+ "helper-state": unref(ZodHelper).helperState(
4542
+ unref(visibleErrors),
4543
+ schemaPathForField(u.property)
4544
+ ),
4545
+ "helper-text": unref(ZodHelper).helperText(
4546
+ unref(visibleErrors),
4547
+ schemaPathForField(u.property)
4548
+ ),
4549
+ extras: u.extras != null ? u.extras == "" ? unref(data) : unref(_).get(unref(data), u.extras) : void 0
4550
+ }, null, 8, ["field", "modelValue", "disabled", "campaign-type", "show-validation", "push-availability", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
4551
+ ]))), 128))
4552
+ ]))), 128)),
4553
+ createElementVNode("div", _hoisted_8, [
4554
+ createVNode(o, {
4555
+ label: unref(t)("connect.common.back"),
4556
+ variant: "tertiary",
4557
+ disabled: unref(currentStep) == 1,
4558
+ onClick: r[5] || (r[5] = (n) => currentStep.value--)
4559
+ }, null, 8, ["label", "disabled"]),
4560
+ createVNode(o, {
4561
+ disabled: isNextDisabled(),
4562
+ label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? unref(t)("connect.common.next") : unref(t)("connect.common.submit"),
4563
+ onClick: r[6] || (r[6] = (n) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? onNext() : onSubmit())
4564
+ }, null, 8, ["disabled", "label"])
4565
+ ])
4566
+ ]),
4567
+ createVNode(_sfc_main$1, {
4568
+ data: unref(data),
4569
+ class: "xs:hidden"
4570
+ }, null, 8, ["data"])
4571
+ ])
4572
+ ])) : createCommentVNode("", !0)
4573
+ ]),
4574
+ key: "0"
4575
+ }
4576
+ ]), 1032, ["modelValue"]);
4577
+ };
4578
+ }
4579
+ });
4580
+ export {
4581
+ _sfc_main as _,
4582
+ summarizeGrabDiscount as s,
4583
+ useLocaleText as u
4584
+ };