@feedmepos/mf-connect 0.0.16-beta.1 → 0.0.17-prod

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