@feedmepos/mf-connect 0.1.0-beta.4 → 0.1.0-beta.40

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