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