@feedmepos/mf-connect 0.1.98-beta.13 → 0.1.98-beta.15

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