@feedmepos/mf-connect 0.1.98-beta.9 → 0.1.99-prod

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