@feedmepos/mf-connect 0.1.98-beta.7 → 0.1.98-beta.71

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