@feedmepos/mf-connect 0.0.16-beta.1 → 0.0.16-beta.11

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