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