@feedmepos/mf-connect 0.0.39-prod → 0.1.0-beta.2

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 (101) hide show
  1. package/dist/Analytic-DSD9TsKr.js +622 -0
  2. package/dist/{App-X3fNEBF3.js → App-D8a5eW51.js} +250 -249
  3. package/dist/Broadcast-C8jgMe6g.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CRYS_tzZ.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js} +20 -20
  5. package/dist/Card-C1K7ULPo.js +825 -0
  6. package/dist/Collections-lMrdPUuM.js +453 -0
  7. package/dist/Credit-CJfU5tP4.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DoZyevfa.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js} +1042 -1011
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js +345 -0
  10. package/dist/Experience-Bp2ki8gU.js +221 -0
  11. package/dist/Game-BpTf6ebE.js +255 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  13. package/dist/{MainLayout-DpZC6o3R.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +19 -53
  14. package/dist/MainLayout-B1aJoR95.js +41 -0
  15. package/dist/Marketing-BiKE2gxA.js +316 -0
  16. package/dist/Member-BSWyy32a.js +69 -0
  17. package/dist/MemberList-CHlGREyR.js +1733 -0
  18. package/dist/MemberOverview-wL_ailso.js +58 -0
  19. package/dist/{MemberTransactions-DueaXBCy.js → MemberTransactions-BzHiXCnp.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js +432 -0
  21. package/dist/Mission-8IGT3T2C.js +261 -0
  22. package/dist/Point-CbbJ6ohd.js +222 -0
  23. package/dist/Promotion-BYXCJa_S.js +247 -0
  24. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-_RX1J0Br.js → RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js} +557 -557
  25. package/dist/Segment-DXDNM0yd.js +437 -0
  26. package/dist/Setting-CLpvvZTv.js +1901 -0
  27. package/dist/Store-C6-P6bwc.js +1511 -0
  28. package/dist/StoreRewards-CUM2irXK.js +401 -0
  29. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CLFiuO5k.js → StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js} +10 -10
  30. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CoMQBL4P.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js} +1 -1
  31. package/dist/{Tier-CftEoP_R.js → Tier-DZTDxWBo.js} +481 -453
  32. package/dist/{Title-BsavXbYh.js → Title-C2Dr5ceK.js} +314 -295
  33. package/dist/Transaction-BL4mS29d.js +39 -0
  34. package/dist/Voucher-Cx0r2-df.js +490 -0
  35. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js +56 -0
  36. package/dist/{app-BNmAx3zq.js → app-B_xuZ5HB.js} +1 -1
  37. package/dist/app-wE5HTF_Y.js +5762 -0
  38. package/dist/app.js +5 -3
  39. package/dist/{business-DGL4Ayx0.js → business-DSv8zM8C.js} +1 -1
  40. package/dist/{campaign-D94sS1kM.js → campaign-7y5qquHZ.js} +5 -3
  41. package/dist/{collection.fn-BHJ1ISqO.js → collection.fn-BxVZQAx0.js} +2 -2
  42. package/dist/dto-Ew1QwLci.js +2778 -0
  43. package/dist/{effect-CFRICzlM.js → effect-BzPh8fRI.js} +9 -9
  44. package/dist/{export-w2o9NYcy.js → export-C9tDplkA.js} +3 -3
  45. package/dist/{helper-CUDWQ8vq.js → helper-Sz7oQ0F4.js} +1 -1
  46. package/dist/{index-BGuLhEym.js → index-BQm0C3Jm.js} +3 -3
  47. package/dist/{index-BjwyxNSp.js → index-C-SOz7jt.js} +1 -1
  48. package/dist/{index-BcWJcD9f.js → index-C0lpADCo.js} +1 -1
  49. package/dist/{index-DIq2KVis.js → index-C3_4GUiI.js} +1 -1
  50. package/dist/{index-BPEV5Tzg.js → index-D-2nFLsg.js} +59 -47
  51. package/dist/{index-CFMBSL24.js → index-DBMaUGYI.js} +2 -2
  52. package/dist/{index-CpwFQFTV.js → index-DH_1nOJ_.js} +3 -3
  53. package/dist/index-Dy4pmQpt.js +29193 -0
  54. package/dist/{index-BQ6isIeo.js → index-_3qBsogG.js} +1 -1
  55. package/dist/index-gIRszcHf.js +3 -0
  56. package/dist/{index-VjUw31dN.js → index-tv4t0Pnh.js} +1 -1
  57. package/dist/{index-tZ1aqhks.js → index-z0IfdrZk.js} +319 -281
  58. package/dist/{index.esm2017-zciuPty-.js → index.esm2017-BnKJDxUo.js} +55 -55
  59. package/dist/{loading-GuXe5bYG.js → loading-Ds-yFYhc.js} +469 -460
  60. package/dist/{membership-BHWJVI3e.js → membership-DaiVw9qF.js} +3 -3
  61. package/dist/money-BHtBdZoz.js +15 -0
  62. package/dist/number-CZhcB8ef.js +12 -0
  63. package/dist/{rule-MgNa_8FF.js → rule-Cd2M6Ri2.js} +2 -2
  64. package/dist/{rule-builder-BsBCWzq_.js → rule-builder-B6og27Q1.js} +1 -1
  65. package/dist/style.css +1 -1
  66. package/dist/{template-D6k3lusq.js → template-DouRWBpv.js} +63 -63
  67. package/dist/{usePagination-JoYaROkV.js → usePagination-BeF5K3M7.js} +85 -85
  68. package/dist/vue-i18n-BTlOChXs.js +2365 -0
  69. package/dist/{xlsx-ClrA4KOh.js → xlsx-SahfXQ70.js} +517 -517
  70. package/dist/zod-Bg2FbC-D.js +90 -0
  71. package/package.json +7 -4
  72. package/dist/Analytic-DMFueUju.js +0 -620
  73. package/dist/Broadcast-YIfWIXeA.js +0 -216
  74. package/dist/Card-BIxlgQm7.js +0 -824
  75. package/dist/Collections-M6DaHM2W.js +0 -441
  76. package/dist/Credit-BtRy-xoY.js +0 -214
  77. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-D5DNTBSQ.js +0 -344
  78. package/dist/Experience-DGm1lnqj.js +0 -211
  79. package/dist/Game-B8-lG7qq.js +0 -250
  80. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
  81. package/dist/Marketing-DtG3AIWr.js +0 -309
  82. package/dist/Member-K443-9Vy.js +0 -92
  83. package/dist/MemberList-CYXHXFTL.js +0 -1735
  84. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  85. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Bk2HLVmt.js +0 -203
  86. package/dist/Mission-CN5umXXA.js +0 -248
  87. package/dist/Point-XAm6H2p_.js +0 -220
  88. package/dist/Promotion-DsrA4KiE.js +0 -244
  89. package/dist/Segment-CZGGHoAu.js +0 -435
  90. package/dist/Setting-BjfxLKyp.js +0 -1870
  91. package/dist/Store-D_B-vhh3.js +0 -1513
  92. package/dist/StoreRewards-BjHffUKj.js +0 -429
  93. package/dist/Transaction-CdxzoKDG.js +0 -36
  94. package/dist/Voucher-B_9Nv1Mr.js +0 -485
  95. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  96. package/dist/app--1Ks5Hms.js +0 -2974
  97. package/dist/dto-X0Eeujxx.js +0 -1151
  98. package/dist/index-BPNG8N-w.js +0 -11
  99. package/dist/index-DWM9MWGj.js +0 -28058
  100. package/dist/money-CrttVpCp.js +0 -15
  101. package/dist/number-CIndGU4O.js +0 -12
@@ -0,0 +1,1511 @@
1
+ import { defineComponent as X, computed as D, resolveComponent as F, openBlock as x, createBlock as A, withCtx as P, createElementVNode as h, createElementBlock as $, createVNode as i, createCommentVNode as j, toDisplayString as B, unref as e, Fragment as L, renderList as le, ref as N, isRef as ie, reactive as Me, onMounted as ye, watch as Ve, toRaw as je, createTextVNode as se, h as Le } from "vue";
2
+ import { _ as qe } from "./tier-BJDhpH6X.js";
3
+ import { useDialog as Ae, useDialogChild as Ne, components as He } from "@feedmepos/ui-library";
4
+ import { r as ee, k as fe, t as Ie, S as Ke, c as We, e as G } from "./index-Dy4pmQpt.js";
5
+ import { d as te, a as ze, u as Je, p as be, n as Ye, f as ve } from "./loading-Ds-yFYhc.js";
6
+ import { u as Ce, C as ue } from "./membership-DaiVw9qF.js";
7
+ import { a as Ge, c as Be } from "./object-qECH92oz.js";
8
+ import { _ as re } from "./lodash-B5I3zXaY.js";
9
+ import { u as pe } from "./vue-i18n-BTlOChXs.js";
10
+ import { Z as z, g as K, a as W } from "./zod-Bg2FbC-D.js";
11
+ import { z as J, R as Xe } from "./app-wE5HTF_Y.js";
12
+ import { F as Ze, a as Qe, b as et, c as De } from "./index-BQm0C3Jm.js";
13
+ import { u as xe } from "./app-wDQR6dpb.js";
14
+ import { _ as Z } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js";
15
+ import { J as Fe } from "./JsonViewer-v8_C7l5N.js";
16
+ import { _ as tt } from "./index-_3qBsogG.js";
17
+ import { _ as ot } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
18
+ import { _ as nt } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
19
+ import { z as lt, a as at } from "./money-BHtBdZoz.js";
20
+ import { F as st } from "./number-CZhcB8ef.js";
21
+ import { t as rt } from "./helper-Sz7oQ0F4.js";
22
+ import "./index-gIRszcHf.js";
23
+ import { useRouter as it } from "vue-router";
24
+ import { m as ge } from "./index-C3_4GUiI.js";
25
+ function dt(f) {
26
+ return te.DineroFactory(f).toUnit();
27
+ }
28
+ function ut(f, g, l, y, c = [], b = []) {
29
+ const n = tt.compact(
30
+ g.map((u) => f.find((d) => d.systemCode === u.systemCode && d.taxCode === u.taxCode)).filter((u) => !!u && b.includes(u.systemCode))
31
+ ), r = n.reduce(
32
+ (u, d) => {
33
+ var a;
34
+ return Object.assign(u, {
35
+ [d.taxCode]: {
36
+ inclusive: ((a = c.find((_) => _.systemCode === d.systemCode)) == null ? void 0 : a.inclusive) || !1,
37
+ adjustment: {
38
+ level: 1,
39
+ type: {
40
+ type: "BY_MULTIPLIER",
41
+ amount: {
42
+ amount: d.rate.amount,
43
+ precision: d.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: y }).toObject()).toObject()
62
+ }
63
+ }
64
+ },
65
+ taxes: r
66
+ }
67
+ },
68
+ adjustments: {},
69
+ roundToNearest: 0
70
+ });
71
+ return n.map((u) => ({
72
+ setting: u,
73
+ systemCode: u.systemCode,
74
+ name: u.name,
75
+ taxCode: u.taxCode,
76
+ rate: u.rate,
77
+ total: te.DineroFactory({
78
+ ...t.items[0].taxes[u.taxCode]
79
+ }).convertPrecision(2).toObject()
80
+ }));
81
+ }
82
+ function ct(f, g, l) {
83
+ return f ? f.reduce((y, c) => {
84
+ var b;
85
+ return (b = l.find((n) => n.systemCode === c.systemCode)) != null && b.inclusive || (y = te.DineroFactory(y.toObject()).add(c.total)), y;
86
+ }, te.DineroFactory(g)).toObject() : te.DineroFactory(g).toObject();
87
+ }
88
+ 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 = {
89
+ key: 2,
90
+ class: "absolute top-2 left-2"
91
+ }, ft = { class: "absolute top-0 right-0" }, bt = { class: "fm-typo-en-body-lg-600" }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, gt = { class: "flex gap-8 items-center flex-wrap" }, ht = /* @__PURE__ */ X({
92
+ __name: "StoreBundleCard",
93
+ props: {
94
+ bundle: { type: Object, required: !0 }
95
+ },
96
+ emits: ["edit", "delete"],
97
+ setup(f, { emit: g }) {
98
+ const l = f, y = g, c = D(() => {
99
+ const n = [];
100
+ return l.bundle.price.amount > 0 && n.push(
101
+ `${ee.getCountry().currency.symbol}${dt(l.bundle.price)}`
102
+ ), l.bundle.coinPrice && n.push(`${l.bundle.coinPrice} point(s)`), n.join(" or ");
103
+ }), b = D(() => {
104
+ var r, t;
105
+ const n = [];
106
+ if (l.bundle.titles.length > 0 && n.push(`${l.bundle.titles.length} title(s)`), l.bundle.vouchers.length > 0 && n.push(`${l.bundle.vouchers.length} voucher(s)`), l.bundle.credit.normal || (r = l.bundle.credit.free) != null && r.amount) {
107
+ const u = l.bundle.credit.normal + (((t = l.bundle.credit.free) == null ? void 0 : t.amount) ?? 0);
108
+ n.push(`${u} credit(s)`);
109
+ }
110
+ return n;
111
+ });
112
+ return (n, r) => {
113
+ const t = F("FmIcon"), u = F("FmChip"), d = F("FmButton"), a = F("FmMenuItem"), _ = F("FmMenu"), v = F("FmCard");
114
+ return x(), A(v, {
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: P(() => [
119
+ h("div", mt, [
120
+ f.bundle.image ? (x(), $("img", {
121
+ key: 1,
122
+ src: f.bundle.image,
123
+ class: "w-full h-full object-contain aspect-video"
124
+ }, null, 8, pt)) : (x(), A(t, {
125
+ key: 0,
126
+ name: "image",
127
+ outline: !0,
128
+ size: "md",
129
+ class: "text-fm-color-neutral-gray-200"
130
+ })),
131
+ f.bundle.isFeedvibe ? (x(), $("div", yt, [
132
+ i(u, {
133
+ label: "Feedvibe",
134
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
135
+ compact: ""
136
+ })
137
+ ])) : j("", !0),
138
+ h("div", ft, [
139
+ i(_, { placement: "bottom-end" }, {
140
+ "menu-button": P(() => [
141
+ i(d, {
142
+ icon: "more_vert",
143
+ variant: "tertiary"
144
+ })
145
+ ]),
146
+ default: P(() => [
147
+ i(a, {
148
+ onClick: r[0] || (r[0] = (s) => y("edit", f.bundle)),
149
+ label: "Edit"
150
+ }),
151
+ i(a, {
152
+ onClick: r[1] || (r[1] = (s) => y("delete", f.bundle)),
153
+ label: "Delete"
154
+ })
155
+ ]),
156
+ _: 1
157
+ })
158
+ ])
159
+ ]),
160
+ h("div", bt, B(f.bundle.name), 1),
161
+ h("div", vt, B(e(c) || "Free"), 1),
162
+ h("div", gt, [
163
+ (x(!0), $(L, null, le(e(b), (s, U) => (x(), A(u, {
164
+ key: U,
165
+ label: s
166
+ }, null, 8, ["label"]))), 128))
167
+ ])
168
+ ]),
169
+ _: 1
170
+ });
171
+ };
172
+ }
173
+ }), xt = /* @__PURE__ */ X({
174
+ __name: "AddBundleCard",
175
+ emits: ["create"],
176
+ setup(f, { emit: g }) {
177
+ const { t: l } = pe(), y = g;
178
+ return (c, b) => {
179
+ const n = F("FmButton"), r = F("FmCard");
180
+ return x(), A(r, {
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: P(() => [
185
+ i(n, {
186
+ onClick: b[0] || (b[0] = (t) => y("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
+ }), _t = { class: "space-y-16" }, Vt = { class: "flex w-full justify-between pb-16" }, Ct = { class: "flex items-center justify-end gap-8" }, Ft = /* @__PURE__ */ X({
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(f) {
209
+ const { t: g } = pe(), l = f, y = Ae(), { emitData: c, emitAction: b } = Ne(), n = N(l.initialValue), r = J.string().min(1);
210
+ function t() {
211
+ c(n.value), b("primary"), y.close();
212
+ }
213
+ function u() {
214
+ c(null), b("primary"), y.close();
215
+ }
216
+ return (d, a) => {
217
+ const _ = F("FmTextField"), v = F("FmButton");
218
+ return x(), $("div", _t, [
219
+ i(_, {
220
+ modelValue: e(n),
221
+ "onUpdate:modelValue": a[0] || (a[0] = (s) => ie(n) ? n.value = s : null),
222
+ label: e(g)("connect.store.category.label"),
223
+ rules: [e(z).toRule(e(r))]
224
+ }, null, 8, ["modelValue", "label", "rules"]),
225
+ h("div", Vt, [
226
+ h("div", null, [
227
+ f.action == "edit" ? (x(), A(v, {
228
+ key: 0,
229
+ onClick: u,
230
+ label: e(g)("connect.common.delete"),
231
+ variant: "destructive"
232
+ }, null, 8, ["label"])) : j("", !0)
233
+ ]),
234
+ h("div", Ct, [
235
+ i(v, {
236
+ label: e(g)("connect.common.cancel"),
237
+ variant: "tertiary",
238
+ onClick: a[1] || (a[1] = (s) => e(y).close())
239
+ }, null, 8, ["label"]),
240
+ i(v, {
241
+ label: f.action == "edit" ? e(g)("connect.common.edit") : e(g)("connect.common.add"),
242
+ disabled: !e(n),
243
+ onClick: t
244
+ }, null, 8, ["label", "disabled"])
245
+ ])
246
+ ])
247
+ ]);
248
+ };
249
+ }
250
+ }), St = { class: "space-y-16" }, wt = { class: "flex items-center justify-end gap-8 pb-16" }, $t = /* @__PURE__ */ X({
251
+ __name: "SelectCategoryDialog",
252
+ setup(f) {
253
+ const { emitData: g, emitAction: l } = Ne(), y = Ce(), c = N(), b = D(
254
+ () => y.sortedStoreCategories.map((n, r) => ({
255
+ label: n.name,
256
+ value: r
257
+ }))
258
+ );
259
+ return (n, r) => {
260
+ const t = F("FmSelect"), u = F("FmButton");
261
+ return x(), $("div", St, [
262
+ r[4] || (r[4] = h("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Select a category to create FeedMe CNY 2025 bundle ", -1)),
263
+ i(t, {
264
+ placeholder: "Select a category",
265
+ items: e(b),
266
+ modelValue: e(c),
267
+ "onUpdate:modelValue": [
268
+ r[0] || (r[0] = (d) => ie(c) ? c.value = d : null),
269
+ r[1] || (r[1] = (d) => e(g)(d))
270
+ ],
271
+ label: "Category"
272
+ }, null, 8, ["items", "modelValue"]),
273
+ h("div", wt, [
274
+ i(u, {
275
+ variant: "tertiary",
276
+ label: "Cancel",
277
+ onClick: r[2] || (r[2] = (d) => e(l)("tertiary"))
278
+ }),
279
+ i(u, {
280
+ label: "Select",
281
+ onClick: r[3] || (r[3] = (d) => e(l)("primary")),
282
+ disabled: e(c) == null
283
+ }, null, 8, ["disabled"])
284
+ ])
285
+ ]);
286
+ };
287
+ }
288
+ });
289
+ function he(f) {
290
+ return f.states.map((g) => ({ label: g, value: g }));
291
+ }
292
+ const Pt = {
293
+ [fe.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 he(this);
314
+ }
315
+ },
316
+ [fe.enum.SG]: {
317
+ states: [],
318
+ get stateItems() {
319
+ return he(this);
320
+ }
321
+ },
322
+ [fe.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 he(this);
360
+ }
361
+ }
362
+ }, ce = () => ee.getCountry(), me = {
363
+ get fullCurrency() {
364
+ return ce().currency;
365
+ },
366
+ get currency() {
367
+ return ce().currency.code;
368
+ },
369
+ get fullTax() {
370
+ return Ie.getCountryFlattenTaxes(ce().code);
371
+ },
372
+ get taxSystem() {
373
+ return ce().taxSystems;
374
+ },
375
+ taxInclusion(f) {
376
+ return me.taxSystem.map((g) => ({
377
+ systemCode: g.code,
378
+ inclusive: f !== void 0 ? f : !1
379
+ }));
380
+ },
381
+ groupedTaxOptions() {
382
+ const f = Ie.getCountryFlattenTaxes(ce().code);
383
+ return me.taxSystem.map((g) => ({
384
+ code: g.code,
385
+ options: f.map((l) => ({ ...l, feedmeTaxCode: me.generateCode(l) })).filter((l) => l.systemCode === g.code)
386
+ }));
387
+ },
388
+ systemDefaultCode(f) {
389
+ const g = me.groupedTaxOptions().find((l) => l.code === f);
390
+ return g == null ? void 0 : g.options.find((l) => l.default);
391
+ },
392
+ generateCode(f) {
393
+ return `${f.systemCode}/${f.taxCode}`;
394
+ }
395
+ }, Q = me, kt = /* @__PURE__ */ X({
396
+ __name: "TaxInclusiveSetting",
397
+ props: {
398
+ modelValue: {
399
+ type: Array,
400
+ required: !0,
401
+ default: () => []
402
+ }
403
+ },
404
+ emits: ["update:model-value"],
405
+ setup(f, { emit: g }) {
406
+ const l = f, y = Q.taxSystem, c = g, b = N(l.modelValue);
407
+ function n(d, a) {
408
+ const _ = re.clone(l.modelValue), v = _.findIndex((s) => s.systemCode === d);
409
+ v >= 0 ? _[v].inclusive = a : _.push({
410
+ systemCode: d,
411
+ inclusive: a
412
+ }), b.value = _, c("update:model-value", _);
413
+ }
414
+ function r() {
415
+ return y.map((d) => {
416
+ const a = l.modelValue ? l.modelValue.find((_) => _.systemCode === d.code) : !1;
417
+ return {
418
+ label: d.name,
419
+ config: {
420
+ value: a ? a.inclusive : !1
421
+ },
422
+ input: (_) => {
423
+ n(d.code, _);
424
+ }
425
+ };
426
+ });
427
+ }
428
+ const t = Me(r());
429
+ function u(d, a) {
430
+ return `${d} ${a ? "Inclusive" : "Exclusive"}`;
431
+ }
432
+ return ye(() => {
433
+ l.modelValue.length || n(y[0].code, !1);
434
+ }), Ve(
435
+ () => l.modelValue,
436
+ (d, a) => {
437
+ d != a && !d.length && n(y[0].code, !1);
438
+ }
439
+ ), (d, a) => {
440
+ const _ = F("FmSwitch");
441
+ return x(!0), $(L, null, le(e(t), (v, s) => {
442
+ var U;
443
+ return x(), $("div", { key: s }, [
444
+ i(_, {
445
+ "model-value": ((U = e(b)[s]) == null ? void 0 : U.inclusive) || !1,
446
+ "label-placement": "left",
447
+ "onUpdate:modelValue": (R) => v.input(R)
448
+ }, {
449
+ label: P(() => {
450
+ var R;
451
+ return [
452
+ h("div", null, B(u(v.label, ((R = e(b)[s]) == null ? void 0 : R.inclusive) || !1)), 1)
453
+ ];
454
+ }),
455
+ _: 2
456
+ }, 1032, ["model-value", "onUpdate:modelValue"])
457
+ ]);
458
+ }), 128);
459
+ };
460
+ }
461
+ });
462
+ var Tt = { mode: "development", appMode: "mf" };
463
+ const Ut = { class: "space-y-8" }, Rt = {
464
+ key: 0,
465
+ class: "space-y-16"
466
+ }, It = /* @__PURE__ */ X({
467
+ __name: "StripeSetting",
468
+ props: {
469
+ modelValue: {}
470
+ },
471
+ emits: ["update:modelValue"],
472
+ setup(f, { emit: g }) {
473
+ const l = f, y = g, c = N(!1);
474
+ Ve(c, (n, r) => {
475
+ r != n && (!l.modelValue && n ? y("update:modelValue", {
476
+ apiKey: "",
477
+ webhookSecret: ""
478
+ }) : n || y("update:modelValue", void 0));
479
+ });
480
+ const b = D(() => {
481
+ const n = Tt.mode === "development", r = ee.getCountry().code.toLowerCase(), t = r != "my" ? `.${r}` : "";
482
+ return `https://marketing${n ? "-dev" : ""}${t}.feedmeapi.com/stripe/${Ke.getBusinessId()}/webhook`;
483
+ });
484
+ return ye(() => {
485
+ c.value = !!l.modelValue;
486
+ }), (n, r) => {
487
+ const t = F("FmSwitch"), u = F("FmTextField"), d = F("FmButton");
488
+ return x(), $("div", Ut, [
489
+ i(t, {
490
+ modelValue: e(c),
491
+ "onUpdate:modelValue": r[0] || (r[0] = (a) => ie(c) ? c.value = a : null),
492
+ value: "true",
493
+ label: "Enable Stripe"
494
+ }, null, 8, ["modelValue"]),
495
+ l.modelValue ? (x(), $("div", Rt, [
496
+ i(u, {
497
+ label: "API Key",
498
+ modelValue: l.modelValue.apiKey,
499
+ "onUpdate:modelValue": r[1] || (r[1] = (a) => l.modelValue.apiKey = a),
500
+ "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
501
+ }, null, 8, ["modelValue"]),
502
+ i(u, {
503
+ label: "Webhook URL",
504
+ "model-value": e(b),
505
+ readonly: "",
506
+ "helper-text": "Copy this URL to your Stripe dashboard"
507
+ }, {
508
+ append: P(() => [
509
+ i(d, {
510
+ icon: "content_copy",
511
+ variant: "tertiary",
512
+ onClick: r[2] || (r[2] = (a) => e(ze)(e(b)))
513
+ })
514
+ ]),
515
+ _: 1
516
+ }, 8, ["model-value"]),
517
+ i(u, {
518
+ modelValue: l.modelValue.webhookSecret,
519
+ "onUpdate:modelValue": r[3] || (r[3] = (a) => l.modelValue.webhookSecret = a),
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
+ }), Bt = {
529
+ key: 0,
530
+ class: "space-y-16 pr-12"
531
+ }, Dt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, At = {
532
+ key: 0,
533
+ class: "space-y-16"
534
+ }, Nt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Ot = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Et = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, Mt = { class: "space-y-4" }, jt = { class: "fm-typo-en-body-lg-400" }, Lt = { class: "space-y-16" }, qt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Ht = { class: "flex items-center gap-8" }, Kt = /* @__PURE__ */ X({
535
+ __name: "StoreSettingSheet",
536
+ emits: ["update"],
537
+ setup(f, { expose: g, emit: l }) {
538
+ const { t: y } = pe(), c = l, b = N(!1), n = N(), r = N(!1), t = Ze.extend({
539
+ company: Qe.extend({
540
+ name: J.string().min(1, "Company name is required"),
541
+ regNo: J.string().min(1, "Registration number is required"),
542
+ address: et.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
+ }), u = D(() => t.safeParse(n.value).success);
554
+ function d() {
555
+ const v = t.safeParse(n.value);
556
+ v.success && c("update", v.data);
557
+ }
558
+ function a() {
559
+ return {
560
+ company: {
561
+ name: "",
562
+ address: {
563
+ line1: "",
564
+ line2: "",
565
+ city: "",
566
+ postcode: "",
567
+ state: "",
568
+ country: ee.getCountry().name
569
+ },
570
+ phoneNo: "",
571
+ regNo: "",
572
+ sstRegNo: ""
573
+ },
574
+ inclusiveTaxes: []
575
+ };
576
+ }
577
+ function _(v, s) {
578
+ b.value = v, v && (n.value = s != null && s.company ? s : a());
579
+ }
580
+ return g({
581
+ showSheet: _,
582
+ data: n
583
+ }), (v, s) => {
584
+ const U = F("FmIcon"), R = F("FmMenuItem"), ae = F("FmMenu"), oe = F("FmSelect"), M = F("FmButton"), V = F("FmSideSheet");
585
+ return x(), A(V, {
586
+ "max-width": 560,
587
+ modelValue: e(b),
588
+ "onUpdate:modelValue": s[15] || (s[15] = (w) => ie(b) ? b.value = w : null),
589
+ header: e(y)("connect.store.setting.title")
590
+ }, {
591
+ "side-sheet-footer": P(() => [
592
+ h("div", Ht, [
593
+ i(M, {
594
+ label: e(y)("connect.common.save"),
595
+ onClick: d,
596
+ disabled: !e(u) || e(xe)().isLoading,
597
+ loading: e(xe)().isLoading
598
+ }, null, 8, ["label", "disabled", "loading"]),
599
+ i(M, {
600
+ label: e(y)("connect.common.cancel"),
601
+ onClick: s[14] || (s[14] = (w) => _(!1)),
602
+ variant: "tertiary"
603
+ }, null, 8, ["label"])
604
+ ])
605
+ ]),
606
+ default: P(() => {
607
+ var w, k;
608
+ return [
609
+ i(Fe, { json: e(n) }, null, 8, ["json"]),
610
+ e(n) && e(n).company ? (x(), $("div", Bt, [
611
+ h("div", Dt, B(e(y)("connect.store.setting.company.legal_info")), 1),
612
+ i(Z, {
613
+ modelValue: e(n).company.name,
614
+ "onUpdate:modelValue": s[0] || (s[0] = (p) => e(n).company.name = p),
615
+ label: e(y)("connect.store.setting.company.name"),
616
+ schema: e(z).typeAtPath(e(t), "company.name")
617
+ }, null, 8, ["modelValue", "label", "schema"]),
618
+ i(Z, {
619
+ modelValue: e(n).company.regNo,
620
+ "onUpdate:modelValue": s[1] || (s[1] = (p) => e(n).company.regNo = p),
621
+ label: e(y)("connect.store.setting.company.reg_no"),
622
+ schema: e(z).typeAtPath(e(t), "company.regNo")
623
+ }, null, 8, ["modelValue", "label", "schema"]),
624
+ i(Z, {
625
+ modelValue: e(n).company.sstRegNo,
626
+ "onUpdate:modelValue": [
627
+ s[2] || (s[2] = (p) => e(n).company.sstRegNo = p),
628
+ s[3] || (s[3] = (p) => p ? null : e(n).inclusiveTaxes = [])
629
+ ],
630
+ label: e(y)("connect.store.setting.company.tax_reg_no"),
631
+ schema: e(z).typeAtPath(e(t), "company.sstRegNo")
632
+ }, null, 8, ["modelValue", "label", "schema"]),
633
+ (w = e(n).company) != null && w.sstRegNo && e(n).inclusiveTaxes ? (x(), $("div", At, [
634
+ h("div", Nt, B(e(y)("connect.store.setting.company.tax")), 1),
635
+ i(kt, {
636
+ modelValue: e(n).inclusiveTaxes,
637
+ "onUpdate:modelValue": s[4] || (s[4] = (p) => e(n).inclusiveTaxes = p)
638
+ }, null, 8, ["modelValue"])
639
+ ])) : j("", !0),
640
+ i(Z, {
641
+ modelValue: e(n).company.phoneNo,
642
+ "onUpdate:modelValue": s[5] || (s[5] = (p) => e(n).company.phoneNo = p),
643
+ label: e(y)("connect.store.setting.company.phone"),
644
+ schema: e(z).typeAtPath(e(t), "company.phoneNo")
645
+ }, null, 8, ["modelValue", "label", "schema"]),
646
+ h("div", Ot, B(e(y)("connect.store.setting.company.address.title")), 1),
647
+ i(Z, {
648
+ modelValue: e(n).company.address.line1,
649
+ "onUpdate:modelValue": s[6] || (s[6] = (p) => e(n).company.address.line1 = p),
650
+ label: e(y)("connect.store.setting.company.address.line1"),
651
+ schema: e(z).typeAtPath(e(t), "company.address.line1")
652
+ }, null, 8, ["modelValue", "label", "schema"]),
653
+ i(Z, {
654
+ modelValue: e(n).company.address.line2,
655
+ "onUpdate:modelValue": s[7] || (s[7] = (p) => e(n).company.address.line2 = p),
656
+ label: e(y)("connect.store.setting.company.address.line2"),
657
+ schema: e(z).typeAtPath(e(t), "company.address.line2")
658
+ }, null, 8, ["modelValue", "label", "schema"]),
659
+ h("div", Et, [
660
+ i(Z, {
661
+ modelValue: e(n).company.address.city,
662
+ "onUpdate:modelValue": s[8] || (s[8] = (p) => e(n).company.address.city = p),
663
+ label: e(y)("connect.store.setting.company.address.city"),
664
+ schema: e(z).typeAtPath(e(t), "company.address.city")
665
+ }, null, 8, ["modelValue", "label", "schema"]),
666
+ i(Z, {
667
+ modelValue: e(n).company.address.postcode,
668
+ "onUpdate:modelValue": s[9] || (s[9] = (p) => e(n).company.address.postcode = p),
669
+ label: e(y)("connect.store.setting.company.address.postcode"),
670
+ schema: e(z).typeAtPath(e(t), "company.address.postcode")
671
+ }, null, 8, ["modelValue", "label", "schema"]),
672
+ h("div", Mt, [
673
+ h("div", jt, B(e(y)("connect.store.setting.company.address.state")), 1),
674
+ i(ae, {
675
+ placement: "top-end",
676
+ "model-value": e(r)
677
+ }, {
678
+ "menu-button": P(() => [
679
+ i(Z, {
680
+ modelValue: e(n).company.address.state,
681
+ "onUpdate:modelValue": s[10] || (s[10] = (p) => e(n).company.address.state = p),
682
+ schema: e(z).typeAtPath(e(t), "company.address.state"),
683
+ onFocusChanged: s[11] || (s[11] = (p) => r.value = p)
684
+ }, {
685
+ append: P(() => [
686
+ i(U, {
687
+ name: e(r) ? "keyboard_arrow_up" : "keyboard_arrow_down"
688
+ }, null, 8, ["name"])
689
+ ]),
690
+ _: 1
691
+ }, 8, ["modelValue", "schema"])
692
+ ]),
693
+ default: P(() => [
694
+ (x(!0), $(L, null, le(e(Pt)[e(ee).getCountry().code].stateItems.filter(
695
+ (p) => {
696
+ var O, I;
697
+ return p.label.toLowerCase().includes(((I = (O = e(n)) == null ? void 0 : O.company) == null ? void 0 : I.address.state.toLowerCase()) ?? "");
698
+ }
699
+ ) || [], (p) => (x(), A(R, {
700
+ key: p.value,
701
+ "model-value": e(n).company.address.state === p.value,
702
+ label: p.label,
703
+ onClick: () => {
704
+ e(n).company.address.state = p.value, r.value = !1;
705
+ }
706
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
707
+ ]),
708
+ _: 1
709
+ }, 8, ["model-value"])
710
+ ]),
711
+ i(oe, {
712
+ label: e(y)("connect.store.setting.company.address.country"),
713
+ modelValue: e(n).company.address.country,
714
+ "onUpdate:modelValue": s[12] || (s[12] = (p) => e(n).company.address.country = p),
715
+ items: [
716
+ {
717
+ label: e(ee).getCountry().name,
718
+ value: e(ee).getCountry().name
719
+ }
720
+ ],
721
+ rules: [e(z).ruleAtPath(e(t), "company.address.country")]
722
+ }, null, 8, ["label", "modelValue", "items", "rules"])
723
+ ]),
724
+ h("div", Lt, [
725
+ h("div", qt, B(e(y)("connect.store.setting.stripe.title")), 1),
726
+ i(It, {
727
+ "model-value": (k = e(n)) == null ? void 0 : k.stripe,
728
+ "onUpdate:modelValue": s[13] || (s[13] = (p) => e(n).stripe = p)
729
+ }, null, 8, ["model-value"])
730
+ ])
731
+ ])) : j("", !0)
732
+ ];
733
+ }),
734
+ _: 1
735
+ }, 8, ["modelValue", "header"]);
736
+ };
737
+ }
738
+ });
739
+ function Wt(f, g = !0) {
740
+ return We(f).toFormat(g);
741
+ }
742
+ const zt = /* @__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(f, { emit: g }) {
753
+ const l = f, y = g;
754
+ ye(() => {
755
+ if (n.value.length !== b.value.length) {
756
+ const u = b.value.reduce((d, a) => {
757
+ const _ = Q.systemDefaultCode(a.name);
758
+ if (!_) return d;
759
+ const { systemCode: v, taxCode: s } = _;
760
+ return a.value || d.push({ systemCode: v, taxCode: s }), d;
761
+ }, []);
762
+ t(u);
763
+ }
764
+ });
765
+ function c() {
766
+ return Q.groupedTaxOptions();
767
+ }
768
+ const b = D(() => c().map((u) => ({
769
+ name: u.code,
770
+ value: (n.value || []).find(
771
+ (d) => u.options.some((a) => a.feedmeTaxCode === d)
772
+ ),
773
+ options: u.options.map((d) => ({
774
+ label: `${d.name} (${st(d.rate)}%)`,
775
+ value: d.feedmeTaxCode
776
+ }))
777
+ }))), n = D(() => l.modelValue.map((u) => Q.generateCode(u)));
778
+ function r(u) {
779
+ const d = c().find(
780
+ (s) => s.options.some((U) => U.feedmeTaxCode === u)
781
+ ), a = d == null ? void 0 : d.options.find((s) => s.feedmeTaxCode === u);
782
+ if (!a) return;
783
+ const { systemCode: _, taxCode: v } = a;
784
+ t([{ systemCode: _, taxCode: v }]);
785
+ }
786
+ function t(u) {
787
+ const d = re.clone(l.modelValue);
788
+ u.forEach((a) => {
789
+ const _ = c().find(
790
+ (U) => U.options.some((R) => R.feedmeTaxCode === Q.generateCode(a))
791
+ ), v = (_ == null ? void 0 : _.options) || [], s = d.findIndex(
792
+ (U) => v.some((R) => Q.generateCode(R) === Q.generateCode(U))
793
+ );
794
+ s >= 0 ? d.splice(s, 1, a) : d.push(a);
795
+ }), y("update:modelValue", d);
796
+ }
797
+ return (u, d) => {
798
+ const a = F("FmRadio"), _ = F("FmRadioGroup");
799
+ return x(!0), $(L, null, le(e(b), (v) => (x(), $("div", {
800
+ key: v.name,
801
+ class: "flex items-start"
802
+ }, [
803
+ i(_, {
804
+ modelValue: v.value,
805
+ "onUpdate:modelValue": [
806
+ (s) => v.value = s,
807
+ d[0] || (d[0] = (s) => {
808
+ r(s);
809
+ })
810
+ ]
811
+ }, {
812
+ default: P(() => [
813
+ (x(!0), $(L, null, le(v.options, (s, U) => (x(), A(a, {
814
+ key: U,
815
+ value: s.value,
816
+ label: s.label
817
+ }, null, 8, ["value", "label"]))), 128))
818
+ ]),
819
+ _: 2
820
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
821
+ ]))), 128);
822
+ };
823
+ }
824
+ }), _e = {
825
+ get _id() {
826
+ return (/* @__PURE__ */ new Date()).toISOString();
827
+ },
828
+ name: "",
829
+ price: G.zero().toObject(),
830
+ originalPrice: G.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
+ }, Yt = { class: "space-y-8" }, Gt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, Xt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, Zt = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, Qt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, eo = { class: "space-y-8" }, to = { class: "flex items-center justify-between" }, oo = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, no = { class: "space-y-8" }, lo = { class: "flex items-center gap-8" }, ao = /* @__PURE__ */ X({
851
+ __name: "EditBundleSheet",
852
+ emits: ["update"],
853
+ setup(f, { expose: g, emit: l }) {
854
+ const y = l, { t: c } = pe(), b = Ce(), n = N(!1), r = N({
855
+ category: 0,
856
+ index: -1
857
+ }), t = N(re.cloneDeep(_e)), u = N(), d = De, a = D(() => {
858
+ const m = d.safeParse(t.value);
859
+ return m.success ? [] : m.error.errors;
860
+ }), _ = [
861
+ {
862
+ header: "Reward title",
863
+ accessorFn: (m) => m.collectible.name,
864
+ enableSorting: !0
865
+ },
866
+ {
867
+ id: "type",
868
+ header: "Reward type",
869
+ accessorFn: (m) => m.collectible.type,
870
+ cell(m) {
871
+ return ue[m.row.original.collectible.type].chip();
872
+ }
873
+ },
874
+ {
875
+ header: "Description",
876
+ accessorFn: (m) => m.description,
877
+ cell(m) {
878
+ var S;
879
+ const o = m.row.original;
880
+ return o.collectible.type == "VOUCHER" || o.selectedReward == null ? o.description : Le(He.FmStepperField, {
881
+ "onUpdate:modelValue": (T) => {
882
+ t.value.titles = t.value.titles.map(
883
+ (Y) => Y.id == o.collectible._id ? { ...Y, dayToExpire: T } : Y
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
+ ], v = N([]), s = D(() => b.bundleRewards.map((m) => {
894
+ const o = U.value.find((T) => T.id == m._id), S = m.type === "VOUCHER" ? `${m.options.maxUse} use(s), ${rt(m.options.validityOption || {})}` : "No expiry";
895
+ return {
896
+ collectible: m,
897
+ description: S,
898
+ selectedReward: o
899
+ };
900
+ })), U = D(() => {
901
+ var m, o;
902
+ return [
903
+ ...((m = t.value) == null ? void 0 : m.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
+ }), R = D(
913
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
914
+ );
915
+ function ae(m) {
916
+ t.value.subscriptionValidity = m;
917
+ for (const o of t.value.titles)
918
+ o.dayToExpire = m;
919
+ t.value.credit.free && (t.value.credit.free.day = m);
920
+ }
921
+ function oe() {
922
+ const m = s.value, o = t.value;
923
+ if (!(!o || !m))
924
+ for (let S = 0; S < m.length; S++) {
925
+ const T = m[S];
926
+ M.value[S] ? T.collectible.type == "TITLE" ? o.titles.findIndex(
927
+ (ne) => ne.id == T.collectible._id
928
+ ) < 0 && o.titles.push({
929
+ id: T.collectible._id,
930
+ dayToExpire: R.value
931
+ }) : o.vouchers.findIndex(
932
+ (ne) => ne == T.collectible._id
933
+ ) < 0 && o.vouchers.push(T.collectible._id) : (o.titles = o.titles.filter((E) => E.id != T.collectible._id), o.vouchers = o.vouchers.filter(
934
+ (E) => E != T.collectible._id
935
+ ));
936
+ }
937
+ }
938
+ const M = N({});
939
+ Ve(M, oe, { deep: !0 });
940
+ const V = D(() => {
941
+ var m, o;
942
+ return (o = (m = b.storeOption) == null ? void 0 : m.company) == null ? void 0 : o.sstRegNo;
943
+ }), w = D(() => {
944
+ var m, o, S;
945
+ return (S = (o = (m = b.storeOption) == null ? void 0 : m.inclusiveTaxes) == null ? void 0 : o[0]) != null && S.inclusive ? "Inclusive" : "Exclusive";
946
+ }), k = D(() => {
947
+ var m, o, S;
948
+ return ut(
949
+ Q.fullTax,
950
+ je(t.value.taxes),
951
+ t.value.price,
952
+ Number(t.value.credit.normal),
953
+ ((m = b.storeOption) == null ? void 0 : m.inclusiveTaxes) ?? [],
954
+ (S = (o = b.storeOption) == null ? void 0 : o.company) != null && S.sstRegNo ? Q.taxSystem.map((T) => T.code) : []
955
+ );
956
+ }), p = D(() => k.value.reduce(
957
+ (o, S) => o.add(S.total),
958
+ at()
959
+ ).toFormat()), O = D(() => {
960
+ var T;
961
+ const m = ct(
962
+ k.value,
963
+ t.value.price,
964
+ ((T = b.storeOption) == null ? void 0 : T.inclusiveTaxes) ?? []
965
+ );
966
+ t.value.priceWithTaxes = m;
967
+ const o = Wt(m, !1), S = Number(o.replace(/[^\d.-]/g, ""));
968
+ return Number.isNaN(S) ? 0 : S;
969
+ });
970
+ function I() {
971
+ t.value.taxTotals = k.value, y("update", De.parse(Ge(t.value)));
972
+ }
973
+ function q() {
974
+ return re.cloneDeep(_e);
975
+ }
976
+ function H(m, o) {
977
+ n.value = m, m && o && (console.log(o.bundle, "set.bundle"), u.value = void 0, t.value = o.bundle || q(), r.value.category = o.category, r.value.index = o.index, M.value = s.value.reduce((S, T, Y) => (S[Y] = !!T.selectedReward, S), {}));
978
+ }
979
+ return g({
980
+ showSheet: H,
981
+ bundleImage: u,
982
+ target: r,
983
+ data: t
984
+ }), (m, o) => {
985
+ const S = F("FmSwitch"), T = F("FmHelperText"), Y = F("FmTextField"), E = F("FmStepperField"), ne = F("FmMenuItem"), Oe = F("FmTable"), Se = F("FmButton"), Ee = F("FmSideSheet");
986
+ return x(), A(Ee, {
987
+ "max-width": 560,
988
+ modelValue: e(n),
989
+ "onUpdate:modelValue": o[19] || (o[19] = (de) => ie(n) ? n.value = de : null),
990
+ header: e(r).index != -1 ? e(c)("connect.store.bundle.edit.title") : e(c)("connect.store.bundle.edit.create")
991
+ }, {
992
+ "side-sheet-footer": P(() => [
993
+ h("div", lo, [
994
+ i(Se, {
995
+ label: e(r).index != -1 ? "Save" : "Add",
996
+ onClick: I,
997
+ disabled: e(a).length > 0,
998
+ loading: e(xe)().isLoading
999
+ }, null, 8, ["label", "disabled", "loading"]),
1000
+ i(Se, {
1001
+ label: "Cancel",
1002
+ onClick: o[18] || (o[18] = (de) => H(!1)),
1003
+ variant: "tertiary"
1004
+ })
1005
+ ])
1006
+ ]),
1007
+ default: P(() => {
1008
+ var de, we, $e, Pe, ke, Te, Ue, Re;
1009
+ return [
1010
+ i(Fe, { json: e(t) }, null, 8, ["json"]),
1011
+ e(t) ? (x(), $("div", Jt, [
1012
+ h("div", Yt, [
1013
+ e(ee).getCountry().code == "MY" && ((de = e(b).payoutAccount) == null ? void 0 : de.status) == "APPROVED" && ((we = e(b).payoutAccount) != null && we.enable) ? (x(), A(S, {
1014
+ key: 0,
1015
+ "onUpdate:modelValue": o[0] || (o[0] = (C) => {
1016
+ e(t).isFeedvibe = C, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], M.value = {});
1017
+ }),
1018
+ "label-placement": "right",
1019
+ "model-value": e(t).isFeedvibe || !1,
1020
+ label: "Feedvibe Campaign",
1021
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1022
+ }, null, 8, ["model-value"])) : j("", !0),
1023
+ e(t).isFeedvibe ? (x(), A(T, {
1024
+ key: 1,
1025
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1026
+ state: "warning"
1027
+ })) : j("", !0)
1028
+ ]),
1029
+ h("div", Gt, B(e(c)("connect.store.bundle.edit.basicInformation")), 1),
1030
+ i(Y, {
1031
+ label: e(c)("connect.store.bundle.edit.bundleName"),
1032
+ modelValue: e(t).name,
1033
+ "onUpdate:modelValue": o[1] || (o[1] = (C) => e(t).name = C),
1034
+ "helper-state": e(K)(e(a), "name"),
1035
+ "helper-text": e(W)(e(a), "name")
1036
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1037
+ i(ot, {
1038
+ label: e(c)("connect.store.bundle.edit.bundleImage"),
1039
+ class: "w-1/2 xs:w-2/3",
1040
+ "aspect-ratio": "16/9",
1041
+ thumbnail: e(t).image ?? void 0,
1042
+ file: e(u) ?? void 0,
1043
+ "onUpdate:file": o[2] || (o[2] = (C) => {
1044
+ u.value = C;
1045
+ }),
1046
+ "helper-state": e(K)(e(a), "image"),
1047
+ "helper-text": e(W)(e(a), "image")
1048
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1049
+ i(E, {
1050
+ "model-value": e(G).fromFdoDinero(e(t).price).toUnit(),
1051
+ label: e(c)("connect.store.bundle.edit.bundlePrice"),
1052
+ min: 0,
1053
+ "max-fraction-digits": 2,
1054
+ "onUpdate:modelValue": o[3] || (o[3] = (C) => {
1055
+ e(t).price.amount = C * 10 ** e(t).price.precision;
1056
+ }),
1057
+ "is-currency": !0,
1058
+ "show-steppers": !1,
1059
+ "helper-text": e(W)(e(a), "price") || `${e(G).fromNumber({ number: 1 }).toFormat(!0)} = ${e(G).fromNumber({ number: 1 }).toUnit()} credit`,
1060
+ "helper-state": e(K)(e(a), "price")
1061
+ }, {
1062
+ prepend: P(() => [
1063
+ se(B(e(G).defaultCurrency()), 1)
1064
+ ]),
1065
+ _: 1
1066
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1067
+ i(E, {
1068
+ "model-value": e(G).fromFdoDinero(e(t).originalPrice).toUnit(),
1069
+ label: e(c)("connect.store.bundle.edit.bundleValue"),
1070
+ min: 0,
1071
+ "max-fraction-digits": 2,
1072
+ "onUpdate:modelValue": o[4] || (o[4] = (C) => {
1073
+ e(t).originalPrice || (e(t).originalPrice = e(G).zero().toObject()), e(t).originalPrice.amount = C * 10 ** e(t).originalPrice.precision;
1074
+ }),
1075
+ "is-currency": !0,
1076
+ "show-steppers": !1,
1077
+ "helper-text": e(W)(e(a), "originalPrice") || e(c)("connect.store.bundle.edit.originalPriceHelper"),
1078
+ "helper-state": e(K)(e(a), "originalPrice")
1079
+ }, {
1080
+ prepend: P(() => [
1081
+ se(B(e(G).defaultCurrency()), 1)
1082
+ ]),
1083
+ _: 1
1084
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1085
+ e(t).isFeedvibe ? j("", !0) : (x(), A(E, {
1086
+ key: 0,
1087
+ "model-value": e(t).coinPrice ?? null,
1088
+ label: e(c)("connect.store.bundle.edit.pointNeeded"),
1089
+ min: 0,
1090
+ "onUpdate:modelValue": o[5] || (o[5] = (C) => {
1091
+ C > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = C;
1092
+ }),
1093
+ "show-steppers": !1,
1094
+ "helper-state": e(K)(e(a), "coinPrice"),
1095
+ "helper-text": e(W)(e(a), "coinPrice")
1096
+ }, {
1097
+ append: P(() => o[20] || (o[20] = [
1098
+ se(" point(s) ")
1099
+ ])),
1100
+ _: 1
1101
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1102
+ ($e = e(b).storeOption) != null && $e.stripe && !e(t).isFeedvibe ? (x(), $(L, { key: 1 }, [
1103
+ h("div", Xt, B(e(c)("connect.store.bundle.edit.subscriptionSettings")), 1),
1104
+ i(Y, {
1105
+ label: e(c)("connect.store.bundle.edit.stripePriceId"),
1106
+ modelValue: e(t).stripePriceId,
1107
+ "onUpdate:modelValue": o[6] || (o[6] = (C) => e(t).stripePriceId = C),
1108
+ "helper-state": e(K)(e(a), "stripePriceId"),
1109
+ "helper-text": e(W)(e(a), "stripePriceId")
1110
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1111
+ e(t).stripePriceId ? (x(), A(E, {
1112
+ key: 0,
1113
+ "model-value": e(t).subscriptionValidity ?? null,
1114
+ min: 1,
1115
+ "onUpdate:modelValue": ae,
1116
+ label: e(c)("connect.store.bundle.edit.subscriptionValidity"),
1117
+ "show-steppers": !1,
1118
+ "helper-state": e(K)(e(a), "subscriptionValidity"),
1119
+ "helper-text": e(W)(e(a), "subscriptionValidity")
1120
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : j("", !0)
1121
+ ], 64)) : j("", !0),
1122
+ e(t).isFeedvibe ? j("", !0) : (x(), $(L, { key: 2 }, [
1123
+ o[24] || (o[24] = h("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Credit", -1)),
1124
+ i(E, {
1125
+ modelValue: e(t).credit.normal,
1126
+ "onUpdate:modelValue": o[7] || (o[7] = (C) => e(t).credit.normal = C),
1127
+ label: "Normal credit",
1128
+ "show-steppers": !1,
1129
+ "helper-state": e(K)(e(a), "credit.normal"),
1130
+ "helper-text": e(W)(e(a), "credit.normal")
1131
+ }, {
1132
+ append: P(() => o[21] || (o[21] = [
1133
+ se(" credit ")
1134
+ ])),
1135
+ _: 1
1136
+ }, 8, ["modelValue", "helper-state", "helper-text"]),
1137
+ i(E, {
1138
+ "model-value": ((Pe = e(t).credit.free) == null ? void 0 : Pe.amount) ?? null,
1139
+ min: 0,
1140
+ "onUpdate:modelValue": o[8] || (o[8] = (C) => {
1141
+ e(t).credit.free || (e(t).credit.free = {
1142
+ amount: 0,
1143
+ day: 1
1144
+ }), e(t).credit.free.amount = C;
1145
+ }),
1146
+ label: "Free credit",
1147
+ "show-steppers": !1,
1148
+ "helper-state": e(K)(e(a), "credit.free.amount"),
1149
+ "helper-text": e(W)(e(a), "credit.free.amount")
1150
+ }, {
1151
+ append: P(() => o[22] || (o[22] = [
1152
+ se(" credit ")
1153
+ ])),
1154
+ _: 1
1155
+ }, 8, ["model-value", "helper-state", "helper-text"]),
1156
+ (ke = e(t).credit.free) != null && ke.amount ? (x(), A(E, {
1157
+ key: 0,
1158
+ disabled: !!e(t).stripePriceId,
1159
+ "model-value": ((Te = e(t).credit.free) == null ? void 0 : Te.day) ?? null,
1160
+ min: 0,
1161
+ "onUpdate:modelValue": o[9] || (o[9] = (C) => {
1162
+ e(t).credit.free || (e(t).credit.free = {
1163
+ amount: 0,
1164
+ day: 1
1165
+ }), e(t).credit.free.day = e(R) || C;
1166
+ }),
1167
+ label: "Free credit valid for",
1168
+ "show-steppers": !1,
1169
+ "helper-state": e(K)(e(a), "credit.free.day"),
1170
+ "helper-text": e(W)(e(a), "credit.free.day")
1171
+ }, {
1172
+ append: P(() => o[23] || (o[23] = [
1173
+ se(" day(s) ")
1174
+ ])),
1175
+ _: 1
1176
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : j("", !0)
1177
+ ], 64)),
1178
+ e(V) ? (x(), $(L, { key: 3 }, [
1179
+ o[25] || (o[25] = h("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1180
+ i(zt, {
1181
+ modelValue: e(t).taxes,
1182
+ "onUpdate:modelValue": o[10] || (o[10] = (C) => e(t).taxes = C)
1183
+ }, null, 8, ["modelValue"]),
1184
+ i(Y, {
1185
+ label: `Tax Charged (${e(w)})`,
1186
+ "model-value": e(p),
1187
+ disabled: ""
1188
+ }, null, 8, ["label", "model-value"])
1189
+ ], 64)) : j("", !0),
1190
+ i(E, {
1191
+ label: "Total Price",
1192
+ "model-value": e(O),
1193
+ disabled: !0
1194
+ }, null, 8, ["model-value"]),
1195
+ h("div", Zt, B(e(c)("connect.store.bundle.edit.bundleReward.title")), 1),
1196
+ h("div", Qt, B(e(c)("connect.store.bundle.edit.bundleReward.description")), 1),
1197
+ h("div", eo, [
1198
+ h("div", to, [
1199
+ i(nt, {
1200
+ label: `Reward type: ${e(v).length == 0 ? "All" : e(v)[0].name}`
1201
+ }, {
1202
+ default: P(() => [
1203
+ i(ne, {
1204
+ onClick: o[11] || (o[11] = (C) => v.value = []),
1205
+ label: "All"
1206
+ }),
1207
+ i(ne, {
1208
+ onClick: o[12] || (o[12] = (C) => v.value = [
1209
+ {
1210
+ id: "type",
1211
+ value: "VOUCHER",
1212
+ name: e(ue).VOUCHER.name
1213
+ }
1214
+ ]),
1215
+ label: e(ue).VOUCHER.name
1216
+ }, null, 8, ["label"]),
1217
+ i(ne, {
1218
+ onClick: o[13] || (o[13] = (C) => v.value = [
1219
+ {
1220
+ id: "type",
1221
+ value: "TITLE",
1222
+ name: e(ue).TITLE.name
1223
+ }
1224
+ ]),
1225
+ label: e(ue).TITLE.name
1226
+ }, null, 8, ["label"])
1227
+ ]),
1228
+ _: 1
1229
+ }, 8, ["label"])
1230
+ ]),
1231
+ i(Oe, {
1232
+ modelValue: e(M),
1233
+ "onUpdate:modelValue": o[14] || (o[14] = (C) => ie(M) ? M.value = C : null),
1234
+ selection: "multiple",
1235
+ "column-filter": e(v),
1236
+ "column-defs": _,
1237
+ "row-data": e(s).filter(
1238
+ (C) => !e(t).isFeedvibe || C.collectible.type == "VOUCHER"
1239
+ ),
1240
+ "hide-footer": e(s).length <= 10
1241
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1242
+ i(T, {
1243
+ text: e(W)(e(a), "titles"),
1244
+ state: e(K)(e(a), "titles")
1245
+ }, null, 8, ["text", "state"])
1246
+ ]),
1247
+ h("div", oo, B(e(c)("connect.store.bundle.edit.advanceSetting")), 1),
1248
+ h("div", no, [
1249
+ i(S, {
1250
+ "model-value": e(t).internal ?? !1,
1251
+ "onUpdate:modelValue": o[15] || (o[15] = (C) => e(t).internal = C),
1252
+ "label-placement": "right",
1253
+ label: e(c)("connect.store.bundle.edit.internalBundle"),
1254
+ sublabel: e(c)("connect.store.bundle.edit.internalBundleDescription")
1255
+ }, null, 8, ["model-value", "label", "sublabel"]),
1256
+ i(S, {
1257
+ "model-value": e(t).hideInPos ?? !1,
1258
+ "onUpdate:modelValue": o[16] || (o[16] = (C) => e(t).hideInPos = C),
1259
+ "label-placement": "right",
1260
+ label: e(c)("connect.store.bundle.edit.hideInPos"),
1261
+ sublabel: e(c)("connect.store.bundle.edit.hideInPosDescription")
1262
+ }, null, 8, ["model-value", "label", "sublabel"]),
1263
+ i(E, {
1264
+ "model-value": ((Re = (Ue = e(t).config) == null ? void 0 : Ue.options) == null ? void 0 : Re.maxPerUser) || null,
1265
+ "onUpdate:modelValue": o[17] || (o[17] = (C) => e(re).set(e(t), "config.options.maxPerUser", C)),
1266
+ label: e(c)("connect.store.bundle.edit.maxPerUser"),
1267
+ "show-steppers": !1,
1268
+ placeholder: "Unlimited"
1269
+ }, null, 8, ["model-value", "label"])
1270
+ ])
1271
+ ])) : j("", !0)
1272
+ ];
1273
+ }),
1274
+ _: 1
1275
+ }, 8, ["modelValue", "header"]);
1276
+ };
1277
+ }
1278
+ });
1279
+ var so = { 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" };
1280
+ const ro = { class: "px-24 flex flex-col gap-y-16" }, io = { class: "flex gap-8 items-center" }, uo = { class: "fm-typo-en-body-lg-600" }, co = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, mo = { class: "flex flex-col gap-16 text-center" }, po = { class: "fm-typo-en-title-sm-800" }, yo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Eo = /* @__PURE__ */ X({
1281
+ __name: "Store",
1282
+ setup(f) {
1283
+ const g = {
1284
+ label: "Setup payout account",
1285
+ value: "payout",
1286
+ isPrimary: !1
1287
+ }, { t: l } = pe(), y = {
1288
+ label: l("connect.store.actions.setting"),
1289
+ value: "setting",
1290
+ isPrimary: !1
1291
+ }, c = {
1292
+ label: l("connect.store.actions.manageReward"),
1293
+ value: "create_reward"
1294
+ }, b = {
1295
+ label: l("connect.store.actions.addCategory"),
1296
+ value: "create_category",
1297
+ isPrimary: !0,
1298
+ prependIcon: "add"
1299
+ }, n = it(), r = Ce(), { global: t, minor: u } = Je, d = Ae(), a = D(() => r.sortedStoreCategories), _ = N(), v = N();
1300
+ async function s(V) {
1301
+ var w;
1302
+ V === "setting" ? (w = _.value) == null || w.showSheet(!0, r.storeOption) : V === "create_category" ? R(-1) : V === "create_reward" ? await n.push({ name: Xe["$connect-STORE_REWARDS"] }) : V == "payout" && window.open(so.paymentPortalUrl, "_blank");
1303
+ }
1304
+ async function U(V) {
1305
+ await u(
1306
+ async () => {
1307
+ var w;
1308
+ await ge.updateStore(V), await r.readMemberStore(), (w = _.value) == null || w.showSheet(!1);
1309
+ },
1310
+ {
1311
+ message: l("connect.store.setting.update.message"),
1312
+ successMessage: l("connect.store.setting.update.success")
1313
+ }
1314
+ );
1315
+ }
1316
+ async function R(V = -1) {
1317
+ var w, k;
1318
+ if ((!r.storeOption || !r.storeOption.company) && await be.confirm(
1319
+ l("connect.store.category.setup.title"),
1320
+ l("connect.store.category.setup.button"),
1321
+ l("connect.store.category.setup.action"),
1322
+ l("connect.common.cancel")
1323
+ ))
1324
+ return (w = _.value) == null ? void 0 : w.showSheet(!0);
1325
+ d.open({
1326
+ title: V == -1 ? l("connect.store.category.add") : l("connect.store.category.edit"),
1327
+ contentComponent: Ft,
1328
+ contentComponentProps: {
1329
+ initialValue: ((k = a.value[V]) == null ? void 0 : k.name) ?? "",
1330
+ action: V == -1 ? "add" : "edit"
1331
+ }
1332
+ }).onPrimary(async (p) => {
1333
+ p === null && !await be.remove(
1334
+ l("connect.store.category.remove.confirm"),
1335
+ l("connect.store.category.remove.title")
1336
+ ) || await u(
1337
+ async () => {
1338
+ const O = V == -1 ? [...a.value, { name: p, bundles: [] }] : [...a.value].map((I, q) => q == V ? { ...I, name: p } : I).filter((I) => I.name !== null);
1339
+ await ge.updateStoreBundle({
1340
+ categories: O
1341
+ }), await r.readMemberStore();
1342
+ },
1343
+ {
1344
+ message: p === null ? l("connect.store.category.update.deleting") : V == -1 ? l("connect.store.category.update.creating") : l("connect.store.category.update.updating"),
1345
+ successMessage: p === null ? l("connect.store.category.update.success.deleted") : V == -1 ? l("connect.store.category.update.success.created") : l("connect.store.category.update.success.updated")
1346
+ }
1347
+ );
1348
+ });
1349
+ }
1350
+ async function ae(V, w, k) {
1351
+ var I, q;
1352
+ w ?? (w = (I = v.value) == null ? void 0 : I.target.category), k ?? (k = (q = v.value) == null ? void 0 : q.target.index);
1353
+ const p = Be(a.value), O = p[w];
1354
+ if (!O) {
1355
+ Ye.error("Unexpected error", 2e3);
1356
+ return;
1357
+ }
1358
+ if (V == null) {
1359
+ if (await be.remove(
1360
+ "Are you sure you want to delete this bundle?",
1361
+ "Delete bundle"
1362
+ ) == !1)
1363
+ return;
1364
+ O.bundles.splice(k, 1);
1365
+ } else
1366
+ k == -1 ? O.bundles.push(V) : O.bundles[k] = V;
1367
+ await u(
1368
+ async () => {
1369
+ var H, m;
1370
+ if (V != null) {
1371
+ const o = (H = v.value) == null ? void 0 : H.bundleImage;
1372
+ o === null && V.image ? (await ve.delete(V.image), V.image = null) : o && (V.image = await ve.update(
1373
+ ve.bundleImagePath(void 0, o),
1374
+ o
1375
+ ));
1376
+ }
1377
+ await ge.updateStoreBundle({
1378
+ categories: p
1379
+ }), await r.readMemberStore(), await r.readMembership(), await r.readRewards(), (m = v.value) == null || m.showSheet(!1);
1380
+ },
1381
+ {
1382
+ message: `${V == null ? "Deleting" : k == -1 ? "Creating" : "Updating"} bundle`,
1383
+ successMessage: `Bundle ${V == null ? "deleted" : k == -1 ? "created" : "updated"} successfully`
1384
+ }
1385
+ );
1386
+ }
1387
+ function oe(V) {
1388
+ var w;
1389
+ (w = v.value) == null || w.showSheet(!0, {
1390
+ ...V,
1391
+ bundle: V.bundle ? Be(V.bundle) : void 0
1392
+ });
1393
+ }
1394
+ const M = N([]);
1395
+ return ye(async () => {
1396
+ var V, w;
1397
+ await t(async () => {
1398
+ var k, p;
1399
+ if (await r.readMemberStore(), await r.readMembership(), await r.readRewards(), await r.readPayoutAccount(), (k = n.currentRoute.value.query) != null && k.action) {
1400
+ switch ((p = n.currentRoute.value.query) == null ? void 0 : p.action) {
1401
+ case "update_setting":
1402
+ s("setting");
1403
+ break;
1404
+ case "create_category":
1405
+ R(-1);
1406
+ break;
1407
+ case "create_feedvibe_bundle":
1408
+ d.open({
1409
+ title: "Select category",
1410
+ contentComponent: $t
1411
+ }).onPrimary((O) => {
1412
+ d.close(), oe({
1413
+ category: O,
1414
+ index: -1,
1415
+ bundle: {
1416
+ ...re.cloneDeep(_e),
1417
+ isFeedvibe: !0,
1418
+ price: G.fromNumber({
1419
+ number: 10,
1420
+ precision: 2
1421
+ }).toObject()
1422
+ }
1423
+ });
1424
+ }).onTertiary(() => d.close());
1425
+ break;
1426
+ }
1427
+ n.replace({ query: {} });
1428
+ }
1429
+ }), M.value = [y, c, b], (((V = r.payoutAccount) == null ? void 0 : V.status) != "APPROVED" || ((w = r.payoutAccount) == null ? void 0 : w.enable) != !0) && (M.value = [
1430
+ g,
1431
+ y,
1432
+ c,
1433
+ b
1434
+ ]);
1435
+ }), (V, w) => {
1436
+ const k = F("FmPageHead"), p = F("FmButton"), O = F("FmCard");
1437
+ return x(), $(L, null, [
1438
+ i(k, {
1439
+ title: e(l)("connect.store.title"),
1440
+ actions: e(M),
1441
+ "onClick:action": s
1442
+ }, null, 8, ["title", "actions"]),
1443
+ h("div", ro, [
1444
+ e(a) && e(a).length > 0 ? (x(), $(L, { key: 0 }, [
1445
+ (x(!0), $(L, null, le(e(a), (I, q) => (x(), $("div", {
1446
+ key: I.name,
1447
+ class: "space-y-8 py-12"
1448
+ }, [
1449
+ h("div", io, [
1450
+ h("div", uo, B(I.name), 1),
1451
+ i(Fe, { json: I }, null, 8, ["json"]),
1452
+ i(p, {
1453
+ icon: "edit",
1454
+ size: "md",
1455
+ variant: "tertiary",
1456
+ onClick: (H) => R(q)
1457
+ }, null, 8, ["onClick"])
1458
+ ]),
1459
+ h("div", co, [
1460
+ (x(!0), $(L, null, le(I.bundles, (H, m) => (x(), A(ht, {
1461
+ bundle: H,
1462
+ key: H._id,
1463
+ onEdit: (o) => oe({ bundle: H, category: q, index: m }),
1464
+ onDelete: (o) => ae(null, q, m)
1465
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1466
+ i(xt, {
1467
+ onCreate: (H) => oe({ category: q, index: -1 })
1468
+ }, null, 8, ["onCreate"])
1469
+ ])
1470
+ ]))), 128)),
1471
+ i(ao, {
1472
+ ref_key: "bundleSheetRef",
1473
+ ref: v,
1474
+ onUpdate: ae
1475
+ }, null, 512)
1476
+ ], 64)) : (x(), A(O, {
1477
+ key: 1,
1478
+ variant: "outlined",
1479
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1480
+ }, {
1481
+ default: P(() => [
1482
+ w[1] || (w[1] = h("img", {
1483
+ src: qe,
1484
+ class: "aspect-square w-[150px]"
1485
+ }, null, -1)),
1486
+ h("div", mo, [
1487
+ h("div", po, B(e(l)("connect.store.bundle.title")), 1),
1488
+ h("div", yo, B(e(l)("connect.store.bundle.description")), 1)
1489
+ ]),
1490
+ i(p, {
1491
+ variant: "primary",
1492
+ label: e(l)("connect.store.actions.addCategory"),
1493
+ icon: "add",
1494
+ onClick: w[0] || (w[0] = (I) => R(-1))
1495
+ }, null, 8, ["label"])
1496
+ ]),
1497
+ _: 1
1498
+ })),
1499
+ i(Kt, {
1500
+ ref_key: "settingSheetRef",
1501
+ ref: _,
1502
+ onUpdate: U
1503
+ }, null, 512)
1504
+ ])
1505
+ ], 64);
1506
+ };
1507
+ }
1508
+ });
1509
+ export {
1510
+ Eo as default
1511
+ };