@feedmepos/mf-connect 0.1.0-beta.6 → 0.1.0-beta.61

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