@feedmepos/mf-connect 0.1.0-beta.15 → 0.1.0-beta.17

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