@feedmepos/mf-connect 0.1.38-beta.52 → 0.1.38-beta.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/package.json +2 -2
  2. package/dist/Analytic-BU1mOMoX.js +0 -760
  3. package/dist/App-fw6iFNxW.js +0 -4638
  4. package/dist/AuditLogs-CliU8167.js +0 -1887
  5. package/dist/Bin-C49tzfas.js +0 -166
  6. package/dist/Broadcast-YZVnZTCD.js +0 -232
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DEwsZags.js +0 -122
  8. package/dist/Card-DcQQyJl9.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections--8lmoXWR.js +0 -540
  11. package/dist/Credit-CfkLFMei.js +0 -227
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-t6eac8yR.js +0 -3151
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CXVOuiLI.js +0 -347
  16. package/dist/Experience-BnVVC2-L.js +0 -228
  17. package/dist/FileSaver.min-NlMItPOc.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/Game-Dbz4DzY_.js +0 -297
  20. package/dist/Grab-CCqScmpp.js +0 -300
  21. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-C5irH9v6.js +0 -145
  22. package/dist/Index-DPsM9D4W.js +0 -259
  23. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  24. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +0 -18737
  25. package/dist/MainLayout-B1aJoR95.js +0 -41
  26. package/dist/Marketing-CFwxWdJq.js +0 -21761
  27. package/dist/Member-ZPKbf5Bk.js +0 -281
  28. package/dist/MemberList-BDs-70nG.js +0 -1607
  29. package/dist/MemberOverview-wL_ailso.js +0 -58
  30. package/dist/MemberTransactions-C-zHpuZF.js +0 -45
  31. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-B2TKmOOK.js +0 -60616
  32. package/dist/Mission-BHkb1E9m.js +0 -301
  33. package/dist/Overview-DYlcqNCX.js +0 -1079
  34. package/dist/Point-BEhNBY2_.js +0 -231
  35. package/dist/Promotion-DOXRIej4.js +0 -363
  36. package/dist/Queue-Bwa0LWhf.js +0 -260
  37. package/dist/Record-BoI8l1Qq.js +0 -341
  38. package/dist/Reward-BVQaqAYM.js +0 -442
  39. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BC3dEiWi.js +0 -150
  40. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-HpleMvjm.js +0 -1767
  41. package/dist/Segment-Cmy7nu27.js +0 -882
  42. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-pab6X2DC.js +0 -181
  43. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BqIh8D8O.js +0 -189
  44. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CESoNd87.js +0 -147
  45. package/dist/Setting-DN8j_6Xv.js +0 -1993
  46. package/dist/SettingAdvertisements-qHdiaa6m.js +0 -264
  47. package/dist/Store-DfhVYCgX.js +0 -1936
  48. package/dist/StoreRewards-NYucFLJU.js +0 -535
  49. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BGOcOAXR.js +0 -1036
  50. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DRin8Jzw.js +0 -8093
  51. package/dist/Tier-Dl0aBuJz.js +0 -970
  52. package/dist/Title-DvO6Mira.js +0 -568
  53. package/dist/Transaction-ONVl4UZZ.js +0 -39
  54. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-FyE25D8o.js +0 -130
  55. package/dist/Voucher-BZ1feYh1.js +0 -399
  56. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-Lilql8J4.js +0 -421
  57. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-C_ZdCOPI.js +0 -56
  58. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  59. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  60. package/dist/app-B_RRkjaD.js +0 -42566
  61. package/dist/app-wDQR6dpb.js +0 -39
  62. package/dist/app.js +0 -7
  63. package/dist/business-y5qSMcd-.js +0 -82
  64. package/dist/campaign-CpzFl8Vr.js +0 -4
  65. package/dist/campaign-DHgol2Lt.js +0 -219
  66. package/dist/campaign-Drxe0zPX.js +0 -253
  67. package/dist/campaign.enum-CwAPVgPe.js +0 -21
  68. package/dist/campaign.fn-DMx5xsiK.js +0 -776
  69. package/dist/collectible.enum-Bh4jnUgP.js +0 -19
  70. package/dist/collection.fn-BpC_YBwG.js +0 -26
  71. package/dist/dto-DWkf9QOb.js +0 -222
  72. package/dist/effect-D5ZWGpNS.js +0 -78
  73. package/dist/email-addresses-DFtVESS8.js +0 -705
  74. package/dist/export-BtUy3sWU.js +0 -97
  75. package/dist/feedme.ico +0 -0
  76. package/dist/helper-DtWMZoWX.js +0 -86
  77. package/dist/index-7HXC3sH0.js +0 -56
  78. package/dist/index-BQlhmw75.js +0 -3
  79. package/dist/index-BdX7CxUg.js +0 -30076
  80. package/dist/index-BerRe0M3.js +0 -76
  81. package/dist/index-BrZ3xZzk.js +0 -146
  82. package/dist/index-CJzBpsBP.js +0 -3412
  83. package/dist/index-CQiABpeB.js +0 -32456
  84. package/dist/index-CqIWlGW3.js +0 -38
  85. package/dist/index-CsaQJMAR.js +0 -66
  86. package/dist/index-DPCDboPA.js +0 -32
  87. package/dist/index-DPaH8jaV.js +0 -8884
  88. package/dist/index-Dkce3JZ_.js +0 -54
  89. package/dist/index-DrYv_gG4.js +0 -31
  90. package/dist/index-SfJbKfWl.js +0 -2407
  91. package/dist/index-vh86FiIQ.js +0 -10
  92. package/dist/index.esm2017-CbvE5vCC.js +0 -3069
  93. package/dist/loading-BWGIK17X.js +0 -71
  94. package/dist/lodash-B5I3zXaY.js +0 -3678
  95. package/dist/membership-Zy2P6O6X.js +0 -235
  96. package/dist/moment-D7p2TMB-.js +0 -2583
  97. package/dist/money-D_fZmBbi.js +0 -15
  98. package/dist/number-C4DhXkCm.js +0 -12
  99. package/dist/object-qECH92oz.js +0 -26
  100. package/dist/objectId-dwaoBfJX.js +0 -7
  101. package/dist/objectid-C6eRcDzI.js +0 -145
  102. package/dist/plugins-DDAJav2s.js +0 -1817
  103. package/dist/reward-Dxjvmy7-.js +0 -36
  104. package/dist/rule-builder-ZkPWAiTl.js +0 -102
  105. package/dist/rule-sclqeiyk.js +0 -1951
  106. package/dist/style.css +0 -4
  107. package/dist/template-CAs0lkTY.js +0 -188
  108. package/dist/tier-BJDhpH6X.js +0 -4
  109. package/dist/tiers/tier=1.png +0 -0
  110. package/dist/tiers/tier=2.png +0 -0
  111. package/dist/tiers/tier=3.png +0 -0
  112. package/dist/tiers/tier=4.png +0 -0
  113. package/dist/timezone-5t8ki0gE.js +0 -1151
  114. package/dist/titles/type=diamond.png +0 -0
  115. package/dist/titles/type=drinks.png +0 -0
  116. package/dist/titles/type=food.png +0 -0
  117. package/dist/titles/type=heart.png +0 -0
  118. package/dist/titles/type=medal.png +0 -0
  119. package/dist/titles/type=spend.png +0 -0
  120. package/dist/titles/type=thank-you.png +0 -0
  121. package/dist/titles/type=thumbs-up.png +0 -0
  122. package/dist/titles/type=years.png +0 -0
  123. package/dist/trigger-B2fpKTfg.js +0 -213
  124. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  125. package/dist/type_drinks-D6jnpvwV.js +0 -4
  126. package/dist/usePagination-Ds-cuHop.js +0 -223
  127. package/dist/user-ORhbAsqi.js +0 -55
  128. package/dist/vue-i18n-cyOhW8mW.js +0 -2365
  129. package/dist/xlsx-4klfjFae.js +0 -15491
  130. package/dist/zod-BsHmzMQd.js +0 -91
@@ -1,1936 +0,0 @@
1
- import { defineComponent as te, computed as L, resolveComponent as _, openBlock as h, createBlock as M, withCtx as N, createElementVNode as V, createElementBlock as D, createVNode as r, createCommentVNode as E, toDisplayString as K, unref as e, Fragment as Y, renderList as ue, ref as I, isRef as se, reactive as Ye, onMounted as ve, watch as Pe, toRaw as ze, createTextVNode as ce, h as Je } from "vue";
2
- import { _ as Ge } from "./tier-BJDhpH6X.js";
3
- import { useDialog as Ee, useDialogChild as je, components as Xe } from "@feedmepos/ui-library";
4
- import { c as A, e as Ce, S as Ze } from "./index-BdX7CxUg.js";
5
- import { u as Le } from "./loading-BWGIK17X.js";
6
- import { u as Te, C as pe } from "./membership-Zy2P6O6X.js";
7
- import { m as Qe, n as et, o as tt, p as Ae, q as nt } from "./index-CJzBpsBP.js";
8
- import { a as ot, c as Fe } from "./object-qECH92oz.js";
9
- import { _ as ae } from "./lodash-B5I3zXaY.js";
10
- import { c as de } from "./index-CQiABpeB.js";
11
- import { u as he } from "./vue-i18n-cyOhW8mW.js";
12
- import { Z as Q, g as G, a as X } from "./zod-BsHmzMQd.js";
13
- import { z as ee, R as at } from "./app-B_RRkjaD.js";
14
- import { u as Se } from "./app-wDQR6dpb.js";
15
- import { _ as le } from "./ZodTextField.vue_vue_type_script_setup_true_lang-C_ZdCOPI.js";
16
- import { a as lt, p as ye, n as st, f as Ve } from "./plugins-DDAJav2s.js";
17
- import { J as ke } from "./JsonViewer-v8_C7l5N.js";
18
- import { _ as rt } from "./index-DPaH8jaV.js";
19
- import { _ as it } from "./ImageInput.vue_vue_type_script_setup_true_lang-C5irH9v6.js";
20
- import { _ as dt } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
21
- import { z as ut, a as ct } from "./money-D_fZmBbi.js";
22
- import { F as mt } from "./number-C4DhXkCm.js";
23
- import { a as pt, t as ft } from "./helper-DtWMZoWX.js";
24
- import "./index-BQlhmw75.js";
25
- import "./index-SfJbKfWl.js";
26
- import "./index-CqIWlGW3.js";
27
- import "./index-Dkce3JZ_.js";
28
- import { m as yt } from "./index-BerRe0M3.js";
29
- import { m as be } from "./index-BrZ3xZzk.js";
30
- import { useRouter as bt } from "vue-router";
31
- function Ke(x) {
32
- return de.DineroFactory(x).toUnit();
33
- }
34
- function He(x, S, a, g, s = [], v = []) {
35
- const o = rt.compact(
36
- S.map((t) => x.find((u) => u.systemCode === t.systemCode && u.taxCode === t.taxCode)).filter((t) => !!t && v.includes(t.systemCode))
37
- ), c = o.reduce(
38
- (t, u) => {
39
- var f;
40
- return Object.assign(t, {
41
- [u.taxCode]: {
42
- inclusive: ((f = s.find((d) => d.systemCode === u.systemCode)) == null ? void 0 : f.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
- ), i = de.Calculator.calculate({
59
- items: {
60
- 0: {
61
- quantity: 1,
62
- adjustments: {
63
- price: {
64
- level: 0,
65
- type: {
66
- type: "BY_AMOUNT",
67
- amount: de.DineroFactory(a).subtract(de.Dinero.fromNumber({ number: g }).toObject()).toObject()
68
- }
69
- }
70
- },
71
- taxes: c
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: de.DineroFactory({
84
- ...i.items[0].taxes[t.taxCode].amount
85
- }).convertPrecision(2).toObject()
86
- }));
87
- }
88
- function qe(x, S, a) {
89
- return x ? x.reduce((g, s) => {
90
- var v;
91
- return (v = a.find((o) => o.systemCode === s.systemCode)) != null && v.inclusive || (g = de.DineroFactory(g.toObject()).add(s.total)), g;
92
- }, de.DineroFactory(S)).toObject() : de.DineroFactory(S).toObject();
93
- }
94
- const gt = { class: "relative h-[120px] aspect-video flex items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, vt = ["src"], ht = {
95
- key: 2,
96
- class: "absolute top-2 left-2"
97
- }, xt = { class: "absolute top-0 right-0" }, Ct = { class: "fm-typo-en-body-lg-600" }, _t = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, St = { class: "flex gap-8 items-center flex-wrap" }, Ft = /* @__PURE__ */ te({
98
- __name: "StoreBundleCard",
99
- props: {
100
- bundle: { type: Object, required: !0 }
101
- },
102
- emits: ["edit", "delete", "send"],
103
- setup(x, { emit: S }) {
104
- const a = x, g = S, s = L(() => {
105
- const o = [];
106
- return a.bundle.price.amount > 0 && o.push(
107
- `${A.Config.getCountry().currency.symbol}${Ke(a.bundle.price)}`
108
- ), a.bundle.coinPrice && o.push(`${a.bundle.coinPrice} point(s)`), o.join(" or ");
109
- }), v = L(() => {
110
- var c, i;
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 || (c = a.bundle.credit.free) != null && c.amount) {
113
- const t = a.bundle.credit.normal + (((i = a.bundle.credit.free) == null ? void 0 : i.amount) ?? 0);
114
- o.push(`${t} credit(s)`);
115
- }
116
- return o;
117
- });
118
- return (o, c) => {
119
- const i = _("FmIcon"), t = _("FmChip"), u = _("FmButton"), f = _("FmMenuItem"), d = _("FmMenu"), T = _("FmCard");
120
- return h(), M(T, {
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: N(() => [
125
- V("div", gt, [
126
- x.bundle.image ? (h(), D("img", {
127
- key: 1,
128
- src: x.bundle.image,
129
- class: "w-full h-full object-contain aspect-video"
130
- }, null, 8, vt)) : (h(), M(i, {
131
- key: 0,
132
- name: "image",
133
- outline: !0,
134
- size: "md",
135
- class: "text-fm-color-neutral-gray-200"
136
- })),
137
- x.bundle.isFeedvibe ? (h(), D("div", ht, [
138
- r(t, {
139
- label: "Feedvibe",
140
- class: "text-fm-color-primary bg-fm-color-system-warning-100",
141
- compact: ""
142
- })
143
- ])) : E("", !0),
144
- V("div", xt, [
145
- r(d, { placement: "bottom-end" }, {
146
- "menu-button": N(() => [
147
- r(u, {
148
- icon: "more_vert",
149
- variant: "tertiary"
150
- })
151
- ]),
152
- default: N(() => [
153
- r(f, {
154
- onClick: c[0] || (c[0] = (l) => g("edit", x.bundle)),
155
- icon: "edit",
156
- label: "Edit"
157
- }),
158
- x.bundle.stripePriceId ? E("", !0) : (h(), M(f, {
159
- key: 0,
160
- onClick: c[1] || (c[1] = (l) => g("send", x.bundle)),
161
- icon: "send",
162
- label: "Send"
163
- })),
164
- r(f, {
165
- onClick: c[2] || (c[2] = (l) => g("delete", x.bundle)),
166
- icon: "delete"
167
- }, {
168
- label: N(() => [...c[3] || (c[3] = [
169
- V("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
- V("div", Ct, K(x.bundle.name), 1),
179
- V("div", _t, K(e(s) || "Free"), 1),
180
- V("div", St, [
181
- (h(!0), D(Y, null, ue(e(v), (l, w) => (h(), M(t, {
182
- key: w,
183
- label: l
184
- }, null, 8, ["label"]))), 128))
185
- ])
186
- ]),
187
- _: 1
188
- });
189
- };
190
- }
191
- }), Vt = /* @__PURE__ */ te({
192
- __name: "AddBundleCard",
193
- emits: ["create"],
194
- setup(x, { emit: S }) {
195
- const { t: a } = he(), g = S;
196
- return (s, v) => {
197
- const o = _("FmButton"), c = _("FmCard");
198
- return h(), M(c, {
199
- variant: "outlined",
200
- class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
201
- }, {
202
- default: N(() => [
203
- r(o, {
204
- onClick: v[0] || (v[0] = (i) => g("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
- }), wt = { class: "space-y-16" }, Pt = { class: "flex w-full justify-between pb-16" }, Tt = { class: "flex items-center justify-end gap-8" }, kt = /* @__PURE__ */ te({
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(x) {
227
- const { t: S } = he(), a = x, g = Ee(), { emitData: s, emitAction: v } = je(), o = I(a.initialValue), c = ee.string().min(1);
228
- function i() {
229
- s(o.value), v("primary"), g.close();
230
- }
231
- function t() {
232
- s(null), v("primary"), g.close();
233
- }
234
- return (u, f) => {
235
- const d = _("FmTextField"), T = _("FmButton");
236
- return h(), D("div", wt, [
237
- r(d, {
238
- modelValue: e(o),
239
- "onUpdate:modelValue": f[0] || (f[0] = (l) => se(o) ? o.value = l : null),
240
- label: e(S)("connect.store.category.label"),
241
- rules: [e(Q).toRule(e(c))]
242
- }, null, 8, ["modelValue", "label", "rules"]),
243
- V("div", Pt, [
244
- V("div", null, [
245
- x.action == "edit" ? (h(), M(T, {
246
- key: 0,
247
- onClick: t,
248
- label: e(S)("connect.common.delete"),
249
- variant: "destructive"
250
- }, null, 8, ["label"])) : E("", !0)
251
- ]),
252
- V("div", Tt, [
253
- r(T, {
254
- label: e(S)("connect.common.cancel"),
255
- variant: "tertiary",
256
- onClick: f[1] || (f[1] = (l) => e(g).close())
257
- }, null, 8, ["label"]),
258
- r(T, {
259
- label: x.action == "edit" ? e(S)("connect.common.edit") : e(S)("connect.common.add"),
260
- disabled: !e(o),
261
- onClick: i
262
- }, null, 8, ["label", "disabled"])
263
- ])
264
- ])
265
- ]);
266
- };
267
- }
268
- }), $t = { class: "space-y-16" }, Rt = { class: "flex items-center justify-end gap-8 pb-16" }, Ut = /* @__PURE__ */ te({
269
- __name: "SelectCategoryDialog",
270
- setup(x) {
271
- const { emitData: S, emitAction: a } = je(), g = Te(), s = I(), v = L(
272
- () => g.sortedStoreCategories.map((o, c) => ({
273
- label: o.name,
274
- value: c
275
- }))
276
- );
277
- return (o, c) => {
278
- const i = _("FmSelect"), t = _("FmButton");
279
- return h(), D("div", $t, [
280
- c[4] || (c[4] = V("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(i, {
282
- placeholder: "Select a category",
283
- items: e(v),
284
- modelValue: e(s),
285
- "onUpdate:modelValue": [
286
- c[0] || (c[0] = (u) => se(s) ? s.value = u : null),
287
- c[1] || (c[1] = (u) => e(S)(u))
288
- ],
289
- label: "Category"
290
- }, null, 8, ["items", "modelValue"]),
291
- V("div", Rt, [
292
- r(t, {
293
- variant: "tertiary",
294
- label: "Cancel",
295
- onClick: c[2] || (c[2] = (u) => e(a)("tertiary"))
296
- }),
297
- r(t, {
298
- label: "Select",
299
- onClick: c[3] || (c[3] = (u) => e(a)("primary")),
300
- disabled: e(s) == null
301
- }, null, 8, ["disabled"])
302
- ])
303
- ]);
304
- };
305
- }
306
- });
307
- function _e(x) {
308
- return x.states.map((S) => ({ label: S, value: S }));
309
- }
310
- const Bt = {
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 _e(this);
332
- }
333
- },
334
- [Ce.F_COUNTRY.enum.SG]: {
335
- states: [],
336
- get stateItems() {
337
- return _e(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 _e(this);
378
- }
379
- },
380
- [Ce.F_COUNTRY.enum.TH]: {
381
- states: [
382
- "Bangkok",
383
- "Amnat Charoen",
384
- "Ang Thong",
385
- "Bueng Kan",
386
- "Buri Ram",
387
- "Chachoengsao",
388
- "Chai Nat",
389
- "Chaiyaphum",
390
- "Chanthaburi",
391
- "Chiang Mai",
392
- "Chiang Rai",
393
- "Chonburi",
394
- "Chumphon",
395
- "Kalasin",
396
- "Kamphaeng Phet",
397
- "Kanchanaburi",
398
- "Khon Kaen",
399
- "Krabi",
400
- "Lampang",
401
- "Lamphun",
402
- "Loei",
403
- "Lopburi",
404
- "Mae Hong Son",
405
- "Maha Sarakham",
406
- "Mukdahan",
407
- "Nakhon Nayok",
408
- "Nakhon Pathom",
409
- "Nakhon Phanom",
410
- "Nakhon Ratchasima",
411
- "Nakhon Sawan",
412
- "Nakhon Si Thammarat",
413
- "Nan",
414
- "Narathiwat",
415
- "Nong Bua Lamphu",
416
- "Nong Khai",
417
- "Nonthaburi",
418
- "Pathum Thani",
419
- "Pattani",
420
- "Phang Nga",
421
- "Phatthalung",
422
- "Phayao",
423
- "Phetchabun",
424
- "Phetchaburi",
425
- "Phichit",
426
- "Phitsanulok",
427
- "Phra Nakhon Si Ayutthaya",
428
- "Phrae",
429
- "Phuket",
430
- "Prachinburi",
431
- "Prachuap Khiri Khan",
432
- "Ranong",
433
- "Ratchaburi",
434
- "Rayong",
435
- "Roi Et",
436
- "Sa Kaeo",
437
- "Sakon Nakhon",
438
- "Samut Prakan",
439
- "Samut Sakhon",
440
- "Samut Songkhram",
441
- "Saraburi",
442
- "Satun",
443
- "Sing Buri",
444
- "Sisaket",
445
- "Songkhla",
446
- "Sukhothai",
447
- "Suphan Buri",
448
- "Surat Thani",
449
- "Surin",
450
- "Tak",
451
- "Trang",
452
- "Trat",
453
- "Ubon Ratchathani",
454
- "Udon Thani",
455
- "Uthai Thani",
456
- "Uttaradit",
457
- "Yala",
458
- "Yasothon"
459
- ],
460
- get stateItems() {
461
- return _e(this);
462
- }
463
- }
464
- }, fe = () => A.Config.getCountry(), ge = {
465
- get fullCurrency() {
466
- return fe().currency;
467
- },
468
- get currency() {
469
- return fe().currency.code;
470
- },
471
- get fullTax() {
472
- return A.Country.getCountryFlattenTaxes(fe().code);
473
- },
474
- get taxSystem() {
475
- return fe().taxSystems;
476
- },
477
- taxInclusion(x) {
478
- return ge.taxSystem.map((S) => ({
479
- systemCode: S.code,
480
- inclusive: x !== void 0 ? x : !1
481
- }));
482
- },
483
- groupedTaxOptions() {
484
- const x = A.Country.getCountryFlattenTaxes(fe().code);
485
- return ge.taxSystem.map((S) => ({
486
- code: S.code,
487
- options: x.map((a) => ({ ...a, feedmeTaxCode: ge.generateCode(a) })).filter((a) => a.systemCode === S.code)
488
- }));
489
- },
490
- systemDefaultCode(x) {
491
- const S = ge.groupedTaxOptions().find((a) => a.code === x);
492
- return S == null ? void 0 : S.options.find((a) => a.default);
493
- },
494
- generateCode(x) {
495
- return `${x.systemCode}/${x.taxCode}`;
496
- }
497
- }, W = ge, Nt = /* @__PURE__ */ te({
498
- __name: "TaxInclusiveSetting",
499
- props: {
500
- modelValue: {
501
- type: Array,
502
- required: !0,
503
- default: () => []
504
- }
505
- },
506
- emits: ["update:model-value"],
507
- setup(x, { emit: S }) {
508
- const a = x, g = W.taxSystem, s = S, v = I(a.modelValue);
509
- function o(u, f) {
510
- const d = ae.clone(a.modelValue), T = d.findIndex((l) => l.systemCode === u);
511
- T >= 0 ? d[T].inclusive = f : d.push({
512
- systemCode: u,
513
- inclusive: f
514
- }), v.value = d, s("update:model-value", d);
515
- }
516
- function c() {
517
- return g.map((u) => {
518
- const f = a.modelValue ? a.modelValue.find((d) => d.systemCode === u.code) : !1;
519
- return {
520
- label: u.name,
521
- config: {
522
- value: f ? f.inclusive : !1
523
- },
524
- input: (d) => {
525
- o(u.code, d);
526
- }
527
- };
528
- });
529
- }
530
- const i = Ye(c());
531
- function t(u, f) {
532
- return `${u} ${f ? "Inclusive" : "Exclusive"}`;
533
- }
534
- return ve(() => {
535
- a.modelValue.length || o(g[0].code, !1);
536
- }), Pe(
537
- () => a.modelValue,
538
- (u, f) => {
539
- u != f && !u.length && o(g[0].code, !1);
540
- }
541
- ), (u, f) => {
542
- const d = _("FmSwitch");
543
- return h(!0), D(Y, null, ue(e(i), (T, l) => {
544
- var w;
545
- return h(), D("div", { key: l }, [
546
- r(d, {
547
- "model-value": ((w = e(v)[l]) == null ? void 0 : w.inclusive) || !1,
548
- "label-placement": "left",
549
- "onUpdate:modelValue": ($) => T.input($)
550
- }, {
551
- label: N(() => {
552
- var $;
553
- return [
554
- V("div", null, K(t(T.label, (($ = e(v)[l]) == null ? void 0 : $.inclusive) || !1)), 1)
555
- ];
556
- }),
557
- _: 2
558
- }, 1032, ["model-value", "onUpdate:modelValue"])
559
- ]);
560
- }), 128);
561
- };
562
- }
563
- });
564
- var It = { mode: "development", appMode: "mf" };
565
- const Dt = { class: "space-y-8" }, Mt = {
566
- key: 0,
567
- class: "space-y-16"
568
- }, Ot = /* @__PURE__ */ te({
569
- __name: "StripeSetting",
570
- props: {
571
- modelValue: {}
572
- },
573
- emits: ["update:modelValue"],
574
- setup(x, { emit: S }) {
575
- const a = x, g = S, s = I(!1);
576
- Pe(s, (o, c) => {
577
- c != o && (!a.modelValue && o ? g("update:modelValue", {
578
- apiKey: "",
579
- webhookSecret: ""
580
- }) : o || g("update:modelValue", void 0));
581
- });
582
- const v = L(() => {
583
- const o = It.mode === "development", c = A.Config.getCountry().code.toLowerCase(), i = c != "my" ? `.${c}` : "";
584
- return `https://marketing${o ? "-dev" : ""}${i}.feedmeapi.com/stripe/${Ze.getBusinessId()}/webhook`;
585
- });
586
- return ve(() => {
587
- s.value = !!a.modelValue;
588
- }), (o, c) => {
589
- const i = _("FmSwitch"), t = _("FmTextField"), u = _("FmButton");
590
- return h(), D("div", Dt, [
591
- r(i, {
592
- modelValue: e(s),
593
- "onUpdate:modelValue": c[0] || (c[0] = (f) => se(s) ? s.value = f : null),
594
- value: "true",
595
- label: "Enable Stripe"
596
- }, null, 8, ["modelValue"]),
597
- a.modelValue ? (h(), D("div", Mt, [
598
- r(t, {
599
- label: "API Key",
600
- modelValue: a.modelValue.apiKey,
601
- "onUpdate:modelValue": c[1] || (c[1] = (f) => a.modelValue.apiKey = f),
602
- "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
603
- }, null, 8, ["modelValue"]),
604
- r(t, {
605
- label: "Webhook URL",
606
- "model-value": e(v),
607
- readonly: "",
608
- "helper-text": "Copy this URL to your Stripe dashboard"
609
- }, {
610
- append: N(() => [
611
- r(u, {
612
- icon: "content_copy",
613
- variant: "tertiary",
614
- onClick: c[2] || (c[2] = (f) => e(lt)(e(v)))
615
- })
616
- ]),
617
- _: 1
618
- }, 8, ["model-value"]),
619
- r(t, {
620
- modelValue: a.modelValue.webhookSecret,
621
- "onUpdate:modelValue": c[3] || (c[3] = (f) => a.modelValue.webhookSecret = f),
622
- label: "Webhook Secret",
623
- "helper-text": `Copy the webhook signing secret from your Stripe account and paste
624
- here.`
625
- }, null, 8, ["modelValue"])
626
- ])) : E("", !0)
627
- ]);
628
- };
629
- }
630
- }), At = {
631
- key: 0,
632
- class: "space-y-16 pr-12"
633
- }, Et = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, jt = {
634
- key: 1,
635
- class: "space-y-16"
636
- }, Lt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Kt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Ht = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, qt = { class: "space-y-4" }, Wt = { class: "fm-typo-en-body-lg-400" }, Yt = { class: "space-y-16" }, zt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Jt = { class: "flex items-center gap-8" }, Gt = /* @__PURE__ */ te({
637
- __name: "StoreSettingSheet",
638
- emits: ["update"],
639
- setup(x, { expose: S, emit: a }) {
640
- const { t: g } = he(), s = a, v = I(!1), o = I(), c = I(!1), i = Qe.extend({
641
- company: et.extend({
642
- name: ee.string().min(1, "Company name is required"),
643
- regNo: ee.string().min(1, "Registration number is required"),
644
- address: tt.extend({
645
- line1: ee.string().min(1, "Line 1 is required"),
646
- line2: ee.string().optional(),
647
- state: ee.string().min(1, "State is required"),
648
- city: ee.string().min(1, "City is required"),
649
- postcode: ee.string().min(1, "Postcode is required"),
650
- country: ee.string().min(1, "Country is required")
651
- }),
652
- phoneNo: ee.string().min(1, "Phone number is required"),
653
- sstRegNo: ee.string().optional()
654
- })
655
- }), t = L(() => i.safeParse(o.value).success);
656
- function u() {
657
- const T = i.safeParse(o.value);
658
- T.success && s("update", T.data);
659
- }
660
- function f() {
661
- return {
662
- company: {
663
- name: "",
664
- address: {
665
- line1: "",
666
- line2: "",
667
- city: "",
668
- postcode: "",
669
- state: "",
670
- country: A.Config.getCountry().name
671
- },
672
- phoneNo: "",
673
- regNo: "",
674
- sstRegNo: ""
675
- },
676
- inclusiveTaxes: []
677
- };
678
- }
679
- function d(T, l) {
680
- v.value = T, T && (o.value = l != null && l.company ? ae.cloneDeep(l) : f());
681
- }
682
- return S({
683
- showSheet: d,
684
- data: o
685
- }), (T, l) => {
686
- const w = _("FmIcon"), $ = _("FmMenuItem"), j = _("FmMenu"), ne = _("FmSelect"), Z = _("FmButton"), H = _("FmSideSheet");
687
- return h(), M(H, {
688
- "max-width": 560,
689
- modelValue: e(v),
690
- "onUpdate:modelValue": l[15] || (l[15] = (z) => se(v) ? v.value = z : null),
691
- header: e(g)("connect.store.setting.title")
692
- }, {
693
- "side-sheet-footer": N(() => [
694
- V("div", Jt, [
695
- r(Z, {
696
- label: e(g)("connect.common.save"),
697
- onClick: u,
698
- disabled: !e(t) || e(Se)().isLoading,
699
- loading: e(Se)().isLoading
700
- }, null, 8, ["label", "disabled", "loading"]),
701
- r(Z, {
702
- label: e(g)("connect.common.cancel"),
703
- onClick: l[14] || (l[14] = (z) => d(!1)),
704
- variant: "tertiary"
705
- }, null, 8, ["label"])
706
- ])
707
- ]),
708
- default: N(() => {
709
- var z, oe;
710
- return [
711
- r(ke, { json: e(o) }, null, 8, ["json"]),
712
- e(o) && e(o).company ? (h(), D("div", At, [
713
- V("div", Et, K(e(g)("connect.store.setting.company.legal_info")), 1),
714
- r(le, {
715
- modelValue: e(o).company.name,
716
- "onUpdate:modelValue": l[0] || (l[0] = (F) => e(o).company.name = F),
717
- label: e(g)("connect.store.setting.company.name"),
718
- schema: e(Q).typeAtPath(e(i), "company.name")
719
- }, null, 8, ["modelValue", "label", "schema"]),
720
- r(le, {
721
- modelValue: e(o).company.regNo,
722
- "onUpdate:modelValue": l[1] || (l[1] = (F) => e(o).company.regNo = F),
723
- label: e(g)("connect.store.setting.company.reg_no"),
724
- schema: e(Q).typeAtPath(e(i), "company.regNo")
725
- }, null, 8, ["modelValue", "label", "schema"]),
726
- e(A.Config).getCountry().taxSystems.length ? (h(), M(le, {
727
- key: 0,
728
- modelValue: e(o).company.sstRegNo,
729
- "onUpdate:modelValue": [
730
- l[2] || (l[2] = (F) => e(o).company.sstRegNo = F),
731
- l[3] || (l[3] = (F) => F ? null : e(o).inclusiveTaxes = [])
732
- ],
733
- label: e(g)("connect.store.setting.company.tax_reg_no"),
734
- schema: e(Q).typeAtPath(e(i), "company.sstRegNo")
735
- }, null, 8, ["modelValue", "label", "schema"])) : E("", !0),
736
- (z = e(o).company) != null && z.sstRegNo && e(o).inclusiveTaxes ? (h(), D("div", jt, [
737
- V("div", Lt, K(e(g)("connect.store.setting.company.tax")), 1),
738
- r(Nt, {
739
- modelValue: e(o).inclusiveTaxes,
740
- "onUpdate:modelValue": l[4] || (l[4] = (F) => e(o).inclusiveTaxes = F)
741
- }, null, 8, ["modelValue"])
742
- ])) : E("", !0),
743
- r(le, {
744
- modelValue: e(o).company.phoneNo,
745
- "onUpdate:modelValue": l[5] || (l[5] = (F) => e(o).company.phoneNo = F),
746
- label: e(g)("connect.store.setting.company.phone"),
747
- schema: e(Q).typeAtPath(e(i), "company.phoneNo")
748
- }, null, 8, ["modelValue", "label", "schema"]),
749
- V("div", Kt, K(e(g)("connect.store.setting.company.address.title")), 1),
750
- r(le, {
751
- modelValue: e(o).company.address.line1,
752
- "onUpdate:modelValue": l[6] || (l[6] = (F) => e(o).company.address.line1 = F),
753
- label: e(g)("connect.store.setting.company.address.line1"),
754
- schema: e(Q).typeAtPath(e(i), "company.address.line1")
755
- }, null, 8, ["modelValue", "label", "schema"]),
756
- r(le, {
757
- modelValue: e(o).company.address.line2,
758
- "onUpdate:modelValue": l[7] || (l[7] = (F) => e(o).company.address.line2 = F),
759
- label: e(g)("connect.store.setting.company.address.line2"),
760
- schema: e(Q).typeAtPath(e(i), "company.address.line2")
761
- }, null, 8, ["modelValue", "label", "schema"]),
762
- V("div", Ht, [
763
- r(le, {
764
- modelValue: e(o).company.address.city,
765
- "onUpdate:modelValue": l[8] || (l[8] = (F) => e(o).company.address.city = F),
766
- label: e(g)("connect.store.setting.company.address.city"),
767
- schema: e(Q).typeAtPath(e(i), "company.address.city")
768
- }, null, 8, ["modelValue", "label", "schema"]),
769
- r(le, {
770
- modelValue: e(o).company.address.postcode,
771
- "onUpdate:modelValue": l[9] || (l[9] = (F) => e(o).company.address.postcode = F),
772
- label: e(g)("connect.store.setting.company.address.postcode"),
773
- schema: e(Q).typeAtPath(e(i), "company.address.postcode")
774
- }, null, 8, ["modelValue", "label", "schema"]),
775
- V("div", qt, [
776
- V("div", Wt, K(e(g)("connect.store.setting.company.address.state")), 1),
777
- r(j, {
778
- placement: "top-end",
779
- "model-value": e(c)
780
- }, {
781
- "menu-button": N(() => [
782
- r(le, {
783
- modelValue: e(o).company.address.state,
784
- "onUpdate:modelValue": l[10] || (l[10] = (F) => e(o).company.address.state = F),
785
- schema: e(Q).typeAtPath(e(i), "company.address.state"),
786
- onFocusChanged: l[11] || (l[11] = (F) => c.value = F)
787
- }, {
788
- append: N(() => [
789
- r(w, {
790
- name: e(c) ? "keyboard_arrow_up" : "keyboard_arrow_down"
791
- }, null, 8, ["name"])
792
- ]),
793
- _: 1
794
- }, 8, ["modelValue", "schema"])
795
- ]),
796
- default: N(() => [
797
- (h(!0), D(Y, null, ue(e(Bt)[e(A.Config).getCountry().code].stateItems.filter(
798
- (F) => {
799
- var re, b;
800
- return F.label.toLowerCase().includes(((b = (re = e(o)) == null ? void 0 : re.company) == null ? void 0 : b.address.state.toLowerCase()) ?? "");
801
- }
802
- ) || [], (F) => (h(), M($, {
803
- key: F.value,
804
- "model-value": e(o).company.address.state === F.value,
805
- label: F.label,
806
- onClick: () => {
807
- e(o).company.address.state = F.value, c.value = !1;
808
- }
809
- }, null, 8, ["model-value", "label", "onClick"]))), 128))
810
- ]),
811
- _: 1
812
- }, 8, ["model-value"])
813
- ]),
814
- r(ne, {
815
- label: e(g)("connect.store.setting.company.address.country"),
816
- modelValue: e(o).company.address.country,
817
- "onUpdate:modelValue": l[12] || (l[12] = (F) => e(o).company.address.country = F),
818
- items: [
819
- {
820
- label: e(A.Config).getCountry().name,
821
- value: e(A.Config).getCountry().name
822
- }
823
- ],
824
- rules: [e(Q).ruleAtPath(e(i), "company.address.country")]
825
- }, null, 8, ["label", "modelValue", "items", "rules"])
826
- ]),
827
- V("div", Yt, [
828
- V("div", zt, K(e(g)("connect.store.setting.stripe.title")), 1),
829
- r(Ot, {
830
- "model-value": (oe = e(o)) == null ? void 0 : oe.stripe,
831
- "onUpdate:modelValue": l[13] || (l[13] = (F) => e(o).stripe = F)
832
- }, null, 8, ["model-value"])
833
- ])
834
- ])) : E("", !0)
835
- ];
836
- }),
837
- _: 1
838
- }, 8, ["modelValue", "header"]);
839
- };
840
- }
841
- });
842
- function Xt(x, S = !0) {
843
- return A.DineroFactory(x).toFormat(S);
844
- }
845
- const Zt = /* @__PURE__ */ te({
846
- __name: "TaxVariantSetting",
847
- props: {
848
- modelValue: {
849
- type: Array,
850
- required: !0,
851
- default: () => []
852
- }
853
- },
854
- emits: ["update:modelValue"],
855
- setup(x, { emit: S }) {
856
- const a = x, g = S;
857
- ve(() => {
858
- if (o.value.length !== v.value.length) {
859
- const t = v.value.reduce((u, f) => {
860
- const d = W.systemDefaultCode(f.name);
861
- if (!d) return u;
862
- const { systemCode: T, taxCode: l } = d;
863
- return f.value || u.push({ systemCode: T, taxCode: l }), u;
864
- }, []);
865
- i(t);
866
- }
867
- });
868
- function s() {
869
- return W.groupedTaxOptions();
870
- }
871
- const v = L(() => s().map((t) => ({
872
- name: t.code,
873
- value: (o.value || []).find(
874
- (u) => t.options.some((f) => f.feedmeTaxCode === u)
875
- ),
876
- options: t.options.map((u) => ({
877
- label: `${u.name} (${mt(u.rate)}%)`,
878
- value: u.feedmeTaxCode
879
- }))
880
- }))), o = L(() => a.modelValue.map((t) => W.generateCode(t)));
881
- function c(t) {
882
- const u = s().find(
883
- (l) => l.options.some((w) => w.feedmeTaxCode === t)
884
- ), f = u == null ? void 0 : u.options.find((l) => l.feedmeTaxCode === t);
885
- if (!f) return;
886
- const { systemCode: d, taxCode: T } = f;
887
- i([{ systemCode: d, taxCode: T }]);
888
- }
889
- function i(t) {
890
- const u = ae.clone(a.modelValue);
891
- t.forEach((f) => {
892
- const d = s().find(
893
- (w) => w.options.some(($) => $.feedmeTaxCode === W.generateCode(f))
894
- ), T = (d == null ? void 0 : d.options) || [], l = u.findIndex(
895
- (w) => T.some(($) => W.generateCode($) === W.generateCode(w))
896
- );
897
- l >= 0 ? u.splice(l, 1, f) : u.push(f);
898
- }), g("update:modelValue", u);
899
- }
900
- return (t, u) => {
901
- const f = _("FmRadio"), d = _("FmRadioGroup");
902
- return h(!0), D(Y, null, ue(e(v), (T) => (h(), D("div", {
903
- key: T.name,
904
- class: "flex items-start"
905
- }, [
906
- r(d, {
907
- modelValue: T.value,
908
- "onUpdate:modelValue": [
909
- (l) => T.value = l,
910
- u[0] || (u[0] = (l) => {
911
- c(l);
912
- })
913
- ]
914
- }, {
915
- default: N(() => [
916
- (h(!0), D(Y, null, ue(T.options, (l, w) => (h(), M(f, {
917
- key: w,
918
- value: l.value,
919
- label: l.label
920
- }, null, 8, ["value", "label"]))), 128))
921
- ]),
922
- _: 2
923
- }, 1032, ["modelValue", "onUpdate:modelValue"])
924
- ]))), 128);
925
- };
926
- }
927
- }), we = {
928
- get _id() {
929
- return (/* @__PURE__ */ new Date()).toISOString();
930
- },
931
- name: "",
932
- price: A.Dinero.zero().toObject(),
933
- originalPrice: A.Dinero.zero().toObject(),
934
- vouchers: [],
935
- credit: {
936
- normal: 0,
937
- free: {
938
- amount: 0,
939
- day: 0
940
- }
941
- },
942
- config: {
943
- options: {}
944
- },
945
- titles: [],
946
- taxes: [],
947
- taxTotals: [],
948
- internal: !1,
949
- priceWithTaxes: ut()
950
- }, Qt = {
951
- key: 0,
952
- class: "space-y-24 pr-12"
953
- }, en = { class: "space-y-8" }, tn = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, nn = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, on = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, an = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, ln = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, sn = { class: "space-y-8" }, rn = { class: "flex items-center justify-between" }, dn = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, un = { class: "space-y-8" }, cn = { class: "flex items-center gap-8" }, mn = /* @__PURE__ */ te({
954
- __name: "EditBundleSheet",
955
- emits: ["update"],
956
- setup(x, { expose: S, emit: a }) {
957
- const g = a, { t: s } = he(), v = Te(), o = I(!1), c = I([]), i = I({
958
- category: 0,
959
- index: -1,
960
- originalCategoryIndex: void 0
961
- }), t = I(ae.cloneDeep(we)), u = I(), f = Ae, d = L(() => {
962
- const m = f.safeParse(t.value);
963
- return m.success ? [] : m.error.errors;
964
- }), T = [
965
- {
966
- header: "Reward title",
967
- accessorFn: (m) => m.collectible.name,
968
- enableSorting: !0
969
- },
970
- {
971
- id: "type",
972
- header: "Reward type",
973
- accessorFn: (m) => m.collectible.type,
974
- cell(m) {
975
- return pe[m.row.original.collectible.type].chip();
976
- }
977
- },
978
- {
979
- header: "Description",
980
- accessorFn: (m) => m.description,
981
- cell(m) {
982
- var p;
983
- const n = m.row.original;
984
- return n.collectible.type == "VOUCHER" || n.selectedReward == null ? n.description : Je(Xe.FmStepperField, {
985
- "onUpdate:modelValue": (y) => {
986
- t.value.titles = t.value.titles.map(
987
- (U) => U.id == n.collectible._id ? { ...U, dayToExpire: y } : U
988
- );
989
- },
990
- modelValue: ((p = n.selectedReward) == null ? void 0 : p.extra) ?? 0,
991
- appendText: "day(s)",
992
- helperState: G(d.value, "titles"),
993
- helperText: X(d.value, "titles"),
994
- max: 9999,
995
- rules: [(y) => y <= 9999 || "Maximum 9999 days allowed"],
996
- showSteppers: !1,
997
- disabled: !!t.value.stripePriceId
998
- });
999
- }
1000
- }
1001
- ], l = I([]), w = L(() => {
1002
- var n;
1003
- const m = (n = t.value) != null && n.isFeedvibe ? "STORE_BUNDLE:FEEDVIBE" : "STORE_BUNDLE:DEFAULT";
1004
- return v.bundleRewards.filter((p) => {
1005
- var y;
1006
- return (y = t.value) != null && y.isFeedvibe && p.type !== "VOUCHER" ? !1 : pt(p.capabilities, m);
1007
- }).map((p) => {
1008
- const y = $.value.find((O) => O.id == p._id), U = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${ft(
1009
- p.options.validityOption || {}
1010
- )}` : "No expiry";
1011
- return {
1012
- collectible: p,
1013
- description: U,
1014
- selectedReward: y
1015
- };
1016
- });
1017
- }), $ = L(() => {
1018
- var m, n;
1019
- return [
1020
- ...((m = t.value) == null ? void 0 : m.titles.map((p) => ({
1021
- id: p.id,
1022
- extra: p.dayToExpire
1023
- }))) ?? [],
1024
- ...((n = t.value) == null ? void 0 : n.vouchers.map((p) => ({
1025
- id: p,
1026
- extra: void 0
1027
- }))) ?? []
1028
- ];
1029
- }), j = L(
1030
- () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
1031
- );
1032
- function ne(m) {
1033
- t.value.subscriptionValidity = m;
1034
- for (const n of t.value.titles)
1035
- n.dayToExpire = m;
1036
- t.value.credit.free && (t.value.credit.free.day = m);
1037
- }
1038
- function Z() {
1039
- const m = w.value, n = t.value;
1040
- if (!(!n || !m))
1041
- for (let p = 0; p < m.length; p++) {
1042
- const y = m[p];
1043
- H.value[p] ? y.collectible.type == "TITLE" ? n.titles.findIndex(
1044
- (R) => R.id == y.collectible._id
1045
- ) < 0 && n.titles.push({
1046
- id: y.collectible._id,
1047
- dayToExpire: j.value
1048
- }) : n.vouchers.findIndex(
1049
- (R) => R == y.collectible._id
1050
- ) < 0 && n.vouchers.push(y.collectible._id) : (n.titles = n.titles.filter((O) => O.id != y.collectible._id), n.vouchers = n.vouchers.filter(
1051
- (O) => O != y.collectible._id
1052
- ));
1053
- }
1054
- }
1055
- const H = I({});
1056
- Pe(H, Z, { deep: !0 });
1057
- const z = L(() => {
1058
- var m, n;
1059
- return (n = (m = v.storeOption) == null ? void 0 : m.company) == null ? void 0 : n.sstRegNo;
1060
- }), oe = L(() => {
1061
- var m, n, p;
1062
- return (p = (n = (m = v.storeOption) == null ? void 0 : m.inclusiveTaxes) == null ? void 0 : n[0]) != null && p.inclusive ? "Inclusive" : "Exclusive";
1063
- }), F = L(() => {
1064
- var m, n, p;
1065
- return He(
1066
- W.fullTax,
1067
- ze(t.value.taxes),
1068
- t.value.price,
1069
- Number(t.value.credit.normal),
1070
- ((m = v.storeOption) == null ? void 0 : m.inclusiveTaxes) ?? [],
1071
- (p = (n = v.storeOption) == null ? void 0 : n.company) != null && p.sstRegNo ? W.taxSystem.map((y) => y.code) : []
1072
- );
1073
- }), re = L(() => F.value.reduce(
1074
- (n, p) => n.add(p.total),
1075
- ct()
1076
- ).toFormat()), b = L(() => {
1077
- var y;
1078
- const m = qe(
1079
- F.value,
1080
- t.value.price,
1081
- ((y = v.storeOption) == null ? void 0 : y.inclusiveTaxes) ?? []
1082
- );
1083
- t.value.priceWithTaxes = m;
1084
- const n = Xt(m, !1), p = Number(n.replace(/[^\d.-]/g, ""));
1085
- return Number.isNaN(p) ? 0 : p;
1086
- });
1087
- function k() {
1088
- t.value.taxTotals = F.value, g("update", Ae.parse(ot(t.value)));
1089
- }
1090
- function C() {
1091
- return ae.cloneDeep(we);
1092
- }
1093
- function B(m, n) {
1094
- o.value = m, m && n && (u.value = void 0, c.value = n.categories, t.value = n.bundle || C(), i.value.category = n.category, i.value.index = n.index, i.value.originalCategoryIndex = n.category, H.value = w.value.reduce((p, y, U) => (p[U] = !!y.selectedReward, p), {}));
1095
- }
1096
- return S({
1097
- showSheet: B,
1098
- bundleImage: u,
1099
- target: i,
1100
- data: t
1101
- }), (m, n) => {
1102
- const p = _("FmSwitch"), y = _("FmHelperText"), U = _("FmTextField"), O = _("FmSelect"), R = _("FmStepperField"), q = _("FmMenuItem"), J = _("FmTable"), me = _("FmButton"), xe = _("FmSideSheet");
1103
- return h(), M(xe, {
1104
- "max-width": 768,
1105
- modelValue: e(o),
1106
- "onUpdate:modelValue": n[21] || (n[21] = (ie) => se(o) ? o.value = ie : null),
1107
- header: e(i).index != -1 ? e(s)("connect.store.bundle.edit.title") : e(s)("connect.store.bundle.edit.create")
1108
- }, {
1109
- "side-sheet-footer": N(() => [
1110
- V("div", cn, [
1111
- r(me, {
1112
- label: e(i).index != -1 ? "Save" : "Add",
1113
- onClick: k,
1114
- disabled: e(d).length > 0,
1115
- loading: e(Se)().isLoading
1116
- }, null, 8, ["label", "disabled", "loading"]),
1117
- r(me, {
1118
- label: "Cancel",
1119
- onClick: n[20] || (n[20] = (ie) => B(!1)),
1120
- variant: "tertiary"
1121
- })
1122
- ])
1123
- ]),
1124
- default: N(() => {
1125
- var ie, $e, Re, Ue, Be, Ne, Ie, De, Me, Oe;
1126
- return [
1127
- r(ke, { json: e(t) }, null, 8, ["json"]),
1128
- e(t) ? (h(), D("div", Qt, [
1129
- V("div", en, [
1130
- e(A.Config).getCountry().code == "MY" && ((ie = e(v).payoutAccount) == null ? void 0 : ie.status) == "APPROVED" && (($e = e(v).payoutAccount) != null && $e.enable) ? (h(), M(p, {
1131
- key: 0,
1132
- "onUpdate:modelValue": n[0] || (n[0] = (P) => {
1133
- e(t).isFeedvibe = P, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], H.value = {}, e(t).hideInPos = !0, e(t).internal = !0);
1134
- }),
1135
- "label-placement": "right",
1136
- "model-value": e(t).isFeedvibe || !1,
1137
- label: "Feedvibe Campaign",
1138
- sublabel: "Bundle will be appear for Feedvibe campaign use"
1139
- }, null, 8, ["model-value"])) : E("", !0),
1140
- e(t).isFeedvibe ? (h(), M(y, {
1141
- key: 1,
1142
- text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app. FeedVibe bundles only show up in the FeedVibe app and cannot be sold in the POS and mini program. For more information, please contact support.",
1143
- state: "warning"
1144
- })) : E("", !0)
1145
- ]),
1146
- V("div", tn, K(e(s)("connect.store.bundle.edit.basicInformation")), 1),
1147
- r(U, {
1148
- label: e(s)("connect.store.bundle.edit.bundleName"),
1149
- modelValue: e(t).name,
1150
- "onUpdate:modelValue": n[1] || (n[1] = (P) => e(t).name = P),
1151
- "helper-state": e(G)(e(d), "name"),
1152
- "helper-text": e(X)(e(d), "name")
1153
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1154
- r(O, {
1155
- modelValue: e(i).category,
1156
- "onUpdate:modelValue": n[2] || (n[2] = (P) => e(i).category = P),
1157
- label: "Store Category",
1158
- items: e(c).map((P, We) => ({ label: P, value: We }))
1159
- }, null, 8, ["modelValue", "items"]),
1160
- r(it, {
1161
- label: e(s)("connect.store.bundle.edit.bundleImage"),
1162
- class: "w-1/2 xs:w-2/3",
1163
- "aspect-ratio": "16/9",
1164
- thumbnail: e(t).image ?? void 0,
1165
- file: e(u) ?? void 0,
1166
- "onUpdate:file": n[3] || (n[3] = (P) => {
1167
- u.value = P;
1168
- }),
1169
- "helper-state": e(G)(e(d), "image"),
1170
- "helper-text": e(X)(e(d), "image")
1171
- }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1172
- r(R, {
1173
- "model-value": e(A.Dinero).fromFdoDinero(e(t).price).toUnit(),
1174
- label: e(s)("connect.store.bundle.edit.bundlePrice"),
1175
- min: 0,
1176
- "max-fraction-digits": 2,
1177
- "onUpdate:modelValue": n[4] || (n[4] = (P) => {
1178
- e(t).price.amount = P * 10 ** e(t).price.precision;
1179
- }),
1180
- "is-currency": !0,
1181
- "show-steppers": !1,
1182
- "helper-text": e(X)(e(d), "price") || `${e(A.Dinero).fromNumber({ number: 1 }).toFormat(
1183
- !0
1184
- )} = ${e(A.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1185
- "helper-state": e(G)(e(d), "price")
1186
- }, {
1187
- prepend: N(() => [
1188
- ce(K(e(A.Dinero).defaultCurrency()), 1)
1189
- ]),
1190
- _: 1
1191
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1192
- r(R, {
1193
- "model-value": e(A.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1194
- label: e(s)("connect.store.bundle.edit.bundleValue"),
1195
- min: 0,
1196
- "max-fraction-digits": 2,
1197
- "onUpdate:modelValue": n[5] || (n[5] = (P) => {
1198
- e(t).originalPrice || (e(t).originalPrice = e(A.Dinero).zero().toObject()), e(t).originalPrice.amount = P * 10 ** e(t).originalPrice.precision;
1199
- }),
1200
- "is-currency": !0,
1201
- "show-steppers": !1,
1202
- "helper-text": e(X)(e(d), "originalPrice") || e(s)("connect.store.bundle.edit.originalPriceHelper"),
1203
- "helper-state": e(G)(e(d), "originalPrice")
1204
- }, {
1205
- prepend: N(() => [
1206
- ce(K(e(A.Dinero).defaultCurrency()), 1)
1207
- ]),
1208
- _: 1
1209
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1210
- e(t).isFeedvibe ? E("", !0) : (h(), M(R, {
1211
- key: 0,
1212
- "model-value": e(t).coinPrice ?? null,
1213
- label: e(s)("connect.store.bundle.edit.pointNeeded"),
1214
- min: 0,
1215
- "onUpdate:modelValue": n[6] || (n[6] = (P) => {
1216
- P > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = P;
1217
- }),
1218
- "show-steppers": !1,
1219
- "helper-state": e(G)(e(d), "coinPrice"),
1220
- "helper-text": e(X)(e(d), "coinPrice")
1221
- }, {
1222
- append: N(() => [...n[22] || (n[22] = [
1223
- ce(" point(s) ", -1)
1224
- ])]),
1225
- _: 1
1226
- }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1227
- (Re = e(v).storeOption) != null && Re.stripe && !e(t).isFeedvibe ? (h(), D(Y, { key: 1 }, [
1228
- V("div", nn, K(e(s)("connect.store.bundle.edit.subscriptionSettings")), 1),
1229
- r(U, {
1230
- label: e(s)("connect.store.bundle.edit.stripePriceId"),
1231
- modelValue: e(t).stripePriceId,
1232
- "onUpdate:modelValue": n[7] || (n[7] = (P) => e(t).stripePriceId = P),
1233
- "helper-state": e(G)(e(d), "stripePriceId"),
1234
- "helper-text": e(X)(e(d), "stripePriceId")
1235
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1236
- e(t).stripePriceId ? (h(), M(R, {
1237
- key: 0,
1238
- "model-value": e(t).subscriptionValidity ?? null,
1239
- min: 1,
1240
- "onUpdate:modelValue": ne,
1241
- label: e(s)("connect.store.bundle.edit.subscriptionValidity"),
1242
- "show-steppers": !1,
1243
- "helper-state": e(G)(e(d), "subscriptionValidity"),
1244
- "helper-text": e(X)(e(d), "subscriptionValidity")
1245
- }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : E("", !0)
1246
- ], 64)) : E("", !0),
1247
- e(t).isFeedvibe ? E("", !0) : (h(), D(Y, { key: 2 }, [
1248
- V("div", on, K(e(s)("connect.store.bundle.edit.credit")), 1),
1249
- r(R, {
1250
- modelValue: e(t).credit.normal,
1251
- "onUpdate:modelValue": n[8] || (n[8] = (P) => e(t).credit.normal = P),
1252
- label: e(s)("connect.store.bundle.edit.normalCredit"),
1253
- "show-steppers": !1,
1254
- "helper-state": e(G)(e(d), "credit.normal"),
1255
- "helper-text": e(X)(e(d), "credit.normal")
1256
- }, {
1257
- append: N(() => [...n[23] || (n[23] = [
1258
- ce(" credit ", -1)
1259
- ])]),
1260
- _: 1
1261
- }, 8, ["modelValue", "label", "helper-state", "helper-text"]),
1262
- r(R, {
1263
- "model-value": ((Ue = e(t).credit.free) == null ? void 0 : Ue.amount) ?? null,
1264
- min: 0,
1265
- "onUpdate:modelValue": n[9] || (n[9] = (P) => {
1266
- e(t).credit.free || (e(t).credit.free = {
1267
- amount: 0,
1268
- day: 1
1269
- }), e(t).credit.free.amount = P;
1270
- }),
1271
- label: e(s)("connect.store.bundle.edit.freeCredit"),
1272
- "show-steppers": !1,
1273
- "helper-state": e(G)(e(d), "credit.free.amount"),
1274
- "helper-text": e(X)(e(d), "credit.free.amount")
1275
- }, {
1276
- append: N(() => [...n[24] || (n[24] = [
1277
- ce(" credit ", -1)
1278
- ])]),
1279
- _: 1
1280
- }, 8, ["model-value", "label", "helper-state", "helper-text"]),
1281
- (Be = e(t).credit.free) != null && Be.amount ? (h(), M(R, {
1282
- key: 0,
1283
- disabled: !!e(t).stripePriceId,
1284
- "model-value": ((Ne = e(t).credit.free) == null ? void 0 : Ne.day) ?? null,
1285
- min: 0,
1286
- "onUpdate:modelValue": n[10] || (n[10] = (P) => {
1287
- e(t).credit.free || (e(t).credit.free = {
1288
- amount: 0,
1289
- day: 1
1290
- }), e(t).credit.free.day = e(j) || P;
1291
- }),
1292
- label: "Free credit valid for",
1293
- "show-steppers": !1,
1294
- "helper-state": e(G)(e(d), "credit.free.day"),
1295
- "helper-text": e(X)(e(d), "credit.free.day")
1296
- }, {
1297
- append: N(() => [...n[25] || (n[25] = [
1298
- ce(" day(s) ", -1)
1299
- ])]),
1300
- _: 1
1301
- }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : E("", !0)
1302
- ], 64)),
1303
- e(z) ? (h(), D(Y, { key: 3 }, [
1304
- n[26] || (n[26] = V("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1305
- r(Zt, {
1306
- modelValue: e(t).taxes,
1307
- "onUpdate:modelValue": n[11] || (n[11] = (P) => e(t).taxes = P)
1308
- }, null, 8, ["modelValue"]),
1309
- r(U, {
1310
- label: `Tax Charged (${e(oe)})`,
1311
- "model-value": e(re),
1312
- disabled: ""
1313
- }, null, 8, ["label", "model-value"])
1314
- ], 64)) : E("", !0),
1315
- r(R, {
1316
- label: "Total Price",
1317
- "model-value": e(b),
1318
- disabled: !0
1319
- }, null, 8, ["model-value"]),
1320
- V("div", an, K(e(s)("connect.store.bundle.edit.bundleReward.title")), 1),
1321
- V("div", ln, K(e(s)("connect.store.bundle.edit.bundleReward.description")), 1),
1322
- V("div", sn, [
1323
- V("div", rn, [
1324
- r(dt, {
1325
- label: `Reward type: ${e(l).length == 0 ? "All" : e(l)[0].name}`
1326
- }, {
1327
- default: N(() => [
1328
- r(q, {
1329
- onClick: n[12] || (n[12] = (P) => l.value = []),
1330
- label: "All"
1331
- }),
1332
- r(q, {
1333
- onClick: n[13] || (n[13] = (P) => l.value = [
1334
- {
1335
- id: "type",
1336
- value: "VOUCHER",
1337
- name: e(pe).VOUCHER.name
1338
- }
1339
- ]),
1340
- label: e(pe).VOUCHER.name
1341
- }, null, 8, ["label"]),
1342
- r(q, {
1343
- onClick: n[14] || (n[14] = (P) => l.value = [
1344
- {
1345
- id: "type",
1346
- value: "TITLE",
1347
- name: e(pe).TITLE.name
1348
- }
1349
- ]),
1350
- label: e(pe).TITLE.name
1351
- }, null, 8, ["label"])
1352
- ]),
1353
- _: 1
1354
- }, 8, ["label"])
1355
- ]),
1356
- r(J, {
1357
- modelValue: e(H),
1358
- "onUpdate:modelValue": n[15] || (n[15] = (P) => se(H) ? H.value = P : null),
1359
- selection: "multiple",
1360
- "column-filter": e(l),
1361
- "column-defs": T,
1362
- "row-data": e(w),
1363
- "hide-footer": e(w).length <= 10
1364
- }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1365
- r(y, {
1366
- text: e(X)(e(d), "titles"),
1367
- state: e(G)(e(d), "titles")
1368
- }, null, 8, ["text", "state"])
1369
- ]),
1370
- V("div", dn, K(e(s)("connect.store.bundle.edit.advanceSetting")), 1),
1371
- V("div", un, [
1372
- e(t).isFeedvibe ? E("", !0) : (h(), D(Y, { key: 0 }, [
1373
- r(p, {
1374
- "model-value": e(t).internal ?? !1,
1375
- "onUpdate:modelValue": n[16] || (n[16] = (P) => e(t).internal = P),
1376
- "label-placement": "right",
1377
- label: e(s)("connect.store.bundle.edit.internalBundle"),
1378
- sublabel: e(s)("connect.store.bundle.edit.internalBundleDescription")
1379
- }, null, 8, ["model-value", "label", "sublabel"]),
1380
- r(p, {
1381
- "model-value": e(t).hideInPos ?? !1,
1382
- "onUpdate:modelValue": n[17] || (n[17] = (P) => e(t).hideInPos = P),
1383
- "label-placement": "right",
1384
- label: e(s)("connect.store.bundle.edit.hideInPos"),
1385
- sublabel: e(s)("connect.store.bundle.edit.hideInPosDescription")
1386
- }, null, 8, ["model-value", "label", "sublabel"])
1387
- ], 64)),
1388
- r(R, {
1389
- "model-value": ((De = (Ie = e(t).config) == null ? void 0 : Ie.options) == null ? void 0 : De.maxPerUser) || null,
1390
- "onUpdate:modelValue": n[18] || (n[18] = (P) => e(ae).set(e(t), "config.options.maxPerUser", P)),
1391
- label: e(s)("connect.store.bundle.edit.maxPerUser"),
1392
- "show-steppers": !1,
1393
- placeholder: e(s)("connect.store.bundle.edit.unlimited")
1394
- }, null, 8, ["model-value", "label", "placeholder"]),
1395
- r(R, {
1396
- "model-value": ((Oe = (Me = e(t).config) == null ? void 0 : Me.options) == null ? void 0 : Oe.maxReceive) || null,
1397
- "onUpdate:modelValue": n[19] || (n[19] = (P) => e(ae).set(e(t), "config.options.maxReceive", P)),
1398
- label: e(s)("connect.store.bundle.edit.maxReceive"),
1399
- "show-steppers": !1,
1400
- placeholder: e(s)("connect.store.bundle.edit.unlimited")
1401
- }, null, 8, ["model-value", "label", "placeholder"])
1402
- ])
1403
- ])) : E("", !0)
1404
- ];
1405
- }),
1406
- _: 1
1407
- }, 8, ["modelValue", "header"]);
1408
- };
1409
- }
1410
- }), pn = { class: "flex gap-8 items-center flex-wrap" }, fn = { class: "flex items-center gap-8" }, yn = /* @__PURE__ */ te({
1411
- __name: "SendBundleSheet",
1412
- emits: ["success"],
1413
- setup(x, { expose: S, emit: a }) {
1414
- const { minor: g } = Le, s = I(), v = I(""), o = I(""), c = I([]), i = I(!1), t = I();
1415
- I(!0);
1416
- function u(w) {
1417
- i.value = !0, v.value = null, o.value = "", s.value = w.bundle;
1418
- }
1419
- function f() {
1420
- i.value = !1;
1421
- }
1422
- async function d(w) {
1423
- const $ = await yt.read({
1424
- limit: 25,
1425
- skip: 0,
1426
- sortBy: "_id",
1427
- search: w,
1428
- descending: !1
1429
- });
1430
- c.value = $.resources.map((j) => ({
1431
- label: `${j.name} (${j.phoneNumber})`,
1432
- value: j._id
1433
- })), await new Promise((j) => setTimeout(j, 100));
1434
- }
1435
- async function T() {
1436
- if (!s.value || !v.value) return;
1437
- const w = c.value.find(
1438
- (j) => j.value === v.value
1439
- );
1440
- await ye.confirm(
1441
- `Are you sure you want to send bundle ${s.value.name} to ${w == null ? void 0 : w.label}?`,
1442
- "Confirm",
1443
- "Confirm",
1444
- "Cancel"
1445
- ) && await g(
1446
- async () => {
1447
- const j = {
1448
- bundle: s.value._id,
1449
- member: v.value,
1450
- source: nt.enum.ADMIN,
1451
- ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${o.value}`,
1452
- withCoin: !1
1453
- };
1454
- await be.sendBundle(j), f();
1455
- },
1456
- {
1457
- message: "Sending bundle",
1458
- successMessage: "Bundle sent"
1459
- }
1460
- );
1461
- }
1462
- const l = L(() => {
1463
- var $, j, ne;
1464
- const w = [];
1465
- return (($ = s.value) == null ? void 0 : $.price.amount) > 0 && w.push(
1466
- `${A.Config.getCountry().currency.symbol}${Ke((j = s.value) == null ? void 0 : j.price)}`
1467
- ), (ne = s.value) != null && ne.coinPrice && w.push(`${s.value.coinPrice} point(s)`), w.join(" or ");
1468
- });
1469
- return S({
1470
- showSheet: u,
1471
- hideSheet: f
1472
- }), ve(async () => {
1473
- await d("");
1474
- }), (w, $) => {
1475
- const j = _("FmCardMedia"), ne = _("FmCardHeader"), Z = _("FmChip"), H = _("FmCardSection"), z = _("FmCard"), oe = _("FmSelect"), F = _("FmTextField"), re = _("FmForm"), b = _("FmButton"), k = _("FmSideSheet");
1476
- return h(), M(k, {
1477
- "max-width": 560,
1478
- "dismiss-away": !0,
1479
- header: "Send bundle to member",
1480
- modelValue: e(i),
1481
- "onUpdate:modelValue": [
1482
- $[4] || ($[4] = (C) => se(i) ? i.value = C : null),
1483
- $[5] || ($[5] = (C) => i.value = C)
1484
- ]
1485
- }, {
1486
- "side-sheet-footer": N(() => [
1487
- V("div", fn, [
1488
- r(b, {
1489
- label: "Send",
1490
- loading: e(Se)().isLoading,
1491
- onClick: $[2] || ($[2] = async () => {
1492
- var C;
1493
- return (C = e(t)) == null ? void 0 : C.validateInputs();
1494
- })
1495
- }, null, 8, ["loading"]),
1496
- r(b, {
1497
- label: "Cancel",
1498
- type: "button",
1499
- variant: "tertiary",
1500
- onClick: $[3] || ($[3] = (C) => i.value = !1)
1501
- })
1502
- ])
1503
- ]),
1504
- default: N(() => [
1505
- r(re, {
1506
- class: "space-y-16",
1507
- ref_key: "form",
1508
- ref: t,
1509
- onValidationSuccess: T,
1510
- blameFormChildOnValidationFailed: ""
1511
- }, {
1512
- default: N(() => [
1513
- r(z, {
1514
- class: "max-w-[700px]",
1515
- horizontal: "",
1516
- variant: "outlined"
1517
- }, {
1518
- default: N(() => {
1519
- var C, B;
1520
- return [
1521
- (C = e(s)) != null && C.image ? (h(), M(j, {
1522
- key: 0,
1523
- width: "100",
1524
- src: (B = e(s)) == null ? void 0 : B.image
1525
- }, null, 8, ["src"])) : E("", !0),
1526
- r(H, { class: "flex flex-col gap-16 justify-between" }, {
1527
- default: N(() => {
1528
- var m;
1529
- return [
1530
- r(ne, {
1531
- class: "p-0",
1532
- title: (m = e(s)) == null ? void 0 : m.name,
1533
- subtitle: e(l)
1534
- }, null, 8, ["title", "subtitle"]),
1535
- r(H, { class: "p-0" }, {
1536
- default: N(() => {
1537
- var n, p, y, U, O, R, q, J, me, xe, ie;
1538
- return [
1539
- V("div", pn, [
1540
- (n = e(s)) != null && n.isFeedvibe ? (h(), M(Z, {
1541
- key: 0,
1542
- label: "Feedvibe"
1543
- })) : E("", !0),
1544
- (y = (p = e(s)) == null ? void 0 : p.titles) != null && y.length ? (h(), M(Z, {
1545
- key: 1,
1546
- label: `${e(s).titles.length} title(s)`
1547
- }, null, 8, ["label"])) : E("", !0),
1548
- (O = (U = e(s)) == null ? void 0 : U.vouchers) != null && O.length ? (h(), M(Z, {
1549
- key: 2,
1550
- label: `${e(s).vouchers.length} voucher(s)`
1551
- }, null, 8, ["label"])) : E("", !0),
1552
- (q = (R = e(s)) == null ? void 0 : R.credit) != null && q.normal || (xe = (me = (J = e(s)) == null ? void 0 : J.credit) == null ? void 0 : me.free) != null && xe.amount ? (h(), M(Z, {
1553
- key: 3,
1554
- label: `${(e(s).credit.normal || 0) + (((ie = e(s).credit.free) == null ? void 0 : ie.amount) || 0)} credit(s)`
1555
- }, null, 8, ["label"])) : E("", !0)
1556
- ])
1557
- ];
1558
- }),
1559
- _: 1
1560
- })
1561
- ];
1562
- }),
1563
- _: 1
1564
- })
1565
- ];
1566
- }),
1567
- _: 1
1568
- }),
1569
- r(oe, {
1570
- modelValue: e(v),
1571
- "onUpdate:modelValue": $[0] || ($[0] = (C) => se(v) ? v.value = C : null),
1572
- label: "Select member",
1573
- searchable: "",
1574
- items: e(c),
1575
- onSearch: d,
1576
- rules: [(C) => !!C > 0 || "Member is required"],
1577
- "helper-text": "Type to search member"
1578
- }, null, 8, ["modelValue", "items", "rules"]),
1579
- r(F, {
1580
- modelValue: e(o),
1581
- "onUpdate:modelValue": $[1] || ($[1] = (C) => se(o) ? o.value = C : null),
1582
- label: "Reference (optional)",
1583
- rules: [
1584
- (C) => C.length < 50 || "Reference must be less than 50 characters"
1585
- ]
1586
- }, null, 8, ["modelValue", "rules"])
1587
- ]),
1588
- _: 1
1589
- }, 512)
1590
- ]),
1591
- _: 1
1592
- }, 8, ["modelValue"]);
1593
- };
1594
- }
1595
- });
1596
- var bn = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "feedmedev.vip", crmUrl: "crm.feedmedev.cc", paymentPortalUrl: "https://portal.feedmedev.cc/payment/payout-account", licensePortalUrl: "https://license.feedmedev.cc/", marketingV1Portal: "https://marketing-v1.feedmedev.cc", voucherAppUrl: "https://voucher.feedmedev.cc/" };
1597
- const gn = { class: "px-24 flex flex-col gap-y-16" }, vn = { class: "flex gap-8 items-center" }, hn = { class: "fm-typo-en-body-lg-600" }, xn = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, Cn = { class: "flex flex-col gap-16 text-center" }, _n = { class: "fm-typo-en-title-sm-800" }, Sn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, eo = /* @__PURE__ */ te({
1598
- __name: "Store",
1599
- setup(x) {
1600
- const S = {
1601
- label: "Setup payout account",
1602
- value: "payout",
1603
- isPrimary: !1
1604
- }, { t: a } = he(), g = {
1605
- label: a("connect.store.actions.setting"),
1606
- value: "setting",
1607
- isPrimary: !1
1608
- }, s = {
1609
- label: a("connect.store.actions.manageReward"),
1610
- value: "create_reward"
1611
- }, v = {
1612
- label: a("connect.store.actions.addCategory"),
1613
- value: "create_category",
1614
- isPrimary: !0,
1615
- prependIcon: "add"
1616
- }, o = I(), c = bt(), i = Te(), { global: t, minor: u } = Le, f = Ee(), d = L(() => i.sortedStoreCategories), T = L(() => i.sortedStoreCategories.map((b) => b.name)), l = I(), w = I();
1617
- async function $(b) {
1618
- var k;
1619
- b === "setting" ? (k = l.value) == null || k.showSheet(!0, i.storeOption) : b === "create_category" ? H(-1) : b === "create_reward" ? await c.push({ name: at["$connect-STORE_REWARDS"] }) : b == "payout" && window.open(bn.paymentPortalUrl, "_blank");
1620
- }
1621
- function j(b, k) {
1622
- var p;
1623
- const C = !!((p = k.company) != null && p.sstRegNo), B = k.inclusiveTaxes ?? [], m = W.taxSystem.map((y) => y.code), n = C ? B.flatMap((y) => {
1624
- console.log(y, "inclusive tax");
1625
- const U = W.systemDefaultCode(y.systemCode);
1626
- return U ? [{ systemCode: y.systemCode, taxCode: U.taxCode }] : [];
1627
- }) : [];
1628
- return console.log([
1629
- ["hasSstRegNo", C],
1630
- ["defaultTaxCodes", n],
1631
- ["inclusiveTaxes", B],
1632
- ["taxSystemCodes", m]
1633
- ]), b.map((y) => ({
1634
- ...y,
1635
- bundles: y.bundles.map((U) => {
1636
- const { pf_vouchers: O, ...R } = U;
1637
- if (!C)
1638
- return {
1639
- ...R,
1640
- taxes: [],
1641
- taxTotals: [],
1642
- priceWithTaxes: { ...R.price }
1643
- };
1644
- const q = n, J = He(
1645
- W.fullTax,
1646
- q,
1647
- R.price,
1648
- Number(R.credit.normal),
1649
- B,
1650
- m
1651
- );
1652
- return {
1653
- ...R,
1654
- taxes: q,
1655
- taxTotals: J,
1656
- priceWithTaxes: qe(
1657
- J,
1658
- R.price,
1659
- B
1660
- )
1661
- };
1662
- })
1663
- }));
1664
- }
1665
- async function ne(b, k, C) {
1666
- const B = !C && !!k, m = !!C && !k;
1667
- let n;
1668
- if (B) {
1669
- const y = W.taxSystem[0] ? W.systemDefaultCode(W.taxSystem[0].code) : void 0, U = y ? `${y.name} (${y.taxCode})` : a("connect.store.taxPropagation.defaultTax");
1670
- n = a("connect.store.taxPropagation.addConfirm", {
1671
- taxCode: U
1672
- });
1673
- } else m ? n = a("connect.store.taxPropagation.removeConfirm") : n = a("connect.store.taxPropagation.updateConfirm");
1674
- await ye.confirm(
1675
- n,
1676
- a("connect.store.taxPropagation.title"),
1677
- a("connect.store.taxPropagation.confirm"),
1678
- a("connect.common.cancel")
1679
- ) && await u(
1680
- async () => {
1681
- const y = Fe(i.sortedStoreCategories), U = j(y, b);
1682
- await be.updateStoreBundle({ categories: U }), await i.readMemberStore(), await i.readMembership(), await i.readRewards();
1683
- },
1684
- {
1685
- message: a("connect.store.taxPropagation.updating"),
1686
- successMessage: a("connect.store.taxPropagation.success")
1687
- }
1688
- );
1689
- }
1690
- async function Z(b) {
1691
- var U, O, R, q;
1692
- const k = ((O = (U = i.storeOption) == null ? void 0 : U.company) == null ? void 0 : O.sstRegNo) ?? "", C = ae.cloneDeep(
1693
- ((R = i.storeOption) == null ? void 0 : R.inclusiveTaxes) ?? []
1694
- ), B = ((q = b.company) == null ? void 0 : q.sstRegNo) ?? "";
1695
- await u(
1696
- async () => {
1697
- var J;
1698
- await be.updateStore(b), await i.readMemberStore(), (J = l.value) == null || J.showSheet(!1);
1699
- },
1700
- {
1701
- message: a("connect.store.setting.update.message"),
1702
- successMessage: a("connect.store.setting.update.success")
1703
- }
1704
- );
1705
- const m = k !== B, n = !ae.isEqual(
1706
- C,
1707
- b.inclusiveTaxes ?? []
1708
- );
1709
- !(m || n) || i.sortedStoreCategories.flatMap(
1710
- (J) => J.bundles
1711
- ).length === 0 || await ne(b, B, k);
1712
- }
1713
- async function H(b = -1) {
1714
- var k, C;
1715
- if ((!i.storeOption || !i.storeOption.company) && await ye.confirm(
1716
- a("connect.store.category.setup.title"),
1717
- a("connect.store.category.setup.button"),
1718
- a("connect.store.category.setup.action"),
1719
- a("connect.common.cancel")
1720
- ))
1721
- return (k = l.value) == null ? void 0 : k.showSheet(!0);
1722
- f.open({
1723
- title: b == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
1724
- contentComponent: kt,
1725
- contentComponentProps: {
1726
- initialValue: ((C = d.value[b]) == null ? void 0 : C.name) ?? "",
1727
- action: b == -1 ? "add" : "edit"
1728
- }
1729
- }).onPrimary(async (B) => {
1730
- B === null && !await ye.remove(
1731
- a("connect.store.category.remove.confirm"),
1732
- a("connect.store.category.remove.title")
1733
- ) || await u(
1734
- async () => {
1735
- const m = b == -1 ? [...d.value, { name: B, bundles: [] }] : [...d.value].map((n, p) => p == b ? { ...n, name: B } : n).filter((n) => n.name !== null);
1736
- await be.updateStoreBundle({
1737
- categories: m
1738
- }), await i.readMemberStore();
1739
- },
1740
- {
1741
- message: B === null ? a("connect.store.category.update.deleting") : b == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
1742
- successMessage: B === null ? a("connect.store.category.update.success.deleted") : b == -1 ? a("connect.store.category.update.success.created") : a("connect.store.category.update.success.updated")
1743
- }
1744
- );
1745
- });
1746
- }
1747
- async function z(b, k, C, B) {
1748
- var p, y, U;
1749
- k ?? (k = (p = w.value) == null ? void 0 : p.target.category), C ?? (C = (y = w.value) == null ? void 0 : y.target.index), B ?? (B = (U = w.value) == null ? void 0 : U.target.originalCategoryIndex);
1750
- const m = Fe(d.value);
1751
- for (const O of m)
1752
- for (const R of O.bundles)
1753
- console.log(R, "bundle in payload"), "pf_vouchers" in R && delete R.pf_vouchers;
1754
- k != B && B != null && (m[B].bundles.splice(C, 1), C = m[k].bundles.length);
1755
- const n = m[k];
1756
- if (!n) {
1757
- st.error("Unexpected error", 2e3);
1758
- return;
1759
- }
1760
- if (b == null) {
1761
- if (await ye.remove(
1762
- a("connect.store.bundle.delete.confirm"),
1763
- a("connect.store.bundle.delete.title")
1764
- ) == !1)
1765
- return;
1766
- n.bundles.splice(C, 1);
1767
- } else
1768
- C == -1 ? n.bundles.push(b) : n.bundles[C] = b;
1769
- await u(
1770
- async () => {
1771
- var O, R;
1772
- if (b != null) {
1773
- const q = (O = w.value) == null ? void 0 : O.bundleImage;
1774
- q === null && b.image ? (await Ve.delete(b.image), b.image = null) : q && (b.image = await Ve.update(
1775
- Ve.bundleImagePath(void 0, q),
1776
- q
1777
- ));
1778
- }
1779
- await be.updateStoreBundle({
1780
- categories: m
1781
- }), await i.readMemberStore(), await i.readMembership(), await i.readRewards(), (R = w.value) == null || R.showSheet(!1);
1782
- },
1783
- {
1784
- message: `${b == null ? "Deleting" : C == -1 ? "Creating" : "Updating"} bundle`,
1785
- successMessage: `Bundle ${b == null ? "deleted" : C == -1 ? "created" : "updated"} successfully`
1786
- }
1787
- );
1788
- }
1789
- function oe(b) {
1790
- var k;
1791
- (k = w.value) == null || k.showSheet(!0, {
1792
- ...b,
1793
- bundle: b.bundle ? Fe(b.bundle) : void 0
1794
- });
1795
- }
1796
- const F = I([]);
1797
- function re(b) {
1798
- var k;
1799
- (k = o.value) == null || k.showSheet({
1800
- bundle: b
1801
- });
1802
- }
1803
- return ve(async () => {
1804
- var k, C;
1805
- await t(async () => {
1806
- var B, m;
1807
- if (await i.readMemberStore(), await i.readMembership(), await i.readRewards(), await i.readPayoutAccount(), (B = c.currentRoute.value.query) != null && B.action) {
1808
- switch ((m = c.currentRoute.value.query) == null ? void 0 : m.action) {
1809
- case "update_setting":
1810
- $("setting");
1811
- break;
1812
- case "create_category":
1813
- H(-1);
1814
- break;
1815
- case "create_feedvibe_bundle":
1816
- f.open({
1817
- title: "Select category",
1818
- contentComponent: Ut
1819
- }).onPrimary((n) => {
1820
- f.close(), oe({
1821
- categories: T.value,
1822
- category: n,
1823
- index: -1,
1824
- bundle: {
1825
- ...ae.cloneDeep(we),
1826
- isFeedvibe: !0,
1827
- price: A.Dinero.fromNumber({
1828
- number: 10,
1829
- precision: 2
1830
- }).toObject()
1831
- }
1832
- });
1833
- }).onTertiary(() => f.close());
1834
- break;
1835
- }
1836
- c.replace({ query: {} });
1837
- }
1838
- });
1839
- const b = ((k = i.payoutAccount) == null ? void 0 : k.status) === "APPROVED" && ((C = i.payoutAccount) == null ? void 0 : C.enable) === !0;
1840
- F.value = [
1841
- ...b ? [] : [S],
1842
- g,
1843
- s,
1844
- v
1845
- ];
1846
- }), (b, k) => {
1847
- const C = _("FmPageHead"), B = _("FmButton"), m = _("FmCard");
1848
- return h(), D(Y, null, [
1849
- r(C, {
1850
- title: e(a)("connect.store.title"),
1851
- actions: e(F),
1852
- "onClick:action": $
1853
- }, null, 8, ["title", "actions"]),
1854
- V("div", gn, [
1855
- e(d) && e(d).length > 0 ? (h(), D(Y, { key: 0 }, [
1856
- (h(!0), D(Y, null, ue(e(d), (n, p) => (h(), D("div", {
1857
- key: n.name,
1858
- class: "space-y-8 py-12"
1859
- }, [
1860
- V("div", vn, [
1861
- V("div", hn, K(n.name), 1),
1862
- r(ke, { json: n }, null, 8, ["json"]),
1863
- r(B, {
1864
- icon: "edit",
1865
- size: "md",
1866
- variant: "tertiary",
1867
- onClick: (y) => H(p)
1868
- }, null, 8, ["onClick"])
1869
- ]),
1870
- V("div", xn, [
1871
- (h(!0), D(Y, null, ue(n.bundles, (y, U) => (h(), M(Ft, {
1872
- bundle: y,
1873
- key: y._id,
1874
- onEdit: (O) => oe({
1875
- bundle: y,
1876
- category: p,
1877
- index: U,
1878
- categories: e(T)
1879
- }),
1880
- onDelete: (O) => z(null, p, U),
1881
- onSend: re
1882
- }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1883
- r(Vt, {
1884
- onCreate: (y) => oe({
1885
- category: p,
1886
- index: -1,
1887
- categories: e(T)
1888
- })
1889
- }, null, 8, ["onCreate"])
1890
- ])
1891
- ]))), 128)),
1892
- r(mn, {
1893
- ref_key: "bundleSheetRef",
1894
- ref: w,
1895
- onUpdate: z
1896
- }, null, 512)
1897
- ], 64)) : (h(), M(m, {
1898
- key: 1,
1899
- variant: "outlined",
1900
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1901
- }, {
1902
- default: N(() => [
1903
- k[1] || (k[1] = V("img", {
1904
- src: Ge,
1905
- class: "aspect-square w-[150px]"
1906
- }, null, -1)),
1907
- V("div", Cn, [
1908
- V("div", _n, K(e(a)("connect.store.bundle.title")), 1),
1909
- V("div", Sn, K(e(a)("connect.store.bundle.description")), 1)
1910
- ]),
1911
- r(B, {
1912
- variant: "primary",
1913
- label: e(a)("connect.store.actions.addCategory"),
1914
- icon: "add",
1915
- onClick: k[0] || (k[0] = (n) => H(-1))
1916
- }, null, 8, ["label"])
1917
- ]),
1918
- _: 1
1919
- })),
1920
- r(Gt, {
1921
- ref_key: "settingSheetRef",
1922
- ref: l,
1923
- onUpdate: Z
1924
- }, null, 512),
1925
- r(yn, {
1926
- ref_key: "sendBundleSheetRef",
1927
- ref: o
1928
- }, null, 512)
1929
- ])
1930
- ], 64);
1931
- };
1932
- }
1933
- });
1934
- export {
1935
- eo as default
1936
- };