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