@feedmepos/mf-connect 0.1.58-prod → 0.1.60-prod

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