@feedmepos/mf-connect 0.1.57-prod → 0.1.58-prod

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