@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21

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 (97) hide show
  1. package/dist/Analytic-CZ8gfj2V.js +424 -0
  2. package/dist/{App-D8a5eW51.js → App-Da9h7lhI.js} +397 -384
  3. package/dist/{Broadcast-C8jgMe6g.js → Broadcast-m6ehTw7F.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
  5. package/dist/Card-DqZveZ44.js +685 -0
  6. package/dist/{Collections-lMrdPUuM.js → Collections-XIY6SLgQ.js} +4 -4
  7. package/dist/{Credit-CJfU5tP4.js → Credit-B6Yg3_al.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-D1gub9ZP.js +2198 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +8 -8
  11. package/dist/{Experience-Bp2ki8gU.js → Experience-CsoneWLZ.js} +8 -8
  12. package/dist/{Game-BpTf6ebE.js → Game-B029f9yE.js} +15 -15
  13. package/dist/Index-B2LvLfrR.js +226 -0
  14. package/dist/Marketing-DUTyDRXu.js +20070 -0
  15. package/dist/{Member-BSWyy32a.js → Member-CATybMaC.js} +4 -4
  16. package/dist/MemberList-DxvQ7DnC.js +1045 -0
  17. package/dist/{MemberTransactions-BzHiXCnp.js → MemberTransactions-fEZyBY9P.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
  19. package/dist/{Mission-8IGT3T2C.js → Mission-Cl3O0ULj.js} +16 -16
  20. package/dist/Overview-BVI2xGvT.js +1014 -0
  21. package/dist/{Point-CbbJ6ohd.js → Point-DSVn47pK.js} +23 -23
  22. package/dist/{Promotion-BYXCJa_S.js → Promotion-C4HyMpPg.js} +53 -47
  23. package/dist/Record-BSKXwUu2.js +187 -0
  24. package/dist/Reward-Cus20Wq5.js +399 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js +151 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js +1597 -0
  27. package/dist/Segment-DAHJ2FYV.js +567 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js +181 -0
  29. package/dist/{Setting-CLpvvZTv.js → Setting-D7dKlTiZ.js} +8 -8
  30. package/dist/Store-DQdWn1Dw.js +1745 -0
  31. package/dist/{StoreRewards-CUM2irXK.js → StoreRewards-Cut9mJGn.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js +957 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
  34. package/dist/{Tier-DZTDxWBo.js → Tier-DGpNybHO.js} +15 -15
  35. package/dist/{Title-C2Dr5ceK.js → Title-D5y8GEwE.js} +15 -15
  36. package/dist/{Transaction-BL4mS29d.js → Transaction-CCnZouEv.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js +130 -0
  38. package/dist/{Voucher-Cx0r2-df.js → Voucher-BJ6RC4SS.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
  41. package/dist/{app-wE5HTF_Y.js → app-D3chCumI.js} +1279 -1282
  42. package/dist/{app-B_xuZ5HB.js → app-PfWyqx7U.js} +1 -1
  43. package/dist/app.js +1 -1
  44. package/dist/{business-DSv8zM8C.js → business-trsrJyHK.js} +1 -1
  45. package/dist/{campaign-7y5qquHZ.js → campaign-B1rgdv77.js} +2 -2
  46. package/dist/collectible.enum-ZoD0ya1M.js +19 -0
  47. package/dist/{collection.fn-BxVZQAx0.js → collection.fn-CnQjdokW.js} +2 -2
  48. package/dist/{dto-Ew1QwLci.js → dto-DuJumvC2.js} +12 -20
  49. package/dist/{effect-BzPh8fRI.js → effect-CFYktLyZ.js} +9 -9
  50. package/dist/email-addresses-BocLAqLt.js +705 -0
  51. package/dist/{export-C9tDplkA.js → export-BDxbvd3c.js} +3 -3
  52. package/dist/{helper-Sz7oQ0F4.js → helper-Bx6u7f_W.js} +1 -1
  53. package/dist/{index-DH_1nOJ_.js → index-7QsBQpBM.js} +39 -35
  54. package/dist/{index-z0IfdrZk.js → index-AcoIUTDS.js} +203 -195
  55. package/dist/{index-C3_4GUiI.js → index-BAUe6Mqp.js} +7 -1
  56. package/dist/{index-C0lpADCo.js → index-C20tnKDo.js} +1 -1
  57. package/dist/{index-C-SOz7jt.js → index-CDgSJNKm.js} +1 -1
  58. package/dist/{index-DBMaUGYI.js → index-CTnZ9dt0.js} +30 -26
  59. package/dist/index-CUMB0mpB.js +28997 -0
  60. package/dist/index-CsF6BSZU.js +1067 -0
  61. package/dist/index-CsaQJMAR.js +66 -0
  62. package/dist/{index-tv4t0Pnh.js → index-DwXHEi0X.js} +1 -1
  63. package/dist/{index-_3qBsogG.js → index-ZXWgygOr.js} +1500 -1479
  64. package/dist/index-_v_LQTuR.js +53 -0
  65. package/dist/index-kLMiwwB-.js +38 -0
  66. package/dist/{index-gIRszcHf.js → index-pRpTA8Kd.js} +1 -1
  67. package/dist/{index.esm2017-BnKJDxUo.js → index.esm2017-DuOZ7nuk.js} +33 -33
  68. package/dist/{loading-Ds-yFYhc.js → loading-BTEwnG5-.js} +591 -597
  69. package/dist/{membership-DaiVw9qF.js → membership-DkH7qw6W.js} +51 -43
  70. package/dist/money-BfCdj0Ts.js +15 -0
  71. package/dist/number-BKHcstZb.js +12 -0
  72. package/dist/objectid-CumRza_j.js +145 -0
  73. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  74. package/dist/reward-DpR3xoxT.js +36 -0
  75. package/dist/{rule-Cd2M6Ri2.js → rule-Hb9_sJvP.js} +180 -177
  76. package/dist/{rule-builder-B6og27Q1.js → rule-builder-BhwlX4fv.js} +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/{template-DouRWBpv.js → template-PkDFDppy.js} +5 -5
  79. package/dist/trigger-vLHrldAH.js +114 -0
  80. package/dist/{vue-i18n-BTlOChXs.js → vue-i18n-ComnFt3O.js} +2 -2
  81. package/dist/{xlsx-SahfXQ70.js → xlsx-CsUJ1mq4.js} +1 -1
  82. package/package.json +8 -7
  83. package/dist/Analytic-DSD9TsKr.js +0 -622
  84. package/dist/Card-C1K7ULPo.js +0 -825
  85. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js +0 -2809
  86. package/dist/Marketing-BiKE2gxA.js +0 -316
  87. package/dist/MemberList-CHlGREyR.js +0 -1733
  88. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js +0 -1753
  89. package/dist/Segment-DXDNM0yd.js +0 -437
  90. package/dist/Store-C6-P6bwc.js +0 -1511
  91. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js +0 -890
  92. package/dist/index-BQm0C3Jm.js +0 -298
  93. package/dist/index-CuvNtC_M.js +0 -61
  94. package/dist/index-D-2nFLsg.js +0 -762
  95. package/dist/index-Dy4pmQpt.js +0 -29193
  96. package/dist/money-BHtBdZoz.js +0 -15
  97. package/dist/number-CZhcB8ef.js +0 -12
@@ -0,0 +1,2198 @@
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-D3chCumI.js";
4
+ import { Z as ZodHelper } from "./zod-Bg2FbC-D.js";
5
+ import { c as getCampaignSummaryObject, d as campaignRefinement, e as CampaignDtos, b as CampaignOptions, f as campaignTransform } from "./dto-DuJumvC2.js";
6
+ import { u as useMembershipStore } from "./membership-DkH7qw6W.js";
7
+ import { u as useBusinessStore } from "./business-trsrJyHK.js";
8
+ import "./index-ZXWgygOr.js";
9
+ import { R as RuleBuilder, a as isRuleEntry } from "./rule-builder-BhwlX4fv.js";
10
+ import { J as JsonViewer } from "./JsonViewer-v8_C7l5N.js";
11
+ import { h as hooks } from "./moment-BWErdI6_.js";
12
+ import { b as FdoCreditLoyaltyReward, c as FdtoRandomReward, d as F_MISSION_TYPE, e as FdtoThresholdReward, f as FdoMission, g as featureVersionMapping } from "./index-CsF6BSZU.js";
13
+ import { _ as _sfc_main$p } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
14
+ import { _ as _sfc_main$n, a as _sfc_main$q, b as _sfc_main$s } from "./EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js";
15
+ import { _ as _sfc_main$r } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js";
16
+ import { _ as _sfc_main$u } from "./UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js";
17
+ import { _ as _sfc_main$k, a as _sfc_main$l } from "./RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js";
18
+ import { p as prompt, c as cases, f as firebaseStorage, u as useLoading } from "./loading-BTEwnG5-.js";
19
+ import { u as useI18n } from "./vue-i18n-ComnFt3O.js";
20
+ import { T as TypeToTriggerOptions, _ as _sfc_main$v } from "./trigger-vLHrldAH.js";
21
+ import { _ as _sfc_main$t } from "./MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js";
22
+ import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-Hb9_sJvP.js";
23
+ import { _ as _sfc_main$m, a as _sfc_main$o } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js";
24
+ import "./index-CTnZ9dt0.js";
25
+ import "./index-7QsBQpBM.js";
26
+ import { T as TEMPLATES } from "./index-AcoIUTDS.js";
27
+ import "./index-C20tnKDo.js";
28
+ import "./index-_v_LQTuR.js";
29
+ import { F as F_GAME_TYPE } from "./collectible.enum-ZoD0ya1M.js";
30
+ import { useCoreStore } from "@feedmepos/mf-common";
31
+ import { i as initCollectibleConfig } from "./helper-Bx6u7f_W.js";
32
+ import { C as CollectionUtils } from "./collection.fn-CnQjdokW.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-B1rgdv77.js";
36
+ import { S as SvcConfig } from "./index-CUMB0mpB.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
+ (p) => isRuleEntry(p) && RuleBuilder.simplify(p).property == "trigger.date"
432
+ ), h = y.find(
433
+ (p) => isRuleEntry(p) && RuleBuilder.simplify(p).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"), p = resolveComponent("FmTimePicker"), r = resolveComponent("FmIcon"), c = resolveComponent("FmTooltip"), f = resolveComponent("FmField"), b = resolveComponent("FmCard"), x = resolveComponent("FmPopover"), k = resolveComponent("FmDatePicker"), B = 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(p, {
514
+ label: "Notify time",
515
+ "model-value": unref(l).time,
516
+ "onUpdate:modelValue": v[0] || (v[0] = (C) => g({ date: unref(l).date, time: C })),
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] = (C) => o.value = C)
541
+ }, {
542
+ "popover-button": withCtx(() => [
543
+ createVNode(f, {
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] = (C) => o.value = !1),
561
+ "onUpdate:modelValue": v[2] || (v[2] = (C) => (g({ date: C, 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] = (C) => g({ date: C, 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(B, {
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 f;
651
+ return c.value === ((f = o.value) == null ? void 0 : f.collectible);
652
+ }
653
+ )) == null ? void 0 : r.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
654
+ }), g = computed(() => {
655
+ const p = m.value.safeParse(o.value);
656
+ return p.success ? [] : p.error.errors;
657
+ });
658
+ function y(p, r, c) {
659
+ p && (o.value = r, n.value = c), i.value = p;
660
+ }
661
+ const v = a;
662
+ async function h() {
663
+ const p = m.value.safeParse(o.value);
664
+ p.success && (await u(
665
+ async () => {
666
+ p.data.type === "VOUCHER" && l.value && (p.data.collectibleConfig.image = await firebaseStorage.update(
667
+ p.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", p.data, n.value));
676
+ }
677
+ return d({
678
+ showSheet: y
679
+ }), (p, r) => {
680
+ const c = resolveComponent("FmSelect"), f = 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, B, C;
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(f, {
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
+ "for-credit": unref(o).type === "LOYALTY" && ((B = unref(s).loyaltyRewards.items.find(
796
+ (V) => {
797
+ var R;
798
+ return V.value === ((R = unref(o)) == null ? void 0 : R.collectible);
799
+ }
800
+ )) == null ? void 0 : B.raw.type) === "CREDIT",
801
+ class: "!gap-24",
802
+ rules: [unref(ZodHelper).ruleAtPath(unref(m), "validityOption", [unref(o).type])],
803
+ "model-value": unref(o).validityOption,
804
+ "onUpdate:modelValue": r[4] || (r[4] = (V) => o.value = {
805
+ ...unref(o),
806
+ validityOption: V
807
+ })
808
+ }, null, 8, ["for-credit", "rules", "model-value"])
809
+ ], 64)) : createCommentVNode("", !0),
810
+ unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$o, {
811
+ key: 2,
812
+ "reward-image": unref(l),
813
+ "model-value": ((C = unref(o)) == null ? void 0 : C.collectibleConfig) ?? void 0,
814
+ "onUpdate:modelValue": r[5] || (r[5] = (V) => o.value = {
815
+ ...unref(o),
816
+ collectibleConfig: V
817
+ }),
818
+ "onUpdate:rewardImage": r[6] || (r[6] = (V) => l.value = V)
819
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
820
+ createVNode(JsonViewer, { json: unref(g) }, null, 8, ["json"])
821
+ ])) : createCommentVNode("", !0)
822
+ ];
823
+ }),
824
+ _: 1
825
+ }, 8, ["modelValue"]);
826
+ };
827
+ }
828
+ });
829
+ function isNullOrEmpty(e) {
830
+ return e == null || e === "";
831
+ }
832
+ 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({
833
+ __name: "RewardPoolInput",
834
+ props: {
835
+ modelValue: {
836
+ type: Array,
837
+ default: () => [
838
+ {
839
+ collectible: null,
840
+ type: "NO_REWARD",
841
+ weight: 1
842
+ }
843
+ ]
844
+ }
845
+ },
846
+ emits: ["update:model-value"],
847
+ setup(e, { emit: d }) {
848
+ 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(() => {
849
+ const p = i.safeParse(o.value);
850
+ return p.success ? [] : p.error.errors;
851
+ }), n = ref();
852
+ function m(p, r) {
853
+ var f;
854
+ const c = [...o.value];
855
+ c[r] = p, (f = n.value) == null || f.showSheet(!1), s("update:model-value", c);
856
+ }
857
+ function g(p) {
858
+ const r = p.type == "VOUCHER" ? p.collectibleConfig : u.collectibles.find(
859
+ (b) => b._id.toString() == p.collectible
860
+ ), c = CollectionUtils.formattedType((r == null ? void 0 : r.name) || ""), f = p.weight;
861
+ return {
862
+ label: isNullOrEmpty(c) ? "NO REWARD" : c,
863
+ sublabel: `${f} (${(f / o.value.reduce((b, x) => b + x.weight, 0) * 100).toFixed(2)}%)`
864
+ };
865
+ }
866
+ function y(p) {
867
+ var c;
868
+ const r = [...o.value];
869
+ (c = n.value) == null || c.showSheet(!0, r[p], p);
870
+ }
871
+ function v(p) {
872
+ const r = [...o.value];
873
+ r.splice(p, 1), s("update:model-value", r);
874
+ }
875
+ function h() {
876
+ var p;
877
+ (p = n.value) == null || p.showSheet(
878
+ !0,
879
+ {
880
+ type: "NO_REWARD",
881
+ collectible: null,
882
+ weight: 1
883
+ },
884
+ o.value.length
885
+ );
886
+ }
887
+ return (p, r) => {
888
+ const c = resolveComponent("FmButton"), f = resolveComponent("FmCard"), b = resolveComponent("FmHelperText");
889
+ return openBlock(), createElementBlock("div", _hoisted_1$a, [
890
+ 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)),
891
+ createVNode(c, {
892
+ label: "Add Reward",
893
+ onClick: r[0] || (r[0] = (x) => h()),
894
+ variant: "plain",
895
+ icon: "add"
896
+ }),
897
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (x, k) => (openBlock(), createBlock(f, {
898
+ key: k,
899
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
900
+ variant: "outlined",
901
+ onClick: (B) => y(k)
902
+ }, {
903
+ default: withCtx(() => {
904
+ var B;
905
+ return [
906
+ createElementVNode("div", null, [
907
+ createElementVNode("div", _hoisted_2$7, toDisplayString(x.type == "LOYALTY" ? (B = x == null ? void 0 : x.earningOption) == null ? void 0 : B.amount : "") + " " + toDisplayString(g(x).label), 1),
908
+ createElementVNode("div", _hoisted_3$6, toDisplayString(g(x).sublabel), 1)
909
+ ]),
910
+ createVNode(c, {
911
+ icon: "delete",
912
+ variant: "tertiary",
913
+ onClick: (C) => (C.stopPropagation(), v(k))
914
+ }, null, 8, ["onClick"])
915
+ ];
916
+ }),
917
+ _: 2
918
+ }, 1032, ["onClick"]))), 128)),
919
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((x) => x.path.join(".") == ""), (x) => (openBlock(), createBlock(b, {
920
+ key: x.message,
921
+ text: x.message,
922
+ state: "error"
923
+ }, null, 8, ["text"]))), 128)),
924
+ createVNode(_sfc_main$b, {
925
+ ref_key: "sheetRef",
926
+ ref: n,
927
+ "onUpdate:modelValue": m
928
+ }, null, 512)
929
+ ]);
930
+ };
931
+ }
932
+ }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
933
+ key: 0,
934
+ class: "grid grid-cols-2 gap-16"
935
+ }, _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({
936
+ __name: "PromotionGameTypeInput",
937
+ props: {
938
+ modelValue: {
939
+ type: Object
940
+ }
941
+ },
942
+ emits: ["update:model-value"],
943
+ setup(e, { emit: d }) {
944
+ const a = e, s = d, u = computed(() => [
945
+ {
946
+ label: "Rock paper scissor",
947
+ description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
948
+ value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
949
+ }
950
+ ]);
951
+ return (i, o) => {
952
+ var g, y, v;
953
+ const l = resolveComponent("FmSwitch"), n = resolveComponent("FmCard"), m = resolveComponent("FmHelperText");
954
+ return openBlock(), createElementBlock("div", _hoisted_1$9, [
955
+ createVNode(l, {
956
+ label: "Enable game",
957
+ "model-value": !!((g = e.modelValue) != null && g.gameType),
958
+ "onUpdate:modelValue": o[0] || (o[0] = (h) => h ? s("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : s("update:model-value", null))
959
+ }, null, 8, ["model-value"]),
960
+ ((y = e.modelValue) == null ? void 0 : y.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
961
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (h) => {
962
+ var p, r;
963
+ return openBlock(), createBlock(n, {
964
+ variant: "outlined",
965
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
966
+ "col-span-2": unref(u).length == 1,
967
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((p = e.modelValue) == null ? void 0 : p.gameType) == h.value,
968
+ "hover:bg-fm-color-opacity-sm": ((r = e.modelValue) == null ? void 0 : r.gameType) != h.value
969
+ }]),
970
+ onClick: () => {
971
+ var c;
972
+ ((c = a.modelValue) == null ? void 0 : c.gameType) != h.value && s("update:model-value", { gameType: h.value });
973
+ },
974
+ key: h.value
975
+ }, {
976
+ default: withCtx(() => [
977
+ createElementVNode("div", _hoisted_3$5, toDisplayString(h.label), 1),
978
+ createElementVNode("div", _hoisted_4$4, toDisplayString(h.description), 1)
979
+ ]),
980
+ _: 2
981
+ }, 1032, ["class", "onClick"]);
982
+ }), 128))
983
+ ])) : createCommentVNode("", !0),
984
+ ((v = e.modelValue) == null ? void 0 : v.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(m, {
985
+ key: 1,
986
+ 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)",
987
+ state: "warning"
988
+ })) : createCommentVNode("", !0)
989
+ ]);
990
+ };
991
+ }
992
+ }), _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({
993
+ __name: "MissionTypeInput",
994
+ props: {
995
+ modelValue: {
996
+ type: String
997
+ }
998
+ },
999
+ emits: ["update:model-value"],
1000
+ setup(e, { emit: d }) {
1001
+ const a = e, s = d, u = computed(() => [
1002
+ {
1003
+ label: "Stamp",
1004
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
1005
+ value: F_MISSION_TYPE.enum.STAMP
1006
+ },
1007
+ {
1008
+ label: "Progress",
1009
+ description: "Reward customers when they reach a cumulative spending goal.",
1010
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
1011
+ }
1012
+ ]);
1013
+ return (i, o) => {
1014
+ const l = resolveComponent("FmCard");
1015
+ return openBlock(), createElementBlock("div", _hoisted_1$8, [
1016
+ 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)),
1017
+ createElementVNode("div", _hoisted_2$5, [
1018
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (n) => (openBlock(), createBlock(l, {
1019
+ variant: "outlined",
1020
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1021
+ "col-span-2": unref(u).length == 1,
1022
+ "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
1023
+ "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
1024
+ }]),
1025
+ onClick: () => {
1026
+ a.modelValue != n.value && s("update:model-value", n.value);
1027
+ },
1028
+ key: n.value
1029
+ }, {
1030
+ default: withCtx(() => [
1031
+ createElementVNode("div", _hoisted_3$4, toDisplayString(n.label), 1),
1032
+ createElementVNode("div", _hoisted_4$3, toDisplayString(n.description), 1)
1033
+ ]),
1034
+ _: 2
1035
+ }, 1032, ["class", "onClick"]))), 128))
1036
+ ])
1037
+ ]);
1038
+ };
1039
+ }
1040
+ }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
1041
+ __name: "MissionEndInput",
1042
+ props: {
1043
+ modelValue: {
1044
+ type: [String, Number]
1045
+ },
1046
+ helperText: {
1047
+ type: String
1048
+ },
1049
+ helperState: {
1050
+ type: String
1051
+ }
1052
+ },
1053
+ emits: ["update:model-value"],
1054
+ setup(e, { emit: d }) {
1055
+ const a = d;
1056
+ return (s, u) => {
1057
+ const i = resolveComponent("FmStepperField");
1058
+ return openBlock(), createElementBlock("div", _hoisted_1$7, [
1059
+ 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)),
1060
+ createVNode(i, {
1061
+ label: "Maximum to collect",
1062
+ "model-value": e.modelValue || null,
1063
+ "onUpdate:modelValue": u[0] || (u[0] = (o) => a("update:model-value", o)),
1064
+ "helper-text": e.helperText || "Set the threshold required for reward eligibility",
1065
+ "helper-state": e.helperState || "none"
1066
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
1067
+ ]);
1068
+ };
1069
+ }
1070
+ }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
1071
+ __name: "EditMissionPoolSheet",
1072
+ props: {
1073
+ maxThreshold: {
1074
+ type: Number,
1075
+ required: !0
1076
+ }
1077
+ },
1078
+ emits: ["update:model-value"],
1079
+ setup(e, { expose: d, emit: a }) {
1080
+ const s = e, u = useMembershipStore(), { minor: i } = useLoading, o = ref(!1), l = ref(), n = ref(), m = ref(0), g = FdtoThresholdReward, y = computed(() => {
1081
+ const c = g.safeParse(l.value);
1082
+ return c.success ? [] : c.error.errors;
1083
+ });
1084
+ function v(c, f, b) {
1085
+ c && (l.value = f, m.value = b), o.value = c;
1086
+ }
1087
+ const h = a;
1088
+ async function p() {
1089
+ console.log(l.value);
1090
+ const c = g.safeParse(l.value);
1091
+ c.success && (await i(
1092
+ async () => {
1093
+ c.data.type === "VOUCHER" && n.value && (c.data.collectibleConfig.image = await firebaseStorage.update(
1094
+ c.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1095
+ n.value
1096
+ ));
1097
+ },
1098
+ {
1099
+ message: "Uploading reward image",
1100
+ successMessage: "Reward image updated"
1101
+ }
1102
+ ), h("update:model-value", c.data, m.value));
1103
+ }
1104
+ const r = ref();
1105
+ return d({
1106
+ showSheet: v
1107
+ }), (c, f) => {
1108
+ const b = resolveComponent("FmStepperField"), x = resolveComponent("FmSelect"), k = resolveComponent("FmForm"), B = resolveComponent("FmButton"), C = resolveComponent("FmSideSheet");
1109
+ return openBlock(), createBlock(C, {
1110
+ "max-width": 560,
1111
+ modelValue: unref(o),
1112
+ "onUpdate:modelValue": [
1113
+ f[10] || (f[10] = (V) => isRef(o) ? o.value = V : null),
1114
+ f[11] || (f[11] = (V) => o.value = V)
1115
+ ],
1116
+ header: "Edit reward",
1117
+ "dismiss-away": ""
1118
+ }, {
1119
+ "side-sheet-footer": withCtx(() => [
1120
+ createElementVNode("div", _hoisted_1$6, [
1121
+ createVNode(B, {
1122
+ variant: "primary",
1123
+ type: "button",
1124
+ label: "Confirm",
1125
+ onClick: f[8] || (f[8] = async () => {
1126
+ var V;
1127
+ return (V = unref(r)) == null ? void 0 : V.validateInputs();
1128
+ })
1129
+ }),
1130
+ createVNode(B, {
1131
+ variant: "secondary",
1132
+ type: "button",
1133
+ label: "Cancel",
1134
+ onClick: f[9] || (f[9] = (V) => o.value = !1)
1135
+ })
1136
+ ])
1137
+ ]),
1138
+ default: withCtx(() => [
1139
+ unref(l) ? (openBlock(), createBlock(k, {
1140
+ key: 0,
1141
+ class: "flex flex-col gap-y-24",
1142
+ ref_key: "formRef",
1143
+ ref: r,
1144
+ onValidationSuccess: f[7] || (f[7] = (V) => p())
1145
+ }, {
1146
+ default: withCtx(() => {
1147
+ var V, R;
1148
+ return [
1149
+ unref(l).type ? (openBlock(), createBlock(b, {
1150
+ key: 0,
1151
+ label: "Threshold",
1152
+ rules: [
1153
+ unref(ZodHelper).toRule(
1154
+ unref(z).number().min(1).max(
1155
+ s.maxThreshold,
1156
+ `Number cannot be more than ${s.maxThreshold}`
1157
+ )
1158
+ )
1159
+ ],
1160
+ "model-value": unref(l).threshold,
1161
+ "onUpdate:modelValue": f[0] || (f[0] = (E) => l.value = {
1162
+ ...unref(l),
1163
+ threshold: E
1164
+ })
1165
+ }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
1166
+ createVNode(x, {
1167
+ label: "Reward Type",
1168
+ items: [
1169
+ { label: "Voucher", value: "VOUCHER" },
1170
+ { label: "Loyalty", value: "LOYALTY" }
1171
+ ],
1172
+ "model-value": unref(l).type,
1173
+ "onUpdate:modelValue": f[1] || (f[1] = (E) => {
1174
+ var S, w;
1175
+ E === "VOUCHER" ? l.value = {
1176
+ collectible: null,
1177
+ type: "VOUCHER",
1178
+ collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1179
+ business: unref(useCoreStore)().currentBusiness.value._id
1180
+ }),
1181
+ earningOption: {
1182
+ amount: 1,
1183
+ type: "FIXED"
1184
+ },
1185
+ validityOption: {
1186
+ validForDay: 7
1187
+ },
1188
+ threshold: (S = unref(l)) == null ? void 0 : S.threshold
1189
+ } : l.value = {
1190
+ collectible: unref(u).loyaltyRewards.raw[0]._id,
1191
+ type: "LOYALTY",
1192
+ earningOption: {
1193
+ amount: 1,
1194
+ type: "FIXED"
1195
+ },
1196
+ validityOption: {
1197
+ validForDay: 7
1198
+ },
1199
+ threshold: (w = unref(l)) == null ? void 0 : w.threshold
1200
+ };
1201
+ })
1202
+ }, null, 8, ["model-value"]),
1203
+ unref(l).type == "LOYALTY" ? (openBlock(), createBlock(x, {
1204
+ key: 1,
1205
+ label: "Loyalty type",
1206
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "collectible", [unref(l).type])],
1207
+ items: unref(u).loyaltyRewards.items,
1208
+ "model-value": unref(l).collectible,
1209
+ "onUpdate:modelValue": f[2] || (f[2] = (E) => unref(l).collectible = E)
1210
+ }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1211
+ unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1212
+ f[12] || (f[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1213
+ createVNode(_sfc_main$m, {
1214
+ class: "mt-[-8px]",
1215
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "earningOption", [unref(l).type])],
1216
+ "helper-state": unref(ZodHelper).helperState(unref(y), "earningOption"),
1217
+ "error-text": unref(ZodHelper).helperText(unref(y), "earningOption"),
1218
+ "fixed-type": !0,
1219
+ "model-value": unref(l).earningOption,
1220
+ "onUpdate:modelValue": f[3] || (f[3] = (E) => l.value = {
1221
+ ...unref(l),
1222
+ earningOption: E
1223
+ })
1224
+ }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
1225
+ createVNode(_sfc_main$n, {
1226
+ class: "!gap-24",
1227
+ "for-credit": unref(l).type === "LOYALTY" && ((V = unref(u).loyaltyRewards.items.find(
1228
+ (E) => {
1229
+ var S;
1230
+ return E.value === ((S = unref(l)) == null ? void 0 : S.collectible);
1231
+ }
1232
+ )) == null ? void 0 : V.raw.type) === "CREDIT",
1233
+ rules: [unref(ZodHelper).ruleAtPath(unref(g), "validityOption", [unref(l).type])],
1234
+ "model-value": unref(l).validityOption,
1235
+ "onUpdate:modelValue": f[4] || (f[4] = (E) => l.value = {
1236
+ ...unref(l),
1237
+ validityOption: E
1238
+ })
1239
+ }, null, 8, ["for-credit", "rules", "model-value"])
1240
+ ], 64)) : createCommentVNode("", !0),
1241
+ unref(l).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$o, {
1242
+ key: 3,
1243
+ "reward-image": unref(n),
1244
+ "model-value": ((R = unref(l)) == null ? void 0 : R.collectibleConfig) ?? void 0,
1245
+ "onUpdate:modelValue": f[5] || (f[5] = (E) => l.value = {
1246
+ ...unref(l),
1247
+ collectibleConfig: E
1248
+ }),
1249
+ "onUpdate:rewardImage": f[6] || (f[6] = (E) => n.value = E)
1250
+ }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1251
+ createVNode(JsonViewer, { json: unref(y) }, null, 8, ["json"])
1252
+ ];
1253
+ }),
1254
+ _: 1
1255
+ }, 512)) : createCommentVNode("", !0)
1256
+ ]),
1257
+ _: 1
1258
+ }, 8, ["modelValue"]);
1259
+ };
1260
+ }
1261
+ }), _hoisted_1$5 = {
1262
+ key: 0,
1263
+ class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
1264
+ }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
1265
+ __name: "MissionProgress",
1266
+ props: {
1267
+ type: {
1268
+ type: String,
1269
+ required: !0
1270
+ },
1271
+ maxRange: {
1272
+ type: Number,
1273
+ required: !0
1274
+ },
1275
+ currentRange: {
1276
+ type: Number,
1277
+ default: 0
1278
+ },
1279
+ markers: {
1280
+ type: Array,
1281
+ default: () => []
1282
+ }
1283
+ },
1284
+ setup(e) {
1285
+ const d = e, { maxRange: a, currentRange: s, markers: u } = toRefs(d), i = computed(
1286
+ () => Math.min(s.value / a.value * 100, 100)
1287
+ ), o = (l) => l / a.value * 100;
1288
+ return (l, n) => {
1289
+ const m = resolveComponent("FmIcon");
1290
+ return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
1291
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(a), 40), (g) => (openBlock(), createBlock(m, {
1292
+ class: normalizeClass(
1293
+ unref(s) >= g ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
1294
+ ),
1295
+ outline: unref(s) < g,
1296
+ key: g,
1297
+ name: unref(u).some((y) => y === g) ? "featured_seasonal_and_gifts" : "check_circle"
1298
+ }, null, 8, ["class", "outline", "name"]))), 128))
1299
+ ])) : (openBlock(), createElementBlock("div", {
1300
+ key: 1,
1301
+ class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
1302
+ }, [
1303
+ createElementVNode("div", {
1304
+ class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
1305
+ style: normalizeStyle({ width: unref(i) + "%" })
1306
+ }, null, 4),
1307
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (g, y) => (openBlock(), createElementBlock("div", {
1308
+ key: y,
1309
+ class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
1310
+ style: normalizeStyle({ left: o(g) + "%" })
1311
+ }, [
1312
+ createElementVNode("div", _hoisted_2$4, [
1313
+ createElementVNode("div", {
1314
+ class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
1315
+ }),
1316
+ n[0] || (n[0] = createElementVNode("div", null, "🎁", -1))
1317
+ ])
1318
+ ], 4))), 128))
1319
+ ]));
1320
+ };
1321
+ }
1322
+ }), isObject = (e) => e !== null && typeof e == "object";
1323
+ function changeKeysFactory(e) {
1324
+ return function d(a, s = 1, u) {
1325
+ if (s === 0 || !isObject(a))
1326
+ return a;
1327
+ if (Array.isArray(a))
1328
+ return a.map((o) => d(o, s - 1, u));
1329
+ const i = Object.create(Object.getPrototypeOf(a));
1330
+ return Object.keys(a).forEach((o) => {
1331
+ const l = a[o], n = e(o, u), m = d(l, s - 1, u);
1332
+ i[n] = m;
1333
+ }), i;
1334
+ };
1335
+ }
1336
+ 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({
1337
+ __name: "MissionPoolInput",
1338
+ props: {
1339
+ modelValue: {
1340
+ type: Array,
1341
+ default: () => []
1342
+ },
1343
+ mission: {
1344
+ type: Object,
1345
+ required: !0
1346
+ }
1347
+ },
1348
+ emits: ["update:model-value"],
1349
+ setup(e, { emit: d }) {
1350
+ const a = e, s = d, u = useMembershipStore(), i = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), o = computed(
1351
+ () => a.modelValue.sort((r, c) => r.threshold - c.threshold) ?? []
1352
+ ), l = computed(() => {
1353
+ const r = i.safeParse(o.value);
1354
+ return r.success ? [] : r.error.errors;
1355
+ }), n = ref();
1356
+ function m(r, c) {
1357
+ var b;
1358
+ const f = [...o.value];
1359
+ f[c] = r, (b = n.value) == null || b.showSheet(!1), s("update:model-value", f);
1360
+ }
1361
+ function g(r) {
1362
+ const c = r.type == "VOUCHER" ? r.collectibleConfig : u.collectibles.find(
1363
+ (b) => b._id.toString() == r.collectible
1364
+ ), f = CollectionUtils.formattedType((c == null ? void 0 : c.name) || "");
1365
+ return {
1366
+ label: isNullOrEmpty(f) ? "NO REWARD" : f,
1367
+ sublabel: `Reward at ${r.threshold} | Amount: ${r.earningOption.type == "FIXED" ? r.earningOption.amount : `${r.earningOption.amount} for every RM${r.earningOption.every} spent`} `
1368
+ };
1369
+ }
1370
+ function y(r) {
1371
+ var f;
1372
+ const c = [...o.value];
1373
+ (f = n.value) == null || f.showSheet(!0, c[r], r);
1374
+ }
1375
+ function v(r) {
1376
+ const c = [...o.value];
1377
+ c.splice(r, 1), s("update:model-value", c);
1378
+ }
1379
+ function h() {
1380
+ var r;
1381
+ (r = n.value) == null || r.showSheet(
1382
+ !0,
1383
+ {
1384
+ type: "LOYALTY",
1385
+ collectible: u.loyaltyRewards.items[0].value,
1386
+ threshold: null,
1387
+ validityOption: {
1388
+ validForDay: 7
1389
+ },
1390
+ earningOption: {
1391
+ type: "FIXED",
1392
+ amount: 1
1393
+ }
1394
+ },
1395
+ o.value.length
1396
+ );
1397
+ }
1398
+ function p(r) {
1399
+ var c, f;
1400
+ return r.type == "VOUCHER" ? (c = r.collectibleConfig) == null ? void 0 : c.name : sentenceCase(
1401
+ ((f = u.loyaltyRewards.items.find(
1402
+ (b) => b.value == r.collectible
1403
+ )) == null ? void 0 : f.label) || ""
1404
+ );
1405
+ }
1406
+ return (r, c) => {
1407
+ const f = resolveComponent("FmButton"), b = resolveComponent("FmCard"), x = resolveComponent("FmHelperText");
1408
+ return openBlock(), createElementBlock("div", _hoisted_1$4, [
1409
+ 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)),
1410
+ createVNode(f, {
1411
+ label: "Add Reward",
1412
+ onClick: c[0] || (c[0] = (k) => h()),
1413
+ variant: "plain",
1414
+ icon: "add"
1415
+ }),
1416
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o), (k, B) => (openBlock(), createBlock(b, {
1417
+ key: B,
1418
+ class: "px-16 py-12 flex items-center justify-between cursor-pointer",
1419
+ variant: "outlined",
1420
+ onClick: (C) => y(B)
1421
+ }, {
1422
+ default: withCtx(() => [
1423
+ createElementVNode("div", null, [
1424
+ createElementVNode("div", _hoisted_2$3, toDisplayString(g(k).label), 1),
1425
+ createElementVNode("div", _hoisted_3$3, toDisplayString(g(k).sublabel), 1)
1426
+ ]),
1427
+ createVNode(f, {
1428
+ icon: "delete",
1429
+ variant: "tertiary",
1430
+ onClick: (C) => (C.stopPropagation(), v(B))
1431
+ }, null, 8, ["onClick"])
1432
+ ]),
1433
+ _: 2
1434
+ }, 1032, ["onClick"]))), 128)),
1435
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l).filter((k) => k.path.join(".") == ""), (k) => (openBlock(), createBlock(x, {
1436
+ key: k.message,
1437
+ text: k.message,
1438
+ state: "error"
1439
+ }, null, 8, ["text"]))), 128)),
1440
+ c[3] || (c[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
1441
+ (openBlock(), createBlock(b, {
1442
+ key: 0,
1443
+ variant: "outlined",
1444
+ class: "p-24 space-y-16 w-fit"
1445
+ }, {
1446
+ default: withCtx(() => {
1447
+ var k, B;
1448
+ return [
1449
+ createElementVNode("div", _hoisted_4$2, [
1450
+ createElementVNode("div", null, [
1451
+ createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(((k = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : k.earningOption.amount) > 1 ? (B = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : B.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? p(e.modelValue[e.modelValue.length - 1]) : ""), 1),
1452
+ c[1] || (c[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
1453
+ ])
1454
+ ]),
1455
+ createElementVNode("div", _hoisted_6$2, [
1456
+ createVNode(_sfc_main$5, {
1457
+ type: e.mission.type,
1458
+ "max-range": e.mission.end,
1459
+ currentRange: e.mission.end / 4,
1460
+ markers: e.modelValue.map((C) => C.threshold)
1461
+ }, null, 8, ["type", "max-range", "currentRange", "markers"]),
1462
+ e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
1463
+ ])
1464
+ ];
1465
+ }),
1466
+ _: 1
1467
+ })),
1468
+ createVNode(_sfc_main$6, {
1469
+ ref_key: "sheetRef",
1470
+ ref: n,
1471
+ "onUpdate:modelValue": m,
1472
+ "max-threshold": e.mission.end
1473
+ }, null, 8, ["max-threshold"])
1474
+ ]);
1475
+ };
1476
+ }
1477
+ }), _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({
1478
+ __name: "MissionInput",
1479
+ props: {
1480
+ modelValue: Object
1481
+ },
1482
+ emits: ["update:model-value"],
1483
+ setup(e, { emit: d }) {
1484
+ const a = e, s = computed(() => {
1485
+ const o = FdoMission.safeParse(a.modelValue);
1486
+ return o.success ? [] : o.error.errors;
1487
+ }), u = computed(() => [
1488
+ {
1489
+ label: "Stamp",
1490
+ description: "Award stamps for purchases, redeemable after reaching set milestones.",
1491
+ value: F_MISSION_TYPE.enum.STAMP
1492
+ },
1493
+ {
1494
+ label: "Progress",
1495
+ description: "Reward customers when they reach a cumulative spending goal.",
1496
+ value: F_MISSION_TYPE.enum.PROGRESSIVE
1497
+ }
1498
+ ]), i = d;
1499
+ return (o, l) => {
1500
+ var g;
1501
+ const n = resolveComponent("FmCard"), m = resolveComponent("FmStepperField");
1502
+ return openBlock(), createElementBlock("div", _hoisted_1$3, [
1503
+ createElementVNode("div", _hoisted_2$2, [
1504
+ l[1] || (l[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
1505
+ 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)),
1506
+ createElementVNode("div", _hoisted_3$2, [
1507
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(u), (y) => {
1508
+ var v, h;
1509
+ return openBlock(), createBlock(n, {
1510
+ variant: "outlined",
1511
+ class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1512
+ "col-span-2": unref(u).length == 1,
1513
+ "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,
1514
+ "hover:bg-fm-color-opacity-sm": ((h = e.modelValue) == null ? void 0 : h.type) != y.value
1515
+ }]),
1516
+ onClick: () => {
1517
+ var p, r;
1518
+ ((p = e.modelValue) == null ? void 0 : p.type) != y.value && i("update:model-value", {
1519
+ ...e.modelValue,
1520
+ type: y.value,
1521
+ end: ((r = e.modelValue) == null ? void 0 : r.end) || 1
1522
+ });
1523
+ },
1524
+ key: y.value
1525
+ }, {
1526
+ default: withCtx(() => [
1527
+ createElementVNode("div", _hoisted_4$1, toDisplayString(y.label), 1),
1528
+ createElementVNode("div", _hoisted_5$1, toDisplayString(y.description), 1)
1529
+ ]),
1530
+ _: 2
1531
+ }, 1032, ["class", "onClick"]);
1532
+ }), 128))
1533
+ ])
1534
+ ]),
1535
+ createElementVNode("div", _hoisted_6$1, [
1536
+ l[3] || (l[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
1537
+ 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)),
1538
+ createVNode(m, {
1539
+ label: "Maximum to collect",
1540
+ "model-value": ((g = e.modelValue) == null ? void 0 : g.end) || null,
1541
+ "onUpdate:modelValue": l[0] || (l[0] = (y) => {
1542
+ var v;
1543
+ return i("update:model-value", {
1544
+ ...e.modelValue,
1545
+ type: ((v = e.modelValue) == null ? void 0 : v.type) || "STAMP",
1546
+ end: y
1547
+ });
1548
+ }),
1549
+ "helper-text": unref(ZodHelper).helperText(unref(s), "end") || "Set the threshold required for reward eligibility",
1550
+ "helper-state": unref(ZodHelper).helperState(unref(s), "end") || "none"
1551
+ }, null, 8, ["model-value", "helper-text", "helper-state"])
1552
+ ])
1553
+ ]);
1554
+ };
1555
+ }
1556
+ }), _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
1557
+ __name: "TemplateInput",
1558
+ props: {
1559
+ field: { type: Object, required: !0 },
1560
+ modelValue: {
1561
+ type: Object
1562
+ },
1563
+ schema: {
1564
+ type: Object
1565
+ },
1566
+ extras: {
1567
+ type: Object
1568
+ },
1569
+ helperText: {
1570
+ type: String
1571
+ },
1572
+ disabled: {
1573
+ type: Boolean,
1574
+ default: !1
1575
+ }
1576
+ },
1577
+ emits: ["update:model-value", "update:file"],
1578
+ setup(e, { emit: d }) {
1579
+ const { t: a } = useI18n(), s = e, u = d;
1580
+ function i(m) {
1581
+ switch (s.field.type) {
1582
+ case "timeframe":
1583
+ const g = m.startDate ? hooks(m.startDate).startOf("day").toISOString() : void 0, y = m.endDate ? hooks(m.endDate).endOf("day").toISOString() : void 0;
1584
+ u("update:model-value", {
1585
+ type: "timeframe",
1586
+ property: "__now",
1587
+ start: g,
1588
+ end: y
1589
+ });
1590
+ break;
1591
+ case "image": {
1592
+ u(
1593
+ "update:file",
1594
+ m,
1595
+ o.value || firebaseStorage.collectibleImagePath(void 0, m)
1596
+ );
1597
+ break;
1598
+ }
1599
+ default:
1600
+ u("update:model-value", m);
1601
+ break;
1602
+ }
1603
+ }
1604
+ const o = computed(() => {
1605
+ switch (s.field.type) {
1606
+ case "timeframe": {
1607
+ const m = s.modelValue;
1608
+ return {
1609
+ startDate: m != null && m.start ? hooks(m == null ? void 0 : m.start).format("YYYY-MM-DD") : null,
1610
+ endDate: m != null && m.end ? hooks(m == null ? void 0 : m.end).format("YYYY-MM-DD") : null
1611
+ };
1612
+ }
1613
+ default:
1614
+ return s.modelValue;
1615
+ }
1616
+ });
1617
+ function l() {
1618
+ if (!n.value.schema) return [];
1619
+ const m = n.value.schema.safeParse(s.modelValue);
1620
+ return m.success ? [] : m.error.errors;
1621
+ }
1622
+ const n = computed(() => ({
1623
+ schema: s.schema,
1624
+ unwrapped: s.schema ? ZodHelper.unwrap(s.schema) : void 0,
1625
+ rules: s.schema ? [ZodHelper.ruleAtPath(s.schema, "")] : void 0,
1626
+ labelMark: s.schema && ZodHelper.isRequired(s.schema) == !1 ? "optional" : void 0,
1627
+ zodLabel: s.schema ? ZodHelper.toInputLabel(s.schema, s.field.label) : void 0
1628
+ }));
1629
+ return (m, g) => {
1630
+ var c, f, b, x, k;
1631
+ const y = resolveComponent("FmTextField"), v = resolveComponent("FmStepperField"), h = resolveComponent("FmTextarea"), p = resolveComponent("FmHelperText"), r = resolveComponent("FmSwitch");
1632
+ return e.field.type === "text" ? (openBlock(), createBlock(y, {
1633
+ key: 0,
1634
+ label: unref(a)(e.field.label),
1635
+ "label-mark": unref(n).labelMark,
1636
+ rules: unref(n).rules,
1637
+ "model-value": unref(o),
1638
+ "onUpdate:modelValue": i,
1639
+ "helper-state": e.helperText ? "error" : void 0,
1640
+ "helper-text": e.helperText
1641
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1642
+ createVNode(JsonViewer, {
1643
+ json: { schema: unref(n).unwrapped, props: s }
1644
+ }, null, 8, ["json"]),
1645
+ createVNode(v, {
1646
+ label: unref(a)(e.field.label),
1647
+ "label-mark": e.field.isRuleChildren ? void 0 : unref(n).labelMark,
1648
+ "model-value": unref(o),
1649
+ rules: e.field.isRuleChildren ? [] : unref(n).rules,
1650
+ "onUpdate:modelValue": i,
1651
+ "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
1652
+ "helper-text": e.field.isRuleChildren ? e.helperText : void 0
1653
+ }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
1654
+ ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(h, {
1655
+ key: 2,
1656
+ label: unref(a)(e.field.label),
1657
+ "label-mark": unref(n).labelMark,
1658
+ rules: unref(n).rules,
1659
+ "model-value": unref(o),
1660
+ "onUpdate:modelValue": i,
1661
+ "show-word-count": "",
1662
+ "max-length": (k = (x = (b = (f = (c = unref(n)) == null ? void 0 : c.unwrapped) == null ? void 0 : f._def) == null ? void 0 : b.checks) == null ? void 0 : x.find((B) => B.kind == "max")) == null ? void 0 : k.value
1663
+ }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$g, {
1664
+ key: 3,
1665
+ "campaign-type": e.extras,
1666
+ "model-value": unref(o),
1667
+ disabled: e.disabled,
1668
+ "onUpdate:modelValue": i
1669
+ }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
1670
+ createVNode(_sfc_main$e, {
1671
+ "model-value": unref(o),
1672
+ "onUpdate:modelValue": i
1673
+ }, null, 8, ["model-value"]),
1674
+ createVNode(p, {
1675
+ class: "!mt-[8px]",
1676
+ text: unref(ZodHelper).helperText(l(), ""),
1677
+ state: unref(ZodHelper).helperState(l(), "")
1678
+ }, null, 8, ["text", "state"])
1679
+ ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$p, {
1680
+ key: 5,
1681
+ thumbnail: unref(o),
1682
+ "aspect-ratio": "16 / 9",
1683
+ class: "w-1/2 xs:w-2/3",
1684
+ "onUpdate:file": i
1685
+ }, {
1686
+ label: withCtx(() => [
1687
+ (openBlock(), createBlock(resolveDynamicComponent(unref(n).zodLabel)))
1688
+ ]),
1689
+ _: 1
1690
+ }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(r, {
1691
+ key: 6,
1692
+ label: unref(a)(e.field.label),
1693
+ "label-placement": "right",
1694
+ sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
1695
+ "label-mark": unref(n).labelMark,
1696
+ rules: unref(n).rules,
1697
+ "model-value": unref(o),
1698
+ "onUpdate:modelValue": i
1699
+ }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$q, {
1700
+ key: 7,
1701
+ "model-value": unref(o),
1702
+ "onUpdate:modelValue": i,
1703
+ "no-campaign": !1,
1704
+ schema: unref(n).schema,
1705
+ "is-mission": e.extras === "MISSION"
1706
+ }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$r, {
1707
+ key: 8,
1708
+ "model-value": unref(o),
1709
+ "onUpdate:modelValue": i
1710
+ }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
1711
+ createVNode(_sfc_main$s, {
1712
+ "model-value": unref(o),
1713
+ "onUpdate:modelValue": i,
1714
+ "can-set-auto-apply": e.field.property == "campaign.effect"
1715
+ }, null, 8, ["model-value", "can-set-auto-apply"]),
1716
+ unref(o) ? createCommentVNode("", !0) : (openBlock(), createBlock(p, {
1717
+ key: 0,
1718
+ class: "!mt-[8px]",
1719
+ text: unref(a)("connect.campaign.common.effect_required"),
1720
+ state: "error"
1721
+ }, null, 8, ["text"]))
1722
+ ], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$t, {
1723
+ key: 10,
1724
+ "allow-email": !0,
1725
+ "model-value": unref(o),
1726
+ "onUpdate:modelValue": i,
1727
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
1728
+ "trigger-type": e.field.extras,
1729
+ "helper-state": unref(ZodHelper).helperState(l(), "")
1730
+ }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$m, {
1731
+ key: 11,
1732
+ "model-value": unref(o),
1733
+ "onUpdate:modelValue": i,
1734
+ extras: e.extras,
1735
+ "error-text": e.helperText
1736
+ }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$n, {
1737
+ key: 12,
1738
+ type: "custom",
1739
+ "model-value": unref(o),
1740
+ "onUpdate:modelValue": i,
1741
+ "helper-text": e.helperText || unref(ZodHelper).helperText(l(), "")
1742
+ }, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$c, {
1743
+ key: 13,
1744
+ "model-value": unref(o),
1745
+ "onUpdate:modelValue": i
1746
+ }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
1747
+ key: 14,
1748
+ "model-value": unref(o),
1749
+ "onUpdate:modelValue": i
1750
+ }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
1751
+ key: 15,
1752
+ "model-value": unref(o),
1753
+ "onUpdate:modelValue": i
1754
+ }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
1755
+ key: 16,
1756
+ "model-value": unref(o),
1757
+ "onUpdate:modelValue": i
1758
+ }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
1759
+ key: 17,
1760
+ "model-value": unref(o),
1761
+ "onUpdate:modelValue": i,
1762
+ "helper-text": unref(ZodHelper).helperText(l(), ""),
1763
+ "helper-state": unref(ZodHelper).helperState(l(), "")
1764
+ }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
1765
+ key: 18,
1766
+ "model-value": unref(o),
1767
+ "onUpdate:modelValue": i,
1768
+ mission: e.extras.mission
1769
+ }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
1770
+ createVNode(_sfc_main$d, {
1771
+ "model-value": unref(o),
1772
+ "onUpdate:modelValue": i,
1773
+ "start-date": e.extras.start,
1774
+ "end-date": e.extras.end
1775
+ }, null, 8, ["model-value", "start-date", "end-date"]),
1776
+ e.helperText ? (openBlock(), createBlock(p, {
1777
+ key: 0,
1778
+ class: "!mt-[8px]",
1779
+ text: e.helperText,
1780
+ state: "error"
1781
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1782
+ ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
1783
+ createVNode(_sfc_main$u, {
1784
+ "model-value": unref(o),
1785
+ "onUpdate:modelValue": i
1786
+ }, null, 8, ["model-value"]),
1787
+ e.helperText ? (openBlock(), createBlock(p, {
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_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
1794
+ e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(o).rules.g_time).length > 0 ? (openBlock(), createBlock(p, {
1795
+ key: 0,
1796
+ state: "warning",
1797
+ text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
1798
+ }, null, 8, ["text"])) : createCommentVNode("", !0),
1799
+ createVNode(_sfc_main$j, {
1800
+ "model-value": unref(o),
1801
+ "onUpdate:modelValue": i
1802
+ }, null, 8, ["model-value"]),
1803
+ e.helperText ? (openBlock(), createBlock(p, {
1804
+ key: 1,
1805
+ class: "!mt-[8px]",
1806
+ text: e.helperText,
1807
+ state: "error"
1808
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1809
+ ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
1810
+ createVNode(_sfc_main$v, {
1811
+ "model-value": unref(o),
1812
+ "onUpdate:modelValue": i
1813
+ }, null, 8, ["model-value"]),
1814
+ e.helperText ? (openBlock(), createBlock(p, {
1815
+ key: 0,
1816
+ class: "!mt-[8px]",
1817
+ text: e.helperText,
1818
+ state: "error"
1819
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1820
+ ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
1821
+ createVNode(_sfc_main$h, {
1822
+ "model-value": unref(o),
1823
+ "onUpdate:modelValue": i
1824
+ }, null, 8, ["model-value"]),
1825
+ e.helperText ? (openBlock(), createBlock(p, {
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_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
1832
+ createVNode(_sfc_main$i, {
1833
+ "model-value": unref(o),
1834
+ "onUpdate:modelValue": i
1835
+ }, null, 8, ["model-value"]),
1836
+ e.helperText ? (openBlock(), createBlock(p, {
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 === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
1843
+ createVNode(_sfc_main$9, {
1844
+ "model-value": unref(o),
1845
+ "onUpdate:modelValue": i
1846
+ }, null, 8, ["model-value"]),
1847
+ e.helperText ? (openBlock(), createBlock(p, {
1848
+ key: 0,
1849
+ class: "!mt-[8px]",
1850
+ text: e.helperText,
1851
+ state: "error"
1852
+ }, null, 8, ["text"])) : createCommentVNode("", !0)
1853
+ ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(s.field), 1));
1854
+ };
1855
+ }
1856
+ }), _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({
1857
+ __name: "CampaignSummary",
1858
+ props: {
1859
+ data: {
1860
+ type: Object,
1861
+ required: !0
1862
+ }
1863
+ },
1864
+ setup(e) {
1865
+ const { t: d, te: a } = useI18n();
1866
+ return (s, u) => {
1867
+ const i = resolveComponent("FmCard");
1868
+ return openBlock(), createBlock(i, {
1869
+ variant: "outlined",
1870
+ class: "p-16 space-y-8"
1871
+ }, {
1872
+ default: withCtx(() => [
1873
+ createElementVNode("div", _hoisted_1$1, toDisplayString(unref(d)("connect.campaign.common.summary")), 1),
1874
+ u[0] || (u[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
1875
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (o, l) => (openBlock(), createElementBlock("div", {
1876
+ class: "space-y-4",
1877
+ key: l
1878
+ }, [
1879
+ o ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1880
+ createElementVNode("div", _hoisted_2$1, toDisplayString(unref(d)(`${l}`)), 1),
1881
+ createElementVNode("div", _hoisted_3$1, toDisplayString(unref(a)(`${o}`) ? unref(d)(`${o}`) : o), 1)
1882
+ ], 64)) : createCommentVNode("", !0)
1883
+ ]))), 128))
1884
+ ]),
1885
+ _: 1
1886
+ });
1887
+ };
1888
+ }
1889
+ }), _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 = {
1890
+ key: 0,
1891
+ class: "max-w-6xl mx-auto"
1892
+ }, _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({
1893
+ __name: "EditCampaignSheet",
1894
+ emits: ["submit:model-value"],
1895
+ setup(__props, { expose: __expose, emit: __emit }) {
1896
+ const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
1897
+ TEMPLATES.VOUCHER
1898
+ ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
1899
+ async function showSheet(visible, type, campaign, selectedTemplate) {
1900
+ var e, d;
1901
+ if (sheetVisible.value = visible, visible == !0) {
1902
+ try {
1903
+ isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
1904
+ } catch {
1905
+ } finally {
1906
+ await new Promise((a) => setTimeout(a, 120)), isLoading.value = !1;
1907
+ }
1908
+ template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((a, s) => {
1909
+ a.campaign.type === "VOUCHER" && a.campaign.code && useCampaignStore().campaigns.voucher.some(
1910
+ (u) => u.code === a.campaign.code && u._id.toString() !== a.campaign._id.toString()
1911
+ ) && s.addIssue({
1912
+ code: "custom",
1913
+ message: "Code already exists, please use another code",
1914
+ path: ["campaign", "code"]
1915
+ });
1916
+ })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
1917
+ ...(d = template.value) == null ? void 0 : d.defaultValue
1918
+ }), "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`;
1919
+ }
1920
+ }
1921
+ async function hideSheet() {
1922
+ Dialog.open({
1923
+ title: t("connect.campaign.common.unsaved_changes"),
1924
+ message: t("connect.campaign.common.unsaved_changes"),
1925
+ primaryActions: {
1926
+ text: t("connect.campaign.common.unsaved_changes_confirm"),
1927
+ close: !0
1928
+ },
1929
+ secondaryActions: {
1930
+ text: t("connect.campaign.common.unsaved_changes_cancel"),
1931
+ close: !1
1932
+ }
1933
+ }).onPrimary(() => {
1934
+ sheetVisible.value = !1;
1935
+ }).onSecondary(() => {
1936
+ Dialog.close();
1937
+ });
1938
+ }
1939
+ const emits = __emit, errors = computed(() => {
1940
+ const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
1941
+ return e.success ? [] : e.error.errors;
1942
+ });
1943
+ function stepErrors(e = currentStep.value - 1) {
1944
+ const d = template.value.steps[e].groups.flatMap(
1945
+ (a) => a.fields.map((s) => s.property)
1946
+ );
1947
+ return errors.value.filter((a) => d.includes(a.path.join(".")));
1948
+ }
1949
+ __expose({ showSheet });
1950
+ function showSummaryDialog() {
1951
+ Dialog.open({
1952
+ title: "",
1953
+ dialogComponent: _sfc_main$1,
1954
+ dialogComponentProps: {
1955
+ data: data.value
1956
+ }
1957
+ });
1958
+ }
1959
+ function onUpdateProperty(e, d) {
1960
+ if (_.set(data.value, e, d), e == "campaign.event.type") {
1961
+ const a = RuleBuilder.setRuleToGroup(
1962
+ RuleBuilder.scaffoldGroup(),
1963
+ [
1964
+ RuleBuilder.scaffoldGroup("g_schedule"),
1965
+ RuleBuilder.scaffoldGroup("g_time"),
1966
+ RuleBuilder.scaffoldGroup("g_user"),
1967
+ RuleBuilder.scaffoldGroup("g_bill")
1968
+ ]
1969
+ ), s = RuleBuilder.setRuleToGroup(
1970
+ RuleBuilder.scaffoldGroup("g_schedule"),
1971
+ [
1972
+ RuleBuilder.constructEntry(
1973
+ "trigger.date",
1974
+ "_rrule",
1975
+ "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
1976
+ ),
1977
+ RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
1978
+ ],
1979
+ "&&"
1980
+ );
1981
+ if (d != "SCHEDULE") {
1982
+ _.set(data.value, "campaign.event.rule", a);
1983
+ return;
1984
+ }
1985
+ _.set(
1986
+ data.value,
1987
+ "campaign.event.rule",
1988
+ RuleBuilder.setRuleToGroup(a, s)
1989
+ );
1990
+ }
1991
+ e == "campaign.notify" && d == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
1992
+ }
1993
+ async function onUpdateFile(e, d) {
1994
+ return e ? await minor(async () => firebaseStorage.update(d, e), {
1995
+ message: `${e ? "Uploading" : "Removing"} file`,
1996
+ successMessage: `File ${e ? "uploaded" : "removed"} successfully`
1997
+ }) : "";
1998
+ }
1999
+ function isDisable(e) {
2000
+ var d, a;
2001
+ switch (e == null ? void 0 : e.property) {
2002
+ case "campaign.event.type":
2003
+ return ((a = (d = data.value) == null ? void 0 : d.campaign) == null ? void 0 : a._id) || !1;
2004
+ default:
2005
+ return !1;
2006
+ }
2007
+ }
2008
+ function onSubmit() {
2009
+ const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
2010
+ e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
2011
+ }
2012
+ return (e, d) => {
2013
+ const a = resolveComponent("FmButton"), s = resolveComponent("FmStep"), u = resolveComponent("FmStepper"), i = resolveComponent("FmCard"), o = resolveComponent("FmTopSheet");
2014
+ return openBlock(), createBlock(o, {
2015
+ "fullscreen-size": "lg",
2016
+ modelValue: unref(sheetVisible),
2017
+ "onUpdate:modelValue": [
2018
+ d[7] || (d[7] = (l) => isRef(sheetVisible) ? sheetVisible.value = l : null),
2019
+ d[8] || (d[8] = (l) => sheetVisible.value = l)
2020
+ ]
2021
+ }, createSlots({
2022
+ "top-sheet-header": withCtx(() => [
2023
+ createElementVNode("div", _hoisted_1, [
2024
+ createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
2025
+ createElementVNode("div", _hoisted_2, [
2026
+ createVNode(a, {
2027
+ onClick: d[0] || (d[0] = (l) => hideSheet()),
2028
+ label: unref(t)("connect.campaign.common.cancel"),
2029
+ variant: "tertiary"
2030
+ }, null, 8, ["label"]),
2031
+ createVNode(a, {
2032
+ onClick: onSubmit,
2033
+ label: unref(t)("connect.campaign.common.save"),
2034
+ disabled: unref(errors).length > 0
2035
+ }, null, 8, ["label", "disabled"])
2036
+ ])
2037
+ ])
2038
+ ]),
2039
+ _: 2
2040
+ }, [
2041
+ unref(isLoading) ? {
2042
+ name: "default",
2043
+ fn: withCtx(() => [
2044
+ createElementVNode("div", _hoisted_9, [
2045
+ createElementVNode("div", _hoisted_10, [
2046
+ createElementVNode("div", _hoisted_11, [
2047
+ d[9] || (d[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
2048
+ createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
2049
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2050
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2051
+ createElementVNode("div", { class: "space-y-3" }, [
2052
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2053
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2054
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2055
+ ]),
2056
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2057
+ ]),
2058
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2059
+ createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2060
+ createElementVNode("div", { class: "space-y-3" }, [
2061
+ createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2062
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2063
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2064
+ ]),
2065
+ createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2066
+ ])
2067
+ ])
2068
+ ], -1)),
2069
+ createVNode(i, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
2070
+ ])
2071
+ ])
2072
+ ])
2073
+ ]),
2074
+ key: "1"
2075
+ } : {
2076
+ name: "default",
2077
+ fn: withCtx(() => [
2078
+ unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
2079
+ createVNode(u, {
2080
+ modelValue: unref(currentStep),
2081
+ "onUpdate:modelValue": d[1] || (d[1] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2082
+ orientation: "horizontal",
2083
+ class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
2084
+ }, {
2085
+ default: withCtx(() => [
2086
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
2087
+ key: l.name,
2088
+ title: unref(t)(l.name),
2089
+ value: n + 1,
2090
+ error: () => stepErrors(n).length > 0,
2091
+ complete: () => n + 1 <= unref(currentStep)
2092
+ }, null, 8, ["title", "value", "error", "complete"]))), 128))
2093
+ ]),
2094
+ _: 1
2095
+ }, 8, ["modelValue"]),
2096
+ createElementVNode("div", _hoisted_4, [
2097
+ createVNode(a, {
2098
+ icon: "close",
2099
+ variant: "tertiary",
2100
+ onClick: d[2] || (d[2] = (l) => sheetVisible.value = !1)
2101
+ }),
2102
+ createVNode(u, {
2103
+ modelValue: unref(currentStep),
2104
+ "onUpdate:modelValue": d[3] || (d[3] = (l) => isRef(currentStep) ? currentStep.value = l : null),
2105
+ orientation: "horizontal",
2106
+ class: "flex-1"
2107
+ }, {
2108
+ default: withCtx(() => [
2109
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (l, n) => (openBlock(), createBlock(s, {
2110
+ key: l.name,
2111
+ title: unref(sheetTitle),
2112
+ description: l.name,
2113
+ value: n + 1,
2114
+ error: () => stepErrors(n).length > 0,
2115
+ complete: () => n + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
2116
+ }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
2117
+ ]),
2118
+ _: 1
2119
+ }, 8, ["modelValue"]),
2120
+ createVNode(a, {
2121
+ icon: "info",
2122
+ variant: "tertiary",
2123
+ onClick: d[4] || (d[4] = () => showSummaryDialog())
2124
+ })
2125
+ ]),
2126
+ createElementVNode("div", _hoisted_5, [
2127
+ createElementVNode("div", _hoisted_6, [
2128
+ createVNode(JsonViewer, {
2129
+ json: {
2130
+ data: unref(data),
2131
+ errors: unref(errors).map(
2132
+ (l) => `${l.path.join(".")} - ${l.message}`
2133
+ ),
2134
+ stepErrors: stepErrors().map(
2135
+ (l) => `${l.path.join(".")} - ${l.message}`
2136
+ ),
2137
+ schema: unref(schema)
2138
+ }
2139
+ }, null, 8, ["json"]),
2140
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
2141
+ (l) => l.fields.length && (!l.condition || unref(_).get(unref(data), l.condition.property) == l.condition.value == (l.condition.not != !0))
2142
+ ), (l, n) => (openBlock(), createElementBlock("div", {
2143
+ key: n,
2144
+ class: "space-y-24"
2145
+ }, [
2146
+ createElementVNode("div", _hoisted_7, toDisplayString(l.name ? unref(t)(l.name) : ""), 1),
2147
+ (openBlock(!0), createElementBlock(Fragment, null, renderList(l.fields, (m, g) => (openBlock(), createElementBlock("div", { key: g }, [
2148
+ (openBlock(), createBlock(_sfc_main$2, {
2149
+ key: g,
2150
+ field: m,
2151
+ modelValue: unref(_).get(unref(data), m.property),
2152
+ disabled: isDisable(m),
2153
+ "onUpdate:modelValue": (y) => onUpdateProperty(m.property, y),
2154
+ "onUpdate:file": async (y, v) => {
2155
+ const h = await onUpdateFile(y, v);
2156
+ onUpdateProperty(m.property, h || "");
2157
+ },
2158
+ schema: unref(ZodHelper).typeAtPath(
2159
+ unref(schema),
2160
+ m.property,
2161
+ unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
2162
+ ),
2163
+ "helper-state": unref(ZodHelper).helperState(unref(errors), m.property),
2164
+ "helper-text": unref(ZodHelper).helperText(unref(errors), m.property),
2165
+ extras: m.extras != null ? m.extras == "" ? unref(data) : unref(_).get(unref(data), m.extras) : void 0
2166
+ }, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
2167
+ ]))), 128))
2168
+ ]))), 128)),
2169
+ createElementVNode("div", _hoisted_8, [
2170
+ createVNode(a, {
2171
+ label: "Back",
2172
+ variant: "tertiary",
2173
+ disabled: unref(currentStep) == 1,
2174
+ onClick: d[5] || (d[5] = (l) => currentStep.value--)
2175
+ }, null, 8, ["disabled"]),
2176
+ createVNode(a, {
2177
+ disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
2178
+ label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
2179
+ onClick: d[6] || (d[6] = (l) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
2180
+ }, null, 8, ["disabled", "label"])
2181
+ ])
2182
+ ]),
2183
+ createVNode(_sfc_main$1, {
2184
+ data: unref(data),
2185
+ class: "xs:hidden"
2186
+ }, null, 8, ["data"])
2187
+ ])
2188
+ ])) : createCommentVNode("", !0)
2189
+ ]),
2190
+ key: "0"
2191
+ }
2192
+ ]), 1032, ["modelValue"]);
2193
+ };
2194
+ }
2195
+ });
2196
+ export {
2197
+ _sfc_main as _
2198
+ };