@feedmepos/mf-connect 0.1.0-beta.19 → 0.1.0-beta.20

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 (79) hide show
  1. package/dist/{Analytic-C_VhRLv6.js → Analytic-CRdCf6rP.js} +8 -8
  2. package/dist/{App-BfRWtnHD.js → App-CJ9oNLV2.js} +6 -6
  3. package/dist/{Broadcast-CkP0D5Q0.js → Broadcast-CatMmvNa.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-NtvMAKVf.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CYs2Sl5w.js} +8 -8
  5. package/dist/{Card-B3LUbgFG.js → Card-C3D59N5q.js} +15 -15
  6. package/dist/{Collections-auS6nQgP.js → Collections-BuCo1O9x.js} +4 -4
  7. package/dist/{Credit-DFCzt7yb.js → Credit-Babu5EE5.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BI0BX8t8.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DWJw6H-M.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BrjVcauR.js → EffectSheet.vue_vue_type_style_index_0_lang-DSEvgx4z.js} +6 -6
  10. package/dist/{Experience-CVb3L3Nz.js → Experience-XMGv8EGx.js} +8 -8
  11. package/dist/{Game-CVtfz6Hq.js → Game-Cz7YHbx1.js} +8 -8
  12. package/dist/{Index-DFcZ4uTO.js → Index-CQ4S3D3g.js} +7 -7
  13. package/dist/{Marketing-DLF6iuTD.js → Marketing-8E28mxPt.js} +5 -5
  14. package/dist/{Member-CYtrF8IE.js → Member-4y7vThK4.js} +4 -4
  15. package/dist/{MemberList-CrUHnX69.js → MemberList-DFoEZqv5.js} +14 -14
  16. package/dist/{MemberTransactions-DJGj_aav.js → MemberTransactions-CEud4gEU.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BEXdm4kC.js → MessageInput.vue_vue_type_script_setup_true_lang-SVX4fpOu.js} +2 -2
  18. package/dist/{Mission-_LSdgxEz.js → Mission-ChRlRXfM.js} +8 -8
  19. package/dist/{Overview-CuIPJALM.js → Overview-C2xrurYW.js} +17 -17
  20. package/dist/{Point-CVMEXAZ5.js → Point-CLIcUoCI.js} +8 -8
  21. package/dist/{Promotion-DSfbCLAe.js → Promotion-BAimCBQb.js} +9 -9
  22. package/dist/{Record-BNzcMcpH.js → Record-D9DGLK8k.js} +4 -4
  23. package/dist/{Reward-BCN44pw_.js → Reward-xaALJ6xT.js} +10 -10
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-By5HgODg.js → RewardGroup.vue_vue_type_script_setup_true_lang-BbpCY-d1.js} +12 -12
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-X24tGtbC.js → RuleGroup.vue_vue_type_script_setup_true_lang-wncxK2In.js} +14 -14
  26. package/dist/{Segment-MSDomTz2.js → Segment-BbholIXr.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-DyeY1fV7.js → SelectItems.vue_vue_type_script_setup_true_lang-BiT1S0GE.js} +2 -2
  28. package/dist/{Setting-BOLu10II.js → Setting-CuZ3rq-3.js} +8 -8
  29. package/dist/Store-C_BMTPfl.js +1745 -0
  30. package/dist/{StoreRewards-B5HCIRFt.js → StoreRewards-D0W2z3Gq.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-QNn_cpIj.js → StoreTransactions.vue_vue_type_script_setup_true_lang-E-QcGATx.js} +10 -10
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-arVZw_Lq.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C-ogUCbh.js} +1 -1
  33. package/dist/{Tier-C3Y6q17j.js → Tier-BfST7Yfl.js} +15 -15
  34. package/dist/{Title-_fk7AbId.js → Title-CEdQyyyg.js} +15 -15
  35. package/dist/{Transaction-D9CM1V_f.js → Transaction-CYbYZrpN.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BIpPKUWx.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Bgdt5pzT.js} +6 -6
  37. package/dist/{Voucher-Bo5QWYT0.js → Voucher-BGFUSHh3.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CjxmRY5U.js → VoucherEditor.vue_vue_type_script_setup_true_lang-jektdiG2.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BK28WW3q.js → ZodTextField.vue_vue_type_script_setup_true_lang-Cd752C-h.js} +1 -1
  40. package/dist/{app-ChpdgMfQ.js → app-DkwHJjXn.js} +1 -1
  41. package/dist/{app-C_djUlXx.js → app-TsBYmI-P.js} +28 -28
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DJIj4b8e.js → business-ChsnaYdk.js} +1 -1
  44. package/dist/{campaign-NrE6WI9q.js → campaign-PnS10H-F.js} +2 -2
  45. package/dist/{collectible.enum-BzLkFq1w.js → collectible.enum-BZIdjWua.js} +1 -1
  46. package/dist/{collection.fn-DQ71Nfut.js → collection.fn-9np7--Dl.js} +2 -2
  47. package/dist/{dto-12HT7-EA.js → dto-IypAMCcg.js} +9 -9
  48. package/dist/{effect-CobPZ4Rb.js → effect-CCkvCD6X.js} +1 -1
  49. package/dist/{email-addresses-DiWLZMlA.js → email-addresses-CMJLhz7p.js} +1 -1
  50. package/dist/{export-BrJSwHlS.js → export-DkjOipRl.js} +3 -3
  51. package/dist/{helper-CCRX-fvI.js → helper-Bu93Ya_g.js} +1 -1
  52. package/dist/{index-Ct8B2VHH.js → index-BRaG-yBl.js} +3 -3
  53. package/dist/{index-CC2lo_Wb.js → index-BX1M0DCt.js} +4 -4
  54. package/dist/{index-DzJUULpT.js → index-Bzy8Sl5b.js} +1 -1
  55. package/dist/{index-Bt2_f4Oi.js → index-C-FIY2IU.js} +3 -3
  56. package/dist/{index-DwU8LaVM.js → index-CBMl7QZF.js} +3 -3
  57. package/dist/{index-BCyJY05i.js → index-CUhBmJlv.js} +8 -8
  58. package/dist/{index-BS_AxWZH.js → index-CZETB7DA.js} +1 -1
  59. package/dist/{index-BBkLSHsJ.js → index-DLlCBYOm.js} +2 -2
  60. package/dist/{index-B__nVNTt.js → index-DXAQcXA8.js} +1 -1
  61. package/dist/{index--wa67pRl.js → index-De3DoZV3.js} +1 -1
  62. package/dist/{index-bsRZyOPx.js → index-Dx6gloTe.js} +1 -1
  63. package/dist/{index-C_KMGXv9.js → index-JFWJNgz4.js} +4 -4
  64. package/dist/{index-DtnUFcfv.js → index-yNswuwm_.js} +1 -1
  65. package/dist/{index.esm2017-B_FgkPTh.js → index.esm2017-Df64qzkh.js} +1 -1
  66. package/dist/{loading-fHk0Jjet.js → loading-CaxzDKHL.js} +4 -4
  67. package/dist/{membership-BW1NS-Ql.js → membership-BArHVjNf.js} +3 -3
  68. package/dist/{money-CmeLOjIj.js → money-B411u9Co.js} +1 -1
  69. package/dist/{number-D0Hk2ezY.js → number-Cqu4G1FZ.js} +1 -1
  70. package/dist/{objectid-hW6Oa6sR.js → objectid-O8aKbYqY.js} +5 -5
  71. package/dist/{reward-BRZhngDm.js → reward-ikGToGDQ.js} +1 -1
  72. package/dist/{rule-CECp9iUW.js → rule-bi_56V_m.js} +3 -3
  73. package/dist/{rule-builder-BQpTUVhb.js → rule-builder-DqVWht9g.js} +1 -1
  74. package/dist/{template-CLAh7Qcz.js → template-CQVQWOPN.js} +4 -4
  75. package/dist/{trigger-BTbRRpH9.js → trigger-BEOn5QSl.js} +4 -4
  76. package/dist/{vue-i18n-BQqGhLq-.js → vue-i18n-CVFB09Jw.js} +2 -2
  77. package/dist/{xlsx-BxwhyUvM.js → xlsx-DA3tIqnW.js} +1 -1
  78. package/package.json +1 -1
  79. package/dist/Store-CtJ9sJol.js +0 -1729
@@ -1,1729 +0,0 @@
1
- import { defineComponent as Q, computed as O, resolveComponent as h, openBlock as v, createBlock as U, withCtx as T, createElementVNode as C, createElementBlock as R, createVNode as i, createCommentVNode as A, toDisplayString as M, unref as e, Fragment as z, renderList as se, ref as D, isRef as oe, reactive as He, onMounted as fe, watch as Se, toRaw as qe, createTextVNode as ie, h as Ke } from "vue";
2
- import { _ as We } from "./tier-BJDhpH6X.js";
3
- import { useDialog as Ae, useDialogChild as Oe, components as ze } from "@feedmepos/ui-library";
4
- import { c as I, e as _e, S as Ye } from "./index-DwU8LaVM.js";
5
- import { d as ae, a as Je, p as ge, u as Me, n as Ge, f as Ce } from "./loading-fHk0Jjet.js";
6
- import { u as we, C as me } from "./membership-BW1NS-Ql.js";
7
- import { a as Xe, c as Be } from "./object-qECH92oz.js";
8
- import { _ as de } from "./lodash-B5I3zXaY.js";
9
- import { u as be } from "./vue-i18n-BQqGhLq-.js";
10
- import { Z as X, g as J, a as G } from "./zod-Bg2FbC-D.js";
11
- import { z as Z, R as Ze } from "./app-C_djUlXx.js";
12
- import { n as Qe, o as et, p as tt, q as Ne, r as nt } from "./index-CC2lo_Wb.js";
13
- import { u as xe } from "./app-wDQR6dpb.js";
14
- import { _ as te } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BK28WW3q.js";
15
- import { J as $e } from "./JsonViewer-v8_C7l5N.js";
16
- import { _ as ot } from "./index-BBkLSHsJ.js";
17
- import { _ as lt } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
18
- import { _ as at } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
19
- import { z as st, a as rt } from "./money-CmeLOjIj.js";
20
- import { F as it } from "./number-D0Hk2ezY.js";
21
- import { t as dt } from "./helper-CCRX-fvI.js";
22
- import "./index-DtnUFcfv.js";
23
- import "./index-Bt2_f4Oi.js";
24
- import "./index-C_KMGXv9.js";
25
- import "./index-BCyJY05i.js";
26
- import "./index-B__nVNTt.js";
27
- import "./index-Ct8B2VHH.js";
28
- import { m as ut } from "./index-BS_AxWZH.js";
29
- import { m as he } from "./index-DzJUULpT.js";
30
- import { useRouter as ct } from "vue-router";
31
- function Ee(g) {
32
- return ae.DineroFactory(g).toUnit();
33
- }
34
- function mt(g, x, a, b, r = [], f = []) {
35
- const l = ot.compact(
36
- x.map((t) => g.find((u) => u.systemCode === t.systemCode && u.taxCode === t.taxCode)).filter((t) => !!t && f.includes(t.systemCode))
37
- ), c = l.reduce(
38
- (t, u) => {
39
- var y;
40
- return Object.assign(t, {
41
- [u.taxCode]: {
42
- inclusive: ((y = r.find((m) => m.systemCode === u.systemCode)) == null ? void 0 : y.inclusive) || !1,
43
- adjustment: {
44
- level: 1,
45
- type: {
46
- type: "BY_MULTIPLIER",
47
- amount: {
48
- amount: u.rate.amount,
49
- precision: u.rate.precision,
50
- currency: "MYR"
51
- }
52
- }
53
- }
54
- }
55
- });
56
- },
57
- {}
58
- ), d = ae.Calculator.calculate({
59
- items: {
60
- 0: {
61
- quantity: 1,
62
- adjustments: {
63
- price: {
64
- level: 0,
65
- type: {
66
- type: "BY_AMOUNT",
67
- amount: ae.DineroFactory(a).subtract(ae.Dinero.fromNumber({ number: b }).toObject()).toObject()
68
- }
69
- }
70
- },
71
- taxes: c
72
- }
73
- },
74
- adjustments: {},
75
- roundToNearest: 0
76
- });
77
- return l.map((t) => ({
78
- setting: t,
79
- systemCode: t.systemCode,
80
- name: t.name,
81
- taxCode: t.taxCode,
82
- rate: t.rate,
83
- total: ae.DineroFactory({
84
- ...d.items[0].taxes[t.taxCode]
85
- }).convertPrecision(2).toObject()
86
- }));
87
- }
88
- function pt(g, x, a) {
89
- return g ? g.reduce((b, r) => {
90
- var f;
91
- return (f = a.find((l) => l.systemCode === r.systemCode)) != null && f.inclusive || (b = ae.DineroFactory(b.toObject()).add(r.total)), b;
92
- }, ae.DineroFactory(x)).toObject() : ae.DineroFactory(x).toObject();
93
- }
94
- const yt = { class: "relative h-[120px] aspect-video flex items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, ft = ["src"], bt = {
95
- key: 2,
96
- class: "absolute top-2 left-2"
97
- }, vt = { class: "absolute top-0 right-0" }, gt = { class: "fm-typo-en-body-lg-600" }, ht = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = { class: "flex gap-8 items-center flex-wrap" }, _t = /* @__PURE__ */ Q({
98
- __name: "StoreBundleCard",
99
- props: {
100
- bundle: { type: Object, required: !0 }
101
- },
102
- emits: ["edit", "delete", "send"],
103
- setup(g, { emit: x }) {
104
- const a = g, b = x, r = O(() => {
105
- const l = [];
106
- return a.bundle.price.amount > 0 && l.push(
107
- `${I.Config.getCountry().currency.symbol}${Ee(a.bundle.price)}`
108
- ), a.bundle.coinPrice && l.push(`${a.bundle.coinPrice} point(s)`), l.join(" or ");
109
- }), f = O(() => {
110
- var c, d;
111
- const l = [];
112
- if (a.bundle.titles.length > 0 && l.push(`${a.bundle.titles.length} title(s)`), a.bundle.vouchers.length > 0 && l.push(`${a.bundle.vouchers.length} voucher(s)`), a.bundle.credit.normal || (c = a.bundle.credit.free) != null && c.amount) {
113
- const t = a.bundle.credit.normal + (((d = a.bundle.credit.free) == null ? void 0 : d.amount) ?? 0);
114
- l.push(`${t} credit(s)`);
115
- }
116
- return l;
117
- });
118
- return (l, c) => {
119
- const d = h("FmIcon"), t = h("FmChip"), u = h("FmButton"), y = h("FmMenuItem"), m = h("FmMenu"), S = h("FmCard");
120
- return v(), U(S, {
121
- variant: "outlined",
122
- class: "flex flex-col gap-y-8 p-16 min-h-[240px] h-full text-center items-center"
123
- }, {
124
- default: T(() => [
125
- C("div", yt, [
126
- g.bundle.image ? (v(), R("img", {
127
- key: 1,
128
- src: g.bundle.image,
129
- class: "w-full h-full object-contain aspect-video"
130
- }, null, 8, ft)) : (v(), U(d, {
131
- key: 0,
132
- name: "image",
133
- outline: !0,
134
- size: "md",
135
- class: "text-fm-color-neutral-gray-200"
136
- })),
137
- g.bundle.isFeedvibe ? (v(), R("div", bt, [
138
- i(t, {
139
- label: "Feedvibe",
140
- class: "text-fm-color-primary bg-fm-color-system-warning-100",
141
- compact: ""
142
- })
143
- ])) : A("", !0),
144
- C("div", vt, [
145
- i(m, { placement: "bottom-end" }, {
146
- "menu-button": T(() => [
147
- i(u, {
148
- icon: "more_vert",
149
- variant: "tertiary"
150
- })
151
- ]),
152
- default: T(() => [
153
- i(y, {
154
- onClick: c[0] || (c[0] = (o) => b("edit", g.bundle)),
155
- icon: "edit",
156
- label: "Edit"
157
- }),
158
- g.bundle.stripePriceId ? A("", !0) : (v(), U(y, {
159
- key: 0,
160
- onClick: c[1] || (c[1] = (o) => b("send", g.bundle)),
161
- icon: "send",
162
- label: "Send"
163
- })),
164
- i(y, {
165
- onClick: c[2] || (c[2] = (o) => b("delete", g.bundle)),
166
- icon: "delete"
167
- }, {
168
- label: T(() => c[3] || (c[3] = [
169
- C("div", { class: "text-fm-color-typo-error fm-typo-en-body-md-400" }, " Delete ", -1)
170
- ])),
171
- _: 1
172
- })
173
- ]),
174
- _: 1
175
- })
176
- ])
177
- ]),
178
- C("div", gt, M(g.bundle.name), 1),
179
- C("div", ht, M(e(r) || "Free"), 1),
180
- C("div", xt, [
181
- (v(!0), R(z, null, se(e(f), (o, _) => (v(), U(t, {
182
- key: _,
183
- label: o
184
- }, null, 8, ["label"]))), 128))
185
- ])
186
- ]),
187
- _: 1
188
- });
189
- };
190
- }
191
- }), Ct = /* @__PURE__ */ Q({
192
- __name: "AddBundleCard",
193
- emits: ["create"],
194
- setup(g, { emit: x }) {
195
- const { t: a } = be(), b = x;
196
- return (r, f) => {
197
- const l = h("FmButton"), c = h("FmCard");
198
- return v(), U(c, {
199
- variant: "outlined",
200
- class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
201
- }, {
202
- default: T(() => [
203
- i(l, {
204
- onClick: f[0] || (f[0] = (d) => b("create")),
205
- label: e(a)("connect.store.actions.addBundle"),
206
- icon: "add",
207
- variant: "secondary"
208
- }, null, 8, ["label"])
209
- ]),
210
- _: 1
211
- });
212
- };
213
- }
214
- }), Ft = { class: "space-y-16" }, Vt = { class: "flex w-full justify-between pb-16" }, St = { class: "flex items-center justify-end gap-8" }, wt = /* @__PURE__ */ Q({
215
- __name: "CategoryDialog",
216
- props: {
217
- action: {
218
- type: String,
219
- default: () => "add"
220
- },
221
- initialValue: {
222
- type: String,
223
- default: () => ""
224
- }
225
- },
226
- setup(g) {
227
- const { t: x } = be(), a = g, b = Ae(), { emitData: r, emitAction: f } = Oe(), l = D(a.initialValue), c = Z.string().min(1);
228
- function d() {
229
- r(l.value), f("primary"), b.close();
230
- }
231
- function t() {
232
- r(null), f("primary"), b.close();
233
- }
234
- return (u, y) => {
235
- const m = h("FmTextField"), S = h("FmButton");
236
- return v(), R("div", Ft, [
237
- i(m, {
238
- modelValue: e(l),
239
- "onUpdate:modelValue": y[0] || (y[0] = (o) => oe(l) ? l.value = o : null),
240
- label: e(x)("connect.store.category.label"),
241
- rules: [e(X).toRule(e(c))]
242
- }, null, 8, ["modelValue", "label", "rules"]),
243
- C("div", Vt, [
244
- C("div", null, [
245
- g.action == "edit" ? (v(), U(S, {
246
- key: 0,
247
- onClick: t,
248
- label: e(x)("connect.common.delete"),
249
- variant: "destructive"
250
- }, null, 8, ["label"])) : A("", !0)
251
- ]),
252
- C("div", St, [
253
- i(S, {
254
- label: e(x)("connect.common.cancel"),
255
- variant: "tertiary",
256
- onClick: y[1] || (y[1] = (o) => e(b).close())
257
- }, null, 8, ["label"]),
258
- i(S, {
259
- label: g.action == "edit" ? e(x)("connect.common.edit") : e(x)("connect.common.add"),
260
- disabled: !e(l),
261
- onClick: d
262
- }, null, 8, ["label", "disabled"])
263
- ])
264
- ])
265
- ]);
266
- };
267
- }
268
- }), $t = { class: "space-y-16" }, kt = { class: "flex items-center justify-end gap-8 pb-16" }, Pt = /* @__PURE__ */ Q({
269
- __name: "SelectCategoryDialog",
270
- setup(g) {
271
- const { emitData: x, emitAction: a } = Oe(), b = we(), r = D(), f = O(
272
- () => b.sortedStoreCategories.map((l, c) => ({
273
- label: l.name,
274
- value: c
275
- }))
276
- );
277
- return (l, c) => {
278
- const d = h("FmSelect"), t = h("FmButton");
279
- return v(), R("div", $t, [
280
- c[4] || (c[4] = C("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Select a category to create FeedMe CNY 2025 bundle ", -1)),
281
- i(d, {
282
- placeholder: "Select a category",
283
- items: e(f),
284
- modelValue: e(r),
285
- "onUpdate:modelValue": [
286
- c[0] || (c[0] = (u) => oe(r) ? r.value = u : null),
287
- c[1] || (c[1] = (u) => e(x)(u))
288
- ],
289
- label: "Category"
290
- }, null, 8, ["items", "modelValue"]),
291
- C("div", kt, [
292
- i(t, {
293
- variant: "tertiary",
294
- label: "Cancel",
295
- onClick: c[2] || (c[2] = (u) => e(a)("tertiary"))
296
- }),
297
- i(t, {
298
- label: "Select",
299
- onClick: c[3] || (c[3] = (u) => e(a)("primary")),
300
- disabled: e(r) == null
301
- }, null, 8, ["disabled"])
302
- ])
303
- ]);
304
- };
305
- }
306
- });
307
- function Fe(g) {
308
- return g.states.map((x) => ({ label: x, value: x }));
309
- }
310
- const Tt = {
311
- [_e.F_COUNTRY.enum.MY]: {
312
- states: [
313
- "Johor",
314
- "Kedah",
315
- "Kelantan",
316
- "Kuala Lumpur",
317
- "Labuan",
318
- "Melaka",
319
- "Negeri Sembilan",
320
- "Pahang",
321
- "Perak",
322
- "Perlis",
323
- "Pulau Pinang",
324
- "Putrajaya",
325
- "Sabah",
326
- "Sarawak",
327
- "Selangor",
328
- "Terengganu"
329
- ],
330
- get stateItems() {
331
- return Fe(this);
332
- }
333
- },
334
- [_e.F_COUNTRY.enum.SG]: {
335
- states: [],
336
- get stateItems() {
337
- return Fe(this);
338
- }
339
- },
340
- [_e.F_COUNTRY.enum.ID]: {
341
- states: [
342
- "Aceh",
343
- "Bali",
344
- "Bangka-Belitung",
345
- "Banten",
346
- "Bengkulu",
347
- "Central Java",
348
- "Central Sulawesi",
349
- "Daerah Istimewa Yogyakarta",
350
- "East Java",
351
- "East Kalimantan",
352
- "East Nusa Tenggara",
353
- "Gorontalo",
354
- "Jakarta Raya",
355
- "Jambi",
356
- "Kalimantan Tengah",
357
- "Lampung",
358
- "Maluku",
359
- "Maluku Utara",
360
- "North Sulawesi",
361
- "North Sumatra",
362
- "Nusa Tenggara Barat",
363
- "Papua",
364
- "Riau",
365
- "Riau Islands",
366
- "South Kalimantan",
367
- "South Sulawesi",
368
- "South Sumatra",
369
- "Sulawesi Barat",
370
- "Sulawesi Tenggara",
371
- "West Java",
372
- "West Kalimantan",
373
- "West Papua",
374
- "West Sumatra"
375
- ],
376
- get stateItems() {
377
- return Fe(this);
378
- }
379
- }
380
- }, pe = () => I.Config.getCountry(), ye = {
381
- get fullCurrency() {
382
- return pe().currency;
383
- },
384
- get currency() {
385
- return pe().currency.code;
386
- },
387
- get fullTax() {
388
- return I.Country.getCountryFlattenTaxes(pe().code);
389
- },
390
- get taxSystem() {
391
- return pe().taxSystems;
392
- },
393
- taxInclusion(g) {
394
- return ye.taxSystem.map((x) => ({
395
- systemCode: x.code,
396
- inclusive: g !== void 0 ? g : !1
397
- }));
398
- },
399
- groupedTaxOptions() {
400
- const g = I.Country.getCountryFlattenTaxes(pe().code);
401
- return ye.taxSystem.map((x) => ({
402
- code: x.code,
403
- options: g.map((a) => ({ ...a, feedmeTaxCode: ye.generateCode(a) })).filter((a) => a.systemCode === x.code)
404
- }));
405
- },
406
- systemDefaultCode(g) {
407
- const x = ye.groupedTaxOptions().find((a) => a.code === g);
408
- return x == null ? void 0 : x.options.find((a) => a.default);
409
- },
410
- generateCode(g) {
411
- return `${g.systemCode}/${g.taxCode}`;
412
- }
413
- }, ne = ye, Ut = /* @__PURE__ */ Q({
414
- __name: "TaxInclusiveSetting",
415
- props: {
416
- modelValue: {
417
- type: Array,
418
- required: !0,
419
- default: () => []
420
- }
421
- },
422
- emits: ["update:model-value"],
423
- setup(g, { emit: x }) {
424
- const a = g, b = ne.taxSystem, r = x, f = D(a.modelValue);
425
- function l(u, y) {
426
- const m = de.clone(a.modelValue), S = m.findIndex((o) => o.systemCode === u);
427
- S >= 0 ? m[S].inclusive = y : m.push({
428
- systemCode: u,
429
- inclusive: y
430
- }), f.value = m, r("update:model-value", m);
431
- }
432
- function c() {
433
- return b.map((u) => {
434
- const y = a.modelValue ? a.modelValue.find((m) => m.systemCode === u.code) : !1;
435
- return {
436
- label: u.name,
437
- config: {
438
- value: y ? y.inclusive : !1
439
- },
440
- input: (m) => {
441
- l(u.code, m);
442
- }
443
- };
444
- });
445
- }
446
- const d = He(c());
447
- function t(u, y) {
448
- return `${u} ${y ? "Inclusive" : "Exclusive"}`;
449
- }
450
- return fe(() => {
451
- a.modelValue.length || l(b[0].code, !1);
452
- }), Se(
453
- () => a.modelValue,
454
- (u, y) => {
455
- u != y && !u.length && l(b[0].code, !1);
456
- }
457
- ), (u, y) => {
458
- const m = h("FmSwitch");
459
- return v(!0), R(z, null, se(e(d), (S, o) => {
460
- var _;
461
- return v(), R("div", { key: o }, [
462
- i(m, {
463
- "model-value": ((_ = e(f)[o]) == null ? void 0 : _.inclusive) || !1,
464
- "label-placement": "left",
465
- "onUpdate:modelValue": (k) => S.input(k)
466
- }, {
467
- label: T(() => {
468
- var k;
469
- return [
470
- C("div", null, M(t(S.label, ((k = e(f)[o]) == null ? void 0 : k.inclusive) || !1)), 1)
471
- ];
472
- }),
473
- _: 2
474
- }, 1032, ["model-value", "onUpdate:modelValue"])
475
- ]);
476
- }), 128);
477
- };
478
- }
479
- });
480
- var Rt = { mode: "development", appMode: "mf" };
481
- const It = { class: "space-y-8" }, Dt = {
482
- key: 0,
483
- class: "space-y-16"
484
- }, Bt = /* @__PURE__ */ Q({
485
- __name: "StripeSetting",
486
- props: {
487
- modelValue: {}
488
- },
489
- emits: ["update:modelValue"],
490
- setup(g, { emit: x }) {
491
- const a = g, b = x, r = D(!1);
492
- Se(r, (l, c) => {
493
- c != l && (!a.modelValue && l ? b("update:modelValue", {
494
- apiKey: "",
495
- webhookSecret: ""
496
- }) : l || b("update:modelValue", void 0));
497
- });
498
- const f = O(() => {
499
- const l = Rt.mode === "development", c = I.Config.getCountry().code.toLowerCase(), d = c != "my" ? `.${c}` : "";
500
- return `https://marketing${l ? "-dev" : ""}${d}.feedmeapi.com/stripe/${Ye.getBusinessId()}/webhook`;
501
- });
502
- return fe(() => {
503
- r.value = !!a.modelValue;
504
- }), (l, c) => {
505
- const d = h("FmSwitch"), t = h("FmTextField"), u = h("FmButton");
506
- return v(), R("div", It, [
507
- i(d, {
508
- modelValue: e(r),
509
- "onUpdate:modelValue": c[0] || (c[0] = (y) => oe(r) ? r.value = y : null),
510
- value: "true",
511
- label: "Enable Stripe"
512
- }, null, 8, ["modelValue"]),
513
- a.modelValue ? (v(), R("div", Dt, [
514
- i(t, {
515
- label: "API Key",
516
- modelValue: a.modelValue.apiKey,
517
- "onUpdate:modelValue": c[1] || (c[1] = (y) => a.modelValue.apiKey = y),
518
- "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
519
- }, null, 8, ["modelValue"]),
520
- i(t, {
521
- label: "Webhook URL",
522
- "model-value": e(f),
523
- readonly: "",
524
- "helper-text": "Copy this URL to your Stripe dashboard"
525
- }, {
526
- append: T(() => [
527
- i(u, {
528
- icon: "content_copy",
529
- variant: "tertiary",
530
- onClick: c[2] || (c[2] = (y) => e(Je)(e(f)))
531
- })
532
- ]),
533
- _: 1
534
- }, 8, ["model-value"]),
535
- i(t, {
536
- modelValue: a.modelValue.webhookSecret,
537
- "onUpdate:modelValue": c[3] || (c[3] = (y) => a.modelValue.webhookSecret = y),
538
- label: "Webhook Secret",
539
- "helper-text": `Copy the webhook signing secret from your Stripe account and paste
540
- here.`
541
- }, null, 8, ["modelValue"])
542
- ])) : A("", !0)
543
- ]);
544
- };
545
- }
546
- }), Nt = {
547
- key: 0,
548
- class: "space-y-16 pr-12"
549
- }, At = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Ot = {
550
- key: 1,
551
- class: "space-y-16"
552
- }, Mt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Et = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, jt = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, Lt = { class: "space-y-4" }, Ht = { class: "fm-typo-en-body-lg-400" }, qt = { class: "space-y-16" }, Kt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Wt = { class: "flex items-center gap-8" }, zt = /* @__PURE__ */ Q({
553
- __name: "StoreSettingSheet",
554
- emits: ["update"],
555
- setup(g, { expose: x, emit: a }) {
556
- const { t: b } = be(), r = a, f = D(!1), l = D(), c = D(!1), d = Qe.extend({
557
- company: et.extend({
558
- name: Z.string().min(1, "Company name is required"),
559
- regNo: Z.string().min(1, "Registration number is required"),
560
- address: tt.extend({
561
- line1: Z.string().min(1, "Line 1 is required"),
562
- line2: Z.string().optional(),
563
- state: Z.string().min(1, "State is required"),
564
- city: Z.string().min(1, "City is required"),
565
- postcode: Z.string().min(1, "Postcode is required"),
566
- country: Z.string().min(1, "Country is required")
567
- }),
568
- phoneNo: Z.string().min(1, "Phone number is required"),
569
- sstRegNo: Z.string().optional()
570
- })
571
- }), t = O(() => d.safeParse(l.value).success);
572
- function u() {
573
- const S = d.safeParse(l.value);
574
- S.success && r("update", S.data);
575
- }
576
- function y() {
577
- return {
578
- company: {
579
- name: "",
580
- address: {
581
- line1: "",
582
- line2: "",
583
- city: "",
584
- postcode: "",
585
- state: "",
586
- country: I.Config.getCountry().name
587
- },
588
- phoneNo: "",
589
- regNo: "",
590
- sstRegNo: ""
591
- },
592
- inclusiveTaxes: []
593
- };
594
- }
595
- function m(S, o) {
596
- f.value = S, S && (l.value = o != null && o.company ? o : y());
597
- }
598
- return x({
599
- showSheet: m,
600
- data: l
601
- }), (S, o) => {
602
- const _ = h("FmIcon"), k = h("FmMenuItem"), Y = h("FmMenu"), K = h("FmSelect"), ee = h("FmButton"), L = h("FmSideSheet");
603
- return v(), U(L, {
604
- "max-width": 560,
605
- modelValue: e(f),
606
- "onUpdate:modelValue": o[15] || (o[15] = (W) => oe(f) ? f.value = W : null),
607
- header: e(b)("connect.store.setting.title")
608
- }, {
609
- "side-sheet-footer": T(() => [
610
- C("div", Wt, [
611
- i(ee, {
612
- label: e(b)("connect.common.save"),
613
- onClick: u,
614
- disabled: !e(t) || e(xe)().isLoading,
615
- loading: e(xe)().isLoading
616
- }, null, 8, ["label", "disabled", "loading"]),
617
- i(ee, {
618
- label: e(b)("connect.common.cancel"),
619
- onClick: o[14] || (o[14] = (W) => m(!1)),
620
- variant: "tertiary"
621
- }, null, 8, ["label"])
622
- ])
623
- ]),
624
- default: T(() => {
625
- var W, le;
626
- return [
627
- i($e, { json: e(l) }, null, 8, ["json"]),
628
- e(l) && e(l).company ? (v(), R("div", Nt, [
629
- C("div", At, M(e(b)("connect.store.setting.company.legal_info")), 1),
630
- i(te, {
631
- modelValue: e(l).company.name,
632
- "onUpdate:modelValue": o[0] || (o[0] = (s) => e(l).company.name = s),
633
- label: e(b)("connect.store.setting.company.name"),
634
- schema: e(X).typeAtPath(e(d), "company.name")
635
- }, null, 8, ["modelValue", "label", "schema"]),
636
- i(te, {
637
- modelValue: e(l).company.regNo,
638
- "onUpdate:modelValue": o[1] || (o[1] = (s) => e(l).company.regNo = s),
639
- label: e(b)("connect.store.setting.company.reg_no"),
640
- schema: e(X).typeAtPath(e(d), "company.regNo")
641
- }, null, 8, ["modelValue", "label", "schema"]),
642
- e(I.Config).getCountry().taxSystems.length ? (v(), U(te, {
643
- key: 0,
644
- modelValue: e(l).company.sstRegNo,
645
- "onUpdate:modelValue": [
646
- o[2] || (o[2] = (s) => e(l).company.sstRegNo = s),
647
- o[3] || (o[3] = (s) => s ? null : e(l).inclusiveTaxes = [])
648
- ],
649
- label: e(b)("connect.store.setting.company.tax_reg_no"),
650
- schema: e(X).typeAtPath(e(d), "company.sstRegNo")
651
- }, null, 8, ["modelValue", "label", "schema"])) : A("", !0),
652
- (W = e(l).company) != null && W.sstRegNo && e(l).inclusiveTaxes ? (v(), R("div", Ot, [
653
- C("div", Mt, M(e(b)("connect.store.setting.company.tax")), 1),
654
- i(Ut, {
655
- modelValue: e(l).inclusiveTaxes,
656
- "onUpdate:modelValue": o[4] || (o[4] = (s) => e(l).inclusiveTaxes = s)
657
- }, null, 8, ["modelValue"])
658
- ])) : A("", !0),
659
- i(te, {
660
- modelValue: e(l).company.phoneNo,
661
- "onUpdate:modelValue": o[5] || (o[5] = (s) => e(l).company.phoneNo = s),
662
- label: e(b)("connect.store.setting.company.phone"),
663
- schema: e(X).typeAtPath(e(d), "company.phoneNo")
664
- }, null, 8, ["modelValue", "label", "schema"]),
665
- C("div", Et, M(e(b)("connect.store.setting.company.address.title")), 1),
666
- i(te, {
667
- modelValue: e(l).company.address.line1,
668
- "onUpdate:modelValue": o[6] || (o[6] = (s) => e(l).company.address.line1 = s),
669
- label: e(b)("connect.store.setting.company.address.line1"),
670
- schema: e(X).typeAtPath(e(d), "company.address.line1")
671
- }, null, 8, ["modelValue", "label", "schema"]),
672
- i(te, {
673
- modelValue: e(l).company.address.line2,
674
- "onUpdate:modelValue": o[7] || (o[7] = (s) => e(l).company.address.line2 = s),
675
- label: e(b)("connect.store.setting.company.address.line2"),
676
- schema: e(X).typeAtPath(e(d), "company.address.line2")
677
- }, null, 8, ["modelValue", "label", "schema"]),
678
- C("div", jt, [
679
- i(te, {
680
- modelValue: e(l).company.address.city,
681
- "onUpdate:modelValue": o[8] || (o[8] = (s) => e(l).company.address.city = s),
682
- label: e(b)("connect.store.setting.company.address.city"),
683
- schema: e(X).typeAtPath(e(d), "company.address.city")
684
- }, null, 8, ["modelValue", "label", "schema"]),
685
- i(te, {
686
- modelValue: e(l).company.address.postcode,
687
- "onUpdate:modelValue": o[9] || (o[9] = (s) => e(l).company.address.postcode = s),
688
- label: e(b)("connect.store.setting.company.address.postcode"),
689
- schema: e(X).typeAtPath(e(d), "company.address.postcode")
690
- }, null, 8, ["modelValue", "label", "schema"]),
691
- C("div", Lt, [
692
- C("div", Ht, M(e(b)("connect.store.setting.company.address.state")), 1),
693
- i(Y, {
694
- placement: "top-end",
695
- "model-value": e(c)
696
- }, {
697
- "menu-button": T(() => [
698
- i(te, {
699
- modelValue: e(l).company.address.state,
700
- "onUpdate:modelValue": o[10] || (o[10] = (s) => e(l).company.address.state = s),
701
- schema: e(X).typeAtPath(e(d), "company.address.state"),
702
- onFocusChanged: o[11] || (o[11] = (s) => c.value = s)
703
- }, {
704
- append: T(() => [
705
- i(_, {
706
- name: e(c) ? "keyboard_arrow_up" : "keyboard_arrow_down"
707
- }, null, 8, ["name"])
708
- ]),
709
- _: 1
710
- }, 8, ["modelValue", "schema"])
711
- ]),
712
- default: T(() => [
713
- (v(!0), R(z, null, se(e(Tt)[e(I.Config).getCountry().code].stateItems.filter(
714
- (s) => {
715
- var w, $;
716
- return s.label.toLowerCase().includes((($ = (w = e(l)) == null ? void 0 : w.company) == null ? void 0 : $.address.state.toLowerCase()) ?? "");
717
- }
718
- ) || [], (s) => (v(), U(k, {
719
- key: s.value,
720
- "model-value": e(l).company.address.state === s.value,
721
- label: s.label,
722
- onClick: () => {
723
- e(l).company.address.state = s.value, c.value = !1;
724
- }
725
- }, null, 8, ["model-value", "label", "onClick"]))), 128))
726
- ]),
727
- _: 1
728
- }, 8, ["model-value"])
729
- ]),
730
- i(K, {
731
- label: e(b)("connect.store.setting.company.address.country"),
732
- modelValue: e(l).company.address.country,
733
- "onUpdate:modelValue": o[12] || (o[12] = (s) => e(l).company.address.country = s),
734
- items: [
735
- {
736
- label: e(I.Config).getCountry().name,
737
- value: e(I.Config).getCountry().name
738
- }
739
- ],
740
- rules: [e(X).ruleAtPath(e(d), "company.address.country")]
741
- }, null, 8, ["label", "modelValue", "items", "rules"])
742
- ]),
743
- C("div", qt, [
744
- C("div", Kt, M(e(b)("connect.store.setting.stripe.title")), 1),
745
- i(Bt, {
746
- "model-value": (le = e(l)) == null ? void 0 : le.stripe,
747
- "onUpdate:modelValue": o[13] || (o[13] = (s) => e(l).stripe = s)
748
- }, null, 8, ["model-value"])
749
- ])
750
- ])) : A("", !0)
751
- ];
752
- }),
753
- _: 1
754
- }, 8, ["modelValue", "header"]);
755
- };
756
- }
757
- });
758
- function Yt(g, x = !0) {
759
- return I.DineroFactory(g).toFormat(x);
760
- }
761
- const Jt = /* @__PURE__ */ Q({
762
- __name: "TaxVariantSetting",
763
- props: {
764
- modelValue: {
765
- type: Array,
766
- required: !0,
767
- default: () => []
768
- }
769
- },
770
- emits: ["update:modelValue"],
771
- setup(g, { emit: x }) {
772
- const a = g, b = x;
773
- fe(() => {
774
- if (l.value.length !== f.value.length) {
775
- const t = f.value.reduce((u, y) => {
776
- const m = ne.systemDefaultCode(y.name);
777
- if (!m) return u;
778
- const { systemCode: S, taxCode: o } = m;
779
- return y.value || u.push({ systemCode: S, taxCode: o }), u;
780
- }, []);
781
- d(t);
782
- }
783
- });
784
- function r() {
785
- return ne.groupedTaxOptions();
786
- }
787
- const f = O(() => r().map((t) => ({
788
- name: t.code,
789
- value: (l.value || []).find(
790
- (u) => t.options.some((y) => y.feedmeTaxCode === u)
791
- ),
792
- options: t.options.map((u) => ({
793
- label: `${u.name} (${it(u.rate)}%)`,
794
- value: u.feedmeTaxCode
795
- }))
796
- }))), l = O(() => a.modelValue.map((t) => ne.generateCode(t)));
797
- function c(t) {
798
- const u = r().find(
799
- (o) => o.options.some((_) => _.feedmeTaxCode === t)
800
- ), y = u == null ? void 0 : u.options.find((o) => o.feedmeTaxCode === t);
801
- if (!y) return;
802
- const { systemCode: m, taxCode: S } = y;
803
- d([{ systemCode: m, taxCode: S }]);
804
- }
805
- function d(t) {
806
- const u = de.clone(a.modelValue);
807
- t.forEach((y) => {
808
- const m = r().find(
809
- (_) => _.options.some((k) => k.feedmeTaxCode === ne.generateCode(y))
810
- ), S = (m == null ? void 0 : m.options) || [], o = u.findIndex(
811
- (_) => S.some((k) => ne.generateCode(k) === ne.generateCode(_))
812
- );
813
- o >= 0 ? u.splice(o, 1, y) : u.push(y);
814
- }), b("update:modelValue", u);
815
- }
816
- return (t, u) => {
817
- const y = h("FmRadio"), m = h("FmRadioGroup");
818
- return v(!0), R(z, null, se(e(f), (S) => (v(), R("div", {
819
- key: S.name,
820
- class: "flex items-start"
821
- }, [
822
- i(m, {
823
- modelValue: S.value,
824
- "onUpdate:modelValue": [
825
- (o) => S.value = o,
826
- u[0] || (u[0] = (o) => {
827
- c(o);
828
- })
829
- ]
830
- }, {
831
- default: T(() => [
832
- (v(!0), R(z, null, se(S.options, (o, _) => (v(), U(y, {
833
- key: _,
834
- value: o.value,
835
- label: o.label
836
- }, null, 8, ["value", "label"]))), 128))
837
- ]),
838
- _: 2
839
- }, 1032, ["modelValue", "onUpdate:modelValue"])
840
- ]))), 128);
841
- };
842
- }
843
- }), Ve = {
844
- get _id() {
845
- return (/* @__PURE__ */ new Date()).toISOString();
846
- },
847
- name: "",
848
- price: I.Dinero.zero().toObject(),
849
- originalPrice: I.Dinero.zero().toObject(),
850
- vouchers: [],
851
- credit: {
852
- normal: 0,
853
- free: {
854
- amount: 0,
855
- day: 0
856
- }
857
- },
858
- config: {
859
- options: {}
860
- },
861
- titles: [],
862
- taxes: [],
863
- taxTotals: [],
864
- internal: !1,
865
- priceWithTaxes: st()
866
- }, Gt = {
867
- key: 0,
868
- class: "space-y-24 pr-12"
869
- }, Xt = { class: "space-y-8" }, Zt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, Qt = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, en = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, tn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, nn = { class: "space-y-8" }, on = { class: "flex items-center justify-between" }, ln = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, an = { class: "space-y-8" }, sn = { class: "flex items-center gap-8" }, rn = /* @__PURE__ */ Q({
870
- __name: "EditBundleSheet",
871
- emits: ["update"],
872
- setup(g, { expose: x, emit: a }) {
873
- const b = a, { t: r } = be(), f = we(), l = D(!1), c = D([]), d = D({
874
- category: 0,
875
- index: -1,
876
- originalCategoryIndex: void 0
877
- }), t = D(de.cloneDeep(Ve)), u = D(), y = Ne, m = O(() => {
878
- const p = y.safeParse(t.value);
879
- return p.success ? [] : p.error.errors;
880
- }), S = [
881
- {
882
- header: "Reward title",
883
- accessorFn: (p) => p.collectible.name,
884
- enableSorting: !0
885
- },
886
- {
887
- id: "type",
888
- header: "Reward type",
889
- accessorFn: (p) => p.collectible.type,
890
- cell(p) {
891
- return me[p.row.original.collectible.type].chip();
892
- }
893
- },
894
- {
895
- header: "Description",
896
- accessorFn: (p) => p.description,
897
- cell(p) {
898
- var F;
899
- const n = p.row.original;
900
- return n.collectible.type == "VOUCHER" || n.selectedReward == null ? n.description : Ke(ze.FmStepperField, {
901
- "onUpdate:modelValue": (P) => {
902
- t.value.titles = t.value.titles.map(
903
- (E) => E.id == n.collectible._id ? { ...E, dayToExpire: P } : E
904
- );
905
- },
906
- modelValue: ((F = n.selectedReward) == null ? void 0 : F.extra) ?? 0,
907
- appendText: "day(s)",
908
- showSteppers: !1,
909
- disabled: !!t.value.stripePriceId
910
- });
911
- }
912
- }
913
- ], o = D([]), _ = O(() => f.bundleRewards.map((p) => {
914
- const n = k.value.find((P) => P.id == p._id), F = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${dt(p.options.validityOption || {})}` : "No expiry";
915
- return {
916
- collectible: p,
917
- description: F,
918
- selectedReward: n
919
- };
920
- })), k = O(() => {
921
- var p, n;
922
- return [
923
- ...((p = t.value) == null ? void 0 : p.titles.map((F) => ({
924
- id: F.id,
925
- extra: F.dayToExpire
926
- }))) ?? [],
927
- ...((n = t.value) == null ? void 0 : n.vouchers.map((F) => ({
928
- id: F,
929
- extra: void 0
930
- }))) ?? []
931
- ];
932
- }), Y = O(
933
- () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
934
- );
935
- function K(p) {
936
- t.value.subscriptionValidity = p;
937
- for (const n of t.value.titles)
938
- n.dayToExpire = p;
939
- t.value.credit.free && (t.value.credit.free.day = p);
940
- }
941
- function ee() {
942
- const p = _.value, n = t.value;
943
- if (!(!n || !p))
944
- for (let F = 0; F < p.length; F++) {
945
- const P = p[F];
946
- L.value[F] ? P.collectible.type == "TITLE" ? n.titles.findIndex(
947
- (j) => j.id == P.collectible._id
948
- ) < 0 && n.titles.push({
949
- id: P.collectible._id,
950
- dayToExpire: Y.value
951
- }) : n.vouchers.findIndex(
952
- (j) => j == P.collectible._id
953
- ) < 0 && n.vouchers.push(P.collectible._id) : (n.titles = n.titles.filter((q) => q.id != P.collectible._id), n.vouchers = n.vouchers.filter(
954
- (q) => q != P.collectible._id
955
- ));
956
- }
957
- }
958
- const L = D({});
959
- Se(L, ee, { deep: !0 });
960
- const W = O(() => {
961
- var p, n;
962
- return (n = (p = f.storeOption) == null ? void 0 : p.company) == null ? void 0 : n.sstRegNo;
963
- }), le = O(() => {
964
- var p, n, F;
965
- return (F = (n = (p = f.storeOption) == null ? void 0 : p.inclusiveTaxes) == null ? void 0 : n[0]) != null && F.inclusive ? "Inclusive" : "Exclusive";
966
- }), s = O(() => {
967
- var p, n, F;
968
- return mt(
969
- ne.fullTax,
970
- qe(t.value.taxes),
971
- t.value.price,
972
- Number(t.value.credit.normal),
973
- ((p = f.storeOption) == null ? void 0 : p.inclusiveTaxes) ?? [],
974
- (F = (n = f.storeOption) == null ? void 0 : n.company) != null && F.sstRegNo ? ne.taxSystem.map((P) => P.code) : []
975
- );
976
- }), w = O(() => s.value.reduce(
977
- (n, F) => n.add(F.total),
978
- rt()
979
- ).toFormat()), $ = O(() => {
980
- var P;
981
- const p = pt(
982
- s.value,
983
- t.value.price,
984
- ((P = f.storeOption) == null ? void 0 : P.inclusiveTaxes) ?? []
985
- );
986
- t.value.priceWithTaxes = p;
987
- const n = Yt(p, !1), F = Number(n.replace(/[^\d.-]/g, ""));
988
- return Number.isNaN(F) ? 0 : F;
989
- });
990
- function B() {
991
- t.value.taxTotals = s.value, b("update", Ne.parse(Xe(t.value)));
992
- }
993
- function H() {
994
- return de.cloneDeep(Ve);
995
- }
996
- function N(p, n) {
997
- l.value = p, p && n && (u.value = void 0, c.value = n.categories, t.value = n.bundle || H(), d.value.category = n.category, d.value.index = n.index, d.value.originalCategoryIndex = n.category, L.value = _.value.reduce((F, P, E) => (F[E] = !!P.selectedReward, F), {}));
998
- }
999
- return x({
1000
- showSheet: N,
1001
- bundleImage: u,
1002
- target: d,
1003
- data: t
1004
- }), (p, n) => {
1005
- const F = h("FmSwitch"), P = h("FmHelperText"), E = h("FmTextField"), q = h("FmSelect"), j = h("FmStepperField"), re = h("FmMenuItem"), ve = h("FmTable"), ue = h("FmButton"), je = h("FmSideSheet");
1006
- return v(), U(je, {
1007
- "max-width": 560,
1008
- modelValue: e(l),
1009
- "onUpdate:modelValue": n[20] || (n[20] = (ce) => oe(l) ? l.value = ce : null),
1010
- header: e(d).index != -1 ? e(r)("connect.store.bundle.edit.title") : e(r)("connect.store.bundle.edit.create")
1011
- }, {
1012
- "side-sheet-footer": T(() => [
1013
- C("div", sn, [
1014
- i(ue, {
1015
- label: e(d).index != -1 ? "Save" : "Add",
1016
- onClick: B,
1017
- disabled: e(m).length > 0,
1018
- loading: e(xe)().isLoading
1019
- }, null, 8, ["label", "disabled", "loading"]),
1020
- i(ue, {
1021
- label: "Cancel",
1022
- onClick: n[19] || (n[19] = (ce) => N(!1)),
1023
- variant: "tertiary"
1024
- })
1025
- ])
1026
- ]),
1027
- default: T(() => {
1028
- var ce, ke, Pe, Te, Ue, Re, Ie, De;
1029
- return [
1030
- i($e, { json: e(t) }, null, 8, ["json"]),
1031
- e(t) ? (v(), R("div", Gt, [
1032
- C("div", Xt, [
1033
- e(I.Config).getCountry().code == "MY" && ((ce = e(f).payoutAccount) == null ? void 0 : ce.status) == "APPROVED" && ((ke = e(f).payoutAccount) != null && ke.enable) ? (v(), U(F, {
1034
- key: 0,
1035
- "onUpdate:modelValue": n[0] || (n[0] = (V) => {
1036
- e(t).isFeedvibe = V, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], L.value = {});
1037
- }),
1038
- "label-placement": "right",
1039
- "model-value": e(t).isFeedvibe || !1,
1040
- label: "Feedvibe Campaign",
1041
- sublabel: "Bundle will be appear for Feedvibe campaign use"
1042
- }, null, 8, ["model-value"])) : A("", !0),
1043
- e(t).isFeedvibe ? (v(), U(P, {
1044
- key: 1,
1045
- text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1046
- state: "warning"
1047
- })) : A("", !0)
1048
- ]),
1049
- C("div", Zt, M(e(r)("connect.store.bundle.edit.basicInformation")), 1),
1050
- i(E, {
1051
- label: e(r)("connect.store.bundle.edit.bundleName"),
1052
- modelValue: e(t).name,
1053
- "onUpdate:modelValue": n[1] || (n[1] = (V) => e(t).name = V),
1054
- "helper-state": e(J)(e(m), "name"),
1055
- "helper-text": e(G)(e(m), "name")
1056
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1057
- i(q, {
1058
- modelValue: e(d).category,
1059
- "onUpdate:modelValue": n[2] || (n[2] = (V) => e(d).category = V),
1060
- label: "Store Category",
1061
- items: e(c).map((V, Le) => ({ label: V, value: Le }))
1062
- }, null, 8, ["modelValue", "items"]),
1063
- i(lt, {
1064
- label: e(r)("connect.store.bundle.edit.bundleImage"),
1065
- class: "w-1/2 xs:w-2/3",
1066
- "aspect-ratio": "16/9",
1067
- thumbnail: e(t).image ?? void 0,
1068
- file: e(u) ?? void 0,
1069
- "onUpdate:file": n[3] || (n[3] = (V) => {
1070
- u.value = V;
1071
- }),
1072
- "helper-state": e(J)(e(m), "image"),
1073
- "helper-text": e(G)(e(m), "image")
1074
- }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1075
- i(j, {
1076
- "model-value": e(I.Dinero).fromFdoDinero(e(t).price).toUnit(),
1077
- label: e(r)("connect.store.bundle.edit.bundlePrice"),
1078
- min: 0,
1079
- "max-fraction-digits": 2,
1080
- "onUpdate:modelValue": n[4] || (n[4] = (V) => {
1081
- e(t).price.amount = V * 10 ** e(t).price.precision;
1082
- }),
1083
- "is-currency": !0,
1084
- "show-steppers": !1,
1085
- "helper-text": e(G)(e(m), "price") || `${e(I.Dinero).fromNumber({ number: 1 }).toFormat(!0)} = ${e(I.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1086
- "helper-state": e(J)(e(m), "price")
1087
- }, {
1088
- prepend: T(() => [
1089
- ie(M(e(I.Dinero).defaultCurrency()), 1)
1090
- ]),
1091
- _: 1
1092
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1093
- i(j, {
1094
- "model-value": e(I.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1095
- label: e(r)("connect.store.bundle.edit.bundleValue"),
1096
- min: 0,
1097
- "max-fraction-digits": 2,
1098
- "onUpdate:modelValue": n[5] || (n[5] = (V) => {
1099
- e(t).originalPrice || (e(t).originalPrice = e(I.Dinero).zero().toObject()), e(t).originalPrice.amount = V * 10 ** e(t).originalPrice.precision;
1100
- }),
1101
- "is-currency": !0,
1102
- "show-steppers": !1,
1103
- "helper-text": e(G)(e(m), "originalPrice") || e(r)("connect.store.bundle.edit.originalPriceHelper"),
1104
- "helper-state": e(J)(e(m), "originalPrice")
1105
- }, {
1106
- prepend: T(() => [
1107
- ie(M(e(I.Dinero).defaultCurrency()), 1)
1108
- ]),
1109
- _: 1
1110
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1111
- e(t).isFeedvibe ? A("", !0) : (v(), U(j, {
1112
- key: 0,
1113
- "model-value": e(t).coinPrice ?? null,
1114
- label: e(r)("connect.store.bundle.edit.pointNeeded"),
1115
- min: 0,
1116
- "onUpdate:modelValue": n[6] || (n[6] = (V) => {
1117
- V > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = V;
1118
- }),
1119
- "show-steppers": !1,
1120
- "helper-state": e(J)(e(m), "coinPrice"),
1121
- "helper-text": e(G)(e(m), "coinPrice")
1122
- }, {
1123
- append: T(() => n[21] || (n[21] = [
1124
- ie(" point(s) ")
1125
- ])),
1126
- _: 1
1127
- }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1128
- (Pe = e(f).storeOption) != null && Pe.stripe && !e(t).isFeedvibe ? (v(), R(z, { key: 1 }, [
1129
- C("div", Qt, M(e(r)("connect.store.bundle.edit.subscriptionSettings")), 1),
1130
- i(E, {
1131
- label: e(r)("connect.store.bundle.edit.stripePriceId"),
1132
- modelValue: e(t).stripePriceId,
1133
- "onUpdate:modelValue": n[7] || (n[7] = (V) => e(t).stripePriceId = V),
1134
- "helper-state": e(J)(e(m), "stripePriceId"),
1135
- "helper-text": e(G)(e(m), "stripePriceId")
1136
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1137
- e(t).stripePriceId ? (v(), U(j, {
1138
- key: 0,
1139
- "model-value": e(t).subscriptionValidity ?? null,
1140
- min: 1,
1141
- "onUpdate:modelValue": K,
1142
- label: e(r)("connect.store.bundle.edit.subscriptionValidity"),
1143
- "show-steppers": !1,
1144
- "helper-state": e(J)(e(m), "subscriptionValidity"),
1145
- "helper-text": e(G)(e(m), "subscriptionValidity")
1146
- }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : A("", !0)
1147
- ], 64)) : A("", !0),
1148
- e(t).isFeedvibe ? A("", !0) : (v(), R(z, { key: 2 }, [
1149
- n[25] || (n[25] = C("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Credit", -1)),
1150
- i(j, {
1151
- modelValue: e(t).credit.normal,
1152
- "onUpdate:modelValue": n[8] || (n[8] = (V) => e(t).credit.normal = V),
1153
- label: "Normal credit",
1154
- "show-steppers": !1,
1155
- "helper-state": e(J)(e(m), "credit.normal"),
1156
- "helper-text": e(G)(e(m), "credit.normal")
1157
- }, {
1158
- append: T(() => n[22] || (n[22] = [
1159
- ie(" credit ")
1160
- ])),
1161
- _: 1
1162
- }, 8, ["modelValue", "helper-state", "helper-text"]),
1163
- i(j, {
1164
- "model-value": ((Te = e(t).credit.free) == null ? void 0 : Te.amount) ?? null,
1165
- min: 0,
1166
- "onUpdate:modelValue": n[9] || (n[9] = (V) => {
1167
- e(t).credit.free || (e(t).credit.free = {
1168
- amount: 0,
1169
- day: 1
1170
- }), e(t).credit.free.amount = V;
1171
- }),
1172
- label: "Free credit",
1173
- "show-steppers": !1,
1174
- "helper-state": e(J)(e(m), "credit.free.amount"),
1175
- "helper-text": e(G)(e(m), "credit.free.amount")
1176
- }, {
1177
- append: T(() => n[23] || (n[23] = [
1178
- ie(" credit ")
1179
- ])),
1180
- _: 1
1181
- }, 8, ["model-value", "helper-state", "helper-text"]),
1182
- (Ue = e(t).credit.free) != null && Ue.amount ? (v(), U(j, {
1183
- key: 0,
1184
- disabled: !!e(t).stripePriceId,
1185
- "model-value": ((Re = e(t).credit.free) == null ? void 0 : Re.day) ?? null,
1186
- min: 0,
1187
- "onUpdate:modelValue": n[10] || (n[10] = (V) => {
1188
- e(t).credit.free || (e(t).credit.free = {
1189
- amount: 0,
1190
- day: 1
1191
- }), e(t).credit.free.day = e(Y) || V;
1192
- }),
1193
- label: "Free credit valid for",
1194
- "show-steppers": !1,
1195
- "helper-state": e(J)(e(m), "credit.free.day"),
1196
- "helper-text": e(G)(e(m), "credit.free.day")
1197
- }, {
1198
- append: T(() => n[24] || (n[24] = [
1199
- ie(" day(s) ")
1200
- ])),
1201
- _: 1
1202
- }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : A("", !0)
1203
- ], 64)),
1204
- e(W) ? (v(), R(z, { key: 3 }, [
1205
- n[26] || (n[26] = C("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1206
- i(Jt, {
1207
- modelValue: e(t).taxes,
1208
- "onUpdate:modelValue": n[11] || (n[11] = (V) => e(t).taxes = V)
1209
- }, null, 8, ["modelValue"]),
1210
- i(E, {
1211
- label: `Tax Charged (${e(le)})`,
1212
- "model-value": e(w),
1213
- disabled: ""
1214
- }, null, 8, ["label", "model-value"])
1215
- ], 64)) : A("", !0),
1216
- i(j, {
1217
- label: "Total Price",
1218
- "model-value": e($),
1219
- disabled: !0
1220
- }, null, 8, ["model-value"]),
1221
- C("div", en, M(e(r)("connect.store.bundle.edit.bundleReward.title")), 1),
1222
- C("div", tn, M(e(r)("connect.store.bundle.edit.bundleReward.description")), 1),
1223
- C("div", nn, [
1224
- C("div", on, [
1225
- i(at, {
1226
- label: `Reward type: ${e(o).length == 0 ? "All" : e(o)[0].name}`
1227
- }, {
1228
- default: T(() => [
1229
- i(re, {
1230
- onClick: n[12] || (n[12] = (V) => o.value = []),
1231
- label: "All"
1232
- }),
1233
- i(re, {
1234
- onClick: n[13] || (n[13] = (V) => o.value = [
1235
- {
1236
- id: "type",
1237
- value: "VOUCHER",
1238
- name: e(me).VOUCHER.name
1239
- }
1240
- ]),
1241
- label: e(me).VOUCHER.name
1242
- }, null, 8, ["label"]),
1243
- i(re, {
1244
- onClick: n[14] || (n[14] = (V) => o.value = [
1245
- {
1246
- id: "type",
1247
- value: "TITLE",
1248
- name: e(me).TITLE.name
1249
- }
1250
- ]),
1251
- label: e(me).TITLE.name
1252
- }, null, 8, ["label"])
1253
- ]),
1254
- _: 1
1255
- }, 8, ["label"])
1256
- ]),
1257
- i(ve, {
1258
- modelValue: e(L),
1259
- "onUpdate:modelValue": n[15] || (n[15] = (V) => oe(L) ? L.value = V : null),
1260
- selection: "multiple",
1261
- "column-filter": e(o),
1262
- "column-defs": S,
1263
- "row-data": e(_).filter(
1264
- (V) => !e(t).isFeedvibe || V.collectible.type == "VOUCHER"
1265
- ),
1266
- "hide-footer": e(_).length <= 10
1267
- }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1268
- i(P, {
1269
- text: e(G)(e(m), "titles"),
1270
- state: e(J)(e(m), "titles")
1271
- }, null, 8, ["text", "state"])
1272
- ]),
1273
- C("div", ln, M(e(r)("connect.store.bundle.edit.advanceSetting")), 1),
1274
- C("div", an, [
1275
- i(F, {
1276
- "model-value": e(t).internal ?? !1,
1277
- "onUpdate:modelValue": n[16] || (n[16] = (V) => e(t).internal = V),
1278
- "label-placement": "right",
1279
- label: e(r)("connect.store.bundle.edit.internalBundle"),
1280
- sublabel: e(r)("connect.store.bundle.edit.internalBundleDescription")
1281
- }, null, 8, ["model-value", "label", "sublabel"]),
1282
- i(F, {
1283
- "model-value": e(t).hideInPos ?? !1,
1284
- "onUpdate:modelValue": n[17] || (n[17] = (V) => e(t).hideInPos = V),
1285
- "label-placement": "right",
1286
- label: e(r)("connect.store.bundle.edit.hideInPos"),
1287
- sublabel: e(r)("connect.store.bundle.edit.hideInPosDescription")
1288
- }, null, 8, ["model-value", "label", "sublabel"]),
1289
- i(j, {
1290
- "model-value": ((De = (Ie = e(t).config) == null ? void 0 : Ie.options) == null ? void 0 : De.maxPerUser) || null,
1291
- "onUpdate:modelValue": n[18] || (n[18] = (V) => e(de).set(e(t), "config.options.maxPerUser", V)),
1292
- label: e(r)("connect.store.bundle.edit.maxPerUser"),
1293
- "show-steppers": !1,
1294
- placeholder: "Unlimited"
1295
- }, null, 8, ["model-value", "label"])
1296
- ])
1297
- ])) : A("", !0)
1298
- ];
1299
- }),
1300
- _: 1
1301
- }, 8, ["modelValue", "header"]);
1302
- };
1303
- }
1304
- }), dn = { class: "space-y-16" }, un = { class: "flex gap-8 items-center flex-wrap" }, cn = { class: "flex items-center gap-8" }, mn = /* @__PURE__ */ Q({
1305
- __name: "SendBundleSheet",
1306
- emits: ["success"],
1307
- setup(g, { expose: x, emit: a }) {
1308
- const { minor: b } = Me, r = D(), f = D(""), l = D(""), c = D([]), d = D(!1);
1309
- function t(o) {
1310
- d.value = !0, f.value = null, l.value = "", r.value = o.bundle;
1311
- }
1312
- function u() {
1313
- d.value = !1;
1314
- }
1315
- async function y(o) {
1316
- const _ = await ut.read({
1317
- limit: 25,
1318
- skip: 0,
1319
- sortBy: "_id",
1320
- search: o,
1321
- descending: !1
1322
- });
1323
- c.value = _.resources.map((k) => ({
1324
- label: `${k.name} (${k.phoneNumber})`,
1325
- value: k._id
1326
- })), await new Promise((k) => setTimeout(k, 100));
1327
- }
1328
- async function m() {
1329
- if (!r.value || !f.value) return;
1330
- const o = c.value.find(
1331
- (k) => k.value === f.value
1332
- );
1333
- await ge.confirm(
1334
- `Are you sure you want to send bundle ${r.value.name} to ${o == null ? void 0 : o.label}?`,
1335
- "Confirm",
1336
- "Confirm",
1337
- "Cancel"
1338
- ) && await b(
1339
- async () => {
1340
- const k = {
1341
- bundle: r.value._id,
1342
- member: f.value,
1343
- source: nt.enum.ADMIN,
1344
- ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${l.value}`,
1345
- withCoin: !1
1346
- };
1347
- await he.sendBundle(k), u();
1348
- },
1349
- {
1350
- message: "Sending bundle",
1351
- successMessage: "Bundle sent"
1352
- }
1353
- );
1354
- }
1355
- const S = O(() => {
1356
- var _, k, Y;
1357
- const o = [];
1358
- return ((_ = r.value) == null ? void 0 : _.price.amount) > 0 && o.push(
1359
- `${I.Config.getCountry().currency.symbol}${Ee((k = r.value) == null ? void 0 : k.price)}`
1360
- ), (Y = r.value) != null && Y.coinPrice && o.push(`${r.value.coinPrice} point(s)`), o.join(" or ");
1361
- });
1362
- return x({
1363
- showSheet: t,
1364
- hideSheet: u
1365
- }), fe(async () => {
1366
- await y("");
1367
- }), (o, _) => {
1368
- const k = h("FmCardMedia"), Y = h("FmCardHeader"), K = h("FmChip"), ee = h("FmCardSection"), L = h("FmCard"), W = h("FmSelect"), le = h("FmTextField"), s = h("FmButton"), w = h("FmSideSheet");
1369
- return v(), U(w, {
1370
- "max-width": 560,
1371
- "dismiss-away": !0,
1372
- header: "Send bundle to member",
1373
- modelValue: e(d),
1374
- "onUpdate:modelValue": [
1375
- _[3] || (_[3] = ($) => oe(d) ? d.value = $ : null),
1376
- _[4] || (_[4] = ($) => d.value = $)
1377
- ]
1378
- }, {
1379
- "side-sheet-footer": T(() => [
1380
- C("div", cn, [
1381
- i(s, {
1382
- label: "Send",
1383
- loading: e(xe)().isLoading,
1384
- disabled: !e(f) || !e(r),
1385
- onClick: m
1386
- }, null, 8, ["loading", "disabled"]),
1387
- i(s, {
1388
- label: "Cancel",
1389
- type: "button",
1390
- variant: "tertiary",
1391
- onClick: _[2] || (_[2] = ($) => d.value = !1)
1392
- })
1393
- ])
1394
- ]),
1395
- default: T(() => [
1396
- C("div", dn, [
1397
- i(L, {
1398
- class: "max-w-[700px]",
1399
- horizontal: "",
1400
- variant: "outlined"
1401
- }, {
1402
- default: T(() => {
1403
- var $, B;
1404
- return [
1405
- ($ = e(r)) != null && $.image ? (v(), U(k, {
1406
- key: 0,
1407
- width: "100",
1408
- src: (B = e(r)) == null ? void 0 : B.image
1409
- }, null, 8, ["src"])) : A("", !0),
1410
- i(ee, { class: "flex flex-col gap-16 justify-between" }, {
1411
- default: T(() => {
1412
- var H;
1413
- return [
1414
- i(Y, {
1415
- class: "p-0",
1416
- title: (H = e(r)) == null ? void 0 : H.name,
1417
- subtitle: e(S)
1418
- }, null, 8, ["title", "subtitle"]),
1419
- i(ee, { class: "p-0" }, {
1420
- default: T(() => {
1421
- var N, p, n, F, P, E, q, j, re, ve, ue;
1422
- return [
1423
- C("div", un, [
1424
- (N = e(r)) != null && N.isFeedvibe ? (v(), U(K, {
1425
- key: 0,
1426
- label: "Feedvibe"
1427
- })) : A("", !0),
1428
- (n = (p = e(r)) == null ? void 0 : p.titles) != null && n.length ? (v(), U(K, {
1429
- key: 1,
1430
- label: `${e(r).titles.length} title(s)`
1431
- }, null, 8, ["label"])) : A("", !0),
1432
- (P = (F = e(r)) == null ? void 0 : F.vouchers) != null && P.length ? (v(), U(K, {
1433
- key: 2,
1434
- label: `${e(r).vouchers.length} voucher(s)`
1435
- }, null, 8, ["label"])) : A("", !0),
1436
- (q = (E = e(r)) == null ? void 0 : E.credit) != null && q.normal || (ve = (re = (j = e(r)) == null ? void 0 : j.credit) == null ? void 0 : re.free) != null && ve.amount ? (v(), U(K, {
1437
- key: 3,
1438
- label: `${(e(r).credit.normal || 0) + (((ue = e(r).credit.free) == null ? void 0 : ue.amount) || 0)} credit(s)`
1439
- }, null, 8, ["label"])) : A("", !0)
1440
- ])
1441
- ];
1442
- }),
1443
- _: 1
1444
- })
1445
- ];
1446
- }),
1447
- _: 1
1448
- })
1449
- ];
1450
- }),
1451
- _: 1
1452
- }),
1453
- i(W, {
1454
- modelValue: e(f),
1455
- "onUpdate:modelValue": _[0] || (_[0] = ($) => oe(f) ? f.value = $ : null),
1456
- label: "Select member",
1457
- searchable: "",
1458
- items: e(c),
1459
- onSearch: y,
1460
- "helper-text": "Type to search"
1461
- }, null, 8, ["modelValue", "items"]),
1462
- i(le, {
1463
- modelValue: e(l),
1464
- "onUpdate:modelValue": _[1] || (_[1] = ($) => oe(l) ? l.value = $ : null),
1465
- label: "Reference"
1466
- }, null, 8, ["modelValue"])
1467
- ])
1468
- ]),
1469
- _: 1
1470
- }, 8, ["modelValue"]);
1471
- };
1472
- }
1473
- });
1474
- var pn = { 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" };
1475
- const yn = { class: "px-24 flex flex-col gap-y-16" }, fn = { class: "flex gap-8 items-center" }, bn = { class: "fm-typo-en-body-lg-600" }, vn = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, gn = { class: "flex flex-col gap-16 text-center" }, hn = { class: "fm-typo-en-title-sm-800" }, xn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xn = /* @__PURE__ */ Q({
1476
- __name: "Store",
1477
- setup(g) {
1478
- const x = {
1479
- label: "Setup payout account",
1480
- value: "payout",
1481
- isPrimary: !1
1482
- }, { t: a } = be(), b = {
1483
- label: a("connect.store.actions.setting"),
1484
- value: "setting",
1485
- isPrimary: !1
1486
- }, r = {
1487
- label: a("connect.store.actions.manageReward"),
1488
- value: "create_reward"
1489
- }, f = {
1490
- label: a("connect.store.actions.addCategory"),
1491
- value: "create_category",
1492
- isPrimary: !0,
1493
- prependIcon: "add"
1494
- }, l = D(), c = ct(), d = we(), { global: t, minor: u } = Me, y = Ae(), m = O(() => d.sortedStoreCategories), S = O(() => d.sortedStoreCategories.map((s) => s.name)), o = D(), _ = D();
1495
- async function k(s) {
1496
- var w;
1497
- s === "setting" ? (w = o.value) == null || w.showSheet(!0, d.storeOption) : s === "create_category" ? K(-1) : s === "create_reward" ? await c.push({ name: Ze["$connect-STORE_REWARDS"] }) : s == "payout" && window.open(pn.paymentPortalUrl, "_blank");
1498
- }
1499
- async function Y(s) {
1500
- await u(
1501
- async () => {
1502
- var w;
1503
- await he.updateStore(s), await d.readMemberStore(), (w = o.value) == null || w.showSheet(!1);
1504
- },
1505
- {
1506
- message: a("connect.store.setting.update.message"),
1507
- successMessage: a("connect.store.setting.update.success")
1508
- }
1509
- );
1510
- }
1511
- async function K(s = -1) {
1512
- var w, $;
1513
- if ((!d.storeOption || !d.storeOption.company) && await ge.confirm(
1514
- a("connect.store.category.setup.title"),
1515
- a("connect.store.category.setup.button"),
1516
- a("connect.store.category.setup.action"),
1517
- a("connect.common.cancel")
1518
- ))
1519
- return (w = o.value) == null ? void 0 : w.showSheet(!0);
1520
- y.open({
1521
- title: s == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
1522
- contentComponent: wt,
1523
- contentComponentProps: {
1524
- initialValue: (($ = m.value[s]) == null ? void 0 : $.name) ?? "",
1525
- action: s == -1 ? "add" : "edit"
1526
- }
1527
- }).onPrimary(async (B) => {
1528
- B === null && !await ge.remove(
1529
- a("connect.store.category.remove.confirm"),
1530
- a("connect.store.category.remove.title")
1531
- ) || await u(
1532
- async () => {
1533
- const H = s == -1 ? [...m.value, { name: B, bundles: [] }] : [...m.value].map((N, p) => p == s ? { ...N, name: B } : N).filter((N) => N.name !== null);
1534
- await he.updateStoreBundle({
1535
- categories: H
1536
- }), await d.readMemberStore();
1537
- },
1538
- {
1539
- message: B === null ? a("connect.store.category.update.deleting") : s == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
1540
- successMessage: B === null ? a("connect.store.category.update.success.deleted") : s == -1 ? a("connect.store.category.update.success.created") : a("connect.store.category.update.success.updated")
1541
- }
1542
- );
1543
- });
1544
- }
1545
- async function ee(s, w, $, B) {
1546
- var p, n, F;
1547
- w ?? (w = (p = _.value) == null ? void 0 : p.target.category), $ ?? ($ = (n = _.value) == null ? void 0 : n.target.index), B ?? (B = (F = _.value) == null ? void 0 : F.target.originalCategoryIndex);
1548
- const H = Be(m.value);
1549
- w != B && (H[B].bundles.splice($, 1), $ = H[w].bundles.length), console.log(w, $, B, "ci, bi, originalCategoryIndex");
1550
- const N = H[w];
1551
- if (!N) {
1552
- Ge.error("Unexpected error", 2e3);
1553
- return;
1554
- }
1555
- if (s == null) {
1556
- if (await ge.remove(
1557
- "Are you sure you want to delete this bundle?",
1558
- "Delete bundle"
1559
- ) == !1)
1560
- return;
1561
- N.bundles.splice($, 1);
1562
- } else
1563
- $ == -1 ? N.bundles.push(s) : N.bundles[$] = s;
1564
- await u(
1565
- async () => {
1566
- var P, E;
1567
- if (s != null) {
1568
- const q = (P = _.value) == null ? void 0 : P.bundleImage;
1569
- q === null && s.image ? (await Ce.delete(s.image), s.image = null) : q && (s.image = await Ce.update(
1570
- Ce.bundleImagePath(void 0, q),
1571
- q
1572
- ));
1573
- }
1574
- await he.updateStoreBundle({
1575
- categories: H
1576
- }), await d.readMemberStore(), await d.readMembership(), await d.readRewards(), (E = _.value) == null || E.showSheet(!1);
1577
- },
1578
- {
1579
- message: `${s == null ? "Deleting" : $ == -1 ? "Creating" : "Updating"} bundle`,
1580
- successMessage: `Bundle ${s == null ? "deleted" : $ == -1 ? "created" : "updated"} successfully`
1581
- }
1582
- );
1583
- }
1584
- function L(s) {
1585
- var w;
1586
- (w = _.value) == null || w.showSheet(!0, {
1587
- ...s,
1588
- bundle: s.bundle ? Be(s.bundle) : void 0
1589
- });
1590
- }
1591
- const W = D([]);
1592
- function le(s) {
1593
- var w;
1594
- (w = l.value) == null || w.showSheet({
1595
- bundle: s
1596
- });
1597
- }
1598
- return fe(async () => {
1599
- var s, w;
1600
- await t(async () => {
1601
- var $, B;
1602
- if (await d.readMemberStore(), await d.readMembership(), await d.readRewards(), await d.readPayoutAccount(), ($ = c.currentRoute.value.query) != null && $.action) {
1603
- switch ((B = c.currentRoute.value.query) == null ? void 0 : B.action) {
1604
- case "update_setting":
1605
- k("setting");
1606
- break;
1607
- case "create_category":
1608
- K(-1);
1609
- break;
1610
- case "create_feedvibe_bundle":
1611
- y.open({
1612
- title: "Select category",
1613
- contentComponent: Pt
1614
- }).onPrimary((H) => {
1615
- y.close(), L({
1616
- categories: S.value,
1617
- category: H,
1618
- index: -1,
1619
- bundle: {
1620
- ...de.cloneDeep(Ve),
1621
- isFeedvibe: !0,
1622
- price: I.Dinero.fromNumber({
1623
- number: 10,
1624
- precision: 2
1625
- }).toObject()
1626
- }
1627
- });
1628
- }).onTertiary(() => y.close());
1629
- break;
1630
- }
1631
- c.replace({ query: {} });
1632
- }
1633
- }), W.value = [b, r, f], (((s = d.payoutAccount) == null ? void 0 : s.status) != "APPROVED" || ((w = d.payoutAccount) == null ? void 0 : w.enable) != !0) && (W.value = [
1634
- x,
1635
- b,
1636
- r,
1637
- f
1638
- ]);
1639
- }), (s, w) => {
1640
- const $ = h("FmPageHead"), B = h("FmButton"), H = h("FmCard");
1641
- return v(), R(z, null, [
1642
- i($, {
1643
- title: e(a)("connect.store.title"),
1644
- actions: e(W),
1645
- "onClick:action": k
1646
- }, null, 8, ["title", "actions"]),
1647
- C("div", yn, [
1648
- e(m) && e(m).length > 0 ? (v(), R(z, { key: 0 }, [
1649
- (v(!0), R(z, null, se(e(m), (N, p) => (v(), R("div", {
1650
- key: N.name,
1651
- class: "space-y-8 py-12"
1652
- }, [
1653
- C("div", fn, [
1654
- C("div", bn, M(N.name), 1),
1655
- i($e, { json: N }, null, 8, ["json"]),
1656
- i(B, {
1657
- icon: "edit",
1658
- size: "md",
1659
- variant: "tertiary",
1660
- onClick: (n) => K(p)
1661
- }, null, 8, ["onClick"])
1662
- ]),
1663
- C("div", vn, [
1664
- (v(!0), R(z, null, se(N.bundles, (n, F) => (v(), U(_t, {
1665
- bundle: n,
1666
- key: n._id,
1667
- onEdit: (P) => L({
1668
- bundle: n,
1669
- category: p,
1670
- index: F,
1671
- categories: e(S)
1672
- }),
1673
- onDelete: (P) => ee(null, p, F),
1674
- onSend: le
1675
- }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1676
- i(Ct, {
1677
- onCreate: (n) => L({
1678
- category: p,
1679
- index: -1,
1680
- categories: e(S)
1681
- })
1682
- }, null, 8, ["onCreate"])
1683
- ])
1684
- ]))), 128)),
1685
- i(rn, {
1686
- ref_key: "bundleSheetRef",
1687
- ref: _,
1688
- onUpdate: ee
1689
- }, null, 512)
1690
- ], 64)) : (v(), U(H, {
1691
- key: 1,
1692
- variant: "outlined",
1693
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1694
- }, {
1695
- default: T(() => [
1696
- w[1] || (w[1] = C("img", {
1697
- src: We,
1698
- class: "aspect-square w-[150px]"
1699
- }, null, -1)),
1700
- C("div", gn, [
1701
- C("div", hn, M(e(a)("connect.store.bundle.title")), 1),
1702
- C("div", xn, M(e(a)("connect.store.bundle.description")), 1)
1703
- ]),
1704
- i(B, {
1705
- variant: "primary",
1706
- label: e(a)("connect.store.actions.addCategory"),
1707
- icon: "add",
1708
- onClick: w[0] || (w[0] = (N) => K(-1))
1709
- }, null, 8, ["label"])
1710
- ]),
1711
- _: 1
1712
- })),
1713
- i(zt, {
1714
- ref_key: "settingSheetRef",
1715
- ref: o,
1716
- onUpdate: Y
1717
- }, null, 512),
1718
- i(mn, {
1719
- ref_key: "sendBundleSheetRef",
1720
- ref: l
1721
- }, null, 512)
1722
- ])
1723
- ], 64);
1724
- };
1725
- }
1726
- });
1727
- export {
1728
- Xn as default
1729
- };