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