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