@feedmepos/mf-connect 0.1.9-prod → 0.1.10-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 (90) hide show
  1. package/dist/{Analytic-8Ew7y5t9.js → Analytic-CpSbitWV.js} +24 -23
  2. package/dist/{App-3BVNH3r-.js → App-BPT8XzjX.js} +56 -51
  3. package/dist/{Broadcast-CrsPUhLT.js → Broadcast-CJHpiQeN.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DE300Y56.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DUPqWdIm.js} +7 -7
  5. package/dist/Card-Bvn36zqZ.js +895 -0
  6. package/dist/{Collections-djS9hLI8.js → Collections-Bq6OxsJC.js} +24 -29
  7. package/dist/{Credit-D4KEvIov.js → Credit-Dno_g7dW.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BjM81fmS.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-cGbwORhw.js} +648 -1284
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-aEWfdpCg.js → EffectSheet.vue_vue_type_style_index_0_lang-Ho7zwlbb.js} +19 -19
  10. package/dist/{Experience-2FPLO7aV.js → Experience-BC1qSIGO.js} +8 -8
  11. package/dist/{Game-e_UjVJgU.js → Game-C_CKGMBW.js} +8 -8
  12. package/dist/Index-BXFaWTfw.js +255 -0
  13. package/dist/{Marketing-B2hCjZ2r.js → Marketing-Ni0WAie5.js} +5 -5
  14. package/dist/{Member-D_ykRIBb.js → Member-djnisrK1.js} +4 -4
  15. package/dist/{MemberList-LmzzYxEn.js → MemberList-CclU-3B7.js} +193 -189
  16. package/dist/{MemberTransactions-B2vqlKaP.js → MemberTransactions-DVVsv3Ux.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DQ2ubF0N.js → MessageInput.vue_vue_type_script_setup_true_lang-khyDg1m4.js} +2 -2
  18. package/dist/Mission-Z5somdo_.js +273 -0
  19. package/dist/Overview-BvMVz3lQ.js +1074 -0
  20. package/dist/{Point-DFriwWWY.js → Point-DdPukiTg.js} +8 -8
  21. package/dist/{Promotion-Db3IEs2F.js → Promotion-DCqdIwjG.js} +9 -9
  22. package/dist/Record-CvMxXm1B.js +337 -0
  23. package/dist/Reward-CiJHGXfQ.js +441 -0
  24. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CrGCBRmH.js +150 -0
  25. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-tnT6i0Jq.js +1638 -0
  26. package/dist/{Segment-CE8q9JV2.js → Segment-CQb3j-o0.js} +13 -13
  27. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-B7YqIU5D.js +181 -0
  28. package/dist/{Setting-Vcz1S27V.js → Setting-91cK3ssU.js} +31 -31
  29. package/dist/Store-B-uldUKt.js +1744 -0
  30. package/dist/{StoreRewards-Dt30AkWo.js → StoreRewards-dDNeFlA9.js} +12 -12
  31. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BVb1X0aq.js +1132 -0
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-f59onlgt.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Ds0WxGxr.js} +1 -1
  33. package/dist/{Tier-a6yXEtLd.js → Tier-_jMaLj3u.js} +19 -19
  34. package/dist/{Title-A3-2EI0w.js → Title-By7o67aT.js} +19 -19
  35. package/dist/{Transaction-DswABr2P.js → Transaction-BLpEgeI2.js} +2 -2
  36. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Bf_nO9zH.js +130 -0
  37. package/dist/{Voucher-DEoVgZYa.js → Voucher-CG5tfibn.js} +11 -11
  38. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DpQUoXyQ.js +419 -0
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-ccc1vxjS.js → ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js} +1 -1
  40. package/dist/{app-C23GfQGq.js → app-DDmTqTb7.js} +1 -1
  41. package/dist/{app-C66C2KLW.js → app-vCqTQIeC.js} +424 -273
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DNAVZOSH.js → business-Cz78KGF2.js} +1 -1
  44. package/dist/{campaign-Cv0HaUD1.js → campaign-BBd4o7F_.js} +2 -2
  45. package/dist/campaign.enum-CIhi0b-m.js +20 -0
  46. package/dist/campaign.fn-5silF1DK.js +758 -0
  47. package/dist/collectible.enum-cMIQ6ogq.js +19 -0
  48. package/dist/{collection.fn-Dxzr2oPt.js → collection.fn-BGc7Qeli.js} +2 -2
  49. package/dist/dto-i04OPJfW.js +2018 -0
  50. package/dist/{effect-CUuL8Tci.js → effect-D8UzkYRg.js} +1 -1
  51. package/dist/{email-addresses-Yt3s7i2b.js → email-addresses-u05o35hN.js} +1 -1
  52. package/dist/{export-CNg5YWMm.js → export-BEXuPYEd.js} +3 -3
  53. package/dist/{helper-DzmKNFue.js → helper-RptRJGv6.js} +1 -1
  54. package/dist/{index-Dnf7j71V.js → index-B8s-gucK.js} +9 -3
  55. package/dist/{index-B88e_9YI.js → index-BjHZUhiH.js} +1 -1
  56. package/dist/{index-O9lB54LY.js → index-Bpu2DYUc.js} +1348 -1342
  57. package/dist/{index-BK8X9RF6.js → index-C6-rCMhD.js} +3 -3
  58. package/dist/{index-D0obMrAS.js → index-Cq_ZIbRm.js} +173 -62
  59. package/dist/{index-CsCgQ8gt.js → index-DFAnoAe9.js} +1 -1
  60. package/dist/index-DbyJ6Nyn.js +54 -0
  61. package/dist/{index-yzH5eyKW.js → index-Dt6K2eG8.js} +1 -1
  62. package/dist/{index-9CXt2kbQ.js → index-DwzoqCt8.js} +293 -287
  63. package/dist/index-UfL5qRzR.js +1049 -0
  64. package/dist/index-g8EbRVnr.js +32 -0
  65. package/dist/{index-QuBsnXgx.js → index-hEE_ntHd.js} +1 -1
  66. package/dist/index-vh86FiIQ.js +10 -0
  67. package/dist/{index.esm2017-TpBElhnN.js → index.esm2017-BSzW_yaL.js} +1 -1
  68. package/dist/{loading-ChoC5E9d.js → loading-DjEdwdnj.js} +156 -153
  69. package/dist/{membership-CU-k0-Tf.js → membership-BL9Xs8lD.js} +52 -44
  70. package/dist/{money-DANmyTBj.js → money-D7lq0cx-.js} +1 -1
  71. package/dist/{number-DrocTWDD.js → number-BiDabTkI.js} +1 -1
  72. package/dist/objectid-CXf0jb1W.js +145 -0
  73. package/dist/reward-Cr8rbe5R.js +36 -0
  74. package/dist/{rule-builder-3YRdr18A.js → rule-builder-DPKFZ5UX.js} +1 -1
  75. package/dist/{rule-BQLmpER9.js → rule-vkYJij4h.js} +4 -3
  76. package/dist/{template-DOKU1QkY.js → template-Bep5Y5ch.js} +4 -4
  77. package/dist/trigger-fWhQ3bqv.js +144 -0
  78. package/dist/{usePagination-JGI7x0W7.js → usePagination-DSF5b4hM.js} +1 -1
  79. package/dist/user-9UiaP0xs.js +54 -0
  80. package/dist/{vue-i18n-Bch1JmhI.js → vue-i18n-BhiDOB1j.js} +232 -232
  81. package/package.json +2 -2
  82. package/dist/Card-DndggRLr.js +0 -1036
  83. package/dist/Mission-CsLdMq1M.js +0 -261
  84. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-_P2yImhi.js +0 -1804
  85. package/dist/Store-C8kT7JN5.js +0 -1531
  86. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cc2F_06x.js +0 -1065
  87. package/dist/dto-CcrufW2j.js +0 -2770
  88. package/dist/index-C7745kXl.js +0 -755
  89. package/dist/index-CZ28ywyB.js +0 -298
  90. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1744 @@
1
+ import { defineComponent as ee, computed as E, resolveComponent as h, openBlock as g, createBlock as I, withCtx as T, createElementVNode as x, createElementBlock as D, createVNode as r, createCommentVNode as A, toDisplayString as j, unref as e, Fragment as J, renderList as re, ref as R, isRef as oe, reactive as qe, onMounted as fe, watch as we, toRaw as He, createTextVNode as de, h as Ke } from "vue";
2
+ import { _ as We } from "./tier-BJDhpH6X.js";
3
+ import { useDialog as Ae, useDialogChild as Me, components as ze } from "@feedmepos/ui-library";
4
+ import { c as B, e as Ce, S as Ye } from "./index-C6-rCMhD.js";
5
+ import { d as se, a as Je, p as he, u as Ee, n as Ge, f as Fe } from "./loading-DjEdwdnj.js";
6
+ import { u as $e, C as me } from "./membership-BL9Xs8lD.js";
7
+ import { a as Xe, c as Ne } from "./object-qECH92oz.js";
8
+ import { _ as ue } from "./lodash-B5I3zXaY.js";
9
+ import { u as be } from "./vue-i18n-BhiDOB1j.js";
10
+ import { Z, g as G, a as X } from "./zod-Bg2FbC-D.js";
11
+ import { z as Q, R as Ze } from "./app-vCqTQIeC.js";
12
+ import { m as Qe, n as et, o as tt, p as Oe, q as nt } from "./index-UfL5qRzR.js";
13
+ import { u as xe } from "./app-wDQR6dpb.js";
14
+ import { _ as te } from "./ZodTextField.vue_vue_type_script_setup_true_lang-YwGR2En3.js";
15
+ import { J as ke } from "./JsonViewer-v8_C7l5N.js";
16
+ import { _ as ot } from "./index-Bpu2DYUc.js";
17
+ import { _ as lt } from "./ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js";
18
+ import { _ as at } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
19
+ import { z as st, a as rt } from "./money-D7lq0cx-.js";
20
+ import { F as it } from "./number-BiDabTkI.js";
21
+ import { t as dt } from "./helper-RptRJGv6.js";
22
+ import "./index-Dt6K2eG8.js";
23
+ import "./index-DwzoqCt8.js";
24
+ import "./index-Cq_ZIbRm.js";
25
+ import "./index-hEE_ntHd.js";
26
+ import "./index-DbyJ6Nyn.js";
27
+ import { m as ut } from "./index-BjHZUhiH.js";
28
+ import { m as _e } from "./index-B8s-gucK.js";
29
+ import { useRouter as ct } from "vue-router";
30
+ function je(v) {
31
+ return se.DineroFactory(v).toUnit();
32
+ }
33
+ function mt(v, _, a, f, i = [], b = []) {
34
+ const o = ot.compact(
35
+ _.map((t) => v.find((u) => u.systemCode === t.systemCode && u.taxCode === t.taxCode)).filter((t) => !!t && b.includes(t.systemCode))
36
+ ), m = o.reduce(
37
+ (t, u) => {
38
+ var y;
39
+ return Object.assign(t, {
40
+ [u.taxCode]: {
41
+ inclusive: ((y = i.find((c) => c.systemCode === u.systemCode)) == null ? void 0 : y.inclusive) || !1,
42
+ adjustment: {
43
+ level: 1,
44
+ type: {
45
+ type: "BY_MULTIPLIER",
46
+ amount: {
47
+ amount: u.rate.amount,
48
+ precision: u.rate.precision,
49
+ currency: "MYR"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ });
55
+ },
56
+ {}
57
+ ), d = se.Calculator.calculate({
58
+ items: {
59
+ 0: {
60
+ quantity: 1,
61
+ adjustments: {
62
+ price: {
63
+ level: 0,
64
+ type: {
65
+ type: "BY_AMOUNT",
66
+ amount: se.DineroFactory(a).subtract(se.Dinero.fromNumber({ number: f }).toObject()).toObject()
67
+ }
68
+ }
69
+ },
70
+ taxes: m
71
+ }
72
+ },
73
+ adjustments: {},
74
+ roundToNearest: 0
75
+ });
76
+ return o.map((t) => ({
77
+ setting: t,
78
+ systemCode: t.systemCode,
79
+ name: t.name,
80
+ taxCode: t.taxCode,
81
+ rate: t.rate,
82
+ total: se.DineroFactory({
83
+ ...d.items[0].taxes[t.taxCode]
84
+ }).convertPrecision(2).toObject()
85
+ }));
86
+ }
87
+ function pt(v, _, a) {
88
+ return v ? v.reduce((f, i) => {
89
+ var b;
90
+ return (b = a.find((o) => o.systemCode === i.systemCode)) != null && b.inclusive || (f = se.DineroFactory(f.toObject()).add(i.total)), f;
91
+ }, se.DineroFactory(_)).toObject() : se.DineroFactory(_).toObject();
92
+ }
93
+ const yt = { class: "relative h-[120px] aspect-video flex items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, ft = ["src"], bt = {
94
+ key: 2,
95
+ class: "absolute top-2 left-2"
96
+ }, gt = { class: "absolute top-0 right-0" }, vt = /* @__PURE__ */ x("div", { class: "text-fm-color-typo-error fm-typo-en-body-md-400" }, " Delete ", -1), ht = { class: "fm-typo-en-body-lg-600" }, _t = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = { class: "flex gap-8 items-center flex-wrap" }, Ct = /* @__PURE__ */ ee({
97
+ __name: "StoreBundleCard",
98
+ props: {
99
+ bundle: { type: Object, required: !0 }
100
+ },
101
+ emits: ["edit", "delete", "send"],
102
+ setup(v, { emit: _ }) {
103
+ const a = v, f = _, i = E(() => {
104
+ const o = [];
105
+ return a.bundle.price.amount > 0 && o.push(
106
+ `${B.Config.getCountry().currency.symbol}${je(a.bundle.price)}`
107
+ ), a.bundle.coinPrice && o.push(`${a.bundle.coinPrice} point(s)`), o.join(" or ");
108
+ }), b = E(() => {
109
+ var m, d;
110
+ const o = [];
111
+ if (a.bundle.titles.length > 0 && o.push(`${a.bundle.titles.length} title(s)`), a.bundle.vouchers.length > 0 && o.push(`${a.bundle.vouchers.length} voucher(s)`), a.bundle.credit.normal || (m = a.bundle.credit.free) != null && m.amount) {
112
+ const t = a.bundle.credit.normal + (((d = a.bundle.credit.free) == null ? void 0 : d.amount) ?? 0);
113
+ o.push(`${t} credit(s)`);
114
+ }
115
+ return o;
116
+ });
117
+ return (o, m) => {
118
+ const d = h("FmIcon"), t = h("FmChip"), u = h("FmButton"), y = h("FmMenuItem"), c = h("FmMenu"), S = h("FmCard");
119
+ return g(), I(S, {
120
+ variant: "outlined",
121
+ class: "flex flex-col gap-y-8 p-16 min-h-[240px] h-full text-center items-center"
122
+ }, {
123
+ default: T(() => [
124
+ x("div", yt, [
125
+ v.bundle.image ? (g(), D("img", {
126
+ key: 1,
127
+ src: v.bundle.image,
128
+ class: "w-full h-full object-contain aspect-video"
129
+ }, null, 8, ft)) : (g(), I(d, {
130
+ key: 0,
131
+ name: "image",
132
+ outline: !0,
133
+ size: "md",
134
+ class: "text-fm-color-neutral-gray-200"
135
+ })),
136
+ v.bundle.isFeedvibe ? (g(), D("div", bt, [
137
+ r(t, {
138
+ label: "Feedvibe",
139
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
140
+ compact: ""
141
+ })
142
+ ])) : A("", !0),
143
+ x("div", gt, [
144
+ r(c, { placement: "bottom-end" }, {
145
+ "menu-button": T(() => [
146
+ r(u, {
147
+ icon: "more_vert",
148
+ variant: "tertiary"
149
+ })
150
+ ]),
151
+ default: T(() => [
152
+ r(y, {
153
+ onClick: m[0] || (m[0] = (l) => f("edit", v.bundle)),
154
+ icon: "edit",
155
+ label: "Edit"
156
+ }),
157
+ v.bundle.stripePriceId ? A("", !0) : (g(), I(y, {
158
+ key: 0,
159
+ onClick: m[1] || (m[1] = (l) => f("send", v.bundle)),
160
+ icon: "send",
161
+ label: "Send"
162
+ })),
163
+ r(y, {
164
+ onClick: m[2] || (m[2] = (l) => f("delete", v.bundle)),
165
+ icon: "delete"
166
+ }, {
167
+ label: T(() => [
168
+ vt
169
+ ]),
170
+ _: 1
171
+ })
172
+ ]),
173
+ _: 1
174
+ })
175
+ ])
176
+ ]),
177
+ x("div", ht, j(v.bundle.name), 1),
178
+ x("div", _t, j(e(i) || "Free"), 1),
179
+ x("div", xt, [
180
+ (g(!0), D(J, null, re(e(b), (l, F) => (g(), I(t, {
181
+ key: F,
182
+ label: l
183
+ }, null, 8, ["label"]))), 128))
184
+ ])
185
+ ]),
186
+ _: 1
187
+ });
188
+ };
189
+ }
190
+ }), Ft = /* @__PURE__ */ ee({
191
+ __name: "AddBundleCard",
192
+ emits: ["create"],
193
+ setup(v, { emit: _ }) {
194
+ const { t: a } = be(), f = _;
195
+ return (i, b) => {
196
+ const o = h("FmButton"), m = h("FmCard");
197
+ return g(), I(m, {
198
+ variant: "outlined",
199
+ class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
200
+ }, {
201
+ default: T(() => [
202
+ r(o, {
203
+ onClick: b[0] || (b[0] = (d) => f("create")),
204
+ label: e(a)("connect.store.actions.addBundle"),
205
+ icon: "add",
206
+ variant: "secondary"
207
+ }, null, 8, ["label"])
208
+ ]),
209
+ _: 1
210
+ });
211
+ };
212
+ }
213
+ }), Vt = { class: "space-y-16" }, St = { class: "flex w-full justify-between pb-16" }, wt = { class: "flex items-center justify-end gap-8" }, $t = /* @__PURE__ */ ee({
214
+ __name: "CategoryDialog",
215
+ props: {
216
+ action: {
217
+ type: String,
218
+ default: () => "add"
219
+ },
220
+ initialValue: {
221
+ type: String,
222
+ default: () => ""
223
+ }
224
+ },
225
+ setup(v) {
226
+ const { t: _ } = be(), a = v, f = Ae(), { emitData: i, emitAction: b } = Me(), o = R(a.initialValue), m = Q.string().min(1);
227
+ function d() {
228
+ i(o.value), b("primary"), f.close();
229
+ }
230
+ function t() {
231
+ i(null), b("primary"), f.close();
232
+ }
233
+ return (u, y) => {
234
+ const c = h("FmTextField"), S = h("FmButton");
235
+ return g(), D("div", Vt, [
236
+ r(c, {
237
+ modelValue: e(o),
238
+ "onUpdate:modelValue": y[0] || (y[0] = (l) => oe(o) ? o.value = l : null),
239
+ label: e(_)("connect.store.category.label"),
240
+ rules: [e(Z).toRule(e(m))]
241
+ }, null, 8, ["modelValue", "label", "rules"]),
242
+ x("div", St, [
243
+ x("div", null, [
244
+ v.action == "edit" ? (g(), I(S, {
245
+ key: 0,
246
+ onClick: t,
247
+ label: e(_)("connect.common.delete"),
248
+ variant: "destructive"
249
+ }, null, 8, ["label"])) : A("", !0)
250
+ ]),
251
+ x("div", wt, [
252
+ r(S, {
253
+ label: e(_)("connect.common.cancel"),
254
+ variant: "tertiary",
255
+ onClick: y[1] || (y[1] = (l) => e(f).close())
256
+ }, null, 8, ["label"]),
257
+ r(S, {
258
+ label: v.action == "edit" ? e(_)("connect.common.edit") : e(_)("connect.common.add"),
259
+ disabled: !e(o),
260
+ onClick: d
261
+ }, null, 8, ["label", "disabled"])
262
+ ])
263
+ ])
264
+ ]);
265
+ };
266
+ }
267
+ }), kt = { class: "space-y-16" }, Pt = /* @__PURE__ */ x("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Select a category to create FeedMe CNY 2025 bundle ", -1), Tt = { class: "flex items-center justify-end gap-8 pb-16" }, Ut = /* @__PURE__ */ ee({
268
+ __name: "SelectCategoryDialog",
269
+ setup(v) {
270
+ const { emitData: _, emitAction: a } = Me(), f = $e(), i = R(), b = E(
271
+ () => f.sortedStoreCategories.map((o, m) => ({
272
+ label: o.name,
273
+ value: m
274
+ }))
275
+ );
276
+ return (o, m) => {
277
+ const d = h("FmSelect"), t = h("FmButton");
278
+ return g(), D("div", kt, [
279
+ Pt,
280
+ r(d, {
281
+ placeholder: "Select a category",
282
+ items: e(b),
283
+ modelValue: e(i),
284
+ "onUpdate:modelValue": [
285
+ m[0] || (m[0] = (u) => oe(i) ? i.value = u : null),
286
+ m[1] || (m[1] = (u) => e(_)(u))
287
+ ],
288
+ label: "Category"
289
+ }, null, 8, ["items", "modelValue"]),
290
+ x("div", Tt, [
291
+ r(t, {
292
+ variant: "tertiary",
293
+ label: "Cancel",
294
+ onClick: m[2] || (m[2] = (u) => e(a)("tertiary"))
295
+ }),
296
+ r(t, {
297
+ label: "Select",
298
+ onClick: m[3] || (m[3] = (u) => e(a)("primary")),
299
+ disabled: e(i) == null
300
+ }, null, 8, ["disabled"])
301
+ ])
302
+ ]);
303
+ };
304
+ }
305
+ });
306
+ function Ve(v) {
307
+ return v.states.map((_) => ({ label: _, value: _ }));
308
+ }
309
+ const Rt = {
310
+ [Ce.F_COUNTRY.enum.MY]: {
311
+ states: [
312
+ "Johor",
313
+ "Kedah",
314
+ "Kelantan",
315
+ "Kuala Lumpur",
316
+ "Labuan",
317
+ "Melaka",
318
+ "Negeri Sembilan",
319
+ "Pahang",
320
+ "Perak",
321
+ "Perlis",
322
+ "Pulau Pinang",
323
+ "Putrajaya",
324
+ "Sabah",
325
+ "Sarawak",
326
+ "Selangor",
327
+ "Terengganu"
328
+ ],
329
+ get stateItems() {
330
+ return Ve(this);
331
+ }
332
+ },
333
+ [Ce.F_COUNTRY.enum.SG]: {
334
+ states: [],
335
+ get stateItems() {
336
+ return Ve(this);
337
+ }
338
+ },
339
+ [Ce.F_COUNTRY.enum.ID]: {
340
+ states: [
341
+ "Aceh",
342
+ "Bali",
343
+ "Bangka-Belitung",
344
+ "Banten",
345
+ "Bengkulu",
346
+ "Central Java",
347
+ "Central Sulawesi",
348
+ "Daerah Istimewa Yogyakarta",
349
+ "East Java",
350
+ "East Kalimantan",
351
+ "East Nusa Tenggara",
352
+ "Gorontalo",
353
+ "Jakarta Raya",
354
+ "Jambi",
355
+ "Kalimantan Tengah",
356
+ "Lampung",
357
+ "Maluku",
358
+ "Maluku Utara",
359
+ "North Sulawesi",
360
+ "North Sumatra",
361
+ "Nusa Tenggara Barat",
362
+ "Papua",
363
+ "Riau",
364
+ "Riau Islands",
365
+ "South Kalimantan",
366
+ "South Sulawesi",
367
+ "South Sumatra",
368
+ "Sulawesi Barat",
369
+ "Sulawesi Tenggara",
370
+ "West Java",
371
+ "West Kalimantan",
372
+ "West Papua",
373
+ "West Sumatra"
374
+ ],
375
+ get stateItems() {
376
+ return Ve(this);
377
+ }
378
+ }
379
+ }, pe = () => B.Config.getCountry(), ye = {
380
+ get fullCurrency() {
381
+ return pe().currency;
382
+ },
383
+ get currency() {
384
+ return pe().currency.code;
385
+ },
386
+ get fullTax() {
387
+ return B.Country.getCountryFlattenTaxes(pe().code);
388
+ },
389
+ get taxSystem() {
390
+ return pe().taxSystems;
391
+ },
392
+ taxInclusion(v) {
393
+ return ye.taxSystem.map((_) => ({
394
+ systemCode: _.code,
395
+ inclusive: v !== void 0 ? v : !1
396
+ }));
397
+ },
398
+ groupedTaxOptions() {
399
+ const v = B.Country.getCountryFlattenTaxes(pe().code);
400
+ return ye.taxSystem.map((_) => ({
401
+ code: _.code,
402
+ options: v.map((a) => ({ ...a, feedmeTaxCode: ye.generateCode(a) })).filter((a) => a.systemCode === _.code)
403
+ }));
404
+ },
405
+ systemDefaultCode(v) {
406
+ const _ = ye.groupedTaxOptions().find((a) => a.code === v);
407
+ return _ == null ? void 0 : _.options.find((a) => a.default);
408
+ },
409
+ generateCode(v) {
410
+ return `${v.systemCode}/${v.taxCode}`;
411
+ }
412
+ }, ne = ye, It = /* @__PURE__ */ ee({
413
+ __name: "TaxInclusiveSetting",
414
+ props: {
415
+ modelValue: {
416
+ type: Array,
417
+ required: !0,
418
+ default: () => []
419
+ }
420
+ },
421
+ emits: ["update:model-value"],
422
+ setup(v, { emit: _ }) {
423
+ const a = v, f = ne.taxSystem, i = _, b = R(a.modelValue);
424
+ function o(u, y) {
425
+ const c = ue.clone(a.modelValue), S = c.findIndex((l) => l.systemCode === u);
426
+ S >= 0 ? c[S].inclusive = y : c.push({
427
+ systemCode: u,
428
+ inclusive: y
429
+ }), b.value = c, i("update:model-value", c);
430
+ }
431
+ function m() {
432
+ return f.map((u) => {
433
+ const y = a.modelValue ? a.modelValue.find((c) => c.systemCode === u.code) : !1;
434
+ return {
435
+ label: u.name,
436
+ config: {
437
+ value: y ? y.inclusive : !1
438
+ },
439
+ input: (c) => {
440
+ o(u.code, c);
441
+ }
442
+ };
443
+ });
444
+ }
445
+ const d = qe(m());
446
+ function t(u, y) {
447
+ return `${u} ${y ? "Inclusive" : "Exclusive"}`;
448
+ }
449
+ return fe(() => {
450
+ a.modelValue.length || o(f[0].code, !1);
451
+ }), we(
452
+ () => a.modelValue,
453
+ (u, y) => {
454
+ u != y && !u.length && o(f[0].code, !1);
455
+ }
456
+ ), (u, y) => {
457
+ const c = h("FmSwitch");
458
+ return g(!0), D(J, null, re(e(d), (S, l) => {
459
+ var F;
460
+ return g(), D("div", { key: l }, [
461
+ r(c, {
462
+ "model-value": ((F = e(b)[l]) == null ? void 0 : F.inclusive) || !1,
463
+ "label-placement": "left",
464
+ "onUpdate:modelValue": (w) => S.input(w)
465
+ }, {
466
+ label: T(() => {
467
+ var w;
468
+ return [
469
+ x("div", null, j(t(S.label, ((w = e(b)[l]) == null ? void 0 : w.inclusive) || !1)), 1)
470
+ ];
471
+ }),
472
+ _: 2
473
+ }, 1032, ["model-value", "onUpdate:modelValue"])
474
+ ]);
475
+ }), 128);
476
+ };
477
+ }
478
+ });
479
+ var Dt = { mode: "production", appMode: "mf" };
480
+ const Bt = { class: "space-y-8" }, Nt = {
481
+ key: 0,
482
+ class: "space-y-16"
483
+ }, Ot = /* @__PURE__ */ ee({
484
+ __name: "StripeSetting",
485
+ props: {
486
+ modelValue: {}
487
+ },
488
+ emits: ["update:modelValue"],
489
+ setup(v, { emit: _ }) {
490
+ const a = v, f = _, i = R(!1);
491
+ we(i, (o, m) => {
492
+ m != o && (!a.modelValue && o ? f("update:modelValue", {
493
+ apiKey: "",
494
+ webhookSecret: ""
495
+ }) : o || f("update:modelValue", void 0));
496
+ });
497
+ const b = E(() => {
498
+ const o = Dt.mode === "development", m = B.Config.getCountry().code.toLowerCase(), d = m != "my" ? `.${m}` : "";
499
+ return `https://marketing${o ? "-dev" : ""}${d}.feedmeapi.com/stripe/${Ye.getBusinessId()}/webhook`;
500
+ });
501
+ return fe(() => {
502
+ i.value = !!a.modelValue;
503
+ }), (o, m) => {
504
+ const d = h("FmSwitch"), t = h("FmTextField"), u = h("FmButton");
505
+ return g(), D("div", Bt, [
506
+ r(d, {
507
+ modelValue: e(i),
508
+ "onUpdate:modelValue": m[0] || (m[0] = (y) => oe(i) ? i.value = y : null),
509
+ value: "true",
510
+ label: "Enable Stripe"
511
+ }, null, 8, ["modelValue"]),
512
+ a.modelValue ? (g(), D("div", Nt, [
513
+ r(t, {
514
+ label: "API Key",
515
+ modelValue: a.modelValue.apiKey,
516
+ "onUpdate:modelValue": m[1] || (m[1] = (y) => a.modelValue.apiKey = y),
517
+ "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
518
+ }, null, 8, ["modelValue"]),
519
+ r(t, {
520
+ label: "Webhook URL",
521
+ "model-value": e(b),
522
+ readonly: "",
523
+ "helper-text": "Copy this URL to your Stripe dashboard"
524
+ }, {
525
+ append: T(() => [
526
+ r(u, {
527
+ icon: "content_copy",
528
+ variant: "tertiary",
529
+ onClick: m[2] || (m[2] = (y) => e(Je)(e(b)))
530
+ })
531
+ ]),
532
+ _: 1
533
+ }, 8, ["model-value"]),
534
+ r(t, {
535
+ modelValue: a.modelValue.webhookSecret,
536
+ "onUpdate:modelValue": m[3] || (m[3] = (y) => a.modelValue.webhookSecret = y),
537
+ label: "Webhook Secret",
538
+ "helper-text": `Copy the webhook signing secret from your Stripe account and paste
539
+ here.`
540
+ }, null, 8, ["modelValue"])
541
+ ])) : A("", !0)
542
+ ]);
543
+ };
544
+ }
545
+ }), At = {
546
+ key: 0,
547
+ class: "space-y-16 pr-12"
548
+ }, Mt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Et = {
549
+ key: 1,
550
+ class: "space-y-16"
551
+ }, jt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Lt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, qt = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, Ht = { class: "space-y-4" }, Kt = { class: "fm-typo-en-body-lg-400" }, Wt = { class: "space-y-16" }, zt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Yt = { class: "flex items-center gap-8" }, Jt = /* @__PURE__ */ ee({
552
+ __name: "StoreSettingSheet",
553
+ emits: ["update"],
554
+ setup(v, { expose: _, emit: a }) {
555
+ const { t: f } = be(), i = a, b = R(!1), o = R(), m = R(!1), d = Qe.extend({
556
+ company: et.extend({
557
+ name: Q.string().min(1, "Company name is required"),
558
+ regNo: Q.string().min(1, "Registration number is required"),
559
+ address: tt.extend({
560
+ line1: Q.string().min(1, "Line 1 is required"),
561
+ line2: Q.string().optional(),
562
+ state: Q.string().min(1, "State is required"),
563
+ city: Q.string().min(1, "City is required"),
564
+ postcode: Q.string().min(1, "Postcode is required"),
565
+ country: Q.string().min(1, "Country is required")
566
+ }),
567
+ phoneNo: Q.string().min(1, "Phone number is required"),
568
+ sstRegNo: Q.string().optional()
569
+ })
570
+ }), t = E(() => d.safeParse(o.value).success);
571
+ function u() {
572
+ const S = d.safeParse(o.value);
573
+ S.success && i("update", S.data);
574
+ }
575
+ function y() {
576
+ return {
577
+ company: {
578
+ name: "",
579
+ address: {
580
+ line1: "",
581
+ line2: "",
582
+ city: "",
583
+ postcode: "",
584
+ state: "",
585
+ country: B.Config.getCountry().name
586
+ },
587
+ phoneNo: "",
588
+ regNo: "",
589
+ sstRegNo: ""
590
+ },
591
+ inclusiveTaxes: []
592
+ };
593
+ }
594
+ function c(S, l) {
595
+ b.value = S, S && (o.value = l != null && l.company ? l : y());
596
+ }
597
+ return _({
598
+ showSheet: c,
599
+ data: o
600
+ }), (S, l) => {
601
+ const F = h("FmIcon"), w = h("FmMenuItem"), N = h("FmMenu"), W = h("FmSelect"), Y = h("FmButton"), L = h("FmSideSheet");
602
+ return g(), I(L, {
603
+ "max-width": 560,
604
+ modelValue: e(b),
605
+ "onUpdate:modelValue": l[15] || (l[15] = (z) => oe(b) ? b.value = z : null),
606
+ header: e(f)("connect.store.setting.title")
607
+ }, {
608
+ "side-sheet-footer": T(() => [
609
+ x("div", Yt, [
610
+ r(Y, {
611
+ label: e(f)("connect.common.save"),
612
+ onClick: u,
613
+ disabled: !e(t) || e(xe)().isLoading,
614
+ loading: e(xe)().isLoading
615
+ }, null, 8, ["label", "disabled", "loading"]),
616
+ r(Y, {
617
+ label: e(f)("connect.common.cancel"),
618
+ onClick: l[14] || (l[14] = (z) => c(!1)),
619
+ variant: "tertiary"
620
+ }, null, 8, ["label"])
621
+ ])
622
+ ]),
623
+ default: T(() => {
624
+ var z, le;
625
+ return [
626
+ r(ke, { json: e(o) }, null, 8, ["json"]),
627
+ e(o) && e(o).company ? (g(), D("div", At, [
628
+ x("div", Mt, j(e(f)("connect.store.setting.company.legal_info")), 1),
629
+ r(te, {
630
+ modelValue: e(o).company.name,
631
+ "onUpdate:modelValue": l[0] || (l[0] = (s) => e(o).company.name = s),
632
+ label: e(f)("connect.store.setting.company.name"),
633
+ schema: e(Z).typeAtPath(e(d), "company.name")
634
+ }, null, 8, ["modelValue", "label", "schema"]),
635
+ r(te, {
636
+ modelValue: e(o).company.regNo,
637
+ "onUpdate:modelValue": l[1] || (l[1] = (s) => e(o).company.regNo = s),
638
+ label: e(f)("connect.store.setting.company.reg_no"),
639
+ schema: e(Z).typeAtPath(e(d), "company.regNo")
640
+ }, null, 8, ["modelValue", "label", "schema"]),
641
+ e(B.Config).getCountry().taxSystems.length ? (g(), I(te, {
642
+ key: 0,
643
+ modelValue: e(o).company.sstRegNo,
644
+ "onUpdate:modelValue": [
645
+ l[2] || (l[2] = (s) => e(o).company.sstRegNo = s),
646
+ l[3] || (l[3] = (s) => s ? null : e(o).inclusiveTaxes = [])
647
+ ],
648
+ label: e(f)("connect.store.setting.company.tax_reg_no"),
649
+ schema: e(Z).typeAtPath(e(d), "company.sstRegNo")
650
+ }, null, 8, ["modelValue", "label", "schema"])) : A("", !0),
651
+ (z = e(o).company) != null && z.sstRegNo && e(o).inclusiveTaxes ? (g(), D("div", Et, [
652
+ x("div", jt, j(e(f)("connect.store.setting.company.tax")), 1),
653
+ r(It, {
654
+ modelValue: e(o).inclusiveTaxes,
655
+ "onUpdate:modelValue": l[4] || (l[4] = (s) => e(o).inclusiveTaxes = s)
656
+ }, null, 8, ["modelValue"])
657
+ ])) : A("", !0),
658
+ r(te, {
659
+ modelValue: e(o).company.phoneNo,
660
+ "onUpdate:modelValue": l[5] || (l[5] = (s) => e(o).company.phoneNo = s),
661
+ label: e(f)("connect.store.setting.company.phone"),
662
+ schema: e(Z).typeAtPath(e(d), "company.phoneNo")
663
+ }, null, 8, ["modelValue", "label", "schema"]),
664
+ x("div", Lt, j(e(f)("connect.store.setting.company.address.title")), 1),
665
+ r(te, {
666
+ modelValue: e(o).company.address.line1,
667
+ "onUpdate:modelValue": l[6] || (l[6] = (s) => e(o).company.address.line1 = s),
668
+ label: e(f)("connect.store.setting.company.address.line1"),
669
+ schema: e(Z).typeAtPath(e(d), "company.address.line1")
670
+ }, null, 8, ["modelValue", "label", "schema"]),
671
+ r(te, {
672
+ modelValue: e(o).company.address.line2,
673
+ "onUpdate:modelValue": l[7] || (l[7] = (s) => e(o).company.address.line2 = s),
674
+ label: e(f)("connect.store.setting.company.address.line2"),
675
+ schema: e(Z).typeAtPath(e(d), "company.address.line2")
676
+ }, null, 8, ["modelValue", "label", "schema"]),
677
+ x("div", qt, [
678
+ r(te, {
679
+ modelValue: e(o).company.address.city,
680
+ "onUpdate:modelValue": l[8] || (l[8] = (s) => e(o).company.address.city = s),
681
+ label: e(f)("connect.store.setting.company.address.city"),
682
+ schema: e(Z).typeAtPath(e(d), "company.address.city")
683
+ }, null, 8, ["modelValue", "label", "schema"]),
684
+ r(te, {
685
+ modelValue: e(o).company.address.postcode,
686
+ "onUpdate:modelValue": l[9] || (l[9] = (s) => e(o).company.address.postcode = s),
687
+ label: e(f)("connect.store.setting.company.address.postcode"),
688
+ schema: e(Z).typeAtPath(e(d), "company.address.postcode")
689
+ }, null, 8, ["modelValue", "label", "schema"]),
690
+ x("div", Ht, [
691
+ x("div", Kt, j(e(f)("connect.store.setting.company.address.state")), 1),
692
+ r(N, {
693
+ placement: "top-end",
694
+ "model-value": e(m)
695
+ }, {
696
+ "menu-button": T(() => [
697
+ r(te, {
698
+ modelValue: e(o).company.address.state,
699
+ "onUpdate:modelValue": l[10] || (l[10] = (s) => e(o).company.address.state = s),
700
+ schema: e(Z).typeAtPath(e(d), "company.address.state"),
701
+ onFocusChanged: l[11] || (l[11] = (s) => m.value = s)
702
+ }, {
703
+ append: T(() => [
704
+ r(F, {
705
+ name: e(m) ? "keyboard_arrow_up" : "keyboard_arrow_down"
706
+ }, null, 8, ["name"])
707
+ ]),
708
+ _: 1
709
+ }, 8, ["modelValue", "schema"])
710
+ ]),
711
+ default: T(() => [
712
+ (g(!0), D(J, null, re(e(Rt)[e(B.Config).getCountry().code].stateItems.filter(
713
+ (s) => {
714
+ var $, U;
715
+ return s.label.toLowerCase().includes(((U = ($ = e(o)) == null ? void 0 : $.company) == null ? void 0 : U.address.state.toLowerCase()) ?? "");
716
+ }
717
+ ) || [], (s) => (g(), I(w, {
718
+ key: s.value,
719
+ "model-value": e(o).company.address.state === s.value,
720
+ label: s.label,
721
+ onClick: () => {
722
+ e(o).company.address.state = s.value, m.value = !1;
723
+ }
724
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
725
+ ]),
726
+ _: 1
727
+ }, 8, ["model-value"])
728
+ ]),
729
+ r(W, {
730
+ label: e(f)("connect.store.setting.company.address.country"),
731
+ modelValue: e(o).company.address.country,
732
+ "onUpdate:modelValue": l[12] || (l[12] = (s) => e(o).company.address.country = s),
733
+ items: [
734
+ {
735
+ label: e(B.Config).getCountry().name,
736
+ value: e(B.Config).getCountry().name
737
+ }
738
+ ],
739
+ rules: [e(Z).ruleAtPath(e(d), "company.address.country")]
740
+ }, null, 8, ["label", "modelValue", "items", "rules"])
741
+ ]),
742
+ x("div", Wt, [
743
+ x("div", zt, j(e(f)("connect.store.setting.stripe.title")), 1),
744
+ r(Ot, {
745
+ "model-value": (le = e(o)) == null ? void 0 : le.stripe,
746
+ "onUpdate:modelValue": l[13] || (l[13] = (s) => e(o).stripe = s)
747
+ }, null, 8, ["model-value"])
748
+ ])
749
+ ])) : A("", !0)
750
+ ];
751
+ }),
752
+ _: 1
753
+ }, 8, ["modelValue", "header"]);
754
+ };
755
+ }
756
+ });
757
+ function Gt(v, _ = !0) {
758
+ return B.DineroFactory(v).toFormat(_);
759
+ }
760
+ const Xt = /* @__PURE__ */ ee({
761
+ __name: "TaxVariantSetting",
762
+ props: {
763
+ modelValue: {
764
+ type: Array,
765
+ required: !0,
766
+ default: () => []
767
+ }
768
+ },
769
+ emits: ["update:modelValue"],
770
+ setup(v, { emit: _ }) {
771
+ const a = v, f = _;
772
+ fe(() => {
773
+ if (o.value.length !== b.value.length) {
774
+ const t = b.value.reduce((u, y) => {
775
+ const c = ne.systemDefaultCode(y.name);
776
+ if (!c) return u;
777
+ const { systemCode: S, taxCode: l } = c;
778
+ return y.value || u.push({ systemCode: S, taxCode: l }), u;
779
+ }, []);
780
+ d(t);
781
+ }
782
+ });
783
+ function i() {
784
+ return ne.groupedTaxOptions();
785
+ }
786
+ const b = E(() => i().map((t) => ({
787
+ name: t.code,
788
+ value: (o.value || []).find(
789
+ (u) => t.options.some((y) => y.feedmeTaxCode === u)
790
+ ),
791
+ options: t.options.map((u) => ({
792
+ label: `${u.name} (${it(u.rate)}%)`,
793
+ value: u.feedmeTaxCode
794
+ }))
795
+ }))), o = E(() => a.modelValue.map((t) => ne.generateCode(t)));
796
+ function m(t) {
797
+ const u = i().find(
798
+ (l) => l.options.some((F) => F.feedmeTaxCode === t)
799
+ ), y = u == null ? void 0 : u.options.find((l) => l.feedmeTaxCode === t);
800
+ if (!y) return;
801
+ const { systemCode: c, taxCode: S } = y;
802
+ d([{ systemCode: c, taxCode: S }]);
803
+ }
804
+ function d(t) {
805
+ const u = ue.clone(a.modelValue);
806
+ t.forEach((y) => {
807
+ const c = i().find(
808
+ (F) => F.options.some((w) => w.feedmeTaxCode === ne.generateCode(y))
809
+ ), S = (c == null ? void 0 : c.options) || [], l = u.findIndex(
810
+ (F) => S.some((w) => ne.generateCode(w) === ne.generateCode(F))
811
+ );
812
+ l >= 0 ? u.splice(l, 1, y) : u.push(y);
813
+ }), f("update:modelValue", u);
814
+ }
815
+ return (t, u) => {
816
+ const y = h("FmRadio"), c = h("FmRadioGroup");
817
+ return g(!0), D(J, null, re(e(b), (S) => (g(), D("div", {
818
+ key: S.name,
819
+ class: "flex items-start"
820
+ }, [
821
+ r(c, {
822
+ modelValue: S.value,
823
+ "onUpdate:modelValue": [
824
+ (l) => S.value = l,
825
+ u[0] || (u[0] = (l) => {
826
+ m(l);
827
+ })
828
+ ]
829
+ }, {
830
+ default: T(() => [
831
+ (g(!0), D(J, null, re(S.options, (l, F) => (g(), I(y, {
832
+ key: F,
833
+ value: l.value,
834
+ label: l.label
835
+ }, null, 8, ["value", "label"]))), 128))
836
+ ]),
837
+ _: 2
838
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
839
+ ]))), 128);
840
+ };
841
+ }
842
+ }), Se = {
843
+ get _id() {
844
+ return (/* @__PURE__ */ new Date()).toISOString();
845
+ },
846
+ name: "",
847
+ price: B.Dinero.zero().toObject(),
848
+ originalPrice: B.Dinero.zero().toObject(),
849
+ vouchers: [],
850
+ credit: {
851
+ normal: 0,
852
+ free: {
853
+ amount: 0,
854
+ day: 0
855
+ }
856
+ },
857
+ config: {
858
+ options: {}
859
+ },
860
+ titles: [],
861
+ taxes: [],
862
+ taxTotals: [],
863
+ internal: !1,
864
+ priceWithTaxes: st()
865
+ }, Zt = {
866
+ key: 0,
867
+ class: "space-y-24 pr-12"
868
+ }, Qt = { class: "space-y-8" }, en = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, tn = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, nn = /* @__PURE__ */ x("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Credit", -1), on = /* @__PURE__ */ x("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1), ln = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, an = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, sn = { class: "space-y-8" }, rn = { class: "flex items-center justify-between" }, dn = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, un = { class: "space-y-8" }, cn = { class: "flex items-center gap-8" }, mn = /* @__PURE__ */ ee({
869
+ __name: "EditBundleSheet",
870
+ emits: ["update"],
871
+ setup(v, { expose: _, emit: a }) {
872
+ const f = a, { t: i } = be(), b = $e(), o = R(!1), m = R([]), d = R({
873
+ category: 0,
874
+ index: -1,
875
+ originalCategoryIndex: void 0
876
+ }), t = R(ue.cloneDeep(Se)), u = R(), y = Oe, c = E(() => {
877
+ const p = y.safeParse(t.value);
878
+ return p.success ? [] : p.error.errors;
879
+ }), S = [
880
+ {
881
+ header: "Reward title",
882
+ accessorFn: (p) => p.collectible.name,
883
+ enableSorting: !0
884
+ },
885
+ {
886
+ id: "type",
887
+ header: "Reward type",
888
+ accessorFn: (p) => p.collectible.type,
889
+ cell(p) {
890
+ return me[p.row.original.collectible.type].chip();
891
+ }
892
+ },
893
+ {
894
+ header: "Description",
895
+ accessorFn: (p) => p.description,
896
+ cell(p) {
897
+ var C;
898
+ const n = p.row.original;
899
+ return n.collectible.type == "VOUCHER" || n.selectedReward == null ? n.description : Ke(ze.FmStepperField, {
900
+ "onUpdate:modelValue": (P) => {
901
+ t.value.titles = t.value.titles.map(
902
+ (q) => q.id == n.collectible._id ? { ...q, dayToExpire: P } : q
903
+ );
904
+ },
905
+ modelValue: ((C = n.selectedReward) == null ? void 0 : C.extra) ?? 0,
906
+ appendText: "day(s)",
907
+ showSteppers: !1,
908
+ disabled: !!t.value.stripePriceId
909
+ });
910
+ }
911
+ }
912
+ ], l = R([]), F = E(() => b.bundleRewards.map((p) => {
913
+ const n = w.value.find((P) => P.id == p._id), C = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${dt(p.options.validityOption || {})}` : "No expiry";
914
+ return {
915
+ collectible: p,
916
+ description: C,
917
+ selectedReward: n
918
+ };
919
+ })), w = E(() => {
920
+ var p, n;
921
+ return [
922
+ ...((p = t.value) == null ? void 0 : p.titles.map((C) => ({
923
+ id: C.id,
924
+ extra: C.dayToExpire
925
+ }))) ?? [],
926
+ ...((n = t.value) == null ? void 0 : n.vouchers.map((C) => ({
927
+ id: C,
928
+ extra: void 0
929
+ }))) ?? []
930
+ ];
931
+ }), N = E(
932
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
933
+ );
934
+ function W(p) {
935
+ t.value.subscriptionValidity = p;
936
+ for (const n of t.value.titles)
937
+ n.dayToExpire = p;
938
+ t.value.credit.free && (t.value.credit.free.day = p);
939
+ }
940
+ function Y() {
941
+ const p = F.value, n = t.value;
942
+ if (!(!n || !p))
943
+ for (let C = 0; C < p.length; C++) {
944
+ const P = p[C];
945
+ L.value[C] ? P.collectible.type == "TITLE" ? n.titles.findIndex(
946
+ (H) => H.id == P.collectible._id
947
+ ) < 0 && n.titles.push({
948
+ id: P.collectible._id,
949
+ dayToExpire: N.value
950
+ }) : n.vouchers.findIndex(
951
+ (H) => H == P.collectible._id
952
+ ) < 0 && n.vouchers.push(P.collectible._id) : (n.titles = n.titles.filter((K) => K.id != P.collectible._id), n.vouchers = n.vouchers.filter(
953
+ (K) => K != P.collectible._id
954
+ ));
955
+ }
956
+ }
957
+ const L = R({});
958
+ we(L, Y, { deep: !0 });
959
+ const z = E(() => {
960
+ var p, n;
961
+ return (n = (p = b.storeOption) == null ? void 0 : p.company) == null ? void 0 : n.sstRegNo;
962
+ }), le = E(() => {
963
+ var p, n, C;
964
+ return (C = (n = (p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) == null ? void 0 : n[0]) != null && C.inclusive ? "Inclusive" : "Exclusive";
965
+ }), s = E(() => {
966
+ var p, n, C;
967
+ return mt(
968
+ ne.fullTax,
969
+ He(t.value.taxes),
970
+ t.value.price,
971
+ Number(t.value.credit.normal),
972
+ ((p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) ?? [],
973
+ (C = (n = b.storeOption) == null ? void 0 : n.company) != null && C.sstRegNo ? ne.taxSystem.map((P) => P.code) : []
974
+ );
975
+ }), $ = E(() => s.value.reduce(
976
+ (n, C) => n.add(C.total),
977
+ rt()
978
+ ).toFormat()), U = E(() => {
979
+ var P;
980
+ const p = pt(
981
+ s.value,
982
+ t.value.price,
983
+ ((P = b.storeOption) == null ? void 0 : P.inclusiveTaxes) ?? []
984
+ );
985
+ t.value.priceWithTaxes = p;
986
+ const n = Gt(p, !1), C = Number(n.replace(/[^\d.-]/g, ""));
987
+ return Number.isNaN(C) ? 0 : C;
988
+ });
989
+ function M() {
990
+ t.value.taxTotals = s.value, f("update", Oe.parse(Xe(t.value)));
991
+ }
992
+ function k() {
993
+ return ue.cloneDeep(Se);
994
+ }
995
+ function O(p, n) {
996
+ o.value = p, p && n && (u.value = void 0, m.value = n.categories, t.value = n.bundle || k(), d.value.category = n.category, d.value.index = n.index, d.value.originalCategoryIndex = n.category, L.value = F.value.reduce((C, P, q) => (C[q] = !!P.selectedReward, C), {}));
997
+ }
998
+ return _({
999
+ showSheet: O,
1000
+ bundleImage: u,
1001
+ target: d,
1002
+ data: t
1003
+ }), (p, n) => {
1004
+ const C = h("FmSwitch"), P = h("FmHelperText"), q = h("FmTextField"), K = h("FmSelect"), H = h("FmStepperField"), ie = h("FmMenuItem"), ge = h("FmTable"), ce = h("FmButton"), ve = h("FmSideSheet");
1005
+ return g(), I(ve, {
1006
+ "max-width": 560,
1007
+ modelValue: e(o),
1008
+ "onUpdate:modelValue": n[20] || (n[20] = (ae) => oe(o) ? o.value = ae : null),
1009
+ header: e(d).index != -1 ? e(i)("connect.store.bundle.edit.title") : e(i)("connect.store.bundle.edit.create")
1010
+ }, {
1011
+ "side-sheet-footer": T(() => [
1012
+ x("div", cn, [
1013
+ r(ce, {
1014
+ label: e(d).index != -1 ? "Save" : "Add",
1015
+ onClick: M,
1016
+ disabled: e(c).length > 0,
1017
+ loading: e(xe)().isLoading
1018
+ }, null, 8, ["label", "disabled", "loading"]),
1019
+ r(ce, {
1020
+ label: "Cancel",
1021
+ onClick: n[19] || (n[19] = (ae) => O(!1)),
1022
+ variant: "tertiary"
1023
+ })
1024
+ ])
1025
+ ]),
1026
+ default: T(() => {
1027
+ var ae, Pe, Te, Ue, Re, Ie, De, Be;
1028
+ return [
1029
+ r(ke, { json: e(t) }, null, 8, ["json"]),
1030
+ e(t) ? (g(), D("div", Zt, [
1031
+ x("div", Qt, [
1032
+ e(B.Config).getCountry().code == "MY" && ((ae = e(b).payoutAccount) == null ? void 0 : ae.status) == "APPROVED" && ((Pe = e(b).payoutAccount) != null && Pe.enable) ? (g(), I(C, {
1033
+ key: 0,
1034
+ "onUpdate:modelValue": n[0] || (n[0] = (V) => {
1035
+ e(t).isFeedvibe = V, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], L.value = {});
1036
+ }),
1037
+ "label-placement": "right",
1038
+ "model-value": e(t).isFeedvibe || !1,
1039
+ label: "Feedvibe Campaign",
1040
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1041
+ }, null, 8, ["model-value"])) : A("", !0),
1042
+ e(t).isFeedvibe ? (g(), I(P, {
1043
+ key: 1,
1044
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1045
+ state: "warning"
1046
+ })) : A("", !0)
1047
+ ]),
1048
+ x("div", en, j(e(i)("connect.store.bundle.edit.basicInformation")), 1),
1049
+ r(q, {
1050
+ label: e(i)("connect.store.bundle.edit.bundleName"),
1051
+ modelValue: e(t).name,
1052
+ "onUpdate:modelValue": n[1] || (n[1] = (V) => e(t).name = V),
1053
+ "helper-state": e(G)(e(c), "name"),
1054
+ "helper-text": e(X)(e(c), "name")
1055
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1056
+ r(K, {
1057
+ modelValue: e(d).category,
1058
+ "onUpdate:modelValue": n[2] || (n[2] = (V) => e(d).category = V),
1059
+ label: "Store Category",
1060
+ items: e(m).map((V, Le) => ({ label: V, value: Le }))
1061
+ }, null, 8, ["modelValue", "items"]),
1062
+ r(lt, {
1063
+ label: e(i)("connect.store.bundle.edit.bundleImage"),
1064
+ class: "w-1/2 xs:w-2/3",
1065
+ "aspect-ratio": "16/9",
1066
+ thumbnail: e(t).image ?? void 0,
1067
+ file: e(u) ?? void 0,
1068
+ "onUpdate:file": n[3] || (n[3] = (V) => {
1069
+ u.value = V;
1070
+ }),
1071
+ "helper-state": e(G)(e(c), "image"),
1072
+ "helper-text": e(X)(e(c), "image")
1073
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1074
+ r(H, {
1075
+ "model-value": e(B.Dinero).fromFdoDinero(e(t).price).toUnit(),
1076
+ label: e(i)("connect.store.bundle.edit.bundlePrice"),
1077
+ min: 0,
1078
+ "max-fraction-digits": 2,
1079
+ "onUpdate:modelValue": n[4] || (n[4] = (V) => {
1080
+ e(t).price.amount = V * 10 ** e(t).price.precision;
1081
+ }),
1082
+ "is-currency": !0,
1083
+ "show-steppers": !1,
1084
+ "helper-text": e(X)(e(c), "price") || `${e(B.Dinero).fromNumber({ number: 1 }).toFormat(!0)} = ${e(B.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1085
+ "helper-state": e(G)(e(c), "price")
1086
+ }, {
1087
+ prepend: T(() => [
1088
+ de(j(e(B.Dinero).defaultCurrency()), 1)
1089
+ ]),
1090
+ _: 1
1091
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1092
+ r(H, {
1093
+ "model-value": e(B.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1094
+ label: e(i)("connect.store.bundle.edit.bundleValue"),
1095
+ min: 0,
1096
+ "max-fraction-digits": 2,
1097
+ "onUpdate:modelValue": n[5] || (n[5] = (V) => {
1098
+ e(t).originalPrice || (e(t).originalPrice = e(B.Dinero).zero().toObject()), e(t).originalPrice.amount = V * 10 ** e(t).originalPrice.precision;
1099
+ }),
1100
+ "is-currency": !0,
1101
+ "show-steppers": !1,
1102
+ "helper-text": e(X)(e(c), "originalPrice") || e(i)("connect.store.bundle.edit.originalPriceHelper"),
1103
+ "helper-state": e(G)(e(c), "originalPrice")
1104
+ }, {
1105
+ prepend: T(() => [
1106
+ de(j(e(B.Dinero).defaultCurrency()), 1)
1107
+ ]),
1108
+ _: 1
1109
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1110
+ e(t).isFeedvibe ? A("", !0) : (g(), I(H, {
1111
+ key: 0,
1112
+ "model-value": e(t).coinPrice ?? null,
1113
+ label: e(i)("connect.store.bundle.edit.pointNeeded"),
1114
+ min: 0,
1115
+ "onUpdate:modelValue": n[6] || (n[6] = (V) => {
1116
+ V > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = V;
1117
+ }),
1118
+ "show-steppers": !1,
1119
+ "helper-state": e(G)(e(c), "coinPrice"),
1120
+ "helper-text": e(X)(e(c), "coinPrice")
1121
+ }, {
1122
+ append: T(() => [
1123
+ de(" point(s) ")
1124
+ ]),
1125
+ _: 1
1126
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1127
+ (Te = e(b).storeOption) != null && Te.stripe && !e(t).isFeedvibe ? (g(), D(J, { key: 1 }, [
1128
+ x("div", tn, j(e(i)("connect.store.bundle.edit.subscriptionSettings")), 1),
1129
+ r(q, {
1130
+ label: e(i)("connect.store.bundle.edit.stripePriceId"),
1131
+ modelValue: e(t).stripePriceId,
1132
+ "onUpdate:modelValue": n[7] || (n[7] = (V) => e(t).stripePriceId = V),
1133
+ "helper-state": e(G)(e(c), "stripePriceId"),
1134
+ "helper-text": e(X)(e(c), "stripePriceId")
1135
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1136
+ e(t).stripePriceId ? (g(), I(H, {
1137
+ key: 0,
1138
+ "model-value": e(t).subscriptionValidity ?? null,
1139
+ min: 1,
1140
+ "onUpdate:modelValue": W,
1141
+ label: e(i)("connect.store.bundle.edit.subscriptionValidity"),
1142
+ "show-steppers": !1,
1143
+ "helper-state": e(G)(e(c), "subscriptionValidity"),
1144
+ "helper-text": e(X)(e(c), "subscriptionValidity")
1145
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : A("", !0)
1146
+ ], 64)) : A("", !0),
1147
+ e(t).isFeedvibe ? A("", !0) : (g(), D(J, { key: 2 }, [
1148
+ nn,
1149
+ r(H, {
1150
+ modelValue: e(t).credit.normal,
1151
+ "onUpdate:modelValue": n[8] || (n[8] = (V) => e(t).credit.normal = V),
1152
+ label: "Normal credit",
1153
+ "show-steppers": !1,
1154
+ "helper-state": e(G)(e(c), "credit.normal"),
1155
+ "helper-text": e(X)(e(c), "credit.normal")
1156
+ }, {
1157
+ append: T(() => [
1158
+ de(" credit ")
1159
+ ]),
1160
+ _: 1
1161
+ }, 8, ["modelValue", "helper-state", "helper-text"]),
1162
+ r(H, {
1163
+ "model-value": ((Ue = e(t).credit.free) == null ? void 0 : Ue.amount) ?? null,
1164
+ min: 0,
1165
+ "onUpdate:modelValue": n[9] || (n[9] = (V) => {
1166
+ e(t).credit.free || (e(t).credit.free = {
1167
+ amount: 0,
1168
+ day: 1
1169
+ }), e(t).credit.free.amount = V;
1170
+ }),
1171
+ label: "Free credit",
1172
+ "show-steppers": !1,
1173
+ "helper-state": e(G)(e(c), "credit.free.amount"),
1174
+ "helper-text": e(X)(e(c), "credit.free.amount")
1175
+ }, {
1176
+ append: T(() => [
1177
+ de(" credit ")
1178
+ ]),
1179
+ _: 1
1180
+ }, 8, ["model-value", "helper-state", "helper-text"]),
1181
+ (Re = e(t).credit.free) != null && Re.amount ? (g(), I(H, {
1182
+ key: 0,
1183
+ disabled: !!e(t).stripePriceId,
1184
+ "model-value": ((Ie = e(t).credit.free) == null ? void 0 : Ie.day) ?? null,
1185
+ min: 0,
1186
+ "onUpdate:modelValue": n[10] || (n[10] = (V) => {
1187
+ e(t).credit.free || (e(t).credit.free = {
1188
+ amount: 0,
1189
+ day: 1
1190
+ }), e(t).credit.free.day = e(N) || V;
1191
+ }),
1192
+ label: "Free credit valid for",
1193
+ "show-steppers": !1,
1194
+ "helper-state": e(G)(e(c), "credit.free.day"),
1195
+ "helper-text": e(X)(e(c), "credit.free.day")
1196
+ }, {
1197
+ append: T(() => [
1198
+ de(" day(s) ")
1199
+ ]),
1200
+ _: 1
1201
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : A("", !0)
1202
+ ], 64)),
1203
+ e(z) ? (g(), D(J, { key: 3 }, [
1204
+ on,
1205
+ r(Xt, {
1206
+ modelValue: e(t).taxes,
1207
+ "onUpdate:modelValue": n[11] || (n[11] = (V) => e(t).taxes = V)
1208
+ }, null, 8, ["modelValue"]),
1209
+ r(q, {
1210
+ label: `Tax Charged (${e(le)})`,
1211
+ "model-value": e($),
1212
+ disabled: ""
1213
+ }, null, 8, ["label", "model-value"])
1214
+ ], 64)) : A("", !0),
1215
+ r(H, {
1216
+ label: "Total Price",
1217
+ "model-value": e(U),
1218
+ disabled: !0
1219
+ }, null, 8, ["model-value"]),
1220
+ x("div", ln, j(e(i)("connect.store.bundle.edit.bundleReward.title")), 1),
1221
+ x("div", an, j(e(i)("connect.store.bundle.edit.bundleReward.description")), 1),
1222
+ x("div", sn, [
1223
+ x("div", rn, [
1224
+ r(at, {
1225
+ label: `Reward type: ${e(l).length == 0 ? "All" : e(l)[0].name}`
1226
+ }, {
1227
+ default: T(() => [
1228
+ r(ie, {
1229
+ onClick: n[12] || (n[12] = (V) => l.value = []),
1230
+ label: "All"
1231
+ }),
1232
+ r(ie, {
1233
+ onClick: n[13] || (n[13] = (V) => l.value = [
1234
+ {
1235
+ id: "type",
1236
+ value: "VOUCHER",
1237
+ name: e(me).VOUCHER.name
1238
+ }
1239
+ ]),
1240
+ label: e(me).VOUCHER.name
1241
+ }, null, 8, ["label"]),
1242
+ r(ie, {
1243
+ onClick: n[14] || (n[14] = (V) => l.value = [
1244
+ {
1245
+ id: "type",
1246
+ value: "TITLE",
1247
+ name: e(me).TITLE.name
1248
+ }
1249
+ ]),
1250
+ label: e(me).TITLE.name
1251
+ }, null, 8, ["label"])
1252
+ ]),
1253
+ _: 1
1254
+ }, 8, ["label"])
1255
+ ]),
1256
+ r(ge, {
1257
+ modelValue: e(L),
1258
+ "onUpdate:modelValue": n[15] || (n[15] = (V) => oe(L) ? L.value = V : null),
1259
+ selection: "multiple",
1260
+ "column-filter": e(l),
1261
+ "column-defs": S,
1262
+ "row-data": e(F).filter(
1263
+ (V) => !e(t).isFeedvibe || V.collectible.type == "VOUCHER"
1264
+ ),
1265
+ "hide-footer": e(F).length <= 10
1266
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1267
+ r(P, {
1268
+ text: e(X)(e(c), "titles"),
1269
+ state: e(G)(e(c), "titles")
1270
+ }, null, 8, ["text", "state"])
1271
+ ]),
1272
+ x("div", dn, j(e(i)("connect.store.bundle.edit.advanceSetting")), 1),
1273
+ x("div", un, [
1274
+ r(C, {
1275
+ "model-value": e(t).internal ?? !1,
1276
+ "onUpdate:modelValue": n[16] || (n[16] = (V) => e(t).internal = V),
1277
+ "label-placement": "right",
1278
+ label: e(i)("connect.store.bundle.edit.internalBundle"),
1279
+ sublabel: e(i)("connect.store.bundle.edit.internalBundleDescription")
1280
+ }, null, 8, ["model-value", "label", "sublabel"]),
1281
+ r(C, {
1282
+ "model-value": e(t).hideInPos ?? !1,
1283
+ "onUpdate:modelValue": n[17] || (n[17] = (V) => e(t).hideInPos = V),
1284
+ "label-placement": "right",
1285
+ label: e(i)("connect.store.bundle.edit.hideInPos"),
1286
+ sublabel: e(i)("connect.store.bundle.edit.hideInPosDescription")
1287
+ }, null, 8, ["model-value", "label", "sublabel"]),
1288
+ r(H, {
1289
+ "model-value": ((Be = (De = e(t).config) == null ? void 0 : De.options) == null ? void 0 : Be.maxPerUser) || null,
1290
+ "onUpdate:modelValue": n[18] || (n[18] = (V) => e(ue).set(e(t), "config.options.maxPerUser", V)),
1291
+ label: e(i)("connect.store.bundle.edit.maxPerUser"),
1292
+ "show-steppers": !1,
1293
+ placeholder: "Unlimited"
1294
+ }, null, 8, ["model-value", "label"])
1295
+ ])
1296
+ ])) : A("", !0)
1297
+ ];
1298
+ }),
1299
+ _: 1
1300
+ }, 8, ["modelValue", "header"]);
1301
+ };
1302
+ }
1303
+ }), pn = { class: "flex gap-8 items-center flex-wrap" }, yn = { class: "flex items-center gap-8" }, fn = /* @__PURE__ */ ee({
1304
+ __name: "SendBundleSheet",
1305
+ emits: ["success"],
1306
+ setup(v, { expose: _, emit: a }) {
1307
+ const { minor: f } = Ee, i = R(), b = R(""), o = R(""), m = R([]), d = R(!1), t = R();
1308
+ R(!0);
1309
+ function u(F) {
1310
+ d.value = !0, b.value = null, o.value = "", i.value = F.bundle;
1311
+ }
1312
+ function y() {
1313
+ d.value = !1;
1314
+ }
1315
+ async function c(F) {
1316
+ const w = await ut.read({
1317
+ limit: 25,
1318
+ skip: 0,
1319
+ sortBy: "_id",
1320
+ search: F,
1321
+ descending: !1
1322
+ });
1323
+ m.value = w.resources.map((N) => ({
1324
+ label: `${N.name} (${N.phoneNumber})`,
1325
+ value: N._id
1326
+ })), await new Promise((N) => setTimeout(N, 100));
1327
+ }
1328
+ async function S() {
1329
+ if (!i.value || !b.value) return;
1330
+ const F = m.value.find(
1331
+ (N) => N.value === b.value
1332
+ );
1333
+ await he.confirm(
1334
+ `Are you sure you want to send bundle ${i.value.name} to ${F == null ? void 0 : F.label}?`,
1335
+ "Confirm",
1336
+ "Confirm",
1337
+ "Cancel"
1338
+ ) && await f(
1339
+ async () => {
1340
+ const N = {
1341
+ bundle: i.value._id,
1342
+ member: b.value,
1343
+ source: nt.enum.ADMIN,
1344
+ ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${o.value}`,
1345
+ withCoin: !1
1346
+ };
1347
+ await _e.sendBundle(N), y();
1348
+ },
1349
+ {
1350
+ message: "Sending bundle",
1351
+ successMessage: "Bundle sent"
1352
+ }
1353
+ );
1354
+ }
1355
+ const l = E(() => {
1356
+ var w, N, W;
1357
+ const F = [];
1358
+ return ((w = i.value) == null ? void 0 : w.price.amount) > 0 && F.push(
1359
+ `${B.Config.getCountry().currency.symbol}${je((N = i.value) == null ? void 0 : N.price)}`
1360
+ ), (W = i.value) != null && W.coinPrice && F.push(`${i.value.coinPrice} point(s)`), F.join(" or ");
1361
+ });
1362
+ return _({
1363
+ showSheet: u,
1364
+ hideSheet: y
1365
+ }), fe(async () => {
1366
+ await c("");
1367
+ }), (F, w) => {
1368
+ const N = h("FmCardMedia"), W = h("FmCardHeader"), Y = h("FmChip"), L = h("FmCardSection"), z = h("FmCard"), le = h("FmSelect"), s = h("FmTextField"), $ = h("FmForm"), U = h("FmButton"), M = h("FmSideSheet");
1369
+ return g(), I(M, {
1370
+ "max-width": 560,
1371
+ "dismiss-away": !0,
1372
+ header: "Send bundle to member",
1373
+ modelValue: e(d),
1374
+ "onUpdate:modelValue": [
1375
+ w[4] || (w[4] = (k) => oe(d) ? d.value = k : null),
1376
+ w[5] || (w[5] = (k) => d.value = k)
1377
+ ]
1378
+ }, {
1379
+ "side-sheet-footer": T(() => [
1380
+ x("div", yn, [
1381
+ r(U, {
1382
+ label: "Send",
1383
+ loading: e(xe)().isLoading,
1384
+ onClick: w[2] || (w[2] = async () => {
1385
+ var k;
1386
+ return (k = e(t)) == null ? void 0 : k.validateInputs();
1387
+ })
1388
+ }, null, 8, ["loading"]),
1389
+ r(U, {
1390
+ label: "Cancel",
1391
+ type: "button",
1392
+ variant: "tertiary",
1393
+ onClick: w[3] || (w[3] = (k) => d.value = !1)
1394
+ })
1395
+ ])
1396
+ ]),
1397
+ default: T(() => [
1398
+ r($, {
1399
+ class: "space-y-16",
1400
+ ref_key: "form",
1401
+ ref: t,
1402
+ onValidationSuccess: S,
1403
+ blameFormChildOnValidationFailed: ""
1404
+ }, {
1405
+ default: T(() => [
1406
+ r(z, {
1407
+ class: "max-w-[700px]",
1408
+ horizontal: "",
1409
+ variant: "outlined"
1410
+ }, {
1411
+ default: T(() => {
1412
+ var k, O;
1413
+ return [
1414
+ (k = e(i)) != null && k.image ? (g(), I(N, {
1415
+ key: 0,
1416
+ width: "100",
1417
+ src: (O = e(i)) == null ? void 0 : O.image
1418
+ }, null, 8, ["src"])) : A("", !0),
1419
+ r(L, { class: "flex flex-col gap-16 justify-between" }, {
1420
+ default: T(() => {
1421
+ var p;
1422
+ return [
1423
+ r(W, {
1424
+ class: "p-0",
1425
+ title: (p = e(i)) == null ? void 0 : p.name,
1426
+ subtitle: e(l)
1427
+ }, null, 8, ["title", "subtitle"]),
1428
+ r(L, { class: "p-0" }, {
1429
+ default: T(() => {
1430
+ var n, C, P, q, K, H, ie, ge, ce, ve, ae;
1431
+ return [
1432
+ x("div", pn, [
1433
+ (n = e(i)) != null && n.isFeedvibe ? (g(), I(Y, {
1434
+ key: 0,
1435
+ label: "Feedvibe"
1436
+ })) : A("", !0),
1437
+ (P = (C = e(i)) == null ? void 0 : C.titles) != null && P.length ? (g(), I(Y, {
1438
+ key: 1,
1439
+ label: `${e(i).titles.length} title(s)`
1440
+ }, null, 8, ["label"])) : A("", !0),
1441
+ (K = (q = e(i)) == null ? void 0 : q.vouchers) != null && K.length ? (g(), I(Y, {
1442
+ key: 2,
1443
+ label: `${e(i).vouchers.length} voucher(s)`
1444
+ }, null, 8, ["label"])) : A("", !0),
1445
+ (ie = (H = e(i)) == null ? void 0 : H.credit) != null && ie.normal || (ve = (ce = (ge = e(i)) == null ? void 0 : ge.credit) == null ? void 0 : ce.free) != null && ve.amount ? (g(), I(Y, {
1446
+ key: 3,
1447
+ label: `${(e(i).credit.normal || 0) + (((ae = e(i).credit.free) == null ? void 0 : ae.amount) || 0)} credit(s)`
1448
+ }, null, 8, ["label"])) : A("", !0)
1449
+ ])
1450
+ ];
1451
+ }),
1452
+ _: 1
1453
+ })
1454
+ ];
1455
+ }),
1456
+ _: 1
1457
+ })
1458
+ ];
1459
+ }),
1460
+ _: 1
1461
+ }),
1462
+ r(le, {
1463
+ modelValue: e(b),
1464
+ "onUpdate:modelValue": w[0] || (w[0] = (k) => oe(b) ? b.value = k : null),
1465
+ label: "Select member",
1466
+ searchable: "",
1467
+ items: e(m),
1468
+ onSearch: c,
1469
+ rules: [(k) => !!k > 0 || "Member is required"],
1470
+ "helper-text": "Type to search member"
1471
+ }, null, 8, ["modelValue", "items", "rules"]),
1472
+ r(s, {
1473
+ modelValue: e(o),
1474
+ "onUpdate:modelValue": w[1] || (w[1] = (k) => oe(o) ? o.value = k : null),
1475
+ label: "Reference (optional)",
1476
+ rules: [
1477
+ (k) => k.length < 50 || "Reference must be less than 50 characters"
1478
+ ]
1479
+ }, null, 8, ["modelValue", "rules"])
1480
+ ]),
1481
+ _: 1
1482
+ }, 512)
1483
+ ]),
1484
+ _: 1
1485
+ }, 8, ["modelValue"]);
1486
+ };
1487
+ }
1488
+ });
1489
+ var bn = { authUrl: "https://portal-v2.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "member.feedme.cc", crmUrl: "crm.feedme.cc", paymentPortalUrl: "https://portal.feedme.cc/payment/payout-account", marketingV1Portal: "https://marketing-v1.feedme.cc" };
1490
+ const gn = { class: "px-24 flex flex-col gap-y-16" }, vn = { class: "flex gap-8 items-center" }, hn = { class: "fm-typo-en-body-lg-600" }, _n = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, xn = /* @__PURE__ */ x("img", {
1491
+ src: We,
1492
+ class: "aspect-square w-[150px]"
1493
+ }, null, -1), Cn = { class: "flex flex-col gap-16 text-center" }, Fn = { class: "fm-typo-en-title-sm-800" }, Vn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, eo = /* @__PURE__ */ ee({
1494
+ __name: "Store",
1495
+ setup(v) {
1496
+ const _ = {
1497
+ label: "Setup payout account",
1498
+ value: "payout",
1499
+ isPrimary: !1
1500
+ }, { t: a } = be(), f = {
1501
+ label: a("connect.store.actions.setting"),
1502
+ value: "setting",
1503
+ isPrimary: !1
1504
+ }, i = {
1505
+ label: a("connect.store.actions.manageReward"),
1506
+ value: "create_reward"
1507
+ }, b = {
1508
+ label: a("connect.store.actions.addCategory"),
1509
+ value: "create_category",
1510
+ isPrimary: !0,
1511
+ prependIcon: "add"
1512
+ }, o = R(), m = ct(), d = $e(), { global: t, minor: u } = Ee, y = Ae(), c = E(() => d.sortedStoreCategories), S = E(() => d.sortedStoreCategories.map((s) => s.name)), l = R(), F = R();
1513
+ async function w(s) {
1514
+ var $;
1515
+ s === "setting" ? ($ = l.value) == null || $.showSheet(!0, d.storeOption) : s === "create_category" ? W(-1) : s === "create_reward" ? await m.push({ name: Ze["$connect-STORE_REWARDS"] }) : s == "payout" && window.open(bn.paymentPortalUrl, "_blank");
1516
+ }
1517
+ async function N(s) {
1518
+ await u(
1519
+ async () => {
1520
+ var $;
1521
+ await _e.updateStore(s), await d.readMemberStore(), ($ = l.value) == null || $.showSheet(!1);
1522
+ },
1523
+ {
1524
+ message: a("connect.store.setting.update.message"),
1525
+ successMessage: a("connect.store.setting.update.success")
1526
+ }
1527
+ );
1528
+ }
1529
+ async function W(s = -1) {
1530
+ var $, U;
1531
+ if ((!d.storeOption || !d.storeOption.company) && await he.confirm(
1532
+ a("connect.store.category.setup.title"),
1533
+ a("connect.store.category.setup.button"),
1534
+ a("connect.store.category.setup.action"),
1535
+ a("connect.common.cancel")
1536
+ ))
1537
+ return ($ = l.value) == null ? void 0 : $.showSheet(!0);
1538
+ y.open({
1539
+ title: s == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
1540
+ contentComponent: $t,
1541
+ contentComponentProps: {
1542
+ initialValue: ((U = c.value[s]) == null ? void 0 : U.name) ?? "",
1543
+ action: s == -1 ? "add" : "edit"
1544
+ }
1545
+ }).onPrimary(async (M) => {
1546
+ M === null && !await he.remove(
1547
+ a("connect.store.category.remove.confirm"),
1548
+ a("connect.store.category.remove.title")
1549
+ ) || await u(
1550
+ async () => {
1551
+ const k = s == -1 ? [...c.value, { name: M, bundles: [] }] : [...c.value].map((O, p) => p == s ? { ...O, name: M } : O).filter((O) => O.name !== null);
1552
+ await _e.updateStoreBundle({
1553
+ categories: k
1554
+ }), await d.readMemberStore();
1555
+ },
1556
+ {
1557
+ message: M === null ? a("connect.store.category.update.deleting") : s == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
1558
+ successMessage: M === null ? a("connect.store.category.update.success.deleted") : s == -1 ? a("connect.store.category.update.success.created") : a("connect.store.category.update.success.updated")
1559
+ }
1560
+ );
1561
+ });
1562
+ }
1563
+ async function Y(s, $, U, M) {
1564
+ var p, n, C;
1565
+ $ ?? ($ = (p = F.value) == null ? void 0 : p.target.category), U ?? (U = (n = F.value) == null ? void 0 : n.target.index), M ?? (M = (C = F.value) == null ? void 0 : C.target.originalCategoryIndex);
1566
+ const k = Ne(c.value);
1567
+ $ != M && (k[M].bundles.splice(U, 1), U = k[$].bundles.length), console.log($, U, M, "ci, bi, originalCategoryIndex");
1568
+ const O = k[$];
1569
+ if (!O) {
1570
+ Ge.error("Unexpected error", 2e3);
1571
+ return;
1572
+ }
1573
+ if (s == null) {
1574
+ if (await he.remove(
1575
+ "Are you sure you want to delete this bundle?",
1576
+ "Delete bundle"
1577
+ ) == !1)
1578
+ return;
1579
+ O.bundles.splice(U, 1);
1580
+ } else
1581
+ U == -1 ? O.bundles.push(s) : O.bundles[U] = s;
1582
+ await u(
1583
+ async () => {
1584
+ var P, q;
1585
+ if (s != null) {
1586
+ const K = (P = F.value) == null ? void 0 : P.bundleImage;
1587
+ K === null && s.image ? (await Fe.delete(s.image), s.image = null) : K && (s.image = await Fe.update(
1588
+ Fe.bundleImagePath(void 0, K),
1589
+ K
1590
+ ));
1591
+ }
1592
+ await _e.updateStoreBundle({
1593
+ categories: k
1594
+ }), await d.readMemberStore(), await d.readMembership(), await d.readRewards(), (q = F.value) == null || q.showSheet(!1);
1595
+ },
1596
+ {
1597
+ message: `${s == null ? "Deleting" : U == -1 ? "Creating" : "Updating"} bundle`,
1598
+ successMessage: `Bundle ${s == null ? "deleted" : U == -1 ? "created" : "updated"} successfully`
1599
+ }
1600
+ );
1601
+ }
1602
+ function L(s) {
1603
+ var $;
1604
+ ($ = F.value) == null || $.showSheet(!0, {
1605
+ ...s,
1606
+ bundle: s.bundle ? Ne(s.bundle) : void 0
1607
+ });
1608
+ }
1609
+ const z = R([]);
1610
+ function le(s) {
1611
+ var $;
1612
+ ($ = o.value) == null || $.showSheet({
1613
+ bundle: s
1614
+ });
1615
+ }
1616
+ return fe(async () => {
1617
+ var s, $;
1618
+ await t(async () => {
1619
+ var U, M;
1620
+ if (await d.readMemberStore(), await d.readMembership(), await d.readRewards(), await d.readPayoutAccount(), (U = m.currentRoute.value.query) != null && U.action) {
1621
+ switch ((M = m.currentRoute.value.query) == null ? void 0 : M.action) {
1622
+ case "update_setting":
1623
+ w("setting");
1624
+ break;
1625
+ case "create_category":
1626
+ W(-1);
1627
+ break;
1628
+ case "create_feedvibe_bundle":
1629
+ y.open({
1630
+ title: "Select category",
1631
+ contentComponent: Ut
1632
+ }).onPrimary((k) => {
1633
+ y.close(), L({
1634
+ categories: S.value,
1635
+ category: k,
1636
+ index: -1,
1637
+ bundle: {
1638
+ ...ue.cloneDeep(Se),
1639
+ isFeedvibe: !0,
1640
+ price: B.Dinero.fromNumber({
1641
+ number: 10,
1642
+ precision: 2
1643
+ }).toObject()
1644
+ }
1645
+ });
1646
+ }).onTertiary(() => y.close());
1647
+ break;
1648
+ }
1649
+ m.replace({ query: {} });
1650
+ }
1651
+ }), z.value = [f, i, b], (((s = d.payoutAccount) == null ? void 0 : s.status) != "APPROVED" || (($ = d.payoutAccount) == null ? void 0 : $.enable) != !0) && (z.value = [
1652
+ _,
1653
+ f,
1654
+ i,
1655
+ b
1656
+ ]);
1657
+ }), (s, $) => {
1658
+ const U = h("FmPageHead"), M = h("FmButton"), k = h("FmCard");
1659
+ return g(), D(J, null, [
1660
+ r(U, {
1661
+ title: e(a)("connect.store.title"),
1662
+ actions: e(z),
1663
+ "onClick:action": w
1664
+ }, null, 8, ["title", "actions"]),
1665
+ x("div", gn, [
1666
+ e(c) && e(c).length > 0 ? (g(), D(J, { key: 0 }, [
1667
+ (g(!0), D(J, null, re(e(c), (O, p) => (g(), D("div", {
1668
+ key: O.name,
1669
+ class: "space-y-8 py-12"
1670
+ }, [
1671
+ x("div", vn, [
1672
+ x("div", hn, j(O.name), 1),
1673
+ r(ke, { json: O }, null, 8, ["json"]),
1674
+ r(M, {
1675
+ icon: "edit",
1676
+ size: "md",
1677
+ variant: "tertiary",
1678
+ onClick: (n) => W(p)
1679
+ }, null, 8, ["onClick"])
1680
+ ]),
1681
+ x("div", _n, [
1682
+ (g(!0), D(J, null, re(O.bundles, (n, C) => (g(), I(Ct, {
1683
+ bundle: n,
1684
+ key: n._id,
1685
+ onEdit: (P) => L({
1686
+ bundle: n,
1687
+ category: p,
1688
+ index: C,
1689
+ categories: e(S)
1690
+ }),
1691
+ onDelete: (P) => Y(null, p, C),
1692
+ onSend: le
1693
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1694
+ r(Ft, {
1695
+ onCreate: (n) => L({
1696
+ category: p,
1697
+ index: -1,
1698
+ categories: e(S)
1699
+ })
1700
+ }, null, 8, ["onCreate"])
1701
+ ])
1702
+ ]))), 128)),
1703
+ r(mn, {
1704
+ ref_key: "bundleSheetRef",
1705
+ ref: F,
1706
+ onUpdate: Y
1707
+ }, null, 512)
1708
+ ], 64)) : (g(), I(k, {
1709
+ key: 1,
1710
+ variant: "outlined",
1711
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1712
+ }, {
1713
+ default: T(() => [
1714
+ xn,
1715
+ x("div", Cn, [
1716
+ x("div", Fn, j(e(a)("connect.store.bundle.title")), 1),
1717
+ x("div", Vn, j(e(a)("connect.store.bundle.description")), 1)
1718
+ ]),
1719
+ r(M, {
1720
+ variant: "primary",
1721
+ label: e(a)("connect.store.actions.addCategory"),
1722
+ icon: "add",
1723
+ onClick: $[0] || ($[0] = (O) => W(-1))
1724
+ }, null, 8, ["label"])
1725
+ ]),
1726
+ _: 1
1727
+ })),
1728
+ r(Jt, {
1729
+ ref_key: "settingSheetRef",
1730
+ ref: l,
1731
+ onUpdate: N
1732
+ }, null, 512),
1733
+ r(fn, {
1734
+ ref_key: "sendBundleSheetRef",
1735
+ ref: o
1736
+ }, null, 512)
1737
+ ])
1738
+ ], 64);
1739
+ };
1740
+ }
1741
+ });
1742
+ export {
1743
+ eo as default
1744
+ };