@feedmepos/mf-connect 0.0.16-beta.10 → 0.0.16-beta.11

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 (86) hide show
  1. package/dist/{Analytic-BVk0jPDU.js → Analytic-Gq7PoNer.js} +32 -20
  2. package/dist/{App-BbAalq1k.js → App-Cikl5jnp.js} +33 -27
  3. package/dist/Broadcast-DU3JnBwZ.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DiU3MnH0.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D0I8IZIR.js} +18 -11
  5. package/dist/Card-hIeQ5XUH.js +825 -0
  6. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  7. package/dist/Collections-B1SC1rr7.js +453 -0
  8. package/dist/{Credit-Bc9EzdsC.js → Credit-BgwI8DR3.js} +78 -69
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D9VR3P2d.js +2788 -0
  10. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DPgu45MD.js +344 -0
  11. package/dist/{Experience-CgKak5ik.js → Experience-C2Q-zqV6.js} +64 -55
  12. package/dist/{Game-QhfKqrN_.js → Game-DU2pZDGk.js} +54 -45
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  14. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  15. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  16. package/dist/MainLayout-B1aJoR95.js +41 -0
  17. package/dist/{Marketing-CSx4N7UJ.js → Marketing-DWiTQp9I.js} +79 -72
  18. package/dist/{Member-CY6WMD8D.js → Member-BEXKBFry.js} +25 -22
  19. package/dist/{MemberList-8iRwm7Sz.js → MemberList-DzMdajIf.js} +321 -307
  20. package/dist/{MemberTransactions-CknqkWO3.js → MemberTransactions-Bciankuu.js} +1 -1
  21. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DH25Hfk3.js +432 -0
  22. package/dist/{Mission-BTy1p7lU.js → Mission-KzwRlaA5.js} +50 -40
  23. package/dist/{Point-A6B_ggSy.js → Point-CSKvZXHc.js} +67 -58
  24. package/dist/Promotion-IiwPhx8p.js +221 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-4zIO3oCr.js +1751 -0
  26. package/dist/{Segment-CFVXtyEj.js → Segment-2Q0PonBb.js} +145 -130
  27. package/dist/{Setting-Jmtw-_DV.js → Setting-Df5vVRt4.js} +167 -154
  28. package/dist/{Store-DQypT-7e.js → Store-C0WXCKs6.js} +504 -489
  29. package/dist/{StoreRewards-M-utm0iI.js → StoreRewards-eSSIO0nk.js} +124 -108
  30. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-B60mQ5kq.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BjnCRKGX.js} +131 -123
  31. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-b0xTcoEp.js +139 -0
  32. package/dist/{Tier-D1jymeLK.js → Tier-v-1FkRU-.js} +144 -125
  33. package/dist/{Title-DN9DIP2k.js → Title-CQ2JWqBW.js} +107 -90
  34. package/dist/{Transaction-BAJvAoU6.js → Transaction-0OouN_6s.js} +2 -2
  35. package/dist/Voucher-CL0cgogx.js +488 -0
  36. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js +55 -0
  37. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  38. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  39. package/dist/app-Bd19eW7X.js +5381 -0
  40. package/dist/app-CfS25Z66.js +34797 -0
  41. package/dist/app-wDQR6dpb.js +39 -0
  42. package/dist/app.js +2 -1
  43. package/dist/business-dQh3AEot.js +78 -0
  44. package/dist/campaign-BOl8AgKA.js +96 -0
  45. package/dist/campaign-CpzFl8Vr.js +4 -0
  46. package/dist/collection.fn-B_YsXmrP.js +26 -0
  47. package/dist/dto-B8NfyVPG.js +1169 -0
  48. package/dist/effect-C2jCStXO.js +61 -0
  49. package/dist/{export-DjeNY5Pc.js → export-BtZc3Yzh.js} +19 -16
  50. package/dist/helper-8oGsrM56.js +71 -0
  51. package/dist/index-6FkKY3q0.js +73 -0
  52. package/dist/index-C7oeXRUl.js +95 -0
  53. package/dist/index-CZKYIefW.js +203 -0
  54. package/dist/index-C_0IFnwi.js +2071 -0
  55. package/dist/index-CuvNtC_M.js +61 -0
  56. package/dist/index-DCixRRvz.js +761 -0
  57. package/dist/index-DFgt4-VW.js +38 -0
  58. package/dist/index-DYDhH9bi.js +8832 -0
  59. package/dist/index-Dbd4WA4r.js +61 -0
  60. package/dist/index-Di-kWSmf.js +1737 -0
  61. package/dist/index-Dn0jdj0o.js +28058 -0
  62. package/dist/index-DwKqFNF6.js +3 -0
  63. package/dist/index-HoacsZDk.js +291 -0
  64. package/dist/index-UTQHDUdW.js +94 -0
  65. package/dist/loading-D_AN6p24.js +32697 -0
  66. package/dist/lodash-B5I3zXaY.js +3678 -0
  67. package/dist/membership-Ccrx9R6r.js +221 -0
  68. package/dist/moment-BWErdI6_.js +2578 -0
  69. package/dist/money-waD-f-Zz.js +15 -0
  70. package/dist/number-CwTGGsh9.js +12 -0
  71. package/dist/object-qECH92oz.js +26 -0
  72. package/dist/objectId-dwaoBfJX.js +7 -0
  73. package/dist/rule-DJ07h3Gh.js +1973 -0
  74. package/dist/rule-builder-DJ-acvVD.js +89 -0
  75. package/dist/template-clxvNnbF.js +190 -0
  76. package/dist/usePagination-BeF5K3M7.js +223 -0
  77. package/dist/vue-i18n-BxwiXSkp.js +2365 -0
  78. package/dist/xlsx-BB366cdN.js +15491 -0
  79. package/dist/zod-W_PvIofQ.js +90 -0
  80. package/package.json +2 -2
  81. package/dist/Card-B5in1RMa.js +0 -805
  82. package/dist/Collections-CFCZ9YIG.js +0 -4
  83. package/dist/MainLayout-JbHzENFy.js +0 -4
  84. package/dist/app-BpzzygYP.js +0 -87765
  85. package/dist/money-DKGIIplY.js +0 -15
  86. package/dist/number-tPodRxTN.js +0 -12
@@ -0,0 +1,2788 @@
1
+ import { defineComponent, computed, openBlock, createBlock, unref, ref, watch, resolveComponent, createElementBlock, createElementVNode, Fragment, renderList, createVNode, isRef, createCommentVNode, withCtx, normalizeClass, toDisplayString, renderSlot, createTextVNode, resolveDynamicComponent, toRefs, normalizeStyle, createSlots } from "vue";
2
+ import { _ } from "./lodash-B5I3zXaY.js";
3
+ import { z } from "./app-Bd19eW7X.js";
4
+ import { Z as ZodHelper } from "./zod-W_PvIofQ.js";
5
+ import { c as getCampaignSummaryObject, d as campaignRefinement, e as CampaignDtos, C as CampaignOptions, f as campaignTransform } from "./dto-B8NfyVPG.js";
6
+ import { u as useMembershipStore, C as CollectibleOptions } from "./membership-Ccrx9R6r.js";
7
+ import { u as useBusinessStore } from "./business-dQh3AEot.js";
8
+ import { a as FdoEarningOption, b as F_GAME_TYPE, F as FdtoCollectibleConfig } from "./index-DYDhH9bi.js";
9
+ import { i as isRuleGroup, R as RuleBuilder, a as isRuleEntry } from "./rule-builder-DJ-acvVD.js";
10
+ import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
11
+ import { h as hooks } from "./moment-BWErdI6_.js";
12
+ import { b as F_CAMPAIGN_TRIGGER_TYPE, C as CAMPAIGN_TRIGGER, c as FdoCreditLoyaltyReward, d as FdtoRandomReward, e as F_MISSION_TYPE, f as FdtoThresholdReward, g as FdoMission, h as featureVersionMapping } from "./index-DCixRRvz.js";
13
+ import { _ as _sfc_main$v } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
14
+ import { _ as _sfc_main$w, a as _sfc_main$x, b as _sfc_main$z } from "./EffectSheet.vue_vue_type_style_index_0_lang-DPgu45MD.js";
15
+ import { _ as _sfc_main$y } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-b0xTcoEp.js";
16
+ import { _ as _sfc_main$r, a as _sfc_main$s, b as _sfc_main$t } from "./RuleGroup.vue_vue_type_script_setup_true_lang-4zIO3oCr.js";
17
+ import { p as prompt, c as cases, f as firebaseStorage, u as useLoading } from "./loading-D_AN6p24.js";
18
+ import { _ as _sfc_main$q, T as TEMPLATES } from "./index-C_0IFnwi.js";
19
+ import { _ as _sfc_main$A } from "./MessageInput.vue_vue_type_script_setup_true_lang-DH25Hfk3.js";
20
+ import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-DJ07h3Gh.js";
21
+ import { c as core, S as SvcConfig } from "./index-Dn0jdj0o.js";
22
+ import "./index-CZKYIefW.js";
23
+ import "./index-Di-kWSmf.js";
24
+ import "./index-HoacsZDk.js";
25
+ import "./index-DFgt4-VW.js";
26
+ import { useCoreStore } from "@feedmepos/mf-common";
27
+ import { _ as _sfc_main$u } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js";
28
+ import { u as useI18n } from "./vue-i18n-BxwiXSkp.js";
29
+ import { i as initCollectibleConfig } from "./helper-8oGsrM56.js";
30
+ import { C as CollectionUtils } from "./collection.fn-B_YsXmrP.js";
31
+ import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
32
+ import { useDialog } from "@feedmepos/ui-library";
33
+ import { a as cleanPF } from "./object-qECH92oz.js";
34
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
35
+ __name: "SegmentConfigurator",
36
+ props: {
37
+ modelValue: {
38
+ type: Object,
39
+ required: !0
40
+ }
41
+ },
42
+ emits: ["update:model-value"],
43
+ setup(e, { emit: m }) {
44
+ const r = e, u = computed(() => {
45
+ var l;
46
+ const [i] = isRuleGroup(r.modelValue) ? Object.values(((l = r.modelValue) == null ? void 0 : l.rules) ?? {}) : [null];
47
+ return (i ?? RuleBuilder.constructEntry("user.segment", "_hasAny", [])).conditions._hasAny;
48
+ }), a = m;
49
+ return (i, o) => (openBlock(), createBlock(_sfc_main$q, {
50
+ multiselect: !0,
51
+ items: unref(useMembershipStore)().segmentOptions,
52
+ "model-value": unref(u),
53
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => a(
54
+ "update:model-value",
55
+ unref(RuleBuilder).setRuleToGroup(
56
+ unref(RuleBuilder).scaffoldGroup("g_segment"),
57
+ unref(RuleBuilder).constructEntry("user.segment", "_hasAny", l)
58
+ )
59
+ )),
60
+ label: "Select segment(s) to match"
61
+ }, null, 8, ["items", "model-value"]));
62
+ }
63
+ }), _hoisted_1$k = { class: "space-y-16" }, _hoisted_2$e = { key: 0 }, _sfc_main$o = /* @__PURE__ */ defineComponent({
64
+ __name: "UserRuleGroup",
65
+ props: {
66
+ modelValue: {
67
+ type: Object,
68
+ default: () => {
69
+ }
70
+ }
71
+ },
72
+ emits: ["update:model-value"],
73
+ setup(e, { emit: m }) {
74
+ const r = e, u = m, a = ref(
75
+ r.modelValue ? RuleBuilder.getRules(r.modelValue.rules.g_user).length > 0 ? "custom" : RuleBuilder.getRules(r.modelValue.rules.g_segment).length > 0 ? "segment" : "all_users" : "all_users"
76
+ ), i = [
77
+ {
78
+ value: "all_users",
79
+ label: "All audience"
80
+ },
81
+ {
82
+ value: "segment",
83
+ label: "Member segment"
84
+ },
85
+ {
86
+ value: "custom",
87
+ label: "Custom audience"
88
+ }
89
+ ];
90
+ return watch(a, async (o, l) => {
91
+ var n;
92
+ if (l != "all_users" && l != o && RuleBuilder.getRules(
93
+ (n = r.modelValue) == null ? void 0 : n.rules[l == "custom" ? "g_user" : "g_segment"]
94
+ ).length > 0) {
95
+ const c = await prompt.confirm(
96
+ "Are you sure you want to change the audience type? This will remove all the rules you have set."
97
+ );
98
+ c && u(
99
+ "update:model-value",
100
+ RuleBuilder.setRuleToGroup(
101
+ r.modelValue ?? RuleBuilder.scaffoldGroup(),
102
+ RuleBuilder.scaffoldGroup(l == "custom" ? "g_user" : "g_segment")
103
+ )
104
+ ), a.value = c ? o : l;
105
+ }
106
+ }), (o, l) => {
107
+ var c, v;
108
+ const n = resolveComponent("FmRadio");
109
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
110
+ createElementVNode("div", null, [
111
+ (openBlock(), createElementBlock(Fragment, null, renderList(i, (p) => createVNode(n, {
112
+ key: p.value,
113
+ value: p.value,
114
+ label: p.label,
115
+ modelValue: unref(a),
116
+ "onUpdate:modelValue": l[0] || (l[0] = (g) => isRef(a) ? a.value = g : null)
117
+ }, null, 8, ["value", "label", "modelValue"])), 64))
118
+ ]),
119
+ unref(a) == "segment" ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
120
+ createVNode(_sfc_main$p, {
121
+ modelValue: ((c = e.modelValue) == null ? void 0 : c.rules.g_segment) ?? unref(RuleBuilder).scaffoldGroup("g_segment"),
122
+ "onUpdate:modelValue": l[1] || (l[1] = (p) => u(
123
+ "update:model-value",
124
+ unref(RuleBuilder).setRuleToGroup(
125
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
126
+ p,
127
+ "&&"
128
+ )
129
+ ))
130
+ }, null, 8, ["modelValue"])
131
+ ])) : createCommentVNode("", !0),
132
+ unref(a) == "custom" ? (openBlock(), createBlock(_sfc_main$r, {
133
+ key: 1,
134
+ "include-only": "user",
135
+ "trigger-type": "MEMBERSHIP_JOINED",
136
+ "model-value": ((v = e.modelValue) == null ? void 0 : v.rules.g_user) ?? unref(RuleBuilder).scaffoldGroup("g_user"),
137
+ "onUpdate:modelValue": l[2] || (l[2] = (p) => u(
138
+ "update:model-value",
139
+ unref(RuleBuilder).setRuleToGroup(
140
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
141
+ p,
142
+ "&&"
143
+ )
144
+ ))
145
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0)
146
+ ]);
147
+ };
148
+ }
149
+ }), _hoisted_1$j = { class: "space-y-24" }, _sfc_main$n = /* @__PURE__ */ defineComponent({
150
+ __name: "TimeRuleGroup",
151
+ props: {
152
+ modelValue: {
153
+ type: Object,
154
+ default: () => {
155
+ }
156
+ }
157
+ },
158
+ emits: ["update:model-value"],
159
+ setup(e, { emit: m }) {
160
+ const r = e, u = m, a = ref(
161
+ !r.modelValue || !r.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(r.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
162
+ );
163
+ watch(a, async (o, l) => {
164
+ var n;
165
+ if (l == "custom" && o == "all_time" && RuleBuilder.getRules((n = r.modelValue) == null ? void 0 : n.rules.g_time).length > 0) {
166
+ const c = await prompt.confirm(
167
+ "Are you sure you want to turn off custom conditons? This will remove all the rules you have set."
168
+ );
169
+ c && u(
170
+ "update:model-value",
171
+ RuleBuilder.setRuleToGroup(
172
+ r.modelValue ?? RuleBuilder.scaffoldGroup(),
173
+ RuleBuilder.scaffoldGroup("g_time")
174
+ )
175
+ ), a.value = c ? o : l;
176
+ }
177
+ });
178
+ async function i(o) {
179
+ var l;
180
+ if (o == "custom" && RuleBuilder.getRules((l = r.modelValue) == null ? void 0 : l.rules.g_time).length > 0) {
181
+ if (!await prompt.confirm(
182
+ "Are you sure you want to turn off custom conditons? This will remove all the rules you have set."
183
+ )) {
184
+ a.value = "all_time";
185
+ return;
186
+ }
187
+ u(
188
+ "update:model-value",
189
+ RuleBuilder.setRuleToGroup(
190
+ r.modelValue ?? RuleBuilder.scaffoldGroup(),
191
+ RuleBuilder.scaffoldGroup("g_time")
192
+ )
193
+ );
194
+ }
195
+ }
196
+ return (o, l) => {
197
+ var v;
198
+ const n = resolveComponent("FmRadio"), c = resolveComponent("FmRadioGroup");
199
+ return openBlock(), createElementBlock("div", _hoisted_1$j, [
200
+ createVNode(c, {
201
+ modelValue: unref(a),
202
+ "onUpdate:modelValue": [
203
+ l[0] || (l[0] = (p) => isRef(a) ? a.value = p : null),
204
+ l[1] || (l[1] = (p) => i(p))
205
+ ]
206
+ }, {
207
+ default: withCtx(() => [
208
+ createVNode(n, {
209
+ label: "All time",
210
+ value: "all_time"
211
+ }),
212
+ createVNode(n, {
213
+ label: "Custom date/time",
214
+ value: "custom"
215
+ })
216
+ ]),
217
+ _: 1
218
+ }, 8, ["modelValue"]),
219
+ unref(a) == "custom" ? (openBlock(), createBlock(_sfc_main$r, {
220
+ key: 0,
221
+ class: "!mt-[0px]",
222
+ "include-only": "trigger",
223
+ "trigger-type": "SCHEDULE",
224
+ "model-value": ((v = e.modelValue) == null ? void 0 : v.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
225
+ "onUpdate:modelValue": l[2] || (l[2] = (p) => u(
226
+ "update:model-value",
227
+ unref(RuleBuilder).setRuleToGroup(
228
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
229
+ p,
230
+ "&&"
231
+ )
232
+ ))
233
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0)
234
+ ]);
235
+ };
236
+ }
237
+ }), _sfc_main$m = /* @__PURE__ */ defineComponent({
238
+ __name: "BillRuleGroup",
239
+ props: {
240
+ modelValue: {
241
+ type: Object,
242
+ default: () => {
243
+ }
244
+ }
245
+ },
246
+ emits: ["update:model-value"],
247
+ setup(e, { emit: m }) {
248
+ const r = m;
249
+ return (u, a) => {
250
+ var i;
251
+ return openBlock(), createBlock(_sfc_main$r, {
252
+ "include-only": "bill",
253
+ "trigger-type": "BILL_COMPLETED",
254
+ "model-value": ((i = e.modelValue) == null ? void 0 : i.rules.g_bill) ?? unref(RuleBuilder).scaffoldGroup("g_bill"),
255
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => r(
256
+ "update:model-value",
257
+ unref(RuleBuilder).setRuleToGroup(
258
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
259
+ o,
260
+ "&&"
261
+ )
262
+ ))
263
+ }, null, 8, ["model-value"]);
264
+ };
265
+ }
266
+ }), _sfc_main$l = /* @__PURE__ */ defineComponent({
267
+ __name: "BirthdayInput",
268
+ props: {
269
+ modelValue: {
270
+ type: Object
271
+ }
272
+ },
273
+ emits: ["update:model-value"],
274
+ setup(e, { emit: m }) {
275
+ const r = e, u = m, a = computed(() => {
276
+ const { property: i, operator: o, equator: l } = RuleBuilder.simplify(
277
+ r.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
278
+ op: "before",
279
+ x: 1
280
+ })
281
+ );
282
+ return {
283
+ property: i,
284
+ operator: o,
285
+ equator: l
286
+ };
287
+ });
288
+ return (i, o) => {
289
+ const l = resolveComponent("FmRadio"), n = resolveComponent("FmStepperField");
290
+ return openBlock(), createElementBlock("div", null, [
291
+ createVNode(l, {
292
+ label: "On birthday",
293
+ value: "_isRange-day",
294
+ "model-value": `${unref(a).operator}-${unref(a).equator.unit}`,
295
+ "onUpdate:modelValue": o[0] || (o[0] = () => {
296
+ u(
297
+ "update:model-value",
298
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
299
+ op: "this",
300
+ unit: "day",
301
+ ignoreYear: !0
302
+ })
303
+ );
304
+ })
305
+ }, null, 8, ["model-value"]),
306
+ createVNode(l, {
307
+ label: "N days before birthday",
308
+ value: "_isDay",
309
+ "model-value": unref(a).operator,
310
+ "onUpdate:modelValue": o[1] || (o[1] = () => {
311
+ u(
312
+ "update:model-value",
313
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
314
+ op: "after",
315
+ x: 1,
316
+ ignoreYear: !0
317
+ })
318
+ );
319
+ })
320
+ }, null, 8, ["model-value"]),
321
+ unref(a).operator == "_isDay" ? (openBlock(), createBlock(n, {
322
+ key: 0,
323
+ label: "Days before birthday",
324
+ "show-steppers": !1,
325
+ "model-value": unref(a).equator.x,
326
+ "onUpdate:modelValue": o[2] || (o[2] = (c) => u(
327
+ "update:model-value",
328
+ unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
329
+ op: "after",
330
+ x: c,
331
+ ignoreYear: !0
332
+ })
333
+ ))
334
+ }, null, 8, ["model-value"])) : createCommentVNode("", !0),
335
+ createVNode(l, {
336
+ label: "In birthday week",
337
+ value: "_isRange-week",
338
+ "model-value": `${unref(a).operator}-${unref(a).equator.unit}`,
339
+ "onUpdate:modelValue": o[3] || (o[3] = () => {
340
+ u(
341
+ "update:model-value",
342
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
343
+ op: "this",
344
+ unit: "week",
345
+ ignoreYear: !0
346
+ })
347
+ );
348
+ })
349
+ }, null, 8, ["model-value"]),
350
+ createVNode(l, {
351
+ label: "In birthday month",
352
+ value: "_isRange-month",
353
+ "model-value": `${unref(a).operator}-${unref(a).equator.unit}`,
354
+ "onUpdate:modelValue": o[4] || (o[4] = () => {
355
+ u(
356
+ "update:model-value",
357
+ unref(RuleBuilder).constructEntry("user.birthday", "_isRange", {
358
+ op: "this",
359
+ unit: "month",
360
+ ignoreYear: !0
361
+ })
362
+ );
363
+ })
364
+ }, null, 8, ["model-value"])
365
+ ]);
366
+ };
367
+ }
368
+ }), _sfc_main$k = /* @__PURE__ */ defineComponent({
369
+ __name: "FeedbackRuleGroup",
370
+ props: {
371
+ modelValue: {
372
+ type: Object,
373
+ default: () => {
374
+ }
375
+ }
376
+ },
377
+ emits: ["update:model-value"],
378
+ setup(e, { emit: m }) {
379
+ const r = m;
380
+ return (u, a) => {
381
+ var i;
382
+ return openBlock(), createBlock(_sfc_main$r, {
383
+ "include-only": "feedback",
384
+ "trigger-type": "FEEDBACK",
385
+ "model-value": ((i = e.modelValue) == null ? void 0 : i.rules.g_feedback) ?? unref(RuleBuilder).scaffoldGroup("g_feedback"),
386
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => r(
387
+ "update:model-value",
388
+ unref(RuleBuilder).setRuleToGroup(
389
+ e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
390
+ o,
391
+ "&&"
392
+ )
393
+ ))
394
+ }, null, 8, ["model-value"]);
395
+ };
396
+ }
397
+ }), TriggerOptions = {
398
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.BILL_COMPLETED]: {
399
+ name: "Bill complete",
400
+ description: "Reward customers upon the completion of their bill.",
401
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.BILL_COMPLETED,
402
+ hidden: !1
403
+ },
404
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.FEEDBACK]: {
405
+ name: "Feedback",
406
+ description: "Reward customers for providing feedback.",
407
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.FEEDBACK,
408
+ hidden: !1
409
+ },
410
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.GAME_COMPLETED]: {
411
+ name: "Game complete",
412
+ description: "Reward customers upon the completion of a game.",
413
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.GAME_COMPLETED,
414
+ hidden: !1
415
+ },
416
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.MAKING_ORDER]: {
417
+ name: "Making order",
418
+ description: "Reward customers upon the creation of their order.",
419
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.MAKING_ORDER,
420
+ hidden: !1
421
+ },
422
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.MEMBERSHIP_JOINED]: {
423
+ name: "Member joined ",
424
+ description: "Trigger rewards when customers join your membership program.",
425
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.MEMBERSHIP_JOINED,
426
+ hidden: !1
427
+ },
428
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.SCHEDULE]: {
429
+ name: "Schedule",
430
+ description: "Set rewards to be triggered at specific times or dates.",
431
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.SCHEDULE,
432
+ hidden: !1
433
+ },
434
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.SIMPLE_CLAIM]: {
435
+ name: "Simple claim",
436
+ description: "Activate rewards when customers claim an offer",
437
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.SIMPLE_CLAIM,
438
+ hidden: !1
439
+ },
440
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.TIER_UPGRADED]: {
441
+ name: "Tier upgrade",
442
+ description: "Activate rewards when their membership tier gets upgraded.",
443
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.TIER_UPGRADED,
444
+ hidden: !1
445
+ },
446
+ [F_CAMPAIGN_TRIGGER_TYPE.enum.ISSUE_REWARD]: {
447
+ name: "Issue reward",
448
+ description: "Triggers whenever customer receives a reward in any kind.",
449
+ value: F_CAMPAIGN_TRIGGER_TYPE.enum.ISSUE_REWARD,
450
+ hidden: !0
451
+ }
452
+ }, TypeToTriggerOptions = Object.fromEntries(
453
+ [
454
+ "VOUCHER",
455
+ "PROMOTION",
456
+ "POINT",
457
+ "CREDIT",
458
+ "MEMBERSHIP",
459
+ "BROADCAST",
460
+ "COIN",
461
+ "REWARD_POOL",
462
+ "GAME",
463
+ "MISSION"
464
+ ].map((e) => {
465
+ const m = CAMPAIGN_TRIGGER[e];
466
+ return [
467
+ e,
468
+ (m == null ? void 0 : m.map((r) => TriggerOptions[r]).filter((r) => !r.hidden)) ?? []
469
+ ];
470
+ })
471
+ ), _hoisted_1$i = { class: "space-y-16" }, _hoisted_2$d = { class: "grid grid-cols-3 gap-16" }, _hoisted_3$b = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$8 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _sfc_main$j = /* @__PURE__ */ defineComponent({
472
+ __name: "CampaignTriggerInput",
473
+ props: {
474
+ campaignType: {
475
+ type: String,
476
+ required: !0
477
+ },
478
+ modelValue: {
479
+ type: String
480
+ },
481
+ disabled: {
482
+ type: Boolean,
483
+ default: !1
484
+ }
485
+ },
486
+ emits: ["update:model-value"],
487
+ setup(e, { emit: m }) {
488
+ const r = e, u = m, a = computed(() => r.disabled ? TypeToTriggerOptions[r.campaignType].filter(
489
+ (i) => i.value == r.modelValue
490
+ ) : TypeToTriggerOptions[r.campaignType]);
491
+ return (i, o) => {
492
+ const l = resolveComponent("FmCard");
493
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
494
+ 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)),
495
+ createElementVNode("div", _hoisted_2$d, [
496
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (n) => (openBlock(), createBlock(l, {
497
+ variant: "outlined",
498
+ disabled: r.disabled,
499
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
500
+ "col-span-3": unref(a).length == 1,
501
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
502
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
503
+ }]),
504
+ onClick: () => {
505
+ r.modelValue != n.value && !r.disabled && u("update:model-value", n.value);
506
+ },
507
+ key: n.name
508
+ }, {
509
+ default: withCtx(() => [
510
+ createElementVNode("div", _hoisted_3$b, toDisplayString(n.name), 1),
511
+ createElementVNode("div", _hoisted_4$8, toDisplayString(n.description), 1)
512
+ ]),
513
+ _: 2
514
+ }, 1032, ["disabled", "class", "onClick"]))), 128))
515
+ ])
516
+ ]);
517
+ };
518
+ }
519
+ }), _sfc_main$i = /* @__PURE__ */ defineComponent({
520
+ __name: "DateInput",
521
+ props: {
522
+ label: {
523
+ type: String,
524
+ required: !1
525
+ },
526
+ modelValue: {
527
+ type: Object,
528
+ required: !1
529
+ }
530
+ },
531
+ emits: ["update:model-value"],
532
+ setup(e, { emit: m }) {
533
+ const r = m;
534
+ return (u, a) => {
535
+ const i = resolveComponent("FmButton"), o = resolveComponent("FmField"), l = resolveComponent("FmDatePicker");
536
+ return openBlock(), createBlock(l, {
537
+ label: e.label,
538
+ "model-value": e.modelValue || "",
539
+ "onUpdate:modelValue": a[1] || (a[1] = (n) => r("update:model-value", n))
540
+ }, {
541
+ "trigger-button": withCtx(({ opened: n }) => [
542
+ createVNode(o, {
543
+ class: "flex items-center",
544
+ "prepend-icon": "calendar_month",
545
+ "icon-outlined": !n
546
+ }, {
547
+ append: withCtx(() => [
548
+ e.modelValue ? (openBlock(), createBlock(i, {
549
+ key: 0,
550
+ variant: "tertiary",
551
+ icon: "clear",
552
+ onClick: a[0] || (a[0] = (c) => (c.stopPropagation(), r("update:model-value", null)))
553
+ })) : createCommentVNode("", !0)
554
+ ]),
555
+ default: withCtx(() => [
556
+ createElementVNode("div", {
557
+ class: normalizeClass(["fm-typo-en-body-lg-400", { "text-fm-color-typo-secondary": !e.modelValue }])
558
+ }, toDisplayString(e.modelValue ? unref(hooks)(e.modelValue).format("DD MMM YYYY") : "DD MM YYYY"), 3)
559
+ ]),
560
+ _: 2
561
+ }, 1032, ["icon-outlined"])
562
+ ]),
563
+ _: 1
564
+ }, 8, ["label", "model-value"]);
565
+ };
566
+ }
567
+ }), _hoisted_1$h = { class: "flex items-center gap-8 w-full xs:flex-col" }, _hoisted_2$c = { class: "flex-1 xs:w-full" }, _hoisted_3$a = { class: "flex-1 xs:w-full" }, _sfc_main$h = /* @__PURE__ */ defineComponent({
568
+ __name: "DateRangeInput",
569
+ props: {
570
+ modelValue: {
571
+ type: Object,
572
+ required: !1
573
+ }
574
+ },
575
+ emits: ["update:model-value"],
576
+ setup(e, { emit: m }) {
577
+ const r = m;
578
+ return (u, a) => {
579
+ var i, o;
580
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
581
+ createElementVNode("div", _hoisted_2$c, [
582
+ createVNode(_sfc_main$i, {
583
+ "model-value": ((i = e.modelValue) == null ? void 0 : i.startDate) ?? null,
584
+ label: "Start date",
585
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => {
586
+ var n;
587
+ return r("update:model-value", {
588
+ startDate: l,
589
+ endDate: ((n = e.modelValue) == null ? void 0 : n.endDate) ?? null
590
+ });
591
+ })
592
+ }, null, 8, ["model-value"])
593
+ ]),
594
+ a[2] || (a[2] = createElementVNode("div", { class: "mt-5 xs:hidden" }, "to", -1)),
595
+ createElementVNode("div", _hoisted_3$a, [
596
+ createVNode(_sfc_main$i, {
597
+ "model-value": ((o = e.modelValue) == null ? void 0 : o.endDate) ?? null,
598
+ label: "End date",
599
+ "onUpdate:modelValue": a[1] || (a[1] = (l) => {
600
+ var n;
601
+ return r("update:model-value", {
602
+ startDate: ((n = e.modelValue) == null ? void 0 : n.startDate) ?? null,
603
+ endDate: l
604
+ });
605
+ })
606
+ }, null, 8, ["model-value"])
607
+ ])
608
+ ]);
609
+ };
610
+ }
611
+ }), _hoisted_1$g = { class: "space-y-8" }, _hoisted_2$b = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$9 = {
612
+ key: 0,
613
+ class: "space-y-4"
614
+ }, _hoisted_4$7 = { class: "fm-typo-en-body-lg-400 class flex items-center justify-between" }, _hoisted_5$4 = { class: "text-ellipsis line-clamp-1" }, _sfc_main$g = /* @__PURE__ */ defineComponent({
615
+ __name: "ScheduleRuleInput",
616
+ props: {
617
+ modelValue: {
618
+ type: Object,
619
+ required: !0
620
+ },
621
+ startDate: {
622
+ type: String
623
+ },
624
+ endDate: {
625
+ type: String
626
+ }
627
+ },
628
+ emits: ["update:model-value"],
629
+ setup(e, { emit: m }) {
630
+ const r = e, u = m;
631
+ function a() {
632
+ const p = RuleBuilder.getRules(r.modelValue);
633
+ return p.length == 0 ? "fixed" : p.some(
634
+ (g) => isRuleEntry(g) && RuleBuilder.simplify(g).operator == "_rrule"
635
+ ) ? "repeating" : "fixed";
636
+ }
637
+ const i = ref(a()), o = ref(!1), l = computed(() => {
638
+ const p = RuleBuilder.getRules(r.modelValue), g = p.find(
639
+ (s) => isRuleEntry(s) && RuleBuilder.simplify(s).property == "trigger.date"
640
+ ), h = p.find(
641
+ (s) => isRuleEntry(s) && RuleBuilder.simplify(s).property == "trigger.time"
642
+ );
643
+ return {
644
+ date: g ? RuleBuilder.simplify(g).equator : null,
645
+ time: h ? RuleBuilder.simplify(h).equator : null
646
+ };
647
+ }), n = computed(
648
+ () => calculateNextScheduleAt(
649
+ r.modelValue,
650
+ /* @__PURE__ */ new Date(),
651
+ r.startDate ? new Date(r.startDate) : void 0,
652
+ r.endDate ? new Date(r.endDate) : void 0
653
+ )
654
+ );
655
+ function c(p) {
656
+ const g = p.label.toLowerCase(), h = g == "fixed" ? [
657
+ RuleBuilder.constructEntry(
658
+ "trigger.date",
659
+ "_isOnDate",
660
+ (/* @__PURE__ */ new Date()).toISOString()
661
+ ),
662
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
663
+ ] : [
664
+ RuleBuilder.constructEntry(
665
+ "trigger.date",
666
+ "_rrule",
667
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
668
+ ),
669
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
670
+ ];
671
+ u(
672
+ "update:model-value",
673
+ RuleBuilder.setRuleToGroup(
674
+ RuleBuilder.scaffoldGroup("g_schedule"),
675
+ h
676
+ )
677
+ ), i.value = g;
678
+ }
679
+ function v(p) {
680
+ i.value == "fixed" ? u(
681
+ "update:model-value",
682
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
683
+ RuleBuilder.constructEntry(
684
+ "trigger.date",
685
+ "_isOnDate",
686
+ p.date
687
+ ),
688
+ RuleBuilder.constructEntry(
689
+ "trigger.time",
690
+ "_isOnTime",
691
+ p.time
692
+ )
693
+ ])
694
+ ) : u(
695
+ "update:model-value",
696
+ RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
697
+ RuleBuilder.constructEntry(
698
+ "trigger.date",
699
+ "_rrule",
700
+ p.date
701
+ ),
702
+ RuleBuilder.constructEntry(
703
+ "trigger.time",
704
+ "_isOnTime",
705
+ p.time
706
+ )
707
+ ])
708
+ );
709
+ }
710
+ return (p, g) => {
711
+ const h = resolveComponent("FmButtonGroup"), s = resolveComponent("FmTimePicker"), d = resolveComponent("FmIcon"), f = resolveComponent("FmTooltip"), y = resolveComponent("FmField"), C = resolveComponent("FmCard"), E = resolveComponent("FmPopover"), k = resolveComponent("FmDatePicker"), B = resolveComponent("FmHelperText");
712
+ return openBlock(), createElementBlock(Fragment, null, [
713
+ createVNode(h, {
714
+ items: [{ label: "Fixed" }, { label: "Repeating" }],
715
+ "model-value": { label: unref(cases).title(unref(i)) },
716
+ "onUpdate:modelValue": c,
717
+ class: "mb-8"
718
+ }, null, 8, ["model-value"]),
719
+ createElementVNode("div", _hoisted_1$g, [
720
+ createElementVNode("div", _hoisted_2$b, [
721
+ createVNode(s, {
722
+ label: "Notify time",
723
+ "model-value": unref(l).time,
724
+ "onUpdate:modelValue": g[0] || (g[0] = (x) => v({ date: unref(l).date, time: x })),
725
+ "helper-text": unref(l).time ? void 0 : "Time is required",
726
+ "helper-state": unref(l).time ? void 0 : "error"
727
+ }, null, 8, ["model-value", "helper-text", "helper-state"]),
728
+ unref(i) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
729
+ createElementVNode("div", _hoisted_4$7, [
730
+ g[5] || (g[5] = createElementVNode("div", null, "Notify date", -1)),
731
+ unref(l).date ? (openBlock(), createBlock(f, {
732
+ key: 0,
733
+ "z-index": 9999,
734
+ content: unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options)
735
+ }, {
736
+ default: withCtx(() => [
737
+ createVNode(d, {
738
+ name: "info",
739
+ size: "sm",
740
+ outline: !0
741
+ })
742
+ ]),
743
+ _: 1
744
+ }, 8, ["content"])) : createCommentVNode("", !0)
745
+ ]),
746
+ createVNode(E, {
747
+ "show-popover": unref(o),
748
+ onPopoverChanged: g[3] || (g[3] = (x) => o.value = x)
749
+ }, {
750
+ "popover-button": withCtx(() => [
751
+ createVNode(y, {
752
+ class: "cursor-pointer",
753
+ "helper-text": unref(l).date ? void 0 : "Date is required",
754
+ "helper-state": unref(l).date ? void 0 : "error"
755
+ }, {
756
+ default: withCtx(() => [
757
+ createElementVNode("div", _hoisted_5$4, toDisplayString(unref(l).date ? unref(SummarizeRrule)(unref(RRule).fromString(unref(l).date).options) : "Set a repeating date"), 1)
758
+ ]),
759
+ _: 1
760
+ }, 8, ["helper-text", "helper-state"])
761
+ ]),
762
+ default: withCtx(() => [
763
+ createVNode(C, { class: "elevated p-8 w-[450px]" }, {
764
+ default: withCtx(() => [
765
+ createVNode(_sfc_main$s, {
766
+ "apply-button": !0,
767
+ "model-value": unref(l).date || "",
768
+ onCancel: g[1] || (g[1] = (x) => o.value = !1),
769
+ "onUpdate:modelValue": g[2] || (g[2] = (x) => (v({ date: x, time: unref(l).time }), o.value = !1))
770
+ }, null, 8, ["model-value"])
771
+ ]),
772
+ _: 1
773
+ })
774
+ ]),
775
+ _: 1
776
+ }, 8, ["show-popover"])
777
+ ])) : (openBlock(), createBlock(k, {
778
+ key: 1,
779
+ label: "Notify date",
780
+ "model-value": unref(l).date || "",
781
+ "onUpdate:modelValue": g[4] || (g[4] = (x) => v({ date: x, time: unref(l).time })),
782
+ "helper-text": unref(l).date ? void 0 : "Date is required",
783
+ "helper-state": unref(l).date ? void 0 : "error"
784
+ }, null, 8, ["model-value", "helper-text", "helper-state"]))
785
+ ]),
786
+ unref(l).date && unref(l).time && unref(n) ? (openBlock(), createBlock(B, {
787
+ key: 0,
788
+ 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
789
+ ${unref(hooks)(unref(n)).format("hh:mmA")} (${unref(hooks)(unref(n)).fromNow()})`
790
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
791
+ ])
792
+ ], 64);
793
+ };
794
+ }
795
+ }), _hoisted_1$f = { class: "flex justify-end gap-8 w-full" }, _sfc_main$f = /* @__PURE__ */ defineComponent({
796
+ __name: "MenuSheet",
797
+ props: {
798
+ modelValue: {},
799
+ filterItems: { type: Function }
800
+ },
801
+ emits: ["confirm"],
802
+ setup(e, { emit: m }) {
803
+ const r = ref(), u = ref(!1);
804
+ function a() {
805
+ var o;
806
+ (o = r.value) == null || o.onConfirm();
807
+ }
808
+ const i = m;
809
+ return (o, l) => {
810
+ const n = resolveComponent("FmField"), c = resolveComponent("FmButton"), v = resolveComponent("FmSideSheet");
811
+ return openBlock(), createBlock(v, {
812
+ modelValue: u.value,
813
+ "onUpdate:modelValue": l[1] || (l[1] = (p) => u.value = p),
814
+ title: "Select Items",
815
+ "close-button": !1,
816
+ "dismiss-away": !0,
817
+ "max-width": 560
818
+ }, {
819
+ "side-sheet-button": withCtx(() => [
820
+ renderSlot(o.$slots, "side-sheet-button", {}, () => [
821
+ createVNode(n, { class: "text-fm-color-typo-tertiary cursor-pointer" }, {
822
+ default: withCtx(() => [
823
+ createTextVNode(toDisplayString(o.modelValue.length) + " item(s) selected ", 1)
824
+ ]),
825
+ _: 1
826
+ })
827
+ ])
828
+ ]),
829
+ "side-sheet-footer": withCtx(() => [
830
+ createElementVNode("div", _hoisted_1$f, [
831
+ createVNode(c, {
832
+ variant: "tertiary",
833
+ onClick: l[0] || (l[0] = (p) => u.value = !1),
834
+ label: "Cancel"
835
+ }),
836
+ createVNode(c, {
837
+ variant: "primary",
838
+ onClick: a,
839
+ label: "Confirm"
840
+ })
841
+ ])
842
+ ]),
843
+ default: withCtx(() => [
844
+ createVNode(_sfc_main$t, {
845
+ class: "h-full",
846
+ "max-height": 0,
847
+ ref_key: "selectItemRef",
848
+ ref: r,
849
+ "initial-value": o.modelValue,
850
+ "filter-items": o.filterItems,
851
+ "on-complete": (p) => {
852
+ i("confirm", p), u.value = !1;
853
+ }
854
+ }, null, 8, ["initial-value", "filter-items", "on-complete"])
855
+ ]),
856
+ _: 3
857
+ }, 8, ["modelValue"]);
858
+ };
859
+ }
860
+ }), _hoisted_1$e = { class: "space-y-24" }, _hoisted_2$a = { class: "grid grid-cols-2 gap-16" }, _hoisted_3$8 = { class: "fm-typo-en-title-sm-800" }, _hoisted_4$6 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_5$3 = { class: "space-y-16" }, _hoisted_6$3 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_7$2 = {
861
+ key: 0,
862
+ class: "xs:!block flex gap-16 items-center pt-8"
863
+ }, _hoisted_8$1 = { class: "fm-typo-en-body-lg-400" }, _hoisted_9$1 = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, _hoisted_10$1 = {
864
+ key: 0,
865
+ class: "pt-8 space-y-8"
866
+ }, _hoisted_11$1 = { class: "flex items-center gap-16 xs:block xs:space-y-8 w-fit" }, _hoisted_12 = { class: "xs:!block flex gap-16 items-center" }, _sfc_main$e = /* @__PURE__ */ defineComponent({
867
+ __name: "EarningOptionInput",
868
+ props: {
869
+ modelValue: {
870
+ type: Object
871
+ },
872
+ extras: {
873
+ type: Object
874
+ },
875
+ fixedType: {
876
+ type: Boolean
877
+ },
878
+ errorText: {
879
+ type: String
880
+ }
881
+ },
882
+ emits: ["update:model-value"],
883
+ setup(e, { emit: m }) {
884
+ var v, p, g;
885
+ const r = useBusinessStore(), u = e, a = m, i = [
886
+ {
887
+ label: "Based on spending",
888
+ sublabel: "Customers earn rewards based on how much they spend.",
889
+ value: "PROPORTIONAL"
890
+ },
891
+ {
892
+ label: "Fixed amount",
893
+ sublabel: "Customers earn a set amount of rewards for specific actions.",
894
+ value: "FIXED"
895
+ }
896
+ ].filter((h) => {
897
+ var s, d;
898
+ return u.fixedType || ((d = (s = u.extras) == null ? void 0 : s.campaign) == null ? void 0 : d.event.type) != "BILL_COMPLETED" ? h.value == "FIXED" : !0;
899
+ }), o = computed(() => {
900
+ var s, d;
901
+ const h = u.extras && "configs" in u.extras ? u.extras.configs.type : (s = u.extras) == null ? void 0 : s.campaign.type;
902
+ return (((d = CollectibleOptions[h]) == null ? void 0 : d.name) || "reward").toLowerCase();
903
+ }), l = computed(() => {
904
+ const h = FdoEarningOption.safeParse(u.modelValue);
905
+ return h.success ? [] : h.error.errors;
906
+ });
907
+ function n(h) {
908
+ var s;
909
+ h != ((s = u.modelValue) == null ? void 0 : s.type) && a(
910
+ "update:model-value",
911
+ h === "FIXED" ? {
912
+ type: "FIXED",
913
+ amount: 1
914
+ } : {
915
+ type: "PROPORTIONAL",
916
+ amount: 1,
917
+ every: 1
918
+ }
919
+ );
920
+ }
921
+ const c = ref(
922
+ ((v = u.modelValue) == null ? void 0 : v.type) === "PROPORTIONAL" && !!((g = (p = u.modelValue) == null ? void 0 : p.property) != null && g.length) || !1
923
+ );
924
+ return (h, s) => {
925
+ var x, b, S;
926
+ const d = resolveComponent("FmCard"), f = resolveComponent("FmStepperField"), y = resolveComponent("FmRadio"), C = resolveComponent("FmPill"), E = resolveComponent("FmButton"), k = resolveComponent("FmRadioGroup"), B = resolveComponent("FmHelperText");
927
+ return openBlock(), createElementBlock("div", _hoisted_1$e, [
928
+ createElementVNode("div", _hoisted_2$a, [
929
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(i), (V) => {
930
+ var N, R;
931
+ return openBlock(), createBlock(d, {
932
+ variant: "outlined",
933
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
934
+ "col-span-2": unref(i).length == 1,
935
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((N = e.modelValue) == null ? void 0 : N.type) === V.value,
936
+ "hover:bg-fm-color-opacity-sm": ((R = e.modelValue) == null ? void 0 : R.type) != V.value
937
+ }]),
938
+ onClick: (w) => n(V.value),
939
+ key: V.value
940
+ }, {
941
+ default: withCtx(() => [
942
+ createElementVNode("div", _hoisted_3$8, toDisplayString(V.label), 1),
943
+ createElementVNode("div", _hoisted_4$6, toDisplayString(V.sublabel), 1)
944
+ ]),
945
+ _: 2
946
+ }, 1032, ["class", "onClick"]);
947
+ }), 128))
948
+ ]),
949
+ createElementVNode("div", _hoisted_5$3, [
950
+ ((x = e.modelValue) == null ? void 0 : x.type) === "FIXED" ? (openBlock(), createBlock(f, {
951
+ key: 0,
952
+ label: `Receive ${unref(o)}(s)`,
953
+ class: "flex-1",
954
+ "model-value": ((b = e.modelValue) == null ? void 0 : b.amount) ?? null,
955
+ "onUpdate:modelValue": s[0] || (s[0] = (V) => a("update:model-value", {
956
+ ...e.modelValue ?? { type: "FIXED" },
957
+ amount: V
958
+ }))
959
+ }, null, 8, ["label", "model-value"])) : ((S = e.modelValue) == null ? void 0 : S.type) === "PROPORTIONAL" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
960
+ s[11] || (s[11] = createElementVNode("div", { class: "fm-typo-en-body-lg-600" }, "Spending type", -1)),
961
+ createVNode(k, {
962
+ "model-value": unref(c),
963
+ "onUpdate:modelValue": s[6] || (s[6] = (V) => {
964
+ unref(c) != V && (a("update:model-value", {
965
+ ...e.modelValue ?? {
966
+ type: "PROPORTIONAL",
967
+ amount: 1,
968
+ every: 1
969
+ },
970
+ property: V ? [] : void 0,
971
+ every: 1
972
+ }), c.value = V);
973
+ })
974
+ }, {
975
+ default: withCtx(() => [
976
+ createVNode(y, {
977
+ label: "Amount spent",
978
+ sublabel: `Receive ${unref(o)} by amount spent`,
979
+ value: !1
980
+ }, {
981
+ label: withCtx(() => {
982
+ var V, N;
983
+ return [
984
+ s[8] || (s[8] = createElementVNode("div", { class: "fm-typo-en-body-lg-400" }, "Amount spent", -1)),
985
+ createElementVNode("div", _hoisted_6$3, " Receive " + toDisplayString(unref(o)) + " by amount spent ", 1),
986
+ unref(c) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_7$2, [
987
+ createVNode(f, {
988
+ label: `Receive ${unref(o)}(s)`,
989
+ inputmode: "decimal",
990
+ class: "flex-1",
991
+ "model-value": ((V = e.modelValue) == null ? void 0 : V.amount) ?? null,
992
+ "onUpdate:modelValue": s[1] || (s[1] = (R) => a("update:model-value", {
993
+ ...e.modelValue ?? { type: "FIXED" },
994
+ amount: R
995
+ }))
996
+ }, null, 8, ["label", "model-value"]),
997
+ s[7] || (s[7] = createElementVNode("div", { class: "xs:py-4 text-center" }, "for every", -1)),
998
+ createVNode(f, {
999
+ label: `Amount spend (${unref(core.Config).getCountry().currency.symbol})`,
1000
+ class: "flex-1",
1001
+ inputmode: "decimal",
1002
+ "model-value": ((N = e.modelValue) == null ? void 0 : N.every) ?? null,
1003
+ "onUpdate:modelValue": s[2] || (s[2] = (R) => a("update:model-value", {
1004
+ ...e.modelValue,
1005
+ every: R
1006
+ }))
1007
+ }, {
1008
+ prepend: withCtx(() => [
1009
+ createTextVNode(toDisplayString(unref(core.Config).getCountry().currency.symbol), 1)
1010
+ ]),
1011
+ _: 1
1012
+ }, 8, ["label", "model-value"])
1013
+ ]))
1014
+ ];
1015
+ }),
1016
+ _: 1
1017
+ }, 8, ["sublabel"]),
1018
+ createVNode(y, {
1019
+ label: "Product bought",
1020
+ sublabel: `Receive ${unref(o)} by product bought`,
1021
+ value: !0,
1022
+ disabled: !unref(r).isPremium
1023
+ }, {
1024
+ label: withCtx(() => {
1025
+ var V, N;
1026
+ return [
1027
+ createElementVNode("div", _hoisted_8$1, [
1028
+ s[9] || (s[9] = createTextVNode(" Product bought ")),
1029
+ createVNode(C, { variant: "premium" })
1030
+ ]),
1031
+ createElementVNode("div", _hoisted_9$1, " Receive " + toDisplayString(unref(o)) + " by product bought ", 1),
1032
+ unref(c) ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
1033
+ createElementVNode("div", _hoisted_11$1, [
1034
+ createVNode(_sfc_main$f, {
1035
+ "model-value": u.modelValue.property || [],
1036
+ onConfirm: s[3] || (s[3] = (R) => a("update:model-value", {
1037
+ ...e.modelValue,
1038
+ property: R
1039
+ }))
1040
+ }, {
1041
+ "side-sheet-button": withCtx(() => {
1042
+ var R, w;
1043
+ return [
1044
+ createVNode(E, {
1045
+ label: (R = u.modelValue.property) != null && R.length ? `${(w = u.modelValue.property) == null ? void 0 : w.length} product(s) selected` : "Select product",
1046
+ icon: "link",
1047
+ variant: "secondary"
1048
+ }, null, 8, ["label"])
1049
+ ];
1050
+ }),
1051
+ _: 1
1052
+ }, 8, ["model-value"])
1053
+ ]),
1054
+ createElementVNode("div", _hoisted_12, [
1055
+ createVNode(f, {
1056
+ inputmode: "decimal",
1057
+ label: `Receive ${unref(o)}(s)`,
1058
+ class: "flex-1",
1059
+ "model-value": ((V = e.modelValue) == null ? void 0 : V.amount) ?? null,
1060
+ "onUpdate:modelValue": s[4] || (s[4] = (R) => a("update:model-value", {
1061
+ ...e.modelValue ?? { type: "FIXED" },
1062
+ amount: R
1063
+ }))
1064
+ }, null, 8, ["label", "model-value"]),
1065
+ s[10] || (s[10] = createElementVNode("div", { class: "xs:py-4 text-center" }, "for every", -1)),
1066
+ createVNode(f, {
1067
+ label: "Item purchased",
1068
+ class: "flex-1",
1069
+ "model-value": ((N = e.modelValue) == null ? void 0 : N.every) ?? null,
1070
+ inputmode: "numeric",
1071
+ "max-fraction-digits": 0,
1072
+ "onUpdate:modelValue": s[5] || (s[5] = (R) => a("update:model-value", {
1073
+ ...e.modelValue,
1074
+ every: R
1075
+ }))
1076
+ }, null, 8, ["model-value"])
1077
+ ])
1078
+ ])) : createCommentVNode("", !0)
1079
+ ];
1080
+ }),
1081
+ _: 1
1082
+ }, 8, ["sublabel", "disabled"])
1083
+ ]),
1084
+ _: 1
1085
+ }, 8, ["model-value"])
1086
+ ], 64)) : createCommentVNode("", !0)
1087
+ ]),
1088
+ e.errorText || unref(l).length > 0 ? (openBlock(), createBlock(B, {
1089
+ key: 0,
1090
+ class: "!mt-4",
1091
+ text: e.errorText || unref(ZodHelper).helperText(unref(l), ""),
1092
+ state: "error"
1093
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1094
+ ]);
1095
+ };
1096
+ }
1097
+ }), _hoisted_1$d = { 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$d = /* @__PURE__ */ defineComponent({
1098
+ __name: "GameTypeInput",
1099
+ props: {
1100
+ modelValue: {
1101
+ type: String
1102
+ }
1103
+ },
1104
+ emits: ["update:model-value"],
1105
+ setup(e, { emit: m }) {
1106
+ const r = e, u = m, a = computed(
1107
+ () => [
1108
+ {
1109
+ label: "Fortune Wheel",
1110
+ description: "Allow customers to spin the Fortune Wheel to win various rewards.",
1111
+ value: F_GAME_TYPE.enum.FORTUNE_WHEEL,
1112
+ hidden: !1
1113
+ },
1114
+ {
1115
+ label: "Rock paper scissor",
1116
+ description: "Customers play a game of Rock Paper Scissors against the cashier.",
1117
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS,
1118
+ hidden: !0
1119
+ }
1120
+ ].filter((i) => !i.hidden)
1121
+ );
1122
+ return (i, o) => {
1123
+ const l = resolveComponent("FmCard");
1124
+ return openBlock(), createElementBlock("div", _hoisted_1$d, [
1125
+ 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)),
1126
+ createElementVNode("div", _hoisted_2$9, [
1127
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (n) => (openBlock(), createBlock(l, {
1128
+ variant: "outlined",
1129
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1130
+ "col-span-2": unref(a).length == 1,
1131
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
1132
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
1133
+ }]),
1134
+ onClick: () => {
1135
+ r.modelValue != n.value && u("update:model-value", n.value);
1136
+ },
1137
+ key: n.value
1138
+ }, {
1139
+ default: withCtx(() => [
1140
+ createElementVNode("div", _hoisted_3$7, toDisplayString(n.label), 1),
1141
+ createElementVNode("div", _hoisted_4$5, toDisplayString(n.description), 1)
1142
+ ]),
1143
+ _: 2
1144
+ }, 1032, ["class", "onClick"]))), 128))
1145
+ ])
1146
+ ]);
1147
+ };
1148
+ }
1149
+ }), _hoisted_1$c = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, _sfc_main$c = /* @__PURE__ */ defineComponent({
1150
+ __name: "VoucherEditor",
1151
+ props: {
1152
+ modelValue: {
1153
+ type: Object
1154
+ },
1155
+ rewardImage: {
1156
+ type: Object
1157
+ }
1158
+ },
1159
+ emits: ["update:model-value", "update:reward-image"],
1160
+ setup(e, { emit: m }) {
1161
+ const { t: r } = useI18n(), a = ref(
1162
+ e.modelValue ?? initCollectibleConfig("VOUCHER", {
1163
+ business: useCoreStore().currentBusiness.value._id,
1164
+ name: ""
1165
+ })
1166
+ ), i = FdtoCollectibleConfig, o = m;
1167
+ return (l, n) => {
1168
+ var p, g, h;
1169
+ const c = resolveComponent("FmTextarea"), v = resolveComponent("FmHelperText");
1170
+ return openBlock(), createElementBlock(Fragment, null, [
1171
+ createVNode(_sfc_main$u, {
1172
+ modelValue: unref(a).name,
1173
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => unref(a).name = s),
1174
+ label: "Voucher name",
1175
+ schema: unref(ZodHelper).typeAtPath(unref(i), "name", [unref(a).type])
1176
+ }, null, 8, ["modelValue", "schema"]),
1177
+ createVNode(c, {
1178
+ class: "!mb-[-16px]",
1179
+ modelValue: unref(a).description,
1180
+ "onUpdate:modelValue": n[1] || (n[1] = (s) => unref(a).description = s),
1181
+ rules: [unref(ZodHelper).ruleAtPath(unref(i), "description", [unref(a).type])]
1182
+ }, {
1183
+ label: withCtx(() => [
1184
+ (openBlock(), createBlock(resolveDynamicComponent(
1185
+ unref(ZodHelper).toInputLabel(
1186
+ unref(ZodHelper).typeAtPath(unref(i), "description", [unref(a).type]),
1187
+ "Voucher description"
1188
+ )
1189
+ )))
1190
+ ]),
1191
+ _: 1
1192
+ }, 8, ["modelValue", "rules"]),
1193
+ createElementVNode("div", _hoisted_1$c, [
1194
+ n[6] || (n[6] = createElementVNode("div", null, "Voucher description should not exceed 200 characters.", -1)),
1195
+ createElementVNode("div", null, toDisplayString(((p = unref(a).description) == null ? void 0 : p.length) ?? 0) + "/200", 1)
1196
+ ]),
1197
+ createVNode(_sfc_main$v, {
1198
+ class: "w-1/2 xs:w-2/3",
1199
+ "aspect-ratio": "16/9",
1200
+ file: e.rewardImage ?? void 0,
1201
+ thumbnail: unref(a).image ?? void 0,
1202
+ "onUpdate:file": n[2] || (n[2] = async (s) => {
1203
+ o("update:reward-image", s), s || (unref(a).image = null);
1204
+ })
1205
+ }, {
1206
+ label: withCtx(() => [
1207
+ (openBlock(), createBlock(resolveDynamicComponent(
1208
+ unref(ZodHelper).toInputLabel(
1209
+ unref(ZodHelper).typeAtPath(unref(i), "image", [unref(a).type]),
1210
+ "Voucher image"
1211
+ )
1212
+ )))
1213
+ ]),
1214
+ _: 1
1215
+ }, 8, ["file", "thumbnail"]),
1216
+ n[7] || (n[7] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1)),
1217
+ createVNode(_sfc_main$w, {
1218
+ "model-value": unref(a).extras.effect,
1219
+ "onUpdate:modelValue": n[3] || (n[3] = (s) => unref(a).extras.effect = s)
1220
+ }, null, 8, ["model-value"]),
1221
+ unref(a).extras.effect == null ? (openBlock(), createBlock(v, {
1222
+ key: 0,
1223
+ class: "!mt-8",
1224
+ text: unref(r)("connect.campaign.common.effect_required"),
1225
+ state: "error"
1226
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
1227
+ n[8] || (n[8] = createElementVNode("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Usage configuration", -1)),
1228
+ createVNode(_sfc_main$x, {
1229
+ "model-value": unref(a).options,
1230
+ "no-campaign": unref(a).noCampaign,
1231
+ "onUpdate:modelValue": n[4] || (n[4] = (s) => unref(a).options = s),
1232
+ schema: unref(ZodHelper).typeAtPath(unref(i), "options", ["VOUCHER"])
1233
+ }, null, 8, ["model-value", "no-campaign", "schema"]),
1234
+ n[9] || (n[9] = createElementVNode("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1)),
1235
+ unref(a).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$y, {
1236
+ key: 1,
1237
+ "model-value": ((h = (g = unref(a).extras) == null ? void 0 : g.targetLocation) == null ? void 0 : h.map(String)) ?? null,
1238
+ type: "select",
1239
+ "onUpdate:modelValue": n[5] || (n[5] = (s) => {
1240
+ unref(a).extras.targetLocation = s;
1241
+ }),
1242
+ rules: [unref(ZodHelper).ruleAtPath(unref(i), "extras.targetLocation")]
1243
+ }, null, 8, ["model-value", "rules"])) : createCommentVNode("", !0)
1244
+ ], 64);
1245
+ };
1246
+ }
1247
+ }), _hoisted_1$b = {
1248
+ key: 0,
1249
+ class: "flex flex-col gap-y-24"
1250
+ }, _hoisted_2$8 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$b = /* @__PURE__ */ defineComponent({
1251
+ __name: "EditRewardPoolSheet",
1252
+ emits: ["update:model-value"],
1253
+ setup(e, { expose: m, emit: r }) {
1254
+ const u = useMembershipStore(), { minor: a } = useLoading, i = ref(!1), o = ref(), l = ref(), n = ref(0), c = computed(() => {
1255
+ var d;
1256
+ return ((d = u.loyaltyRewards.items.find(
1257
+ (f) => {
1258
+ var y;
1259
+ return f.value === ((y = o.value) == null ? void 0 : y.collectible);
1260
+ }
1261
+ )) == null ? void 0 : d.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
1262
+ }), v = computed(() => {
1263
+ const s = c.value.safeParse(o.value);
1264
+ return s.success ? [] : s.error.errors;
1265
+ });
1266
+ function p(s, d, f) {
1267
+ s && (o.value = d, n.value = f), i.value = s;
1268
+ }
1269
+ const g = r;
1270
+ async function h() {
1271
+ const s = c.value.safeParse(o.value);
1272
+ s.success && (await a(
1273
+ async () => {
1274
+ s.data.type === "VOUCHER" && l.value && (s.data.collectibleConfig.image = await firebaseStorage.update(
1275
+ s.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, l.value),
1276
+ l.value
1277
+ ));
1278
+ },
1279
+ {
1280
+ message: "Uploading reward image",
1281
+ successMessage: "Reward image updated"
1282
+ }
1283
+ ), g("update:model-value", s.data, n.value));
1284
+ }
1285
+ return m({
1286
+ showSheet: p
1287
+ }), (s, d) => {
1288
+ const f = resolveComponent("FmSelect"), y = resolveComponent("FmStepperField"), C = resolveComponent("FmButton"), E = resolveComponent("FmSideSheet");
1289
+ return openBlock(), createBlock(E, {
1290
+ "max-width": 560,
1291
+ modelValue: unref(i),
1292
+ "onUpdate:modelValue": [
1293
+ d[9] || (d[9] = (k) => isRef(i) ? i.value = k : null),
1294
+ d[10] || (d[10] = (k) => i.value = k)
1295
+ ],
1296
+ header: "Edit reward",
1297
+ "dismiss-away": ""
1298
+ }, {
1299
+ "side-sheet-footer": withCtx(() => [
1300
+ createElementVNode("div", _hoisted_2$8, [
1301
+ createVNode(C, {
1302
+ variant: "primary",
1303
+ type: "button",
1304
+ disabled: unref(v).length > 0,
1305
+ label: "Confirm",
1306
+ onClick: d[7] || (d[7] = (k) => h())
1307
+ }, null, 8, ["disabled"]),
1308
+ createVNode(C, {
1309
+ variant: "secondary",
1310
+ type: "button",
1311
+ label: "Cancel",
1312
+ onClick: d[8] || (d[8] = (k) => i.value = !1)
1313
+ })
1314
+ ])
1315
+ ]),
1316
+ default: withCtx(() => {
1317
+ var k, B, x;
1318
+ return [
1319
+ unref(o) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
1320
+ createVNode(f, {
1321
+ label: "Reward Type",
1322
+ items: [
1323
+ { label: "No Reward", value: "NO_REWARD" },
1324
+ { label: "Voucher", value: "VOUCHER" },
1325
+ { label: "Loyalty", value: "LOYALTY" }
1326
+ ],
1327
+ "model-value": unref(o).type,
1328
+ "onUpdate:modelValue": d[0] || (d[0] = (b) => {
1329
+ b == "NO_REWARD" ? o.value = {
1330
+ type: "NO_REWARD",
1331
+ collectible: null,
1332
+ weight: 1
1333
+ } : b === "VOUCHER" ? o.value = {
1334
+ collectible: null,
1335
+ type: "VOUCHER",
1336
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1337
+ business: unref(useCoreStore)().currentBusiness.value._id
1338
+ }),
1339
+ earningOption: {
1340
+ amount: 1,
1341
+ type: "FIXED"
1342
+ },
1343
+ validityOption: {
1344
+ validForDay: 7
1345
+ },
1346
+ weight: 1
1347
+ } : o.value = {
1348
+ collectible: unref(u).loyaltyRewards.raw[0]._id,
1349
+ type: "LOYALTY",
1350
+ earningOption: {
1351
+ amount: 1,
1352
+ type: "FIXED"
1353
+ },
1354
+ validityOption: {
1355
+ validForDay: 7
1356
+ },
1357
+ weight: 1
1358
+ };
1359
+ })
1360
+ }, null, 8, ["model-value"]),
1361
+ unref(o).type == "LOYALTY" ? (openBlock(), createBlock(f, {
1362
+ key: 0,
1363
+ label: "Loyalty type",
1364
+ rules: [unref(ZodHelper).ruleAtPath(unref(c), "collectible", [unref(o).type])],
1365
+ items: unref(u).loyaltyRewards.items,
1366
+ "model-value": unref(o).collectible,
1367
+ "onUpdate:modelValue": d[1] || (d[1] = (b) => unref(o).collectible = b)
1368
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1369
+ createVNode(y, {
1370
+ label: "Weight",
1371
+ rules: [unref(ZodHelper).ruleAtPath(unref(c), "weight", [unref(o).type])],
1372
+ "model-value": unref(o).weight,
1373
+ "onUpdate:modelValue": d[2] || (d[2] = (b) => o.value = {
1374
+ ...unref(o),
1375
+ weight: b
1376
+ })
1377
+ }, null, 8, ["rules", "model-value"]),
1378
+ unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1379
+ ((k = unref(u).loyaltyRewards.items.find(
1380
+ (b) => {
1381
+ var S;
1382
+ return b.value === ((S = unref(o)) == null ? void 0 : S.collectible);
1383
+ }
1384
+ )) == null ? void 0 : k.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1385
+ d[11] || (d[11] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1386
+ createVNode(_sfc_main$e, {
1387
+ class: "mt-[-8px]",
1388
+ rules: [
1389
+ unref(ZodHelper).ruleAtPath(unref(c), "earningOption", [unref(o).type])
1390
+ ],
1391
+ "helper-state": unref(ZodHelper).helperState(unref(v), "earningOption"),
1392
+ "error-text": unref(ZodHelper).helperText(unref(v), "earningOption"),
1393
+ "fixed-type": !0,
1394
+ "model-value": unref(o).earningOption,
1395
+ "onUpdate:modelValue": d[3] || (d[3] = (b) => o.value = {
1396
+ ...unref(o),
1397
+ earningOption: b
1398
+ })
1399
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
1400
+ ], 64)) : createCommentVNode("", !0),
1401
+ d[12] || (d[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Validity option", -1)),
1402
+ createVNode(_sfc_main$z, {
1403
+ "for-credit": unref(o).type === "LOYALTY" && ((B = unref(u).loyaltyRewards.items.find(
1404
+ (b) => {
1405
+ var S;
1406
+ return b.value === ((S = unref(o)) == null ? void 0 : S.collectible);
1407
+ }
1408
+ )) == null ? void 0 : B.raw.type) === "CREDIT",
1409
+ class: "!gap-24",
1410
+ rules: [unref(ZodHelper).ruleAtPath(unref(c), "validityOption", [unref(o).type])],
1411
+ "model-value": unref(o).validityOption,
1412
+ "onUpdate:modelValue": d[4] || (d[4] = (b) => o.value = {
1413
+ ...unref(o),
1414
+ validityOption: b
1415
+ })
1416
+ }, null, 8, ["for-credit", "rules", "model-value"])
1417
+ ], 64)) : createCommentVNode("", !0),
1418
+ unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$c, {
1419
+ key: 2,
1420
+ "reward-image": unref(l),
1421
+ "model-value": ((x = unref(o)) == null ? void 0 : x.collectibleConfig) ?? void 0,
1422
+ "onUpdate:modelValue": d[5] || (d[5] = (b) => o.value = {
1423
+ ...unref(o),
1424
+ collectibleConfig: b
1425
+ }),
1426
+ "onUpdate:rewardImage": d[6] || (d[6] = (b) => l.value = b)
1427
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1428
+ createVNode(JsonViewer, { json: unref(v) }, null, 8, ["json"])
1429
+ ])) : createCommentVNode("", !0)
1430
+ ];
1431
+ }),
1432
+ _: 1
1433
+ }, 8, ["modelValue"]);
1434
+ };
1435
+ }
1436
+ });
1437
+ function isNullOrEmpty(e) {
1438
+ return e == null || e === "";
1439
+ }
1440
+ 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({
1441
+ __name: "RewardPoolInput",
1442
+ props: {
1443
+ modelValue: {
1444
+ type: Array,
1445
+ default: () => [
1446
+ {
1447
+ collectible: null,
1448
+ type: "NO_REWARD",
1449
+ weight: 1
1450
+ }
1451
+ ]
1452
+ }
1453
+ },
1454
+ emits: ["update:model-value"],
1455
+ setup(e, { emit: m }) {
1456
+ const r = e, u = m, a = useMembershipStore(), i = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), o = computed(() => r.modelValue ?? []), l = computed(() => {
1457
+ const s = i.safeParse(o.value);
1458
+ return s.success ? [] : s.error.errors;
1459
+ }), n = ref();
1460
+ function c(s, d) {
1461
+ var y;
1462
+ const f = [...o.value];
1463
+ f[d] = s, (y = n.value) == null || y.showSheet(!1), u("update:model-value", f);
1464
+ }
1465
+ function v(s) {
1466
+ const d = s.type == "VOUCHER" ? s.collectibleConfig : a.collectibles.find(
1467
+ (C) => C._id.toString() == s.collectible
1468
+ ), f = CollectionUtils.formattedType((d == null ? void 0 : d.name) || ""), y = s.weight;
1469
+ return {
1470
+ label: isNullOrEmpty(f) ? "NO REWARD" : f,
1471
+ sublabel: `${y} (${(y / o.value.reduce((C, E) => C + E.weight, 0) * 100).toFixed(2)}%)`
1472
+ };
1473
+ }
1474
+ function p(s) {
1475
+ var f;
1476
+ const d = [...o.value];
1477
+ (f = n.value) == null || f.showSheet(!0, d[s], s);
1478
+ }
1479
+ function g(s) {
1480
+ const d = [...o.value];
1481
+ d.splice(s, 1), u("update:model-value", d);
1482
+ }
1483
+ function h() {
1484
+ var s;
1485
+ (s = n.value) == null || s.showSheet(
1486
+ !0,
1487
+ {
1488
+ type: "NO_REWARD",
1489
+ collectible: null,
1490
+ weight: 1
1491
+ },
1492
+ o.value.length
1493
+ );
1494
+ }
1495
+ return (s, d) => {
1496
+ const f = resolveComponent("FmButton"), y = resolveComponent("FmCard"), C = resolveComponent("FmHelperText");
1497
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
1498
+ d[1] || (d[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)),
1499
+ createVNode(f, {
1500
+ label: "Add Reward",
1501
+ onClick: d[0] || (d[0] = (E) => h()),
1502
+ variant: "plain",
1503
+ icon: "add"
1504
+ }),
1505
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (E, k) => (openBlock(), createBlock(y, {
1506
+ key: k,
1507
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
1508
+ variant: "outlined",
1509
+ onClick: (B) => p(k)
1510
+ }, {
1511
+ default: withCtx(() => [
1512
+ createElementVNode("div", null, [
1513
+ createElementVNode("div", _hoisted_2$7, toDisplayString(v(E).label), 1),
1514
+ createElementVNode("div", _hoisted_3$6, toDisplayString(v(E).sublabel), 1)
1515
+ ]),
1516
+ createVNode(f, {
1517
+ icon: "delete",
1518
+ variant: "tertiary",
1519
+ onClick: (B) => (B.stopPropagation(), g(k))
1520
+ }, null, 8, ["onClick"])
1521
+ ]),
1522
+ _: 2
1523
+ }, 1032, ["onClick"]))), 128)),
1524
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((E) => E.path.join(".") == ""), (E) => (openBlock(), createBlock(C, {
1525
+ key: E.message,
1526
+ text: E.message,
1527
+ state: "error"
1528
+ }, null, 8, ["text"]))), 128)),
1529
+ createVNode(_sfc_main$b, {
1530
+ ref_key: "sheetRef",
1531
+ ref: n,
1532
+ "onUpdate:modelValue": c
1533
+ }, null, 512)
1534
+ ]);
1535
+ };
1536
+ }
1537
+ }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
1538
+ key: 0,
1539
+ class: "grid grid-cols-2 gap-16"
1540
+ }, _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({
1541
+ __name: "PromotionGameTypeInput",
1542
+ props: {
1543
+ modelValue: {
1544
+ type: Object
1545
+ }
1546
+ },
1547
+ emits: ["update:model-value"],
1548
+ setup(e, { emit: m }) {
1549
+ const r = e, u = m, a = computed(() => [
1550
+ {
1551
+ label: "Rock paper scissor",
1552
+ description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
1553
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
1554
+ }
1555
+ ]);
1556
+ return (i, o) => {
1557
+ var v, p, g;
1558
+ const l = resolveComponent("FmSwitch"), n = resolveComponent("FmCard"), c = resolveComponent("FmHelperText");
1559
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
1560
+ createVNode(l, {
1561
+ label: "Enable game",
1562
+ "model-value": !!((v = e.modelValue) != null && v.gameType),
1563
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => h ? u("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : u("update:model-value", null))
1564
+ }, null, 8, ["model-value"]),
1565
+ ((p = e.modelValue) == null ? void 0 : p.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1566
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (h) => {
1567
+ var s, d;
1568
+ return openBlock(), createBlock(n, {
1569
+ variant: "outlined",
1570
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1571
+ "col-span-2": unref(a).length == 1,
1572
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((s = e.modelValue) == null ? void 0 : s.gameType) == h.value,
1573
+ "hover:bg-fm-color-opacity-sm": ((d = e.modelValue) == null ? void 0 : d.gameType) != h.value
1574
+ }]),
1575
+ onClick: () => {
1576
+ var f;
1577
+ ((f = r.modelValue) == null ? void 0 : f.gameType) != h.value && u("update:model-value", { gameType: h.value });
1578
+ },
1579
+ key: h.value
1580
+ }, {
1581
+ default: withCtx(() => [
1582
+ createElementVNode("div", _hoisted_3$5, toDisplayString(h.label), 1),
1583
+ createElementVNode("div", _hoisted_4$4, toDisplayString(h.description), 1)
1584
+ ]),
1585
+ _: 2
1586
+ }, 1032, ["class", "onClick"]);
1587
+ }), 128))
1588
+ ])) : createCommentVNode("", !0),
1589
+ ((g = e.modelValue) == null ? void 0 : g.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(c, {
1590
+ key: 1,
1591
+ 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)",
1592
+ state: "warning"
1593
+ })) : createCommentVNode("", !0)
1594
+ ]);
1595
+ };
1596
+ }
1597
+ }), _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({
1598
+ __name: "MissionTypeInput",
1599
+ props: {
1600
+ modelValue: {
1601
+ type: String
1602
+ }
1603
+ },
1604
+ emits: ["update:model-value"],
1605
+ setup(e, { emit: m }) {
1606
+ const r = e, u = m, a = computed(() => [
1607
+ {
1608
+ label: "Stamp",
1609
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
1610
+ value: F_MISSION_TYPE.enum.STAMP
1611
+ },
1612
+ {
1613
+ label: "Progress",
1614
+ description: "Reward customers when they reach a cumulative spending goal.",
1615
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
1616
+ }
1617
+ ]);
1618
+ return (i, o) => {
1619
+ const l = resolveComponent("FmCard");
1620
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1621
+ 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)),
1622
+ createElementVNode("div", _hoisted_2$5, [
1623
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (n) => (openBlock(), createBlock(l, {
1624
+ variant: "outlined",
1625
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1626
+ "col-span-2": unref(a).length == 1,
1627
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
1628
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
1629
+ }]),
1630
+ onClick: () => {
1631
+ r.modelValue != n.value && u("update:model-value", n.value);
1632
+ },
1633
+ key: n.value
1634
+ }, {
1635
+ default: withCtx(() => [
1636
+ createElementVNode("div", _hoisted_3$4, toDisplayString(n.label), 1),
1637
+ createElementVNode("div", _hoisted_4$3, toDisplayString(n.description), 1)
1638
+ ]),
1639
+ _: 2
1640
+ }, 1032, ["class", "onClick"]))), 128))
1641
+ ])
1642
+ ]);
1643
+ };
1644
+ }
1645
+ }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
1646
+ __name: "MissionEndInput",
1647
+ props: {
1648
+ modelValue: {
1649
+ type: [String, Number]
1650
+ },
1651
+ helperText: {
1652
+ type: String
1653
+ },
1654
+ helperState: {
1655
+ type: String
1656
+ }
1657
+ },
1658
+ emits: ["update:model-value"],
1659
+ setup(e, { emit: m }) {
1660
+ const r = m;
1661
+ return (u, a) => {
1662
+ const i = resolveComponent("FmStepperField");
1663
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1664
+ a[1] || (a[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)),
1665
+ createVNode(i, {
1666
+ label: "Maximum to collect",
1667
+ "model-value": e.modelValue || null,
1668
+ "onUpdate:modelValue": a[0] || (a[0] = (o) => r("update:model-value", o)),
1669
+ "helper-text": e.helperText || "Set the threshold required for reward eligibility",
1670
+ "helper-state": e.helperState || "none"
1671
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
1672
+ ]);
1673
+ };
1674
+ }
1675
+ }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
1676
+ __name: "EditMissionPoolSheet",
1677
+ props: {
1678
+ maxThreshold: {
1679
+ type: Number,
1680
+ required: !0
1681
+ }
1682
+ },
1683
+ emits: ["update:model-value"],
1684
+ setup(e, { expose: m, emit: r }) {
1685
+ const u = e, a = useMembershipStore(), { minor: i } = useLoading, o = ref(!1), l = ref(), n = ref(), c = ref(0), v = FdtoThresholdReward, p = computed(() => {
1686
+ const f = v.safeParse(l.value);
1687
+ return f.success ? [] : f.error.errors;
1688
+ });
1689
+ function g(f, y, C) {
1690
+ f && (l.value = y, c.value = C), o.value = f;
1691
+ }
1692
+ const h = r;
1693
+ async function s() {
1694
+ console.log(l.value);
1695
+ const f = v.safeParse(l.value);
1696
+ f.success && (await i(
1697
+ async () => {
1698
+ f.data.type === "VOUCHER" && n.value && (f.data.collectibleConfig.image = await firebaseStorage.update(
1699
+ f.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1700
+ n.value
1701
+ ));
1702
+ },
1703
+ {
1704
+ message: "Uploading reward image",
1705
+ successMessage: "Reward image updated"
1706
+ }
1707
+ ), h("update:model-value", f.data, c.value));
1708
+ }
1709
+ const d = ref();
1710
+ return m({
1711
+ showSheet: g
1712
+ }), (f, y) => {
1713
+ const C = resolveComponent("FmStepperField"), E = resolveComponent("FmSelect"), k = resolveComponent("FmForm"), B = resolveComponent("FmButton"), x = resolveComponent("FmSideSheet");
1714
+ return openBlock(), createBlock(x, {
1715
+ "max-width": 560,
1716
+ modelValue: unref(o),
1717
+ "onUpdate:modelValue": [
1718
+ y[10] || (y[10] = (b) => isRef(o) ? o.value = b : null),
1719
+ y[11] || (y[11] = (b) => o.value = b)
1720
+ ],
1721
+ header: "Edit reward",
1722
+ "dismiss-away": ""
1723
+ }, {
1724
+ "side-sheet-footer": withCtx(() => [
1725
+ createElementVNode("div", _hoisted_1$6, [
1726
+ createVNode(B, {
1727
+ variant: "primary",
1728
+ type: "button",
1729
+ label: "Confirm",
1730
+ onClick: y[8] || (y[8] = async () => {
1731
+ var b;
1732
+ return (b = unref(d)) == null ? void 0 : b.validateInputs();
1733
+ })
1734
+ }),
1735
+ createVNode(B, {
1736
+ variant: "secondary",
1737
+ type: "button",
1738
+ label: "Cancel",
1739
+ onClick: y[9] || (y[9] = (b) => o.value = !1)
1740
+ })
1741
+ ])
1742
+ ]),
1743
+ default: withCtx(() => [
1744
+ unref(l) ? (openBlock(), createBlock(k, {
1745
+ key: 0,
1746
+ class: "flex flex-col gap-y-24",
1747
+ ref_key: "formRef",
1748
+ ref: d,
1749
+ onValidationSuccess: y[7] || (y[7] = (b) => s())
1750
+ }, {
1751
+ default: withCtx(() => {
1752
+ var b, S;
1753
+ return [
1754
+ unref(l).type ? (openBlock(), createBlock(C, {
1755
+ key: 0,
1756
+ label: "Threshold",
1757
+ rules: [
1758
+ unref(ZodHelper).toRule(
1759
+ unref(z).number().min(1).max(
1760
+ u.maxThreshold,
1761
+ `Number cannot be more than ${u.maxThreshold}`
1762
+ )
1763
+ )
1764
+ ],
1765
+ "model-value": unref(l).threshold,
1766
+ "onUpdate:modelValue": y[0] || (y[0] = (V) => l.value = {
1767
+ ...unref(l),
1768
+ threshold: V
1769
+ })
1770
+ }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
1771
+ createVNode(E, {
1772
+ label: "Reward Type",
1773
+ items: [
1774
+ { label: "Voucher", value: "VOUCHER" },
1775
+ { label: "Loyalty", value: "LOYALTY" }
1776
+ ],
1777
+ "model-value": unref(l).type,
1778
+ "onUpdate:modelValue": y[1] || (y[1] = (V) => {
1779
+ var N, R;
1780
+ V === "VOUCHER" ? l.value = {
1781
+ collectible: null,
1782
+ type: "VOUCHER",
1783
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1784
+ business: unref(useCoreStore)().currentBusiness.value._id
1785
+ }),
1786
+ earningOption: {
1787
+ amount: 1,
1788
+ type: "FIXED"
1789
+ },
1790
+ validityOption: {
1791
+ validForDay: 7
1792
+ },
1793
+ threshold: (N = unref(l)) == null ? void 0 : N.threshold
1794
+ } : l.value = {
1795
+ collectible: unref(a).loyaltyRewards.raw[0]._id,
1796
+ type: "LOYALTY",
1797
+ earningOption: {
1798
+ amount: 1,
1799
+ type: "FIXED"
1800
+ },
1801
+ validityOption: {
1802
+ validForDay: 7
1803
+ },
1804
+ threshold: (R = unref(l)) == null ? void 0 : R.threshold
1805
+ };
1806
+ })
1807
+ }, null, 8, ["model-value"]),
1808
+ unref(l).type == "LOYALTY" ? (openBlock(), createBlock(E, {
1809
+ key: 1,
1810
+ label: "Loyalty type",
1811
+ rules: [unref(ZodHelper).ruleAtPath(unref(v), "collectible", [unref(l).type])],
1812
+ items: unref(a).loyaltyRewards.items,
1813
+ "model-value": unref(l).collectible,
1814
+ "onUpdate:modelValue": y[2] || (y[2] = (V) => unref(l).collectible = V)
1815
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1816
+ unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1817
+ y[12] || (y[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1818
+ createVNode(_sfc_main$e, {
1819
+ class: "mt-[-8px]",
1820
+ rules: [unref(ZodHelper).ruleAtPath(unref(v), "earningOption", [unref(l).type])],
1821
+ "helper-state": unref(ZodHelper).helperState(unref(p), "earningOption"),
1822
+ "error-text": unref(ZodHelper).helperText(unref(p), "earningOption"),
1823
+ "fixed-type": !0,
1824
+ "model-value": unref(l).earningOption,
1825
+ "onUpdate:modelValue": y[3] || (y[3] = (V) => l.value = {
1826
+ ...unref(l),
1827
+ earningOption: V
1828
+ })
1829
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
1830
+ createVNode(_sfc_main$z, {
1831
+ class: "!gap-24",
1832
+ "for-credit": unref(l).type === "LOYALTY" && ((b = unref(a).loyaltyRewards.items.find(
1833
+ (V) => {
1834
+ var N;
1835
+ return V.value === ((N = unref(l)) == null ? void 0 : N.collectible);
1836
+ }
1837
+ )) == null ? void 0 : b.raw.type) === "CREDIT",
1838
+ rules: [unref(ZodHelper).ruleAtPath(unref(v), "validityOption", [unref(l).type])],
1839
+ "model-value": unref(l).validityOption,
1840
+ "onUpdate:modelValue": y[4] || (y[4] = (V) => l.value = {
1841
+ ...unref(l),
1842
+ validityOption: V
1843
+ })
1844
+ }, null, 8, ["for-credit", "rules", "model-value"])
1845
+ ], 64)) : createCommentVNode("", !0),
1846
+ unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$c, {
1847
+ key: 3,
1848
+ "reward-image": unref(n),
1849
+ "model-value": ((S = unref(l)) == null ? void 0 : S.collectibleConfig) ?? void 0,
1850
+ "onUpdate:modelValue": y[5] || (y[5] = (V) => l.value = {
1851
+ ...unref(l),
1852
+ collectibleConfig: V
1853
+ }),
1854
+ "onUpdate:rewardImage": y[6] || (y[6] = (V) => n.value = V)
1855
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1856
+ createVNode(JsonViewer, { json: unref(p) }, null, 8, ["json"])
1857
+ ];
1858
+ }),
1859
+ _: 1
1860
+ }, 512)) : createCommentVNode("", !0)
1861
+ ]),
1862
+ _: 1
1863
+ }, 8, ["modelValue"]);
1864
+ };
1865
+ }
1866
+ }), _hoisted_1$5 = {
1867
+ key: 0,
1868
+ class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
1869
+ }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
1870
+ __name: "MissionProgress",
1871
+ props: {
1872
+ type: {
1873
+ type: String,
1874
+ required: !0
1875
+ },
1876
+ maxRange: {
1877
+ type: Number,
1878
+ required: !0
1879
+ },
1880
+ currentRange: {
1881
+ type: Number,
1882
+ default: 0
1883
+ },
1884
+ markers: {
1885
+ type: Array,
1886
+ default: () => []
1887
+ }
1888
+ },
1889
+ setup(e) {
1890
+ const m = e, { maxRange: r, currentRange: u, markers: a } = toRefs(m), i = computed(
1891
+ () => Math.min(u.value / r.value * 100, 100)
1892
+ ), o = (l) => l / r.value * 100;
1893
+ return (l, n) => {
1894
+ const c = resolveComponent("FmIcon");
1895
+ return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
1896
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(r), 40), (v) => (openBlock(), createBlock(c, {
1897
+ class: normalizeClass(
1898
+ unref(u) >= v ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
1899
+ ),
1900
+ outline: unref(u) < v,
1901
+ key: v,
1902
+ name: unref(a).some((p) => p === v) ? "featured_seasonal_and_gifts" : "check_circle"
1903
+ }, null, 8, ["class", "outline", "name"]))), 128))
1904
+ ])) : (openBlock(), createElementBlock("div", {
1905
+ key: 1,
1906
+ class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
1907
+ }, [
1908
+ createElementVNode("div", {
1909
+ class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
1910
+ style: normalizeStyle({ width: unref(i) + "%" })
1911
+ }, null, 4),
1912
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (v, p) => (openBlock(), createElementBlock("div", {
1913
+ key: p,
1914
+ class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
1915
+ style: normalizeStyle({ left: o(v) + "%" })
1916
+ }, [
1917
+ createElementVNode("div", _hoisted_2$4, [
1918
+ createElementVNode("div", {
1919
+ class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
1920
+ }),
1921
+ n[0] || (n[0] = createElementVNode("div", null, "🎁", -1))
1922
+ ])
1923
+ ], 4))), 128))
1924
+ ]));
1925
+ };
1926
+ }
1927
+ }), isObject = (e) => e !== null && typeof e == "object";
1928
+ function changeKeysFactory(e) {
1929
+ return function m(r, u = 1, a) {
1930
+ if (u === 0 || !isObject(r))
1931
+ return r;
1932
+ if (Array.isArray(r))
1933
+ return r.map((o) => m(o, u - 1, a));
1934
+ const i = Object.create(Object.getPrototypeOf(r));
1935
+ return Object.keys(r).forEach((o) => {
1936
+ const l = r[o], n = e(o, a), c = m(l, u - 1, a);
1937
+ i[n] = c;
1938
+ }), i;
1939
+ };
1940
+ }
1941
+ 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({
1942
+ __name: "MissionPoolInput",
1943
+ props: {
1944
+ modelValue: {
1945
+ type: Array,
1946
+ default: () => []
1947
+ },
1948
+ mission: {
1949
+ type: Object,
1950
+ required: !0
1951
+ }
1952
+ },
1953
+ emits: ["update:model-value"],
1954
+ setup(e, { emit: m }) {
1955
+ const r = e, u = m, a = useMembershipStore(), i = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(
1956
+ () => r.modelValue.sort((d, f) => d.threshold - f.threshold) ?? []
1957
+ ), l = computed(() => {
1958
+ const d = i.safeParse(o.value);
1959
+ return d.success ? [] : d.error.errors;
1960
+ }), n = ref();
1961
+ function c(d, f) {
1962
+ var C;
1963
+ const y = [...o.value];
1964
+ y[f] = d, (C = n.value) == null || C.showSheet(!1), u("update:model-value", y);
1965
+ }
1966
+ function v(d) {
1967
+ const f = d.type == "VOUCHER" ? d.collectibleConfig : a.collectibles.find(
1968
+ (C) => C._id.toString() == d.collectible
1969
+ ), y = CollectionUtils.formattedType((f == null ? void 0 : f.name) || "");
1970
+ return {
1971
+ label: isNullOrEmpty(y) ? "NO REWARD" : y,
1972
+ sublabel: `Reward at ${d.threshold} | Amount: ${d.earningOption.type == "FIXED" ? d.earningOption.amount : `${d.earningOption.amount} for every RM${d.earningOption.every} spent`} `
1973
+ };
1974
+ }
1975
+ function p(d) {
1976
+ var y;
1977
+ const f = [...o.value];
1978
+ (y = n.value) == null || y.showSheet(!0, f[d], d);
1979
+ }
1980
+ function g(d) {
1981
+ const f = [...o.value];
1982
+ f.splice(d, 1), u("update:model-value", f);
1983
+ }
1984
+ function h() {
1985
+ var d;
1986
+ (d = n.value) == null || d.showSheet(
1987
+ !0,
1988
+ {
1989
+ type: "LOYALTY",
1990
+ collectible: a.loyaltyRewards.items[0].value,
1991
+ threshold: null,
1992
+ validityOption: {
1993
+ validForDay: 7
1994
+ },
1995
+ earningOption: {
1996
+ type: "FIXED",
1997
+ amount: 1
1998
+ }
1999
+ },
2000
+ o.value.length
2001
+ );
2002
+ }
2003
+ function s(d) {
2004
+ var f, y;
2005
+ return d.type == "VOUCHER" ? (f = d.collectibleConfig) == null ? void 0 : f.name : sentenceCase(
2006
+ ((y = a.loyaltyRewards.items.find(
2007
+ (C) => C.value == d.collectible
2008
+ )) == null ? void 0 : y.label) || ""
2009
+ );
2010
+ }
2011
+ return (d, f) => {
2012
+ const y = resolveComponent("FmButton"), C = resolveComponent("FmCard"), E = resolveComponent("FmHelperText");
2013
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
2014
+ f[2] || (f[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1)),
2015
+ createVNode(y, {
2016
+ label: "Add Reward",
2017
+ onClick: f[0] || (f[0] = (k) => h()),
2018
+ variant: "plain",
2019
+ icon: "add"
2020
+ }),
2021
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (k, B) => (openBlock(), createBlock(C, {
2022
+ key: B,
2023
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2024
+ variant: "outlined",
2025
+ onClick: (x) => p(B)
2026
+ }, {
2027
+ default: withCtx(() => [
2028
+ createElementVNode("div", null, [
2029
+ createElementVNode("div", _hoisted_2$3, toDisplayString(v(k).label), 1),
2030
+ createElementVNode("div", _hoisted_3$3, toDisplayString(v(k).sublabel), 1)
2031
+ ]),
2032
+ createVNode(y, {
2033
+ icon: "delete",
2034
+ variant: "tertiary",
2035
+ onClick: (x) => (x.stopPropagation(), g(B))
2036
+ }, null, 8, ["onClick"])
2037
+ ]),
2038
+ _: 2
2039
+ }, 1032, ["onClick"]))), 128)),
2040
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((k) => k.path.join(".") == ""), (k) => (openBlock(), createBlock(E, {
2041
+ key: k.message,
2042
+ text: k.message,
2043
+ state: "error"
2044
+ }, null, 8, ["text"]))), 128)),
2045
+ f[3] || (f[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
2046
+ createVNode(C, {
2047
+ variant: "outlined",
2048
+ class: "p-24 space-y-16 w-fit"
2049
+ }, {
2050
+ default: withCtx(() => [
2051
+ createElementVNode("div", _hoisted_4$2, [
2052
+ createElementVNode("div", null, [
2053
+ createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(e.modelValue[e.modelValue.length - 1].earningOption.amount > 1 ? e.modelValue[e.modelValue.length - 1].earningOption.amount : "") + " " + toDisplayString(s(e.modelValue[e.modelValue.length - 1])), 1),
2054
+ f[1] || (f[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
2055
+ ])
2056
+ ]),
2057
+ createElementVNode("div", _hoisted_6$2, [
2058
+ createVNode(_sfc_main$5, {
2059
+ type: e.mission.type,
2060
+ "max-range": e.mission.end,
2061
+ currentRange: e.mission.end / 4,
2062
+ markers: e.modelValue.map((k) => k.threshold)
2063
+ }, null, 8, ["type", "max-range", "currentRange", "markers"]),
2064
+ e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
2065
+ ])
2066
+ ]),
2067
+ _: 1
2068
+ }),
2069
+ createVNode(_sfc_main$6, {
2070
+ ref_key: "sheetRef",
2071
+ ref: n,
2072
+ "onUpdate:modelValue": c,
2073
+ "max-threshold": e.mission.end
2074
+ }, null, 8, ["max-threshold"])
2075
+ ]);
2076
+ };
2077
+ }
2078
+ }), _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({
2079
+ __name: "MissionInput",
2080
+ props: {
2081
+ modelValue: Object
2082
+ },
2083
+ emits: ["update:model-value"],
2084
+ setup(e, { emit: m }) {
2085
+ const r = e, u = computed(() => {
2086
+ const o = FdoMission.safeParse(r.modelValue);
2087
+ return o.success ? [] : o.error.errors;
2088
+ }), a = computed(() => [
2089
+ {
2090
+ label: "Stamp",
2091
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
2092
+ value: F_MISSION_TYPE.enum.STAMP
2093
+ },
2094
+ {
2095
+ label: "Progress",
2096
+ description: "Reward customers when they reach a cumulative spending goal.",
2097
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
2098
+ }
2099
+ ]), i = m;
2100
+ return (o, l) => {
2101
+ var v;
2102
+ const n = resolveComponent("FmCard"), c = resolveComponent("FmStepperField");
2103
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
2104
+ createElementVNode("div", _hoisted_2$2, [
2105
+ l[1] || (l[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
2106
+ 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)),
2107
+ createElementVNode("div", _hoisted_3$2, [
2108
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (p) => {
2109
+ var g, h;
2110
+ return openBlock(), createBlock(n, {
2111
+ variant: "outlined",
2112
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2113
+ "col-span-2": unref(a).length == 1,
2114
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((g = e.modelValue) == null ? void 0 : g.type) == p.value,
2115
+ "hover:bg-fm-color-opacity-sm": ((h = e.modelValue) == null ? void 0 : h.type) != p.value
2116
+ }]),
2117
+ onClick: () => {
2118
+ var s, d;
2119
+ ((s = e.modelValue) == null ? void 0 : s.type) != p.value && i("update:model-value", {
2120
+ ...e.modelValue,
2121
+ type: p.value,
2122
+ end: ((d = e.modelValue) == null ? void 0 : d.end) || 1
2123
+ });
2124
+ },
2125
+ key: p.value
2126
+ }, {
2127
+ default: withCtx(() => [
2128
+ createElementVNode("div", _hoisted_4$1, toDisplayString(p.label), 1),
2129
+ createElementVNode("div", _hoisted_5$1, toDisplayString(p.description), 1)
2130
+ ]),
2131
+ _: 2
2132
+ }, 1032, ["class", "onClick"]);
2133
+ }), 128))
2134
+ ])
2135
+ ]),
2136
+ createElementVNode("div", _hoisted_6$1, [
2137
+ l[3] || (l[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
2138
+ 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)),
2139
+ createVNode(c, {
2140
+ label: "Maximum to collect",
2141
+ "model-value": ((v = e.modelValue) == null ? void 0 : v.end) || null,
2142
+ "onUpdate:modelValue": l[0] || (l[0] = (p) => {
2143
+ var g;
2144
+ return i("update:model-value", {
2145
+ ...e.modelValue,
2146
+ type: ((g = e.modelValue) == null ? void 0 : g.type) || "STAMP",
2147
+ end: p
2148
+ });
2149
+ }),
2150
+ "helper-text": unref(ZodHelper).helperText(unref(u), "end") || "Set the threshold required for reward eligibility",
2151
+ "helper-state": unref(ZodHelper).helperState(unref(u), "end") || "none"
2152
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
2153
+ ])
2154
+ ]);
2155
+ };
2156
+ }
2157
+ }), _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
2158
+ __name: "TemplateInput",
2159
+ props: {
2160
+ field: { type: Object, required: !0 },
2161
+ modelValue: {
2162
+ type: Object
2163
+ },
2164
+ schema: {
2165
+ type: Object
2166
+ },
2167
+ extras: {
2168
+ type: Object
2169
+ },
2170
+ helperText: {
2171
+ type: String
2172
+ },
2173
+ disabled: {
2174
+ type: Boolean,
2175
+ default: !1
2176
+ }
2177
+ },
2178
+ emits: ["update:model-value", "update:file"],
2179
+ setup(e, { emit: m }) {
2180
+ const { t: r } = useI18n(), u = e, a = m;
2181
+ function i(c) {
2182
+ switch (u.field.type) {
2183
+ case "timeframe":
2184
+ const v = c.startDate ? hooks(c.startDate).startOf("day").toISOString() : void 0, p = c.endDate ? hooks(c.endDate).endOf("day").toISOString() : void 0;
2185
+ a("update:model-value", {
2186
+ type: "timeframe",
2187
+ property: "__now",
2188
+ start: v,
2189
+ end: p
2190
+ });
2191
+ break;
2192
+ case "image": {
2193
+ a(
2194
+ "update:file",
2195
+ c,
2196
+ o.value || firebaseStorage.collectibleImagePath(void 0, c)
2197
+ );
2198
+ break;
2199
+ }
2200
+ default:
2201
+ a("update:model-value", c);
2202
+ break;
2203
+ }
2204
+ }
2205
+ const o = computed(() => {
2206
+ switch (u.field.type) {
2207
+ case "timeframe": {
2208
+ const c = u.modelValue;
2209
+ return {
2210
+ startDate: c != null && c.start ? hooks(c == null ? void 0 : c.start).format("YYYY-MM-DD") : null,
2211
+ endDate: c != null && c.end ? hooks(c == null ? void 0 : c.end).format("YYYY-MM-DD") : null
2212
+ };
2213
+ }
2214
+ default:
2215
+ return u.modelValue;
2216
+ }
2217
+ });
2218
+ function l() {
2219
+ if (!n.value.schema) return [];
2220
+ const c = n.value.schema.safeParse(u.modelValue);
2221
+ return c.success ? [] : c.error.errors;
2222
+ }
2223
+ const n = computed(() => ({
2224
+ schema: u.schema,
2225
+ unwrapped: u.schema ? ZodHelper.unwrap(u.schema) : void 0,
2226
+ rules: u.schema ? [ZodHelper.ruleAtPath(u.schema, "")] : void 0,
2227
+ labelMark: u.schema && ZodHelper.isRequired(u.schema) == !1 ? "optional" : void 0,
2228
+ zodLabel: u.schema ? ZodHelper.toInputLabel(u.schema, u.field.label) : void 0
2229
+ }));
2230
+ return (c, v) => {
2231
+ var f, y, C, E, k;
2232
+ const p = resolveComponent("FmTextField"), g = resolveComponent("FmStepperField"), h = resolveComponent("FmTextarea"), s = resolveComponent("FmHelperText"), d = resolveComponent("FmSwitch");
2233
+ return e.field.type === "text" ? (openBlock(), createBlock(p, {
2234
+ key: 0,
2235
+ label: e.field.label,
2236
+ "label-mark": unref(n).labelMark,
2237
+ rules: unref(n).rules,
2238
+ "model-value": unref(o),
2239
+ "onUpdate:modelValue": i
2240
+ }, null, 8, ["label", "label-mark", "rules", "model-value"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2241
+ createVNode(JsonViewer, {
2242
+ json: { schema: unref(n).unwrapped, props: u }
2243
+ }, null, 8, ["json"]),
2244
+ createVNode(g, {
2245
+ label: e.field.label,
2246
+ "label-mark": e.field.isRuleChildren ? void 0 : unref(n).labelMark,
2247
+ "model-value": unref(o),
2248
+ rules: e.field.isRuleChildren ? [] : unref(n).rules,
2249
+ "onUpdate:modelValue": i,
2250
+ "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
2251
+ "helper-text": e.field.isRuleChildren ? e.helperText : void 0
2252
+ }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
2253
+ ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(h, {
2254
+ key: 2,
2255
+ label: e.field.label,
2256
+ "label-mark": unref(n).labelMark,
2257
+ rules: unref(n).rules,
2258
+ "model-value": unref(o),
2259
+ "onUpdate:modelValue": i,
2260
+ "show-word-count": "",
2261
+ "max-length": (k = (E = (C = (y = (f = unref(n)) == null ? void 0 : f.unwrapped) == null ? void 0 : y._def) == null ? void 0 : C.checks) == null ? void 0 : E.find((B) => B.kind == "max")) == null ? void 0 : k.value
2262
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$j, {
2263
+ key: 3,
2264
+ "campaign-type": e.extras,
2265
+ "model-value": unref(o),
2266
+ disabled: e.disabled,
2267
+ "onUpdate:modelValue": i
2268
+ }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
2269
+ createVNode(_sfc_main$h, {
2270
+ "model-value": unref(o),
2271
+ "onUpdate:modelValue": i
2272
+ }, null, 8, ["model-value"]),
2273
+ createVNode(s, {
2274
+ class: "!mt-[8px]",
2275
+ text: unref(ZodHelper).helperText(l(), ""),
2276
+ state: unref(ZodHelper).helperState(l(), "")
2277
+ }, null, 8, ["text", "state"])
2278
+ ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$v, {
2279
+ key: 5,
2280
+ thumbnail: unref(o),
2281
+ "aspect-ratio": "16 / 9",
2282
+ class: "w-1/2 xs:w-2/3",
2283
+ "onUpdate:file": i
2284
+ }, {
2285
+ label: withCtx(() => [
2286
+ (openBlock(), createBlock(resolveDynamicComponent(unref(n).zodLabel)))
2287
+ ]),
2288
+ _: 1
2289
+ }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(d, {
2290
+ key: 6,
2291
+ label: e.field.label,
2292
+ "label-placement": "right",
2293
+ sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
2294
+ "label-mark": unref(n).labelMark,
2295
+ rules: unref(n).rules,
2296
+ "model-value": unref(o),
2297
+ "onUpdate:modelValue": i
2298
+ }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$x, {
2299
+ key: 7,
2300
+ "model-value": unref(o),
2301
+ "onUpdate:modelValue": i,
2302
+ "no-campaign": !1,
2303
+ schema: unref(n).schema,
2304
+ "is-mission": e.extras === "MISSION"
2305
+ }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$y, {
2306
+ key: 8,
2307
+ "model-value": unref(o),
2308
+ "onUpdate:modelValue": i
2309
+ }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
2310
+ createVNode(_sfc_main$w, {
2311
+ "model-value": unref(o),
2312
+ "onUpdate:modelValue": i,
2313
+ "can-set-auto-apply": e.field.property == "campaign.effect"
2314
+ }, null, 8, ["model-value", "can-set-auto-apply"]),
2315
+ unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(s, {
2316
+ key: 0,
2317
+ class: "!mt-[8px]",
2318
+ text: unref(r)("connect.campaign.common.effect_required"),
2319
+ state: "error"
2320
+ }, null, 8, ["text"]))
2321
+ ], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$A, {
2322
+ key: 10,
2323
+ "allow-email": !0,
2324
+ "model-value": unref(o),
2325
+ "onUpdate:modelValue": i,
2326
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
2327
+ "trigger-type": e.field.extras,
2328
+ "helper-state": unref(ZodHelper).helperState(l(), "")
2329
+ }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$e, {
2330
+ key: 11,
2331
+ "model-value": unref(o),
2332
+ "onUpdate:modelValue": i,
2333
+ extras: e.extras,
2334
+ "error-text": e.helperText
2335
+ }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$z, {
2336
+ key: 12,
2337
+ type: "custom",
2338
+ "model-value": unref(o),
2339
+ "onUpdate:modelValue": i,
2340
+ "helper-text": e.helperText || unref(ZodHelper).helperText(l(), "")
2341
+ }, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$d, {
2342
+ key: 13,
2343
+ "model-value": unref(o),
2344
+ "onUpdate:modelValue": i
2345
+ }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
2346
+ key: 14,
2347
+ "model-value": unref(o),
2348
+ "onUpdate:modelValue": i
2349
+ }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
2350
+ key: 15,
2351
+ "model-value": unref(o),
2352
+ "onUpdate:modelValue": i
2353
+ }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
2354
+ key: 16,
2355
+ "model-value": unref(o),
2356
+ "onUpdate:modelValue": i
2357
+ }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
2358
+ key: 17,
2359
+ "model-value": unref(o),
2360
+ "onUpdate:modelValue": i,
2361
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
2362
+ "helper-state": unref(ZodHelper).helperState(l(), "")
2363
+ }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
2364
+ key: 18,
2365
+ "model-value": unref(o),
2366
+ "onUpdate:modelValue": i,
2367
+ mission: e.extras.mission
2368
+ }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
2369
+ createVNode(_sfc_main$g, {
2370
+ "model-value": unref(o),
2371
+ "onUpdate:modelValue": i,
2372
+ "start-date": e.extras.start,
2373
+ "end-date": e.extras.end
2374
+ }, null, 8, ["model-value", "start-date", "end-date"]),
2375
+ e.helperText ? (openBlock(), createBlock(s, {
2376
+ key: 0,
2377
+ class: "!mt-[8px]",
2378
+ text: e.helperText,
2379
+ state: "error"
2380
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2381
+ ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
2382
+ createVNode(_sfc_main$o, {
2383
+ "model-value": unref(o),
2384
+ "onUpdate:modelValue": i
2385
+ }, null, 8, ["model-value"]),
2386
+ e.helperText ? (openBlock(), createBlock(s, {
2387
+ key: 0,
2388
+ class: "!mt-[8px]",
2389
+ text: e.helperText,
2390
+ state: "error"
2391
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2392
+ ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
2393
+ e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(o).rules.g_time).length > 0 ? (openBlock(), createBlock(s, {
2394
+ key: 0,
2395
+ state: "warning",
2396
+ text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
2397
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
2398
+ createVNode(_sfc_main$n, {
2399
+ "model-value": unref(o),
2400
+ "onUpdate:modelValue": i
2401
+ }, null, 8, ["model-value"]),
2402
+ e.helperText ? (openBlock(), createBlock(s, {
2403
+ key: 1,
2404
+ class: "!mt-[8px]",
2405
+ text: e.helperText,
2406
+ state: "error"
2407
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2408
+ ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
2409
+ createVNode(_sfc_main$m, {
2410
+ "model-value": unref(o),
2411
+ "onUpdate:modelValue": i
2412
+ }, null, 8, ["model-value"]),
2413
+ e.helperText ? (openBlock(), createBlock(s, {
2414
+ key: 0,
2415
+ class: "!mt-[8px]",
2416
+ text: e.helperText,
2417
+ state: "error"
2418
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2419
+ ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
2420
+ createVNode(_sfc_main$k, {
2421
+ "model-value": unref(o),
2422
+ "onUpdate:modelValue": i
2423
+ }, null, 8, ["model-value"]),
2424
+ e.helperText ? (openBlock(), createBlock(s, {
2425
+ key: 0,
2426
+ class: "!mt-[8px]",
2427
+ text: e.helperText,
2428
+ state: "error"
2429
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2430
+ ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
2431
+ createVNode(_sfc_main$l, {
2432
+ "model-value": unref(o),
2433
+ "onUpdate:modelValue": i
2434
+ }, null, 8, ["model-value"]),
2435
+ e.helperText ? (openBlock(), createBlock(s, {
2436
+ key: 0,
2437
+ class: "!mt-[8px]",
2438
+ text: e.helperText,
2439
+ state: "error"
2440
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2441
+ ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
2442
+ createVNode(_sfc_main$9, {
2443
+ "model-value": unref(o),
2444
+ "onUpdate:modelValue": i
2445
+ }, null, 8, ["model-value"]),
2446
+ e.helperText ? (openBlock(), createBlock(s, {
2447
+ key: 0,
2448
+ class: "!mt-[8px]",
2449
+ text: e.helperText,
2450
+ state: "error"
2451
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
2452
+ ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(u.field), 1));
2453
+ };
2454
+ }
2455
+ }), _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({
2456
+ __name: "CampaignSummary",
2457
+ props: {
2458
+ data: {
2459
+ type: Object,
2460
+ required: !0
2461
+ }
2462
+ },
2463
+ setup(e) {
2464
+ const { t: m, te: r } = useI18n();
2465
+ return (u, a) => {
2466
+ const i = resolveComponent("FmCard");
2467
+ return openBlock(), createBlock(i, {
2468
+ variant: "outlined",
2469
+ class: "p-16 space-y-8"
2470
+ }, {
2471
+ default: withCtx(() => [
2472
+ createElementVNode("div", _hoisted_1$1, toDisplayString(unref(m)("connect.campaign.common.summary")), 1),
2473
+ a[0] || (a[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
2474
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (o, l) => (openBlock(), createElementBlock("div", {
2475
+ class: "space-y-4",
2476
+ key: l
2477
+ }, [
2478
+ o ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2479
+ createElementVNode("div", _hoisted_2$1, toDisplayString(unref(m)(`${l}`)), 1),
2480
+ createElementVNode("div", _hoisted_3$1, toDisplayString(unref(r)(`${o}`) ? unref(m)(`${o}`) : o), 1)
2481
+ ], 64)) : createCommentVNode("", !0)
2482
+ ]))), 128))
2483
+ ]),
2484
+ _: 1
2485
+ });
2486
+ };
2487
+ }
2488
+ }), _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 = {
2489
+ key: 0,
2490
+ class: "max-w-6xl mx-auto"
2491
+ }, _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({
2492
+ __name: "EditCampaignSheet",
2493
+ emits: ["submit:model-value"],
2494
+ setup(__props, { expose: __expose, emit: __emit }) {
2495
+ const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
2496
+ TEMPLATES.VOUCHER
2497
+ ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
2498
+ async function showSheet(visible, type, campaign, selectedTemplate) {
2499
+ var e, m;
2500
+ if (sheetVisible.value = visible, visible == !0) {
2501
+ try {
2502
+ isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
2503
+ } catch {
2504
+ } finally {
2505
+ await new Promise((r) => setTimeout(r, 120)), isLoading.value = !1;
2506
+ }
2507
+ template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
2508
+ ...(m = template.value) == null ? void 0 : m.defaultValue
2509
+ }), "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`;
2510
+ }
2511
+ }
2512
+ async function hideSheet() {
2513
+ Dialog.open({
2514
+ title: t("connect.campaign.common.unsaved_changes"),
2515
+ message: t("connect.campaign.common.unsaved_changes"),
2516
+ primaryActions: {
2517
+ text: t("connect.campaign.common.unsaved_changes_confirm"),
2518
+ close: !0
2519
+ },
2520
+ secondaryActions: {
2521
+ text: t("connect.campaign.common.unsaved_changes_cancel"),
2522
+ close: !1
2523
+ }
2524
+ }).onPrimary(() => {
2525
+ sheetVisible.value = !1;
2526
+ }).onSecondary(() => {
2527
+ Dialog.close();
2528
+ });
2529
+ }
2530
+ const emits = __emit, errors = computed(() => {
2531
+ const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
2532
+ return e.success ? [] : e.error.errors;
2533
+ });
2534
+ function stepErrors(e = currentStep.value - 1) {
2535
+ const m = template.value.steps[e].groups.flatMap(
2536
+ (r) => r.fields.map((u) => u.property)
2537
+ );
2538
+ return errors.value.filter((r) => m.includes(r.path.join(".")));
2539
+ }
2540
+ __expose({ showSheet });
2541
+ function showSummaryDialog() {
2542
+ Dialog.open({
2543
+ title: "",
2544
+ dialogComponent: _sfc_main$1,
2545
+ dialogComponentProps: {
2546
+ data: data.value
2547
+ }
2548
+ });
2549
+ }
2550
+ function onUpdateProperty(e, m) {
2551
+ if (_.set(data.value, e, m), e == "campaign.event.type") {
2552
+ const r = RuleBuilder.setRuleToGroup(
2553
+ RuleBuilder.scaffoldGroup(),
2554
+ [
2555
+ RuleBuilder.scaffoldGroup("g_schedule"),
2556
+ RuleBuilder.scaffoldGroup("g_time"),
2557
+ RuleBuilder.scaffoldGroup("g_user"),
2558
+ RuleBuilder.scaffoldGroup("g_bill")
2559
+ ]
2560
+ ), u = RuleBuilder.setRuleToGroup(
2561
+ RuleBuilder.scaffoldGroup("g_schedule"),
2562
+ [
2563
+ RuleBuilder.constructEntry(
2564
+ "trigger.date",
2565
+ "_rrule",
2566
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
2567
+ ),
2568
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
2569
+ ],
2570
+ "&&"
2571
+ );
2572
+ if (m != "SCHEDULE") {
2573
+ _.set(data.value, "campaign.event.rule", r);
2574
+ return;
2575
+ }
2576
+ _.set(
2577
+ data.value,
2578
+ "campaign.event.rule",
2579
+ RuleBuilder.setRuleToGroup(r, u)
2580
+ );
2581
+ }
2582
+ e == "campaign.notify" && m == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
2583
+ }
2584
+ async function onUpdateFile(e, m) {
2585
+ return e ? await minor(async () => firebaseStorage.update(m, e), {
2586
+ message: `${e ? "Uploading" : "Removing"} file`,
2587
+ successMessage: `File ${e ? "uploaded" : "removed"} successfully`
2588
+ }) : "";
2589
+ }
2590
+ function isDisable(e) {
2591
+ var m, r;
2592
+ switch (e == null ? void 0 : e.property) {
2593
+ case "campaign.event.type":
2594
+ return ((r = (m = data.value) == null ? void 0 : m.campaign) == null ? void 0 : r._id) || !1;
2595
+ default:
2596
+ return !1;
2597
+ }
2598
+ }
2599
+ function onSubmit() {
2600
+ const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
2601
+ e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
2602
+ }
2603
+ return (e, m) => {
2604
+ const r = resolveComponent("FmButton"), u = resolveComponent("FmStep"), a = resolveComponent("FmStepper"), i = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
2605
+ return openBlock(), createBlock(o, {
2606
+ "fullscreen-size": "lg",
2607
+ modelValue: unref(sheetVisible),
2608
+ "onUpdate:modelValue": [
2609
+ m[7] || (m[7] = (l) => isRef(sheetVisible) ? sheetVisible.value = l : null),
2610
+ m[8] || (m[8] = (l) => sheetVisible.value = l)
2611
+ ]
2612
+ }, createSlots({
2613
+ "top-sheet-header": withCtx(() => [
2614
+ createElementVNode("div", _hoisted_1, [
2615
+ createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
2616
+ createElementVNode("div", _hoisted_2, [
2617
+ createVNode(r, {
2618
+ onClick: m[0] || (m[0] = (l) => hideSheet()),
2619
+ label: unref(t)("connect.campaign.common.cancel"),
2620
+ variant: "tertiary"
2621
+ }, null, 8, ["label"]),
2622
+ createVNode(r, {
2623
+ onClick: onSubmit,
2624
+ label: unref(t)("connect.campaign.common.save"),
2625
+ disabled: unref(errors).length > 0
2626
+ }, null, 8, ["label", "disabled"])
2627
+ ])
2628
+ ])
2629
+ ]),
2630
+ _: 2
2631
+ }, [
2632
+ unref(isLoading) ? {
2633
+ name: "default",
2634
+ fn: withCtx(() => [
2635
+ createElementVNode("div", _hoisted_9, [
2636
+ createElementVNode("div", _hoisted_10, [
2637
+ createElementVNode("div", _hoisted_11, [
2638
+ m[9] || (m[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
2639
+ createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
2640
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2641
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2642
+ createElementVNode("div", { class: "space-y-3" }, [
2643
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2644
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2645
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2646
+ ]),
2647
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2648
+ ]),
2649
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2650
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2651
+ createElementVNode("div", { class: "space-y-3" }, [
2652
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2653
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2654
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2655
+ ]),
2656
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2657
+ ])
2658
+ ])
2659
+ ], -1)),
2660
+ createVNode(i, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
2661
+ ])
2662
+ ])
2663
+ ])
2664
+ ]),
2665
+ key: "1"
2666
+ } : {
2667
+ name: "default",
2668
+ fn: withCtx(() => [
2669
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
2670
+ createVNode(a, {
2671
+ modelValue: unref(currentStep),
2672
+ "onUpdate:modelValue": m[1] || (m[1] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2673
+ orientation: "horizontal",
2674
+ class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
2675
+ }, {
2676
+ default: withCtx(() => [
2677
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(u, {
2678
+ key: l.name,
2679
+ title: l.name,
2680
+ value: n + 1,
2681
+ error: () => stepErrors(n).length > 0,
2682
+ complete: () => n + 1 <= unref(currentStep)
2683
+ }, null, 8, ["title", "value", "error", "complete"]))), 128))
2684
+ ]),
2685
+ _: 1
2686
+ }, 8, ["modelValue"]),
2687
+ createElementVNode("div", _hoisted_4, [
2688
+ createVNode(r, {
2689
+ icon: "close",
2690
+ variant: "tertiary",
2691
+ onClick: m[2] || (m[2] = (l) => sheetVisible.value = !1)
2692
+ }),
2693
+ createVNode(a, {
2694
+ modelValue: unref(currentStep),
2695
+ "onUpdate:modelValue": m[3] || (m[3] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2696
+ orientation: "horizontal",
2697
+ class: "flex-1"
2698
+ }, {
2699
+ default: withCtx(() => [
2700
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(u, {
2701
+ key: l.name,
2702
+ title: unref(sheetTitle),
2703
+ description: l.name,
2704
+ value: n + 1,
2705
+ error: () => stepErrors(n).length > 0,
2706
+ complete: () => n + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
2707
+ }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
2708
+ ]),
2709
+ _: 1
2710
+ }, 8, ["modelValue"]),
2711
+ createVNode(r, {
2712
+ icon: "info",
2713
+ variant: "tertiary",
2714
+ onClick: m[4] || (m[4] = () => showSummaryDialog())
2715
+ })
2716
+ ]),
2717
+ createElementVNode("div", _hoisted_5, [
2718
+ createElementVNode("div", _hoisted_6, [
2719
+ createVNode(JsonViewer, {
2720
+ json: {
2721
+ data: unref(data),
2722
+ errors: unref(errors).map(
2723
+ (l) => `${l.path.join(".")} - ${l.message}`
2724
+ ),
2725
+ stepErrors: stepErrors().map(
2726
+ (l) => `${l.path.join(".")} - ${l.message}`
2727
+ ),
2728
+ schema: unref(schema)
2729
+ }
2730
+ }, null, 8, ["json"]),
2731
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
2732
+ (l) => l.fields.length && (!l.condition || unref(_).get(unref(data), l.condition.property) == l.condition.value == (l.condition.not != !0))
2733
+ ), (l, n) => (openBlock(), createElementBlock("div", {
2734
+ key: n,
2735
+ class: "space-y-24"
2736
+ }, [
2737
+ createElementVNode("div", _hoisted_7, toDisplayString(l.name), 1),
2738
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(l.fields, (c, v) => (openBlock(), createElementBlock("div", { key: v }, [
2739
+ (openBlock(), createBlock(_sfc_main$2, {
2740
+ key: v,
2741
+ field: c,
2742
+ modelValue: unref(_).get(unref(data), c.property),
2743
+ disabled: isDisable(c),
2744
+ "onUpdate:modelValue": (p) => onUpdateProperty(c.property, p),
2745
+ "onUpdate:file": async (p, g) => {
2746
+ const h = await onUpdateFile(p, g);
2747
+ onUpdateProperty(c.property, h || "");
2748
+ },
2749
+ schema: unref(ZodHelper).typeAtPath(
2750
+ unref(schema),
2751
+ c.property,
2752
+ unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
2753
+ ),
2754
+ "helper-text": unref(ZodHelper).helperText(unref(errors), c.property),
2755
+ extras: c.extras != null ? c.extras == "" ? unref(data) : unref(_).get(unref(data), c.extras) : void 0
2756
+ }, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-text", "extras"]))
2757
+ ]))), 128))
2758
+ ]))), 128)),
2759
+ createElementVNode("div", _hoisted_8, [
2760
+ createVNode(r, {
2761
+ label: "Back",
2762
+ variant: "tertiary",
2763
+ disabled: unref(currentStep) == 1,
2764
+ onClick: m[5] || (m[5] = (l) => currentStep.value--)
2765
+ }, null, 8, ["disabled"]),
2766
+ createVNode(r, {
2767
+ disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
2768
+ label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
2769
+ onClick: m[6] || (m[6] = (l) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
2770
+ }, null, 8, ["disabled", "label"])
2771
+ ])
2772
+ ]),
2773
+ createVNode(_sfc_main$1, {
2774
+ data: unref(data),
2775
+ class: "xs:hidden"
2776
+ }, null, 8, ["data"])
2777
+ ])
2778
+ ])) : createCommentVNode("", !0)
2779
+ ]),
2780
+ key: "0"
2781
+ }
2782
+ ]), 1032, ["modelValue"]);
2783
+ };
2784
+ }
2785
+ });
2786
+ export {
2787
+ _sfc_main as _
2788
+ };