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