@feedmepos/mf-connect 0.0.12-beta.5 → 0.0.13-prod

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