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

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