@feedmepos/mf-connect 0.1.3-prod → 0.1.4-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 (87) hide show
  1. package/dist/Analytic-07T9poLx.js +423 -0
  2. package/dist/{App-DvtYt9h5.js → App-C6MukSCT.js} +276 -275
  3. package/dist/Broadcast-CzsgeZNO.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DoH4RX_Y.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BirunpzI.js} +8 -8
  5. package/dist/Card-DQnyWZZf.js +824 -0
  6. package/dist/{Collections-C5-k8WkG.js → Collections-BV7CSqRw.js} +4 -4
  7. package/dist/Credit-CxsbYGLZ.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DCbvlp5V.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKSZYxvb.js} +918 -901
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DpsrI-Z3.js +345 -0
  10. package/dist/Experience-eMUbhq7h.js +221 -0
  11. package/dist/Game-CxAG2ViS.js +255 -0
  12. package/dist/Marketing-CozMj2Y5.js +316 -0
  13. package/dist/Member-DM1dj3F5.js +69 -0
  14. package/dist/{MemberList-CMefeirT.js → MemberList-DNjK9BbG.js} +14 -14
  15. package/dist/{MemberTransactions-B9oYdzjR.js → MemberTransactions-CsjN3LZA.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-B0T7ze7r.js → MessageInput.vue_vue_type_script_setup_true_lang-DVQE9v2R.js} +2 -2
  17. package/dist/Mission-BugvTPPH.js +261 -0
  18. package/dist/Point-D8BjGtqT.js +222 -0
  19. package/dist/Promotion-mc9KBzoJ.js +253 -0
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BGM1doWM.js → RuleGroup.vue_vue_type_script_setup_true_lang-B2H3D_kZ.js} +15 -15
  21. package/dist/Segment-DZRFA-Pb.js +565 -0
  22. package/dist/Setting-DxNhR44e.js +1871 -0
  23. package/dist/Store-CdkJWpjV.js +1530 -0
  24. package/dist/StoreRewards-Cdturia8.js +400 -0
  25. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-JumDBZLs.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D7GcOiUM.js} +10 -10
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BtBCggcN.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-nuCOrrLE.js} +1 -1
  27. package/dist/{Tier-ms8r2E7c.js → Tier-I_MMd39Y.js} +470 -445
  28. package/dist/{Title-BBKoBs46.js → Title-DK5gmUvo.js} +298 -282
  29. package/dist/Transaction-BXpTIMS_.js +39 -0
  30. package/dist/Voucher-BQ5h2G0I.js +490 -0
  31. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js +141 -0
  32. package/dist/app-CL2Wxzv5.js +5639 -0
  33. package/dist/{app-CGgrMOc_.js → app-DTAyCT-G.js} +1 -1
  34. package/dist/app.js +4 -3
  35. package/dist/{business-DeMUnCNX.js → business-B9OUlaFZ.js} +1 -1
  36. package/dist/{campaign-CBszI6An.js → campaign-CNbUA51l.js} +2 -2
  37. package/dist/{collection.fn-D4Qgx1aW.js → collection.fn-D_i45T4Q.js} +2 -2
  38. package/dist/dto-B4208_es.js +2770 -0
  39. package/dist/{effect-2p4_SGbQ.js → effect-Ye_yr8et.js} +1 -1
  40. package/dist/{email-addresses-Bc9od2gA.js → email-addresses-Gm7Dyaxy.js} +1 -1
  41. package/dist/{export-BK6FgeQO.js → export-Buee5oUV.js} +3 -3
  42. package/dist/{helper-DUkKW7uc.js → helper-BBlHhMFc.js} +1 -1
  43. package/dist/{index-BWWnWRpt.js → index-BxJgFvym.js} +2 -2
  44. package/dist/{index-g4L04WYz.js → index-ByaM-yoc.js} +91 -86
  45. package/dist/{index-B9f-K1No.js → index-C0QHb5SL.js} +2 -2
  46. package/dist/{index-M1SmasnI.js → index-C363BG5A.js} +3 -3
  47. package/dist/{index-Ci8tkzSn.js → index-CLL3no-v.js} +1 -1
  48. package/dist/{index-Cvbyv9Hx.js → index-ChSVaFk3.js} +1 -1
  49. package/dist/{index-D4HYMbSu.js → index-Co9n8I_5.js} +3 -3
  50. package/dist/index-CoGNKU8v.js +3 -0
  51. package/dist/{index-BFcrfL4W.js → index-DHGcUMVN.js} +1 -1
  52. package/dist/{index-CTmiZrHu.js → index-DWWtZSrm.js} +1 -1
  53. package/dist/{index-DRaETKbn.js → index-DdVZgYE4.js} +258 -256
  54. package/dist/{index-AZ8cKg9n.js → index-Dx3HwWcb.js} +1 -1
  55. package/dist/{index.esm2017-kvuav0Sd.js → index.esm2017-Dd02dg_O.js} +38 -38
  56. package/dist/{loading-MNCADfHc.js → loading-Or1ZDzDS.js} +11 -11
  57. package/dist/{membership-CsbTF-DX.js → membership-B8h5ku-v.js} +3 -3
  58. package/dist/{money-Lo7kavmu.js → money-CmsKAJBT.js} +1 -1
  59. package/dist/{number-BviV2K5O.js → number-iEhp7Uai.js} +1 -1
  60. package/dist/{rule-DKrUrnrM.js → rule-BORkgSMK.js} +3 -3
  61. package/dist/{rule-builder-DjPniLk6.js → rule-builder-DEfkSr68.js} +1 -1
  62. package/dist/{template-DteMEC9C.js → template-C_Y7bhlI.js} +4 -4
  63. package/dist/{usePagination-BKTq-UbV.js → usePagination-Ci8-uZvb.js} +1 -1
  64. package/dist/vue-i18n-BXzrZRP6.js +2365 -0
  65. package/package.json +7 -4
  66. package/dist/Analytic-DiPWt78u.js +0 -423
  67. package/dist/Broadcast-Dv4XcvBh.js +0 -216
  68. package/dist/Card-DDvwlZF0.js +0 -823
  69. package/dist/Credit-BDQIr_FJ.js +0 -214
  70. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BQzgcn4V.js +0 -344
  71. package/dist/Experience-B9H3tOF0.js +0 -211
  72. package/dist/Game-cy3_ppLO.js +0 -250
  73. package/dist/Marketing-CWXV2n5F.js +0 -309
  74. package/dist/Member-DyTX22Zk.js +0 -92
  75. package/dist/Mission-DxSO3iES.js +0 -248
  76. package/dist/Point-C5UtlqkX.js +0 -220
  77. package/dist/Promotion-DhSGTj-R.js +0 -244
  78. package/dist/Segment-BzI6Ykxp.js +0 -564
  79. package/dist/Setting-SRUWwF9w.js +0 -1870
  80. package/dist/Store-CIrn_7Mh.js +0 -1533
  81. package/dist/StoreRewards-BYc0vgnr.js +0 -429
  82. package/dist/Transaction-IZL9-6fe.js +0 -36
  83. package/dist/Voucher-CIWulmcc.js +0 -485
  84. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  85. package/dist/app-BQvluJk_.js +0 -2974
  86. package/dist/dto-Dtvg93Bz.js +0 -1145
  87. package/dist/index-UR1Lxi0C.js +0 -11
@@ -0,0 +1,1530 @@
1
+ import { defineComponent as X, computed as I, resolveComponent as F, openBlock as _, createBlock as O, withCtx as T, createElementVNode as x, createElementBlock as P, createVNode as i, createCommentVNode as E, toDisplayString as D, unref as e, Fragment as q, renderList as le, ref as N, isRef as ie, reactive as je, onMounted as ye, watch as Ve, toRaw as Le, createTextVNode as se, h as qe } from "vue";
2
+ import { _ as He } from "./tier-BJDhpH6X.js";
3
+ import { useDialog as Ne, useDialogChild as Oe, components as Ke } from "@feedmepos/ui-library";
4
+ import { c as U, e as be, S as We } from "./index-Co9n8I_5.js";
5
+ import { d as oe, a as ze, u as Ye, p as ge, n as Je, f as ve } from "./loading-Or1ZDzDS.js";
6
+ import { u as Fe, C as ce } from "./membership-B8h5ku-v.js";
7
+ import { a as Ge, c as De } from "./object-qECH92oz.js";
8
+ import { _ as re } from "./lodash-B5I3zXaY.js";
9
+ import { u as pe } from "./vue-i18n-BXzrZRP6.js";
10
+ import { Z as Y, _ as Q, g as W, a as z } from "./ZodTextField.vue_vue_type_script_setup_true_lang-eAP99wyg.js";
11
+ import { z as J, R as Xe } from "./app-CL2Wxzv5.js";
12
+ import { F as Ze, a as Qe, b as et, c as Be } from "./index-C0QHb5SL.js";
13
+ import { u as xe } from "./app-wDQR6dpb.js";
14
+ import { J as Se } from "./JsonViewer-v8_C7l5N.js";
15
+ import { _ as tt } from "./index-ChSVaFk3.js";
16
+ import { _ as ot } from "./ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js";
17
+ import { _ as nt } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
18
+ import { z as lt, a as at } from "./money-CmsKAJBT.js";
19
+ import { F as st } from "./number-iEhp7Uai.js";
20
+ import { t as rt } from "./helper-BBlHhMFc.js";
21
+ import "./index-CoGNKU8v.js";
22
+ import { useRouter as it } from "vue-router";
23
+ import { m as he } from "./index-DHGcUMVN.js";
24
+ function dt(b) {
25
+ return oe.DineroFactory(b).toUnit();
26
+ }
27
+ function ct(b, h, a, y, m = [], g = []) {
28
+ const n = tt.compact(
29
+ h.map((t) => b.find((r) => r.systemCode === t.systemCode && r.taxCode === t.taxCode)).filter((t) => !!t && g.includes(t.systemCode))
30
+ ), s = n.reduce(
31
+ (t, r) => {
32
+ var u;
33
+ return Object.assign(t, {
34
+ [r.taxCode]: {
35
+ inclusive: ((u = m.find((d) => d.systemCode === r.systemCode)) == null ? void 0 : u.inclusive) || !1,
36
+ adjustment: {
37
+ level: 1,
38
+ type: {
39
+ type: "BY_MULTIPLIER",
40
+ amount: {
41
+ amount: r.rate.amount,
42
+ precision: r.rate.precision,
43
+ currency: "MYR"
44
+ }
45
+ }
46
+ }
47
+ }
48
+ });
49
+ },
50
+ {}
51
+ ), f = oe.Calculator.calculate({
52
+ items: {
53
+ 0: {
54
+ quantity: 1,
55
+ adjustments: {
56
+ price: {
57
+ level: 0,
58
+ type: {
59
+ type: "BY_AMOUNT",
60
+ amount: oe.DineroFactory(a).subtract(oe.Dinero.fromNumber({ number: y }).toObject()).toObject()
61
+ }
62
+ }
63
+ },
64
+ taxes: s
65
+ }
66
+ },
67
+ adjustments: {},
68
+ roundToNearest: 0
69
+ });
70
+ return n.map((t) => ({
71
+ setting: t,
72
+ systemCode: t.systemCode,
73
+ name: t.name,
74
+ taxCode: t.taxCode,
75
+ rate: t.rate,
76
+ total: oe.DineroFactory({
77
+ ...f.items[0].taxes[t.taxCode]
78
+ }).convertPrecision(2).toObject()
79
+ }));
80
+ }
81
+ function ut(b, h, a) {
82
+ return b ? b.reduce((y, m) => {
83
+ var g;
84
+ return (g = a.find((n) => n.systemCode === m.systemCode)) != null && g.inclusive || (y = oe.DineroFactory(y.toObject()).add(m.total)), y;
85
+ }, oe.DineroFactory(h)).toObject() : oe.DineroFactory(h).toObject();
86
+ }
87
+ const mt = { class: "relative h-[120px] aspect-video flex items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, pt = ["src"], yt = {
88
+ key: 2,
89
+ class: "absolute top-2 left-2"
90
+ }, ft = { class: "absolute top-0 right-0" }, bt = { class: "fm-typo-en-body-lg-600" }, gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vt = { class: "flex gap-8 items-center flex-wrap" }, ht = /* @__PURE__ */ X({
91
+ __name: "StoreBundleCard",
92
+ props: {
93
+ bundle: { type: Object, required: !0 }
94
+ },
95
+ emits: ["edit", "delete"],
96
+ setup(b, { emit: h }) {
97
+ const a = b, y = h, m = I(() => {
98
+ const n = [];
99
+ return a.bundle.price.amount > 0 && n.push(
100
+ `${U.Config.getCountry().currency.symbol}${dt(a.bundle.price)}`
101
+ ), a.bundle.coinPrice && n.push(`${a.bundle.coinPrice} point(s)`), n.join(" or ");
102
+ }), g = I(() => {
103
+ var s, f;
104
+ const n = [];
105
+ if (a.bundle.titles.length > 0 && n.push(`${a.bundle.titles.length} title(s)`), a.bundle.vouchers.length > 0 && n.push(`${a.bundle.vouchers.length} voucher(s)`), a.bundle.credit.normal || (s = a.bundle.credit.free) != null && s.amount) {
106
+ const t = a.bundle.credit.normal + (((f = a.bundle.credit.free) == null ? void 0 : f.amount) ?? 0);
107
+ n.push(`${t} credit(s)`);
108
+ }
109
+ return n;
110
+ });
111
+ return (n, s) => {
112
+ const f = F("FmIcon"), t = F("FmChip"), r = F("FmButton"), u = F("FmMenuItem"), d = F("FmMenu"), V = F("FmCard");
113
+ return _(), O(V, {
114
+ variant: "outlined",
115
+ class: "flex flex-col gap-y-8 p-16 min-h-[240px] h-full text-center items-center"
116
+ }, {
117
+ default: T(() => [
118
+ x("div", mt, [
119
+ b.bundle.image ? (_(), P("img", {
120
+ key: 1,
121
+ src: b.bundle.image,
122
+ class: "w-full h-full object-contain aspect-video"
123
+ }, null, 8, pt)) : (_(), O(f, {
124
+ key: 0,
125
+ name: "image",
126
+ outline: !0,
127
+ size: "md",
128
+ class: "text-fm-color-neutral-gray-200"
129
+ })),
130
+ b.bundle.isFeedvibe ? (_(), P("div", yt, [
131
+ i(t, {
132
+ label: "Feedvibe",
133
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
134
+ compact: ""
135
+ })
136
+ ])) : E("", !0),
137
+ x("div", ft, [
138
+ i(d, { placement: "bottom-end" }, {
139
+ "menu-button": T(() => [
140
+ i(r, {
141
+ icon: "more_vert",
142
+ variant: "tertiary"
143
+ })
144
+ ]),
145
+ default: T(() => [
146
+ i(u, {
147
+ onClick: s[0] || (s[0] = (l) => y("edit", b.bundle)),
148
+ label: "Edit"
149
+ }),
150
+ i(u, {
151
+ onClick: s[1] || (s[1] = (l) => y("delete", b.bundle)),
152
+ label: "Delete"
153
+ })
154
+ ]),
155
+ _: 1
156
+ })
157
+ ])
158
+ ]),
159
+ x("div", bt, D(b.bundle.name), 1),
160
+ x("div", gt, D(e(m) || "Free"), 1),
161
+ x("div", vt, [
162
+ (_(!0), P(q, null, le(e(g), (l, k) => (_(), O(t, {
163
+ key: k,
164
+ label: l
165
+ }, null, 8, ["label"]))), 128))
166
+ ])
167
+ ]),
168
+ _: 1
169
+ });
170
+ };
171
+ }
172
+ }), _t = /* @__PURE__ */ X({
173
+ __name: "AddBundleCard",
174
+ emits: ["create"],
175
+ setup(b, { emit: h }) {
176
+ const { t: a } = pe(), y = h;
177
+ return (m, g) => {
178
+ const n = F("FmButton"), s = F("FmCard");
179
+ return _(), O(s, {
180
+ variant: "outlined",
181
+ class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
182
+ }, {
183
+ default: T(() => [
184
+ i(n, {
185
+ onClick: g[0] || (g[0] = (f) => y("create")),
186
+ label: e(a)("connect.store.actions.addBundle"),
187
+ icon: "add",
188
+ variant: "secondary"
189
+ }, null, 8, ["label"])
190
+ ]),
191
+ _: 1
192
+ });
193
+ };
194
+ }
195
+ }), xt = { class: "space-y-16" }, Ct = { class: "flex w-full justify-between pb-16" }, Vt = { class: "flex items-center justify-end gap-8" }, Ft = /* @__PURE__ */ X({
196
+ __name: "CategoryDialog",
197
+ props: {
198
+ action: {
199
+ type: String,
200
+ default: () => "add"
201
+ },
202
+ initialValue: {
203
+ type: String,
204
+ default: () => ""
205
+ }
206
+ },
207
+ setup(b) {
208
+ const { t: h } = pe(), a = b, y = Ne(), { emitData: m, emitAction: g } = Oe(), n = N(a.initialValue), s = J.string().min(1);
209
+ function f() {
210
+ m(n.value), g("primary"), y.close();
211
+ }
212
+ function t() {
213
+ m(null), g("primary"), y.close();
214
+ }
215
+ return (r, u) => {
216
+ const d = F("FmTextField"), V = F("FmButton");
217
+ return _(), P("div", xt, [
218
+ i(d, {
219
+ modelValue: e(n),
220
+ "onUpdate:modelValue": u[0] || (u[0] = (l) => ie(n) ? n.value = l : null),
221
+ label: e(h)("connect.store.category.label"),
222
+ rules: [e(Y).toRule(e(s))]
223
+ }, null, 8, ["modelValue", "label", "rules"]),
224
+ x("div", Ct, [
225
+ x("div", null, [
226
+ b.action == "edit" ? (_(), O(V, {
227
+ key: 0,
228
+ onClick: t,
229
+ label: e(h)("connect.common.delete"),
230
+ variant: "destructive"
231
+ }, null, 8, ["label"])) : E("", !0)
232
+ ]),
233
+ x("div", Vt, [
234
+ i(V, {
235
+ label: e(h)("connect.common.cancel"),
236
+ variant: "tertiary",
237
+ onClick: u[1] || (u[1] = (l) => e(y).close())
238
+ }, null, 8, ["label"]),
239
+ i(V, {
240
+ label: b.action == "edit" ? e(h)("connect.common.edit") : e(h)("connect.common.add"),
241
+ disabled: !e(n),
242
+ onClick: f
243
+ }, null, 8, ["label", "disabled"])
244
+ ])
245
+ ])
246
+ ]);
247
+ };
248
+ }
249
+ }), St = { class: "space-y-16" }, wt = /* @__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), $t = { class: "flex items-center justify-end gap-8 pb-16" }, Pt = /* @__PURE__ */ X({
250
+ __name: "SelectCategoryDialog",
251
+ setup(b) {
252
+ const { emitData: h, emitAction: a } = Oe(), y = Fe(), m = N(), g = I(
253
+ () => y.sortedStoreCategories.map((n, s) => ({
254
+ label: n.name,
255
+ value: s
256
+ }))
257
+ );
258
+ return (n, s) => {
259
+ const f = F("FmSelect"), t = F("FmButton");
260
+ return _(), P("div", St, [
261
+ wt,
262
+ i(f, {
263
+ placeholder: "Select a category",
264
+ items: e(g),
265
+ modelValue: e(m),
266
+ "onUpdate:modelValue": [
267
+ s[0] || (s[0] = (r) => ie(m) ? m.value = r : null),
268
+ s[1] || (s[1] = (r) => e(h)(r))
269
+ ],
270
+ label: "Category"
271
+ }, null, 8, ["items", "modelValue"]),
272
+ x("div", $t, [
273
+ i(t, {
274
+ variant: "tertiary",
275
+ label: "Cancel",
276
+ onClick: s[2] || (s[2] = (r) => e(a)("tertiary"))
277
+ }),
278
+ i(t, {
279
+ label: "Select",
280
+ onClick: s[3] || (s[3] = (r) => e(a)("primary")),
281
+ disabled: e(m) == null
282
+ }, null, 8, ["disabled"])
283
+ ])
284
+ ]);
285
+ };
286
+ }
287
+ });
288
+ function _e(b) {
289
+ return b.states.map((h) => ({ label: h, value: h }));
290
+ }
291
+ const kt = {
292
+ [be.F_COUNTRY.enum.MY]: {
293
+ states: [
294
+ "Johor",
295
+ "Kedah",
296
+ "Kelantan",
297
+ "Kuala Lumpur",
298
+ "Labuan",
299
+ "Melaka",
300
+ "Negeri Sembilan",
301
+ "Pahang",
302
+ "Perak",
303
+ "Perlis",
304
+ "Pulau Pinang",
305
+ "Putrajaya",
306
+ "Sabah",
307
+ "Sarawak",
308
+ "Selangor",
309
+ "Terengganu"
310
+ ],
311
+ get stateItems() {
312
+ return _e(this);
313
+ }
314
+ },
315
+ [be.F_COUNTRY.enum.SG]: {
316
+ states: [],
317
+ get stateItems() {
318
+ return _e(this);
319
+ }
320
+ },
321
+ [be.F_COUNTRY.enum.ID]: {
322
+ states: [
323
+ "Aceh",
324
+ "Bali",
325
+ "Bangka-Belitung",
326
+ "Banten",
327
+ "Bengkulu",
328
+ "Central Java",
329
+ "Central Sulawesi",
330
+ "Daerah Istimewa Yogyakarta",
331
+ "East Java",
332
+ "East Kalimantan",
333
+ "East Nusa Tenggara",
334
+ "Gorontalo",
335
+ "Jakarta Raya",
336
+ "Jambi",
337
+ "Kalimantan Tengah",
338
+ "Lampung",
339
+ "Maluku",
340
+ "Maluku Utara",
341
+ "North Sulawesi",
342
+ "North Sumatra",
343
+ "Nusa Tenggara Barat",
344
+ "Papua",
345
+ "Riau",
346
+ "Riau Islands",
347
+ "South Kalimantan",
348
+ "South Sulawesi",
349
+ "South Sumatra",
350
+ "Sulawesi Barat",
351
+ "Sulawesi Tenggara",
352
+ "West Java",
353
+ "West Kalimantan",
354
+ "West Papua",
355
+ "West Sumatra"
356
+ ],
357
+ get stateItems() {
358
+ return _e(this);
359
+ }
360
+ }
361
+ }, ue = () => U.Config.getCountry(), me = {
362
+ get fullCurrency() {
363
+ return ue().currency;
364
+ },
365
+ get currency() {
366
+ return ue().currency.code;
367
+ },
368
+ get fullTax() {
369
+ return U.Country.getCountryFlattenTaxes(ue().code);
370
+ },
371
+ get taxSystem() {
372
+ return ue().taxSystems;
373
+ },
374
+ taxInclusion(b) {
375
+ return me.taxSystem.map((h) => ({
376
+ systemCode: h.code,
377
+ inclusive: b !== void 0 ? b : !1
378
+ }));
379
+ },
380
+ groupedTaxOptions() {
381
+ const b = U.Country.getCountryFlattenTaxes(ue().code);
382
+ return me.taxSystem.map((h) => ({
383
+ code: h.code,
384
+ options: b.map((a) => ({ ...a, feedmeTaxCode: me.generateCode(a) })).filter((a) => a.systemCode === h.code)
385
+ }));
386
+ },
387
+ systemDefaultCode(b) {
388
+ const h = me.groupedTaxOptions().find((a) => a.code === b);
389
+ return h == null ? void 0 : h.options.find((a) => a.default);
390
+ },
391
+ generateCode(b) {
392
+ return `${b.systemCode}/${b.taxCode}`;
393
+ }
394
+ }, ee = me, Tt = /* @__PURE__ */ X({
395
+ __name: "TaxInclusiveSetting",
396
+ props: {
397
+ modelValue: {
398
+ type: Array,
399
+ required: !0,
400
+ default: () => []
401
+ }
402
+ },
403
+ emits: ["update:model-value"],
404
+ setup(b, { emit: h }) {
405
+ const a = b, y = ee.taxSystem, m = h, g = N(a.modelValue);
406
+ function n(r, u) {
407
+ const d = re.clone(a.modelValue), V = d.findIndex((l) => l.systemCode === r);
408
+ V >= 0 ? d[V].inclusive = u : d.push({
409
+ systemCode: r,
410
+ inclusive: u
411
+ }), g.value = d, m("update:model-value", d);
412
+ }
413
+ function s() {
414
+ return y.map((r) => {
415
+ const u = a.modelValue ? a.modelValue.find((d) => d.systemCode === r.code) : !1;
416
+ return {
417
+ label: r.name,
418
+ config: {
419
+ value: u ? u.inclusive : !1
420
+ },
421
+ input: (d) => {
422
+ n(r.code, d);
423
+ }
424
+ };
425
+ });
426
+ }
427
+ const f = je(s());
428
+ function t(r, u) {
429
+ return `${r} ${u ? "Inclusive" : "Exclusive"}`;
430
+ }
431
+ return ye(() => {
432
+ a.modelValue.length || n(y[0].code, !1);
433
+ }), Ve(
434
+ () => a.modelValue,
435
+ (r, u) => {
436
+ r != u && !r.length && n(y[0].code, !1);
437
+ }
438
+ ), (r, u) => {
439
+ const d = F("FmSwitch");
440
+ return _(!0), P(q, null, le(e(f), (V, l) => {
441
+ var k;
442
+ return _(), P("div", { key: l }, [
443
+ i(d, {
444
+ "model-value": ((k = e(g)[l]) == null ? void 0 : k.inclusive) || !1,
445
+ "label-placement": "left",
446
+ "onUpdate:modelValue": (M) => V.input(M)
447
+ }, {
448
+ label: T(() => {
449
+ var M;
450
+ return [
451
+ x("div", null, D(t(V.label, ((M = e(g)[l]) == null ? void 0 : M.inclusive) || !1)), 1)
452
+ ];
453
+ }),
454
+ _: 2
455
+ }, 1032, ["model-value", "onUpdate:modelValue"])
456
+ ]);
457
+ }), 128);
458
+ };
459
+ }
460
+ });
461
+ var Ut = { mode: "production", appMode: "mf" };
462
+ const Rt = { class: "space-y-8" }, It = {
463
+ key: 0,
464
+ class: "space-y-16"
465
+ }, Dt = /* @__PURE__ */ X({
466
+ __name: "StripeSetting",
467
+ props: {
468
+ modelValue: {}
469
+ },
470
+ emits: ["update:modelValue"],
471
+ setup(b, { emit: h }) {
472
+ const a = b, y = h, m = N(!1);
473
+ Ve(m, (n, s) => {
474
+ s != n && (!a.modelValue && n ? y("update:modelValue", {
475
+ apiKey: "",
476
+ webhookSecret: ""
477
+ }) : n || y("update:modelValue", void 0));
478
+ });
479
+ const g = I(() => {
480
+ const n = Ut.mode === "development", s = U.Config.getCountry().code.toLowerCase(), f = s != "my" ? `.${s}` : "";
481
+ return `https://marketing${n ? "-dev" : ""}${f}.feedmeapi.com/stripe/${We.getBusinessId()}/webhook`;
482
+ });
483
+ return ye(() => {
484
+ m.value = !!a.modelValue;
485
+ }), (n, s) => {
486
+ const f = F("FmSwitch"), t = F("FmTextField"), r = F("FmButton");
487
+ return _(), P("div", Rt, [
488
+ i(f, {
489
+ modelValue: e(m),
490
+ "onUpdate:modelValue": s[0] || (s[0] = (u) => ie(m) ? m.value = u : null),
491
+ value: "true",
492
+ label: "Enable Stripe"
493
+ }, null, 8, ["modelValue"]),
494
+ a.modelValue ? (_(), P("div", It, [
495
+ i(t, {
496
+ label: "API Key",
497
+ modelValue: a.modelValue.apiKey,
498
+ "onUpdate:modelValue": s[1] || (s[1] = (u) => a.modelValue.apiKey = u),
499
+ "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
500
+ }, null, 8, ["modelValue"]),
501
+ i(t, {
502
+ label: "Webhook URL",
503
+ "model-value": e(g),
504
+ readonly: "",
505
+ "helper-text": "Copy this URL to your Stripe dashboard"
506
+ }, {
507
+ append: T(() => [
508
+ i(r, {
509
+ icon: "content_copy",
510
+ variant: "tertiary",
511
+ onClick: s[2] || (s[2] = (u) => e(ze)(e(g)))
512
+ })
513
+ ]),
514
+ _: 1
515
+ }, 8, ["model-value"]),
516
+ i(t, {
517
+ modelValue: a.modelValue.webhookSecret,
518
+ "onUpdate:modelValue": s[3] || (s[3] = (u) => a.modelValue.webhookSecret = u),
519
+ label: "Webhook Secret",
520
+ "helper-text": `Copy the webhook signing secret from your Stripe account and paste
521
+ here.`
522
+ }, null, 8, ["modelValue"])
523
+ ])) : E("", !0)
524
+ ]);
525
+ };
526
+ }
527
+ }), Bt = {
528
+ key: 0,
529
+ class: "space-y-16 pr-12"
530
+ }, Nt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Ot = {
531
+ key: 1,
532
+ class: "space-y-16"
533
+ }, At = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Et = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Mt = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, jt = { class: "space-y-4" }, Lt = { class: "fm-typo-en-body-lg-400" }, qt = { class: "space-y-16" }, Ht = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Kt = { class: "flex items-center gap-8" }, Wt = /* @__PURE__ */ X({
534
+ __name: "StoreSettingSheet",
535
+ emits: ["update"],
536
+ setup(b, { expose: h, emit: a }) {
537
+ const { t: y } = pe(), m = a, g = N(!1), n = N(), s = N(!1), f = Ze.extend({
538
+ company: Qe.extend({
539
+ name: J.string().min(1, "Company name is required"),
540
+ regNo: J.string().min(1, "Registration number is required"),
541
+ address: et.extend({
542
+ line1: J.string().min(1, "Line 1 is required"),
543
+ line2: J.string().optional(),
544
+ state: J.string().min(1, "State is required"),
545
+ city: J.string().min(1, "City is required"),
546
+ postcode: J.string().min(1, "Postcode is required"),
547
+ country: J.string().min(1, "Country is required")
548
+ }),
549
+ phoneNo: J.string().min(1, "Phone number is required"),
550
+ sstRegNo: J.string().optional()
551
+ })
552
+ }), t = I(() => f.safeParse(n.value).success);
553
+ function r() {
554
+ const V = f.safeParse(n.value);
555
+ V.success && m("update", V.data);
556
+ }
557
+ function u() {
558
+ return {
559
+ company: {
560
+ name: "",
561
+ address: {
562
+ line1: "",
563
+ line2: "",
564
+ city: "",
565
+ postcode: "",
566
+ state: "",
567
+ country: U.Config.getCountry().name
568
+ },
569
+ phoneNo: "",
570
+ regNo: "",
571
+ sstRegNo: ""
572
+ },
573
+ inclusiveTaxes: []
574
+ };
575
+ }
576
+ function d(V, l) {
577
+ g.value = V, V && (n.value = l != null && l.company ? l : u());
578
+ }
579
+ return h({
580
+ showSheet: d,
581
+ data: n
582
+ }), (V, l) => {
583
+ const k = F("FmIcon"), M = F("FmMenuItem"), Z = F("FmMenu"), ae = F("FmSelect"), te = F("FmButton"), j = F("FmSideSheet");
584
+ return _(), O(j, {
585
+ "max-width": 560,
586
+ modelValue: e(g),
587
+ "onUpdate:modelValue": l[15] || (l[15] = (v) => ie(g) ? g.value = v : null),
588
+ header: e(y)("connect.store.setting.title")
589
+ }, {
590
+ "side-sheet-footer": T(() => [
591
+ x("div", Kt, [
592
+ i(te, {
593
+ label: e(y)("connect.common.save"),
594
+ onClick: r,
595
+ disabled: !e(t) || e(xe)().isLoading,
596
+ loading: e(xe)().isLoading
597
+ }, null, 8, ["label", "disabled", "loading"]),
598
+ i(te, {
599
+ label: e(y)("connect.common.cancel"),
600
+ onClick: l[14] || (l[14] = (v) => d(!1)),
601
+ variant: "tertiary"
602
+ }, null, 8, ["label"])
603
+ ])
604
+ ]),
605
+ default: T(() => {
606
+ var v, w;
607
+ return [
608
+ i(Se, { json: e(n) }, null, 8, ["json"]),
609
+ e(n) && e(n).company ? (_(), P("div", Bt, [
610
+ x("div", Nt, D(e(y)("connect.store.setting.company.legal_info")), 1),
611
+ i(Q, {
612
+ modelValue: e(n).company.name,
613
+ "onUpdate:modelValue": l[0] || (l[0] = (c) => e(n).company.name = c),
614
+ label: e(y)("connect.store.setting.company.name"),
615
+ schema: e(Y).typeAtPath(e(f), "company.name")
616
+ }, null, 8, ["modelValue", "label", "schema"]),
617
+ i(Q, {
618
+ modelValue: e(n).company.regNo,
619
+ "onUpdate:modelValue": l[1] || (l[1] = (c) => e(n).company.regNo = c),
620
+ label: e(y)("connect.store.setting.company.reg_no"),
621
+ schema: e(Y).typeAtPath(e(f), "company.regNo")
622
+ }, null, 8, ["modelValue", "label", "schema"]),
623
+ e(U.Config).getCountry().taxSystems.length ? (_(), O(Q, {
624
+ key: 0,
625
+ modelValue: e(n).company.sstRegNo,
626
+ "onUpdate:modelValue": [
627
+ l[2] || (l[2] = (c) => e(n).company.sstRegNo = c),
628
+ l[3] || (l[3] = (c) => c ? null : e(n).inclusiveTaxes = [])
629
+ ],
630
+ label: e(y)("connect.store.setting.company.tax_reg_no"),
631
+ schema: e(Y).typeAtPath(e(f), "company.sstRegNo")
632
+ }, null, 8, ["modelValue", "label", "schema"])) : E("", !0),
633
+ (v = e(n).company) != null && v.sstRegNo && e(n).inclusiveTaxes ? (_(), P("div", Ot, [
634
+ x("div", At, D(e(y)("connect.store.setting.company.tax")), 1),
635
+ i(Tt, {
636
+ modelValue: e(n).inclusiveTaxes,
637
+ "onUpdate:modelValue": l[4] || (l[4] = (c) => e(n).inclusiveTaxes = c)
638
+ }, null, 8, ["modelValue"])
639
+ ])) : E("", !0),
640
+ i(Q, {
641
+ modelValue: e(n).company.phoneNo,
642
+ "onUpdate:modelValue": l[5] || (l[5] = (c) => e(n).company.phoneNo = c),
643
+ label: e(y)("connect.store.setting.company.phone"),
644
+ schema: e(Y).typeAtPath(e(f), "company.phoneNo")
645
+ }, null, 8, ["modelValue", "label", "schema"]),
646
+ x("div", Et, D(e(y)("connect.store.setting.company.address.title")), 1),
647
+ i(Q, {
648
+ modelValue: e(n).company.address.line1,
649
+ "onUpdate:modelValue": l[6] || (l[6] = (c) => e(n).company.address.line1 = c),
650
+ label: e(y)("connect.store.setting.company.address.line1"),
651
+ schema: e(Y).typeAtPath(e(f), "company.address.line1")
652
+ }, null, 8, ["modelValue", "label", "schema"]),
653
+ i(Q, {
654
+ modelValue: e(n).company.address.line2,
655
+ "onUpdate:modelValue": l[7] || (l[7] = (c) => e(n).company.address.line2 = c),
656
+ label: e(y)("connect.store.setting.company.address.line2"),
657
+ schema: e(Y).typeAtPath(e(f), "company.address.line2")
658
+ }, null, 8, ["modelValue", "label", "schema"]),
659
+ x("div", Mt, [
660
+ i(Q, {
661
+ modelValue: e(n).company.address.city,
662
+ "onUpdate:modelValue": l[8] || (l[8] = (c) => e(n).company.address.city = c),
663
+ label: e(y)("connect.store.setting.company.address.city"),
664
+ schema: e(Y).typeAtPath(e(f), "company.address.city")
665
+ }, null, 8, ["modelValue", "label", "schema"]),
666
+ i(Q, {
667
+ modelValue: e(n).company.address.postcode,
668
+ "onUpdate:modelValue": l[9] || (l[9] = (c) => e(n).company.address.postcode = c),
669
+ label: e(y)("connect.store.setting.company.address.postcode"),
670
+ schema: e(Y).typeAtPath(e(f), "company.address.postcode")
671
+ }, null, 8, ["modelValue", "label", "schema"]),
672
+ x("div", jt, [
673
+ x("div", Lt, D(e(y)("connect.store.setting.company.address.state")), 1),
674
+ i(Z, {
675
+ placement: "top-end",
676
+ "model-value": e(s)
677
+ }, {
678
+ "menu-button": T(() => [
679
+ i(Q, {
680
+ modelValue: e(n).company.address.state,
681
+ "onUpdate:modelValue": l[10] || (l[10] = (c) => e(n).company.address.state = c),
682
+ schema: e(Y).typeAtPath(e(f), "company.address.state"),
683
+ onFocusChanged: l[11] || (l[11] = (c) => s.value = c)
684
+ }, {
685
+ append: T(() => [
686
+ i(k, {
687
+ name: e(s) ? "keyboard_arrow_up" : "keyboard_arrow_down"
688
+ }, null, 8, ["name"])
689
+ ]),
690
+ _: 1
691
+ }, 8, ["modelValue", "schema"])
692
+ ]),
693
+ default: T(() => [
694
+ (_(!0), P(q, null, le(e(kt)[e(U.Config).getCountry().code].stateItems.filter(
695
+ (c) => {
696
+ var R, A;
697
+ return c.label.toLowerCase().includes(((A = (R = e(n)) == null ? void 0 : R.company) == null ? void 0 : A.address.state.toLowerCase()) ?? "");
698
+ }
699
+ ) || [], (c) => (_(), O(M, {
700
+ key: c.value,
701
+ "model-value": e(n).company.address.state === c.value,
702
+ label: c.label,
703
+ onClick: () => {
704
+ e(n).company.address.state = c.value, s.value = !1;
705
+ }
706
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
707
+ ]),
708
+ _: 1
709
+ }, 8, ["model-value"])
710
+ ]),
711
+ i(ae, {
712
+ label: e(y)("connect.store.setting.company.address.country"),
713
+ modelValue: e(n).company.address.country,
714
+ "onUpdate:modelValue": l[12] || (l[12] = (c) => e(n).company.address.country = c),
715
+ items: [
716
+ {
717
+ label: e(U.Config).getCountry().name,
718
+ value: e(U.Config).getCountry().name
719
+ }
720
+ ],
721
+ rules: [e(Y).ruleAtPath(e(f), "company.address.country")]
722
+ }, null, 8, ["label", "modelValue", "items", "rules"])
723
+ ]),
724
+ x("div", qt, [
725
+ x("div", Ht, D(e(y)("connect.store.setting.stripe.title")), 1),
726
+ i(Dt, {
727
+ "model-value": (w = e(n)) == null ? void 0 : w.stripe,
728
+ "onUpdate:modelValue": l[13] || (l[13] = (c) => e(n).stripe = c)
729
+ }, null, 8, ["model-value"])
730
+ ])
731
+ ])) : E("", !0)
732
+ ];
733
+ }),
734
+ _: 1
735
+ }, 8, ["modelValue", "header"]);
736
+ };
737
+ }
738
+ });
739
+ function zt(b, h = !0) {
740
+ return U.DineroFactory(b).toFormat(h);
741
+ }
742
+ const Yt = /* @__PURE__ */ X({
743
+ __name: "TaxVariantSetting",
744
+ props: {
745
+ modelValue: {
746
+ type: Array,
747
+ required: !0,
748
+ default: () => []
749
+ }
750
+ },
751
+ emits: ["update:modelValue"],
752
+ setup(b, { emit: h }) {
753
+ const a = b, y = h;
754
+ ye(() => {
755
+ if (n.value.length !== g.value.length) {
756
+ const t = g.value.reduce((r, u) => {
757
+ const d = ee.systemDefaultCode(u.name);
758
+ if (!d) return r;
759
+ const { systemCode: V, taxCode: l } = d;
760
+ return u.value || r.push({ systemCode: V, taxCode: l }), r;
761
+ }, []);
762
+ f(t);
763
+ }
764
+ });
765
+ function m() {
766
+ return ee.groupedTaxOptions();
767
+ }
768
+ const g = I(() => m().map((t) => ({
769
+ name: t.code,
770
+ value: (n.value || []).find(
771
+ (r) => t.options.some((u) => u.feedmeTaxCode === r)
772
+ ),
773
+ options: t.options.map((r) => ({
774
+ label: `${r.name} (${st(r.rate)}%)`,
775
+ value: r.feedmeTaxCode
776
+ }))
777
+ }))), n = I(() => a.modelValue.map((t) => ee.generateCode(t)));
778
+ function s(t) {
779
+ const r = m().find(
780
+ (l) => l.options.some((k) => k.feedmeTaxCode === t)
781
+ ), u = r == null ? void 0 : r.options.find((l) => l.feedmeTaxCode === t);
782
+ if (!u) return;
783
+ const { systemCode: d, taxCode: V } = u;
784
+ f([{ systemCode: d, taxCode: V }]);
785
+ }
786
+ function f(t) {
787
+ const r = re.clone(a.modelValue);
788
+ t.forEach((u) => {
789
+ const d = m().find(
790
+ (k) => k.options.some((M) => M.feedmeTaxCode === ee.generateCode(u))
791
+ ), V = (d == null ? void 0 : d.options) || [], l = r.findIndex(
792
+ (k) => V.some((M) => ee.generateCode(M) === ee.generateCode(k))
793
+ );
794
+ l >= 0 ? r.splice(l, 1, u) : r.push(u);
795
+ }), y("update:modelValue", r);
796
+ }
797
+ return (t, r) => {
798
+ const u = F("FmRadio"), d = F("FmRadioGroup");
799
+ return _(!0), P(q, null, le(e(g), (V) => (_(), P("div", {
800
+ key: V.name,
801
+ class: "flex items-start"
802
+ }, [
803
+ i(d, {
804
+ modelValue: V.value,
805
+ "onUpdate:modelValue": [
806
+ (l) => V.value = l,
807
+ r[0] || (r[0] = (l) => {
808
+ s(l);
809
+ })
810
+ ]
811
+ }, {
812
+ default: T(() => [
813
+ (_(!0), P(q, null, le(V.options, (l, k) => (_(), O(u, {
814
+ key: k,
815
+ value: l.value,
816
+ label: l.label
817
+ }, null, 8, ["value", "label"]))), 128))
818
+ ]),
819
+ _: 2
820
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
821
+ ]))), 128);
822
+ };
823
+ }
824
+ }), Ce = {
825
+ get _id() {
826
+ return (/* @__PURE__ */ new Date()).toISOString();
827
+ },
828
+ name: "",
829
+ price: U.Dinero.zero().toObject(),
830
+ originalPrice: U.Dinero.zero().toObject(),
831
+ vouchers: [],
832
+ credit: {
833
+ normal: 0,
834
+ free: {
835
+ amount: 0,
836
+ day: 0
837
+ }
838
+ },
839
+ config: {
840
+ options: {}
841
+ },
842
+ titles: [],
843
+ taxes: [],
844
+ taxTotals: [],
845
+ internal: !1,
846
+ priceWithTaxes: lt()
847
+ }, Jt = {
848
+ key: 0,
849
+ class: "space-y-24 pr-12"
850
+ }, Gt = { class: "space-y-8" }, Xt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, Zt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, Qt = /* @__PURE__ */ x("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Credit", -1), eo = /* @__PURE__ */ x("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1), to = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, oo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, no = { class: "space-y-8" }, lo = { class: "flex items-center justify-between" }, ao = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, so = { class: "space-y-8" }, ro = { class: "flex items-center gap-8" }, io = /* @__PURE__ */ X({
851
+ __name: "EditBundleSheet",
852
+ emits: ["update"],
853
+ setup(b, { expose: h, emit: a }) {
854
+ const y = a, { t: m } = pe(), g = Fe(), n = N(!1), s = N([]), f = N({
855
+ category: 0,
856
+ index: -1,
857
+ originalCategoryIndex: void 0
858
+ }), t = N(re.cloneDeep(Ce)), r = N(), u = Be, d = I(() => {
859
+ const p = u.safeParse(t.value);
860
+ return p.success ? [] : p.error.errors;
861
+ }), V = [
862
+ {
863
+ header: "Reward title",
864
+ accessorFn: (p) => p.collectible.name,
865
+ enableSorting: !0
866
+ },
867
+ {
868
+ id: "type",
869
+ header: "Reward type",
870
+ accessorFn: (p) => p.collectible.type,
871
+ cell(p) {
872
+ return ce[p.row.original.collectible.type].chip();
873
+ }
874
+ },
875
+ {
876
+ header: "Description",
877
+ accessorFn: (p) => p.description,
878
+ cell(p) {
879
+ var S;
880
+ const o = p.row.original;
881
+ return o.collectible.type == "VOUCHER" || o.selectedReward == null ? o.description : qe(Ke.FmStepperField, {
882
+ "onUpdate:modelValue": ($) => {
883
+ t.value.titles = t.value.titles.map(
884
+ (G) => G.id == o.collectible._id ? { ...G, dayToExpire: $ } : G
885
+ );
886
+ },
887
+ modelValue: ((S = o.selectedReward) == null ? void 0 : S.extra) ?? 0,
888
+ appendText: "day(s)",
889
+ showSteppers: !1,
890
+ disabled: !!t.value.stripePriceId
891
+ });
892
+ }
893
+ }
894
+ ], l = N([]), k = I(() => g.bundleRewards.map((p) => {
895
+ const o = M.value.find(($) => $.id == p._id), S = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${rt(p.options.validityOption || {})}` : "No expiry";
896
+ return {
897
+ collectible: p,
898
+ description: S,
899
+ selectedReward: o
900
+ };
901
+ })), M = I(() => {
902
+ var p, o;
903
+ return [
904
+ ...((p = t.value) == null ? void 0 : p.titles.map((S) => ({
905
+ id: S.id,
906
+ extra: S.dayToExpire
907
+ }))) ?? [],
908
+ ...((o = t.value) == null ? void 0 : o.vouchers.map((S) => ({
909
+ id: S,
910
+ extra: void 0
911
+ }))) ?? []
912
+ ];
913
+ }), Z = I(
914
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
915
+ );
916
+ function ae(p) {
917
+ t.value.subscriptionValidity = p;
918
+ for (const o of t.value.titles)
919
+ o.dayToExpire = p;
920
+ t.value.credit.free && (t.value.credit.free.day = p);
921
+ }
922
+ function te() {
923
+ const p = k.value, o = t.value;
924
+ if (!(!o || !p))
925
+ for (let S = 0; S < p.length; S++) {
926
+ const $ = p[S];
927
+ j.value[S] ? $.collectible.type == "TITLE" ? o.titles.findIndex(
928
+ (L) => L.id == $.collectible._id
929
+ ) < 0 && o.titles.push({
930
+ id: $.collectible._id,
931
+ dayToExpire: Z.value
932
+ }) : o.vouchers.findIndex(
933
+ (L) => L == $.collectible._id
934
+ ) < 0 && o.vouchers.push($.collectible._id) : (o.titles = o.titles.filter((ne) => ne.id != $.collectible._id), o.vouchers = o.vouchers.filter(
935
+ (ne) => ne != $.collectible._id
936
+ ));
937
+ }
938
+ }
939
+ const j = N({});
940
+ Ve(j, te, { deep: !0 });
941
+ const v = I(() => {
942
+ var p, o;
943
+ return (o = (p = g.storeOption) == null ? void 0 : p.company) == null ? void 0 : o.sstRegNo;
944
+ }), w = I(() => {
945
+ var p, o, S;
946
+ return (S = (o = (p = g.storeOption) == null ? void 0 : p.inclusiveTaxes) == null ? void 0 : o[0]) != null && S.inclusive ? "Inclusive" : "Exclusive";
947
+ }), c = I(() => {
948
+ var p, o, S;
949
+ return ct(
950
+ ee.fullTax,
951
+ Le(t.value.taxes),
952
+ t.value.price,
953
+ Number(t.value.credit.normal),
954
+ ((p = g.storeOption) == null ? void 0 : p.inclusiveTaxes) ?? [],
955
+ (S = (o = g.storeOption) == null ? void 0 : o.company) != null && S.sstRegNo ? ee.taxSystem.map(($) => $.code) : []
956
+ );
957
+ }), R = I(() => c.value.reduce(
958
+ (o, S) => o.add(S.total),
959
+ at()
960
+ ).toFormat()), A = I(() => {
961
+ var $;
962
+ const p = ut(
963
+ c.value,
964
+ t.value.price,
965
+ (($ = g.storeOption) == null ? void 0 : $.inclusiveTaxes) ?? []
966
+ );
967
+ t.value.priceWithTaxes = p;
968
+ const o = zt(p, !1), S = Number(o.replace(/[^\d.-]/g, ""));
969
+ return Number.isNaN(S) ? 0 : S;
970
+ });
971
+ function B() {
972
+ t.value.taxTotals = c.value, y("update", Be.parse(Ge(t.value)));
973
+ }
974
+ function H() {
975
+ return re.cloneDeep(Ce);
976
+ }
977
+ function K(p, o) {
978
+ n.value = p, p && o && (r.value = void 0, s.value = o.categories, t.value = o.bundle || H(), f.value.category = o.category, f.value.index = o.index, f.value.originalCategoryIndex = o.category, j.value = k.value.reduce((S, $, G) => (S[G] = !!$.selectedReward, S), {}));
979
+ }
980
+ return h({
981
+ showSheet: K,
982
+ bundleImage: r,
983
+ target: f,
984
+ data: t
985
+ }), (p, o) => {
986
+ const S = F("FmSwitch"), $ = F("FmHelperText"), G = F("FmTextField"), ne = F("FmSelect"), L = F("FmStepperField"), fe = F("FmMenuItem"), Ae = F("FmTable"), we = F("FmButton"), Ee = F("FmSideSheet");
987
+ return _(), O(Ee, {
988
+ "max-width": 560,
989
+ modelValue: e(n),
990
+ "onUpdate:modelValue": o[20] || (o[20] = (de) => ie(n) ? n.value = de : null),
991
+ header: e(f).index != -1 ? e(m)("connect.store.bundle.edit.title") : e(m)("connect.store.bundle.edit.create")
992
+ }, {
993
+ "side-sheet-footer": T(() => [
994
+ x("div", ro, [
995
+ i(we, {
996
+ label: e(f).index != -1 ? "Save" : "Add",
997
+ onClick: B,
998
+ disabled: e(d).length > 0,
999
+ loading: e(xe)().isLoading
1000
+ }, null, 8, ["label", "disabled", "loading"]),
1001
+ i(we, {
1002
+ label: "Cancel",
1003
+ onClick: o[19] || (o[19] = (de) => K(!1)),
1004
+ variant: "tertiary"
1005
+ })
1006
+ ])
1007
+ ]),
1008
+ default: T(() => {
1009
+ var de, $e, Pe, ke, Te, Ue, Re, Ie;
1010
+ return [
1011
+ i(Se, { json: e(t) }, null, 8, ["json"]),
1012
+ e(t) ? (_(), P("div", Jt, [
1013
+ x("div", Gt, [
1014
+ e(U.Config).getCountry().code == "MY" && ((de = e(g).payoutAccount) == null ? void 0 : de.status) == "APPROVED" && (($e = e(g).payoutAccount) != null && $e.enable) ? (_(), O(S, {
1015
+ key: 0,
1016
+ "onUpdate:modelValue": o[0] || (o[0] = (C) => {
1017
+ e(t).isFeedvibe = C, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], j.value = {});
1018
+ }),
1019
+ "label-placement": "right",
1020
+ "model-value": e(t).isFeedvibe || !1,
1021
+ label: "Feedvibe Campaign",
1022
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1023
+ }, null, 8, ["model-value"])) : E("", !0),
1024
+ e(t).isFeedvibe ? (_(), O($, {
1025
+ key: 1,
1026
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1027
+ state: "warning"
1028
+ })) : E("", !0)
1029
+ ]),
1030
+ x("div", Xt, D(e(m)("connect.store.bundle.edit.basicInformation")), 1),
1031
+ i(G, {
1032
+ label: e(m)("connect.store.bundle.edit.bundleName"),
1033
+ modelValue: e(t).name,
1034
+ "onUpdate:modelValue": o[1] || (o[1] = (C) => e(t).name = C),
1035
+ "helper-state": e(W)(e(d), "name"),
1036
+ "helper-text": e(z)(e(d), "name")
1037
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1038
+ i(ne, {
1039
+ modelValue: e(f).category,
1040
+ "onUpdate:modelValue": o[2] || (o[2] = (C) => e(f).category = C),
1041
+ label: "Store Category",
1042
+ items: e(s).map((C, Me) => ({ label: C, value: Me }))
1043
+ }, null, 8, ["modelValue", "items"]),
1044
+ i(ot, {
1045
+ label: e(m)("connect.store.bundle.edit.bundleImage"),
1046
+ class: "w-1/2 xs:w-2/3",
1047
+ "aspect-ratio": "16/9",
1048
+ thumbnail: e(t).image ?? void 0,
1049
+ file: e(r) ?? void 0,
1050
+ "onUpdate:file": o[3] || (o[3] = (C) => {
1051
+ r.value = C;
1052
+ }),
1053
+ "helper-state": e(W)(e(d), "image"),
1054
+ "helper-text": e(z)(e(d), "image")
1055
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1056
+ i(L, {
1057
+ "model-value": e(U.Dinero).fromFdoDinero(e(t).price).toUnit(),
1058
+ label: e(m)("connect.store.bundle.edit.bundlePrice"),
1059
+ min: 0,
1060
+ "max-fraction-digits": 2,
1061
+ "onUpdate:modelValue": o[4] || (o[4] = (C) => {
1062
+ e(t).price.amount = C * 10 ** e(t).price.precision;
1063
+ }),
1064
+ "is-currency": !0,
1065
+ "show-steppers": !1,
1066
+ "helper-text": e(z)(e(d), "price") || `${e(U.Dinero).fromNumber({ number: 1 }).toFormat(!0)} = ${e(U.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1067
+ "helper-state": e(W)(e(d), "price")
1068
+ }, {
1069
+ prepend: T(() => [
1070
+ se(D(e(U.Dinero).defaultCurrency()), 1)
1071
+ ]),
1072
+ _: 1
1073
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1074
+ i(L, {
1075
+ "model-value": e(U.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1076
+ label: e(m)("connect.store.bundle.edit.bundleValue"),
1077
+ min: 0,
1078
+ "max-fraction-digits": 2,
1079
+ "onUpdate:modelValue": o[5] || (o[5] = (C) => {
1080
+ e(t).originalPrice || (e(t).originalPrice = e(U.Dinero).zero().toObject()), e(t).originalPrice.amount = C * 10 ** e(t).originalPrice.precision;
1081
+ }),
1082
+ "is-currency": !0,
1083
+ "show-steppers": !1,
1084
+ "helper-text": e(z)(e(d), "originalPrice") || e(m)("connect.store.bundle.edit.originalPriceHelper"),
1085
+ "helper-state": e(W)(e(d), "originalPrice")
1086
+ }, {
1087
+ prepend: T(() => [
1088
+ se(D(e(U.Dinero).defaultCurrency()), 1)
1089
+ ]),
1090
+ _: 1
1091
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1092
+ e(t).isFeedvibe ? E("", !0) : (_(), O(L, {
1093
+ key: 0,
1094
+ "model-value": e(t).coinPrice ?? null,
1095
+ label: e(m)("connect.store.bundle.edit.pointNeeded"),
1096
+ min: 0,
1097
+ "onUpdate:modelValue": o[6] || (o[6] = (C) => {
1098
+ C > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = C;
1099
+ }),
1100
+ "show-steppers": !1,
1101
+ "helper-state": e(W)(e(d), "coinPrice"),
1102
+ "helper-text": e(z)(e(d), "coinPrice")
1103
+ }, {
1104
+ append: T(() => [
1105
+ se(" point(s) ")
1106
+ ]),
1107
+ _: 1
1108
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1109
+ (Pe = e(g).storeOption) != null && Pe.stripe && !e(t).isFeedvibe ? (_(), P(q, { key: 1 }, [
1110
+ x("div", Zt, D(e(m)("connect.store.bundle.edit.subscriptionSettings")), 1),
1111
+ i(G, {
1112
+ label: e(m)("connect.store.bundle.edit.stripePriceId"),
1113
+ modelValue: e(t).stripePriceId,
1114
+ "onUpdate:modelValue": o[7] || (o[7] = (C) => e(t).stripePriceId = C),
1115
+ "helper-state": e(W)(e(d), "stripePriceId"),
1116
+ "helper-text": e(z)(e(d), "stripePriceId")
1117
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1118
+ e(t).stripePriceId ? (_(), O(L, {
1119
+ key: 0,
1120
+ "model-value": e(t).subscriptionValidity ?? null,
1121
+ min: 1,
1122
+ "onUpdate:modelValue": ae,
1123
+ label: e(m)("connect.store.bundle.edit.subscriptionValidity"),
1124
+ "show-steppers": !1,
1125
+ "helper-state": e(W)(e(d), "subscriptionValidity"),
1126
+ "helper-text": e(z)(e(d), "subscriptionValidity")
1127
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : E("", !0)
1128
+ ], 64)) : E("", !0),
1129
+ e(t).isFeedvibe ? E("", !0) : (_(), P(q, { key: 2 }, [
1130
+ Qt,
1131
+ i(L, {
1132
+ modelValue: e(t).credit.normal,
1133
+ "onUpdate:modelValue": o[8] || (o[8] = (C) => e(t).credit.normal = C),
1134
+ label: "Normal credit",
1135
+ "show-steppers": !1,
1136
+ "helper-state": e(W)(e(d), "credit.normal"),
1137
+ "helper-text": e(z)(e(d), "credit.normal")
1138
+ }, {
1139
+ append: T(() => [
1140
+ se(" credit ")
1141
+ ]),
1142
+ _: 1
1143
+ }, 8, ["modelValue", "helper-state", "helper-text"]),
1144
+ i(L, {
1145
+ "model-value": ((ke = e(t).credit.free) == null ? void 0 : ke.amount) ?? null,
1146
+ min: 0,
1147
+ "onUpdate:modelValue": o[9] || (o[9] = (C) => {
1148
+ e(t).credit.free || (e(t).credit.free = {
1149
+ amount: 0,
1150
+ day: 1
1151
+ }), e(t).credit.free.amount = C;
1152
+ }),
1153
+ label: "Free credit",
1154
+ "show-steppers": !1,
1155
+ "helper-state": e(W)(e(d), "credit.free.amount"),
1156
+ "helper-text": e(z)(e(d), "credit.free.amount")
1157
+ }, {
1158
+ append: T(() => [
1159
+ se(" credit ")
1160
+ ]),
1161
+ _: 1
1162
+ }, 8, ["model-value", "helper-state", "helper-text"]),
1163
+ (Te = e(t).credit.free) != null && Te.amount ? (_(), O(L, {
1164
+ key: 0,
1165
+ disabled: !!e(t).stripePriceId,
1166
+ "model-value": ((Ue = e(t).credit.free) == null ? void 0 : Ue.day) ?? null,
1167
+ min: 0,
1168
+ "onUpdate:modelValue": o[10] || (o[10] = (C) => {
1169
+ e(t).credit.free || (e(t).credit.free = {
1170
+ amount: 0,
1171
+ day: 1
1172
+ }), e(t).credit.free.day = e(Z) || C;
1173
+ }),
1174
+ label: "Free credit valid for",
1175
+ "show-steppers": !1,
1176
+ "helper-state": e(W)(e(d), "credit.free.day"),
1177
+ "helper-text": e(z)(e(d), "credit.free.day")
1178
+ }, {
1179
+ append: T(() => [
1180
+ se(" day(s) ")
1181
+ ]),
1182
+ _: 1
1183
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : E("", !0)
1184
+ ], 64)),
1185
+ e(v) ? (_(), P(q, { key: 3 }, [
1186
+ eo,
1187
+ i(Yt, {
1188
+ modelValue: e(t).taxes,
1189
+ "onUpdate:modelValue": o[11] || (o[11] = (C) => e(t).taxes = C)
1190
+ }, null, 8, ["modelValue"]),
1191
+ i(G, {
1192
+ label: `Tax Charged (${e(w)})`,
1193
+ "model-value": e(R),
1194
+ disabled: ""
1195
+ }, null, 8, ["label", "model-value"])
1196
+ ], 64)) : E("", !0),
1197
+ i(L, {
1198
+ label: "Total Price",
1199
+ "model-value": e(A),
1200
+ disabled: !0
1201
+ }, null, 8, ["model-value"]),
1202
+ x("div", to, D(e(m)("connect.store.bundle.edit.bundleReward.title")), 1),
1203
+ x("div", oo, D(e(m)("connect.store.bundle.edit.bundleReward.description")), 1),
1204
+ x("div", no, [
1205
+ x("div", lo, [
1206
+ i(nt, {
1207
+ label: `Reward type: ${e(l).length == 0 ? "All" : e(l)[0].name}`
1208
+ }, {
1209
+ default: T(() => [
1210
+ i(fe, {
1211
+ onClick: o[12] || (o[12] = (C) => l.value = []),
1212
+ label: "All"
1213
+ }),
1214
+ i(fe, {
1215
+ onClick: o[13] || (o[13] = (C) => l.value = [
1216
+ {
1217
+ id: "type",
1218
+ value: "VOUCHER",
1219
+ name: e(ce).VOUCHER.name
1220
+ }
1221
+ ]),
1222
+ label: e(ce).VOUCHER.name
1223
+ }, null, 8, ["label"]),
1224
+ i(fe, {
1225
+ onClick: o[14] || (o[14] = (C) => l.value = [
1226
+ {
1227
+ id: "type",
1228
+ value: "TITLE",
1229
+ name: e(ce).TITLE.name
1230
+ }
1231
+ ]),
1232
+ label: e(ce).TITLE.name
1233
+ }, null, 8, ["label"])
1234
+ ]),
1235
+ _: 1
1236
+ }, 8, ["label"])
1237
+ ]),
1238
+ i(Ae, {
1239
+ modelValue: e(j),
1240
+ "onUpdate:modelValue": o[15] || (o[15] = (C) => ie(j) ? j.value = C : null),
1241
+ selection: "multiple",
1242
+ "column-filter": e(l),
1243
+ "column-defs": V,
1244
+ "row-data": e(k).filter(
1245
+ (C) => !e(t).isFeedvibe || C.collectible.type == "VOUCHER"
1246
+ ),
1247
+ "hide-footer": e(k).length <= 10
1248
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1249
+ i($, {
1250
+ text: e(z)(e(d), "titles"),
1251
+ state: e(W)(e(d), "titles")
1252
+ }, null, 8, ["text", "state"])
1253
+ ]),
1254
+ x("div", ao, D(e(m)("connect.store.bundle.edit.advanceSetting")), 1),
1255
+ x("div", so, [
1256
+ i(S, {
1257
+ "model-value": e(t).internal ?? !1,
1258
+ "onUpdate:modelValue": o[16] || (o[16] = (C) => e(t).internal = C),
1259
+ "label-placement": "right",
1260
+ label: e(m)("connect.store.bundle.edit.internalBundle"),
1261
+ sublabel: e(m)("connect.store.bundle.edit.internalBundleDescription")
1262
+ }, null, 8, ["model-value", "label", "sublabel"]),
1263
+ i(S, {
1264
+ "model-value": e(t).hideInPos ?? !1,
1265
+ "onUpdate:modelValue": o[17] || (o[17] = (C) => e(t).hideInPos = C),
1266
+ "label-placement": "right",
1267
+ label: e(m)("connect.store.bundle.edit.hideInPos"),
1268
+ sublabel: e(m)("connect.store.bundle.edit.hideInPosDescription")
1269
+ }, null, 8, ["model-value", "label", "sublabel"]),
1270
+ i(L, {
1271
+ "model-value": ((Ie = (Re = e(t).config) == null ? void 0 : Re.options) == null ? void 0 : Ie.maxPerUser) || null,
1272
+ "onUpdate:modelValue": o[18] || (o[18] = (C) => e(re).set(e(t), "config.options.maxPerUser", C)),
1273
+ label: e(m)("connect.store.bundle.edit.maxPerUser"),
1274
+ "show-steppers": !1,
1275
+ placeholder: "Unlimited"
1276
+ }, null, 8, ["model-value", "label"])
1277
+ ])
1278
+ ])) : E("", !0)
1279
+ ];
1280
+ }),
1281
+ _: 1
1282
+ }, 8, ["modelValue", "header"]);
1283
+ };
1284
+ }
1285
+ });
1286
+ var co = { 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" };
1287
+ const uo = { class: "px-24 flex flex-col gap-y-16" }, mo = { class: "flex gap-8 items-center" }, po = { class: "fm-typo-en-body-lg-600" }, yo = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, fo = /* @__PURE__ */ x("img", {
1288
+ src: He,
1289
+ class: "aspect-square w-[150px]"
1290
+ }, null, -1), bo = { class: "flex flex-col gap-16 text-center" }, go = { class: "fm-typo-en-title-sm-800" }, vo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = /* @__PURE__ */ X({
1291
+ __name: "Store",
1292
+ setup(b) {
1293
+ const h = {
1294
+ label: "Setup payout account",
1295
+ value: "payout",
1296
+ isPrimary: !1
1297
+ }, { t: a } = pe(), y = {
1298
+ label: a("connect.store.actions.setting"),
1299
+ value: "setting",
1300
+ isPrimary: !1
1301
+ }, m = {
1302
+ label: a("connect.store.actions.manageReward"),
1303
+ value: "create_reward"
1304
+ }, g = {
1305
+ label: a("connect.store.actions.addCategory"),
1306
+ value: "create_category",
1307
+ isPrimary: !0,
1308
+ prependIcon: "add"
1309
+ }, n = it(), s = Fe(), { global: f, minor: t } = Ye, r = Ne(), u = I(() => s.sortedStoreCategories), d = I(() => s.sortedStoreCategories.map((v) => v.name)), V = N(), l = N();
1310
+ async function k(v) {
1311
+ var w;
1312
+ v === "setting" ? (w = V.value) == null || w.showSheet(!0, s.storeOption) : v === "create_category" ? Z(-1) : v === "create_reward" ? await n.push({ name: Xe["$connect-STORE_REWARDS"] }) : v == "payout" && window.open(co.paymentPortalUrl, "_blank");
1313
+ }
1314
+ async function M(v) {
1315
+ await t(
1316
+ async () => {
1317
+ var w;
1318
+ await he.updateStore(v), await s.readMemberStore(), (w = V.value) == null || w.showSheet(!1);
1319
+ },
1320
+ {
1321
+ message: a("connect.store.setting.update.message"),
1322
+ successMessage: a("connect.store.setting.update.success")
1323
+ }
1324
+ );
1325
+ }
1326
+ async function Z(v = -1) {
1327
+ var w, c;
1328
+ if ((!s.storeOption || !s.storeOption.company) && await ge.confirm(
1329
+ a("connect.store.category.setup.title"),
1330
+ a("connect.store.category.setup.button"),
1331
+ a("connect.store.category.setup.action"),
1332
+ a("connect.common.cancel")
1333
+ ))
1334
+ return (w = V.value) == null ? void 0 : w.showSheet(!0);
1335
+ r.open({
1336
+ title: v == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
1337
+ contentComponent: Ft,
1338
+ contentComponentProps: {
1339
+ initialValue: ((c = u.value[v]) == null ? void 0 : c.name) ?? "",
1340
+ action: v == -1 ? "add" : "edit"
1341
+ }
1342
+ }).onPrimary(async (R) => {
1343
+ R === null && !await ge.remove(
1344
+ a("connect.store.category.remove.confirm"),
1345
+ a("connect.store.category.remove.title")
1346
+ ) || await t(
1347
+ async () => {
1348
+ const A = v == -1 ? [...u.value, { name: R, bundles: [] }] : [...u.value].map((B, H) => H == v ? { ...B, name: R } : B).filter((B) => B.name !== null);
1349
+ await he.updateStoreBundle({
1350
+ categories: A
1351
+ }), await s.readMemberStore();
1352
+ },
1353
+ {
1354
+ message: R === null ? a("connect.store.category.update.deleting") : v == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
1355
+ successMessage: R === null ? a("connect.store.category.update.success.deleted") : v == -1 ? a("connect.store.category.update.success.created") : a("connect.store.category.update.success.updated")
1356
+ }
1357
+ );
1358
+ });
1359
+ }
1360
+ async function ae(v, w, c, R) {
1361
+ var H, K, p;
1362
+ w ?? (w = (H = l.value) == null ? void 0 : H.target.category), c ?? (c = (K = l.value) == null ? void 0 : K.target.index), R ?? (R = (p = l.value) == null ? void 0 : p.target.originalCategoryIndex);
1363
+ const A = De(u.value);
1364
+ w != R && (A[R].bundles.splice(c, 1), c = A[w].bundles.length), console.log(w, c, R, "ci, bi, originalCategoryIndex");
1365
+ const B = A[w];
1366
+ if (!B) {
1367
+ Je.error("Unexpected error", 2e3);
1368
+ return;
1369
+ }
1370
+ if (v == null) {
1371
+ if (await ge.remove(
1372
+ "Are you sure you want to delete this bundle?",
1373
+ "Delete bundle"
1374
+ ) == !1)
1375
+ return;
1376
+ B.bundles.splice(c, 1);
1377
+ } else
1378
+ c == -1 ? B.bundles.push(v) : B.bundles[c] = v;
1379
+ await t(
1380
+ async () => {
1381
+ var o, S;
1382
+ if (v != null) {
1383
+ const $ = (o = l.value) == null ? void 0 : o.bundleImage;
1384
+ $ === null && v.image ? (await ve.delete(v.image), v.image = null) : $ && (v.image = await ve.update(
1385
+ ve.bundleImagePath(void 0, $),
1386
+ $
1387
+ ));
1388
+ }
1389
+ await he.updateStoreBundle({
1390
+ categories: A
1391
+ }), await s.readMemberStore(), await s.readMembership(), await s.readRewards(), (S = l.value) == null || S.showSheet(!1);
1392
+ },
1393
+ {
1394
+ message: `${v == null ? "Deleting" : c == -1 ? "Creating" : "Updating"} bundle`,
1395
+ successMessage: `Bundle ${v == null ? "deleted" : c == -1 ? "created" : "updated"} successfully`
1396
+ }
1397
+ );
1398
+ }
1399
+ function te(v) {
1400
+ var w;
1401
+ (w = l.value) == null || w.showSheet(!0, {
1402
+ ...v,
1403
+ bundle: v.bundle ? De(v.bundle) : void 0
1404
+ });
1405
+ }
1406
+ const j = N([]);
1407
+ return ye(async () => {
1408
+ var v, w;
1409
+ await f(async () => {
1410
+ var c, R;
1411
+ if (await s.readMemberStore(), await s.readMembership(), await s.readRewards(), await s.readPayoutAccount(), (c = n.currentRoute.value.query) != null && c.action) {
1412
+ switch ((R = n.currentRoute.value.query) == null ? void 0 : R.action) {
1413
+ case "update_setting":
1414
+ k("setting");
1415
+ break;
1416
+ case "create_category":
1417
+ Z(-1);
1418
+ break;
1419
+ case "create_feedvibe_bundle":
1420
+ r.open({
1421
+ title: "Select category",
1422
+ contentComponent: Pt
1423
+ }).onPrimary((A) => {
1424
+ r.close(), te({
1425
+ categories: d.value,
1426
+ category: A,
1427
+ index: -1,
1428
+ bundle: {
1429
+ ...re.cloneDeep(Ce),
1430
+ isFeedvibe: !0,
1431
+ price: U.Dinero.fromNumber({
1432
+ number: 10,
1433
+ precision: 2
1434
+ }).toObject()
1435
+ }
1436
+ });
1437
+ }).onTertiary(() => r.close());
1438
+ break;
1439
+ }
1440
+ n.replace({ query: {} });
1441
+ }
1442
+ }), j.value = [y, m, g], (((v = s.payoutAccount) == null ? void 0 : v.status) != "APPROVED" || ((w = s.payoutAccount) == null ? void 0 : w.enable) != !0) && (j.value = [
1443
+ h,
1444
+ y,
1445
+ m,
1446
+ g
1447
+ ]);
1448
+ }), (v, w) => {
1449
+ const c = F("FmPageHead"), R = F("FmButton"), A = F("FmCard");
1450
+ return _(), P(q, null, [
1451
+ i(c, {
1452
+ title: e(a)("connect.store.title"),
1453
+ actions: e(j),
1454
+ "onClick:action": k
1455
+ }, null, 8, ["title", "actions"]),
1456
+ x("div", uo, [
1457
+ e(u) && e(u).length > 0 ? (_(), P(q, { key: 0 }, [
1458
+ (_(!0), P(q, null, le(e(u), (B, H) => (_(), P("div", {
1459
+ key: B.name,
1460
+ class: "space-y-8 py-12"
1461
+ }, [
1462
+ x("div", mo, [
1463
+ x("div", po, D(B.name), 1),
1464
+ i(Se, { json: B }, null, 8, ["json"]),
1465
+ i(R, {
1466
+ icon: "edit",
1467
+ size: "md",
1468
+ variant: "tertiary",
1469
+ onClick: (K) => Z(H)
1470
+ }, null, 8, ["onClick"])
1471
+ ]),
1472
+ x("div", yo, [
1473
+ (_(!0), P(q, null, le(B.bundles, (K, p) => (_(), O(ht, {
1474
+ bundle: K,
1475
+ key: K._id,
1476
+ onEdit: (o) => te({
1477
+ bundle: K,
1478
+ category: H,
1479
+ index: p,
1480
+ categories: e(d)
1481
+ }),
1482
+ onDelete: (o) => ae(null, H, p)
1483
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1484
+ i(_t, {
1485
+ onCreate: (K) => te({
1486
+ category: H,
1487
+ index: -1,
1488
+ categories: e(d)
1489
+ })
1490
+ }, null, 8, ["onCreate"])
1491
+ ])
1492
+ ]))), 128)),
1493
+ i(io, {
1494
+ ref_key: "bundleSheetRef",
1495
+ ref: l,
1496
+ onUpdate: ae
1497
+ }, null, 512)
1498
+ ], 64)) : (_(), O(A, {
1499
+ key: 1,
1500
+ variant: "outlined",
1501
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1502
+ }, {
1503
+ default: T(() => [
1504
+ fo,
1505
+ x("div", bo, [
1506
+ x("div", go, D(e(a)("connect.store.bundle.title")), 1),
1507
+ x("div", vo, D(e(a)("connect.store.bundle.description")), 1)
1508
+ ]),
1509
+ i(R, {
1510
+ variant: "primary",
1511
+ label: e(a)("connect.store.actions.addCategory"),
1512
+ icon: "add",
1513
+ onClick: w[0] || (w[0] = (B) => Z(-1))
1514
+ }, null, 8, ["label"])
1515
+ ]),
1516
+ _: 1
1517
+ })),
1518
+ i(Wt, {
1519
+ ref_key: "settingSheetRef",
1520
+ ref: V,
1521
+ onUpdate: M
1522
+ }, null, 512)
1523
+ ])
1524
+ ], 64);
1525
+ };
1526
+ }
1527
+ });
1528
+ export {
1529
+ Lo as default
1530
+ };