@feedmepos/mf-connect 0.1.0-beta.8 → 0.1.0-beta.81

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 (127) hide show
  1. package/dist/Analytic-C9JWdPcg.js +761 -0
  2. package/dist/{App-SRz4257n.js → App-BVEfQEjU.js} +441 -420
  3. package/dist/AuditLogs-qbqxB_Oz.js +1887 -0
  4. package/dist/Bin-DPfStHeL.js +166 -0
  5. package/dist/{Broadcast-DmkrJGp2.js → Broadcast-CrQZDeiZ.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CZXSxA9u.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Fpcw9NWs.js} +14 -10
  7. package/dist/Card-d7rnO53X.js +905 -0
  8. package/dist/Collections-5rEy2lvX.js +464 -0
  9. package/dist/{Credit-CcNrq9qk.js → Credit-CHyEsV7R.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CLqubY_R.js +2182 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BIZDiLns.js → EffectSheet.vue_vue_type_style_index_0_lang-DEmIYpS6.js} +49 -49
  14. package/dist/{Experience-DNsQLzDH.js → Experience-DhDLyUFN.js} +32 -30
  15. package/dist/FileSaver.min-NlMItPOc.js +74 -0
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  17. package/dist/Game-CoOZBnN-.js +278 -0
  18. package/dist/Index-BxzvptzX.js +259 -0
  19. package/dist/Marketing-CwxJ5Upf.js +20071 -0
  20. package/dist/Member-D1SRjLZd.js +287 -0
  21. package/dist/MemberList-C-8mcfuk.js +1606 -0
  22. package/dist/MemberTransactions-C7uwJdn8.js +45 -0
  23. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-GCEQCVOt.js → MessageInput.vue_vue_type_script_setup_true_lang-ChQ3zuj7.js} +152 -137
  24. package/dist/Mission-CtF_zohU.js +296 -0
  25. package/dist/Overview-g9HqRUmv.js +1079 -0
  26. package/dist/{Point-Ck8EG_3k.js → Point-BrifiJTO.js} +55 -53
  27. package/dist/Promotion-D-VpO9Y1.js +289 -0
  28. package/dist/Queue-V6tLLO52.js +260 -0
  29. package/dist/Record-C_eSy9Pl.js +341 -0
  30. package/dist/Reward-BcS5W2o6.js +442 -0
  31. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B_g46hrr.js +150 -0
  32. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CFvxrx8L.js +1728 -0
  33. package/dist/Segment-B7JtvneQ.js +880 -0
  34. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BX-E0sDn.js +181 -0
  35. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DPByAnL2.js +188 -0
  36. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-DE7ROhd5.js +147 -0
  37. package/dist/Setting-1KOQwRHn.js +1932 -0
  38. package/dist/Store-Dj84K8ZK.js +1842 -0
  39. package/dist/StoreRewards-7rXn3J0B.js +423 -0
  40. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-D7zdyg9d.js +1029 -0
  41. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DrzmjYmU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D6T7vFXj.js} +1 -1
  42. package/dist/{Tier-CJ9-d8Zg.js → Tier-CwS_A8F5.js} +350 -334
  43. package/dist/{Title-DZCpvg4q.js → Title-YAj_vykl.js} +245 -222
  44. package/dist/{Transaction-DpnTxlbf.js → Transaction-CvbHHpIT.js} +2 -2
  45. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-CYXM679D.js +130 -0
  46. package/dist/Voucher-C0V9koK8.js +354 -0
  47. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DwfF_8uQ.js +419 -0
  48. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-SukfoJpU.js → ZodTextField.vue_vue_type_script_setup_true_lang-D3mmtmvI.js} +1 -1
  49. package/dist/{app-DzAexOqx.js → app-D5BiHqr1.js} +2712 -1266
  50. package/dist/app-TANcLG-R.js +33357 -0
  51. package/dist/app.js +1 -1
  52. package/dist/business-DxNWLRXa.js +79 -0
  53. package/dist/{campaign-winsqufa.js → campaign-DhEbMRyc.js} +2 -2
  54. package/dist/campaign-DqFW5qoE.js +1810 -0
  55. package/dist/campaign.enum-DGpeHkL2.js +20 -0
  56. package/dist/campaign.fn-BqP9eKCL.js +758 -0
  57. package/dist/collectible.enum-CSFqER3H.js +19 -0
  58. package/dist/{collection.fn-CI5Llblg.js → collection.fn-CA112Q3U.js} +2 -2
  59. package/dist/dto-UeacqOxr.js +214 -0
  60. package/dist/{effect-CdkrIYgX.js → effect-CEB8v8KY.js} +33 -16
  61. package/dist/email-addresses-DLDeL77c.js +705 -0
  62. package/dist/{export-DGxfief1.js → export-B_8_zEGl.js} +5 -5
  63. package/dist/{helper-B8RqcTNu.js → helper-BN4JZQLv.js} +1 -1
  64. package/dist/index-B-O8sm9u.js +54 -0
  65. package/dist/index-B-WW-LtM.js +56 -0
  66. package/dist/index-BOQonmqm.js +32 -0
  67. package/dist/{index-9w43_U1v.js → index-CboHpXNN.js} +1506 -1480
  68. package/dist/{index-A34xEz20.js → index-CjJOf_Ko.js} +2246 -871
  69. package/dist/index-CsU66Lo8.js +115 -0
  70. package/dist/index-CsaQJMAR.js +66 -0
  71. package/dist/index-Csb4GQq-.js +29556 -0
  72. package/dist/{index-wzdbEEcZ.js → index-Cv54KpqR.js} +1 -1
  73. package/dist/{index-Cw_aXFH6.js → index-D-9zLobO.js} +269 -173
  74. package/dist/{index-HZC9LLAX.js → index-DLEuoM6n.js} +48 -4
  75. package/dist/{index-CZgQVRsm.js → index-DX1pCi2M.js} +1 -1
  76. package/dist/{index-OzicErwL.js → index-Dtvx0B0f.js} +24 -21
  77. package/dist/index-vh86FiIQ.js +10 -0
  78. package/dist/{loading-DuEFUCwF.js → index-wwxalEHE.js} +4609 -4886
  79. package/dist/{index.esm2017-CppSMh_U.js → index.esm2017-B8lg2TL9.js} +206 -206
  80. package/dist/loading-C7yV_Gjh.js +71 -0
  81. package/dist/{membership-nsMtWeTC.js → membership-DVqBNqdx.js} +80 -66
  82. package/dist/money-DlG5z_tl.js +15 -0
  83. package/dist/number-CEbwCzov.js +12 -0
  84. package/dist/objectid-Du3yg6Vv.js +145 -0
  85. package/dist/plugins-D_RKZlC6.js +208 -0
  86. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  87. package/dist/reward-Bv14VitO.js +36 -0
  88. package/dist/{rule-CPIMqt1h.js → rule-BR5ZUIKH.js} +185 -178
  89. package/dist/{rule-builder-CSs5XRKP.js → rule-builder-CITle0qo.js} +1 -1
  90. package/dist/style.css +1 -1
  91. package/dist/{template-CJZoYavu.js → template-ybPO7TWN.js} +5 -5
  92. package/dist/trigger-5C6n0ORq.js +144 -0
  93. package/dist/user-CP3tloTS.js +54 -0
  94. package/dist/vue-i18n-DGew8_SZ.js +2365 -0
  95. package/dist/{xlsx-BZlnYinX.js → xlsx-CsBnmxHp.js} +1 -1
  96. package/package.json +11 -7
  97. package/dist/Analytic-5QztrYSp.js +0 -622
  98. package/dist/Card-BsjFTVsH.js +0 -825
  99. package/dist/Collections-7wqZHOax.js +0 -453
  100. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Cuklmxur.js +0 -2813
  101. package/dist/Game-DlzDerT7.js +0 -255
  102. package/dist/Marketing-BqhpaG4o.js +0 -316
  103. package/dist/Member-AFgZcdtz.js +0 -69
  104. package/dist/MemberList-BKgrLz2C.js +0 -1733
  105. package/dist/MemberTransactions-BwT3zE2a.js +0 -38
  106. package/dist/Mission-BTAia7AS.js +0 -261
  107. package/dist/Promotion-0v3kvsK3.js +0 -247
  108. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BkFm7tXq.js +0 -1753
  109. package/dist/Segment-BenLupqV.js +0 -437
  110. package/dist/Setting-0fpREqpJ.js +0 -1901
  111. package/dist/Store-BDGwe4ar.js +0 -1511
  112. package/dist/StoreRewards-TDZt9H1V.js +0 -401
  113. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BqpsMcl1.js +0 -890
  114. package/dist/Voucher-DsP_rh8I.js +0 -490
  115. package/dist/app-Cg2pTZJK.js +0 -53428
  116. package/dist/business-Cw_qGw8y.js +0 -78
  117. package/dist/dto-ozu1smC3.js +0 -2770
  118. package/dist/index-BLACZ3-L.js +0 -206
  119. package/dist/index-BaozRfWB.js +0 -762
  120. package/dist/index-CjVmULNd.js +0 -99
  121. package/dist/index-CuvNtC_M.js +0 -61
  122. package/dist/index-DAEmawcj.js +0 -298
  123. package/dist/index-Oxr-mU6h.js +0 -29193
  124. package/dist/money-BGZPFtUc.js +0 -15
  125. package/dist/number-4J0xvXP9.js +0 -12
  126. package/dist/user-Bm4KttFq.js +0 -37
  127. package/dist/vue-i18n-CCyiVzOE.js +0 -2365
@@ -0,0 +1,2182 @@
1
+ import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, createVNode, unref, isRef, withCtx, createBlock, createCommentVNode, computed, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, toRefs, normalizeStyle, resolveDynamicComponent, createSlots } from "vue";
2
+ import { _ } from "./lodash-B5I3zXaY.js";
3
+ import { z } from "./app-D5BiHqr1.js";
4
+ import { Z as ZodHelper } from "./zod-Bg2FbC-D.js";
5
+ import { c as getCampaignSummaryObject, C as CampaignOptions } from "./campaign-DqFW5qoE.js";
6
+ import { c as campaignRefinement, C as CampaignDtos, a as campaignTransform } from "./dto-UeacqOxr.js";
7
+ import { u as useMembershipStore } from "./membership-DVqBNqdx.js";
8
+ import { u as useBusinessStore } from "./business-DxNWLRXa.js";
9
+ import "./index-CboHpXNN.js";
10
+ import { R as RuleBuilder, a as isRuleEntry } from "./rule-builder-CITle0qo.js";
11
+ import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
12
+ import { h as hooks } from "./moment-BWErdI6_.js";
13
+ import { f as featureVersionMapping } from "./campaign.enum-DGpeHkL2.js";
14
+ import { _ as _sfc_main$o } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
15
+ import { b as _sfc_main$m, a as _sfc_main$p, _ as _sfc_main$r } from "./EffectSheet.vue_vue_type_style_index_0_lang-DEmIYpS6.js";
16
+ import { _ as _sfc_main$q } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-D6T7vFXj.js";
17
+ import { _ as _sfc_main$t } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-CYXM679D.js";
18
+ import { _ as _sfc_main$j, a as _sfc_main$k } from "./RuleGroup.vue_vue_type_script_setup_true_lang-CFvxrx8L.js";
19
+ import { p as prompt, c as cases, f as firebaseStorage } from "./plugins-D_RKZlC6.js";
20
+ import { u as useI18n } from "./vue-i18n-DGew8_SZ.js";
21
+ import { b as TypeToTriggerOptions, _ as _sfc_main$u, a as _sfc_main$v } from "./trigger-5C6n0ORq.js";
22
+ import { _ as _sfc_main$s } from "./MessageInput.vue_vue_type_script_setup_true_lang-ChQ3zuj7.js";
23
+ import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-BR5ZUIKH.js";
24
+ import { _ as _sfc_main$l, a as _sfc_main$n } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-DwfF_8uQ.js";
25
+ import { T as TEMPLATES } from "./index-D-9zLobO.js";
26
+ import { t as FdoCreditLoyaltyReward, u as FdtoRandomReward, v as F_MISSION_TYPE, w as FdoThresholdCreditReward, x as FdtoThresholdReward, y as FdoMission } from "./index-CjJOf_Ko.js";
27
+ import "./index-Cv54KpqR.js";
28
+ import "./index-B-O8sm9u.js";
29
+ import { a as F_GAME_TYPE } from "./collectible.enum-CSFqER3H.js";
30
+ import { useCoreStore } from "@feedmepos/mf-common";
31
+ import { u as useLoading } from "./loading-C7yV_Gjh.js";
32
+ import { i as initCollectibleConfig } from "./helper-BN4JZQLv.js";
33
+ import { C as CollectionUtils } from "./collection.fn-CA112Q3U.js";
34
+ import { s as sentenceCase$1 } from "./index-CsaQJMAR.js";
35
+ import "./index-wwxalEHE.js";
36
+ import { useDialog } from "@feedmepos/ui-library";
37
+ import { u as useCampaignStore } from "./campaign-DhEbMRyc.js";
38
+ import { S as SvcConfig } from "./index-Csb4GQq-.js";
39
+ import { a as cleanPF } from "./object-qECH92oz.js";
40
+ const _hoisted_1$g = { class: "space-y-24" }, _sfc_main$i = /* @__PURE__ */ defineComponent({
41
+ __name: "TimeRuleGroup",
42
+ props: {
43
+ modelValue: {
44
+ type: Object,
45
+ default: () => {
46
+ }
47
+ }
48
+ },
49
+ emits: ["update:model-value"],
50
+ setup(e, { emit: d }) {
51
+ const { t: a } = useI18n(), s = e, u = d, i = ref(
52
+ !s.modelValue || !s.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(s.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
53
+ );
54
+ watch(i, async (l, n) => {
55
+ var m;
56
+ if (n == "custom" && l == "all_time" && RuleBuilder.getRules((m = s.modelValue) == null ? void 0 : m.rules.g_time).length > 0) {
57
+ const g = await prompt.confirm(
58
+ a("connect.template.rule.time.confirm_remove"),
59
+ a("connect.common.confirm"),
60
+ a("connect.common.confirm"),
61
+ a("connect.common.cancel")
62
+ );
63
+ g && u(
64
+ "update:model-value",
65
+ RuleBuilder.setRuleToGroup(
66
+ s.modelValue ?? RuleBuilder.scaffoldGroup(),
67
+ RuleBuilder.scaffoldGroup("g_time")
68
+ )
69
+ ), i.value = g ? l : n;
70
+ }
71
+ });
72
+ async function o(l) {
73
+ var n;
74
+ if (l == "custom" && RuleBuilder.getRules((n = s.modelValue) == null ? void 0 : n.rules.g_time).length > 0) {
75
+ if (!await prompt.confirm(
76
+ a("connect.template.rule.time.confirm_remove"),
77
+ a("connect.common.confirm"),
78
+ a("connect.common.confirm"),
79
+ a("connect.common.cancel")
80
+ )) {
81
+ i.value = "all_time";
82
+ return;
83
+ }
84
+ u(
85
+ "update:model-value",
86
+ RuleBuilder.setRuleToGroup(
87
+ s.modelValue ?? RuleBuilder.scaffoldGroup(),
88
+ RuleBuilder.scaffoldGroup("g_time")
89
+ )
90
+ );
91
+ }
92
+ }
93
+ return (l, n) => {
94
+ var y;
95
+ const m = resolveComponent("FmRadio"), g = resolveComponent("FmRadioGroup");
96
+ return openBlock(), createElementBlock("div", _hoisted_1$g, [
97
+ createVNode(g, {
98
+ modelValue: unref(i),
99
+ "onUpdate:modelValue": [
100
+ n[0] || (n[0] = (v) => isRef(i) ? i.value = v : null),
101
+ n[1] || (n[1] = (v) => o(v))
102
+ ]
103
+ }, {
104
+ default: withCtx(() => [
105
+ createVNode(m, {
106
+ label: unref(a)("connect.template.rule.time.all_time"),
107
+ value: "all_time"
108
+ }, null, 8, ["label"]),
109
+ createVNode(m, {
110
+ label: unref(a)("connect.template.rule.time.custom"),
111
+ value: "custom"
112
+ }, null, 8, ["label"])
113
+ ]),
114
+ _: 1
115
+ }, 8, ["modelValue"]),
116
+ unref(i) == "custom" ? (openBlock(), createBlock(_sfc_main$j, {
117
+ key: 0,
118
+ class: "!mt-[0px]",
119
+ "include-only": "trigger",
120
+ "trigger-type": "SCHEDULE",
121
+ "model-value": ((y = e.modelValue) == null ? void 0 : y.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
122
+ "onUpdate:modelValue": n[2] || (n[2] = (v) => u(
123
+ "update:model-value",
124
+ unref(RuleBuilder).setRuleToGroup(
125
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
126
+ v,
127
+ "&&"
128
+ )
129
+ ))
130
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0)
131
+ ]);
132
+ };
133
+ }
134
+ }), _sfc_main$h = /* @__PURE__ */ defineComponent({
135
+ __name: "BirthdayInput",
136
+ props: {
137
+ modelValue: {
138
+ type: Object
139
+ }
140
+ },
141
+ emits: ["update:model-value"],
142
+ setup(e, { emit: d }) {
143
+ const a = e, s = d, u = computed(() => {
144
+ const { property: i, operator: o, equator: l } = RuleBuilder.simplify(
145
+ a.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
146
+ op: "before",
147
+ x: 1
148
+ })
149
+ );
150
+ return {
151
+ property: i,
152
+ operator: o,
153
+ equator: l
154
+ };
155
+ });
156
+ return (i, o) => {
157
+ const l = resolveComponent("FmRadio"), n = resolveComponent("FmStepperField");
158
+ return openBlock(), createElementBlock("div", null, [
159
+ createVNode(l, {
160
+ label: "On birthday",
161
+ value: "_isRange-day",
162
+ "model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
163
+ "onUpdate:modelValue": o[0] || (o[0] = () => {
164
+ s(
165
+ "update:model-value",
166
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
167
+ op: "this",
168
+ unit: "day",
169
+ ignoreYear: !0
170
+ })
171
+ );
172
+ })
173
+ }, null, 8, ["model-value"]),
174
+ createVNode(l, {
175
+ label: "N days before birthday",
176
+ value: "_isDay",
177
+ "model-value": unref(u).operator,
178
+ "onUpdate:modelValue": o[1] || (o[1] = () => {
179
+ s(
180
+ "update:model-value",
181
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
182
+ op: "after",
183
+ x: 1,
184
+ ignoreYear: !0
185
+ })
186
+ );
187
+ })
188
+ }, null, 8, ["model-value"]),
189
+ unref(u).operator == "_isDay" ? (openBlock(), createBlock(n, {
190
+ key: 0,
191
+ label: "Days before birthday",
192
+ "show-steppers": !1,
193
+ "model-value": unref(u).equator.x,
194
+ "onUpdate:modelValue": o[2] || (o[2] = (m) => s(
195
+ "update:model-value",
196
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
197
+ op: "after",
198
+ x: m,
199
+ ignoreYear: !0
200
+ })
201
+ ))
202
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0),
203
+ createVNode(l, {
204
+ label: "In birthday week",
205
+ value: "_isRange-week",
206
+ "model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
207
+ "onUpdate:modelValue": o[3] || (o[3] = () => {
208
+ s(
209
+ "update:model-value",
210
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
211
+ op: "this",
212
+ unit: "week",
213
+ ignoreYear: !0
214
+ })
215
+ );
216
+ })
217
+ }, null, 8, ["model-value"]),
218
+ createVNode(l, {
219
+ label: "In birthday month",
220
+ value: "_isRange-month",
221
+ "model-value": `${unref(u).operator}-${unref(u).equator.unit}`,
222
+ "onUpdate:modelValue": o[4] || (o[4] = () => {
223
+ s(
224
+ "update:model-value",
225
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
226
+ op: "this",
227
+ unit: "month",
228
+ ignoreYear: !0
229
+ })
230
+ );
231
+ })
232
+ }, null, 8, ["model-value"])
233
+ ]);
234
+ };
235
+ }
236
+ }), _hoisted_1$f = { class: "space-y-16" }, _hoisted_2$c = { class: "grid grid-cols-3 gap-16" }, _hoisted_3$a = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
237
+ __name: "CampaignTriggerInput",
238
+ props: {
239
+ campaignType: {
240
+ type: String,
241
+ required: !0
242
+ },
243
+ modelValue: {
244
+ type: String
245
+ },
246
+ disabled: {
247
+ type: Boolean,
248
+ default: !1
249
+ }
250
+ },
251
+ emits: ["update:model-value"],
252
+ setup(e, { emit: d }) {
253
+ const a = e, s = d, u = computed(() => a.disabled ? TypeToTriggerOptions[a.campaignType].filter(
254
+ (i) => i.value == a.modelValue
255
+ ) : TypeToTriggerOptions[a.campaignType]);
256
+ return (i, o) => {
257
+ const l = resolveComponent("FmCard");
258
+ return openBlock(), createElementBlock("div", _hoisted_1$f, [
259
+ o[0] || (o[0] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Define the conditions that must be met to activate a reward. ", -1)),
260
+ createElementVNode("div", _hoisted_2$c, [
261
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
262
+ variant: "outlined",
263
+ disabled: a.disabled,
264
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
265
+ "col-span-3": unref(u).length == 1,
266
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
267
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
268
+ }]),
269
+ onClick: () => {
270
+ a.modelValue != n.value && !a.disabled && s("update:model-value", n.value);
271
+ },
272
+ key: n.name
273
+ }, {
274
+ default: withCtx(() => [
275
+ createElementVNode("div", _hoisted_3$a, toDisplayString(n.name), 1),
276
+ createElementVNode("div", _hoisted_4$7, toDisplayString(n.description), 1)
277
+ ]),
278
+ _: 2
279
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
280
+ ])
281
+ ]);
282
+ };
283
+ }
284
+ }), _sfc_main$f = /* @__PURE__ */ defineComponent({
285
+ __name: "DateInput",
286
+ props: {
287
+ label: {
288
+ type: String,
289
+ required: !1
290
+ },
291
+ modelValue: {
292
+ type: Object,
293
+ required: !1
294
+ }
295
+ },
296
+ emits: ["update:model-value"],
297
+ setup(e, { emit: d }) {
298
+ const a = d;
299
+ return (s, u) => {
300
+ const i = resolveComponent("FmButton"), o = resolveComponent("FmField"), l = resolveComponent("FmDatePicker");
301
+ return openBlock(), createBlock(l, {
302
+ label: e.label,
303
+ "model-value": e.modelValue || "",
304
+ "onUpdate:modelValue": u[1] || (u[1] = (n) => a("update:model-value", n))
305
+ }, {
306
+ "trigger-button": withCtx(({ opened: n }) => [
307
+ createVNode(o, {
308
+ class: "flex items-center",
309
+ "prepend-icon": "calendar_month",
310
+ "icon-outlined": !n
311
+ }, {
312
+ append: withCtx(() => [
313
+ e.modelValue ? (openBlock(), createBlock(i, {
314
+ key: 0,
315
+ variant: "tertiary",
316
+ icon: "clear",
317
+ onClick: u[0] || (u[0] = (m) => (m.stopPropagation(), a("update:model-value", null)))
318
+ })) : createCommentVNode("", !0)
319
+ ]),
320
+ default: withCtx(() => [
321
+ createElementVNode("div", {
322
+ class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
323
+ }, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
324
+ ]),
325
+ _: 2
326
+ }, 1032, ["icon-outlined"])
327
+ ]),
328
+ _: 1
329
+ }, 8, ["label", "model-value"]);
330
+ };
331
+ }
332
+ }), _hoisted_1$e = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$b = { class: "flex-1 xs:w-full" }, _hoisted_3$9 = { class: "flex-1 xs:w-full" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
333
+ __name: "DateRangeInput",
334
+ props: {
335
+ modelValue: {
336
+ type: Object,
337
+ required: !1
338
+ }
339
+ },
340
+ emits: ["update:model-value"],
341
+ setup(e, { emit: d }) {
342
+ const a = d;
343
+ return (s, u) => {
344
+ var i, o;
345
+ return openBlock(), createElementBlock("div", _hoisted_1$e, [
346
+ createElementVNode("div", _hoisted_2$b, [
347
+ createVNode(_sfc_main$f, {
348
+ "model-value": ((i = e.modelValue) == null ? void 0 : i.startDate) ?? null,
349
+ label: "Start date",
350
+ "onUpdate:modelValue": u[0] || (u[0] = (l) => {
351
+ var n;
352
+ return a("update:model-value", {
353
+ startDate: l,
354
+ endDate: ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null
355
+ });
356
+ })
357
+ }, null, 8, ["model-value"])
358
+ ]),
359
+ u[2] || (u[2] = createElementVNode("div", { class: "mt-5 xs:hidden" }, "to", -1)),
360
+ createElementVNode("div", _hoisted_3$9, [
361
+ createVNode(_sfc_main$f, {
362
+ "model-value": ((o = e.modelValue) == null ? void 0 : o.endDate) ?? null,
363
+ label: "End date",
364
+ "onUpdate:modelValue": u[1] || (u[1] = (l) => {
365
+ var n;
366
+ return a("update:model-value", {
367
+ startDate: ((n = e.modelValue) == null ? void 0 : n.startDate) ?? null,
368
+ endDate: l
369
+ });
370
+ })
371
+ }, null, 8, ["model-value"])
372
+ ])
373
+ ]);
374
+ };
375
+ }
376
+ }), _hoisted_1$d = { class: "space-y-8" }, _hoisted_2$a = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$8 = {
377
+ key: 0,
378
+ class: "space-y-4"
379
+ }, _hoisted_4$6 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$3 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$d = /* @__PURE__ */ defineComponent({
380
+ __name: "ScheduleRuleInput",
381
+ props: {
382
+ modelValue: {
383
+ type: Object,
384
+ required: !0
385
+ },
386
+ startDate: {
387
+ type: String
388
+ },
389
+ endDate: {
390
+ type: String
391
+ }
392
+ },
393
+ emits: ["update:model-value"],
394
+ setup(e, { emit: d }) {
395
+ const a = e, s = d;
396
+ function u() {
397
+ const y = RuleBuilder.getRules(a.modelValue);
398
+ return y.length == 0 ? "fixed" : y.some(
399
+ (v) => isRuleEntry(v) && RuleBuilder.simplify(v).operator == "_rrule"
400
+ ) ? "repeating" : "fixed";
401
+ }
402
+ const i = ref(u()), o = ref(!1), l = computed(() => {
403
+ const y = RuleBuilder.getRules(a.modelValue), v = y.find(
404
+ (f) => isRuleEntry(f) && RuleBuilder.simplify(f).property == "trigger.date"
405
+ ), h = y.find(
406
+ (f) => isRuleEntry(f) && RuleBuilder.simplify(f).property == "trigger.time"
407
+ );
408
+ return {
409
+ date: v ? RuleBuilder.simplify(v).equator : null,
410
+ time: h ? RuleBuilder.simplify(h).equator : null
411
+ };
412
+ }), n = computed(
413
+ () => calculateNextScheduleAt(
414
+ a.modelValue,
415
+ /* @__PURE__ */ new Date(),
416
+ a.startDate ? new Date(a.startDate) : void 0,
417
+ a.endDate ? new Date(a.endDate) : void 0
418
+ )
419
+ );
420
+ function m(y) {
421
+ const v = y.label.toLowerCase(), h = v == "fixed" ? [
422
+ RuleBuilder.constructEntry(
423
+ "trigger.date",
424
+ "_isOnDate",
425
+ (/* @__PURE__ */ new Date()).toISOString()
426
+ ),
427
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
428
+ ] : [
429
+ RuleBuilder.constructEntry(
430
+ "trigger.date",
431
+ "_rrule",
432
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
433
+ ),
434
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
435
+ ];
436
+ s(
437
+ "update:model-value",
438
+ RuleBuilder.setRuleToGroup(
439
+ RuleBuilder.scaffoldGroup("g_schedule"),
440
+ h
441
+ )
442
+ ), i.value = v;
443
+ }
444
+ function g(y) {
445
+ i.value == "fixed" ? s(
446
+ "update:model-value",
447
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
448
+ RuleBuilder.constructEntry(
449
+ "trigger.date",
450
+ "_isOnDate",
451
+ y.date
452
+ ),
453
+ RuleBuilder.constructEntry(
454
+ "trigger.time",
455
+ "_isOnTime",
456
+ y.time
457
+ )
458
+ ])
459
+ ) : s(
460
+ "update:model-value",
461
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
462
+ RuleBuilder.constructEntry(
463
+ "trigger.date",
464
+ "_rrule",
465
+ y.date
466
+ ),
467
+ RuleBuilder.constructEntry(
468
+ "trigger.time",
469
+ "_isOnTime",
470
+ y.time
471
+ )
472
+ ])
473
+ );
474
+ }
475
+ return (y, v) => {
476
+ const h = resolveComponent("FmButtonGroup"), f = resolveComponent("FmTimePicker"), r = resolveComponent("FmIcon"), c = resolveComponent("FmTooltip"), p = resolveComponent("FmField"), b = resolveComponent("FmCard"), x = resolveComponent("FmPopover"), k = resolveComponent("FmDatePicker"), C = resolveComponent("FmHelperText");
477
+ return openBlock(), createElementBlock(Fragment, null, [
478
+ createVNode(h, {
479
+ items: [{ label: "Fixed" }, { label: "Repeating" }],
480
+ "model-value": { label: unref(cases).title(unref(i)) },
481
+ "onUpdate:modelValue": m,
482
+ class: "mb-8"
483
+ }, null, 8, ["model-value"]),
484
+ createElementVNode("div", _hoisted_1$d, [
485
+ createElementVNode("div", _hoisted_2$a, [
486
+ createVNode(f, {
487
+ label: "Notify time",
488
+ "model-value": unref(l).time,
489
+ "onUpdate:modelValue": v[0] || (v[0] = (B) => g({ date: unref(l).date, time: B })),
490
+ "helper-text": unref(l).time ? void 0 : "Time is required",
491
+ "helper-state": unref(l).time ? void 0 : "error"
492
+ }, null, 8, ["model-value", "helper-text", "helper-state"]),
493
+ unref(i) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$8, [
494
+ createElementVNode("div", _hoisted_4$6, [
495
+ v[5] || (v[5] = createElementVNode("div", null, "Notify date", -1)),
496
+ unref(l).date ? (openBlock(), createBlock(c, {
497
+ key: 0,
498
+ "z-index": 9999,
499
+ content: unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options)
500
+ }, {
501
+ default: withCtx(() => [
502
+ createVNode(r, {
503
+ name: "info",
504
+ size: "sm",
505
+ outline: !0
506
+ })
507
+ ]),
508
+ _: 1
509
+ }, 8, ["content"])) : createCommentVNode("", !0)
510
+ ]),
511
+ createVNode(x, {
512
+ "show-popover": unref(o),
513
+ onPopoverChanged: v[3] || (v[3] = (B) => o.value = B)
514
+ }, {
515
+ "popover-button": withCtx(() => [
516
+ createVNode(p, {
517
+ class: "cursor-pointer",
518
+ "helper-text": unref(l).date ? void 0 : "Date is required",
519
+ "helper-state": unref(l).date ? void 0 : "error"
520
+ }, {
521
+ default: withCtx(() => [
522
+ createElementVNode("div", _hoisted_5$3, toDisplayString(unref(l).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options) : "Set a repeating date"), 1)
523
+ ]),
524
+ _: 1
525
+ }, 8, ["helper-text", "helper-state"])
526
+ ]),
527
+ default: withCtx(() => [
528
+ createVNode(b, { class: "elevated p-8 w-[450px]" }, {
529
+ default: withCtx(() => [
530
+ createVNode(_sfc_main$k, {
531
+ "apply-button": !0,
532
+ "model-value": unref(l).date || "",
533
+ onCancel: v[1] || (v[1] = (B) => o.value = !1),
534
+ "onUpdate:modelValue": v[2] || (v[2] = (B) => (g({ date: B, time: unref(l).time }), o.value = !1))
535
+ }, null, 8, ["model-value"])
536
+ ]),
537
+ _: 1
538
+ })
539
+ ]),
540
+ _: 1
541
+ }, 8, ["show-popover"])
542
+ ])) : (openBlock(), createBlock(k, {
543
+ key: 1,
544
+ label: "Notify date",
545
+ "model-value": unref(l).date || "",
546
+ "onUpdate:modelValue": v[4] || (v[4] = (B) => g({ date: B, time: unref(l).time })),
547
+ "helper-text": unref(l).date ? void 0 : "Date is required",
548
+ "helper-state": unref(l).date ? void 0 : "error"
549
+ }, null, 8, ["model-value", "helper-text", "helper-state"]))
550
+ ]),
551
+ unref(l).date && unref(l).time && unref(n) ? (openBlock(), createBlock(C, {
552
+ key: 0,
553
+ text: `${unref(hooks)(unref(n)).isAfter(unref(hooks)()) ? "The next notification will be sent on " : "Last trigger is on "} ${unref(hooks)(unref(n)).format("dddd, DD MMM YYYY")} at
554
+ ${unref(hooks)(unref(n)).format("hh:mmA")} (${unref(hooks)(unref(n)).fromNow()})`
555
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
556
+ ])
557
+ ], 64);
558
+ };
559
+ }
560
+ }), _hoisted_1$c = { class: "space-y-16" }, _hoisted_2$9 = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$7 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$5 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
561
+ __name: "GameTypeInput",
562
+ props: {
563
+ modelValue: {
564
+ type: String
565
+ }
566
+ },
567
+ emits: ["update:model-value"],
568
+ setup(e, { emit: d }) {
569
+ const a = e, s = d, u = computed(
570
+ () => [
571
+ {
572
+ label: "Fortune Wheel",
573
+ description: "Allow customers to spin the Fortune Wheel to win various rewards.",
574
+ value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
575
+ hidden: !1
576
+ },
577
+ {
578
+ label: "Rock paper scissor",
579
+ description: "Customers play a game of Rock Paper Scissors against the cashier.",
580
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
581
+ hidden: !0
582
+ }
583
+ ].filter((i) => !i.hidden)
584
+ );
585
+ return (i, o) => {
586
+ const l = resolveComponent("FmCard");
587
+ return openBlock(), createElementBlock("div", _hoisted_1$c, [
588
+ o[0] || (o[0] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Select a game where you want your customer to play. ", -1)),
589
+ createElementVNode("div", _hoisted_2$9, [
590
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
591
+ variant: "outlined",
592
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
593
+ "col-span-2": unref(u).length == 1,
594
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
595
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
596
+ }]),
597
+ onClick: () => {
598
+ a.modelValue != n.value && s("update:model-value", n.value);
599
+ },
600
+ key: n.value
601
+ }, {
602
+ default: withCtx(() => [
603
+ createElementVNode("div", _hoisted_3$7, toDisplayString(n.label), 1),
604
+ createElementVNode("div", _hoisted_4$5, toDisplayString(n.description), 1)
605
+ ]),
606
+ _: 2
607
+ }, 1032, ["class", "onClick"]))), 128))
608
+ ])
609
+ ]);
610
+ };
611
+ }
612
+ }), _hoisted_1$b = {
613
+ key: 0,
614
+ class: "flex flex-col gap-y-24"
615
+ }, _hoisted_2$8 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
616
+ __name: "EditRewardPoolSheet",
617
+ emits: ["update:model-value"],
618
+ setup(e, { expose: d, emit: a }) {
619
+ const s = useMembershipStore(), { minor: u } = useLoading, i = ref(!1), o = ref(), l = ref(), n = ref(0), m = computed(() => {
620
+ var r;
621
+ return ((r = s.loyaltyRewards.items.find(
622
+ (c) => {
623
+ var p;
624
+ return c.value === ((p = o.value) == null ? void 0 : p.collectible);
625
+ }
626
+ )) == null ? void 0 : r.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
627
+ }), g = computed(() => {
628
+ const f = m.value.safeParse(o.value);
629
+ return f.success ? [] : f.error.errors;
630
+ });
631
+ function y(f, r, c) {
632
+ f && (o.value = r, n.value = c), i.value = f;
633
+ }
634
+ const v = a;
635
+ async function h() {
636
+ const f = m.value.safeParse(o.value);
637
+ f.success && (await u(
638
+ async () => {
639
+ f.data.type === "VOUCHER" && l.value && (f.data.collectibleConfig.image = await firebaseStorage.update(
640
+ f.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, l.value),
641
+ l.value
642
+ ));
643
+ },
644
+ {
645
+ message: "Uploading reward image",
646
+ successMessage: "Reward image updated"
647
+ }
648
+ ), v("update:model-value", f.data, n.value));
649
+ }
650
+ return d({
651
+ showSheet: y
652
+ }), (f, r) => {
653
+ const c = resolveComponent("FmSelect"), p = resolveComponent("FmStepperField"), b = resolveComponent("FmButton"), x = resolveComponent("FmSideSheet");
654
+ return openBlock(), createBlock(x, {
655
+ "max-width": 560,
656
+ modelValue: unref(i),
657
+ "onUpdate:modelValue": [
658
+ r[9] || (r[9] = (k) => isRef(i) ? i.value = k : null),
659
+ r[10] || (r[10] = (k) => i.value = k)
660
+ ],
661
+ header: "Edit reward",
662
+ "dismiss-away": ""
663
+ }, {
664
+ "side-sheet-footer": withCtx(() => [
665
+ createElementVNode("div", _hoisted_2$8, [
666
+ createVNode(b, {
667
+ variant: "primary",
668
+ type: "button",
669
+ disabled: unref(g).length > 0,
670
+ label: "Confirm",
671
+ onClick: r[7] || (r[7] = (k) => h())
672
+ }, null, 8, ["disabled"]),
673
+ createVNode(b, {
674
+ variant: "secondary",
675
+ type: "button",
676
+ label: "Cancel",
677
+ onClick: r[8] || (r[8] = (k) => i.value = !1)
678
+ })
679
+ ])
680
+ ]),
681
+ default: withCtx(() => {
682
+ var k, C, B;
683
+ return [
684
+ unref(o) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
685
+ createVNode(c, {
686
+ label: "Reward Type",
687
+ items: [
688
+ { label: "No Reward", value: "NO_REWARD" },
689
+ { label: "Voucher", value: "VOUCHER" },
690
+ { label: "Loyalty", value: "LOYALTY" }
691
+ ],
692
+ "model-value": unref(o).type,
693
+ "onUpdate:modelValue": r[0] || (r[0] = (V) => {
694
+ V == "NO_REWARD" ? o.value = {
695
+ type: "NO_REWARD",
696
+ collectible: null,
697
+ weight: 1
698
+ } : V === "VOUCHER" ? o.value = {
699
+ collectible: null,
700
+ type: "VOUCHER",
701
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
702
+ business: unref(useCoreStore)().currentBusiness.value._id
703
+ }),
704
+ earningOption: {
705
+ amount: 1,
706
+ type: "FIXED"
707
+ },
708
+ validityOption: {
709
+ validForDay: 7
710
+ },
711
+ weight: 1
712
+ } : o.value = {
713
+ collectible: unref(s).loyaltyRewards.raw[0]._id,
714
+ type: "LOYALTY",
715
+ earningOption: {
716
+ amount: 1,
717
+ type: "FIXED"
718
+ },
719
+ validityOption: {
720
+ validForDay: 7
721
+ },
722
+ weight: 1
723
+ };
724
+ })
725
+ }, null, 8, ["model-value"]),
726
+ unref(o).type == "LOYALTY" ? (openBlock(), createBlock(c, {
727
+ key: 0,
728
+ label: "Loyalty type",
729
+ rules: [unref(ZodHelper).ruleAtPath(unref(m), "collectible", [unref(o).type])],
730
+ items: unref(s).loyaltyRewards.items,
731
+ "model-value": unref(o).collectible,
732
+ "onUpdate:modelValue": r[1] || (r[1] = (V) => unref(o).collectible = V)
733
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
734
+ createVNode(p, {
735
+ label: "Weight",
736
+ rules: [unref(ZodHelper).ruleAtPath(unref(m), "weight", [unref(o).type])],
737
+ "model-value": unref(o).weight,
738
+ "onUpdate:modelValue": r[2] || (r[2] = (V) => o.value = {
739
+ ...unref(o),
740
+ weight: V
741
+ })
742
+ }, null, 8, ["rules", "model-value"]),
743
+ unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
744
+ ((k = unref(s).loyaltyRewards.items.find(
745
+ (V) => {
746
+ var R;
747
+ return V.value === ((R = unref(o)) == null ? void 0 : R.collectible);
748
+ }
749
+ )) == null ? void 0 : k.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
750
+ r[11] || (r[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
751
+ createVNode(_sfc_main$l, {
752
+ class: "mt-[-8px]",
753
+ rules: [
754
+ unref(ZodHelper).ruleAtPath(unref(m), "earningOption", [unref(o).type])
755
+ ],
756
+ "helper-state": unref(ZodHelper).helperState(unref(g), "earningOption"),
757
+ "error-text": unref(ZodHelper).helperText(unref(g), "earningOption"),
758
+ "fixed-type": !0,
759
+ "model-value": unref(o).earningOption,
760
+ "onUpdate:modelValue": r[3] || (r[3] = (V) => o.value = {
761
+ ...unref(o),
762
+ earningOption: V
763
+ })
764
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
765
+ ], 64)) : createCommentVNode("", !0),
766
+ r[12] || (r[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
767
+ createVNode(_sfc_main$m, {
768
+ type: unref(o).type === "LOYALTY" ? "custom" : "range",
769
+ "for-credit": unref(o).type === "LOYALTY" && ((C = unref(s).loyaltyRewards.items.find(
770
+ (V) => {
771
+ var R;
772
+ return V.value === ((R = unref(o)) == null ? void 0 : R.collectible);
773
+ }
774
+ )) == null ? void 0 : C.raw.type) === "CREDIT",
775
+ class: "!gap-24",
776
+ rules: [unref(ZodHelper).ruleAtPath(unref(m), "validityOption", [unref(o).type])],
777
+ "model-value": unref(o).validityOption,
778
+ "onUpdate:modelValue": r[4] || (r[4] = (V) => o.value = {
779
+ ...unref(o),
780
+ validityOption: V
781
+ })
782
+ }, null, 8, ["type", "for-credit", "rules", "model-value"])
783
+ ], 64)) : createCommentVNode("", !0),
784
+ unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$n, {
785
+ key: 2,
786
+ "reward-image": unref(l),
787
+ "model-value": ((B = unref(o)) == null ? void 0 : B.collectibleConfig) ?? void 0,
788
+ "onUpdate:modelValue": r[5] || (r[5] = (V) => o.value = {
789
+ ...unref(o),
790
+ collectibleConfig: V
791
+ }),
792
+ "onUpdate:rewardImage": r[6] || (r[6] = (V) => l.value = V)
793
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
794
+ createVNode(JsonViewer, { json: unref(g) }, null, 8, ["json"])
795
+ ])) : createCommentVNode("", !0)
796
+ ];
797
+ }),
798
+ _: 1
799
+ }, 8, ["modelValue"]);
800
+ };
801
+ }
802
+ });
803
+ function isNullOrEmpty(e) {
804
+ return e == null || e === "";
805
+ }
806
+ const _hoisted_1$a = { class: "space-y-16" }, _hoisted_2$7 = { class: "fm-typo-en-body-lg-400" }, _hoisted_3$6 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _sfc_main$a = /* @__PURE__ */ defineComponent({
807
+ __name: "RewardPoolInput",
808
+ props: {
809
+ modelValue: {
810
+ type: Array,
811
+ default: () => [
812
+ {
813
+ collectible: null,
814
+ type: "NO_REWARD",
815
+ weight: 1
816
+ }
817
+ ]
818
+ }
819
+ },
820
+ emits: ["update:model-value"],
821
+ setup(e, { emit: d }) {
822
+ const a = e, s = d, u = useMembershipStore(), i = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), o = computed(() => a.modelValue ?? []), l = computed(() => {
823
+ const f = i.safeParse(o.value);
824
+ return f.success ? [] : f.error.errors;
825
+ }), n = ref();
826
+ function m(f, r) {
827
+ var p;
828
+ const c = [...o.value];
829
+ c[r] = f, (p = n.value) == null || p.showSheet(!1), s("update:model-value", c);
830
+ }
831
+ function g(f) {
832
+ const r = f.type == "VOUCHER" ? f.collectibleConfig : u.collectibles.find(
833
+ (b) => b._id.toString() == f.collectible
834
+ ), c = CollectionUtils.formattedType((r == null ? void 0 : r.name) || ""), p = f.weight;
835
+ return {
836
+ label: isNullOrEmpty(c) ? "NO REWARD" : c,
837
+ sublabel: `${p} (${(p / o.value.reduce((b, x) => b + x.weight, 0) * 100).toFixed(2)}%)`
838
+ };
839
+ }
840
+ function y(f) {
841
+ var c;
842
+ const r = [...o.value];
843
+ (c = n.value) == null || c.showSheet(!0, r[f], f);
844
+ }
845
+ function v(f) {
846
+ const r = [...o.value];
847
+ r.splice(f, 1), s("update:model-value", r);
848
+ }
849
+ function h() {
850
+ var f;
851
+ (f = n.value) == null || f.showSheet(
852
+ !0,
853
+ {
854
+ type: "NO_REWARD",
855
+ collectible: null,
856
+ weight: 1
857
+ },
858
+ o.value.length
859
+ );
860
+ }
861
+ return (f, r) => {
862
+ const c = resolveComponent("FmButton"), p = resolveComponent("FmCard"), b = resolveComponent("FmHelperText");
863
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
864
+ r[1] || (r[1] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type and weightage given to your customer. ", -1)),
865
+ createVNode(c, {
866
+ label: "Add Reward",
867
+ onClick: r[0] || (r[0] = (x) => h()),
868
+ variant: "plain",
869
+ icon: "add"
870
+ }),
871
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (x, k) => (openBlock(), createBlock(p, {
872
+ key: k,
873
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
874
+ variant: "outlined",
875
+ onClick: (C) => y(k)
876
+ }, {
877
+ default: withCtx(() => {
878
+ var C;
879
+ return [
880
+ createElementVNode("div", null, [
881
+ createElementVNode("div", _hoisted_2$7, toDisplayString(x.type == "LOYALTY" ? (C = x == null ? void 0 : x.earningOption) == null ? void 0 : C.amount : "") + " " + toDisplayString(g(x).label), 1),
882
+ createElementVNode("div", _hoisted_3$6, toDisplayString(g(x).sublabel), 1)
883
+ ]),
884
+ createVNode(c, {
885
+ icon: "delete",
886
+ variant: "tertiary",
887
+ onClick: (B) => (B.stopPropagation(), v(k))
888
+ }, null, 8, ["onClick"])
889
+ ];
890
+ }),
891
+ _: 2
892
+ }, 1032, ["onClick"]))), 128)),
893
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((x) => x.path.join(".") == ""), (x) => (openBlock(), createBlock(b, {
894
+ key: x.message,
895
+ text: x.message,
896
+ state: "error"
897
+ }, null, 8, ["text"]))), 128)),
898
+ createVNode(_sfc_main$b, {
899
+ ref_key: "sheetRef",
900
+ ref: n,
901
+ "onUpdate:modelValue": m
902
+ }, null, 512)
903
+ ]);
904
+ };
905
+ }
906
+ }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
907
+ key: 0,
908
+ class: "grid grid-cols-2 gap-16"
909
+ }, _hoisted_3$5 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$4 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$9 = /* @__PURE__ */ defineComponent({
910
+ __name: "PromotionGameTypeInput",
911
+ props: {
912
+ modelValue: {
913
+ type: Object
914
+ }
915
+ },
916
+ emits: ["update:model-value"],
917
+ setup(e, { emit: d }) {
918
+ const a = e, s = d, u = computed(() => [
919
+ {
920
+ label: "Rock paper scissor",
921
+ description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
922
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
923
+ }
924
+ ]);
925
+ return (i, o) => {
926
+ var g, y, v;
927
+ const l = resolveComponent("FmSwitch"), n = resolveComponent("FmCard"), m = resolveComponent("FmHelperText");
928
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
929
+ createVNode(l, {
930
+ label: "Enable game",
931
+ "model-value": !!((g = e.modelValue) != null && g.gameType),
932
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => h ? s("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : s("update:model-value", null))
933
+ }, null, 8, ["model-value"]),
934
+ ((y = e.modelValue) == null ? void 0 : y.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
935
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (h) => {
936
+ var f, r;
937
+ return openBlock(), createBlock(n, {
938
+ variant: "outlined",
939
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
940
+ "col-span-2": unref(u).length == 1,
941
+ "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) == h.value,
942
+ "hover:bg-fm-color-opacity-sm": ((r = e.modelValue) == null ? void 0 : r.gameType) != h.value
943
+ }]),
944
+ onClick: () => {
945
+ var c;
946
+ ((c = a.modelValue) == null ? void 0 : c.gameType) != h.value && s("update:model-value", { gameType: h.value });
947
+ },
948
+ key: h.value
949
+ }, {
950
+ default: withCtx(() => [
951
+ createElementVNode("div", _hoisted_3$5, toDisplayString(h.label), 1),
952
+ createElementVNode("div", _hoisted_4$4, toDisplayString(h.description), 1)
953
+ ]),
954
+ _: 2
955
+ }, 1032, ["class", "onClick"]);
956
+ }), 128))
957
+ ])) : createCommentVNode("", !0),
958
+ ((v = e.modelValue) == null ? void 0 : v.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(m, {
959
+ key: 1,
960
+ text: "Rock paper scissors is only available for POS >= 7.7.4 with dual screen on android devices (Sunmi D3 Pro and Sunmi T3 Pro)",
961
+ state: "warning"
962
+ })) : createCommentVNode("", !0)
963
+ ]);
964
+ };
965
+ }
966
+ }), _hoisted_1$8 = { class: "space-y-16" }, _hoisted_2$5 = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$4 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$8 = /* @__PURE__ */ defineComponent({
967
+ __name: "MissionTypeInput",
968
+ props: {
969
+ modelValue: {
970
+ type: String
971
+ }
972
+ },
973
+ emits: ["update:model-value"],
974
+ setup(e, { emit: d }) {
975
+ const a = e, s = d, u = computed(() => [
976
+ {
977
+ label: "Stamp",
978
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
979
+ value: F_MISSION_TYPE.enum.STAMP
980
+ },
981
+ {
982
+ label: "Progress",
983
+ description: "Reward customers when they reach a cumulative spending goal.",
984
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
985
+ }
986
+ ]);
987
+ return (i, o) => {
988
+ const l = resolveComponent("FmCard");
989
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
990
+ o[0] || (o[0] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Select a game where you want your customer to play. ", -1)),
991
+ createElementVNode("div", _hoisted_2$5, [
992
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
993
+ variant: "outlined",
994
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
995
+ "col-span-2": unref(u).length == 1,
996
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
997
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
998
+ }]),
999
+ onClick: () => {
1000
+ a.modelValue != n.value && s("update:model-value", n.value);
1001
+ },
1002
+ key: n.value
1003
+ }, {
1004
+ default: withCtx(() => [
1005
+ createElementVNode("div", _hoisted_3$4, toDisplayString(n.label), 1),
1006
+ createElementVNode("div", _hoisted_4$3, toDisplayString(n.description), 1)
1007
+ ]),
1008
+ _: 2
1009
+ }, 1032, ["class", "onClick"]))), 128))
1010
+ ])
1011
+ ]);
1012
+ };
1013
+ }
1014
+ }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
1015
+ __name: "MissionEndInput",
1016
+ props: {
1017
+ modelValue: {
1018
+ type: [String, Number]
1019
+ },
1020
+ helperText: {
1021
+ type: String
1022
+ },
1023
+ helperState: {
1024
+ type: String
1025
+ }
1026
+ },
1027
+ emits: ["update:model-value"],
1028
+ setup(e, { emit: d }) {
1029
+ const a = d;
1030
+ return (s, u) => {
1031
+ const i = resolveComponent("FmStepperField");
1032
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1033
+ u[1] || (u[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)),
1034
+ createVNode(i, {
1035
+ label: "Maximum to collect",
1036
+ "model-value": e.modelValue || null,
1037
+ "onUpdate:modelValue": u[0] || (u[0] = (o) => a("update:model-value", o)),
1038
+ "helper-text": e.helperText || "Set the threshold required for reward eligibility",
1039
+ "helper-state": e.helperState || "none"
1040
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
1041
+ ]);
1042
+ };
1043
+ }
1044
+ }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
1045
+ __name: "EditMissionPoolSheet",
1046
+ props: {
1047
+ maxThreshold: {
1048
+ type: Number,
1049
+ required: !0
1050
+ }
1051
+ },
1052
+ emits: ["update:model-value"],
1053
+ setup(e, { expose: d, emit: a }) {
1054
+ const s = e, u = useMembershipStore(), { minor: i } = useLoading, o = ref(!1), l = ref(), n = ref(), m = ref(0), g = computed(() => {
1055
+ var p;
1056
+ return ((p = u.loyaltyRewards.items.find(
1057
+ (b) => {
1058
+ var x;
1059
+ return b.value === ((x = l.value) == null ? void 0 : x.collectible);
1060
+ }
1061
+ )) == null ? void 0 : p.raw.type) === "CREDIT" ? FdoThresholdCreditReward : FdtoThresholdReward;
1062
+ }), y = computed(() => {
1063
+ const c = g.value.safeParse(l.value);
1064
+ return c.success ? [] : c.error.errors;
1065
+ });
1066
+ function v(c, p, b) {
1067
+ c && (l.value = p, m.value = b), o.value = c;
1068
+ }
1069
+ const h = a;
1070
+ async function f() {
1071
+ const c = g.value.safeParse(l.value);
1072
+ c.success && (await i(
1073
+ async () => {
1074
+ c.data.type === "VOUCHER" && n.value && (c.data.collectibleConfig.image = await firebaseStorage.update(
1075
+ c.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1076
+ n.value
1077
+ ));
1078
+ },
1079
+ {
1080
+ message: "Uploading reward image",
1081
+ successMessage: "Reward image updated"
1082
+ }
1083
+ ), h("update:model-value", c.data, m.value));
1084
+ }
1085
+ const r = ref();
1086
+ return d({
1087
+ showSheet: v
1088
+ }), (c, p) => {
1089
+ const b = resolveComponent("FmStepperField"), x = resolveComponent("FmSelect"), k = resolveComponent("FmForm"), C = resolveComponent("FmButton"), B = resolveComponent("FmSideSheet");
1090
+ return openBlock(), createBlock(B, {
1091
+ "max-width": 560,
1092
+ modelValue: unref(o),
1093
+ "onUpdate:modelValue": [
1094
+ p[10] || (p[10] = (V) => isRef(o) ? o.value = V : null),
1095
+ p[11] || (p[11] = (V) => o.value = V)
1096
+ ],
1097
+ header: "Edit reward",
1098
+ "dismiss-away": ""
1099
+ }, {
1100
+ "side-sheet-footer": withCtx(() => [
1101
+ createElementVNode("div", _hoisted_1$6, [
1102
+ createVNode(C, {
1103
+ variant: "primary",
1104
+ type: "button",
1105
+ label: "Confirm",
1106
+ disabled: unref(y).length > 0,
1107
+ onClick: p[8] || (p[8] = async () => {
1108
+ var V;
1109
+ return (V = unref(r)) == null ? void 0 : V.validateInputs();
1110
+ })
1111
+ }, null, 8, ["disabled"]),
1112
+ createVNode(C, {
1113
+ variant: "secondary",
1114
+ type: "button",
1115
+ label: "Cancel",
1116
+ onClick: p[9] || (p[9] = (V) => o.value = !1)
1117
+ })
1118
+ ])
1119
+ ]),
1120
+ default: withCtx(() => [
1121
+ createVNode(JsonViewer, { json: unref(l) }, null, 8, ["json"]),
1122
+ unref(l) ? (openBlock(), createBlock(k, {
1123
+ key: 0,
1124
+ class: "flex flex-col gap-y-24",
1125
+ ref_key: "formRef",
1126
+ ref: r,
1127
+ onValidationSuccess: p[7] || (p[7] = (V) => f())
1128
+ }, {
1129
+ default: withCtx(() => {
1130
+ var V, R;
1131
+ return [
1132
+ unref(l).type ? (openBlock(), createBlock(b, {
1133
+ key: 0,
1134
+ label: "Threshold",
1135
+ rules: [
1136
+ unref(ZodHelper).toRule(
1137
+ unref(z).number().min(1).max(
1138
+ s.maxThreshold,
1139
+ `Number cannot be more than ${s.maxThreshold}`
1140
+ )
1141
+ )
1142
+ ],
1143
+ "model-value": unref(l).threshold,
1144
+ "onUpdate:modelValue": p[0] || (p[0] = (E) => l.value = {
1145
+ ...unref(l),
1146
+ threshold: E
1147
+ })
1148
+ }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
1149
+ createVNode(x, {
1150
+ label: "Reward Type",
1151
+ items: [
1152
+ { label: "Voucher", value: "VOUCHER" },
1153
+ { label: "Loyalty", value: "LOYALTY" }
1154
+ ],
1155
+ "model-value": unref(l).type,
1156
+ "onUpdate:modelValue": p[1] || (p[1] = (E) => {
1157
+ var S, w;
1158
+ E === "VOUCHER" ? l.value = {
1159
+ collectible: null,
1160
+ type: "VOUCHER",
1161
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1162
+ business: unref(useCoreStore)().currentBusiness.value._id
1163
+ }),
1164
+ earningOption: {
1165
+ amount: 1,
1166
+ type: "FIXED"
1167
+ },
1168
+ validityOption: {
1169
+ validForDay: 7
1170
+ },
1171
+ threshold: (S = unref(l)) == null ? void 0 : S.threshold
1172
+ } : l.value = {
1173
+ collectible: unref(u).loyaltyRewards.raw[0]._id,
1174
+ type: "LOYALTY",
1175
+ earningOption: {
1176
+ amount: 1,
1177
+ type: "FIXED"
1178
+ },
1179
+ validityOption: {
1180
+ validForDay: 7
1181
+ },
1182
+ threshold: (w = unref(l)) == null ? void 0 : w.threshold
1183
+ };
1184
+ })
1185
+ }, null, 8, ["model-value"]),
1186
+ unref(l).type == "LOYALTY" ? (openBlock(), createBlock(x, {
1187
+ key: 1,
1188
+ label: "Loyalty type",
1189
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "collectible", [unref(l).type])],
1190
+ items: unref(u).loyaltyRewards.items,
1191
+ "model-value": unref(l).collectible,
1192
+ "onUpdate:modelValue": p[2] || (p[2] = (E) => unref(l).collectible = E)
1193
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1194
+ unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1195
+ p[12] || (p[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1196
+ createVNode(_sfc_main$l, {
1197
+ class: "mt-[-8px]",
1198
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "earningOption", [unref(l).type])],
1199
+ "helper-state": unref(ZodHelper).helperState(unref(y), "earningOption"),
1200
+ "error-text": unref(ZodHelper).helperText(unref(y), "earningOption"),
1201
+ "fixed-type": !0,
1202
+ "model-value": unref(l).earningOption,
1203
+ "onUpdate:modelValue": p[3] || (p[3] = (E) => l.value = {
1204
+ ...unref(l),
1205
+ earningOption: E
1206
+ })
1207
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
1208
+ createVNode(_sfc_main$m, {
1209
+ class: "!gap-24",
1210
+ type: unref(l).type === "LOYALTY" ? "custom" : "range",
1211
+ "for-credit": unref(l).type === "LOYALTY" && ((V = unref(u).loyaltyRewards.items.find(
1212
+ (E) => {
1213
+ var S;
1214
+ return E.value === ((S = unref(l)) == null ? void 0 : S.collectible);
1215
+ }
1216
+ )) == null ? void 0 : V.raw.type) === "CREDIT",
1217
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "validityOption", [unref(l).type])],
1218
+ "model-value": unref(l).validityOption,
1219
+ "onUpdate:modelValue": p[4] || (p[4] = (E) => l.value = {
1220
+ ...unref(l),
1221
+ validityOption: E
1222
+ })
1223
+ }, null, 8, ["type", "for-credit", "rules", "model-value"])
1224
+ ], 64)) : createCommentVNode("", !0),
1225
+ unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$n, {
1226
+ key: 3,
1227
+ "reward-image": unref(n),
1228
+ "model-value": ((R = unref(l)) == null ? void 0 : R.collectibleConfig) ?? void 0,
1229
+ "onUpdate:modelValue": p[5] || (p[5] = (E) => l.value = {
1230
+ ...unref(l),
1231
+ collectibleConfig: E
1232
+ }),
1233
+ "onUpdate:rewardImage": p[6] || (p[6] = (E) => n.value = E)
1234
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1235
+ createVNode(JsonViewer, { json: unref(y) }, null, 8, ["json"])
1236
+ ];
1237
+ }),
1238
+ _: 1
1239
+ }, 512)) : createCommentVNode("", !0)
1240
+ ]),
1241
+ _: 1
1242
+ }, 8, ["modelValue"]);
1243
+ };
1244
+ }
1245
+ }), _hoisted_1$5 = {
1246
+ key: 0,
1247
+ class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
1248
+ }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
1249
+ __name: "MissionProgress",
1250
+ props: {
1251
+ type: {
1252
+ type: String,
1253
+ required: !0
1254
+ },
1255
+ maxRange: {
1256
+ type: Number,
1257
+ required: !0
1258
+ },
1259
+ currentRange: {
1260
+ type: Number,
1261
+ default: 0
1262
+ },
1263
+ markers: {
1264
+ type: Array,
1265
+ default: () => []
1266
+ }
1267
+ },
1268
+ setup(e) {
1269
+ const d = e, { maxRange: a, currentRange: s, markers: u } = toRefs(d), i = computed(
1270
+ () => Math.min(s.value / a.value * 100, 100)
1271
+ ), o = (l) => l / a.value * 100;
1272
+ return (l, n) => {
1273
+ const m = resolveComponent("FmIcon");
1274
+ return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
1275
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(a), 40), (g) => (openBlock(), createBlock(m, {
1276
+ class: normalizeClass(
1277
+ unref(s) >= g ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
1278
+ ),
1279
+ outline: unref(s) < g,
1280
+ key: g,
1281
+ name: unref(u).some((y) => y === g) ? "featured_seasonal_and_gifts" : "check_circle"
1282
+ }, null, 8, ["class", "outline", "name"]))), 128))
1283
+ ])) : (openBlock(), createElementBlock("div", {
1284
+ key: 1,
1285
+ class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
1286
+ }, [
1287
+ createElementVNode("div", {
1288
+ class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
1289
+ style: normalizeStyle({ width: unref(i) + "%" })
1290
+ }, null, 4),
1291
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (g, y) => (openBlock(), createElementBlock("div", {
1292
+ key: y,
1293
+ class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
1294
+ style: normalizeStyle({ left: o(g) + "%" })
1295
+ }, [
1296
+ createElementVNode("div", _hoisted_2$4, [
1297
+ createElementVNode("div", {
1298
+ class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
1299
+ }),
1300
+ n[0] || (n[0] = createElementVNode("div", null, "🎁", -1))
1301
+ ])
1302
+ ], 4))), 128))
1303
+ ]));
1304
+ };
1305
+ }
1306
+ }), isObject = (e) => e !== null && typeof e == "object";
1307
+ function changeKeysFactory(e) {
1308
+ return function d(a, s = 1, u) {
1309
+ if (s === 0 || !isObject(a))
1310
+ return a;
1311
+ if (Array.isArray(a))
1312
+ return a.map((o) => d(o, s - 1, u));
1313
+ const i = Object.create(Object.getPrototypeOf(a));
1314
+ return Object.keys(a).forEach((o) => {
1315
+ const l = a[o], n = e(o, u), m = d(l, s - 1, u);
1316
+ i[n] = m;
1317
+ }), i;
1318
+ };
1319
+ }
1320
+ const sentenceCase = changeKeysFactory(sentenceCase$1), _hoisted_1$4 = { class: "space-y-16" }, _hoisted_2$3 = { class: "fm-typo-en-body-lg-400" }, _hoisted_3$3 = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, _hoisted_4$2 = { class: "flex items-center gap-4" }, _hoisted_5$2 = { class: "fm-typo-en-body-lg-600" }, _hoisted_6$2 = { class: "flex items-center gap-16" }, _hoisted_7$1 = { key: 0 }, _sfc_main$4 = /* @__PURE__ */ defineComponent({
1321
+ __name: "MissionPoolInput",
1322
+ props: {
1323
+ modelValue: {
1324
+ type: Array,
1325
+ default: () => []
1326
+ },
1327
+ mission: {
1328
+ type: Object,
1329
+ required: !0
1330
+ }
1331
+ },
1332
+ emits: ["update:model-value"],
1333
+ setup(e, { emit: d }) {
1334
+ const a = e, s = d, u = useMembershipStore(), i = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(
1335
+ () => a.modelValue.sort((r, c) => r.threshold - c.threshold) ?? []
1336
+ ), l = computed(() => {
1337
+ const r = i.safeParse(o.value);
1338
+ return r.success ? [] : r.error.errors;
1339
+ }), n = ref();
1340
+ function m(r, c) {
1341
+ var b;
1342
+ const p = [...o.value];
1343
+ p[c] = r, (b = n.value) == null || b.showSheet(!1), s("update:model-value", p);
1344
+ }
1345
+ function g(r) {
1346
+ const c = r.type == "VOUCHER" ? r.collectibleConfig : u.collectibles.find(
1347
+ (b) => b._id.toString() == r.collectible
1348
+ ), p = CollectionUtils.formattedType((c == null ? void 0 : c.name) || "");
1349
+ return {
1350
+ label: isNullOrEmpty(p) ? "NO REWARD" : p,
1351
+ sublabel: `Reward at ${r.threshold} | Amount: ${r.earningOption.type == "FIXED" ? r.earningOption.amount : `${r.earningOption.amount} for every RM${r.earningOption.every} spent`} `
1352
+ };
1353
+ }
1354
+ function y(r) {
1355
+ var p;
1356
+ const c = [...o.value];
1357
+ (p = n.value) == null || p.showSheet(!0, c[r], r);
1358
+ }
1359
+ function v(r) {
1360
+ const c = [...o.value];
1361
+ c.splice(r, 1), s("update:model-value", c);
1362
+ }
1363
+ function h() {
1364
+ var r;
1365
+ (r = n.value) == null || r.showSheet(
1366
+ !0,
1367
+ {
1368
+ type: "LOYALTY",
1369
+ collectible: u.loyaltyRewards.items[0].value,
1370
+ threshold: null,
1371
+ validityOption: {
1372
+ validForDay: 7
1373
+ },
1374
+ earningOption: {
1375
+ type: "FIXED",
1376
+ amount: 1
1377
+ }
1378
+ },
1379
+ o.value.length
1380
+ );
1381
+ }
1382
+ function f(r) {
1383
+ var c, p;
1384
+ return r.type == "VOUCHER" ? (c = r.collectibleConfig) == null ? void 0 : c.name : sentenceCase(
1385
+ ((p = u.loyaltyRewards.items.find(
1386
+ (b) => b.value == r.collectible
1387
+ )) == null ? void 0 : p.label) || ""
1388
+ );
1389
+ }
1390
+ return (r, c) => {
1391
+ const p = resolveComponent("FmButton"), b = resolveComponent("FmCard"), x = resolveComponent("FmHelperText");
1392
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
1393
+ c[2] || (c[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1)),
1394
+ createVNode(p, {
1395
+ label: "Add Reward",
1396
+ onClick: c[0] || (c[0] = (k) => h()),
1397
+ variant: "plain",
1398
+ icon: "add"
1399
+ }),
1400
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (k, C) => (openBlock(), createBlock(b, {
1401
+ key: C,
1402
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
1403
+ variant: "outlined",
1404
+ onClick: (B) => y(C)
1405
+ }, {
1406
+ default: withCtx(() => [
1407
+ createElementVNode("div", null, [
1408
+ createElementVNode("div", _hoisted_2$3, toDisplayString(g(k).label), 1),
1409
+ createElementVNode("div", _hoisted_3$3, toDisplayString(g(k).sublabel), 1)
1410
+ ]),
1411
+ createVNode(p, {
1412
+ icon: "delete",
1413
+ variant: "tertiary",
1414
+ onClick: (B) => (B.stopPropagation(), v(C))
1415
+ }, null, 8, ["onClick"])
1416
+ ]),
1417
+ _: 2
1418
+ }, 1032, ["onClick"]))), 128)),
1419
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((k) => k.path.join(".") == ""), (k) => (openBlock(), createBlock(x, {
1420
+ key: k.message,
1421
+ text: k.message,
1422
+ state: "error"
1423
+ }, null, 8, ["text"]))), 128)),
1424
+ c[3] || (c[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
1425
+ (openBlock(), createBlock(b, {
1426
+ key: 0,
1427
+ variant: "outlined",
1428
+ class: "p-24 space-y-16 w-fit"
1429
+ }, {
1430
+ default: withCtx(() => {
1431
+ var k, C;
1432
+ return [
1433
+ createElementVNode("div", _hoisted_4$2, [
1434
+ createElementVNode("div", null, [
1435
+ createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(((k = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : k.earningOption.amount) > 1 ? (C = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : C.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? f(e.modelValue[e.modelValue.length - 1]) : ""), 1),
1436
+ c[1] || (c[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
1437
+ ])
1438
+ ]),
1439
+ createElementVNode("div", _hoisted_6$2, [
1440
+ createVNode(_sfc_main$5, {
1441
+ type: e.mission.type,
1442
+ "max-range": e.mission.end,
1443
+ currentRange: e.mission.end / 4,
1444
+ markers: e.modelValue.map((B) => B.threshold)
1445
+ }, null, 8, ["type", "max-range", "currentRange", "markers"]),
1446
+ e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
1447
+ ])
1448
+ ];
1449
+ }),
1450
+ _: 1
1451
+ })),
1452
+ createVNode(_sfc_main$6, {
1453
+ ref_key: "sheetRef",
1454
+ ref: n,
1455
+ "onUpdate:modelValue": m,
1456
+ "max-threshold": e.mission.end
1457
+ }, null, 8, ["max-threshold"])
1458
+ ]);
1459
+ };
1460
+ }
1461
+ }), _hoisted_1$3 = { class: "space-y-16" }, _hoisted_2$2 = { class: "space-y-8" }, _hoisted_3$2 = { class: "grid grid-cols-2 gap-16" }, _hoisted_4$1 = { class: "fm-typo-en-title-sm-800" }, _hoisted_5$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_6$1 = { class: "space-y-8" }, _sfc_main$3 = /* @__PURE__ */ defineComponent({
1462
+ __name: "MissionInput",
1463
+ props: {
1464
+ modelValue: Object
1465
+ },
1466
+ emits: ["update:model-value"],
1467
+ setup(e, { emit: d }) {
1468
+ const a = e, s = computed(() => {
1469
+ const o = FdoMission.safeParse(a.modelValue);
1470
+ return o.success ? [] : o.error.errors;
1471
+ }), u = computed(() => [
1472
+ {
1473
+ label: "Stamp",
1474
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
1475
+ value: F_MISSION_TYPE.enum.STAMP
1476
+ },
1477
+ {
1478
+ label: "Progress",
1479
+ description: "Reward customers when they reach a cumulative spending goal.",
1480
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
1481
+ }
1482
+ ]), i = d;
1483
+ return (o, l) => {
1484
+ var g;
1485
+ const n = resolveComponent("FmCard"), m = resolveComponent("FmStepperField");
1486
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
1487
+ createElementVNode("div", _hoisted_2$2, [
1488
+ l[1] || (l[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
1489
+ l[2] || (l[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Select a game where you want your customer to play. ", -1)),
1490
+ createElementVNode("div", _hoisted_3$2, [
1491
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (y) => {
1492
+ var v, h;
1493
+ return openBlock(), createBlock(n, {
1494
+ variant: "outlined",
1495
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1496
+ "col-span-2": unref(u).length == 1,
1497
+ "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,
1498
+ "hover:bg-fm-color-opacity-sm": ((h = e.modelValue) == null ? void 0 : h.type) != y.value
1499
+ }]),
1500
+ onClick: () => {
1501
+ var f, r;
1502
+ ((f = e.modelValue) == null ? void 0 : f.type) != y.value && i("update:model-value", {
1503
+ ...e.modelValue,
1504
+ type: y.value,
1505
+ end: ((r = e.modelValue) == null ? void 0 : r.end) || 1
1506
+ });
1507
+ },
1508
+ key: y.value
1509
+ }, {
1510
+ default: withCtx(() => [
1511
+ createElementVNode("div", _hoisted_4$1, toDisplayString(y.label), 1),
1512
+ createElementVNode("div", _hoisted_5$1, toDisplayString(y.description), 1)
1513
+ ]),
1514
+ _: 2
1515
+ }, 1032, ["class", "onClick"]);
1516
+ }), 128))
1517
+ ])
1518
+ ]),
1519
+ createElementVNode("div", _hoisted_6$1, [
1520
+ l[3] || (l[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
1521
+ l[4] || (l[4] = 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)),
1522
+ createVNode(m, {
1523
+ label: "Maximum to collect",
1524
+ "model-value": ((g = e.modelValue) == null ? void 0 : g.end) || null,
1525
+ "onUpdate:modelValue": l[0] || (l[0] = (y) => {
1526
+ var v;
1527
+ return i("update:model-value", {
1528
+ ...e.modelValue,
1529
+ type: ((v = e.modelValue) == null ? void 0 : v.type) || "STAMP",
1530
+ end: y
1531
+ });
1532
+ }),
1533
+ "helper-text": unref(ZodHelper).helperText(unref(s), "end") || "Set the threshold required for reward eligibility",
1534
+ "helper-state": unref(ZodHelper).helperState(unref(s), "end") || "none"
1535
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
1536
+ ])
1537
+ ]);
1538
+ };
1539
+ }
1540
+ }), _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
1541
+ __name: "TemplateInput",
1542
+ props: {
1543
+ field: { type: Object, required: !0 },
1544
+ modelValue: {
1545
+ type: Object
1546
+ },
1547
+ schema: {
1548
+ type: Object
1549
+ },
1550
+ extras: {
1551
+ type: Object
1552
+ },
1553
+ helperText: {
1554
+ type: String
1555
+ },
1556
+ disabled: {
1557
+ type: Boolean,
1558
+ default: !1
1559
+ }
1560
+ },
1561
+ emits: ["update:model-value", "update:file"],
1562
+ setup(e, { emit: d }) {
1563
+ const { t: a } = useI18n(), s = e, u = d;
1564
+ function i(m) {
1565
+ switch (s.field.type) {
1566
+ case "timeframe":
1567
+ const g = m.startDate ? hooks(m.startDate).startOf("day").toISOString() : void 0, y = m.endDate ? hooks(m.endDate).endOf("day").toISOString() : void 0;
1568
+ u("update:model-value", {
1569
+ type: "timeframe",
1570
+ property: "__now",
1571
+ start: g,
1572
+ end: y
1573
+ });
1574
+ break;
1575
+ case "image": {
1576
+ u(
1577
+ "update:file",
1578
+ m,
1579
+ o.value || firebaseStorage.collectibleImagePath(void 0, m)
1580
+ );
1581
+ break;
1582
+ }
1583
+ default:
1584
+ u("update:model-value", m);
1585
+ break;
1586
+ }
1587
+ }
1588
+ const o = computed(() => {
1589
+ switch (s.field.type) {
1590
+ case "timeframe": {
1591
+ const m = s.modelValue;
1592
+ return {
1593
+ startDate: m != null && m.start ? hooks(m == null ? void 0 : m.start).format("YYYY-MM-DD") : null,
1594
+ endDate: m != null && m.end ? hooks(m == null ? void 0 : m.end).format("YYYY-MM-DD") : null
1595
+ };
1596
+ }
1597
+ default:
1598
+ return s.modelValue;
1599
+ }
1600
+ });
1601
+ function l() {
1602
+ if (!n.value.schema) return [];
1603
+ const m = n.value.schema.safeParse(s.modelValue);
1604
+ return m.success ? [] : m.error.errors;
1605
+ }
1606
+ const n = computed(() => ({
1607
+ schema: s.schema,
1608
+ unwrapped: s.schema ? ZodHelper.unwrap(s.schema) : void 0,
1609
+ rules: s.schema ? [ZodHelper.ruleAtPath(s.schema, "")] : void 0,
1610
+ labelMark: s.schema && ZodHelper.isRequired(s.schema) == !1 ? "optional" : void 0,
1611
+ zodLabel: s.schema ? ZodHelper.toInputLabel(s.schema, s.field.label) : void 0
1612
+ }));
1613
+ return (m, g) => {
1614
+ var c, p, b, x, k;
1615
+ const y = resolveComponent("FmTextField"), v = resolveComponent("FmStepperField"), h = resolveComponent("FmTextarea"), f = resolveComponent("FmHelperText"), r = resolveComponent("FmSwitch");
1616
+ return e.field.type === "text" ? (openBlock(), createBlock(y, {
1617
+ key: 0,
1618
+ label: unref(a)(e.field.label),
1619
+ "label-mark": unref(n).labelMark,
1620
+ rules: unref(n).rules,
1621
+ "model-value": unref(o),
1622
+ "onUpdate:modelValue": i,
1623
+ "helper-state": e.helperText ? "error" : void 0,
1624
+ "helper-text": e.helperText
1625
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1626
+ createVNode(JsonViewer, {
1627
+ json: { schema: unref(n).unwrapped, props: s }
1628
+ }, null, 8, ["json"]),
1629
+ createVNode(v, {
1630
+ label: unref(a)(e.field.label),
1631
+ "label-mark": e.field.isRuleChildren ? void 0 : unref(n).labelMark,
1632
+ "model-value": unref(o),
1633
+ rules: e.field.isRuleChildren ? [] : unref(n).rules,
1634
+ "onUpdate:modelValue": i,
1635
+ "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
1636
+ "helper-text": e.field.isRuleChildren ? e.helperText : void 0
1637
+ }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
1638
+ ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(h, {
1639
+ key: 2,
1640
+ label: unref(a)(e.field.label),
1641
+ "label-mark": unref(n).labelMark,
1642
+ rules: unref(n).rules,
1643
+ "model-value": unref(o),
1644
+ "onUpdate:modelValue": i,
1645
+ "show-word-count": "",
1646
+ "max-length": (k = (x = (b = (p = (c = unref(n)) == null ? void 0 : c.unwrapped) == null ? void 0 : p._def) == null ? void 0 : b.checks) == null ? void 0 : x.find((C) => C.kind == "max")) == null ? void 0 : k.value
1647
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$g, {
1648
+ key: 3,
1649
+ "campaign-type": e.extras,
1650
+ "model-value": unref(o),
1651
+ disabled: e.disabled,
1652
+ "onUpdate:modelValue": i
1653
+ }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1654
+ createVNode(_sfc_main$e, {
1655
+ "model-value": unref(o),
1656
+ "onUpdate:modelValue": i
1657
+ }, null, 8, ["model-value"]),
1658
+ createVNode(f, {
1659
+ class: "!mt-[8px]",
1660
+ text: unref(ZodHelper).helperText(l(), ""),
1661
+ state: unref(ZodHelper).helperState(l(), "")
1662
+ }, null, 8, ["text", "state"])
1663
+ ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$o, {
1664
+ key: 5,
1665
+ thumbnail: unref(o),
1666
+ "aspect-ratio": "16 / 9",
1667
+ class: "w-1/2 xs:w-2/3",
1668
+ "onUpdate:file": i
1669
+ }, {
1670
+ label: withCtx(() => [
1671
+ (openBlock(), createBlock(resolveDynamicComponent(unref(n).zodLabel)))
1672
+ ]),
1673
+ _: 1
1674
+ }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(r, {
1675
+ key: 6,
1676
+ label: unref(a)(e.field.label),
1677
+ "label-placement": "right",
1678
+ sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
1679
+ "label-mark": unref(n).labelMark,
1680
+ rules: unref(n).rules,
1681
+ "model-value": unref(o),
1682
+ "onUpdate:modelValue": i
1683
+ }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$p, {
1684
+ key: 7,
1685
+ "model-value": unref(o),
1686
+ "onUpdate:modelValue": i,
1687
+ "no-campaign": !1,
1688
+ schema: unref(n).schema,
1689
+ "is-mission": e.extras === "MISSION"
1690
+ }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$q, {
1691
+ key: 8,
1692
+ "model-value": unref(o),
1693
+ "onUpdate:modelValue": i
1694
+ }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
1695
+ createVNode(_sfc_main$r, {
1696
+ "model-value": unref(o),
1697
+ "onUpdate:modelValue": i,
1698
+ "can-set-auto-apply": e.field.property == "campaign.effect"
1699
+ }, null, 8, ["model-value", "can-set-auto-apply"]),
1700
+ unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(f, {
1701
+ key: 0,
1702
+ class: "!mt-[8px]",
1703
+ text: unref(a)("connect.campaign.common.effect_required"),
1704
+ state: "error"
1705
+ }, null, 8, ["text"]))
1706
+ ], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$s, {
1707
+ key: 10,
1708
+ "allow-email": !0,
1709
+ "model-value": unref(o),
1710
+ "onUpdate:modelValue": i,
1711
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
1712
+ "trigger-type": e.field.extras,
1713
+ "helper-state": unref(ZodHelper).helperState(l(), "")
1714
+ }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$l, {
1715
+ key: 11,
1716
+ "model-value": unref(o),
1717
+ "onUpdate:modelValue": i,
1718
+ extras: e.extras,
1719
+ "error-text": e.helperText
1720
+ }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$m, {
1721
+ key: 12,
1722
+ type: "custom",
1723
+ "model-value": unref(o),
1724
+ "onUpdate:modelValue": i,
1725
+ "helper-text": e.helperText || unref(ZodHelper).helperText(l(), "")
1726
+ }, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$c, {
1727
+ key: 13,
1728
+ "model-value": unref(o),
1729
+ "onUpdate:modelValue": i
1730
+ }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
1731
+ key: 14,
1732
+ "model-value": unref(o),
1733
+ "onUpdate:modelValue": i
1734
+ }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
1735
+ key: 15,
1736
+ "model-value": unref(o),
1737
+ "onUpdate:modelValue": i
1738
+ }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
1739
+ key: 16,
1740
+ "model-value": unref(o),
1741
+ "onUpdate:modelValue": i
1742
+ }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
1743
+ key: 17,
1744
+ "model-value": unref(o),
1745
+ "onUpdate:modelValue": i,
1746
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
1747
+ "helper-state": unref(ZodHelper).helperState(l(), "")
1748
+ }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
1749
+ key: 18,
1750
+ "model-value": unref(o),
1751
+ "onUpdate:modelValue": i,
1752
+ mission: e.extras.mission
1753
+ }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
1754
+ createVNode(_sfc_main$d, {
1755
+ "model-value": unref(o),
1756
+ "onUpdate:modelValue": i,
1757
+ "start-date": e.extras.start,
1758
+ "end-date": e.extras.end
1759
+ }, null, 8, ["model-value", "start-date", "end-date"]),
1760
+ e.helperText ? (openBlock(), createBlock(f, {
1761
+ key: 0,
1762
+ class: "!mt-[8px]",
1763
+ text: e.helperText,
1764
+ state: "error"
1765
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1766
+ ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
1767
+ createVNode(_sfc_main$t, {
1768
+ "model-value": unref(o),
1769
+ "onUpdate:modelValue": i
1770
+ }, null, 8, ["model-value"]),
1771
+ e.helperText ? (openBlock(), createBlock(f, {
1772
+ key: 0,
1773
+ class: "!mt-[8px]",
1774
+ text: e.helperText,
1775
+ state: "error"
1776
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1777
+ ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
1778
+ e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(o).rules.g_time).length > 0 ? (openBlock(), createBlock(f, {
1779
+ key: 0,
1780
+ state: "warning",
1781
+ text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
1782
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
1783
+ createVNode(_sfc_main$i, {
1784
+ "model-value": unref(o),
1785
+ "onUpdate:modelValue": i
1786
+ }, null, 8, ["model-value"]),
1787
+ e.helperText ? (openBlock(), createBlock(f, {
1788
+ key: 1,
1789
+ class: "!mt-[8px]",
1790
+ text: e.helperText,
1791
+ state: "error"
1792
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1793
+ ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
1794
+ createVNode(_sfc_main$u, {
1795
+ "model-value": unref(o),
1796
+ "onUpdate:modelValue": i
1797
+ }, null, 8, ["model-value"]),
1798
+ e.helperText ? (openBlock(), createBlock(f, {
1799
+ key: 0,
1800
+ class: "!mt-[8px]",
1801
+ text: e.helperText,
1802
+ state: "error"
1803
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1804
+ ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
1805
+ createVNode(_sfc_main$v, {
1806
+ "model-value": unref(o),
1807
+ "onUpdate:modelValue": i
1808
+ }, null, 8, ["model-value"]),
1809
+ e.helperText ? (openBlock(), createBlock(f, {
1810
+ key: 0,
1811
+ class: "!mt-[8px]",
1812
+ text: e.helperText,
1813
+ state: "error"
1814
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1815
+ ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
1816
+ createVNode(_sfc_main$h, {
1817
+ "model-value": unref(o),
1818
+ "onUpdate:modelValue": i
1819
+ }, null, 8, ["model-value"]),
1820
+ e.helperText ? (openBlock(), createBlock(f, {
1821
+ key: 0,
1822
+ class: "!mt-[8px]",
1823
+ text: e.helperText,
1824
+ state: "error"
1825
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1826
+ ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
1827
+ createVNode(_sfc_main$9, {
1828
+ "model-value": unref(o),
1829
+ "onUpdate:modelValue": i
1830
+ }, null, 8, ["model-value"]),
1831
+ e.helperText ? (openBlock(), createBlock(f, {
1832
+ key: 0,
1833
+ class: "!mt-[8px]",
1834
+ text: e.helperText,
1835
+ state: "error"
1836
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1837
+ ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(s.field), 1));
1838
+ };
1839
+ }
1840
+ }), _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({
1841
+ __name: "CampaignSummary",
1842
+ props: {
1843
+ data: {
1844
+ type: Object,
1845
+ required: !0
1846
+ }
1847
+ },
1848
+ setup(e) {
1849
+ const { t: d, te: a } = useI18n();
1850
+ return (s, u) => {
1851
+ const i = resolveComponent("FmCard");
1852
+ return openBlock(), createBlock(i, {
1853
+ variant: "outlined",
1854
+ class: "p-16 space-y-8"
1855
+ }, {
1856
+ default: withCtx(() => [
1857
+ createElementVNode("div", _hoisted_1$1, toDisplayString(unref(d)("connect.campaign.common.summary")), 1),
1858
+ u[0] || (u[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
1859
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (o, l) => (openBlock(), createElementBlock("div", {
1860
+ class: "space-y-4",
1861
+ key: l
1862
+ }, [
1863
+ o ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1864
+ createElementVNode("div", _hoisted_2$1, toDisplayString(unref(d)(`${l}`)), 1),
1865
+ createElementVNode("div", _hoisted_3$1, toDisplayString(unref(a)(`${o}`) ? unref(d)(`${o}`) : o), 1)
1866
+ ], 64)) : createCommentVNode("", !0)
1867
+ ]))), 128))
1868
+ ]),
1869
+ _: 1
1870
+ });
1871
+ };
1872
+ }
1873
+ }), _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 = {
1874
+ key: 0,
1875
+ class: "max-w-6xl mx-auto"
1876
+ }, _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({
1877
+ __name: "EditCampaignSheet",
1878
+ emits: ["submit:model-value"],
1879
+ setup(__props, { expose: __expose, emit: __emit }) {
1880
+ const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
1881
+ TEMPLATES.VOUCHER
1882
+ ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
1883
+ async function showSheet(visible, type, campaign, selectedTemplate) {
1884
+ var e, d;
1885
+ if (sheetVisible.value = visible, visible == !0) {
1886
+ try {
1887
+ isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
1888
+ } catch {
1889
+ } finally {
1890
+ await new Promise((a) => setTimeout(a, 120)), isLoading.value = !1;
1891
+ }
1892
+ template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((a, s) => {
1893
+ a.campaign.type === "VOUCHER" && a.campaign.code && useCampaignStore().campaigns.voucher.some(
1894
+ (u) => u.code === a.campaign.code && u._id.toString() !== a.campaign._id.toString()
1895
+ ) && s.addIssue({
1896
+ code: "custom",
1897
+ message: "Code already exists, please use another code",
1898
+ path: ["campaign", "code"]
1899
+ });
1900
+ })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
1901
+ ...(d = template.value) == null ? void 0 : d.defaultValue
1902
+ }), "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 = campaign ? `Edit ${CampaignOptions[type].name} Campaign` : `Create ${CampaignOptions[type].name} Campaign`;
1903
+ }
1904
+ }
1905
+ async function hideSheet() {
1906
+ Dialog.open({
1907
+ title: t("connect.campaign.common.unsaved_changes"),
1908
+ message: t("connect.campaign.common.unsaved_changes"),
1909
+ primaryActions: {
1910
+ text: t("connect.campaign.common.unsaved_changes_confirm"),
1911
+ close: !0
1912
+ },
1913
+ secondaryActions: {
1914
+ text: t("connect.campaign.common.unsaved_changes_cancel"),
1915
+ close: !1
1916
+ }
1917
+ }).onPrimary(() => {
1918
+ sheetVisible.value = !1;
1919
+ }).onSecondary(() => {
1920
+ Dialog.close();
1921
+ });
1922
+ }
1923
+ const emits = __emit, errors = computed(() => {
1924
+ const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
1925
+ return e.success ? [] : e.error.errors;
1926
+ });
1927
+ function stepErrors(e = currentStep.value - 1) {
1928
+ const d = template.value.steps[e].groups.flatMap(
1929
+ (a) => a.fields.map((s) => s.property)
1930
+ );
1931
+ return errors.value.filter((a) => d.includes(a.path.join(".")));
1932
+ }
1933
+ __expose({ showSheet });
1934
+ function showSummaryDialog() {
1935
+ Dialog.open({
1936
+ title: "",
1937
+ dialogComponent: _sfc_main$1,
1938
+ dialogComponentProps: {
1939
+ data: data.value
1940
+ }
1941
+ });
1942
+ }
1943
+ function onUpdateProperty(e, d) {
1944
+ var a, s, u, i, o, l, n, m;
1945
+ if (_.set(data.value, e, d), e == "campaign.event.type") {
1946
+ const y = ((i = (u = (s = (a = template.value) == null ? void 0 : a.defaultValue) == null ? void 0 : s.campaign) == null ? void 0 : u.event) == null ? void 0 : i.rule) ? _.cloneDeep({
1947
+ ...(m = (n = (l = (o = template.value) == null ? void 0 : o.defaultValue) == null ? void 0 : l.campaign) == null ? void 0 : n.event) == null ? void 0 : m.rule
1948
+ }) : RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup(), [
1949
+ RuleBuilder.scaffoldGroup("g_schedule"),
1950
+ RuleBuilder.scaffoldGroup("g_time"),
1951
+ RuleBuilder.scaffoldGroup("g_user"),
1952
+ RuleBuilder.scaffoldGroup("g_bill")
1953
+ ]), v = RuleBuilder.setRuleToGroup(
1954
+ RuleBuilder.scaffoldGroup("g_schedule"),
1955
+ [
1956
+ RuleBuilder.constructEntry(
1957
+ "trigger.date",
1958
+ "_rrule",
1959
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
1960
+ ),
1961
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
1962
+ ],
1963
+ "&&"
1964
+ );
1965
+ if (d != "SCHEDULE") {
1966
+ _.set(data.value, "campaign.event.rule", y);
1967
+ return;
1968
+ }
1969
+ _.set(
1970
+ data.value,
1971
+ "campaign.event.rule",
1972
+ RuleBuilder.setRuleToGroup(y, v)
1973
+ );
1974
+ }
1975
+ e == "campaign.notify" && d == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
1976
+ }
1977
+ async function onUpdateFile(e, d) {
1978
+ return e ? await minor(async () => firebaseStorage.update(d, e), {
1979
+ message: `${e ? "Uploading" : "Removing"} file`,
1980
+ successMessage: `File ${e ? "uploaded" : "removed"} successfully`
1981
+ }) : "";
1982
+ }
1983
+ function isDisable(e) {
1984
+ var d, a;
1985
+ switch (e == null ? void 0 : e.property) {
1986
+ case "campaign.event.type":
1987
+ return ((a = (d = data.value) == null ? void 0 : d.campaign) == null ? void 0 : a._id) || !1;
1988
+ default:
1989
+ return !1;
1990
+ }
1991
+ }
1992
+ function onSubmit() {
1993
+ const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
1994
+ e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
1995
+ }
1996
+ return (e, d) => {
1997
+ const a = resolveComponent("FmButton"), s = resolveComponent("FmStep"), u = resolveComponent("FmStepper"), i = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
1998
+ return openBlock(), createBlock(o, {
1999
+ "fullscreen-size": "lg",
2000
+ modelValue: unref(sheetVisible),
2001
+ "onUpdate:modelValue": [
2002
+ d[7] || (d[7] = (l) => isRef(sheetVisible) ? sheetVisible.value = l : null),
2003
+ d[8] || (d[8] = (l) => sheetVisible.value = l)
2004
+ ]
2005
+ }, createSlots({
2006
+ "top-sheet-header": withCtx(() => [
2007
+ createElementVNode("div", _hoisted_1, [
2008
+ createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
2009
+ createElementVNode("div", _hoisted_2, [
2010
+ createVNode(a, {
2011
+ onClick: d[0] || (d[0] = (l) => hideSheet()),
2012
+ label: unref(t)("connect.campaign.common.cancel"),
2013
+ variant: "tertiary"
2014
+ }, null, 8, ["label"]),
2015
+ createVNode(a, {
2016
+ onClick: onSubmit,
2017
+ label: unref(t)("connect.campaign.common.save"),
2018
+ disabled: unref(errors).length > 0
2019
+ }, null, 8, ["label", "disabled"])
2020
+ ])
2021
+ ])
2022
+ ]),
2023
+ _: 2
2024
+ }, [
2025
+ unref(isLoading) ? {
2026
+ name: "default",
2027
+ fn: withCtx(() => [
2028
+ createElementVNode("div", _hoisted_9, [
2029
+ createElementVNode("div", _hoisted_10, [
2030
+ createElementVNode("div", _hoisted_11, [
2031
+ d[9] || (d[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
2032
+ createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
2033
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2034
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2035
+ createElementVNode("div", { class: "space-y-3" }, [
2036
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2037
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2038
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2039
+ ]),
2040
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2041
+ ]),
2042
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2043
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2044
+ createElementVNode("div", { class: "space-y-3" }, [
2045
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2046
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2047
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2048
+ ]),
2049
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2050
+ ])
2051
+ ])
2052
+ ], -1)),
2053
+ createVNode(i, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
2054
+ ])
2055
+ ])
2056
+ ])
2057
+ ]),
2058
+ key: "1"
2059
+ } : {
2060
+ name: "default",
2061
+ fn: withCtx(() => [
2062
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
2063
+ createVNode(u, {
2064
+ modelValue: unref(currentStep),
2065
+ "onUpdate:modelValue": d[1] || (d[1] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2066
+ orientation: "horizontal",
2067
+ class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
2068
+ }, {
2069
+ default: withCtx(() => [
2070
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
2071
+ key: l.name,
2072
+ title: unref(t)(l.name),
2073
+ value: n + 1,
2074
+ error: () => stepErrors(n).length > 0,
2075
+ complete: () => n + 1 <= unref(currentStep)
2076
+ }, null, 8, ["title", "value", "error", "complete"]))), 128))
2077
+ ]),
2078
+ _: 1
2079
+ }, 8, ["modelValue"]),
2080
+ createElementVNode("div", _hoisted_4, [
2081
+ createVNode(a, {
2082
+ icon: "close",
2083
+ variant: "tertiary",
2084
+ onClick: d[2] || (d[2] = (l) => sheetVisible.value = !1)
2085
+ }),
2086
+ createVNode(u, {
2087
+ modelValue: unref(currentStep),
2088
+ "onUpdate:modelValue": d[3] || (d[3] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2089
+ orientation: "horizontal",
2090
+ class: "flex-1"
2091
+ }, {
2092
+ default: withCtx(() => [
2093
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
2094
+ key: l.name,
2095
+ title: unref(sheetTitle),
2096
+ description: unref(t)(l.name),
2097
+ value: n + 1,
2098
+ error: () => stepErrors(n).length > 0,
2099
+ complete: () => n + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
2100
+ }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
2101
+ ]),
2102
+ _: 1
2103
+ }, 8, ["modelValue"]),
2104
+ createVNode(a, {
2105
+ icon: "info",
2106
+ variant: "tertiary",
2107
+ onClick: d[4] || (d[4] = () => showSummaryDialog())
2108
+ })
2109
+ ]),
2110
+ createElementVNode("div", _hoisted_5, [
2111
+ createElementVNode("div", _hoisted_6, [
2112
+ createVNode(JsonViewer, {
2113
+ json: {
2114
+ data: unref(data),
2115
+ errors: unref(errors).map(
2116
+ (l) => `${l.path.join(".")} - ${l.message}`
2117
+ ),
2118
+ stepErrors: stepErrors().map(
2119
+ (l) => `${l.path.join(".")} - ${l.message}`
2120
+ ),
2121
+ schema: unref(schema)
2122
+ }
2123
+ }, null, 8, ["json"]),
2124
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
2125
+ (l) => l.fields.length && (!l.condition || unref(_).get(unref(data), l.condition.property) == l.condition.value == (l.condition.not != !0))
2126
+ ), (l, n) => (openBlock(), createElementBlock("div", {
2127
+ key: n,
2128
+ class: "space-y-24"
2129
+ }, [
2130
+ createElementVNode("div", _hoisted_7, toDisplayString(l.name ? unref(t)(l.name) : ""), 1),
2131
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(l.fields, (m, g) => (openBlock(), createElementBlock("div", { key: g }, [
2132
+ (openBlock(), createBlock(_sfc_main$2, {
2133
+ key: g,
2134
+ field: m,
2135
+ modelValue: unref(_).get(unref(data), m.property),
2136
+ disabled: isDisable(m),
2137
+ "onUpdate:modelValue": (y) => onUpdateProperty(m.property, y),
2138
+ "onUpdate:file": async (y, v) => {
2139
+ const h = await onUpdateFile(y, v);
2140
+ onUpdateProperty(m.property, h || "");
2141
+ },
2142
+ schema: unref(ZodHelper).typeAtPath(
2143
+ unref(schema),
2144
+ m.property,
2145
+ unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
2146
+ ),
2147
+ "helper-state": unref(ZodHelper).helperState(unref(errors), m.property),
2148
+ "helper-text": unref(ZodHelper).helperText(unref(errors), m.property),
2149
+ extras: m.extras != null ? m.extras == "" ? unref(data) : unref(_).get(unref(data), m.extras) : void 0
2150
+ }, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
2151
+ ]))), 128))
2152
+ ]))), 128)),
2153
+ createElementVNode("div", _hoisted_8, [
2154
+ createVNode(a, {
2155
+ label: "Back",
2156
+ variant: "tertiary",
2157
+ disabled: unref(currentStep) == 1,
2158
+ onClick: d[5] || (d[5] = (l) => currentStep.value--)
2159
+ }, null, 8, ["disabled"]),
2160
+ createVNode(a, {
2161
+ disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
2162
+ label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
2163
+ onClick: d[6] || (d[6] = (l) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
2164
+ }, null, 8, ["disabled", "label"])
2165
+ ])
2166
+ ]),
2167
+ createVNode(_sfc_main$1, {
2168
+ data: unref(data),
2169
+ class: "xs:hidden"
2170
+ }, null, 8, ["data"])
2171
+ ])
2172
+ ])) : createCommentVNode("", !0)
2173
+ ]),
2174
+ key: "0"
2175
+ }
2176
+ ]), 1032, ["modelValue"]);
2177
+ };
2178
+ }
2179
+ });
2180
+ export {
2181
+ _sfc_main as _
2182
+ };