@feedmepos/mf-connect 0.1.98-beta.39 → 0.1.98-beta.40

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 (151) hide show
  1. package/package.json +1 -1
  2. package/dist/App-DwjQisFZ.js +0 -4785
  3. package/dist/AuditLogs-DMGqmriL.js +0 -2014
  4. package/dist/Bin-4wvIqogM.js +0 -166
  5. package/dist/Broadcast-DPpuSZ8_.js +0 -269
  6. package/dist/CampaignAnalytic-CXFDo2X_.js +0 -1826
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-SLoy1-Kd.js +0 -122
  8. package/dist/Card-C8SA6un0.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-BCpSiM_4.js +0 -541
  11. package/dist/Credit-C8RTBpP7.js +0 -286
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0OI5QzpR.js +0 -3382
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js +0 -351
  16. package/dist/Experience-Bg3kFQQE.js +0 -285
  17. package/dist/FileSaver.min-DMUuMi9w.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  20. package/dist/Game-D3DbkRUj.js +0 -356
  21. package/dist/GiftCardSetup-CxlMM4up.js +0 -542
  22. package/dist/Grab-DvEK8ixP.js +0 -301
  23. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js +0 -145
  24. package/dist/Index-Do_9DXuY.js +0 -259
  25. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  26. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js +0 -48
  27. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-D6wJN9Gj.js +0 -18737
  28. package/dist/LoyaltyDashboard-B4WqycGN.js +0 -1345
  29. package/dist/MainLayout-DdxLaufS.js +0 -143
  30. package/dist/Marketing-CcFEMwKB.js +0 -236
  31. package/dist/MarketingMaterialEdit-DoYFaMf7.js +0 -1036
  32. package/dist/Member-BussgBln.js +0 -281
  33. package/dist/MemberList-BXJxSsjo.js +0 -1603
  34. package/dist/MemberOverview-wL_ailso.js +0 -58
  35. package/dist/MemberTransactions-O-XY5nz3.js +0 -45
  36. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DsxrIO0r.js +0 -60957
  37. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +0 -38
  38. package/dist/Mission-CPkM-8Ns.js +0 -360
  39. package/dist/Overview-BJjpYUJN.js +0 -1080
  40. package/dist/Overview-C5KF_Jxj.js +0 -1316
  41. package/dist/Point-FDFwR3Hk.js +0 -288
  42. package/dist/Promotion-qtucKxn0.js +0 -423
  43. package/dist/Queue-d91tocPX.js +0 -261
  44. package/dist/Record-CvkK2iLq.js +0 -342
  45. package/dist/Review-C_zLGtzU.js +0 -45
  46. package/dist/ReviewFacebookCallback-Bidg3P76.js +0 -238
  47. package/dist/ReviewGoogleCallback-DL0lxMBL.js +0 -213
  48. package/dist/Reward-BTsQaI-J.js +0 -442
  49. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BjxA4eMX.js +0 -150
  50. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js +0 -1913
  51. package/dist/Segment-BgFyB3BK.js +0 -1017
  52. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CkhjFNvZ.js +0 -181
  53. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-HYbRyACe.js +0 -189
  54. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-7dv3cAW3.js +0 -226
  55. package/dist/Setting-BxHoCSxw.js +0 -2047
  56. package/dist/SettingAdvertisements-WfvuE4fA.js +0 -264
  57. package/dist/Settings-B42SAvEx.js +0 -179
  58. package/dist/Store-BnvWfCy-.js +0 -2413
  59. package/dist/StoreRewards-BRzAMqR-.js +0 -540
  60. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C3FJr1L5.js +0 -1075
  61. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js +0 -7007
  62. package/dist/Tier-BrzLNat2.js +0 -972
  63. package/dist/Title-EnlaNXld.js +0 -569
  64. package/dist/Transaction-BiXNxUGX.js +0 -39
  65. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Db5_DKQ0.js +0 -130
  66. package/dist/Voucher-C2dyk-jj.js +0 -444
  67. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js +0 -421
  68. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js +0 -56
  69. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  70. package/dist/app-Bt8HrAEr.js +0 -60740
  71. package/dist/app-wDQR6dpb.js +0 -39
  72. package/dist/app.js +0 -7
  73. package/dist/business-BwtQpfUr.js +0 -82
  74. package/dist/campaign-B6U9lwKi.js +0 -255
  75. package/dist/campaign-C6Cb9s3C.js +0 -100
  76. package/dist/campaign-CpzFl8Vr.js +0 -4
  77. package/dist/campaign.enum-Dx-Zo68Q.js +0 -26
  78. package/dist/campaign.fn-B0x2EGhw.js +0 -776
  79. package/dist/collectible.enum-Liy2wH3s.js +0 -19
  80. package/dist/collection.fn-DfoA9sJV.js +0 -26
  81. package/dist/duplicateCampaign-Cnq5N-V8.js +0 -51
  82. package/dist/effect-B2REbrv8.js +0 -89
  83. package/dist/email-addresses-BzmOsxLn.js +0 -705
  84. package/dist/export-jHpRhPQu.js +0 -97
  85. package/dist/feedme.ico +0 -0
  86. package/dist/google-C3S8u0mT.js +0 -4
  87. package/dist/helper-DQAHX1kX.js +0 -86
  88. package/dist/index-4GG-yjdN.js +0 -2963
  89. package/dist/index-BWgMbKOB.js +0 -85
  90. package/dist/index-BccUpf0U.js +0 -3
  91. package/dist/index-BkgkJkVs.js +0 -8919
  92. package/dist/index-C0PKVTf9.js +0 -32
  93. package/dist/index-C8cXXcLk.js +0 -45
  94. package/dist/index-CTTGf4TM.js +0 -151
  95. package/dist/index-C_H8jFYf.js +0 -2743
  96. package/dist/index-CuvNtC_M.js +0 -61
  97. package/dist/index-DJN4auwx.js +0 -146
  98. package/dist/index-DMr9ohGV.js +0 -1139
  99. package/dist/index-DQTo_ytu.js +0 -31
  100. package/dist/index-DW7-0rf_.js +0 -53
  101. package/dist/index-Da7J83jM.js +0 -2706
  102. package/dist/index-Di1Z4vLS.js +0 -27550
  103. package/dist/index-FoKZGh7Z.js +0 -67
  104. package/dist/index-N25Px7RQ.js +0 -72
  105. package/dist/index-PgblELTo.js +0 -897
  106. package/dist/index-STBMTK1u.js +0 -28900
  107. package/dist/index-hP3Mgc0u.js +0 -55
  108. package/dist/index-vh86FiIQ.js +0 -10
  109. package/dist/index.esm2017-DV56jzfJ.js +0 -3069
  110. package/dist/loading-D__sDcq1.js +0 -72
  111. package/dist/lodash-DgkDIHoV.js +0 -3678
  112. package/dist/membership-CBjt1MGx.js +0 -255
  113. package/dist/moment-D7p2TMB-.js +0 -2583
  114. package/dist/money-BFUbPKDM.js +0 -15
  115. package/dist/number-CJb8OUa3.js +0 -12
  116. package/dist/object-BYyQ0PZp.js +0 -18
  117. package/dist/objectId-dwaoBfJX.js +0 -7
  118. package/dist/objectid-BMUFNR9T.js +0 -145
  119. package/dist/plugins-D95ZeD-9.js +0 -1788
  120. package/dist/remy-Qz_pNsUS.js +0 -13
  121. package/dist/reward-CSfV_XFK.js +0 -36
  122. package/dist/rule-DIzVHy2z.js +0 -1969
  123. package/dist/rule-builder-DF7fCvec.js +0 -126
  124. package/dist/string-Gcy5IM_H.js +0 -32
  125. package/dist/style.css +0 -4
  126. package/dist/template-r3lAQP1B.js +0 -188
  127. package/dist/tier-BJDhpH6X.js +0 -4
  128. package/dist/tiers/tier=1.png +0 -0
  129. package/dist/tiers/tier=2.png +0 -0
  130. package/dist/tiers/tier=3.png +0 -0
  131. package/dist/tiers/tier=4.png +0 -0
  132. package/dist/timezone-D40qRUoz.js +0 -20
  133. package/dist/titles/type=diamond.png +0 -0
  134. package/dist/titles/type=drinks.png +0 -0
  135. package/dist/titles/type=food.png +0 -0
  136. package/dist/titles/type=heart.png +0 -0
  137. package/dist/titles/type=medal.png +0 -0
  138. package/dist/titles/type=spend.png +0 -0
  139. package/dist/titles/type=thank-you.png +0 -0
  140. package/dist/titles/type=thumbs-up.png +0 -0
  141. package/dist/titles/type=years.png +0 -0
  142. package/dist/transaction.fn-DV-cpfOj.js +0 -64
  143. package/dist/trigger-BEJaSv5R.js +0 -213
  144. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  145. package/dist/type_drinks-D6jnpvwV.js +0 -4
  146. package/dist/useMarketingMaterialActions-Bd5BDfE1.js +0 -96
  147. package/dist/usePagination-DLIo76-X.js +0 -220
  148. package/dist/user-DtEjuhyM.js +0 -55
  149. package/dist/vue-i18n-dQ1XCaUv.js +0 -2365
  150. package/dist/xlsx-BUMZsTov.js +0 -15491
  151. package/dist/zod-B_pVZhsV.js +0 -91
@@ -1,2413 +0,0 @@
1
- import { defineComponent as te, computed as O, resolveComponent as v, openBlock as p, createBlock as D, withCtx as I, createElementVNode as s, toDisplayString as P, createVNode as i, createCommentVNode as L, createElementBlock as U, unref as e, Fragment as J, renderList as me, ref as j, isRef as ve, reactive as Ze, onMounted as Te, watch as Ae, toRaw as Qe, createTextVNode as be, h as et, normalizeStyle as tt, normalizeClass as ot } from "vue";
2
- import { _ as nt } from "./tier-BJDhpH6X.js";
3
- import { useDialog as He, useDialogChild as Ge, components as at } from "@feedmepos/ui-library";
4
- import { c as H, e as Re, S as qe } from "./index-STBMTK1u.js";
5
- import { u as ze } from "./loading-D__sDcq1.js";
6
- import { u as Oe, C as $e } from "./membership-CBjt1MGx.js";
7
- import { j as st, k as lt, l as it, m as Le, n as rt, o as ct } from "./index-4GG-yjdN.js";
8
- import { a as dt, c as Be } from "./object-BYyQ0PZp.js";
9
- import { _ as ue } from "./lodash-DgkDIHoV.js";
10
- import { c as xe } from "./index-Di1Z4vLS.js";
11
- import { u as Se } from "./vue-i18n-dQ1XCaUv.js";
12
- import { Z as re, g as se, a as le } from "./zod-B_pVZhsV.js";
13
- import { z as ce, R as Ie } from "./app-Bt8HrAEr.js";
14
- import { u as Ue } from "./app-wDQR6dpb.js";
15
- import { _ as ye } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js";
16
- import { c as ut, p as Ce, n as mt, f as De } from "./plugins-D95ZeD-9.js";
17
- import { J as Ee } from "./JsonViewer-v8_C7l5N.js";
18
- import { _ as pt } from "./index-BkgkJkVs.js";
19
- import { _ as ft } from "./ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js";
20
- import { _ as yt } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
21
- import { z as gt, a as bt } from "./money-BFUbPKDM.js";
22
- import { F as vt } from "./number-CJb8OUa3.js";
23
- import { a as ht, t as xt } from "./helper-DQAHX1kX.js";
24
- import "./index-BccUpf0U.js";
25
- import "./index-Da7J83jM.js";
26
- import "./index-PgblELTo.js";
27
- import "./index-hP3Mgc0u.js";
28
- import { m as _t } from "./index-BWgMbKOB.js";
29
- import { m as ke } from "./index-CTTGf4TM.js";
30
- import { g as Ne } from "./index-DW7-0rf_.js";
31
- import { u as Ct } from "./business-BwtQpfUr.js";
32
- import { useRouter as St } from "vue-router";
33
- function We(b) {
34
- return xe.DineroFactory(b).toUnit();
35
- }
36
- function Ye(b, x, o, y, c = [], h = []) {
37
- const n = pt.compact(
38
- x.map((t) => b.find((r) => r.systemCode === t.systemCode && r.taxCode === t.taxCode)).filter((t) => !!t && h.includes(t.systemCode))
39
- ), m = n.reduce(
40
- (t, r) => {
41
- var f;
42
- return Object.assign(t, {
43
- [r.taxCode]: {
44
- inclusive: ((f = c.find((u) => u.systemCode === r.systemCode)) == null ? void 0 : f.inclusive) || !1,
45
- adjustment: {
46
- level: 1,
47
- type: {
48
- type: "BY_MULTIPLIER",
49
- amount: {
50
- amount: r.rate.amount,
51
- precision: r.rate.precision,
52
- currency: "MYR"
53
- }
54
- }
55
- }
56
- }
57
- });
58
- },
59
- {}
60
- ), l = xe.Calculator.calculate({
61
- items: {
62
- 0: {
63
- quantity: 1,
64
- adjustments: {
65
- price: {
66
- level: 0,
67
- type: {
68
- type: "BY_AMOUNT",
69
- amount: xe.DineroFactory(o).subtract(xe.Dinero.fromNumber({ number: y }).toObject()).toObject()
70
- }
71
- }
72
- },
73
- taxes: m
74
- }
75
- },
76
- adjustments: {},
77
- roundToNearest: 0
78
- });
79
- return n.map((t) => ({
80
- setting: t,
81
- systemCode: t.systemCode,
82
- name: t.name,
83
- taxCode: t.taxCode,
84
- rate: t.rate,
85
- total: xe.DineroFactory({
86
- ...l.items[0].taxes[t.taxCode].amount
87
- }).convertPrecision(2).toObject()
88
- }));
89
- }
90
- function Je(b, x, o) {
91
- return b ? b.reduce((y, c) => {
92
- var h;
93
- return (h = o.find((n) => n.systemCode === c.systemCode)) != null && h.inclusive || (y = xe.DineroFactory(y.toObject()).add(c.total)), y;
94
- }, xe.DineroFactory(x)).toObject() : xe.DineroFactory(x).toObject();
95
- }
96
- const Ft = { class: "flex justify-between items-start gap-4 w-full" }, wt = { class: "fm-typo-en-body-lg-600 text-left pt-4 break-words line-clamp-2" }, $t = { class: "flex-shrink-0 -mr-8 -mt-8" }, Vt = { class: "relative h-[120px] aspect-video flex mx-auto items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, kt = ["src"], Pt = {
97
- key: 2,
98
- class: "absolute top-2 left-2"
99
- }, Tt = { class: "flex flex-col gap-8 flex-1 text-left w-full" }, Rt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ut = { class: "flex gap-8 items-center flex-wrap" }, Bt = /* @__PURE__ */ te({
100
- __name: "StoreBundleCard",
101
- props: {
102
- bundle: { type: Object, required: !0 }
103
- },
104
- emits: ["edit", "delete", "send"],
105
- setup(b, { emit: x }) {
106
- const o = b, y = x, c = O(() => {
107
- const n = [];
108
- return o.bundle.price.amount > 0 && n.push(
109
- `${H.Config.getCountry().currency.symbol}${We(o.bundle.price)}`
110
- ), o.bundle.coinPrice && n.push(`${o.bundle.coinPrice} point(s)`), n.join(" or ");
111
- }), h = O(() => {
112
- var m, l;
113
- const n = [];
114
- if (o.bundle.titles.length > 0 && n.push(`${o.bundle.titles.length} title(s)`), o.bundle.vouchers.length > 0 && n.push(`${o.bundle.vouchers.length} voucher(s)`), o.bundle.credit.normal || (m = o.bundle.credit.free) != null && m.amount) {
115
- const t = o.bundle.credit.normal + (((l = o.bundle.credit.free) == null ? void 0 : l.amount) ?? 0);
116
- n.push(`${t} credit(s)`);
117
- }
118
- return n;
119
- });
120
- return (n, m) => {
121
- const l = v("FmButton"), t = v("FmMenuItem"), r = v("FmMenu"), f = v("FmIcon"), u = v("FmChip"), w = v("FmCard");
122
- return p(), D(w, {
123
- variant: "outlined",
124
- class: "flex flex-col gap-y-8 p-16 min-h-[240px] h-full"
125
- }, {
126
- default: I(() => [
127
- s("div", Ft, [
128
- s("div", wt, P(b.bundle.name), 1),
129
- s("div", $t, [
130
- i(r, { placement: "bottom-end" }, {
131
- "menu-button": I(() => [
132
- i(l, {
133
- icon: "more_vert",
134
- variant: "tertiary"
135
- })
136
- ]),
137
- default: I(() => [
138
- i(t, {
139
- onClick: m[0] || (m[0] = (d) => y("edit", b.bundle)),
140
- icon: "edit",
141
- label: "Edit"
142
- }),
143
- b.bundle.stripePriceId ? L("", !0) : (p(), D(t, {
144
- key: 0,
145
- onClick: m[1] || (m[1] = (d) => y("send", b.bundle)),
146
- icon: "send",
147
- label: "Send"
148
- })),
149
- i(t, {
150
- onClick: m[2] || (m[2] = (d) => y("delete", b.bundle)),
151
- icon: "delete"
152
- }, {
153
- label: I(() => [...m[3] || (m[3] = [
154
- s("div", { class: "text-fm-color-typo-error fm-typo-en-body-md-400" }, " Delete ", -1)
155
- ])]),
156
- _: 1
157
- })
158
- ]),
159
- _: 1
160
- })
161
- ])
162
- ]),
163
- s("div", Vt, [
164
- b.bundle.image ? (p(), U("img", {
165
- key: 1,
166
- src: b.bundle.image,
167
- class: "w-full h-full object-contain aspect-video"
168
- }, null, 8, kt)) : (p(), D(f, {
169
- key: 0,
170
- name: "image",
171
- outline: !0,
172
- size: "md",
173
- class: "text-fm-color-neutral-gray-200"
174
- })),
175
- b.bundle.isFeedvibe ? (p(), U("div", Pt, [
176
- i(u, {
177
- label: "Feedvibe",
178
- class: "text-fm-color-primary bg-fm-color-system-warning-100",
179
- compact: ""
180
- })
181
- ])) : L("", !0)
182
- ]),
183
- s("div", Tt, [
184
- s("div", Rt, P(e(c) || "Free"), 1),
185
- s("div", Ut, [
186
- (p(!0), U(J, null, me(e(h), (d, $) => (p(), D(u, {
187
- key: $,
188
- label: d
189
- }, null, 8, ["label"]))), 128))
190
- ])
191
- ])
192
- ]),
193
- _: 1
194
- });
195
- };
196
- }
197
- }), It = /* @__PURE__ */ te({
198
- __name: "AddBundleCard",
199
- emits: ["create"],
200
- setup(b, { emit: x }) {
201
- const { t: o } = Se(), y = x;
202
- return (c, h) => {
203
- const n = v("FmButton"), m = v("FmCard");
204
- return p(), D(m, {
205
- variant: "outlined",
206
- class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
207
- }, {
208
- default: I(() => [
209
- i(n, {
210
- onClick: h[0] || (h[0] = (l) => y("create")),
211
- label: e(o)("connect.store.actions.addBundle"),
212
- icon: "add",
213
- variant: "secondary"
214
- }, null, 8, ["label"])
215
- ]),
216
- _: 1
217
- });
218
- };
219
- }
220
- }), Dt = { class: "space-y-16" }, Nt = { class: "flex w-full justify-between pb-16" }, Mt = { class: "flex items-center justify-end gap-8" }, At = /* @__PURE__ */ te({
221
- __name: "CategoryDialog",
222
- props: {
223
- action: {
224
- type: String,
225
- default: () => "add"
226
- },
227
- initialValue: {
228
- type: String,
229
- default: () => ""
230
- }
231
- },
232
- setup(b) {
233
- const { t: x } = Se(), o = b, y = He(), { emitData: c, emitAction: h } = Ge(), n = j(o.initialValue), m = ce.string().min(1);
234
- function l() {
235
- c(n.value), h("primary"), y.close();
236
- }
237
- function t() {
238
- c(null), h("primary"), y.close();
239
- }
240
- return (r, f) => {
241
- const u = v("FmTextField"), w = v("FmButton");
242
- return p(), U("div", Dt, [
243
- i(u, {
244
- modelValue: e(n),
245
- "onUpdate:modelValue": f[0] || (f[0] = (d) => ve(n) ? n.value = d : null),
246
- label: e(x)("connect.store.category.label"),
247
- rules: [e(re).toRule(e(m))]
248
- }, null, 8, ["modelValue", "label", "rules"]),
249
- s("div", Nt, [
250
- s("div", null, [
251
- b.action == "edit" ? (p(), D(w, {
252
- key: 0,
253
- onClick: t,
254
- label: e(x)("connect.common.delete"),
255
- variant: "destructive"
256
- }, null, 8, ["label"])) : L("", !0)
257
- ]),
258
- s("div", Mt, [
259
- i(w, {
260
- label: e(x)("connect.common.cancel"),
261
- variant: "tertiary",
262
- onClick: f[1] || (f[1] = (d) => e(y).close())
263
- }, null, 8, ["label"]),
264
- i(w, {
265
- label: b.action == "edit" ? e(x)("connect.common.edit") : e(x)("connect.common.add"),
266
- disabled: !e(n),
267
- onClick: l
268
- }, null, 8, ["label", "disabled"])
269
- ])
270
- ])
271
- ]);
272
- };
273
- }
274
- }), Ot = { class: "space-y-16" }, Et = { class: "flex items-center justify-end gap-8 pb-16" }, Lt = /* @__PURE__ */ te({
275
- __name: "SelectCategoryDialog",
276
- setup(b) {
277
- const { emitData: x, emitAction: o } = Ge(), y = Oe(), c = j(), h = O(
278
- () => y.sortedStoreCategories.map((n, m) => ({
279
- label: n.name,
280
- value: m
281
- }))
282
- );
283
- return (n, m) => {
284
- const l = v("FmSelect"), t = v("FmButton");
285
- return p(), U("div", Ot, [
286
- m[4] || (m[4] = s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Select a category to create FeedMe CNY 2025 bundle ", -1)),
287
- i(l, {
288
- placeholder: "Select a category",
289
- items: e(h),
290
- modelValue: e(c),
291
- "onUpdate:modelValue": [
292
- m[0] || (m[0] = (r) => ve(c) ? c.value = r : null),
293
- m[1] || (m[1] = (r) => e(x)(r))
294
- ],
295
- label: "Category"
296
- }, null, 8, ["items", "modelValue"]),
297
- s("div", Et, [
298
- i(t, {
299
- variant: "tertiary",
300
- label: "Cancel",
301
- onClick: m[2] || (m[2] = (r) => e(o)("tertiary"))
302
- }),
303
- i(t, {
304
- label: "Select",
305
- onClick: m[3] || (m[3] = (r) => e(o)("primary")),
306
- disabled: e(c) == null
307
- }, null, 8, ["disabled"])
308
- ])
309
- ]);
310
- };
311
- }
312
- });
313
- function ge(b) {
314
- return b.states.map((x) => ({ label: x, value: x }));
315
- }
316
- const jt = {
317
- [Re.F_COUNTRY.enum.MY]: {
318
- states: [
319
- "Johor",
320
- "Kedah",
321
- "Kelantan",
322
- "Kuala Lumpur",
323
- "Labuan",
324
- "Melaka",
325
- "Negeri Sembilan",
326
- "Pahang",
327
- "Perak",
328
- "Perlis",
329
- "Pulau Pinang",
330
- "Putrajaya",
331
- "Sabah",
332
- "Sarawak",
333
- "Selangor",
334
- "Terengganu"
335
- ],
336
- get stateItems() {
337
- return ge(this);
338
- }
339
- },
340
- [Re.F_COUNTRY.enum.SG]: {
341
- states: [],
342
- get stateItems() {
343
- return ge(this);
344
- }
345
- },
346
- JP: {
347
- states: [],
348
- get stateItems() {
349
- return ge(this);
350
- }
351
- },
352
- AE: {
353
- states: [],
354
- get stateItems() {
355
- return ge(this);
356
- }
357
- },
358
- AU: {
359
- states: [],
360
- get stateItems() {
361
- return ge(this);
362
- }
363
- },
364
- MO: {
365
- states: [],
366
- get stateItems() {
367
- return ge(this);
368
- }
369
- },
370
- VN: {
371
- states: [],
372
- get stateItems() {
373
- return ge(this);
374
- }
375
- },
376
- [Re.F_COUNTRY.enum.ID]: {
377
- states: [
378
- "Aceh",
379
- "Bali",
380
- "Bangka-Belitung",
381
- "Banten",
382
- "Bengkulu",
383
- "Central Java",
384
- "Central Sulawesi",
385
- "Daerah Istimewa Yogyakarta",
386
- "East Java",
387
- "East Kalimantan",
388
- "East Nusa Tenggara",
389
- "Gorontalo",
390
- "Jakarta Raya",
391
- "Jambi",
392
- "Kalimantan Tengah",
393
- "Lampung",
394
- "Maluku",
395
- "Maluku Utara",
396
- "North Sulawesi",
397
- "North Sumatra",
398
- "Nusa Tenggara Barat",
399
- "Papua",
400
- "Riau",
401
- "Riau Islands",
402
- "South Kalimantan",
403
- "South Sulawesi",
404
- "South Sumatra",
405
- "Sulawesi Barat",
406
- "Sulawesi Tenggara",
407
- "West Java",
408
- "West Kalimantan",
409
- "West Papua",
410
- "West Sumatra"
411
- ],
412
- get stateItems() {
413
- return ge(this);
414
- }
415
- },
416
- [Re.F_COUNTRY.enum.TH]: {
417
- states: [
418
- "Bangkok",
419
- "Amnat Charoen",
420
- "Ang Thong",
421
- "Bueng Kan",
422
- "Buri Ram",
423
- "Chachoengsao",
424
- "Chai Nat",
425
- "Chaiyaphum",
426
- "Chanthaburi",
427
- "Chiang Mai",
428
- "Chiang Rai",
429
- "Chonburi",
430
- "Chumphon",
431
- "Kalasin",
432
- "Kamphaeng Phet",
433
- "Kanchanaburi",
434
- "Khon Kaen",
435
- "Krabi",
436
- "Lampang",
437
- "Lamphun",
438
- "Loei",
439
- "Lopburi",
440
- "Mae Hong Son",
441
- "Maha Sarakham",
442
- "Mukdahan",
443
- "Nakhon Nayok",
444
- "Nakhon Pathom",
445
- "Nakhon Phanom",
446
- "Nakhon Ratchasima",
447
- "Nakhon Sawan",
448
- "Nakhon Si Thammarat",
449
- "Nan",
450
- "Narathiwat",
451
- "Nong Bua Lamphu",
452
- "Nong Khai",
453
- "Nonthaburi",
454
- "Pathum Thani",
455
- "Pattani",
456
- "Phang Nga",
457
- "Phatthalung",
458
- "Phayao",
459
- "Phetchabun",
460
- "Phetchaburi",
461
- "Phichit",
462
- "Phitsanulok",
463
- "Phra Nakhon Si Ayutthaya",
464
- "Phrae",
465
- "Phuket",
466
- "Prachinburi",
467
- "Prachuap Khiri Khan",
468
- "Ranong",
469
- "Ratchaburi",
470
- "Rayong",
471
- "Roi Et",
472
- "Sa Kaeo",
473
- "Sakon Nakhon",
474
- "Samut Prakan",
475
- "Samut Sakhon",
476
- "Samut Songkhram",
477
- "Saraburi",
478
- "Satun",
479
- "Sing Buri",
480
- "Sisaket",
481
- "Songkhla",
482
- "Sukhothai",
483
- "Suphan Buri",
484
- "Surat Thani",
485
- "Surin",
486
- "Tak",
487
- "Trang",
488
- "Trat",
489
- "Ubon Ratchathani",
490
- "Udon Thani",
491
- "Uthai Thani",
492
- "Uttaradit",
493
- "Yala",
494
- "Yasothon"
495
- ],
496
- get stateItems() {
497
- return ge(this);
498
- }
499
- }
500
- }, Ve = () => H.Config.getCountry(), Pe = {
501
- get fullCurrency() {
502
- return Ve().currency;
503
- },
504
- get currency() {
505
- return Ve().currency.code;
506
- },
507
- get fullTax() {
508
- return H.Country.getCountryFlattenTaxes(Ve().code);
509
- },
510
- get taxSystem() {
511
- return Ve().taxSystems;
512
- },
513
- taxInclusion(b) {
514
- return Pe.taxSystem.map((x) => ({
515
- systemCode: x.code,
516
- inclusive: b !== void 0 ? b : !1
517
- }));
518
- },
519
- groupedTaxOptions() {
520
- const b = H.Country.getCountryFlattenTaxes(Ve().code);
521
- return Pe.taxSystem.map((x) => ({
522
- code: x.code,
523
- options: b.map((o) => ({ ...o, feedmeTaxCode: Pe.generateCode(o) })).filter((o) => o.systemCode === x.code)
524
- }));
525
- },
526
- systemDefaultCode(b) {
527
- const x = Pe.groupedTaxOptions().find((o) => o.code === b);
528
- return x == null ? void 0 : x.options.find((o) => o.default);
529
- },
530
- generateCode(b) {
531
- return `${b.systemCode}/${b.taxCode}`;
532
- }
533
- }, ee = Pe, Kt = /* @__PURE__ */ te({
534
- __name: "TaxInclusiveSetting",
535
- props: {
536
- modelValue: {
537
- type: Array,
538
- required: !0,
539
- default: () => []
540
- }
541
- },
542
- emits: ["update:model-value"],
543
- setup(b, { emit: x }) {
544
- const o = b, y = ee.taxSystem, c = x, h = j(o.modelValue);
545
- function n(r, f) {
546
- const u = ue.clone(o.modelValue), w = u.findIndex((d) => d.systemCode === r);
547
- w >= 0 ? u[w].inclusive = f : u.push({
548
- systemCode: r,
549
- inclusive: f
550
- }), h.value = u, c("update:model-value", u);
551
- }
552
- function m() {
553
- return y.map((r) => {
554
- const f = o.modelValue ? o.modelValue.find((u) => u.systemCode === r.code) : !1;
555
- return {
556
- label: r.name,
557
- config: {
558
- value: f ? f.inclusive : !1
559
- },
560
- input: (u) => {
561
- n(r.code, u);
562
- }
563
- };
564
- });
565
- }
566
- const l = Ze(m());
567
- function t(r, f) {
568
- return `${r} ${f ? "Inclusive" : "Exclusive"}`;
569
- }
570
- return Te(() => {
571
- o.modelValue.length || n(y[0].code, !1);
572
- }), Ae(
573
- () => o.modelValue,
574
- (r, f) => {
575
- r != f && !r.length && n(y[0].code, !1);
576
- }
577
- ), (r, f) => {
578
- const u = v("FmSwitch");
579
- return p(!0), U(J, null, me(e(l), (w, d) => {
580
- var $;
581
- return p(), U("div", { key: d }, [
582
- i(u, {
583
- "model-value": (($ = e(h)[d]) == null ? void 0 : $.inclusive) || !1,
584
- "label-placement": "left",
585
- "onUpdate:modelValue": (T) => w.input(T)
586
- }, {
587
- label: I(() => {
588
- var T;
589
- return [
590
- s("div", null, P(t(w.label, ((T = e(h)[d]) == null ? void 0 : T.inclusive) || !1)), 1)
591
- ];
592
- }),
593
- _: 2
594
- }, 1032, ["model-value", "onUpdate:modelValue"])
595
- ]);
596
- }), 128);
597
- };
598
- }
599
- });
600
- var Ht = { mode: "development", appMode: "mf" };
601
- const Gt = { class: "space-y-8" }, qt = {
602
- key: 0,
603
- class: "space-y-16"
604
- }, zt = /* @__PURE__ */ te({
605
- __name: "StripeSetting",
606
- props: {
607
- modelValue: {}
608
- },
609
- emits: ["update:modelValue"],
610
- setup(b, { emit: x }) {
611
- const o = b, y = x, c = j(!1);
612
- Ae(c, (n, m) => {
613
- m != n && (!o.modelValue && n ? y("update:modelValue", {
614
- apiKey: "",
615
- webhookSecret: ""
616
- }) : n || y("update:modelValue", void 0));
617
- });
618
- const h = O(() => {
619
- const n = Ht.mode === "development", m = H.Config.getCountry().code.toLowerCase(), l = m != "my" ? `.${m}` : "";
620
- return `https://marketing${n ? "-dev" : ""}${l}.feedmeapi.com/stripe/${qe.getBusinessId()}/webhook`;
621
- });
622
- return Te(() => {
623
- c.value = !!o.modelValue;
624
- }), (n, m) => {
625
- const l = v("FmSwitch"), t = v("FmTextField"), r = v("FmButton");
626
- return p(), U("div", Gt, [
627
- i(l, {
628
- modelValue: e(c),
629
- "onUpdate:modelValue": m[0] || (m[0] = (f) => ve(c) ? c.value = f : null),
630
- value: "true",
631
- label: "Enable Stripe"
632
- }, null, 8, ["modelValue"]),
633
- o.modelValue ? (p(), U("div", qt, [
634
- i(t, {
635
- label: "API Key",
636
- modelValue: o.modelValue.apiKey,
637
- "onUpdate:modelValue": m[1] || (m[1] = (f) => o.modelValue.apiKey = f),
638
- "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
639
- }, null, 8, ["modelValue"]),
640
- i(t, {
641
- label: "Webhook URL",
642
- "model-value": e(h),
643
- readonly: "",
644
- "helper-text": "Copy this URL to your Stripe dashboard"
645
- }, {
646
- append: I(() => [
647
- i(r, {
648
- icon: "content_copy",
649
- variant: "tertiary",
650
- onClick: m[2] || (m[2] = (f) => e(ut)(e(h)))
651
- })
652
- ]),
653
- _: 1
654
- }, 8, ["model-value"]),
655
- i(t, {
656
- modelValue: o.modelValue.webhookSecret,
657
- "onUpdate:modelValue": m[3] || (m[3] = (f) => o.modelValue.webhookSecret = f),
658
- label: "Webhook Secret",
659
- "helper-text": `Copy the webhook signing secret from your Stripe account and paste
660
- here.`
661
- }, null, 8, ["modelValue"])
662
- ])) : L("", !0)
663
- ]);
664
- };
665
- }
666
- }), Wt = {
667
- key: 0,
668
- class: "space-y-16 pr-12"
669
- }, Yt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Jt = {
670
- key: 1,
671
- class: "space-y-16"
672
- }, Xt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Zt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Qt = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, eo = { class: "space-y-4" }, to = { class: "fm-typo-en-body-lg-400" }, oo = { class: "space-y-16" }, no = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, ao = { class: "flex items-center gap-8" }, so = /* @__PURE__ */ te({
673
- __name: "StoreSettingSheet",
674
- emits: ["update"],
675
- setup(b, { expose: x, emit: o }) {
676
- const { t: y } = Se(), c = o, h = j(!1), n = j(), m = j(!1), l = st.extend({
677
- company: lt.extend({
678
- name: ce.string().min(1, "Company name is required"),
679
- regNo: ce.string().min(1, "Registration number is required"),
680
- address: it.extend({
681
- line1: ce.string().min(1, "Line 1 is required"),
682
- line2: ce.string().optional(),
683
- state: ce.string().min(1, "State is required"),
684
- city: ce.string().min(1, "City is required"),
685
- postcode: ce.string().min(1, "Postcode is required"),
686
- country: ce.string().min(1, "Country is required")
687
- }),
688
- phoneNo: ce.string().min(1, "Phone number is required"),
689
- sstRegNo: ce.string().optional()
690
- })
691
- }), t = O(() => l.safeParse(n.value).success);
692
- function r() {
693
- const w = l.safeParse(n.value);
694
- w.success && c("update", w.data);
695
- }
696
- function f() {
697
- return {
698
- company: {
699
- name: "",
700
- address: {
701
- line1: "",
702
- line2: "",
703
- city: "",
704
- postcode: "",
705
- state: "",
706
- country: H.Config.getCountry().name
707
- },
708
- phoneNo: "",
709
- regNo: "",
710
- sstRegNo: ""
711
- },
712
- inclusiveTaxes: []
713
- };
714
- }
715
- function u(w, d) {
716
- h.value = w, w && (n.value = d != null && d.company ? ue.cloneDeep(d) : f());
717
- }
718
- return x({
719
- showSheet: u,
720
- data: n
721
- }), (w, d) => {
722
- const $ = v("FmIcon"), T = v("FmMenuItem"), E = v("FmMenu"), X = v("FmSelect"), ae = v("FmButton"), Z = v("FmSideSheet");
723
- return p(), D(Z, {
724
- "max-width": 560,
725
- modelValue: e(h),
726
- "onUpdate:modelValue": d[15] || (d[15] = (ie) => ve(h) ? h.value = ie : null),
727
- header: e(y)("connect.store.setting.title")
728
- }, {
729
- "side-sheet-footer": I(() => [
730
- s("div", ao, [
731
- i(ae, {
732
- label: e(y)("connect.common.save"),
733
- onClick: r,
734
- disabled: !e(t) || e(Ue)().isLoading,
735
- loading: e(Ue)().isLoading
736
- }, null, 8, ["label", "disabled", "loading"]),
737
- i(ae, {
738
- label: e(y)("connect.common.cancel"),
739
- onClick: d[14] || (d[14] = (ie) => u(!1)),
740
- variant: "tertiary"
741
- }, null, 8, ["label"])
742
- ])
743
- ]),
744
- default: I(() => {
745
- var ie, he;
746
- return [
747
- i(Ee, { json: e(n) }, null, 8, ["json"]),
748
- e(n) && e(n).company ? (p(), U("div", Wt, [
749
- s("div", Yt, P(e(y)("connect.store.setting.company.legal_info")), 1),
750
- i(ye, {
751
- modelValue: e(n).company.name,
752
- "onUpdate:modelValue": d[0] || (d[0] = (V) => e(n).company.name = V),
753
- label: e(y)("connect.store.setting.company.name"),
754
- schema: e(re).typeAtPath(e(l), "company.name")
755
- }, null, 8, ["modelValue", "label", "schema"]),
756
- i(ye, {
757
- modelValue: e(n).company.regNo,
758
- "onUpdate:modelValue": d[1] || (d[1] = (V) => e(n).company.regNo = V),
759
- label: e(y)("connect.store.setting.company.reg_no"),
760
- schema: e(re).typeAtPath(e(l), "company.regNo")
761
- }, null, 8, ["modelValue", "label", "schema"]),
762
- e(H.Config).getCountry().taxSystems.length ? (p(), D(ye, {
763
- key: 0,
764
- modelValue: e(n).company.sstRegNo,
765
- "onUpdate:modelValue": [
766
- d[2] || (d[2] = (V) => e(n).company.sstRegNo = V),
767
- d[3] || (d[3] = (V) => V ? null : e(n).inclusiveTaxes = [])
768
- ],
769
- label: e(y)("connect.store.setting.company.tax_reg_no"),
770
- schema: e(re).typeAtPath(e(l), "company.sstRegNo")
771
- }, null, 8, ["modelValue", "label", "schema"])) : L("", !0),
772
- (ie = e(n).company) != null && ie.sstRegNo && e(n).inclusiveTaxes ? (p(), U("div", Jt, [
773
- s("div", Xt, P(e(y)("connect.store.setting.company.tax")), 1),
774
- i(Kt, {
775
- modelValue: e(n).inclusiveTaxes,
776
- "onUpdate:modelValue": d[4] || (d[4] = (V) => e(n).inclusiveTaxes = V)
777
- }, null, 8, ["modelValue"])
778
- ])) : L("", !0),
779
- i(ye, {
780
- modelValue: e(n).company.phoneNo,
781
- "onUpdate:modelValue": d[5] || (d[5] = (V) => e(n).company.phoneNo = V),
782
- label: e(y)("connect.store.setting.company.phone"),
783
- schema: e(re).typeAtPath(e(l), "company.phoneNo")
784
- }, null, 8, ["modelValue", "label", "schema"]),
785
- s("div", Zt, P(e(y)("connect.store.setting.company.address.title")), 1),
786
- i(ye, {
787
- modelValue: e(n).company.address.line1,
788
- "onUpdate:modelValue": d[6] || (d[6] = (V) => e(n).company.address.line1 = V),
789
- label: e(y)("connect.store.setting.company.address.line1"),
790
- schema: e(re).typeAtPath(e(l), "company.address.line1")
791
- }, null, 8, ["modelValue", "label", "schema"]),
792
- i(ye, {
793
- modelValue: e(n).company.address.line2,
794
- "onUpdate:modelValue": d[7] || (d[7] = (V) => e(n).company.address.line2 = V),
795
- label: e(y)("connect.store.setting.company.address.line2"),
796
- schema: e(re).typeAtPath(e(l), "company.address.line2")
797
- }, null, 8, ["modelValue", "label", "schema"]),
798
- s("div", Qt, [
799
- i(ye, {
800
- modelValue: e(n).company.address.city,
801
- "onUpdate:modelValue": d[8] || (d[8] = (V) => e(n).company.address.city = V),
802
- label: e(y)("connect.store.setting.company.address.city"),
803
- schema: e(re).typeAtPath(e(l), "company.address.city")
804
- }, null, 8, ["modelValue", "label", "schema"]),
805
- i(ye, {
806
- modelValue: e(n).company.address.postcode,
807
- "onUpdate:modelValue": d[9] || (d[9] = (V) => e(n).company.address.postcode = V),
808
- label: e(y)("connect.store.setting.company.address.postcode"),
809
- schema: e(re).typeAtPath(e(l), "company.address.postcode")
810
- }, null, 8, ["modelValue", "label", "schema"]),
811
- s("div", eo, [
812
- s("div", to, P(e(y)("connect.store.setting.company.address.state")), 1),
813
- i(E, {
814
- placement: "top-end",
815
- "model-value": e(m)
816
- }, {
817
- "menu-button": I(() => [
818
- i(ye, {
819
- modelValue: e(n).company.address.state,
820
- "onUpdate:modelValue": d[10] || (d[10] = (V) => e(n).company.address.state = V),
821
- schema: e(re).typeAtPath(e(l), "company.address.state"),
822
- onFocusChanged: d[11] || (d[11] = (V) => m.value = V)
823
- }, {
824
- append: I(() => [
825
- i($, {
826
- name: e(m) ? "keyboard_arrow_up" : "keyboard_arrow_down"
827
- }, null, 8, ["name"])
828
- ]),
829
- _: 1
830
- }, 8, ["modelValue", "schema"])
831
- ]),
832
- default: I(() => [
833
- (p(!0), U(J, null, me(e(jt)[e(H.Config).getCountry().code].stateItems.filter(
834
- (V) => {
835
- var de, pe;
836
- return V.label.toLowerCase().includes(((pe = (de = e(n)) == null ? void 0 : de.company) == null ? void 0 : pe.address.state.toLowerCase()) ?? "");
837
- }
838
- ) || [], (V) => (p(), D(T, {
839
- key: V.value,
840
- "model-value": e(n).company.address.state === V.value,
841
- label: V.label,
842
- onClick: () => {
843
- e(n).company.address.state = V.value, m.value = !1;
844
- }
845
- }, null, 8, ["model-value", "label", "onClick"]))), 128))
846
- ]),
847
- _: 1
848
- }, 8, ["model-value"])
849
- ]),
850
- i(X, {
851
- label: e(y)("connect.store.setting.company.address.country"),
852
- modelValue: e(n).company.address.country,
853
- "onUpdate:modelValue": d[12] || (d[12] = (V) => e(n).company.address.country = V),
854
- items: [
855
- {
856
- label: e(H.Config).getCountry().name,
857
- value: e(H.Config).getCountry().name
858
- }
859
- ],
860
- rules: [e(re).ruleAtPath(e(l), "company.address.country")]
861
- }, null, 8, ["label", "modelValue", "items", "rules"])
862
- ]),
863
- s("div", oo, [
864
- s("div", no, P(e(y)("connect.store.setting.stripe.title")), 1),
865
- i(zt, {
866
- "model-value": (he = e(n)) == null ? void 0 : he.stripe,
867
- "onUpdate:modelValue": d[13] || (d[13] = (V) => e(n).stripe = V)
868
- }, null, 8, ["model-value"])
869
- ])
870
- ])) : L("", !0)
871
- ];
872
- }),
873
- _: 1
874
- }, 8, ["modelValue", "header"]);
875
- };
876
- }
877
- });
878
- function lo(b, x = !0) {
879
- return H.DineroFactory(b).toFormat(x);
880
- }
881
- const io = /* @__PURE__ */ te({
882
- __name: "TaxVariantSetting",
883
- props: {
884
- modelValue: {
885
- type: Array,
886
- required: !0,
887
- default: () => []
888
- }
889
- },
890
- emits: ["update:modelValue"],
891
- setup(b, { emit: x }) {
892
- const o = b, y = x;
893
- Te(() => {
894
- if (n.value.length !== h.value.length) {
895
- const t = h.value.reduce((r, f) => {
896
- const u = ee.systemDefaultCode(f.name);
897
- if (!u) return r;
898
- const { systemCode: w, taxCode: d } = u;
899
- return f.value || r.push({ systemCode: w, taxCode: d }), r;
900
- }, []);
901
- l(t);
902
- }
903
- });
904
- function c() {
905
- return ee.groupedTaxOptions();
906
- }
907
- const h = O(() => c().map((t) => ({
908
- name: t.code,
909
- value: (n.value || []).find(
910
- (r) => t.options.some((f) => f.feedmeTaxCode === r)
911
- ),
912
- options: t.options.map((r) => ({
913
- label: `${r.name} (${vt(r.rate)}%)`,
914
- value: r.feedmeTaxCode
915
- }))
916
- }))), n = O(() => o.modelValue.map((t) => ee.generateCode(t)));
917
- function m(t) {
918
- const r = c().find(
919
- (d) => d.options.some(($) => $.feedmeTaxCode === t)
920
- ), f = r == null ? void 0 : r.options.find((d) => d.feedmeTaxCode === t);
921
- if (!f) return;
922
- const { systemCode: u, taxCode: w } = f;
923
- l([{ systemCode: u, taxCode: w }]);
924
- }
925
- function l(t) {
926
- const r = ue.clone(o.modelValue);
927
- t.forEach((f) => {
928
- const u = c().find(
929
- ($) => $.options.some((T) => T.feedmeTaxCode === ee.generateCode(f))
930
- ), w = (u == null ? void 0 : u.options) || [], d = r.findIndex(
931
- ($) => w.some((T) => ee.generateCode(T) === ee.generateCode($))
932
- );
933
- d >= 0 ? r.splice(d, 1, f) : r.push(f);
934
- }), y("update:modelValue", r);
935
- }
936
- return (t, r) => {
937
- const f = v("FmRadio"), u = v("FmRadioGroup");
938
- return p(!0), U(J, null, me(e(h), (w) => (p(), U("div", {
939
- key: w.name,
940
- class: "flex items-start"
941
- }, [
942
- i(u, {
943
- modelValue: w.value,
944
- "onUpdate:modelValue": [
945
- (d) => w.value = d,
946
- r[0] || (r[0] = (d) => {
947
- m(d);
948
- })
949
- ]
950
- }, {
951
- default: I(() => [
952
- (p(!0), U(J, null, me(w.options, (d, $) => (p(), D(f, {
953
- key: $,
954
- value: d.value,
955
- label: d.label
956
- }, null, 8, ["value", "label"]))), 128))
957
- ]),
958
- _: 2
959
- }, 1032, ["modelValue", "onUpdate:modelValue"])
960
- ]))), 128);
961
- };
962
- }
963
- }), Me = {
964
- get _id() {
965
- return (/* @__PURE__ */ new Date()).toISOString();
966
- },
967
- name: "",
968
- price: H.Dinero.zero().toObject(),
969
- originalPrice: H.Dinero.zero().toObject(),
970
- vouchers: [],
971
- credit: {
972
- normal: 0,
973
- free: {
974
- amount: 0,
975
- day: 0
976
- }
977
- },
978
- config: {
979
- options: {}
980
- },
981
- titles: [],
982
- taxes: [],
983
- taxTotals: [],
984
- internal: !1,
985
- priceWithTaxes: gt()
986
- }, ro = {
987
- key: 0,
988
- class: "space-y-24 pr-12"
989
- }, co = { class: "space-y-8" }, uo = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, mo = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, po = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, fo = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, yo = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, go = { class: "space-y-8" }, bo = { class: "flex items-center justify-between" }, vo = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, ho = { class: "space-y-8" }, xo = { class: "flex items-center gap-8" }, _o = /* @__PURE__ */ te({
990
- __name: "EditBundleSheet",
991
- emits: ["update"],
992
- setup(b, { expose: x, emit: o }) {
993
- const y = o, { t: c } = Se(), h = Oe(), n = j(!1), m = j([]), l = j({
994
- category: 0,
995
- index: -1,
996
- originalCategoryIndex: void 0
997
- }), t = j(ue.cloneDeep(Me)), r = j(), f = Le, u = O(() => {
998
- const _ = f.safeParse(t.value);
999
- return _.success ? [] : _.error.errors;
1000
- }), w = [
1001
- {
1002
- header: "Reward title",
1003
- accessorFn: (_) => _.collectible.name,
1004
- enableSorting: !0
1005
- },
1006
- {
1007
- id: "type",
1008
- header: "Reward type",
1009
- accessorFn: (_) => _.collectible.type,
1010
- cell(_) {
1011
- return $e[_.row.original.collectible.type].chip();
1012
- }
1013
- },
1014
- {
1015
- header: "Description",
1016
- accessorFn: (_) => _.description,
1017
- cell(_) {
1018
- var F;
1019
- const a = _.row.original;
1020
- return a.collectible.type == "VOUCHER" || a.selectedReward == null ? a.description : et(at.FmStepperField, {
1021
- "onUpdate:modelValue": (N) => {
1022
- t.value.titles = t.value.titles.map(
1023
- (z) => z.id == a.collectible._id ? { ...z, dayToExpire: N } : z
1024
- );
1025
- },
1026
- modelValue: ((F = a.selectedReward) == null ? void 0 : F.extra) ?? 0,
1027
- appendText: "day(s)",
1028
- helperState: se(u.value, "titles"),
1029
- helperText: le(u.value, "titles"),
1030
- max: 9999,
1031
- rules: [(N) => N <= 9999 || "Maximum 9999 days allowed"],
1032
- showSteppers: !1,
1033
- disabled: !!t.value.stripePriceId
1034
- });
1035
- }
1036
- }
1037
- ], d = j([]), $ = O(() => {
1038
- var a;
1039
- const _ = (a = t.value) != null && a.isFeedvibe ? "STORE_BUNDLE:FEEDVIBE" : "STORE_BUNDLE:DEFAULT";
1040
- return h.bundleRewards.filter((F) => {
1041
- var N;
1042
- return (N = t.value) != null && N.isFeedvibe && F.type !== "VOUCHER" ? !1 : ht(F.capabilities, _);
1043
- }).map((F) => {
1044
- const N = T.value.find((Q) => Q.id == F._id), z = F.type === "VOUCHER" ? `${F.options.maxUse} use(s), ${xt(
1045
- F.options.validityOption || {}
1046
- )}` : "No expiry";
1047
- return {
1048
- collectible: F,
1049
- description: z,
1050
- selectedReward: N
1051
- };
1052
- });
1053
- }), T = O(() => {
1054
- var _, a;
1055
- return [
1056
- ...((_ = t.value) == null ? void 0 : _.titles.map((F) => ({
1057
- id: F.id,
1058
- extra: F.dayToExpire
1059
- }))) ?? [],
1060
- ...((a = t.value) == null ? void 0 : a.vouchers.map((F) => ({
1061
- id: F,
1062
- extra: void 0
1063
- }))) ?? []
1064
- ];
1065
- }), E = O(
1066
- () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
1067
- );
1068
- function X(_) {
1069
- t.value.subscriptionValidity = _;
1070
- for (const a of t.value.titles)
1071
- a.dayToExpire = _;
1072
- t.value.credit.free && (t.value.credit.free.day = _);
1073
- }
1074
- function ae() {
1075
- const _ = $.value, a = t.value;
1076
- if (!(!a || !_))
1077
- for (let F = 0; F < _.length; F++) {
1078
- const N = _[F];
1079
- Z.value[F] ? N.collectible.type == "TITLE" ? a.titles.findIndex(
1080
- (q) => q.id == N.collectible._id
1081
- ) < 0 && a.titles.push({
1082
- id: N.collectible._id,
1083
- dayToExpire: E.value
1084
- }) : a.vouchers.findIndex(
1085
- (q) => q == N.collectible._id
1086
- ) < 0 && a.vouchers.push(N.collectible._id) : (a.titles = a.titles.filter((Q) => Q.id != N.collectible._id), a.vouchers = a.vouchers.filter(
1087
- (Q) => Q != N.collectible._id
1088
- ));
1089
- }
1090
- }
1091
- const Z = j({});
1092
- Ae(Z, ae, { deep: !0 });
1093
- const ie = O(() => {
1094
- var _, a;
1095
- return (a = (_ = h.storeOption) == null ? void 0 : _.company) == null ? void 0 : a.sstRegNo;
1096
- }), he = O(() => {
1097
- var _, a, F;
1098
- return (F = (a = (_ = h.storeOption) == null ? void 0 : _.inclusiveTaxes) == null ? void 0 : a[0]) != null && F.inclusive ? "Inclusive" : "Exclusive";
1099
- }), V = O(() => {
1100
- var _, a, F;
1101
- return Ye(
1102
- ee.fullTax,
1103
- Qe(t.value.taxes),
1104
- t.value.price,
1105
- Number(t.value.credit.normal),
1106
- ((_ = h.storeOption) == null ? void 0 : _.inclusiveTaxes) ?? [],
1107
- (F = (a = h.storeOption) == null ? void 0 : a.company) != null && F.sstRegNo ? ee.taxSystem.map((N) => N.code) : []
1108
- );
1109
- }), de = O(() => V.value.reduce(
1110
- (a, F) => a.add(F.total),
1111
- bt()
1112
- ).toFormat()), pe = O(() => {
1113
- var N;
1114
- const _ = Je(
1115
- V.value,
1116
- t.value.price,
1117
- ((N = h.storeOption) == null ? void 0 : N.inclusiveTaxes) ?? []
1118
- );
1119
- t.value.priceWithTaxes = _;
1120
- const a = lo(_, !1), F = Number(a.replace(/[^\d.-]/g, ""));
1121
- return Number.isNaN(F) ? 0 : F;
1122
- });
1123
- function Fe() {
1124
- t.value.taxTotals = V.value, y("update", Le.parse(dt(t.value)));
1125
- }
1126
- function G() {
1127
- return ue.cloneDeep(Me);
1128
- }
1129
- function _e(_, a) {
1130
- n.value = _, _ && a && (r.value = void 0, m.value = a.categories, t.value = a.bundle || G(), l.value.category = a.category, l.value.index = a.index, l.value.originalCategoryIndex = a.category, Z.value = $.value.reduce((F, N, z) => (F[z] = !!N.selectedReward, F), {}));
1131
- }
1132
- return x({
1133
- showSheet: _e,
1134
- bundleImage: r,
1135
- target: l,
1136
- data: t
1137
- }), (_, a) => {
1138
- const F = v("FmSwitch"), N = v("FmHelperText"), z = v("FmTextField"), Q = v("FmSelect"), q = v("FmStepperField"), fe = v("FmMenuItem"), we = v("FmTable"), g = v("FmButton"), C = v("FmSideSheet");
1139
- return p(), D(C, {
1140
- "max-width": 768,
1141
- modelValue: e(n),
1142
- "onUpdate:modelValue": a[21] || (a[21] = (R) => ve(n) ? n.value = R : null),
1143
- header: e(l).index != -1 ? e(c)("connect.store.bundle.edit.title") : e(c)("connect.store.bundle.edit.create")
1144
- }, {
1145
- "side-sheet-footer": I(() => [
1146
- s("div", xo, [
1147
- i(g, {
1148
- label: e(l).index != -1 ? "Save" : "Add",
1149
- onClick: Fe,
1150
- disabled: e(u).length > 0,
1151
- loading: e(Ue)().isLoading
1152
- }, null, 8, ["label", "disabled", "loading"]),
1153
- i(g, {
1154
- label: "Cancel",
1155
- onClick: a[20] || (a[20] = (R) => _e(!1)),
1156
- variant: "tertiary"
1157
- })
1158
- ])
1159
- ]),
1160
- default: I(() => {
1161
- var R, B, M, k, K, A, W, oe, Y, ne;
1162
- return [
1163
- i(Ee, { json: e(t) }, null, 8, ["json"]),
1164
- e(t) ? (p(), U("div", ro, [
1165
- s("div", co, [
1166
- e(H.Config).getCountry().code == "MY" && ((R = e(h).payoutAccount) == null ? void 0 : R.status) == "APPROVED" && ((B = e(h).payoutAccount) != null && B.enable) ? (p(), D(F, {
1167
- key: 0,
1168
- "onUpdate:modelValue": a[0] || (a[0] = (S) => {
1169
- e(t).isFeedvibe = S, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], Z.value = {}, e(t).hideInPos = !0, e(t).internal = !0);
1170
- }),
1171
- "label-placement": "right",
1172
- "model-value": e(t).isFeedvibe || !1,
1173
- label: "Feedvibe Campaign",
1174
- sublabel: "Bundle will be appear for Feedvibe campaign use"
1175
- }, null, 8, ["model-value"])) : L("", !0),
1176
- e(t).isFeedvibe ? (p(), D(N, {
1177
- key: 1,
1178
- 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.",
1179
- state: "warning"
1180
- })) : L("", !0)
1181
- ]),
1182
- s("div", uo, P(e(c)("connect.store.bundle.edit.basicInformation")), 1),
1183
- i(z, {
1184
- label: e(c)("connect.store.bundle.edit.bundleName"),
1185
- modelValue: e(t).name,
1186
- "onUpdate:modelValue": a[1] || (a[1] = (S) => e(t).name = S),
1187
- "helper-state": e(se)(e(u), "name"),
1188
- "helper-text": e(le)(e(u), "name")
1189
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1190
- i(Q, {
1191
- modelValue: e(l).category,
1192
- "onUpdate:modelValue": a[2] || (a[2] = (S) => e(l).category = S),
1193
- label: "Store Category",
1194
- items: e(m).map((S, Xe) => ({ label: S, value: Xe }))
1195
- }, null, 8, ["modelValue", "items"]),
1196
- i(ft, {
1197
- label: e(c)("connect.store.bundle.edit.bundleImage"),
1198
- class: "w-1/2 xs:w-2/3",
1199
- "aspect-ratio": "16/9",
1200
- thumbnail: e(t).image ?? void 0,
1201
- file: e(r) ?? void 0,
1202
- "onUpdate:file": a[3] || (a[3] = (S) => {
1203
- r.value = S;
1204
- }),
1205
- "helper-state": e(se)(e(u), "image"),
1206
- "helper-text": e(le)(e(u), "image")
1207
- }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1208
- i(q, {
1209
- "model-value": e(H.Dinero).fromFdoDinero(e(t).price).toUnit(),
1210
- label: e(c)("connect.store.bundle.edit.bundlePrice"),
1211
- min: 0,
1212
- "max-fraction-digits": 2,
1213
- "onUpdate:modelValue": a[4] || (a[4] = (S) => {
1214
- e(t).price.amount = S * 10 ** e(t).price.precision;
1215
- }),
1216
- "is-currency": !0,
1217
- "show-steppers": !1,
1218
- "helper-text": e(le)(e(u), "price") || `${e(H.Dinero).fromNumber({ number: 1 }).toFormat(
1219
- !0
1220
- )} = ${e(H.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1221
- "helper-state": e(se)(e(u), "price")
1222
- }, {
1223
- prepend: I(() => [
1224
- be(P(e(H.Dinero).defaultCurrency()), 1)
1225
- ]),
1226
- _: 1
1227
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1228
- i(q, {
1229
- "model-value": e(H.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1230
- label: e(c)("connect.store.bundle.edit.bundleValue"),
1231
- min: 0,
1232
- "max-fraction-digits": 2,
1233
- "onUpdate:modelValue": a[5] || (a[5] = (S) => {
1234
- e(t).originalPrice || (e(t).originalPrice = e(H.Dinero).zero().toObject()), e(t).originalPrice.amount = S * 10 ** e(t).originalPrice.precision;
1235
- }),
1236
- "is-currency": !0,
1237
- "show-steppers": !1,
1238
- "helper-text": e(le)(e(u), "originalPrice") || e(c)("connect.store.bundle.edit.originalPriceHelper"),
1239
- "helper-state": e(se)(e(u), "originalPrice")
1240
- }, {
1241
- prepend: I(() => [
1242
- be(P(e(H.Dinero).defaultCurrency()), 1)
1243
- ]),
1244
- _: 1
1245
- }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1246
- e(t).isFeedvibe ? L("", !0) : (p(), D(q, {
1247
- key: 0,
1248
- "model-value": e(t).coinPrice ?? null,
1249
- label: e(c)("connect.store.bundle.edit.pointNeeded"),
1250
- min: 0,
1251
- "onUpdate:modelValue": a[6] || (a[6] = (S) => {
1252
- S > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = S;
1253
- }),
1254
- "show-steppers": !1,
1255
- "helper-state": e(se)(e(u), "coinPrice"),
1256
- "helper-text": e(le)(e(u), "coinPrice")
1257
- }, {
1258
- append: I(() => [...a[22] || (a[22] = [
1259
- be(" point(s) ", -1)
1260
- ])]),
1261
- _: 1
1262
- }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1263
- (M = e(h).storeOption) != null && M.stripe && !e(t).isFeedvibe ? (p(), U(J, { key: 1 }, [
1264
- s("div", mo, P(e(c)("connect.store.bundle.edit.subscriptionSettings")), 1),
1265
- i(z, {
1266
- label: e(c)("connect.store.bundle.edit.stripePriceId"),
1267
- modelValue: e(t).stripePriceId,
1268
- "onUpdate:modelValue": a[7] || (a[7] = (S) => e(t).stripePriceId = S),
1269
- "helper-state": e(se)(e(u), "stripePriceId"),
1270
- "helper-text": e(le)(e(u), "stripePriceId")
1271
- }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1272
- e(t).stripePriceId ? (p(), D(q, {
1273
- key: 0,
1274
- "model-value": e(t).subscriptionValidity ?? null,
1275
- min: 1,
1276
- "onUpdate:modelValue": X,
1277
- label: e(c)("connect.store.bundle.edit.subscriptionValidity"),
1278
- "show-steppers": !1,
1279
- "helper-state": e(se)(e(u), "subscriptionValidity"),
1280
- "helper-text": e(le)(e(u), "subscriptionValidity")
1281
- }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : L("", !0)
1282
- ], 64)) : L("", !0),
1283
- e(t).isFeedvibe ? L("", !0) : (p(), U(J, { key: 2 }, [
1284
- s("div", po, P(e(c)("connect.store.bundle.edit.credit")), 1),
1285
- i(q, {
1286
- modelValue: e(t).credit.normal,
1287
- "onUpdate:modelValue": a[8] || (a[8] = (S) => e(t).credit.normal = S),
1288
- label: e(c)("connect.store.bundle.edit.normalCredit"),
1289
- "show-steppers": !1,
1290
- "helper-state": e(se)(e(u), "credit.normal"),
1291
- "helper-text": e(le)(e(u), "credit.normal")
1292
- }, {
1293
- append: I(() => [...a[23] || (a[23] = [
1294
- be(" credit ", -1)
1295
- ])]),
1296
- _: 1
1297
- }, 8, ["modelValue", "label", "helper-state", "helper-text"]),
1298
- i(q, {
1299
- "model-value": ((k = e(t).credit.free) == null ? void 0 : k.amount) ?? null,
1300
- min: 0,
1301
- "onUpdate:modelValue": a[9] || (a[9] = (S) => {
1302
- e(t).credit.free || (e(t).credit.free = {
1303
- amount: 0,
1304
- day: 1
1305
- }), e(t).credit.free.amount = S;
1306
- }),
1307
- label: e(c)("connect.store.bundle.edit.freeCredit"),
1308
- "show-steppers": !1,
1309
- "helper-state": e(se)(e(u), "credit.free.amount"),
1310
- "helper-text": e(le)(e(u), "credit.free.amount")
1311
- }, {
1312
- append: I(() => [...a[24] || (a[24] = [
1313
- be(" credit ", -1)
1314
- ])]),
1315
- _: 1
1316
- }, 8, ["model-value", "label", "helper-state", "helper-text"]),
1317
- (K = e(t).credit.free) != null && K.amount ? (p(), D(q, {
1318
- key: 0,
1319
- disabled: !!e(t).stripePriceId,
1320
- "model-value": ((A = e(t).credit.free) == null ? void 0 : A.day) ?? null,
1321
- min: 0,
1322
- "onUpdate:modelValue": a[10] || (a[10] = (S) => {
1323
- e(t).credit.free || (e(t).credit.free = {
1324
- amount: 0,
1325
- day: 1
1326
- }), e(t).credit.free.day = e(E) || S;
1327
- }),
1328
- label: "Free credit valid for",
1329
- "show-steppers": !1,
1330
- "helper-state": e(se)(e(u), "credit.free.day"),
1331
- "helper-text": e(le)(e(u), "credit.free.day")
1332
- }, {
1333
- append: I(() => [...a[25] || (a[25] = [
1334
- be(" day(s) ", -1)
1335
- ])]),
1336
- _: 1
1337
- }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : L("", !0)
1338
- ], 64)),
1339
- e(ie) ? (p(), U(J, { key: 3 }, [
1340
- a[26] || (a[26] = s("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1341
- i(io, {
1342
- modelValue: e(t).taxes,
1343
- "onUpdate:modelValue": a[11] || (a[11] = (S) => e(t).taxes = S)
1344
- }, null, 8, ["modelValue"]),
1345
- i(z, {
1346
- label: `Tax Charged (${e(he)})`,
1347
- "model-value": e(de),
1348
- disabled: ""
1349
- }, null, 8, ["label", "model-value"])
1350
- ], 64)) : L("", !0),
1351
- i(q, {
1352
- label: "Total Price",
1353
- "model-value": e(pe),
1354
- disabled: !0
1355
- }, null, 8, ["model-value"]),
1356
- s("div", fo, P(e(c)("connect.store.bundle.edit.bundleReward.title")), 1),
1357
- s("div", yo, P(e(c)("connect.store.bundle.edit.bundleReward.description")), 1),
1358
- s("div", go, [
1359
- s("div", bo, [
1360
- i(yt, {
1361
- label: `Reward type: ${e(d).length == 0 ? "All" : e(d)[0].name}`
1362
- }, {
1363
- default: I(() => [
1364
- i(fe, {
1365
- onClick: a[12] || (a[12] = (S) => d.value = []),
1366
- label: "All"
1367
- }),
1368
- i(fe, {
1369
- onClick: a[13] || (a[13] = (S) => d.value = [
1370
- {
1371
- id: "type",
1372
- value: "VOUCHER",
1373
- name: e($e).VOUCHER.name
1374
- }
1375
- ]),
1376
- label: e($e).VOUCHER.name
1377
- }, null, 8, ["label"]),
1378
- i(fe, {
1379
- onClick: a[14] || (a[14] = (S) => d.value = [
1380
- {
1381
- id: "type",
1382
- value: "TITLE",
1383
- name: e($e).TITLE.name
1384
- }
1385
- ]),
1386
- label: e($e).TITLE.name
1387
- }, null, 8, ["label"])
1388
- ]),
1389
- _: 1
1390
- }, 8, ["label"])
1391
- ]),
1392
- i(we, {
1393
- modelValue: e(Z),
1394
- "onUpdate:modelValue": a[15] || (a[15] = (S) => ve(Z) ? Z.value = S : null),
1395
- selection: "multiple",
1396
- "column-filter": e(d),
1397
- "column-defs": w,
1398
- "row-data": e($),
1399
- "hide-footer": e($).length <= 10
1400
- }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1401
- i(N, {
1402
- text: e(le)(e(u), "titles"),
1403
- state: e(se)(e(u), "titles")
1404
- }, null, 8, ["text", "state"])
1405
- ]),
1406
- s("div", vo, P(e(c)("connect.store.bundle.edit.advanceSetting")), 1),
1407
- s("div", ho, [
1408
- e(t).isFeedvibe ? L("", !0) : (p(), U(J, { key: 0 }, [
1409
- i(F, {
1410
- "model-value": e(t).internal ?? !1,
1411
- "onUpdate:modelValue": a[16] || (a[16] = (S) => e(t).internal = S),
1412
- "label-placement": "right",
1413
- label: e(c)("connect.store.bundle.edit.internalBundle"),
1414
- sublabel: e(c)("connect.store.bundle.edit.internalBundleDescription")
1415
- }, null, 8, ["model-value", "label", "sublabel"]),
1416
- i(F, {
1417
- "model-value": e(t).hideInPos ?? !1,
1418
- "onUpdate:modelValue": a[17] || (a[17] = (S) => e(t).hideInPos = S),
1419
- "label-placement": "right",
1420
- label: e(c)("connect.store.bundle.edit.hideInPos"),
1421
- sublabel: e(c)("connect.store.bundle.edit.hideInPosDescription")
1422
- }, null, 8, ["model-value", "label", "sublabel"])
1423
- ], 64)),
1424
- i(q, {
1425
- "model-value": ((oe = (W = e(t).config) == null ? void 0 : W.options) == null ? void 0 : oe.maxPerUser) || null,
1426
- "onUpdate:modelValue": a[18] || (a[18] = (S) => e(ue).set(e(t), "config.options.maxPerUser", S)),
1427
- label: e(c)("connect.store.bundle.edit.maxPerUser"),
1428
- "show-steppers": !1,
1429
- placeholder: e(c)("connect.store.bundle.edit.unlimited")
1430
- }, null, 8, ["model-value", "label", "placeholder"]),
1431
- i(q, {
1432
- "model-value": ((ne = (Y = e(t).config) == null ? void 0 : Y.options) == null ? void 0 : ne.maxReceive) || null,
1433
- "onUpdate:modelValue": a[19] || (a[19] = (S) => e(ue).set(e(t), "config.options.maxReceive", S)),
1434
- label: e(c)("connect.store.bundle.edit.maxReceive"),
1435
- "show-steppers": !1,
1436
- placeholder: e(c)("connect.store.bundle.edit.unlimited")
1437
- }, null, 8, ["model-value", "label", "placeholder"])
1438
- ])
1439
- ])) : L("", !0)
1440
- ];
1441
- }),
1442
- _: 1
1443
- }, 8, ["modelValue", "header"]);
1444
- };
1445
- }
1446
- }), Co = { class: "flex gap-8 items-center flex-wrap" }, So = { class: "flex items-center gap-8" }, Fo = /* @__PURE__ */ te({
1447
- __name: "SendBundleSheet",
1448
- emits: ["success"],
1449
- setup(b, { expose: x, emit: o }) {
1450
- const { minor: y } = ze, c = j(), h = j(""), n = j(""), m = j([]), l = j(!1), t = j();
1451
- j(!0);
1452
- function r($) {
1453
- l.value = !0, h.value = null, n.value = "", c.value = $.bundle;
1454
- }
1455
- function f() {
1456
- l.value = !1;
1457
- }
1458
- async function u($) {
1459
- const T = await _t.read({
1460
- limit: 25,
1461
- skip: 0,
1462
- sortBy: "_id",
1463
- search: $,
1464
- descending: !1
1465
- });
1466
- m.value = T.resources.map((E) => ({
1467
- label: `${E.name} (${E.phoneNumber})`,
1468
- value: E._id
1469
- })), await new Promise((E) => setTimeout(E, 100));
1470
- }
1471
- async function w() {
1472
- if (!c.value || !h.value) return;
1473
- const $ = m.value.find(
1474
- (E) => E.value === h.value
1475
- );
1476
- await Ce.confirm(
1477
- `Are you sure you want to send bundle ${c.value.name} to ${$ == null ? void 0 : $.label}?`,
1478
- "Confirm",
1479
- "Confirm",
1480
- "Cancel"
1481
- ) && await y(
1482
- async () => {
1483
- const E = {
1484
- bundle: c.value._id,
1485
- member: h.value,
1486
- source: rt.enum.ADMIN,
1487
- ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${n.value}`,
1488
- withCoin: !1
1489
- };
1490
- await ke.sendBundle(E), f();
1491
- },
1492
- {
1493
- message: "Sending bundle",
1494
- successMessage: "Bundle sent"
1495
- }
1496
- );
1497
- }
1498
- const d = O(() => {
1499
- var T, E, X;
1500
- const $ = [];
1501
- return ((T = c.value) == null ? void 0 : T.price.amount) > 0 && $.push(
1502
- `${H.Config.getCountry().currency.symbol}${We((E = c.value) == null ? void 0 : E.price)}`
1503
- ), (X = c.value) != null && X.coinPrice && $.push(`${c.value.coinPrice} point(s)`), $.join(" or ");
1504
- });
1505
- return x({
1506
- showSheet: r,
1507
- hideSheet: f
1508
- }), Te(async () => {
1509
- await u("");
1510
- }), ($, T) => {
1511
- const E = v("FmCardMedia"), X = v("FmCardHeader"), ae = v("FmChip"), Z = v("FmCardSection"), ie = v("FmCard"), he = v("FmSelect"), V = v("FmTextField"), de = v("FmForm"), pe = v("FmButton"), Fe = v("FmSideSheet");
1512
- return p(), D(Fe, {
1513
- "max-width": 560,
1514
- "dismiss-away": !0,
1515
- header: "Send bundle to member",
1516
- modelValue: e(l),
1517
- "onUpdate:modelValue": [
1518
- T[4] || (T[4] = (G) => ve(l) ? l.value = G : null),
1519
- T[5] || (T[5] = (G) => l.value = G)
1520
- ]
1521
- }, {
1522
- "side-sheet-footer": I(() => [
1523
- s("div", So, [
1524
- i(pe, {
1525
- label: "Send",
1526
- loading: e(Ue)().isLoading,
1527
- onClick: T[2] || (T[2] = async () => {
1528
- var G;
1529
- return (G = e(t)) == null ? void 0 : G.validateInputs();
1530
- })
1531
- }, null, 8, ["loading"]),
1532
- i(pe, {
1533
- label: "Cancel",
1534
- type: "button",
1535
- variant: "tertiary",
1536
- onClick: T[3] || (T[3] = (G) => l.value = !1)
1537
- })
1538
- ])
1539
- ]),
1540
- default: I(() => [
1541
- i(de, {
1542
- class: "space-y-16",
1543
- ref_key: "form",
1544
- ref: t,
1545
- onValidationSuccess: w,
1546
- blameFormChildOnValidationFailed: ""
1547
- }, {
1548
- default: I(() => [
1549
- i(ie, {
1550
- class: "max-w-[700px]",
1551
- horizontal: "",
1552
- variant: "outlined"
1553
- }, {
1554
- default: I(() => {
1555
- var G, _e;
1556
- return [
1557
- (G = e(c)) != null && G.image ? (p(), D(E, {
1558
- key: 0,
1559
- width: "100",
1560
- src: (_e = e(c)) == null ? void 0 : _e.image
1561
- }, null, 8, ["src"])) : L("", !0),
1562
- i(Z, { class: "flex flex-col gap-16 justify-between" }, {
1563
- default: I(() => {
1564
- var _;
1565
- return [
1566
- i(X, {
1567
- class: "p-0",
1568
- title: (_ = e(c)) == null ? void 0 : _.name,
1569
- subtitle: e(d)
1570
- }, null, 8, ["title", "subtitle"]),
1571
- i(Z, { class: "p-0" }, {
1572
- default: I(() => {
1573
- var a, F, N, z, Q, q, fe, we, g, C, R;
1574
- return [
1575
- s("div", Co, [
1576
- (a = e(c)) != null && a.isFeedvibe ? (p(), D(ae, {
1577
- key: 0,
1578
- label: "Feedvibe"
1579
- })) : L("", !0),
1580
- (N = (F = e(c)) == null ? void 0 : F.titles) != null && N.length ? (p(), D(ae, {
1581
- key: 1,
1582
- label: `${e(c).titles.length} title(s)`
1583
- }, null, 8, ["label"])) : L("", !0),
1584
- (Q = (z = e(c)) == null ? void 0 : z.vouchers) != null && Q.length ? (p(), D(ae, {
1585
- key: 2,
1586
- label: `${e(c).vouchers.length} voucher(s)`
1587
- }, null, 8, ["label"])) : L("", !0),
1588
- (fe = (q = e(c)) == null ? void 0 : q.credit) != null && fe.normal || (C = (g = (we = e(c)) == null ? void 0 : we.credit) == null ? void 0 : g.free) != null && C.amount ? (p(), D(ae, {
1589
- key: 3,
1590
- label: `${(e(c).credit.normal || 0) + (((R = e(c).credit.free) == null ? void 0 : R.amount) || 0)} credit(s)`
1591
- }, null, 8, ["label"])) : L("", !0)
1592
- ])
1593
- ];
1594
- }),
1595
- _: 1
1596
- })
1597
- ];
1598
- }),
1599
- _: 1
1600
- })
1601
- ];
1602
- }),
1603
- _: 1
1604
- }),
1605
- i(he, {
1606
- modelValue: e(h),
1607
- "onUpdate:modelValue": T[0] || (T[0] = (G) => ve(h) ? h.value = G : null),
1608
- label: "Select member",
1609
- searchable: "",
1610
- items: e(m),
1611
- onSearch: u,
1612
- rules: [(G) => !!G > 0 || "Member is required"],
1613
- "helper-text": "Type to search member"
1614
- }, null, 8, ["modelValue", "items", "rules"]),
1615
- i(V, {
1616
- modelValue: e(n),
1617
- "onUpdate:modelValue": T[1] || (T[1] = (G) => ve(n) ? n.value = G : null),
1618
- label: "Reference (optional)",
1619
- rules: [
1620
- (G) => G.length < 50 || "Reference must be less than 50 characters"
1621
- ]
1622
- }, null, 8, ["modelValue", "rules"])
1623
- ]),
1624
- _: 1
1625
- }, 512)
1626
- ]),
1627
- _: 1
1628
- }, 8, ["modelValue"]);
1629
- };
1630
- }
1631
- });
1632
- async function je({
1633
- hasStoreCompany: b,
1634
- confirm: x,
1635
- showSettingSheet: o
1636
- }) {
1637
- return b ? !0 : (await x() && o(!0), !1);
1638
- }
1639
- const wo = { class: "flex items-center gap-8" }, $o = { class: "flex-shrink-0 -mr-8 -mt-8" }, Vo = ["title"], ko = ["src"], Po = { class: "relative flex items-center gap-8" }, To = { class: "font-mono tracking-[0.1em] fm-typo-en-body-sm-600 truncate" }, Ro = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Uo = {
1640
- key: 0,
1641
- class: "flex items-center gap-6"
1642
- }, Bo = "linear-gradient(135deg,#FF9455,#B25300)", Io = /* @__PURE__ */ te({
1643
- __name: "GiftCardProgramCard",
1644
- props: {
1645
- program: {},
1646
- disabled: { type: Boolean }
1647
- },
1648
- emits: ["edit", "setLive", "deactivate"],
1649
- setup(b, { emit: x }) {
1650
- const o = b, y = x, c = O(() => ct(o.program)), h = O(() => {
1651
- const { denominations: l, anyAmount: t } = c.value, r = [], f = [
1652
- ...l,
1653
- ...t ? [t.min, t.max] : []
1654
- ];
1655
- if (f.length) {
1656
- const u = Math.min(...f), w = Math.max(...f);
1657
- r.push(u === w ? `RM${u}` : `RM${u}–RM${w}`);
1658
- }
1659
- return t && r.push("Any amount"), r.join(" · ");
1660
- }), n = O(() => {
1661
- var l;
1662
- return ((l = o.program.designs) == null ? void 0 : l[0]) ?? null;
1663
- }), m = O(() => {
1664
- const l = o.program.numberFormat, t = (l == null ? void 0 : l.prefix) ?? "GC", r = Math.max(4, Math.min(Number((l == null ? void 0 : l.length) ?? 12), 16));
1665
- return `${t}${"•".repeat(r)}`;
1666
- });
1667
- return (l, t) => {
1668
- const r = v("FmChip"), f = v("FmButton"), u = v("FmMenuItem"), w = v("FmMenu"), d = v("FmIcon"), $ = v("FmCard");
1669
- return p(), D($, {
1670
- variant: "outlined",
1671
- class: "flex flex-col gap-y-12 p-16 h-full"
1672
- }, {
1673
- default: I(() => [
1674
- s("div", wo, [
1675
- i(r, {
1676
- label: "Gift card",
1677
- variant: "neutral",
1678
- compact: ""
1679
- }),
1680
- i(r, {
1681
- label: b.program.active ? "Live" : "Inactive",
1682
- variant: b.program.active ? "success" : "neutral",
1683
- compact: ""
1684
- }, null, 8, ["label", "variant"]),
1685
- t[4] || (t[4] = s("div", { class: "flex-1" }, null, -1)),
1686
- s("div", $o, [
1687
- i(w, { placement: "bottom-end" }, {
1688
- "menu-button": I(() => [
1689
- i(f, {
1690
- icon: "more_vert",
1691
- variant: "tertiary"
1692
- })
1693
- ]),
1694
- default: I(() => [
1695
- i(u, {
1696
- onClick: t[0] || (t[0] = (T) => y("edit")),
1697
- icon: "edit",
1698
- label: "Edit"
1699
- }),
1700
- b.program.active ? (p(), D(u, {
1701
- key: 1,
1702
- onClick: t[2] || (t[2] = (T) => y("deactivate")),
1703
- icon: "pause_circle",
1704
- label: "Set inactive"
1705
- })) : (p(), D(u, {
1706
- key: 0,
1707
- onClick: t[1] || (t[1] = (T) => y("setLive")),
1708
- icon: "check_circle",
1709
- label: "Set live"
1710
- }))
1711
- ]),
1712
- _: 1
1713
- })
1714
- ])
1715
- ]),
1716
- s("div", {
1717
- class: "fm-typo-en-body-lg-600 truncate",
1718
- title: b.program.name
1719
- }, P(b.program.name), 9, Vo),
1720
- s("div", {
1721
- class: "relative w-full aspect-[1.586/1] rounded-lg overflow-hidden flex flex-col p-12 text-fm-color-typo-white",
1722
- style: tt({ background: Bo })
1723
- }, [
1724
- e(n) ? (p(), U("img", {
1725
- key: 0,
1726
- src: e(n),
1727
- alt: "",
1728
- class: "absolute inset-0 w-full h-full object-cover"
1729
- }, null, 8, ko)) : L("", !0),
1730
- t[6] || (t[6] = s("div", { class: "relative flex items-start justify-between" }, [
1731
- s("span", { class: "fm-typo-en-body-md-600" }, "FeedMe"),
1732
- s("span", { class: "fm-typo-en-body-sm-600 uppercase tracking-[0.1em] opacity-90" }, " Gift Card ")
1733
- ], -1)),
1734
- t[7] || (t[7] = s("div", { class: "flex-1" }, null, -1)),
1735
- s("div", Po, [
1736
- t[5] || (t[5] = s("span", { class: "w-[28px] h-[20px] rounded-sm flex-none bg-gradient-to-br from-[#F4D479] to-[#C99B3B]" }, null, -1)),
1737
- s("span", To, P(e(m)), 1)
1738
- ])
1739
- ], 4),
1740
- s("div", Ro, P(e(h)), 1),
1741
- t[9] || (t[9] = s("div", { class: "flex-1" }, null, -1)),
1742
- b.program.active ? (p(), U("div", Uo, [
1743
- i(d, {
1744
- name: "check",
1745
- size: "sm",
1746
- class: "text-fm-color-system-success-400"
1747
- }),
1748
- t[8] || (t[8] = s("span", { class: "fm-typo-en-body-sm-600 text-fm-color-system-success-400" }, " Live to customers ", -1))
1749
- ])) : (p(), D(f, {
1750
- key: 1,
1751
- label: "Set live",
1752
- variant: "secondary",
1753
- size: "md",
1754
- disabled: b.disabled,
1755
- onClick: t[3] || (t[3] = (T) => y("setLive"))
1756
- }, null, 8, ["disabled"]))
1757
- ]),
1758
- _: 1
1759
- });
1760
- };
1761
- }
1762
- }), Do = { class: "rounded-lg border-1 border-fm-color-primary p-24 flex flex-col gap-16" }, No = { class: "flex items-start gap-16" }, Mo = { class: "w-40 h-40 rounded-md flex-none grid place-items-center bg-fm-color-primary" }, Ao = { class: "flex flex-col gap-4" }, Oo = { class: "fm-typo-en-body-lg-600" }, Eo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Lo = { class: "rounded-md border-1 border-fm-color-neutral-gray-200" }, jo = { class: "w-24 h-24 rounded-sm flex-none grid place-items-center bg-fm-color-primary-oats text-fm-color-primary fm-typo-en-body-sm-600" }, Ko = { class: "flex-1 min-w-0" }, Ho = { class: "fm-typo-en-body-md-600" }, Go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qo = { class: "px-8 py-4 rounded-sm bg-fm-color-primary-oats text-fm-color-primary fm-typo-en-body-sm-600 whitespace-nowrap" }, zo = /* @__PURE__ */ te({
1763
- __name: "StoreOnboarding",
1764
- props: {
1765
- hasStoreSetting: { type: Boolean },
1766
- hasPayoutAccount: { type: Boolean },
1767
- isPremium: { type: Boolean }
1768
- },
1769
- emits: ["setupStoreSetting", "setupPayout"],
1770
- setup(b, { emit: x }) {
1771
- const { t: o } = Se(), y = b, c = x, h = O(() => {
1772
- const n = [];
1773
- return y.isPremium && n.push({
1774
- key: "payout",
1775
- title: o("connect.store.onboarding.payoutTitle"),
1776
- description: o("connect.store.onboarding.payoutDescription"),
1777
- done: y.hasPayoutAccount,
1778
- action: "setupPayout"
1779
- }), n.push({
1780
- key: "setting",
1781
- title: o("connect.store.onboarding.settingTitle"),
1782
- description: o("connect.store.onboarding.settingDescription"),
1783
- done: y.hasStoreSetting,
1784
- action: "setupStoreSetting"
1785
- }), n;
1786
- });
1787
- return (n, m) => {
1788
- const l = v("FmIcon"), t = v("FmChip"), r = v("FmButton");
1789
- return p(), U("div", Do, [
1790
- s("div", No, [
1791
- s("span", Mo, [
1792
- i(l, {
1793
- name: "warning",
1794
- class: "text-fm-color-typo-white"
1795
- })
1796
- ]),
1797
- s("div", Ao, [
1798
- s("div", Oo, P(e(o)("connect.store.onboarding.title")), 1),
1799
- s("div", Eo, P(e(o)("connect.store.onboarding.description")), 1)
1800
- ])
1801
- ]),
1802
- s("div", Lo, [
1803
- (p(!0), U(J, null, me(e(h), (f, u) => (p(), U("div", {
1804
- key: f.key,
1805
- class: ot(["flex items-center gap-16 p-16", u > 0 ? "border-t-1 border-fm-color-neutral-gray-200" : ""])
1806
- }, [
1807
- s("span", jo, P(u + 1), 1),
1808
- s("div", Ko, [
1809
- s("div", Ho, P(f.title), 1),
1810
- s("div", Go, P(f.description), 1)
1811
- ]),
1812
- f.done ? (p(), D(t, {
1813
- key: 0,
1814
- label: e(o)("connect.store.onboarding.complete"),
1815
- variant: "success",
1816
- compact: ""
1817
- }, null, 8, ["label"])) : (p(), U(J, { key: 1 }, [
1818
- s("span", qo, P(e(o)("connect.store.onboarding.incomplete")), 1),
1819
- i(r, {
1820
- class: "flex-none",
1821
- label: e(o)("connect.store.onboarding.setupNow"),
1822
- variant: "primary",
1823
- onClick: (w) => f.action === "setupPayout" ? c("setupPayout") : c("setupStoreSetting")
1824
- }, null, 8, ["label", "onClick"])
1825
- ], 64))
1826
- ], 2))), 128))
1827
- ])
1828
- ]);
1829
- };
1830
- }
1831
- }), Wo = { class: "grid lg:grid-cols-2 gap-32 items-center" }, Yo = { class: "flex flex-col gap-16" }, Jo = { class: "self-start inline-flex items-center gap-4 px-8 py-4 rounded-sm bg-fm-color-secondary-blueberry text-fm-color-typo-white fm-typo-en-body-sm-600 uppercase tracking-[0.05em]" }, Xo = { class: "flex flex-col gap-8" }, Zo = { class: "fm-typo-en-title-md-800" }, Qo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary max-w-[460px]" }, en = { class: "flex flex-col gap-16" }, tn = { class: "w-40 h-40 rounded-md flex-none grid place-items-center bg-fm-color-primary-oats text-fm-color-primary" }, on = { class: "flex flex-col gap-2" }, nn = { class: "fm-typo-en-body-md-600" }, an = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, sn = { class: "flex items-center gap-16 pt-8" }, ln = { class: "relative rounded-lg overflow-hidden aspect-[4/3] flex items-end justify-center bg-gradient-to-br from-[#FFF3E6] to-[#FDE6D0]" }, rn = { class: "absolute inset-0 grid place-items-center" }, cn = { class: "relative w-[68%] max-w-[320px]" }, dn = { class: "relative w-full aspect-[1.586/1] rounded-lg p-16 flex flex-col justify-between text-fm-color-typo-white bg-gradient-to-br from-[#C98A4B] to-[#A96A2E] rotate-[-3deg]" }, un = { class: "flex flex-col" }, mn = { class: "fm-typo-en-body-sm-400 uppercase tracking-[0.12em] opacity-90" }, pn = /* @__PURE__ */ te({
1832
- __name: "GiftCardUpsell",
1833
- emits: ["upgrade", "comparePlans"],
1834
- setup(b, { emit: x }) {
1835
- const { t: o } = Se(), y = x, c = [
1836
- {
1837
- icon: "send",
1838
- title: "connect.store.giftCard.benefitGiftTitle",
1839
- description: "connect.store.giftCard.benefitGiftDescription"
1840
- },
1841
- {
1842
- icon: "bar_chart",
1843
- title: "connect.store.giftCard.benefitSalesTitle",
1844
- description: "connect.store.giftCard.benefitSalesDescription"
1845
- },
1846
- {
1847
- icon: "favorite",
1848
- title: "connect.store.giftCard.benefitLoyaltyTitle",
1849
- description: "connect.store.giftCard.benefitLoyaltyDescription"
1850
- }
1851
- ];
1852
- return (h, n) => {
1853
- const m = v("FmIcon"), l = v("FmButton"), t = v("FmCard");
1854
- return p(), D(t, {
1855
- variant: "outlined",
1856
- class: "p-24"
1857
- }, {
1858
- default: I(() => [
1859
- s("div", Wo, [
1860
- s("div", Yo, [
1861
- s("span", Jo, [
1862
- i(m, {
1863
- name: "stars",
1864
- size: "sm"
1865
- }),
1866
- be(" " + P(e(o)("connect.store.giftCard.premium")), 1)
1867
- ]),
1868
- s("div", Xo, [
1869
- s("div", Zo, P(e(o)("connect.store.giftCard.upsellTitle")), 1),
1870
- s("div", Qo, P(e(o)("connect.store.giftCard.upsellDescription")), 1)
1871
- ]),
1872
- s("div", en, [
1873
- (p(), U(J, null, me(c, (r) => s("div", {
1874
- key: r.icon,
1875
- class: "flex items-start gap-12"
1876
- }, [
1877
- s("span", tn, [
1878
- i(m, {
1879
- name: r.icon
1880
- }, null, 8, ["name"])
1881
- ]),
1882
- s("div", on, [
1883
- s("div", nn, P(e(o)(r.title)), 1),
1884
- s("div", an, P(e(o)(r.description)), 1)
1885
- ])
1886
- ])), 64))
1887
- ]),
1888
- s("div", sn, [
1889
- i(l, {
1890
- label: e(o)("connect.store.giftCard.upgrade"),
1891
- variant: "primary",
1892
- onClick: n[0] || (n[0] = (r) => y("upgrade"))
1893
- }, null, 8, ["label"]),
1894
- s("button", {
1895
- type: "button",
1896
- class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-typo-primary",
1897
- onClick: n[1] || (n[1] = (r) => y("comparePlans"))
1898
- }, [
1899
- be(P(e(o)("connect.store.giftCard.comparePlans")) + " ", 1),
1900
- i(m, {
1901
- name: "chevron_right",
1902
- size: "sm"
1903
- })
1904
- ])
1905
- ])
1906
- ]),
1907
- s("div", ln, [
1908
- s("div", rn, [
1909
- s("div", cn, [
1910
- n[5] || (n[5] = s("div", { class: "absolute -left-[14%] top-[6%] w-full aspect-[1.586/1] rounded-lg bg-gradient-to-br from-[#3A3A3C] to-[#1C1C1E] rotate-[-8deg]" }, null, -1)),
1911
- s("div", dn, [
1912
- n[4] || (n[4] = s("span", { class: "fm-typo-en-body-md-600" }, "FeedMe", -1)),
1913
- s("div", un, [
1914
- s("span", mn, P(e(o)("connect.store.giftCard.giftCardLabel")), 1),
1915
- n[3] || (n[3] = s("span", { class: "fm-typo-en-title-md-800" }, "RM100", -1))
1916
- ])
1917
- ])
1918
- ])
1919
- ]),
1920
- s("button", {
1921
- type: "button",
1922
- class: "relative mb-24 inline-flex items-center gap-8 px-16 py-8 rounded-full bg-fm-color-neutral-black text-fm-color-typo-white fm-typo-en-body-sm-600",
1923
- onClick: n[2] || (n[2] = (r) => y("upgrade"))
1924
- }, [
1925
- i(m, {
1926
- name: "lock",
1927
- size: "sm"
1928
- }),
1929
- be(" " + P(e(o)("connect.store.giftCard.unlockNow")), 1)
1930
- ])
1931
- ])
1932
- ])
1933
- ]),
1934
- _: 1
1935
- });
1936
- };
1937
- }
1938
- });
1939
- var Ke = { 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/" };
1940
- const fn = { class: "px-24 flex flex-col gap-y-16" }, yn = { class: "space-y-8 py-12" }, gn = { class: "flex gap-8 items-center" }, bn = { class: "fm-typo-en-body-lg-600" }, vn = { class: "px-8 py-2 rounded-sm bg-fm-color-primary-oats text-fm-color-primary fm-typo-en-body-sm-600" }, hn = {
1941
- key: 1,
1942
- class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
1943
- }, xn = {
1944
- key: 1,
1945
- class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24"
1946
- }, _n = { class: "flex gap-8 items-center" }, Cn = { 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" }, wn = { class: "fm-typo-en-title-sm-800" }, $n = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, sa = /* @__PURE__ */ te({
1947
- __name: "Store",
1948
- setup(b) {
1949
- const x = {
1950
- label: "Setup payout account",
1951
- value: "payout",
1952
- isPrimary: !1
1953
- }, { t: o } = Se(), y = {
1954
- label: o("connect.store.actions.setting"),
1955
- value: "setting",
1956
- isPrimary: !1
1957
- }, c = {
1958
- label: o("connect.store.actions.manageReward"),
1959
- value: "create_reward"
1960
- }, h = {
1961
- label: o("connect.store.actions.addCategory"),
1962
- value: "create_category",
1963
- isPrimary: !0,
1964
- prependIcon: "add"
1965
- }, n = j(), m = St(), l = Oe(), { global: t, minor: r } = ze, f = He(), u = O(() => l.sortedStoreCategories), w = O(() => l.sortedStoreCategories.map((g) => g.name)), d = j(), $ = j(), T = Ct(), E = j([]), X = O(() => T.isPremium), ae = O(() => {
1966
- var g;
1967
- return !!((g = l.storeOption) != null && g.company);
1968
- }), Z = O(
1969
- () => {
1970
- var g, C;
1971
- return ((g = l.payoutAccount) == null ? void 0 : g.status) === "APPROVED" && ((C = l.payoutAccount) == null ? void 0 : C.enable) === !0;
1972
- }
1973
- ), ie = O(
1974
- () => !ae.value || X.value && !Z.value
1975
- );
1976
- function he() {
1977
- window.open(
1978
- `${Ke.licensePortalUrl}business/${qe.businessId}/settings`,
1979
- "_blank"
1980
- );
1981
- }
1982
- function V() {
1983
- window.open("https://feedme.ai/pricing", "_blank", "noopener");
1984
- }
1985
- async function de() {
1986
- if (X.value)
1987
- try {
1988
- E.value = await Ne.readPrograms();
1989
- } catch {
1990
- E.value = [];
1991
- }
1992
- }
1993
- function pe() {
1994
- m.push({ name: Ie["$connect-STORE_GIFT_CARD_SETUP"] });
1995
- }
1996
- function Fe(g) {
1997
- m.push({
1998
- name: Ie["$connect-STORE_GIFT_CARD_SETUP"],
1999
- params: { id: String(g._id) }
2000
- });
2001
- }
2002
- async function G(g) {
2003
- await Ce.confirm(
2004
- `Set "${g.name}" live? Only one gift card can be live at a time, so any other will be set inactive.`,
2005
- "Set live",
2006
- "Set live",
2007
- "Cancel"
2008
- ) && await r(
2009
- async () => {
2010
- await Ne.activateProgram(String(g._id)), await de();
2011
- },
2012
- { message: "Setting live", successMessage: "Gift card is live" }
2013
- );
2014
- }
2015
- async function _e(g) {
2016
- await r(
2017
- async () => {
2018
- await Ne.deactivateProgram(String(g._id)), await de();
2019
- },
2020
- { message: "Updating gift card", successMessage: "Gift card set inactive" }
2021
- );
2022
- }
2023
- async function _(g) {
2024
- var C;
2025
- g === "setting" ? (C = d.value) == null || C.showSheet(!0, l.storeOption) : g === "create_category" ? z(-1) : g === "create_reward" ? await m.push({ name: Ie["$connect-STORE_REWARDS"] }) : g == "payout" && window.open(Ke.paymentPortalUrl, "_blank");
2026
- }
2027
- function a(g, C) {
2028
- var K;
2029
- const R = !!((K = C.company) != null && K.sstRegNo), B = C.inclusiveTaxes ?? [], M = ee.taxSystem.map((A) => A.code), k = R ? B.flatMap((A) => {
2030
- console.log(A, "inclusive tax");
2031
- const W = ee.systemDefaultCode(A.systemCode);
2032
- return W ? [{ systemCode: A.systemCode, taxCode: W.taxCode }] : [];
2033
- }) : [];
2034
- return console.log([
2035
- ["hasSstRegNo", R],
2036
- ["defaultTaxCodes", k],
2037
- ["inclusiveTaxes", B],
2038
- ["taxSystemCodes", M]
2039
- ]), g.map((A) => ({
2040
- ...A,
2041
- bundles: A.bundles.map((W) => {
2042
- const { pf_vouchers: oe, ...Y } = W;
2043
- if (!R)
2044
- return {
2045
- ...Y,
2046
- taxes: [],
2047
- taxTotals: [],
2048
- priceWithTaxes: { ...Y.price }
2049
- };
2050
- const ne = k, S = Ye(
2051
- ee.fullTax,
2052
- ne,
2053
- Y.price,
2054
- Number(Y.credit.normal),
2055
- B,
2056
- M
2057
- );
2058
- return {
2059
- ...Y,
2060
- taxes: ne,
2061
- taxTotals: S,
2062
- priceWithTaxes: Je(
2063
- S,
2064
- Y.price,
2065
- B
2066
- )
2067
- };
2068
- })
2069
- }));
2070
- }
2071
- async function F(g, C, R) {
2072
- const B = !R && !!C, M = !!R && !C;
2073
- let k;
2074
- if (B) {
2075
- const A = ee.taxSystem[0] ? ee.systemDefaultCode(ee.taxSystem[0].code) : void 0, W = A ? `${A.name} (${A.taxCode})` : o("connect.store.taxPropagation.defaultTax");
2076
- k = o("connect.store.taxPropagation.addConfirm", {
2077
- taxCode: W
2078
- });
2079
- } else M ? k = o("connect.store.taxPropagation.removeConfirm") : k = o("connect.store.taxPropagation.updateConfirm");
2080
- await Ce.confirm(
2081
- k,
2082
- o("connect.store.taxPropagation.title"),
2083
- o("connect.store.taxPropagation.confirm"),
2084
- o("connect.common.cancel")
2085
- ) && await r(
2086
- async () => {
2087
- const A = Be(l.sortedStoreCategories), W = a(A, g);
2088
- await ke.updateStoreBundle({ categories: W }), await l.readMemberStore(), await l.readMembership(), await l.readRewards();
2089
- },
2090
- {
2091
- message: o("connect.store.taxPropagation.updating"),
2092
- successMessage: o("connect.store.taxPropagation.success")
2093
- }
2094
- );
2095
- }
2096
- async function N(g) {
2097
- var W, oe, Y, ne;
2098
- const C = ((oe = (W = l.storeOption) == null ? void 0 : W.company) == null ? void 0 : oe.sstRegNo) ?? "", R = ue.cloneDeep(
2099
- ((Y = l.storeOption) == null ? void 0 : Y.inclusiveTaxes) ?? []
2100
- ), B = ((ne = g.company) == null ? void 0 : ne.sstRegNo) ?? "";
2101
- await r(
2102
- async () => {
2103
- var S;
2104
- await ke.updateStore(g), await l.readMemberStore(), (S = d.value) == null || S.showSheet(!1);
2105
- },
2106
- {
2107
- message: o("connect.store.setting.update.message"),
2108
- successMessage: o("connect.store.setting.update.success")
2109
- }
2110
- );
2111
- const M = C !== B, k = !ue.isEqual(
2112
- R,
2113
- g.inclusiveTaxes ?? []
2114
- );
2115
- !(M || k) || l.sortedStoreCategories.flatMap(
2116
- (S) => S.bundles
2117
- ).length === 0 || await F(g, B, C);
2118
- }
2119
- async function z(g = -1) {
2120
- var R, B;
2121
- await je({
2122
- hasStoreCompany: !!((R = l.storeOption) != null && R.company),
2123
- confirm: () => Ce.confirm(
2124
- o("connect.store.category.setup.title"),
2125
- o("connect.store.category.setup.button"),
2126
- o("connect.store.category.setup.action"),
2127
- o("connect.common.cancel")
2128
- ),
2129
- showSettingSheet: (M) => {
2130
- var k;
2131
- return (k = d.value) == null ? void 0 : k.showSheet(M);
2132
- }
2133
- }) && f.open({
2134
- title: g == -1 ? o("connect.store.category.add") : o("connect.store.category.edit"),
2135
- contentComponent: At,
2136
- contentComponentProps: {
2137
- initialValue: ((B = u.value[g]) == null ? void 0 : B.name) ?? "",
2138
- action: g == -1 ? "add" : "edit"
2139
- }
2140
- }).onPrimary(async (M) => {
2141
- M === null && !await Ce.remove(
2142
- o("connect.store.category.remove.confirm"),
2143
- o("connect.store.category.remove.title")
2144
- ) || await r(
2145
- async () => {
2146
- const k = g == -1 ? [...u.value, { name: M, bundles: [] }] : [...u.value].map((K, A) => A == g ? { ...K, name: M } : K).filter((K) => K.name !== null);
2147
- await ke.updateStoreBundle({
2148
- categories: k
2149
- }), await l.readMemberStore();
2150
- },
2151
- {
2152
- message: M === null ? o("connect.store.category.update.deleting") : g == -1 ? o("connect.store.category.update.creating") : o("connect.store.category.update.updating"),
2153
- successMessage: M === null ? o("connect.store.category.update.success.deleted") : g == -1 ? o("connect.store.category.update.success.created") : o("connect.store.category.update.success.updated")
2154
- }
2155
- );
2156
- });
2157
- }
2158
- async function Q(g, C, R, B) {
2159
- var K, A, W;
2160
- C ?? (C = (K = $.value) == null ? void 0 : K.target.category), R ?? (R = (A = $.value) == null ? void 0 : A.target.index), B ?? (B = (W = $.value) == null ? void 0 : W.target.originalCategoryIndex);
2161
- const M = Be(u.value);
2162
- for (const oe of M)
2163
- for (const Y of oe.bundles)
2164
- console.log(Y, "bundle in payload"), "pf_vouchers" in Y && delete Y.pf_vouchers;
2165
- C != B && B != null && (M[B].bundles.splice(R, 1), R = M[C].bundles.length);
2166
- const k = M[C];
2167
- if (!k) {
2168
- mt.error("Unexpected error", 2e3);
2169
- return;
2170
- }
2171
- if (g == null) {
2172
- if (await Ce.remove(
2173
- o("connect.store.bundle.delete.confirm"),
2174
- o("connect.store.bundle.delete.title")
2175
- ) == !1)
2176
- return;
2177
- k.bundles.splice(R, 1);
2178
- } else
2179
- R == -1 ? k.bundles.push(g) : k.bundles[R] = g;
2180
- await r(
2181
- async () => {
2182
- var oe, Y;
2183
- if (g != null) {
2184
- const ne = (oe = $.value) == null ? void 0 : oe.bundleImage;
2185
- ne === null && g.image ? (await De.delete(g.image), g.image = null) : ne && (g.image = await De.update(
2186
- De.bundleImagePath(void 0, ne),
2187
- ne
2188
- ));
2189
- }
2190
- await ke.updateStoreBundle({
2191
- categories: M
2192
- }), await l.readMemberStore(), await l.readMembership(), await l.readRewards(), (Y = $.value) == null || Y.showSheet(!1);
2193
- },
2194
- {
2195
- message: `${g == null ? "Deleting" : R == -1 ? "Creating" : "Updating"} bundle`,
2196
- successMessage: `Bundle ${g == null ? "deleted" : R == -1 ? "created" : "updated"} successfully`
2197
- }
2198
- );
2199
- }
2200
- function q(g) {
2201
- var C;
2202
- je({
2203
- hasStoreCompany: !!((C = l.storeOption) != null && C.company),
2204
- confirm: () => Ce.confirm(
2205
- o("connect.store.category.setup.title"),
2206
- o("connect.store.category.setup.button"),
2207
- o("connect.store.category.setup.action"),
2208
- o("connect.common.cancel")
2209
- ),
2210
- showSettingSheet: (R) => {
2211
- var B;
2212
- return (B = d.value) == null ? void 0 : B.showSheet(R);
2213
- }
2214
- }).then((R) => {
2215
- var B;
2216
- R && ((B = $.value) == null || B.showSheet(!0, {
2217
- ...g,
2218
- bundle: g.bundle ? Be(g.bundle) : void 0
2219
- }));
2220
- });
2221
- }
2222
- const fe = j([]);
2223
- function we(g) {
2224
- var C;
2225
- (C = n.value) == null || C.showSheet({
2226
- bundle: g
2227
- });
2228
- }
2229
- return Te(async () => {
2230
- var C, R;
2231
- await t(async () => {
2232
- var B, M;
2233
- if (await l.readMemberStore(), await l.readMembership(), await l.readRewards(), await l.readPayoutAccount(), await T.readPremium(), await de(), (B = m.currentRoute.value.query) != null && B.action) {
2234
- switch ((M = m.currentRoute.value.query) == null ? void 0 : M.action) {
2235
- case "update_setting":
2236
- _("setting");
2237
- break;
2238
- case "create_category":
2239
- z(-1);
2240
- break;
2241
- case "create_feedvibe_bundle":
2242
- f.open({
2243
- title: "Select category",
2244
- contentComponent: Lt
2245
- }).onPrimary((k) => {
2246
- f.close(), q({
2247
- categories: w.value,
2248
- category: k,
2249
- index: -1,
2250
- bundle: {
2251
- ...ue.cloneDeep(Me),
2252
- isFeedvibe: !0,
2253
- price: H.Dinero.fromNumber({
2254
- number: 10,
2255
- precision: 2
2256
- }).toObject()
2257
- }
2258
- });
2259
- }).onTertiary(() => f.close());
2260
- break;
2261
- }
2262
- m.replace({ query: {} });
2263
- }
2264
- });
2265
- const g = ((C = l.payoutAccount) == null ? void 0 : C.status) === "APPROVED" && ((R = l.payoutAccount) == null ? void 0 : R.enable) === !0;
2266
- fe.value = [
2267
- ...g ? [] : [x],
2268
- y,
2269
- c,
2270
- h
2271
- ];
2272
- }), (g, C) => {
2273
- const R = v("FmPageHead"), B = v("FmButton"), M = v("FmCard");
2274
- return p(), U(J, null, [
2275
- i(R, {
2276
- title: e(o)("connect.store.title"),
2277
- actions: e(fe),
2278
- "onClick:action": _
2279
- }, null, 8, ["title", "actions"]),
2280
- s("div", fn, [
2281
- e(ie) ? (p(), D(zo, {
2282
- key: 0,
2283
- class: "mt-12",
2284
- "has-store-setting": e(ae),
2285
- "has-payout-account": e(Z),
2286
- "is-premium": e(X),
2287
- onSetupStoreSetting: C[0] || (C[0] = (k) => _("setting")),
2288
- onSetupPayout: C[1] || (C[1] = (k) => _("payout"))
2289
- }, null, 8, ["has-store-setting", "has-payout-account", "is-premium"])) : L("", !0),
2290
- s("div", yn, [
2291
- s("div", gn, [
2292
- s("div", bn, P(e(o)("connect.store.giftCard.title")), 1),
2293
- s("span", vn, P(e(o)("connect.store.giftCard.new")), 1),
2294
- e(X) && e(E).length ? (p(), D(B, {
2295
- key: 0,
2296
- icon: "edit",
2297
- size: "md",
2298
- variant: "tertiary",
2299
- onClick: C[2] || (C[2] = (k) => Fe(e(E)[0]))
2300
- })) : L("", !0),
2301
- C[4] || (C[4] = s("div", { class: "flex-1" }, null, -1)),
2302
- e(X) && e(E).length ? (p(), U("div", hn, P(e(o)("connect.store.giftCard.oneLiveHint")), 1)) : L("", !0)
2303
- ]),
2304
- e(X) ? (p(), U("div", xn, [
2305
- (p(!0), U(J, null, me(e(E), (k) => (p(), D(Io, {
2306
- key: String(k._id),
2307
- program: k,
2308
- onEdit: (K) => Fe(k),
2309
- onSetLive: (K) => G(k),
2310
- onDeactivate: (K) => _e(k)
2311
- }, null, 8, ["program", "onEdit", "onSetLive", "onDeactivate"]))), 128)),
2312
- i(M, {
2313
- variant: "outlined",
2314
- class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
2315
- }, {
2316
- default: I(() => [
2317
- i(B, {
2318
- label: e(o)("connect.store.giftCard.addGiftCard"),
2319
- icon: "add",
2320
- variant: "secondary",
2321
- onClick: pe
2322
- }, null, 8, ["label"])
2323
- ]),
2324
- _: 1
2325
- })
2326
- ])) : (p(), D(pn, {
2327
- key: 0,
2328
- onUpgrade: he,
2329
- onComparePlans: V
2330
- }))
2331
- ]),
2332
- e(u) && e(u).length > 0 ? (p(), U(J, { key: 1 }, [
2333
- (p(!0), U(J, null, me(e(u), (k, K) => (p(), U("div", {
2334
- key: k.name,
2335
- class: "space-y-8 py-12"
2336
- }, [
2337
- s("div", _n, [
2338
- s("div", Cn, P(k.name), 1),
2339
- i(Ee, { json: k }, null, 8, ["json"]),
2340
- i(B, {
2341
- icon: "edit",
2342
- size: "md",
2343
- variant: "tertiary",
2344
- onClick: (A) => z(K)
2345
- }, null, 8, ["onClick"])
2346
- ]),
2347
- s("div", Sn, [
2348
- (p(!0), U(J, null, me(k.bundles, (A, W) => (p(), D(Bt, {
2349
- bundle: A,
2350
- key: A._id,
2351
- onEdit: (oe) => q({
2352
- bundle: A,
2353
- category: K,
2354
- index: W,
2355
- categories: e(w)
2356
- }),
2357
- onDelete: (oe) => Q(null, K, W),
2358
- onSend: we
2359
- }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
2360
- i(It, {
2361
- onCreate: (A) => q({
2362
- category: K,
2363
- index: -1,
2364
- categories: e(w)
2365
- })
2366
- }, null, 8, ["onCreate"])
2367
- ])
2368
- ]))), 128)),
2369
- i(_o, {
2370
- ref_key: "bundleSheetRef",
2371
- ref: $,
2372
- onUpdate: Q
2373
- }, null, 512)
2374
- ], 64)) : (p(), D(M, {
2375
- key: 2,
2376
- variant: "outlined",
2377
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
2378
- }, {
2379
- default: I(() => [
2380
- C[5] || (C[5] = s("img", {
2381
- src: nt,
2382
- class: "aspect-square w-[150px]"
2383
- }, null, -1)),
2384
- s("div", Fn, [
2385
- s("div", wn, P(e(o)("connect.store.bundle.title")), 1),
2386
- s("div", $n, P(e(o)("connect.store.bundle.description")), 1)
2387
- ]),
2388
- i(B, {
2389
- variant: "primary",
2390
- label: e(o)("connect.store.actions.addCategory"),
2391
- icon: "add",
2392
- onClick: C[3] || (C[3] = (k) => z(-1))
2393
- }, null, 8, ["label"])
2394
- ]),
2395
- _: 1
2396
- })),
2397
- i(so, {
2398
- ref_key: "settingSheetRef",
2399
- ref: d,
2400
- onUpdate: N
2401
- }, null, 512),
2402
- i(Fo, {
2403
- ref_key: "sendBundleSheetRef",
2404
- ref: n
2405
- }, null, 512)
2406
- ])
2407
- ], 64);
2408
- };
2409
- }
2410
- });
2411
- export {
2412
- sa as default
2413
- };