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

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