@feedmepos/mf-connect 0.1.0-beta.6 → 0.1.0-beta.61

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 (119) hide show
  1. package/dist/Analytic-u9mtlxSv.js +427 -0
  2. package/dist/{App-C2616cfr.js → App-BwTQE7Ft.js} +445 -420
  3. package/dist/AuditLogs-BVMRclSw.js +1886 -0
  4. package/dist/Bin-Cca-XOkz.js +166 -0
  5. package/dist/{Broadcast-CqSwLTAq.js → Broadcast-DRQgpwdP.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DrR9Pmtb.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CeUu_T1u.js} +6 -8
  7. package/dist/Card-CnbB_u31.js +896 -0
  8. package/dist/Collections-BjlfOSC3.js +459 -0
  9. package/dist/{Credit-CPcLgnsq.js → Credit-BoElrcx9.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-B3WVwem6.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-D2buK6Dj.js → EffectSheet.vue_vue_type_style_index_0_lang-CGfpziKs.js} +18 -18
  14. package/dist/{Experience-BoBikt-x.js → Experience-SdGBf4vU.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/{Game-DR8PyYZa.js → Game-ChLHibpB.js} +39 -37
  17. package/dist/Index-D7Kq6uyf.js +259 -0
  18. package/dist/Marketing-BDajIqR_.js +20071 -0
  19. package/dist/Member-BPZryqWL.js +317 -0
  20. package/dist/MemberList-C52Dop8Z.js +1598 -0
  21. package/dist/MemberTransactions-DHU78kgS.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DhtIZCjT.js → MessageInput.vue_vue_type_script_setup_true_lang-js1F2E4N.js} +83 -71
  23. package/dist/{Mission-CMpvz9zN.js → Mission-BQR3qjAu.js} +101 -87
  24. package/dist/Overview-BbLYWXjG.js +1078 -0
  25. package/dist/{Point-DkZn6p9s.js → Point-DbTcWJbQ.js} +55 -53
  26. package/dist/{Promotion-B7YzwPc_.js → Promotion-CIrpWBQD.js} +65 -57
  27. package/dist/Queue-B0Mfq2Vn.js +244 -0
  28. package/dist/Record-Z6ZrJeLc.js +340 -0
  29. package/dist/Reward-D6k0QFQA.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-GJ6j_jOh.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-gQxmX9ur.js +1637 -0
  32. package/dist/Segment-D6MF-EO8.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BWG-pz6F.js +181 -0
  34. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-HgorlHNz.js +147 -0
  35. package/dist/Setting--OFDS95z.js +1931 -0
  36. package/dist/Store-BqlRTC-c.js +1751 -0
  37. package/dist/{StoreRewards-6BzVwZqr.js → StoreRewards-BTu0IdDN.js} +33 -32
  38. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BX053DJA.js +943 -0
  39. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-B6cAveco.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BAkuqLwy.js} +1 -1
  40. package/dist/{Tier-CW-46oJS.js → Tier-CE9LYAEX.js} +327 -318
  41. package/dist/{Title-CE9rWVdi.js → Title-DOOASUMI.js} +199 -184
  42. package/dist/{Transaction-B21RrC4M.js → Transaction-DPxUOBP-.js} +2 -2
  43. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-CKwf0F_i.js +130 -0
  44. package/dist/Voucher-D69DD02z.js +354 -0
  45. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CFL0Nsez.js +419 -0
  46. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BiVZwBuG.js → ZodTextField.vue_vue_type_script_setup_true_lang-Byh6_EJM.js} +1 -1
  47. package/dist/app-C2u1t47T.js +7059 -0
  48. package/dist/app-DgfmbHZe.js +33357 -0
  49. package/dist/app.js +1 -1
  50. package/dist/{business-aHhRUXc0.js → business-BqCJB_vA.js} +1 -1
  51. package/dist/{campaign-DH9NUNf_.js → campaign-CWMPCmmU.js} +2 -2
  52. package/dist/campaign-D0dTbl5b.js +1810 -0
  53. package/dist/campaign.enum-DhE8N4pA.js +20 -0
  54. package/dist/campaign.fn-BpO-RQih.js +758 -0
  55. package/dist/collectible.enum-rWEc6Tsw.js +19 -0
  56. package/dist/{collection.fn-CYlsA-kW.js → collection.fn-biX2iFDQ.js} +2 -2
  57. package/dist/dto-3m7xZwfI.js +214 -0
  58. package/dist/{effect-LSc9YanX.js → effect-ZMGRxKCZ.js} +9 -9
  59. package/dist/email-addresses-lgY03bkq.js +705 -0
  60. package/dist/{export-Cf0-C5Ly.js → export-BOzeYUy8.js} +5 -5
  61. package/dist/{helper-CiZpeMCM.js → helper-CO29wun4.js} +1 -1
  62. package/dist/index-B3V7krW_.js +29000 -0
  63. package/dist/index-BVbiAxW8.js +115 -0
  64. package/dist/{index-D_83JP2i.js → index-Bvch9tuP.js} +48 -4
  65. package/dist/index-CYOwwy3h.js +44 -0
  66. package/dist/{index-D6cEOHP4.js → index-CbYXYVYp.js} +1501 -1480
  67. package/dist/{index-DtsDOuDx.js → index-ChrOXJDq.js} +24 -21
  68. package/dist/index-CsaQJMAR.js +66 -0
  69. package/dist/index-DNGenFnf.js +32 -0
  70. package/dist/{index-BVb5-Ht8.js → index-Dd22X409.js} +259 -173
  71. package/dist/{index-kPhrD63q.js → index-LYAWIqjk.js} +1 -1
  72. package/dist/index-Xh9cW6Y9.js +54 -0
  73. package/dist/{index-gxwjKu3-.js → index-XhqaicYu.js} +2212 -871
  74. package/dist/{index-DW3PRjPL.js → index-YsC4VklJ.js} +1 -1
  75. package/dist/index-vh86FiIQ.js +10 -0
  76. package/dist/{index.esm2017-B7oVYIbY.js → index.esm2017-CJ1flA6S.js} +121 -121
  77. package/dist/loading-CUs_CN1k.js +71 -0
  78. package/dist/{membership-Dw1ylJ9Y.js → membership-D-GVacos.js} +54 -46
  79. package/dist/money-CMtSALkX.js +15 -0
  80. package/dist/number-CDwwgAYM.js +12 -0
  81. package/dist/objectid-Bf9yKD81.js +145 -0
  82. package/dist/{loading-7yq1tinq.js → plugins-9sQTEyth.js} +3871 -3943
  83. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  84. package/dist/reward-DblXGhWc.js +36 -0
  85. package/dist/{rule-C0Q_SHow.js → rule-Cy8cTzuw.js} +180 -177
  86. package/dist/{rule-builder-iu17XIof.js → rule-builder-Cn5vZgFN.js} +1 -1
  87. package/dist/style.css +1 -1
  88. package/dist/{template-CyOanTMu.js → template-Cal94dUy.js} +5 -5
  89. package/dist/trigger-C1nwLSP8.js +144 -0
  90. package/dist/user-ir4Rn5bP.js +54 -0
  91. package/dist/{vue-i18n-B0fLJH7a.js → vue-i18n-eOHBBaH5.js} +243 -243
  92. package/dist/{xlsx-BYO_bB9J.js → xlsx-DulnT75_.js} +1 -1
  93. package/package.json +11 -7
  94. package/dist/Analytic-muDf0oMG.js +0 -622
  95. package/dist/Card-bhLoK0ZV.js +0 -825
  96. package/dist/Collections-DjtsAiol.js +0 -453
  97. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-U_QZneS6.js +0 -2813
  98. package/dist/Marketing-Dny2nMUl.js +0 -316
  99. package/dist/Member-CP_smyk8.js +0 -69
  100. package/dist/MemberList-CR3eYI9p.js +0 -1733
  101. package/dist/MemberTransactions-RTx_lKFb.js +0 -38
  102. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cs67_GLE.js +0 -1753
  103. package/dist/Segment-Bb4gHt5V.js +0 -437
  104. package/dist/Setting-Xj0AVzh3.js +0 -1901
  105. package/dist/Store-BWRHQ6Ie.js +0 -1511
  106. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BsFnT8BS.js +0 -890
  107. package/dist/Voucher-KK9fBI0u.js +0 -490
  108. package/dist/app-CjhXHUQv.js +0 -53428
  109. package/dist/app-Dvf_JNMf.js +0 -5764
  110. package/dist/dto-DArfyZAI.js +0 -2770
  111. package/dist/index-Bi_LGEtY.js +0 -99
  112. package/dist/index-CiQDG7Cm.js +0 -762
  113. package/dist/index-CuvNtC_M.js +0 -61
  114. package/dist/index-DQfjSSMF.js +0 -206
  115. package/dist/index-DcxssxPi.js +0 -29193
  116. package/dist/index-DqJVH2kv.js +0 -298
  117. package/dist/money-CPd0XTNv.js +0 -15
  118. package/dist/number-BgXY4un8.js +0 -12
  119. package/dist/user-Bm4KttFq.js +0 -37
@@ -1,2813 +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-Dvf_JNMf.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-DArfyZAI.js";
6
- import { u as useMembershipStore, C as CollectibleOptions } from "./membership-Dw1ylJ9Y.js";
7
- import { u as useBusinessStore } from "./business-aHhRUXc0.js";
8
- import { a as FdoEarningOption, b as F_GAME_TYPE, F as FdtoCollectibleConfig } from "./index-D6cEOHP4.js";
9
- import { i as isRuleGroup, R as RuleBuilder, a as isRuleEntry } from "./rule-builder-iu17XIof.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-CiQDG7Cm.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-D2buK6Dj.js";
15
- import { _ as _sfc_main$y } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-B6cAveco.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-Cs67_GLE.js";
17
- import { p as prompt, c as cases, f as firebaseStorage, u as useLoading } from "./loading-7yq1tinq.js";
18
- import { _ as _sfc_main$q, T as TEMPLATES } from "./index-BVb5-Ht8.js";
19
- import { u as useI18n } from "./vue-i18n-B0fLJH7a.js";
20
- import { _ as _sfc_main$A } from "./MessageInput.vue_vue_type_script_setup_true_lang-DhtIZCjT.js";
21
- import { c as calculateNextScheduleAt, S as SummarizeRrule, R as RRule } from "./rule-C0Q_SHow.js";
22
- import { r, S as SvcConfig } from "./index-DcxssxPi.js";
23
- import "./index-DQfjSSMF.js";
24
- import "./index-gxwjKu3-.js";
25
- import "./index-DqJVH2kv.js";
26
- import "./index-DW3PRjPL.js";
27
- import { useCoreStore } from "@feedmepos/mf-common";
28
- import { _ as _sfc_main$u } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BiVZwBuG.js";
29
- import { i as initCollectibleConfig } from "./helper-CiZpeMCM.js";
30
- import { C as CollectionUtils } from "./collection.fn-CYlsA-kW.js";
31
- import { s as sentenceCase$1 } from "./index-CuvNtC_M.js";
32
- import { useDialog } from "@feedmepos/ui-library";
33
- import { u as useCampaignStore } from "./campaign-DH9NUNf_.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: c }) {
45
- const s = e, u = computed(() => {
46
- var o;
47
- const [i] = isRuleGroup(s.modelValue) ? Object.values(((o = s.modelValue) == null ? void 0 : o.rules) ?? {}) : [null];
48
- return (i ?? RuleBuilder.constructEntry("user.segment", "_hasAny", [])).conditions._hasAny;
49
- }), a = c;
50
- return (i, l) => (openBlock(), createBlock(_sfc_main$q, {
51
- multiselect: !0,
52
- items: unref(useMembershipStore)().segmentOptions,
53
- "model-value": unref(u),
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: c }) {
75
- const { t: s } = useI18n(), u = e, a = c, i = ref(
76
- u.modelValue ? RuleBuilder.getRules(u.modelValue.rules.g_user).length > 0 ? "custom" : RuleBuilder.getRules(u.modelValue.rules.g_segment).length > 0 ? "segment" : "all_users" : "all_users"
77
- ), l = [
78
- {
79
- value: "all_users",
80
- label: s("connect.template.rule.audience.all")
81
- },
82
- {
83
- value: "segment",
84
- label: s("connect.template.rule.audience.member_segment")
85
- },
86
- {
87
- value: "custom",
88
- label: s("connect.template.rule.audience.custom_audience")
89
- }
90
- ];
91
- return watch(i, async (o, n) => {
92
- var p;
93
- if (n != "all_users" && n != o && RuleBuilder.getRules(
94
- (p = u.modelValue) == null ? void 0 : p.rules[n == "custom" ? "g_user" : "g_segment"]
95
- ).length > 0) {
96
- const h = await prompt.confirm(
97
- s("connect.template.rule.audience.confirm_remove"),
98
- s("connect.common.confirm"),
99
- s("connect.common.confirm"),
100
- s("connect.common.cancel")
101
- );
102
- h && a(
103
- "update:model-value",
104
- RuleBuilder.setRuleToGroup(
105
- u.modelValue ?? RuleBuilder.scaffoldGroup(),
106
- RuleBuilder.scaffoldGroup(n == "custom" ? "g_user" : "g_segment")
107
- )
108
- ), i.value = h ? o : n;
109
- }
110
- }), (o, n) => {
111
- var h, y;
112
- const p = resolveComponent("FmRadio");
113
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
114
- createElementVNode("div", null, [
115
- (openBlock(), createElementBlock(Fragment, null, renderList(l, (g) => createVNode(p, {
116
- key: g.value,
117
- value: g.value,
118
- label: g.label,
119
- modelValue: unref(i),
120
- "onUpdate:modelValue": n[0] || (n[0] = (V) => isRef(i) ? i.value = V : null)
121
- }, null, 8, ["value", "label", "modelValue"])), 64))
122
- ]),
123
- unref(i) == "segment" ? (openBlock(), createElementBlock("div", _hoisted_2$e, [
124
- createVNode(_sfc_main$p, {
125
- modelValue: ((h = e.modelValue) == null ? void 0 : h.rules.g_segment) ?? unref(RuleBuilder).scaffoldGroup("g_segment"),
126
- "onUpdate:modelValue": n[1] || (n[1] = (g) => a(
127
- "update:model-value",
128
- unref(RuleBuilder).setRuleToGroup(
129
- e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
130
- g,
131
- "&&"
132
- )
133
- ))
134
- }, null, 8, ["modelValue"])
135
- ])) : createCommentVNode("", !0),
136
- unref(i) == "custom" ? (openBlock(), createBlock(_sfc_main$r, {
137
- key: 1,
138
- "include-only": "user",
139
- "trigger-type": "MEMBERSHIP_JOINED",
140
- "model-value": ((y = e.modelValue) == null ? void 0 : y.rules.g_user) ?? unref(RuleBuilder).scaffoldGroup("g_user"),
141
- "onUpdate:modelValue": n[2] || (n[2] = (g) => a(
142
- "update:model-value",
143
- unref(RuleBuilder).setRuleToGroup(
144
- e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
145
- g,
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: c }) {
164
- const { t: s } = useI18n(), u = e, a = c, i = ref(
165
- !u.modelValue || !u.modelValue.rules.g_time ? "all_time" : RuleBuilder.getRules(u.modelValue.rules.g_time).length > 0 ? "custom" : "all_time"
166
- );
167
- watch(i, async (o, n) => {
168
- var p;
169
- if (n == "custom" && o == "all_time" && RuleBuilder.getRules((p = u.modelValue) == null ? void 0 : p.rules.g_time).length > 0) {
170
- const h = await prompt.confirm(
171
- s("connect.template.rule.time.confirm_remove"),
172
- s("connect.common.confirm"),
173
- s("connect.common.confirm"),
174
- s("connect.common.cancel")
175
- );
176
- h && a(
177
- "update:model-value",
178
- RuleBuilder.setRuleToGroup(
179
- u.modelValue ?? RuleBuilder.scaffoldGroup(),
180
- RuleBuilder.scaffoldGroup("g_time")
181
- )
182
- ), i.value = h ? o : n;
183
- }
184
- });
185
- async function l(o) {
186
- var n;
187
- if (o == "custom" && RuleBuilder.getRules((n = u.modelValue) == null ? void 0 : n.rules.g_time).length > 0) {
188
- if (!await prompt.confirm(
189
- s("connect.template.rule.time.confirm_remove"),
190
- s("connect.common.confirm"),
191
- s("connect.common.confirm"),
192
- s("connect.common.cancel")
193
- )) {
194
- i.value = "all_time";
195
- return;
196
- }
197
- a(
198
- "update:model-value",
199
- RuleBuilder.setRuleToGroup(
200
- u.modelValue ?? RuleBuilder.scaffoldGroup(),
201
- RuleBuilder.scaffoldGroup("g_time")
202
- )
203
- );
204
- }
205
- }
206
- return (o, n) => {
207
- var y;
208
- const p = resolveComponent("FmRadio"), h = resolveComponent("FmRadioGroup");
209
- return openBlock(), createElementBlock("div", _hoisted_1$j, [
210
- createVNode(h, {
211
- modelValue: unref(i),
212
- "onUpdate:modelValue": [
213
- n[0] || (n[0] = (g) => isRef(i) ? i.value = g : null),
214
- n[1] || (n[1] = (g) => l(g))
215
- ]
216
- }, {
217
- default: withCtx(() => [
218
- createVNode(p, {
219
- label: unref(s)("connect.template.rule.time.all_time"),
220
- value: "all_time"
221
- }, null, 8, ["label"]),
222
- createVNode(p, {
223
- label: unref(s)("connect.template.rule.time.custom"),
224
- value: "custom"
225
- }, null, 8, ["label"])
226
- ]),
227
- _: 1
228
- }, 8, ["modelValue"]),
229
- unref(i) == "custom" ? (openBlock(), createBlock(_sfc_main$r, {
230
- key: 0,
231
- class: "!mt-[0px]",
232
- "include-only": "trigger",
233
- "trigger-type": "SCHEDULE",
234
- "model-value": ((y = e.modelValue) == null ? void 0 : y.rules.g_time) ?? unref(RuleBuilder).scaffoldGroup("g_time"),
235
- "onUpdate:modelValue": n[2] || (n[2] = (g) => a(
236
- "update:model-value",
237
- unref(RuleBuilder).setRuleToGroup(
238
- e.modelValue ?? unref(RuleBuilder).scaffoldGroup(),
239
- g,
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: c }) {
258
- const s = c;
259
- return (u, a) => {
260
- var i;
261
- return openBlock(), createBlock(_sfc_main$r, {
262
- "include-only": "bill",
263
- "trigger-type": "BILL_COMPLETED",
264
- "model-value": ((i = e.modelValue) == null ? void 0 : i.rules.g_bill) ?? unref(RuleBuilder).scaffoldGroup("g_bill"),
265
- "onUpdate:modelValue": a[0] || (a[0] = (l) => s(
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: c }) {
285
- const s = e, u = c, a = computed(() => {
286
- const { property: i, operator: l, equator: o } = RuleBuilder.simplify(
287
- s.modelValue ?? RuleBuilder.constructEntry("user.birthday", "_isDay", {
288
- op: "before",
289
- x: 1
290
- })
291
- );
292
- return {
293
- property: i,
294
- operator: l,
295
- equator: o
296
- };
297
- });
298
- return (i, 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
- u(
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
- u(
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] = (p) => u(
337
- "update:model-value",
338
- unref(RuleBuilder).constructEntry("user.birthday", "_isDay", {
339
- op: "after",
340
- x: p,
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
- u(
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
- u(
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: c }) {
389
- const s = c;
390
- return (u, a) => {
391
- var i;
392
- return openBlock(), createBlock(_sfc_main$r, {
393
- "include-only": "feedback",
394
- "trigger-type": "FEEDBACK",
395
- "model-value": ((i = e.modelValue) == null ? void 0 : i.rules.g_feedback) ?? unref(RuleBuilder).scaffoldGroup("g_feedback"),
396
- "onUpdate:modelValue": a[0] || (a[0] = (l) => s(
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 c = CAMPAIGN_TRIGGER[e];
476
- return [
477
- e,
478
- (c == null ? void 0 : c.map((s) => TriggerOptions[s]).filter((s) => !s.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: c }) {
498
- const s = e, u = c, a = computed(() => s.disabled ? TypeToTriggerOptions[s.campaignType].filter(
499
- (i) => i.value == s.modelValue
500
- ) : TypeToTriggerOptions[s.campaignType]);
501
- return (i, 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: s.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
- s.modelValue != n.value && !s.disabled && u("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: c }) {
543
- const s = c;
544
- return (u, a) => {
545
- const i = 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) => s("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(i, {
559
- key: 0,
560
- variant: "tertiary",
561
- icon: "clear",
562
- onClick: a[0] || (a[0] = (p) => (p.stopPropagation(), s("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: c }) {
587
- const s = c;
588
- return (u, a) => {
589
- var i, l;
590
- return openBlock(), createElementBlock("div", _hoisted_1$h, [
591
- createElementVNode("div", _hoisted_2$c, [
592
- createVNode(_sfc_main$i, {
593
- "model-value": ((i = e.modelValue) == null ? void 0 : i.startDate) ?? null,
594
- label: "Start date",
595
- "onUpdate:modelValue": a[0] || (a[0] = (o) => {
596
- var n;
597
- return s("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 s("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: c }) {
640
- const s = e, u = c;
641
- function a() {
642
- const y = RuleBuilder.getRules(s.modelValue);
643
- return y.length == 0 ? "fixed" : y.some(
644
- (g) => isRuleEntry(g) && RuleBuilder.simplify(g).operator == "_rrule"
645
- ) ? "repeating" : "fixed";
646
- }
647
- const i = ref(a()), l = ref(!1), o = computed(() => {
648
- const y = RuleBuilder.getRules(s.modelValue), g = y.find(
649
- (d) => isRuleEntry(d) && RuleBuilder.simplify(d).property == "trigger.date"
650
- ), V = y.find(
651
- (d) => isRuleEntry(d) && RuleBuilder.simplify(d).property == "trigger.time"
652
- );
653
- return {
654
- date: g ? RuleBuilder.simplify(g).equator : null,
655
- time: V ? RuleBuilder.simplify(V).equator : null
656
- };
657
- }), n = computed(
658
- () => calculateNextScheduleAt(
659
- s.modelValue,
660
- /* @__PURE__ */ new Date(),
661
- s.startDate ? new Date(s.startDate) : void 0,
662
- s.endDate ? new Date(s.endDate) : void 0
663
- )
664
- );
665
- function p(y) {
666
- const g = y.label.toLowerCase(), V = g == "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
- u(
682
- "update:model-value",
683
- RuleBuilder.setRuleToGroup(
684
- RuleBuilder.scaffoldGroup("g_schedule"),
685
- V
686
- )
687
- ), i.value = g;
688
- }
689
- function h(y) {
690
- i.value == "fixed" ? u(
691
- "update:model-value",
692
- RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
693
- RuleBuilder.constructEntry(
694
- "trigger.date",
695
- "_isOnDate",
696
- y.date
697
- ),
698
- RuleBuilder.constructEntry(
699
- "trigger.time",
700
- "_isOnTime",
701
- y.time
702
- )
703
- ])
704
- ) : u(
705
- "update:model-value",
706
- RuleBuilder.setRuleToGroup(RuleBuilder.scaffoldGroup("g_schedule"), [
707
- RuleBuilder.constructEntry(
708
- "trigger.date",
709
- "_rrule",
710
- y.date
711
- ),
712
- RuleBuilder.constructEntry(
713
- "trigger.time",
714
- "_isOnTime",
715
- y.time
716
- )
717
- ])
718
- );
719
- }
720
- return (y, g) => {
721
- const V = resolveComponent("FmButtonGroup"), d = resolveComponent("FmTimePicker"), m = resolveComponent("FmIcon"), f = resolveComponent("FmTooltip"), v = resolveComponent("FmField"), E = resolveComponent("FmCard"), x = resolveComponent("FmPopover"), k = resolveComponent("FmDatePicker"), B = resolveComponent("FmHelperText");
722
- return openBlock(), createElementBlock(Fragment, null, [
723
- createVNode(V, {
724
- items: [{ label: "Fixed" }, { label: "Repeating" }],
725
- "model-value": { label: unref(cases).title(unref(i)) },
726
- "onUpdate:modelValue": p,
727
- class: "mb-8"
728
- }, null, 8, ["model-value"]),
729
- createElementVNode("div", _hoisted_1$g, [
730
- createElementVNode("div", _hoisted_2$b, [
731
- createVNode(d, {
732
- label: "Notify time",
733
- "model-value": unref(o).time,
734
- "onUpdate:modelValue": g[0] || (g[0] = (R) => h({ date: unref(o).date, time: R })),
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(i) == "repeating" ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
739
- createElementVNode("div", _hoisted_4$7, [
740
- g[5] || (g[5] = createElementVNode("div", null, "Notify date", -1)),
741
- unref(o).date ? (openBlock(), createBlock(f, {
742
- key: 0,
743
- "z-index": 9999,
744
- content: unref(SummarizeRrule)(unref(RRule).fromString(unref(o).date).options)
745
- }, {
746
- default: withCtx(() => [
747
- createVNode(m, {
748
- name: "info",
749
- size: "sm",
750
- outline: !0
751
- })
752
- ]),
753
- _: 1
754
- }, 8, ["content"])) : createCommentVNode("", !0)
755
- ]),
756
- createVNode(x, {
757
- "show-popover": unref(l),
758
- onPopoverChanged: g[3] || (g[3] = (R) => l.value = R)
759
- }, {
760
- "popover-button": withCtx(() => [
761
- createVNode(v, {
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(E, { 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: g[1] || (g[1] = (R) => l.value = !1),
779
- "onUpdate:modelValue": g[2] || (g[2] = (R) => (h({ date: R, 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(k, {
788
- key: 1,
789
- label: "Notify date",
790
- "model-value": unref(o).date || "",
791
- "onUpdate:modelValue": g[4] || (g[4] = (R) => h({ date: R, 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: c }) {
813
- const s = ref(), u = ref(!1);
814
- function a() {
815
- var l;
816
- (l = s.value) == null || l.onConfirm();
817
- }
818
- const i = c;
819
- return (l, o) => {
820
- const n = resolveComponent("FmField"), p = resolveComponent("FmButton"), h = resolveComponent("FmSideSheet");
821
- return openBlock(), createBlock(h, {
822
- modelValue: u.value,
823
- "onUpdate:modelValue": o[1] || (o[1] = (y) => u.value = y),
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(p, {
842
- variant: "tertiary",
843
- onClick: o[0] || (o[0] = (y) => u.value = !1),
844
- label: "Cancel"
845
- }),
846
- createVNode(p, {
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: s,
859
- "initial-value": l.modelValue,
860
- "filter-items": l.filterItems,
861
- "on-complete": (y) => {
862
- i("confirm", y), u.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: c }) {
894
- var h, y, g;
895
- const s = useBusinessStore(), u = e, a = c, i = [
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((V) => {
907
- var d, m;
908
- return u.fixedType || ((m = (d = u.extras) == null ? void 0 : d.campaign) == null ? void 0 : m.event.type) != "BILL_COMPLETED" ? V.value == "FIXED" : !0;
909
- }), l = computed(() => {
910
- var d, m;
911
- const V = u.extras && "configs" in u.extras ? u.extras.configs.type : (d = u.extras) == null ? void 0 : d.campaign.type;
912
- return (((m = CollectibleOptions[V]) == null ? void 0 : m.name) || "reward").toLowerCase();
913
- }), o = computed(() => {
914
- const V = FdoEarningOption.safeParse(u.modelValue);
915
- return V.success ? [] : V.error.errors;
916
- });
917
- function n(V) {
918
- var d;
919
- V != ((d = u.modelValue) == null ? void 0 : d.type) && a(
920
- "update:model-value",
921
- V === "FIXED" ? {
922
- type: "FIXED",
923
- amount: 1
924
- } : {
925
- type: "PROPORTIONAL",
926
- amount: 1,
927
- every: 1
928
- }
929
- );
930
- }
931
- const p = ref(
932
- ((h = u.modelValue) == null ? void 0 : h.type) === "PROPORTIONAL" && !!((g = (y = u.modelValue) == null ? void 0 : y.property) != null && g.length) || !1
933
- );
934
- return (V, d) => {
935
- var R, C, w;
936
- const m = resolveComponent("FmCard"), f = resolveComponent("FmStepperField"), v = resolveComponent("FmRadio"), E = resolveComponent("FmPill"), x = resolveComponent("FmButton"), k = 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(i), (b) => {
940
- var S, N;
941
- return openBlock(), createBlock(m, {
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(i).length == 1,
945
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((S = e.modelValue) == null ? void 0 : S.type) === b.value,
946
- "hover:bg-fm-color-opacity-sm": ((N = e.modelValue) == null ? void 0 : N.type) != b.value
947
- }]),
948
- onClick: (F) => n(b.value),
949
- key: b.value
950
- }, {
951
- default: withCtx(() => [
952
- createElementVNode("div", _hoisted_3$8, toDisplayString(b.label), 1),
953
- createElementVNode("div", _hoisted_4$6, toDisplayString(b.sublabel), 1)
954
- ]),
955
- _: 2
956
- }, 1032, ["class", "onClick"]);
957
- }), 128))
958
- ]),
959
- createElementVNode("div", _hoisted_5$3, [
960
- ((R = e.modelValue) == null ? void 0 : R.type) === "FIXED" ? (openBlock(), createBlock(f, {
961
- key: 0,
962
- label: `Receive ${unref(l)}(s)`,
963
- class: "flex-1",
964
- "model-value": ((C = e.modelValue) == null ? void 0 : C.amount) ?? null,
965
- "onUpdate:modelValue": d[0] || (d[0] = (b) => a("update:model-value", {
966
- ...e.modelValue ?? { type: "FIXED" },
967
- amount: b
968
- }))
969
- }, null, 8, ["label", "model-value"])) : ((w = e.modelValue) == null ? void 0 : w.type) === "PROPORTIONAL" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
970
- d[11] || (d[11] = createElementVNode("div", { class: "fm-typo-en-body-lg-600" }, "Spending type", -1)),
971
- createVNode(k, {
972
- "model-value": unref(p),
973
- "onUpdate:modelValue": d[6] || (d[6] = (b) => {
974
- unref(p) != b && (a("update:model-value", {
975
- ...e.modelValue ?? {
976
- type: "PROPORTIONAL",
977
- amount: 1,
978
- every: 1
979
- },
980
- property: b ? [] : void 0,
981
- every: 1
982
- }), p.value = b);
983
- })
984
- }, {
985
- default: withCtx(() => [
986
- createVNode(v, {
987
- label: "Amount spent",
988
- sublabel: `Receive ${unref(l)} by amount spent`,
989
- value: !1
990
- }, {
991
- label: withCtx(() => {
992
- var b, S;
993
- return [
994
- d[8] || (d[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(p) ? createCommentVNode("", !0) : (openBlock(), createElementBlock("div", _hoisted_7$2, [
997
- createVNode(f, {
998
- label: `Receive ${unref(l)}(s)`,
999
- inputmode: "decimal",
1000
- class: "flex-1",
1001
- "model-value": ((b = e.modelValue) == null ? void 0 : b.amount) ?? null,
1002
- "onUpdate:modelValue": d[1] || (d[1] = (N) => a("update:model-value", {
1003
- ...e.modelValue ?? { type: "FIXED" },
1004
- amount: N
1005
- }))
1006
- }, null, 8, ["label", "model-value"]),
1007
- d[7] || (d[7] = createElementVNode("div", { class: "xs:py-4 text-center" }, "for every", -1)),
1008
- createVNode(f, {
1009
- label: `Amount spend (${unref(r).getCountry().currency.symbol})`,
1010
- class: "flex-1",
1011
- inputmode: "decimal",
1012
- "model-value": ((S = e.modelValue) == null ? void 0 : S.every) ?? null,
1013
- "onUpdate:modelValue": d[2] || (d[2] = (N) => a("update:model-value", {
1014
- ...e.modelValue,
1015
- every: N
1016
- }))
1017
- }, {
1018
- prepend: withCtx(() => [
1019
- createTextVNode(toDisplayString(unref(r).getCountry().currency.symbol), 1)
1020
- ]),
1021
- _: 1
1022
- }, 8, ["label", "model-value"])
1023
- ]))
1024
- ];
1025
- }),
1026
- _: 1
1027
- }, 8, ["sublabel"]),
1028
- createVNode(v, {
1029
- label: "Product bought",
1030
- sublabel: `Receive ${unref(l)} by product bought`,
1031
- value: !0,
1032
- disabled: !unref(s).isPremium
1033
- }, {
1034
- label: withCtx(() => {
1035
- var b, S;
1036
- return [
1037
- createElementVNode("div", _hoisted_8$1, [
1038
- d[9] || (d[9] = createTextVNode(" Product bought ")),
1039
- createVNode(E, { variant: "premium" })
1040
- ]),
1041
- createElementVNode("div", _hoisted_9$1, " Receive " + toDisplayString(unref(l)) + " by product bought ", 1),
1042
- unref(p) ? (openBlock(), createElementBlock("div", _hoisted_10$1, [
1043
- createElementVNode("div", _hoisted_11$1, [
1044
- createVNode(_sfc_main$f, {
1045
- "model-value": u.modelValue.property || [],
1046
- onConfirm: d[3] || (d[3] = (N) => a("update:model-value", {
1047
- ...e.modelValue,
1048
- property: N
1049
- }))
1050
- }, {
1051
- "side-sheet-button": withCtx(() => {
1052
- var N, F;
1053
- return [
1054
- createVNode(x, {
1055
- label: (N = u.modelValue.property) != null && N.length ? `${(F = u.modelValue.property) == null ? void 0 : F.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(f, {
1066
- inputmode: "decimal",
1067
- label: `Receive ${unref(l)}(s)`,
1068
- class: "flex-1",
1069
- "model-value": ((b = e.modelValue) == null ? void 0 : b.amount) ?? null,
1070
- "onUpdate:modelValue": d[4] || (d[4] = (N) => a("update:model-value", {
1071
- ...e.modelValue ?? { type: "FIXED" },
1072
- amount: N
1073
- }))
1074
- }, null, 8, ["label", "model-value"]),
1075
- d[10] || (d[10] = createElementVNode("div", { class: "xs:py-4 text-center" }, "for every", -1)),
1076
- createVNode(f, {
1077
- label: "Item purchased",
1078
- class: "flex-1",
1079
- "model-value": ((S = e.modelValue) == null ? void 0 : S.every) ?? null,
1080
- inputmode: "numeric",
1081
- "max-fraction-digits": 0,
1082
- "onUpdate:modelValue": d[5] || (d[5] = (N) => a("update:model-value", {
1083
- ...e.modelValue,
1084
- every: N
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: c }) {
1116
- const s = e, u = c, 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((i) => !i.hidden)
1131
- );
1132
- return (i, 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
- s.modelValue != n.value && u("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: c }) {
1171
- const { t: s } = useI18n(), a = ref(
1172
- e.modelValue ?? initCollectibleConfig("VOUCHER", {
1173
- business: useCoreStore().currentBusiness.value._id,
1174
- name: ""
1175
- })
1176
- ), i = FdtoCollectibleConfig, l = c;
1177
- return (o, n) => {
1178
- var y, g, V;
1179
- const p = resolveComponent("FmTextarea"), h = 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] = (d) => unref(a).name = d),
1184
- label: "Voucher name",
1185
- schema: unref(ZodHelper).typeAtPath(unref(i), "name", [unref(a).type])
1186
- }, null, 8, ["modelValue", "schema"]),
1187
- createVNode(p, {
1188
- class: "!mb-[-16px]",
1189
- modelValue: unref(a).description,
1190
- "onUpdate:modelValue": n[1] || (n[1] = (d) => unref(a).description = d),
1191
- rules: [unref(ZodHelper).ruleAtPath(unref(i), "description", [unref(a).type])]
1192
- }, {
1193
- label: withCtx(() => [
1194
- (openBlock(), createBlock(resolveDynamicComponent(
1195
- unref(ZodHelper).toInputLabel(
1196
- unref(ZodHelper).typeAtPath(unref(i), "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(((y = unref(a).description) == null ? void 0 : y.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 (d) => {
1213
- l("update:reward-image", d), d || (unref(a).image = null);
1214
- })
1215
- }, {
1216
- label: withCtx(() => [
1217
- (openBlock(), createBlock(resolveDynamicComponent(
1218
- unref(ZodHelper).toInputLabel(
1219
- unref(ZodHelper).typeAtPath(unref(i), "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] = (d) => unref(a).extras.effect = d)
1230
- }, null, 8, ["model-value"]),
1231
- unref(a).extras.effect == null ? (openBlock(), createBlock(h, {
1232
- key: 0,
1233
- class: "!mt-8",
1234
- text: unref(s)("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] = (d) => unref(a).options = d),
1242
- schema: unref(ZodHelper).typeAtPath(unref(i), "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": ((V = (g = unref(a).extras) == null ? void 0 : g.targetLocation) == null ? void 0 : V.map(String)) ?? null,
1248
- type: "select",
1249
- "onUpdate:modelValue": n[5] || (n[5] = (d) => {
1250
- unref(a).extras.targetLocation = d;
1251
- }),
1252
- rules: [unref(ZodHelper).ruleAtPath(unref(i), "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: c, emit: s }) {
1264
- const u = useMembershipStore(), { minor: a } = useLoading, i = ref(!1), l = ref(), o = ref(), n = ref(0), p = computed(() => {
1265
- var m;
1266
- return ((m = u.loyaltyRewards.items.find(
1267
- (f) => {
1268
- var v;
1269
- return f.value === ((v = l.value) == null ? void 0 : v.collectible);
1270
- }
1271
- )) == null ? void 0 : m.raw.type) === "CREDIT" ? FdoCreditLoyaltyReward : FdtoRandomReward;
1272
- }), h = computed(() => {
1273
- const d = p.value.safeParse(l.value);
1274
- return d.success ? [] : d.error.errors;
1275
- });
1276
- function y(d, m, f) {
1277
- d && (l.value = m, n.value = f), i.value = d;
1278
- }
1279
- const g = s;
1280
- async function V() {
1281
- const d = p.value.safeParse(l.value);
1282
- d.success && (await a(
1283
- async () => {
1284
- d.data.type === "VOUCHER" && o.value && (d.data.collectibleConfig.image = await firebaseStorage.update(
1285
- d.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
- ), g("update:model-value", d.data, n.value));
1294
- }
1295
- return c({
1296
- showSheet: y
1297
- }), (d, m) => {
1298
- const f = resolveComponent("FmSelect"), v = resolveComponent("FmStepperField"), E = resolveComponent("FmButton"), x = resolveComponent("FmSideSheet");
1299
- return openBlock(), createBlock(x, {
1300
- "max-width": 560,
1301
- modelValue: unref(i),
1302
- "onUpdate:modelValue": [
1303
- m[9] || (m[9] = (k) => isRef(i) ? i.value = k : null),
1304
- m[10] || (m[10] = (k) => i.value = k)
1305
- ],
1306
- header: "Edit reward",
1307
- "dismiss-away": ""
1308
- }, {
1309
- "side-sheet-footer": withCtx(() => [
1310
- createElementVNode("div", _hoisted_2$8, [
1311
- createVNode(E, {
1312
- variant: "primary",
1313
- type: "button",
1314
- disabled: unref(h).length > 0,
1315
- label: "Confirm",
1316
- onClick: m[7] || (m[7] = (k) => V())
1317
- }, null, 8, ["disabled"]),
1318
- createVNode(E, {
1319
- variant: "secondary",
1320
- type: "button",
1321
- label: "Cancel",
1322
- onClick: m[8] || (m[8] = (k) => i.value = !1)
1323
- })
1324
- ])
1325
- ]),
1326
- default: withCtx(() => {
1327
- var k, B, R;
1328
- return [
1329
- unref(l) ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
1330
- createVNode(f, {
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": m[0] || (m[0] = (C) => {
1339
- C == "NO_REWARD" ? l.value = {
1340
- type: "NO_REWARD",
1341
- collectible: null,
1342
- weight: 1
1343
- } : C === "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(u).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(f, {
1372
- key: 0,
1373
- label: "Loyalty type",
1374
- rules: [unref(ZodHelper).ruleAtPath(unref(p), "collectible", [unref(l).type])],
1375
- items: unref(u).loyaltyRewards.items,
1376
- "model-value": unref(l).collectible,
1377
- "onUpdate:modelValue": m[1] || (m[1] = (C) => unref(l).collectible = C)
1378
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1379
- createVNode(v, {
1380
- label: "Weight",
1381
- rules: [unref(ZodHelper).ruleAtPath(unref(p), "weight", [unref(l).type])],
1382
- "model-value": unref(l).weight,
1383
- "onUpdate:modelValue": m[2] || (m[2] = (C) => l.value = {
1384
- ...unref(l),
1385
- weight: C
1386
- })
1387
- }, null, 8, ["rules", "model-value"]),
1388
- unref(l).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
1389
- ((k = unref(u).loyaltyRewards.items.find(
1390
- (C) => {
1391
- var w;
1392
- return C.value === ((w = unref(l)) == null ? void 0 : w.collectible);
1393
- }
1394
- )) == null ? void 0 : k.raw.type) !== "TITLE" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
1395
- m[11] || (m[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(p), "earningOption", [unref(l).type])
1400
- ],
1401
- "helper-state": unref(ZodHelper).helperState(unref(h), "earningOption"),
1402
- "error-text": unref(ZodHelper).helperText(unref(h), "earningOption"),
1403
- "fixed-type": !0,
1404
- "model-value": unref(l).earningOption,
1405
- "onUpdate:modelValue": m[3] || (m[3] = (C) => l.value = {
1406
- ...unref(l),
1407
- earningOption: C
1408
- })
1409
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"])
1410
- ], 64)) : createCommentVNode("", !0),
1411
- m[12] || (m[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(u).loyaltyRewards.items.find(
1414
- (C) => {
1415
- var w;
1416
- return C.value === ((w = unref(l)) == null ? void 0 : w.collectible);
1417
- }
1418
- )) == null ? void 0 : B.raw.type) === "CREDIT",
1419
- class: "!gap-24",
1420
- rules: [unref(ZodHelper).ruleAtPath(unref(p), "validityOption", [unref(l).type])],
1421
- "model-value": unref(l).validityOption,
1422
- "onUpdate:modelValue": m[4] || (m[4] = (C) => l.value = {
1423
- ...unref(l),
1424
- validityOption: C
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": ((R = unref(l)) == null ? void 0 : R.collectibleConfig) ?? void 0,
1432
- "onUpdate:modelValue": m[5] || (m[5] = (C) => l.value = {
1433
- ...unref(l),
1434
- collectibleConfig: C
1435
- }),
1436
- "onUpdate:rewardImage": m[6] || (m[6] = (C) => o.value = C)
1437
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1438
- createVNode(JsonViewer, { json: unref(h) }, 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: c }) {
1466
- const s = e, u = c, a = useMembershipStore(), i = z.array(z.lazy(() => FdtoRandomReward)).min(1, "Requires at least 1 reward"), l = computed(() => s.modelValue ?? []), o = computed(() => {
1467
- const d = i.safeParse(l.value);
1468
- return d.success ? [] : d.error.errors;
1469
- }), n = ref();
1470
- function p(d, m) {
1471
- var v;
1472
- const f = [...l.value];
1473
- f[m] = d, (v = n.value) == null || v.showSheet(!1), u("update:model-value", f);
1474
- }
1475
- function h(d) {
1476
- const m = d.type == "VOUCHER" ? d.collectibleConfig : a.collectibles.find(
1477
- (E) => E._id.toString() == d.collectible
1478
- ), f = CollectionUtils.formattedType((m == null ? void 0 : m.name) || ""), v = d.weight;
1479
- return {
1480
- label: isNullOrEmpty(f) ? "NO REWARD" : f,
1481
- sublabel: `${v} (${(v / l.value.reduce((E, x) => E + x.weight, 0) * 100).toFixed(2)}%)`
1482
- };
1483
- }
1484
- function y(d) {
1485
- var f;
1486
- const m = [...l.value];
1487
- (f = n.value) == null || f.showSheet(!0, m[d], d);
1488
- }
1489
- function g(d) {
1490
- const m = [...l.value];
1491
- m.splice(d, 1), u("update:model-value", m);
1492
- }
1493
- function V() {
1494
- var d;
1495
- (d = n.value) == null || d.showSheet(
1496
- !0,
1497
- {
1498
- type: "NO_REWARD",
1499
- collectible: null,
1500
- weight: 1
1501
- },
1502
- l.value.length
1503
- );
1504
- }
1505
- return (d, m) => {
1506
- const f = resolveComponent("FmButton"), v = resolveComponent("FmCard"), E = resolveComponent("FmHelperText");
1507
- return openBlock(), createElementBlock("div", _hoisted_1$a, [
1508
- m[1] || (m[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(f, {
1510
- label: "Add Reward",
1511
- onClick: m[0] || (m[0] = (x) => V()),
1512
- variant: "plain",
1513
- icon: "add"
1514
- }),
1515
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l), (x, k) => (openBlock(), createBlock(v, {
1516
- key: k,
1517
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
1518
- variant: "outlined",
1519
- onClick: (B) => y(k)
1520
- }, {
1521
- default: withCtx(() => [
1522
- createElementVNode("div", null, [
1523
- createElementVNode("div", _hoisted_2$7, toDisplayString(h(x).label), 1),
1524
- createElementVNode("div", _hoisted_3$6, toDisplayString(h(x).sublabel), 1)
1525
- ]),
1526
- createVNode(f, {
1527
- icon: "delete",
1528
- variant: "tertiary",
1529
- onClick: (B) => (B.stopPropagation(), g(k))
1530
- }, null, 8, ["onClick"])
1531
- ]),
1532
- _: 2
1533
- }, 1032, ["onClick"]))), 128)),
1534
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o).filter((x) => x.path.join(".") == ""), (x) => (openBlock(), createBlock(E, {
1535
- key: x.message,
1536
- text: x.message,
1537
- state: "error"
1538
- }, null, 8, ["text"]))), 128)),
1539
- createVNode(_sfc_main$b, {
1540
- ref_key: "sheetRef",
1541
- ref: n,
1542
- "onUpdate:modelValue": p
1543
- }, null, 512)
1544
- ]);
1545
- };
1546
- }
1547
- }), _hoisted_1$9 = { class: "space-y-16" }, _hoisted_2$6 = {
1548
- key: 0,
1549
- class: "grid grid-cols-2 gap-16"
1550
- }, _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({
1551
- __name: "PromotionGameTypeInput",
1552
- props: {
1553
- modelValue: {
1554
- type: Object
1555
- }
1556
- },
1557
- emits: ["update:model-value"],
1558
- setup(e, { emit: c }) {
1559
- const s = e, u = c, a = computed(() => [
1560
- {
1561
- label: "Rock paper scissor",
1562
- description: "Customers play 3 rounds of Rock Paper Scissors against the cashier. If customer won 2 rounds, they will get a discount.",
1563
- value: F_GAME_TYPE.enum.ROCK_PAPER_SCISSORS
1564
- }
1565
- ]);
1566
- return (i, l) => {
1567
- var h, y, g;
1568
- const o = resolveComponent("FmSwitch"), n = resolveComponent("FmCard"), p = resolveComponent("FmHelperText");
1569
- return openBlock(), createElementBlock("div", _hoisted_1$9, [
1570
- createVNode(o, {
1571
- label: "Enable game",
1572
- "model-value": !!((h = e.modelValue) != null && h.gameType),
1573
- "onUpdate:modelValue": l[0] || (l[0] = (V) => V ? u("update:model-value", { gameType: "ROCK_PAPER_SCISSORS" }) : u("update:model-value", null))
1574
- }, null, 8, ["model-value"]),
1575
- ((y = e.modelValue) == null ? void 0 : y.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createElementBlock("div", _hoisted_2$6, [
1576
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (V) => {
1577
- var d, m;
1578
- return openBlock(), createBlock(n, {
1579
- variant: "outlined",
1580
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1581
- "col-span-2": unref(a).length == 1,
1582
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((d = e.modelValue) == null ? void 0 : d.gameType) == V.value,
1583
- "hover:bg-fm-color-opacity-sm": ((m = e.modelValue) == null ? void 0 : m.gameType) != V.value
1584
- }]),
1585
- onClick: () => {
1586
- var f;
1587
- ((f = s.modelValue) == null ? void 0 : f.gameType) != V.value && u("update:model-value", { gameType: V.value });
1588
- },
1589
- key: V.value
1590
- }, {
1591
- default: withCtx(() => [
1592
- createElementVNode("div", _hoisted_3$5, toDisplayString(V.label), 1),
1593
- createElementVNode("div", _hoisted_4$4, toDisplayString(V.description), 1)
1594
- ]),
1595
- _: 2
1596
- }, 1032, ["class", "onClick"]);
1597
- }), 128))
1598
- ])) : createCommentVNode("", !0),
1599
- ((g = e.modelValue) == null ? void 0 : g.gameType) == "ROCK_PAPER_SCISSORS" ? (openBlock(), createBlock(p, {
1600
- key: 1,
1601
- 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)",
1602
- state: "warning"
1603
- })) : createCommentVNode("", !0)
1604
- ]);
1605
- };
1606
- }
1607
- }), _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({
1608
- __name: "MissionTypeInput",
1609
- props: {
1610
- modelValue: {
1611
- type: String
1612
- }
1613
- },
1614
- emits: ["update:model-value"],
1615
- setup(e, { emit: c }) {
1616
- const s = e, u = c, a = computed(() => [
1617
- {
1618
- label: "Stamp",
1619
- description: "Award stamps for purchases, redeemable after reaching set milestones.",
1620
- value: F_MISSION_TYPE.enum.STAMP
1621
- },
1622
- {
1623
- label: "Progress",
1624
- description: "Reward customers when they reach a cumulative spending goal.",
1625
- value: F_MISSION_TYPE.enum.PROGRESSIVE
1626
- }
1627
- ]);
1628
- return (i, l) => {
1629
- const o = resolveComponent("FmCard");
1630
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
1631
- 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)),
1632
- createElementVNode("div", _hoisted_2$5, [
1633
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (n) => (openBlock(), createBlock(o, {
1634
- variant: "outlined",
1635
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
1636
- "col-span-2": unref(a).length == 1,
1637
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": e.modelValue == n.value,
1638
- "hover:bg-fm-color-opacity-sm": e.modelValue != n.value
1639
- }]),
1640
- onClick: () => {
1641
- s.modelValue != n.value && u("update:model-value", n.value);
1642
- },
1643
- key: n.value
1644
- }, {
1645
- default: withCtx(() => [
1646
- createElementVNode("div", _hoisted_3$4, toDisplayString(n.label), 1),
1647
- createElementVNode("div", _hoisted_4$3, toDisplayString(n.description), 1)
1648
- ]),
1649
- _: 2
1650
- }, 1032, ["class", "onClick"]))), 128))
1651
- ])
1652
- ]);
1653
- };
1654
- }
1655
- }), _hoisted_1$7 = { class: "space-y-16" }, _sfc_main$7 = /* @__PURE__ */ defineComponent({
1656
- __name: "MissionEndInput",
1657
- props: {
1658
- modelValue: {
1659
- type: [String, Number]
1660
- },
1661
- helperText: {
1662
- type: String
1663
- },
1664
- helperState: {
1665
- type: String
1666
- }
1667
- },
1668
- emits: ["update:model-value"],
1669
- setup(e, { emit: c }) {
1670
- const s = c;
1671
- return (u, a) => {
1672
- const i = resolveComponent("FmStepperField");
1673
- return openBlock(), createElementBlock("div", _hoisted_1$7, [
1674
- 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)),
1675
- createVNode(i, {
1676
- label: "Maximum to collect",
1677
- "model-value": e.modelValue || null,
1678
- "onUpdate:modelValue": a[0] || (a[0] = (l) => s("update:model-value", l)),
1679
- "helper-text": e.helperText || "Set the threshold required for reward eligibility",
1680
- "helper-state": e.helperState || "none"
1681
- }, null, 8, ["model-value", "helper-text", "helper-state"])
1682
- ]);
1683
- };
1684
- }
1685
- }), _hoisted_1$6 = { class: "flex gap-8 items-center justify-start" }, _sfc_main$6 = /* @__PURE__ */ defineComponent({
1686
- __name: "EditMissionPoolSheet",
1687
- props: {
1688
- maxThreshold: {
1689
- type: Number,
1690
- required: !0
1691
- }
1692
- },
1693
- emits: ["update:model-value"],
1694
- setup(e, { expose: c, emit: s }) {
1695
- const u = e, a = useMembershipStore(), { minor: i } = useLoading, l = ref(!1), o = ref(), n = ref(), p = ref(0), h = FdtoThresholdReward, y = computed(() => {
1696
- const f = h.safeParse(o.value);
1697
- return f.success ? [] : f.error.errors;
1698
- });
1699
- function g(f, v, E) {
1700
- f && (o.value = v, p.value = E), l.value = f;
1701
- }
1702
- const V = s;
1703
- async function d() {
1704
- console.log(o.value);
1705
- const f = h.safeParse(o.value);
1706
- f.success && (await i(
1707
- async () => {
1708
- f.data.type === "VOUCHER" && n.value && (f.data.collectibleConfig.image = await firebaseStorage.update(
1709
- f.data.collectibleConfig.image || firebaseStorage.collectibleImagePath(void 0, n.value),
1710
- n.value
1711
- ));
1712
- },
1713
- {
1714
- message: "Uploading reward image",
1715
- successMessage: "Reward image updated"
1716
- }
1717
- ), V("update:model-value", f.data, p.value));
1718
- }
1719
- const m = ref();
1720
- return c({
1721
- showSheet: g
1722
- }), (f, v) => {
1723
- const E = resolveComponent("FmStepperField"), x = resolveComponent("FmSelect"), k = resolveComponent("FmForm"), B = resolveComponent("FmButton"), R = resolveComponent("FmSideSheet");
1724
- return openBlock(), createBlock(R, {
1725
- "max-width": 560,
1726
- modelValue: unref(l),
1727
- "onUpdate:modelValue": [
1728
- v[10] || (v[10] = (C) => isRef(l) ? l.value = C : null),
1729
- v[11] || (v[11] = (C) => l.value = C)
1730
- ],
1731
- header: "Edit reward",
1732
- "dismiss-away": ""
1733
- }, {
1734
- "side-sheet-footer": withCtx(() => [
1735
- createElementVNode("div", _hoisted_1$6, [
1736
- createVNode(B, {
1737
- variant: "primary",
1738
- type: "button",
1739
- label: "Confirm",
1740
- onClick: v[8] || (v[8] = async () => {
1741
- var C;
1742
- return (C = unref(m)) == null ? void 0 : C.validateInputs();
1743
- })
1744
- }),
1745
- createVNode(B, {
1746
- variant: "secondary",
1747
- type: "button",
1748
- label: "Cancel",
1749
- onClick: v[9] || (v[9] = (C) => l.value = !1)
1750
- })
1751
- ])
1752
- ]),
1753
- default: withCtx(() => [
1754
- unref(o) ? (openBlock(), createBlock(k, {
1755
- key: 0,
1756
- class: "flex flex-col gap-y-24",
1757
- ref_key: "formRef",
1758
- ref: m,
1759
- onValidationSuccess: v[7] || (v[7] = (C) => d())
1760
- }, {
1761
- default: withCtx(() => {
1762
- var C, w;
1763
- return [
1764
- unref(o).type ? (openBlock(), createBlock(E, {
1765
- key: 0,
1766
- label: "Threshold",
1767
- rules: [
1768
- unref(ZodHelper).toRule(
1769
- unref(z).number().min(1).max(
1770
- u.maxThreshold,
1771
- `Number cannot be more than ${u.maxThreshold}`
1772
- )
1773
- )
1774
- ],
1775
- "model-value": unref(o).threshold,
1776
- "onUpdate:modelValue": v[0] || (v[0] = (b) => o.value = {
1777
- ...unref(o),
1778
- threshold: b
1779
- })
1780
- }, null, 8, ["rules", "model-value"])) : createCommentVNode("", !0),
1781
- createVNode(x, {
1782
- label: "Reward Type",
1783
- items: [
1784
- { label: "Voucher", value: "VOUCHER" },
1785
- { label: "Loyalty", value: "LOYALTY" }
1786
- ],
1787
- "model-value": unref(o).type,
1788
- "onUpdate:modelValue": v[1] || (v[1] = (b) => {
1789
- var S, N;
1790
- b === "VOUCHER" ? o.value = {
1791
- collectible: null,
1792
- type: "VOUCHER",
1793
- collectibleConfig: unref(initCollectibleConfig)("VOUCHER", {
1794
- business: unref(useCoreStore)().currentBusiness.value._id
1795
- }),
1796
- earningOption: {
1797
- amount: 1,
1798
- type: "FIXED"
1799
- },
1800
- validityOption: {
1801
- validForDay: 7
1802
- },
1803
- threshold: (S = unref(o)) == null ? void 0 : S.threshold
1804
- } : o.value = {
1805
- collectible: unref(a).loyaltyRewards.raw[0]._id,
1806
- type: "LOYALTY",
1807
- earningOption: {
1808
- amount: 1,
1809
- type: "FIXED"
1810
- },
1811
- validityOption: {
1812
- validForDay: 7
1813
- },
1814
- threshold: (N = unref(o)) == null ? void 0 : N.threshold
1815
- };
1816
- })
1817
- }, null, 8, ["model-value"]),
1818
- unref(o).type == "LOYALTY" ? (openBlock(), createBlock(x, {
1819
- key: 1,
1820
- label: "Loyalty type",
1821
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "collectible", [unref(o).type])],
1822
- items: unref(a).loyaltyRewards.items,
1823
- "model-value": unref(o).collectible,
1824
- "onUpdate:modelValue": v[2] || (v[2] = (b) => unref(o).collectible = b)
1825
- }, null, 8, ["rules", "items", "model-value"])) : createCommentVNode("", !0),
1826
- unref(o).type === "LOYALTY" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
1827
- v[12] || (v[12] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
1828
- createVNode(_sfc_main$e, {
1829
- class: "mt-[-8px]",
1830
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "earningOption", [unref(o).type])],
1831
- "helper-state": unref(ZodHelper).helperState(unref(y), "earningOption"),
1832
- "error-text": unref(ZodHelper).helperText(unref(y), "earningOption"),
1833
- "fixed-type": !0,
1834
- "model-value": unref(o).earningOption,
1835
- "onUpdate:modelValue": v[3] || (v[3] = (b) => o.value = {
1836
- ...unref(o),
1837
- earningOption: b
1838
- })
1839
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"]),
1840
- createVNode(_sfc_main$z, {
1841
- class: "!gap-24",
1842
- "for-credit": unref(o).type === "LOYALTY" && ((C = unref(a).loyaltyRewards.items.find(
1843
- (b) => {
1844
- var S;
1845
- return b.value === ((S = unref(o)) == null ? void 0 : S.collectible);
1846
- }
1847
- )) == null ? void 0 : C.raw.type) === "CREDIT",
1848
- rules: [unref(ZodHelper).ruleAtPath(unref(h), "validityOption", [unref(o).type])],
1849
- "model-value": unref(o).validityOption,
1850
- "onUpdate:modelValue": v[4] || (v[4] = (b) => o.value = {
1851
- ...unref(o),
1852
- validityOption: b
1853
- })
1854
- }, null, 8, ["for-credit", "rules", "model-value"])
1855
- ], 64)) : createCommentVNode("", !0),
1856
- unref(o).type === "VOUCHER" ? (openBlock(), createBlock(_sfc_main$c, {
1857
- key: 3,
1858
- "reward-image": unref(n),
1859
- "model-value": ((w = unref(o)) == null ? void 0 : w.collectibleConfig) ?? void 0,
1860
- "onUpdate:modelValue": v[5] || (v[5] = (b) => o.value = {
1861
- ...unref(o),
1862
- collectibleConfig: b
1863
- }),
1864
- "onUpdate:rewardImage": v[6] || (v[6] = (b) => n.value = b)
1865
- }, null, 8, ["reward-image", "model-value"])) : createCommentVNode("", !0),
1866
- createVNode(JsonViewer, { json: unref(y) }, null, 8, ["json"])
1867
- ];
1868
- }),
1869
- _: 1
1870
- }, 512)) : createCommentVNode("", !0)
1871
- ]),
1872
- _: 1
1873
- }, 8, ["modelValue"]);
1874
- };
1875
- }
1876
- }), _hoisted_1$5 = {
1877
- key: 0,
1878
- class: "grid grid-cols-5 text-center gap-8 justify-between items-center w-full"
1879
- }, _hoisted_2$4 = { class: "flex flex-col gap-0 items-center justify-center" }, _sfc_main$5 = /* @__PURE__ */ defineComponent({
1880
- __name: "MissionProgress",
1881
- props: {
1882
- type: {
1883
- type: String,
1884
- required: !0
1885
- },
1886
- maxRange: {
1887
- type: Number,
1888
- required: !0
1889
- },
1890
- currentRange: {
1891
- type: Number,
1892
- default: 0
1893
- },
1894
- markers: {
1895
- type: Array,
1896
- default: () => []
1897
- }
1898
- },
1899
- setup(e) {
1900
- const c = e, { maxRange: s, currentRange: u, markers: a } = toRefs(c), i = computed(
1901
- () => Math.min(u.value / s.value * 100, 100)
1902
- ), l = (o) => o / s.value * 100;
1903
- return (o, n) => {
1904
- const p = resolveComponent("FmIcon");
1905
- return e.type === "STAMP" ? (openBlock(), createElementBlock("div", _hoisted_1$5, [
1906
- (openBlock(!0), createElementBlock(Fragment, null, renderList(Math.min(unref(s), 40), (h) => (openBlock(), createBlock(p, {
1907
- class: normalizeClass(
1908
- unref(u) >= h ? "text-fm-color-primary" : "text-fm-color-neutral-gray-200"
1909
- ),
1910
- outline: unref(u) < h,
1911
- key: h,
1912
- name: unref(a).some((y) => y === h) ? "featured_seasonal_and_gifts" : "check_circle"
1913
- }, null, 8, ["class", "outline", "name"]))), 128))
1914
- ])) : (openBlock(), createElementBlock("div", {
1915
- key: 1,
1916
- class: normalizeClass(["relative w-full h-4 rounded-lg", "bg-fm-color-system-warning-100"])
1917
- }, [
1918
- createElementVNode("div", {
1919
- class: normalizeClass(["bg-fm-color-primary", "absolute top-0 left-0 h-full rounded-lg"]),
1920
- style: normalizeStyle({ width: unref(i) + "%" })
1921
- }, null, 4),
1922
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (h, y) => (openBlock(), createElementBlock("div", {
1923
- key: y,
1924
- class: "absolute -top-1.5 flex flex-col items-center -translate-x-1/2",
1925
- style: normalizeStyle({ left: l(h) + "%" })
1926
- }, [
1927
- createElementVNode("div", _hoisted_2$4, [
1928
- createElementVNode("div", {
1929
- class: normalizeClass(["h-16 w-[2px]", "bg-fm-color-system-warning-300"])
1930
- }),
1931
- n[0] || (n[0] = createElementVNode("div", null, "🎁", -1))
1932
- ])
1933
- ], 4))), 128))
1934
- ]));
1935
- };
1936
- }
1937
- }), isObject = (e) => e !== null && typeof e == "object";
1938
- function changeKeysFactory(e) {
1939
- return function c(s, u = 1, a) {
1940
- if (u === 0 || !isObject(s))
1941
- return s;
1942
- if (Array.isArray(s))
1943
- return s.map((l) => c(l, u - 1, a));
1944
- const i = Object.create(Object.getPrototypeOf(s));
1945
- return Object.keys(s).forEach((l) => {
1946
- const o = s[l], n = e(l, a), p = c(o, u - 1, a);
1947
- i[n] = p;
1948
- }), i;
1949
- };
1950
- }
1951
- 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({
1952
- __name: "MissionPoolInput",
1953
- props: {
1954
- modelValue: {
1955
- type: Array,
1956
- default: () => []
1957
- },
1958
- mission: {
1959
- type: Object,
1960
- required: !0
1961
- }
1962
- },
1963
- emits: ["update:model-value"],
1964
- setup(e, { emit: c }) {
1965
- const s = e, u = c, a = useMembershipStore(), i = z.array(z.lazy(() => FdtoThresholdReward)).min(1, "Requires at least 1 reward"), l = computed(
1966
- () => s.modelValue.sort((m, f) => m.threshold - f.threshold) ?? []
1967
- ), o = computed(() => {
1968
- const m = i.safeParse(l.value);
1969
- return m.success ? [] : m.error.errors;
1970
- }), n = ref();
1971
- function p(m, f) {
1972
- var E;
1973
- const v = [...l.value];
1974
- v[f] = m, (E = n.value) == null || E.showSheet(!1), u("update:model-value", v);
1975
- }
1976
- function h(m) {
1977
- const f = m.type == "VOUCHER" ? m.collectibleConfig : a.collectibles.find(
1978
- (E) => E._id.toString() == m.collectible
1979
- ), v = CollectionUtils.formattedType((f == null ? void 0 : f.name) || "");
1980
- return {
1981
- label: isNullOrEmpty(v) ? "NO REWARD" : v,
1982
- sublabel: `Reward at ${m.threshold} | Amount: ${m.earningOption.type == "FIXED" ? m.earningOption.amount : `${m.earningOption.amount} for every RM${m.earningOption.every} spent`} `
1983
- };
1984
- }
1985
- function y(m) {
1986
- var v;
1987
- const f = [...l.value];
1988
- (v = n.value) == null || v.showSheet(!0, f[m], m);
1989
- }
1990
- function g(m) {
1991
- const f = [...l.value];
1992
- f.splice(m, 1), u("update:model-value", f);
1993
- }
1994
- function V() {
1995
- var m;
1996
- (m = n.value) == null || m.showSheet(
1997
- !0,
1998
- {
1999
- type: "LOYALTY",
2000
- collectible: a.loyaltyRewards.items[0].value,
2001
- threshold: null,
2002
- validityOption: {
2003
- validForDay: 7
2004
- },
2005
- earningOption: {
2006
- type: "FIXED",
2007
- amount: 1
2008
- }
2009
- },
2010
- l.value.length
2011
- );
2012
- }
2013
- function d(m) {
2014
- var f, v;
2015
- return m.type == "VOUCHER" ? (f = m.collectibleConfig) == null ? void 0 : f.name : sentenceCase(
2016
- ((v = a.loyaltyRewards.items.find(
2017
- (E) => E.value == m.collectible
2018
- )) == null ? void 0 : v.label) || ""
2019
- );
2020
- }
2021
- return (m, f) => {
2022
- const v = resolveComponent("FmButton"), E = resolveComponent("FmCard"), x = resolveComponent("FmHelperText");
2023
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
2024
- f[2] || (f[2] = createElementVNode("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " Configure the reward type given to your customer. ", -1)),
2025
- createVNode(v, {
2026
- label: "Add Reward",
2027
- onClick: f[0] || (f[0] = (k) => V()),
2028
- variant: "plain",
2029
- icon: "add"
2030
- }),
2031
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(l), (k, B) => (openBlock(), createBlock(E, {
2032
- key: B,
2033
- class: "px-16 py-12 flex items-center justify-between cursor-pointer",
2034
- variant: "outlined",
2035
- onClick: (R) => y(B)
2036
- }, {
2037
- default: withCtx(() => [
2038
- createElementVNode("div", null, [
2039
- createElementVNode("div", _hoisted_2$3, toDisplayString(h(k).label), 1),
2040
- createElementVNode("div", _hoisted_3$3, toDisplayString(h(k).sublabel), 1)
2041
- ]),
2042
- createVNode(v, {
2043
- icon: "delete",
2044
- variant: "tertiary",
2045
- onClick: (R) => (R.stopPropagation(), g(B))
2046
- }, null, 8, ["onClick"])
2047
- ]),
2048
- _: 2
2049
- }, 1032, ["onClick"]))), 128)),
2050
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(o).filter((k) => k.path.join(".") == ""), (k) => (openBlock(), createBlock(x, {
2051
- key: k.message,
2052
- text: k.message,
2053
- state: "error"
2054
- }, null, 8, ["text"]))), 128)),
2055
- f[3] || (f[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Preview", -1)),
2056
- (openBlock(), createBlock(E, {
2057
- key: 0,
2058
- variant: "outlined",
2059
- class: "p-24 space-y-16 w-fit"
2060
- }, {
2061
- default: withCtx(() => {
2062
- var k, B;
2063
- return [
2064
- createElementVNode("div", _hoisted_4$2, [
2065
- createElementVNode("div", null, [
2066
- createElementVNode("div", _hoisted_5$2, " Collect " + toDisplayString(e.mission.end) + " stamps to get " + toDisplayString(((k = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : k.earningOption.amount) > 1 ? (B = e.modelValue[e.modelValue.length - 1]) == null ? void 0 : B.earningOption.amount : "") + " " + toDisplayString(e.modelValue[e.modelValue.length - 1] ? d(e.modelValue[e.modelValue.length - 1]) : ""), 1),
2067
- f[1] || (f[1] = createElementVNode("div", { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, " Earn a stamp! ", -1))
2068
- ])
2069
- ]),
2070
- createElementVNode("div", _hoisted_6$2, [
2071
- createVNode(_sfc_main$5, {
2072
- type: e.mission.type,
2073
- "max-range": e.mission.end,
2074
- currentRange: e.mission.end / 4,
2075
- markers: e.modelValue.map((R) => R.threshold)
2076
- }, null, 8, ["type", "max-range", "currentRange", "markers"]),
2077
- e.mission.type == "PROGRESSIVE" ? (openBlock(), createElementBlock("div", _hoisted_7$1, " 0/" + toDisplayString(e.mission.end.toLocaleString()), 1)) : createCommentVNode("", !0)
2078
- ])
2079
- ];
2080
- }),
2081
- _: 1
2082
- })),
2083
- createVNode(_sfc_main$6, {
2084
- ref_key: "sheetRef",
2085
- ref: n,
2086
- "onUpdate:modelValue": p,
2087
- "max-threshold": e.mission.end
2088
- }, null, 8, ["max-threshold"])
2089
- ]);
2090
- };
2091
- }
2092
- }), _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({
2093
- __name: "MissionInput",
2094
- props: {
2095
- modelValue: Object
2096
- },
2097
- emits: ["update:model-value"],
2098
- setup(e, { emit: c }) {
2099
- const s = e, u = computed(() => {
2100
- const l = FdoMission.safeParse(s.modelValue);
2101
- return l.success ? [] : l.error.errors;
2102
- }), a = computed(() => [
2103
- {
2104
- label: "Stamp",
2105
- description: "Award stamps for purchases, redeemable after reaching set milestones.",
2106
- value: F_MISSION_TYPE.enum.STAMP
2107
- },
2108
- {
2109
- label: "Progress",
2110
- description: "Reward customers when they reach a cumulative spending goal.",
2111
- value: F_MISSION_TYPE.enum.PROGRESSIVE
2112
- }
2113
- ]), i = c;
2114
- return (l, o) => {
2115
- var h;
2116
- const n = resolveComponent("FmCard"), p = resolveComponent("FmStepperField");
2117
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
2118
- createElementVNode("div", _hoisted_2$2, [
2119
- o[1] || (o[1] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Mission Type", -1)),
2120
- 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)),
2121
- createElementVNode("div", _hoisted_3$2, [
2122
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(a), (y) => {
2123
- var g, V;
2124
- return openBlock(), createBlock(n, {
2125
- variant: "outlined",
2126
- class: normalizeClass(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3", {
2127
- "col-span-2": unref(a).length == 1,
2128
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": ((g = e.modelValue) == null ? void 0 : g.type) == y.value,
2129
- "hover:bg-fm-color-opacity-sm": ((V = e.modelValue) == null ? void 0 : V.type) != y.value
2130
- }]),
2131
- onClick: () => {
2132
- var d, m;
2133
- ((d = e.modelValue) == null ? void 0 : d.type) != y.value && i("update:model-value", {
2134
- ...e.modelValue,
2135
- type: y.value,
2136
- end: ((m = e.modelValue) == null ? void 0 : m.end) || 1
2137
- });
2138
- },
2139
- key: y.value
2140
- }, {
2141
- default: withCtx(() => [
2142
- createElementVNode("div", _hoisted_4$1, toDisplayString(y.label), 1),
2143
- createElementVNode("div", _hoisted_5$1, toDisplayString(y.description), 1)
2144
- ]),
2145
- _: 2
2146
- }, 1032, ["class", "onClick"]);
2147
- }), 128))
2148
- ])
2149
- ]),
2150
- createElementVNode("div", _hoisted_6$1, [
2151
- o[3] || (o[3] = createElementVNode("div", { class: "fm-typo-en-title-sm-800" }, "Collections required", -1)),
2152
- 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)),
2153
- createVNode(p, {
2154
- label: "Maximum to collect",
2155
- "model-value": ((h = e.modelValue) == null ? void 0 : h.end) || null,
2156
- "onUpdate:modelValue": o[0] || (o[0] = (y) => {
2157
- var g;
2158
- return i("update:model-value", {
2159
- ...e.modelValue,
2160
- type: ((g = e.modelValue) == null ? void 0 : g.type) || "STAMP",
2161
- end: y
2162
- });
2163
- }),
2164
- "helper-text": unref(ZodHelper).helperText(unref(u), "end") || "Set the threshold required for reward eligibility",
2165
- "helper-state": unref(ZodHelper).helperState(unref(u), "end") || "none"
2166
- }, null, 8, ["model-value", "helper-text", "helper-state"])
2167
- ])
2168
- ]);
2169
- };
2170
- }
2171
- }), _hoisted_1$2 = { key: 26 }, _sfc_main$2 = /* @__PURE__ */ defineComponent({
2172
- __name: "TemplateInput",
2173
- props: {
2174
- field: { type: Object, required: !0 },
2175
- modelValue: {
2176
- type: Object
2177
- },
2178
- schema: {
2179
- type: Object
2180
- },
2181
- extras: {
2182
- type: Object
2183
- },
2184
- helperText: {
2185
- type: String
2186
- },
2187
- disabled: {
2188
- type: Boolean,
2189
- default: !1
2190
- }
2191
- },
2192
- emits: ["update:model-value", "update:file"],
2193
- setup(e, { emit: c }) {
2194
- const { t: s } = useI18n(), u = e, a = c;
2195
- function i(p) {
2196
- switch (u.field.type) {
2197
- case "timeframe":
2198
- const h = p.startDate ? hooks(p.startDate).startOf("day").toISOString() : void 0, y = p.endDate ? hooks(p.endDate).endOf("day").toISOString() : void 0;
2199
- a("update:model-value", {
2200
- type: "timeframe",
2201
- property: "__now",
2202
- start: h,
2203
- end: y
2204
- });
2205
- break;
2206
- case "image": {
2207
- a(
2208
- "update:file",
2209
- p,
2210
- l.value || firebaseStorage.collectibleImagePath(void 0, p)
2211
- );
2212
- break;
2213
- }
2214
- default:
2215
- a("update:model-value", p);
2216
- break;
2217
- }
2218
- }
2219
- const l = computed(() => {
2220
- switch (u.field.type) {
2221
- case "timeframe": {
2222
- const p = u.modelValue;
2223
- return {
2224
- startDate: p != null && p.start ? hooks(p == null ? void 0 : p.start).format("YYYY-MM-DD") : null,
2225
- endDate: p != null && p.end ? hooks(p == null ? void 0 : p.end).format("YYYY-MM-DD") : null
2226
- };
2227
- }
2228
- default:
2229
- return u.modelValue;
2230
- }
2231
- });
2232
- function o() {
2233
- if (!n.value.schema) return [];
2234
- const p = n.value.schema.safeParse(u.modelValue);
2235
- return p.success ? [] : p.error.errors;
2236
- }
2237
- const n = computed(() => ({
2238
- schema: u.schema,
2239
- unwrapped: u.schema ? ZodHelper.unwrap(u.schema) : void 0,
2240
- rules: u.schema ? [ZodHelper.ruleAtPath(u.schema, "")] : void 0,
2241
- labelMark: u.schema && ZodHelper.isRequired(u.schema) == !1 ? "optional" : void 0,
2242
- zodLabel: u.schema ? ZodHelper.toInputLabel(u.schema, u.field.label) : void 0
2243
- }));
2244
- return (p, h) => {
2245
- var f, v, E, x, k;
2246
- const y = resolveComponent("FmTextField"), g = resolveComponent("FmStepperField"), V = resolveComponent("FmTextarea"), d = resolveComponent("FmHelperText"), m = resolveComponent("FmSwitch");
2247
- return e.field.type === "text" ? (openBlock(), createBlock(y, {
2248
- key: 0,
2249
- label: unref(s)(e.field.label),
2250
- "label-mark": unref(n).labelMark,
2251
- rules: unref(n).rules,
2252
- "model-value": unref(l),
2253
- "onUpdate:modelValue": i,
2254
- "helper-state": e.helperText ? "error" : void 0,
2255
- "helper-text": e.helperText
2256
- }, null, 8, ["label", "label-mark", "rules", "model-value", "helper-state", "helper-text"])) : e.field.type === "number" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2257
- createVNode(JsonViewer, {
2258
- json: { schema: unref(n).unwrapped, props: u }
2259
- }, null, 8, ["json"]),
2260
- createVNode(g, {
2261
- label: unref(s)(e.field.label),
2262
- "label-mark": e.field.isRuleChildren ? void 0 : unref(n).labelMark,
2263
- "model-value": unref(l),
2264
- rules: e.field.isRuleChildren ? [] : unref(n).rules,
2265
- "onUpdate:modelValue": i,
2266
- "helper-state": e.field.isRuleChildren && e.helperText ? "error" : void 0,
2267
- "helper-text": e.field.isRuleChildren ? e.helperText : void 0
2268
- }, null, 8, ["label", "label-mark", "model-value", "rules", "helper-state", "helper-text"])
2269
- ], 64)) : e.field.type === "textarea" ? (openBlock(), createBlock(V, {
2270
- key: 2,
2271
- label: unref(s)(e.field.label),
2272
- "label-mark": unref(n).labelMark,
2273
- rules: unref(n).rules,
2274
- "model-value": unref(l),
2275
- "onUpdate:modelValue": i,
2276
- "show-word-count": "",
2277
- "max-length": (k = (x = (E = (v = (f = unref(n)) == null ? void 0 : f.unwrapped) == null ? void 0 : v._def) == null ? void 0 : E.checks) == null ? void 0 : x.find((B) => B.kind == "max")) == null ? void 0 : k.value
2278
- }, null, 8, ["label", "label-mark", "rules", "model-value", "max-length"])) : e.field.type === "trigger" ? (openBlock(), createBlock(_sfc_main$j, {
2279
- key: 3,
2280
- "campaign-type": e.extras,
2281
- "model-value": unref(l),
2282
- disabled: e.disabled,
2283
- "onUpdate:modelValue": i
2284
- }, null, 8, ["campaign-type", "model-value", "disabled"])) : e.field.type === "timeframe" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
2285
- createVNode(_sfc_main$h, {
2286
- "model-value": unref(l),
2287
- "onUpdate:modelValue": i
2288
- }, null, 8, ["model-value"]),
2289
- createVNode(d, {
2290
- class: "!mt-[8px]",
2291
- text: unref(ZodHelper).helperText(o(), ""),
2292
- state: unref(ZodHelper).helperState(o(), "")
2293
- }, null, 8, ["text", "state"])
2294
- ], 64)) : e.field.type === "image" ? (openBlock(), createBlock(_sfc_main$v, {
2295
- key: 5,
2296
- thumbnail: unref(l),
2297
- "aspect-ratio": "16 / 9",
2298
- class: "w-1/2 xs:w-2/3",
2299
- "onUpdate:file": i
2300
- }, {
2301
- label: withCtx(() => [
2302
- (openBlock(), createBlock(resolveDynamicComponent(unref(n).zodLabel)))
2303
- ]),
2304
- _: 1
2305
- }, 8, ["thumbnail"])) : e.field.type === "switch" ? (openBlock(), createBlock(m, {
2306
- key: 6,
2307
- label: unref(s)(e.field.label),
2308
- "label-placement": "right",
2309
- sublabel: e.field.property == "campaign.notify" ? "Notify customer when customer receives the reward" : void 0,
2310
- "label-mark": unref(n).labelMark,
2311
- rules: unref(n).rules,
2312
- "model-value": unref(l),
2313
- "onUpdate:modelValue": i
2314
- }, null, 8, ["label", "sublabel", "label-mark", "rules", "model-value"])) : e.field.type === "collectible_options" ? (openBlock(), createBlock(_sfc_main$x, {
2315
- key: 7,
2316
- "model-value": unref(l),
2317
- "onUpdate:modelValue": i,
2318
- "no-campaign": !1,
2319
- schema: unref(n).schema,
2320
- "is-mission": e.extras === "MISSION"
2321
- }, null, 8, ["model-value", "schema", "is-mission"])) : e.field.type === "target_location" ? (openBlock(), createBlock(_sfc_main$y, {
2322
- key: 8,
2323
- "model-value": unref(l),
2324
- "onUpdate:modelValue": i
2325
- }, null, 8, ["model-value"])) : e.field.type == "effect" ? (openBlock(), createElementBlock(Fragment, { key: 9 }, [
2326
- createVNode(_sfc_main$w, {
2327
- "model-value": unref(l),
2328
- "onUpdate:modelValue": i,
2329
- "can-set-auto-apply": e.field.property == "campaign.effect"
2330
- }, null, 8, ["model-value", "can-set-auto-apply"]),
2331
- unref(l) ? createCommentVNode("", !0) : (openBlock(), createBlock(d, {
2332
- key: 0,
2333
- class: "!mt-[8px]",
2334
- text: unref(s)("connect.campaign.common.effect_required"),
2335
- state: "error"
2336
- }, null, 8, ["text"]))
2337
- ], 64)) : e.field.type === "message" ? (openBlock(), createBlock(_sfc_main$A, {
2338
- key: 10,
2339
- "allow-email": !0,
2340
- "model-value": unref(l),
2341
- "onUpdate:modelValue": i,
2342
- "helper-text": unref(ZodHelper).helperText(o(), ""),
2343
- "trigger-type": e.field.extras,
2344
- "helper-state": unref(ZodHelper).helperState(o(), "")
2345
- }, null, 8, ["model-value", "helper-text", "trigger-type", "helper-state"])) : e.field.type === "earning_option" ? (openBlock(), createBlock(_sfc_main$e, {
2346
- key: 11,
2347
- "model-value": unref(l),
2348
- "onUpdate:modelValue": i,
2349
- extras: e.extras,
2350
- "error-text": e.helperText
2351
- }, null, 8, ["model-value", "extras", "error-text"])) : e.field.type === "validity_option" ? (openBlock(), createBlock(_sfc_main$z, {
2352
- key: 12,
2353
- type: "custom",
2354
- "model-value": unref(l),
2355
- "onUpdate:modelValue": i,
2356
- "helper-text": e.helperText || unref(ZodHelper).helperText(o(), "")
2357
- }, null, 8, ["model-value", "helper-text"])) : e.field.type === "game_type" ? (openBlock(), createBlock(_sfc_main$d, {
2358
- key: 13,
2359
- "model-value": unref(l),
2360
- "onUpdate:modelValue": i
2361
- }, null, 8, ["model-value"])) : e.field.type === "reward_pool" ? (openBlock(), createBlock(_sfc_main$a, {
2362
- key: 14,
2363
- "model-value": unref(l),
2364
- "onUpdate:modelValue": i
2365
- }, null, 8, ["model-value"])) : e.field.type === "mission" ? (openBlock(), createBlock(_sfc_main$3, {
2366
- key: 15,
2367
- "model-value": unref(l),
2368
- "onUpdate:modelValue": i
2369
- }, null, 8, ["model-value"])) : e.field.type === "mission_type" ? (openBlock(), createBlock(_sfc_main$8, {
2370
- key: 16,
2371
- "model-value": unref(l),
2372
- "onUpdate:modelValue": i
2373
- }, null, 8, ["model-value"])) : e.field.type === "mission_end" ? (openBlock(), createBlock(_sfc_main$7, {
2374
- key: 17,
2375
- "model-value": unref(l),
2376
- "onUpdate:modelValue": i,
2377
- "helper-text": unref(ZodHelper).helperText(o(), ""),
2378
- "helper-state": unref(ZodHelper).helperState(o(), "")
2379
- }, null, 8, ["model-value", "helper-text", "helper-state"])) : e.field.type === "mission_pool" ? (openBlock(), createBlock(_sfc_main$4, {
2380
- key: 18,
2381
- "model-value": unref(l),
2382
- "onUpdate:modelValue": i,
2383
- mission: e.extras.mission
2384
- }, null, 8, ["model-value", "mission"])) : e.field.type === "rule_schedule" ? (openBlock(), createElementBlock(Fragment, { key: 19 }, [
2385
- createVNode(_sfc_main$g, {
2386
- "model-value": unref(l),
2387
- "onUpdate:modelValue": i,
2388
- "start-date": e.extras.start,
2389
- "end-date": e.extras.end
2390
- }, null, 8, ["model-value", "start-date", "end-date"]),
2391
- e.helperText ? (openBlock(), createBlock(d, {
2392
- key: 0,
2393
- class: "!mt-[8px]",
2394
- text: e.helperText,
2395
- state: "error"
2396
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2397
- ], 64)) : e.field.type === "rule_user" ? (openBlock(), createElementBlock(Fragment, { key: 20 }, [
2398
- createVNode(_sfc_main$o, {
2399
- "model-value": unref(l),
2400
- "onUpdate:modelValue": i
2401
- }, null, 8, ["model-value"]),
2402
- e.helperText ? (openBlock(), createBlock(d, {
2403
- key: 0,
2404
- class: "!mt-[8px]",
2405
- text: e.helperText,
2406
- state: "error"
2407
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2408
- ], 64)) : e.field.type === "rule_time" ? (openBlock(), createElementBlock(Fragment, { key: 21 }, [
2409
- e.extras == "PROMOTION" && unref(RuleBuilder).getRules(unref(l).rules.g_time).length > 0 ? (openBlock(), createBlock(d, {
2410
- key: 0,
2411
- state: "warning",
2412
- text: `Time based rule only work for POS >= v${unref(featureVersionMapping).TIME_BASED_PROMOTION}`
2413
- }, null, 8, ["text"])) : createCommentVNode("", !0),
2414
- createVNode(_sfc_main$n, {
2415
- "model-value": unref(l),
2416
- "onUpdate:modelValue": i
2417
- }, null, 8, ["model-value"]),
2418
- e.helperText ? (openBlock(), createBlock(d, {
2419
- key: 1,
2420
- class: "!mt-[8px]",
2421
- text: e.helperText,
2422
- state: "error"
2423
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2424
- ], 64)) : e.field.type === "rule_bill" ? (openBlock(), createElementBlock(Fragment, { key: 22 }, [
2425
- createVNode(_sfc_main$m, {
2426
- "model-value": unref(l),
2427
- "onUpdate:modelValue": i
2428
- }, null, 8, ["model-value"]),
2429
- e.helperText ? (openBlock(), createBlock(d, {
2430
- key: 0,
2431
- class: "!mt-[8px]",
2432
- text: e.helperText,
2433
- state: "error"
2434
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2435
- ], 64)) : e.field.type === "rule_feedback" ? (openBlock(), createElementBlock(Fragment, { key: 23 }, [
2436
- createVNode(_sfc_main$k, {
2437
- "model-value": unref(l),
2438
- "onUpdate:modelValue": i
2439
- }, null, 8, ["model-value"]),
2440
- e.helperText ? (openBlock(), createBlock(d, {
2441
- key: 0,
2442
- class: "!mt-[8px]",
2443
- text: e.helperText,
2444
- state: "error"
2445
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2446
- ], 64)) : e.field.type === "rule_birthday" ? (openBlock(), createElementBlock(Fragment, { key: 24 }, [
2447
- createVNode(_sfc_main$l, {
2448
- "model-value": unref(l),
2449
- "onUpdate:modelValue": i
2450
- }, null, 8, ["model-value"]),
2451
- e.helperText ? (openBlock(), createBlock(d, {
2452
- key: 0,
2453
- class: "!mt-[8px]",
2454
- text: e.helperText,
2455
- state: "error"
2456
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2457
- ], 64)) : e.field.type === "promotion_game_type" ? (openBlock(), createElementBlock(Fragment, { key: 25 }, [
2458
- createVNode(_sfc_main$9, {
2459
- "model-value": unref(l),
2460
- "onUpdate:modelValue": i
2461
- }, null, 8, ["model-value"]),
2462
- e.helperText ? (openBlock(), createBlock(d, {
2463
- key: 0,
2464
- class: "!mt-[8px]",
2465
- text: e.helperText,
2466
- state: "error"
2467
- }, null, 8, ["text"])) : createCommentVNode("", !0)
2468
- ], 64)) : (openBlock(), createElementBlock("pre", _hoisted_1$2, toDisplayString(u.field), 1));
2469
- };
2470
- }
2471
- }), _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({
2472
- __name: "CampaignSummary",
2473
- props: {
2474
- data: {
2475
- type: Object,
2476
- required: !0
2477
- }
2478
- },
2479
- setup(e) {
2480
- const { t: c, te: s } = useI18n();
2481
- return (u, a) => {
2482
- const i = resolveComponent("FmCard");
2483
- return openBlock(), createBlock(i, {
2484
- variant: "outlined",
2485
- class: "p-16 space-y-8"
2486
- }, {
2487
- default: withCtx(() => [
2488
- createElementVNode("div", _hoisted_1$1, toDisplayString(unref(c)("connect.campaign.common.summary")), 1),
2489
- a[0] || (a[0] = createElementVNode("div", { class: "h-[1px] bg-fm-color-neutral-gray-100 w-full" }, null, -1)),
2490
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(getCampaignSummaryObject)(e.data), (l, o) => (openBlock(), createElementBlock("div", {
2491
- class: "space-y-4",
2492
- key: o
2493
- }, [
2494
- l ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2495
- createElementVNode("div", _hoisted_2$1, toDisplayString(unref(c)(`${o}`)), 1),
2496
- createElementVNode("div", _hoisted_3$1, toDisplayString(unref(s)(`${l}`) ? unref(c)(`${l}`) : l), 1)
2497
- ], 64)) : createCommentVNode("", !0)
2498
- ]))), 128))
2499
- ]),
2500
- _: 1
2501
- });
2502
- };
2503
- }
2504
- }), _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 = {
2505
- key: 0,
2506
- class: "max-w-6xl mx-auto"
2507
- }, _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({
2508
- __name: "EditCampaignSheet",
2509
- emits: ["submit:model-value"],
2510
- setup(__props, { expose: __expose, emit: __emit }) {
2511
- const Dialog = useDialog(), sheetVisible = ref(!1), { t } = useI18n(), currentStep = ref(1), data = ref(), schema = ref(z.any()), template = ref(
2512
- TEMPLATES.VOUCHER
2513
- ), { minor } = useLoading, isLoading = ref(!1), sheetTitle = ref("Create Campaign");
2514
- async function showSheet(visible, type, campaign, selectedTemplate) {
2515
- var e, c;
2516
- if (sheetVisible.value = visible, visible == !0) {
2517
- try {
2518
- isLoading.value = visible, await useMembershipStore().readRewards(), await useBusinessStore().readLocations(), await useMembershipStore().readSegments(), await useMembershipStore().readMembership();
2519
- } catch {
2520
- } finally {
2521
- await new Promise((s) => setTimeout(s, 120)), isLoading.value = !1;
2522
- }
2523
- template.value = selectedTemplate ?? TEMPLATES[type], schema.value = CampaignDtos[type], type === "VOUCHER" && (await useCampaignStore().read(), schema.value = schema.value.superRefine((s, u) => {
2524
- s.campaign.type === "VOUCHER" && s.campaign.code && useCampaignStore().campaigns.voucher.some(
2525
- (a) => a.code === s.campaign.code && a._id.toString() !== s.campaign._id.toString()
2526
- ) && u.addIssue({
2527
- code: "custom",
2528
- message: "Code already exists, please use another code",
2529
- path: ["campaign", "code"]
2530
- });
2531
- })), data.value = campaign != null ? { ...campaign, templateId: (e = campaign.template) == null ? void 0 : e._id } : _.cloneDeep({
2532
- ...(c = template.value) == null ? void 0 : c.defaultValue
2533
- }), "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`;
2534
- }
2535
- }
2536
- async function hideSheet() {
2537
- Dialog.open({
2538
- title: t("connect.campaign.common.unsaved_changes"),
2539
- message: t("connect.campaign.common.unsaved_changes"),
2540
- primaryActions: {
2541
- text: t("connect.campaign.common.unsaved_changes_confirm"),
2542
- close: !0
2543
- },
2544
- secondaryActions: {
2545
- text: t("connect.campaign.common.unsaved_changes_cancel"),
2546
- close: !1
2547
- }
2548
- }).onPrimary(() => {
2549
- sheetVisible.value = !1;
2550
- }).onSecondary(() => {
2551
- Dialog.close();
2552
- });
2553
- }
2554
- const emits = __emit, errors = computed(() => {
2555
- const e = schema.value.superRefine(campaignRefinement).safeParse(data.value);
2556
- return e.success ? [] : e.error.errors;
2557
- });
2558
- function stepErrors(e = currentStep.value - 1) {
2559
- const c = template.value.steps[e].groups.flatMap(
2560
- (s) => s.fields.map((u) => u.property)
2561
- );
2562
- return errors.value.filter((s) => c.includes(s.path.join(".")));
2563
- }
2564
- __expose({ showSheet });
2565
- function showSummaryDialog() {
2566
- Dialog.open({
2567
- title: "",
2568
- dialogComponent: _sfc_main$1,
2569
- dialogComponentProps: {
2570
- data: data.value
2571
- }
2572
- });
2573
- }
2574
- function onUpdateProperty(e, c) {
2575
- if (_.set(data.value, e, c), e == "campaign.event.type") {
2576
- const s = RuleBuilder.setRuleToGroup(
2577
- RuleBuilder.scaffoldGroup(),
2578
- [
2579
- RuleBuilder.scaffoldGroup("g_schedule"),
2580
- RuleBuilder.scaffoldGroup("g_time"),
2581
- RuleBuilder.scaffoldGroup("g_user"),
2582
- RuleBuilder.scaffoldGroup("g_bill")
2583
- ]
2584
- ), u = RuleBuilder.setRuleToGroup(
2585
- RuleBuilder.scaffoldGroup("g_schedule"),
2586
- [
2587
- RuleBuilder.constructEntry(
2588
- "trigger.date",
2589
- "_rrule",
2590
- "RRULE:FREQ=DAILY;INTERVAL=1;BYHOUR=0;BYMINUTE=0;BYSECOND=0;WKST=SU"
2591
- ),
2592
- RuleBuilder.constructEntry("trigger.time", "_isOnTime", "00:00")
2593
- ],
2594
- "&&"
2595
- );
2596
- if (c != "SCHEDULE") {
2597
- _.set(data.value, "campaign.event.rule", s);
2598
- return;
2599
- }
2600
- _.set(
2601
- data.value,
2602
- "campaign.event.rule",
2603
- RuleBuilder.setRuleToGroup(s, u)
2604
- );
2605
- }
2606
- e == "campaign.notify" && c == !1 && _.set(data.value, "campaign.notifyMessage", void 0);
2607
- }
2608
- async function onUpdateFile(e, c) {
2609
- return e ? await minor(async () => firebaseStorage.update(c, e), {
2610
- message: `${e ? "Uploading" : "Removing"} file`,
2611
- successMessage: `File ${e ? "uploaded" : "removed"} successfully`
2612
- }) : "";
2613
- }
2614
- function isDisable(e) {
2615
- var c, s;
2616
- switch (e == null ? void 0 : e.property) {
2617
- case "campaign.event.type":
2618
- return ((s = (c = data.value) == null ? void 0 : c.campaign) == null ? void 0 : s._id) || !1;
2619
- default:
2620
- return !1;
2621
- }
2622
- }
2623
- function onSubmit() {
2624
- const e = schema.value.superRefine(campaignRefinement).transform(campaignTransform).safeParse(data.value);
2625
- e.success && (emits("submit:model-value", cleanPF(JSON.parse(JSON.stringify(e.data)))), sheetVisible.value = !1);
2626
- }
2627
- return (e, c) => {
2628
- const s = resolveComponent("FmButton"), u = resolveComponent("FmStep"), a = resolveComponent("FmStepper"), i = resolveComponent("FmCard"), l = resolveComponent("FmTopSheet");
2629
- return openBlock(), createBlock(l, {
2630
- "fullscreen-size": "lg",
2631
- modelValue: unref(sheetVisible),
2632
- "onUpdate:modelValue": [
2633
- c[7] || (c[7] = (o) => isRef(sheetVisible) ? sheetVisible.value = o : null),
2634
- c[8] || (c[8] = (o) => sheetVisible.value = o)
2635
- ]
2636
- }, createSlots({
2637
- "top-sheet-header": withCtx(() => [
2638
- createElementVNode("div", _hoisted_1, [
2639
- createElementVNode("div", null, toDisplayString(unref(sheetTitle)), 1),
2640
- createElementVNode("div", _hoisted_2, [
2641
- createVNode(s, {
2642
- onClick: c[0] || (c[0] = (o) => hideSheet()),
2643
- label: unref(t)("connect.campaign.common.cancel"),
2644
- variant: "tertiary"
2645
- }, null, 8, ["label"]),
2646
- createVNode(s, {
2647
- onClick: onSubmit,
2648
- label: unref(t)("connect.campaign.common.save"),
2649
- disabled: unref(errors).length > 0
2650
- }, null, 8, ["label", "disabled"])
2651
- ])
2652
- ])
2653
- ]),
2654
- _: 2
2655
- }, [
2656
- unref(isLoading) ? {
2657
- name: "default",
2658
- fn: withCtx(() => [
2659
- createElementVNode("div", _hoisted_9, [
2660
- createElementVNode("div", _hoisted_10, [
2661
- createElementVNode("div", _hoisted_11, [
2662
- c[9] || (c[9] = createElementVNode("div", { class: "col-span-2 space-y-80 xs:col-span-3 xs:px-16 xs:pt-16" }, [
2663
- createElementVNode("div", { class: "flex-1 space-y-6 py-1" }, [
2664
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2665
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2666
- createElementVNode("div", { class: "space-y-3" }, [
2667
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2668
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2669
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2670
- ]),
2671
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2672
- ]),
2673
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100 rounded" }),
2674
- createElementVNode("div", { class: "h-[80px] bg-fm-color-neutral-gray-100 rounded" }),
2675
- createElementVNode("div", { class: "space-y-3" }, [
2676
- createElementVNode("div", { class: "grid grid-cols-2 gap-4" }, [
2677
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" }),
2678
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2679
- ]),
2680
- createElementVNode("div", { class: "h-32 bg-fm-color-neutral-gray-100" })
2681
- ])
2682
- ])
2683
- ], -1)),
2684
- createVNode(i, { class: "h-[150px] bg-fm-color-neutral-gray-100" })
2685
- ])
2686
- ])
2687
- ])
2688
- ]),
2689
- key: "1"
2690
- } : {
2691
- name: "default",
2692
- fn: withCtx(() => [
2693
- unref(data) ? (openBlock(), createElementBlock("div", _hoisted_3, [
2694
- createVNode(a, {
2695
- modelValue: unref(currentStep),
2696
- "onUpdate:modelValue": c[1] || (c[1] = (o) => isRef(currentStep) ? currentStep.value = o : null),
2697
- orientation: "horizontal",
2698
- class: "xs:hidden mx-[-24px] mt-16 mb-24 flex-1"
2699
- }, {
2700
- default: withCtx(() => [
2701
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (o, n) => (openBlock(), createBlock(u, {
2702
- key: o.name,
2703
- title: unref(t)(o.name),
2704
- value: n + 1,
2705
- error: () => stepErrors(n).length > 0,
2706
- complete: () => n + 1 <= unref(currentStep)
2707
- }, null, 8, ["title", "value", "error", "complete"]))), 128))
2708
- ]),
2709
- _: 1
2710
- }, 8, ["modelValue"]),
2711
- createElementVNode("div", _hoisted_4, [
2712
- createVNode(s, {
2713
- icon: "close",
2714
- variant: "tertiary",
2715
- onClick: c[2] || (c[2] = (o) => sheetVisible.value = !1)
2716
- }),
2717
- createVNode(a, {
2718
- modelValue: unref(currentStep),
2719
- "onUpdate:modelValue": c[3] || (c[3] = (o) => isRef(currentStep) ? currentStep.value = o : null),
2720
- orientation: "horizontal",
2721
- class: "flex-1"
2722
- }, {
2723
- default: withCtx(() => [
2724
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps, (o, n) => (openBlock(), createBlock(u, {
2725
- key: o.name,
2726
- title: unref(sheetTitle),
2727
- description: o.name,
2728
- value: n + 1,
2729
- error: () => stepErrors(n).length > 0,
2730
- complete: () => n + 1 <= unref(currentStep) && stepErrors(unref(currentStep) - 1).length == 0
2731
- }, null, 8, ["title", "description", "value", "error", "complete"]))), 128))
2732
- ]),
2733
- _: 1
2734
- }, 8, ["modelValue"]),
2735
- createVNode(s, {
2736
- icon: "info",
2737
- variant: "tertiary",
2738
- onClick: c[4] || (c[4] = () => showSummaryDialog())
2739
- })
2740
- ]),
2741
- createElementVNode("div", _hoisted_5, [
2742
- createElementVNode("div", _hoisted_6, [
2743
- createVNode(JsonViewer, {
2744
- json: {
2745
- data: unref(data),
2746
- errors: unref(errors).map(
2747
- (o) => `${o.path.join(".")} - ${o.message}`
2748
- ),
2749
- stepErrors: stepErrors().map(
2750
- (o) => `${o.path.join(".")} - ${o.message}`
2751
- ),
2752
- schema: unref(schema)
2753
- }
2754
- }, null, 8, ["json"]),
2755
- (openBlock(!0), createElementBlock(Fragment, null, renderList(unref(template).steps[unref(currentStep) - 1].groups.filter(
2756
- (o) => o.fields.length && (!o.condition || unref(_).get(unref(data), o.condition.property) == o.condition.value == (o.condition.not != !0))
2757
- ), (o, n) => (openBlock(), createElementBlock("div", {
2758
- key: n,
2759
- class: "space-y-24"
2760
- }, [
2761
- createElementVNode("div", _hoisted_7, toDisplayString(o.name ? unref(t)(o.name) : ""), 1),
2762
- (openBlock(!0), createElementBlock(Fragment, null, renderList(o.fields, (p, h) => (openBlock(), createElementBlock("div", { key: h }, [
2763
- (openBlock(), createBlock(_sfc_main$2, {
2764
- key: h,
2765
- field: p,
2766
- modelValue: unref(_).get(unref(data), p.property),
2767
- disabled: isDisable(p),
2768
- "onUpdate:modelValue": (y) => onUpdateProperty(p.property, y),
2769
- "onUpdate:file": async (y, g) => {
2770
- const V = await onUpdateFile(y, g);
2771
- onUpdateProperty(p.property, V || "");
2772
- },
2773
- schema: unref(ZodHelper).typeAtPath(
2774
- unref(schema),
2775
- p.property,
2776
- unref(data).campaign.type != "MISSION" ? [unref(data).campaign.type] : ["STAMP", "MISSION"]
2777
- ),
2778
- "helper-state": unref(ZodHelper).helperState(unref(errors), p.property),
2779
- "helper-text": unref(ZodHelper).helperText(unref(errors), p.property),
2780
- extras: p.extras != null ? p.extras == "" ? unref(data) : unref(_).get(unref(data), p.extras) : void 0
2781
- }, null, 8, ["field", "modelValue", "disabled", "onUpdate:modelValue", "onUpdate:file", "schema", "helper-state", "helper-text", "extras"]))
2782
- ]))), 128))
2783
- ]))), 128)),
2784
- createElementVNode("div", _hoisted_8, [
2785
- createVNode(s, {
2786
- label: "Back",
2787
- variant: "tertiary",
2788
- disabled: unref(currentStep) == 1,
2789
- onClick: c[5] || (c[5] = (o) => currentStep.value--)
2790
- }, null, 8, ["disabled"]),
2791
- createVNode(s, {
2792
- disabled: unref(currentStep) - 1 < unref(template).steps.length - 1 ? stepErrors().length > 0 : unref(errors).length > 0,
2793
- label: unref(currentStep) - 1 < unref(template).steps.length - 1 ? "Next" : "Submit",
2794
- onClick: c[6] || (c[6] = (o) => unref(currentStep) - 1 < unref(template).steps.length - 1 ? currentStep.value++ : onSubmit())
2795
- }, null, 8, ["disabled", "label"])
2796
- ])
2797
- ]),
2798
- createVNode(_sfc_main$1, {
2799
- data: unref(data),
2800
- class: "xs:hidden"
2801
- }, null, 8, ["data"])
2802
- ])
2803
- ])) : createCommentVNode("", !0)
2804
- ]),
2805
- key: "0"
2806
- }
2807
- ]), 1032, ["modelValue"]);
2808
- };
2809
- }
2810
- });
2811
- export {
2812
- _sfc_main as _
2813
- };