@feedmepos/mf-connect 0.1.0-beta.5 → 0.1.0-beta.50

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 (112) hide show
  1. package/dist/Analytic-D-yp03jJ.js +427 -0
  2. package/dist/{App-C8Qfnkhz.js → App-CeQWTGNK.js} +441 -420
  3. package/dist/AuditLogs-2qzwcMXR.js +1885 -0
  4. package/dist/Bin-D1b2NbbA.js +191 -0
  5. package/dist/{Broadcast-BK-1MQkL.js → Broadcast-bKF9mIns.js} +13 -12
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BLzpFQoc.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B_q5K-cx.js} +6 -8
  7. package/dist/Card-BCAyfBLi.js +896 -0
  8. package/dist/{Collections-TA4iW1r0.js → Collections-Yz3F55bv.js} +27 -31
  9. package/dist/{Credit-Df9iFQjZ.js → Credit-Ceptt_g_.js} +17 -16
  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-CLFeMi0j.js +169 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TjNinQ8e.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BCRVyPwl.js → EffectSheet.vue_vue_type_style_index_0_lang-D3Bt-Vuu.js} +6 -6
  14. package/dist/{Experience-ByLFXKn6.js → Experience-DskHKzfo.js} +26 -25
  15. package/dist/{Game-B6Ez0pfW.js → Game-IJ6X0AXM.js} +21 -20
  16. package/dist/Index-CEl2y9X6.js +259 -0
  17. package/dist/Marketing-CWekLb4c.js +20071 -0
  18. package/dist/{Member-TobP1ISp.js → Member-BUZPQ5Lb.js} +4 -4
  19. package/dist/MemberList-BmVNqvbm.js +1598 -0
  20. package/dist/MemberTransactions-B3XhEOK_.js +45 -0
  21. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CZ-w6iZi.js → MessageInput.vue_vue_type_script_setup_true_lang-C6YIbQtM.js} +6 -6
  22. package/dist/{Mission-D9uTVo0G.js → Mission-Ci9ed_ph.js} +97 -84
  23. package/dist/Overview-CU9uhC-k.js +1078 -0
  24. package/dist/{Point-4rDr-53e.js → Point-wuuR7AEb.js} +26 -25
  25. package/dist/{Promotion-BKO_dtQk.js → Promotion-BMi3kyE8.js} +55 -48
  26. package/dist/Record-Wmh-g8WY.js +340 -0
  27. package/dist/Reward-BL4lxhIB.js +442 -0
  28. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CqXuTxun.js +150 -0
  29. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Dbik0PEw.js +1637 -0
  30. package/dist/Segment-DObdjyYi.js +568 -0
  31. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BAuM6qP5.js +181 -0
  32. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-BfyRVxWM.js +147 -0
  33. package/dist/{Setting-B7oISD0D.js → Setting-Dqgnd7TR.js} +610 -586
  34. package/dist/Store--Z4So__g.js +1744 -0
  35. package/dist/{StoreRewards-AMxIYhjZ.js → StoreRewards-DPFVXWwm.js} +33 -32
  36. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CNsdA106.js +939 -0
  37. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-B2szciPk.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-CGOmGozY.js} +1 -1
  38. package/dist/{Tier-DkxdNj-K.js → Tier-36IfhsnP.js} +327 -318
  39. package/dist/{Title-VFpCOsMO.js → Title-XH56OOug.js} +199 -184
  40. package/dist/{Transaction-BgKD8n2L.js → Transaction-BUQcSmBs.js} +2 -2
  41. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-BVCfeG5T.js +130 -0
  42. package/dist/Voucher-CvmH0kcF.js +353 -0
  43. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BQOD6uEf.js +419 -0
  44. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B2FGvyza.js → ZodTextField.vue_vue_type_script_setup_true_lang-CcIcCt4N.js} +1 -1
  45. package/dist/{app-DUl5dav5.js → app-DeW5_DB0.js} +1754 -1496
  46. package/dist/{app-DA-t-2Zt.js → app-TN8KEPMu.js} +1 -1
  47. package/dist/app.js +1 -1
  48. package/dist/{business-CeCitOY4.js → business-D1mLhSME.js} +1 -1
  49. package/dist/campaign-0tnkhu78.js +1810 -0
  50. package/dist/{campaign-CcLM6e4s.js → campaign-B-12Im0w.js} +2 -2
  51. package/dist/campaign.enum-C8m-HHZE.js +20 -0
  52. package/dist/campaign.fn-CxkhbK9i.js +758 -0
  53. package/dist/collectible.enum-6Syq-vQ6.js +19 -0
  54. package/dist/{collection.fn-CAEP7YxB.js → collection.fn-BUj75Jp2.js} +2 -2
  55. package/dist/dto-8wODhIIC.js +214 -0
  56. package/dist/{effect-Dt7rXOBy.js → effect-BEZEjcJu.js} +9 -9
  57. package/dist/email-addresses-PwjkdYYD.js +705 -0
  58. package/dist/{export-CyioiboQ.js → export-BB-0vgwy.js} +5 -5
  59. package/dist/{helper-FA_9AhGV.js → helper-DOt8-wns.js} +1 -1
  60. package/dist/{index-DLN4Kzz_.js → index-B1qUjniH.js} +1 -1
  61. package/dist/index-BTMIZz4v.js +44 -0
  62. package/dist/{index-igxrd5jC.js → index-By-GlmG7.js} +1500 -1479
  63. package/dist/index-C7zBkoZ4.js +115 -0
  64. package/dist/{index-CyNdsVrw.js → index-CNlHabtk.js} +1 -1
  65. package/dist/{index-DbbO3wip.js → index-CXGiIgdK.js} +48 -4
  66. package/dist/{index-C20XBD7G.js → index-Cjn1LVjC.js} +2192 -931
  67. package/dist/index-CpfUrdgw.js +29000 -0
  68. package/dist/index-CsaQJMAR.js +66 -0
  69. package/dist/index-DZuEmMyY.js +54 -0
  70. package/dist/{index-CCdXvb92.js → index-D_zwqIhq.js} +1 -1
  71. package/dist/index-DabUEw_c.js +32 -0
  72. package/dist/{index-BiFueJiF.js → index-X-FfC49l.js} +258 -192
  73. package/dist/index-vh86FiIQ.js +10 -0
  74. package/dist/{index.esm2017-Dl_CdTcK.js → index.esm2017-DJOUiVjR.js} +33 -33
  75. package/dist/loading-aCWVsOPY.js +71 -0
  76. package/dist/{membership-DFiY8aVd.js → membership-1etsHC5G.js} +54 -46
  77. package/dist/money-DzWRURZ5.js +15 -0
  78. package/dist/number-BxIQO1i3.js +12 -0
  79. package/dist/objectid-DjhmYkn-.js +145 -0
  80. package/dist/{loading-CZ0fiViM.js → plugins-CSPFAU50.js} +2990 -3062
  81. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  82. package/dist/reward-Bh4Li9f0.js +36 -0
  83. package/dist/{rule-C3e1xTqN.js → rule-CHTTTUFB.js} +180 -177
  84. package/dist/{rule-builder-MEVb_AiZ.js → rule-builder-OHfUJTIA.js} +1 -1
  85. package/dist/style.css +1 -1
  86. package/dist/{template-C2OKWd_e.js → template-ZGxXqkaC.js} +5 -5
  87. package/dist/trigger-Ogu5FDs0.js +144 -0
  88. package/dist/user-DBuU81tO.js +54 -0
  89. package/dist/{vue-i18n-CjxDUnX6.js → vue-i18n-CKpKQ6iE.js} +216 -216
  90. package/dist/{xlsx-CtXdl3ls.js → xlsx-DJDZBIeg.js} +1 -1
  91. package/package.json +9 -7
  92. package/dist/Analytic-C_ZFR5jh.js +0 -622
  93. package/dist/Card-C7dUFJKe.js +0 -825
  94. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bgl90veU.js +0 -2813
  95. package/dist/Marketing-BaqZUeVI.js +0 -316
  96. package/dist/MemberList-B9cutmEh.js +0 -1733
  97. package/dist/MemberTransactions-DRHA7AOF.js +0 -38
  98. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BHCoDSTg.js +0 -1753
  99. package/dist/Segment-Dj8nc3AE.js +0 -437
  100. package/dist/Store-CJ3wcohQ.js +0 -1511
  101. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-wXUTfQQF.js +0 -890
  102. package/dist/Voucher-BbTLt8Pt.js +0 -490
  103. package/dist/dto-CRJma6eX.js +0 -2770
  104. package/dist/index-B1e0LtDe.js +0 -99
  105. package/dist/index-Be2ZYDy_.js +0 -298
  106. package/dist/index-CDkITvze.js +0 -762
  107. package/dist/index-CuvNtC_M.js +0 -61
  108. package/dist/index-DPP5F3bT.js +0 -206
  109. package/dist/index-Dbo3DDwp.js +0 -29193
  110. package/dist/money-D8hUEfP4.js +0 -15
  111. package/dist/number-DL3GAeVt.js +0 -12
  112. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1744 @@
1
+ import { defineComponent as ee, computed as E, 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 j, unref as e, Fragment as J, 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-CpfUrdgw.js";
5
+ import { u as Ee } from "./loading-aCWVsOPY.js";
6
+ import { u as $e, C as me } from "./membership-1etsHC5G.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-CSPFAU50.js";
10
+ import { u as be } from "./vue-i18n-CKpKQ6iE.js";
11
+ import { Z, g as G, a as X } from "./zod-Bg2FbC-D.js";
12
+ import { z as Q, R as Ze } from "./app-DeW5_DB0.js";
13
+ import { k as Qe, l as et, m as tt, n as Oe, o as nt } from "./index-Cjn1LVjC.js";
14
+ import { u as _e } from "./app-wDQR6dpb.js";
15
+ import { _ as te } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CcIcCt4N.js";
16
+ import { J as ke } from "./JsonViewer-v8_C7l5N.js";
17
+ import { _ as ot } from "./index-By-GlmG7.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-DzWRURZ5.js";
21
+ import { F as it } from "./number-BxIQO1i3.js";
22
+ import { t as dt } from "./helper-DOt8-wns.js";
23
+ import "./index-CNlHabtk.js";
24
+ import "./index-X-FfC49l.js";
25
+ import "./index-B1qUjniH.js";
26
+ import "./index-DZuEmMyY.js";
27
+ import { m as ut } from "./index-D_zwqIhq.js";
28
+ import { m as xe } from "./index-CXGiIgdK.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((u) => u.systemCode === t.systemCode && u.taxCode === t.taxCode)).filter((t) => !!t && b.includes(t.systemCode))
36
+ ), m = o.reduce(
37
+ (t, u) => {
38
+ var y;
39
+ return Object.assign(t, {
40
+ [u.taxCode]: {
41
+ inclusive: ((y = i.find((c) => c.systemCode === u.systemCode)) == null ? void 0 : y.inclusive) || !1,
42
+ adjustment: {
43
+ level: 1,
44
+ type: {
45
+ type: "BY_MULTIPLIER",
46
+ amount: {
47
+ amount: u.rate.amount,
48
+ precision: u.rate.precision,
49
+ currency: "MYR"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ });
55
+ },
56
+ {}
57
+ ), d = 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
+ ...d.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 = E(() => {
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 = E(() => {
109
+ var m, d;
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 + (((d = a.bundle.credit.free) == null ? void 0 : d.amount) ?? 0);
113
+ o.push(`${t} credit(s)`);
114
+ }
115
+ return o;
116
+ });
117
+ return (o, m) => {
118
+ const d = h("FmIcon"), t = h("FmChip"), u = h("FmButton"), y = h("FmMenuItem"), c = 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(d, {
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(c, { placement: "bottom-end" }, {
145
+ "menu-button": T(() => [
146
+ r(u, {
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, j(g.bundle.name), 1),
178
+ _("div", ht, j(e(i) || "Free"), 1),
179
+ _("div", xt, [
180
+ (v(!0), D(J, 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] = (d) => 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 d() {
228
+ i(o.value), b("primary"), f.close();
229
+ }
230
+ function t() {
231
+ i(null), b("primary"), f.close();
232
+ }
233
+ return (u, y) => {
234
+ const c = h("FmTextField"), S = h("FmButton");
235
+ return v(), D("div", Ft, [
236
+ r(c, {
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: d
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 = E(
271
+ () => f.sortedStoreCategories.map((o, m) => ({
272
+ label: o.name,
273
+ value: m
274
+ }))
275
+ );
276
+ return (o, m) => {
277
+ const d = 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(d, {
281
+ placeholder: "Select a category",
282
+ items: e(b),
283
+ modelValue: e(i),
284
+ "onUpdate:modelValue": [
285
+ m[0] || (m[0] = (u) => oe(i) ? i.value = u : null),
286
+ m[1] || (m[1] = (u) => e(x)(u))
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] = (u) => e(a)("tertiary"))
295
+ }),
296
+ r(t, {
297
+ label: "Select",
298
+ onClick: m[3] || (m[3] = (u) => 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(u, y) {
425
+ const c = ue.clone(a.modelValue), S = c.findIndex((l) => l.systemCode === u);
426
+ S >= 0 ? c[S].inclusive = y : c.push({
427
+ systemCode: u,
428
+ inclusive: y
429
+ }), b.value = c, i("update:model-value", c);
430
+ }
431
+ function m() {
432
+ return f.map((u) => {
433
+ const y = a.modelValue ? a.modelValue.find((c) => c.systemCode === u.code) : !1;
434
+ return {
435
+ label: u.name,
436
+ config: {
437
+ value: y ? y.inclusive : !1
438
+ },
439
+ input: (c) => {
440
+ o(u.code, c);
441
+ }
442
+ };
443
+ });
444
+ }
445
+ const d = He(m());
446
+ function t(u, y) {
447
+ return `${u} ${y ? "Inclusive" : "Exclusive"}`;
448
+ }
449
+ return fe(() => {
450
+ a.modelValue.length || o(f[0].code, !1);
451
+ }), we(
452
+ () => a.modelValue,
453
+ (u, y) => {
454
+ u != y && !u.length && o(f[0].code, !1);
455
+ }
456
+ ), (u, y) => {
457
+ const c = h("FmSwitch");
458
+ return v(!0), D(J, null, re(e(d), (S, l) => {
459
+ var F;
460
+ return v(), D("div", { key: l }, [
461
+ r(c, {
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, j(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 = E(() => {
498
+ const o = Rt.mode === "development", m = B.Config.getCountry().code.toLowerCase(), d = m != "my" ? `.${m}` : "";
499
+ return `https://marketing${o ? "-dev" : ""}${d}.feedmeapi.com/stripe/${Ye.getBusinessId()}/webhook`;
500
+ });
501
+ return fe(() => {
502
+ i.value = !!a.modelValue;
503
+ }), (o, m) => {
504
+ const d = h("FmSwitch"), t = h("FmTextField"), u = h("FmButton");
505
+ return v(), D("div", It, [
506
+ r(d, {
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(u, {
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), d = 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 = E(() => d.safeParse(o.value).success);
571
+ function u() {
572
+ const S = d.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 c(S, l) {
595
+ b.value = S, S && (o.value = l != null && l.company ? l : y());
596
+ }
597
+ return x({
598
+ showSheet: c,
599
+ data: o
600
+ }), (S, l) => {
601
+ const F = h("FmIcon"), $ = h("FmMenuItem"), N = h("FmMenu"), W = h("FmSelect"), Y = h("FmButton"), L = h("FmSideSheet");
602
+ return v(), I(L, {
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: u,
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) => c(!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, j(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(d), "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(d), "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(d), "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, j(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(d), "company.phoneNo")
663
+ }, null, 8, ["modelValue", "label", "schema"]),
664
+ _("div", Et, j(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(d), "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(d), "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(d), "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(d), "company.address.postcode")
689
+ }, null, 8, ["modelValue", "label", "schema"]),
690
+ _("div", Lt, [
691
+ _("div", Ht, j(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(d), "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(J, 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(d), "company.address.country")]
740
+ }, null, 8, ["label", "modelValue", "items", "rules"])
741
+ ]),
742
+ _("div", qt, [
743
+ _("div", Kt, j(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((u, y) => {
775
+ const c = ne.systemDefaultCode(y.name);
776
+ if (!c) return u;
777
+ const { systemCode: S, taxCode: l } = c;
778
+ return y.value || u.push({ systemCode: S, taxCode: l }), u;
779
+ }, []);
780
+ d(t);
781
+ }
782
+ });
783
+ function i() {
784
+ return ne.groupedTaxOptions();
785
+ }
786
+ const b = E(() => i().map((t) => ({
787
+ name: t.code,
788
+ value: (o.value || []).find(
789
+ (u) => t.options.some((y) => y.feedmeTaxCode === u)
790
+ ),
791
+ options: t.options.map((u) => ({
792
+ label: `${u.name} (${it(u.rate)}%)`,
793
+ value: u.feedmeTaxCode
794
+ }))
795
+ }))), o = E(() => a.modelValue.map((t) => ne.generateCode(t)));
796
+ function m(t) {
797
+ const u = i().find(
798
+ (l) => l.options.some((F) => F.feedmeTaxCode === t)
799
+ ), y = u == null ? void 0 : u.options.find((l) => l.feedmeTaxCode === t);
800
+ if (!y) return;
801
+ const { systemCode: c, taxCode: S } = y;
802
+ d([{ systemCode: c, taxCode: S }]);
803
+ }
804
+ function d(t) {
805
+ const u = ue.clone(a.modelValue);
806
+ t.forEach((y) => {
807
+ const c = i().find(
808
+ (F) => F.options.some(($) => $.feedmeTaxCode === ne.generateCode(y))
809
+ ), S = (c == null ? void 0 : c.options) || [], l = u.findIndex(
810
+ (F) => S.some(($) => ne.generateCode($) === ne.generateCode(F))
811
+ );
812
+ l >= 0 ? u.splice(l, 1, y) : u.push(y);
813
+ }), f("update:modelValue", u);
814
+ }
815
+ return (t, u) => {
816
+ const y = h("FmRadio"), c = h("FmRadioGroup");
817
+ return v(!0), D(J, null, re(e(b), (S) => (v(), D("div", {
818
+ key: S.name,
819
+ class: "flex items-start"
820
+ }, [
821
+ r(c, {
822
+ modelValue: S.value,
823
+ "onUpdate:modelValue": [
824
+ (l) => S.value = l,
825
+ u[0] || (u[0] = (l) => {
826
+ m(l);
827
+ })
828
+ ]
829
+ }, {
830
+ default: T(() => [
831
+ (v(!0), D(J, 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([]), d = R({
873
+ category: 0,
874
+ index: -1,
875
+ originalCategoryIndex: void 0
876
+ }), t = R(ue.cloneDeep(Se)), u = R(), y = Oe, c = E(() => {
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": (P) => {
901
+ t.value.titles = t.value.titles.map(
902
+ (H) => H.id == n.collectible._id ? { ...H, dayToExpire: P } : H
903
+ );
904
+ },
905
+ modelValue: ((C = n.selectedReward) == null ? void 0 : C.extra) ?? 0,
906
+ appendText: "day(s)",
907
+ showSteppers: !1,
908
+ disabled: !!t.value.stripePriceId
909
+ });
910
+ }
911
+ }
912
+ ], l = R([]), F = E(() => b.bundleRewards.map((p) => {
913
+ const n = $.value.find((P) => P.id == p._id), C = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${dt(p.options.validityOption || {})}` : "No expiry";
914
+ return {
915
+ collectible: p,
916
+ description: C,
917
+ selectedReward: n
918
+ };
919
+ })), $ = E(() => {
920
+ var p, n;
921
+ return [
922
+ ...((p = t.value) == null ? void 0 : p.titles.map((C) => ({
923
+ id: C.id,
924
+ extra: C.dayToExpire
925
+ }))) ?? [],
926
+ ...((n = t.value) == null ? void 0 : n.vouchers.map((C) => ({
927
+ id: C,
928
+ extra: void 0
929
+ }))) ?? []
930
+ ];
931
+ }), N = E(
932
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
933
+ );
934
+ function W(p) {
935
+ t.value.subscriptionValidity = p;
936
+ for (const n of t.value.titles)
937
+ n.dayToExpire = p;
938
+ t.value.credit.free && (t.value.credit.free.day = p);
939
+ }
940
+ function Y() {
941
+ const p = F.value, n = t.value;
942
+ if (!(!n || !p))
943
+ for (let C = 0; C < p.length; C++) {
944
+ const P = p[C];
945
+ L.value[C] ? P.collectible.type == "TITLE" ? n.titles.findIndex(
946
+ (q) => q.id == P.collectible._id
947
+ ) < 0 && n.titles.push({
948
+ id: P.collectible._id,
949
+ dayToExpire: N.value
950
+ }) : n.vouchers.findIndex(
951
+ (q) => q == P.collectible._id
952
+ ) < 0 && n.vouchers.push(P.collectible._id) : (n.titles = n.titles.filter((K) => K.id != P.collectible._id), n.vouchers = n.vouchers.filter(
953
+ (K) => K != P.collectible._id
954
+ ));
955
+ }
956
+ }
957
+ const L = R({});
958
+ we(L, Y, { deep: !0 });
959
+ const z = E(() => {
960
+ var p, n;
961
+ return (n = (p = b.storeOption) == null ? void 0 : p.company) == null ? void 0 : n.sstRegNo;
962
+ }), le = E(() => {
963
+ var p, n, C;
964
+ return (C = (n = (p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) == null ? void 0 : n[0]) != null && C.inclusive ? "Inclusive" : "Exclusive";
965
+ }), s = E(() => {
966
+ var p, n, C;
967
+ return mt(
968
+ ne.fullTax,
969
+ qe(t.value.taxes),
970
+ t.value.price,
971
+ Number(t.value.credit.normal),
972
+ ((p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) ?? [],
973
+ (C = (n = b.storeOption) == null ? void 0 : n.company) != null && C.sstRegNo ? ne.taxSystem.map((P) => P.code) : []
974
+ );
975
+ }), w = E(() => s.value.reduce(
976
+ (n, C) => n.add(C.total),
977
+ rt()
978
+ ).toFormat()), U = E(() => {
979
+ var P;
980
+ const p = pt(
981
+ s.value,
982
+ t.value.price,
983
+ ((P = b.storeOption) == null ? void 0 : P.inclusiveTaxes) ?? []
984
+ );
985
+ t.value.priceWithTaxes = p;
986
+ const n = Yt(p, !1), C = Number(n.replace(/[^\d.-]/g, ""));
987
+ return Number.isNaN(C) ? 0 : C;
988
+ });
989
+ function M() {
990
+ t.value.taxTotals = s.value, f("update", Oe.parse(Je(t.value)));
991
+ }
992
+ function k() {
993
+ return ue.cloneDeep(Se);
994
+ }
995
+ function O(p, n) {
996
+ o.value = p, p && n && (u.value = void 0, m.value = n.categories, t.value = n.bundle || k(), d.value.category = n.category, d.value.index = n.index, d.value.originalCategoryIndex = n.category, L.value = F.value.reduce((C, P, H) => (C[H] = !!P.selectedReward, C), {}));
997
+ }
998
+ return x({
999
+ showSheet: O,
1000
+ bundleImage: u,
1001
+ target: d,
1002
+ data: t
1003
+ }), (p, n) => {
1004
+ const C = h("FmSwitch"), P = h("FmHelperText"), H = h("FmTextField"), K = h("FmSelect"), q = h("FmStepperField"), ie = h("FmMenuItem"), ve = h("FmTable"), ce = h("FmButton"), ge = h("FmSideSheet");
1005
+ return v(), I(ge, {
1006
+ "max-width": 560,
1007
+ modelValue: e(o),
1008
+ "onUpdate:modelValue": n[20] || (n[20] = (ae) => oe(o) ? o.value = ae : null),
1009
+ header: e(d).index != -1 ? e(i)("connect.store.bundle.edit.title") : e(i)("connect.store.bundle.edit.create")
1010
+ }, {
1011
+ "side-sheet-footer": T(() => [
1012
+ _("div", sn, [
1013
+ r(ce, {
1014
+ label: e(d).index != -1 ? "Save" : "Add",
1015
+ onClick: M,
1016
+ disabled: e(c).length > 0,
1017
+ loading: e(_e)().isLoading
1018
+ }, null, 8, ["label", "disabled", "loading"]),
1019
+ r(ce, {
1020
+ label: "Cancel",
1021
+ onClick: n[19] || (n[19] = (ae) => O(!1)),
1022
+ variant: "tertiary"
1023
+ })
1024
+ ])
1025
+ ]),
1026
+ default: T(() => {
1027
+ var ae, Pe, Te, Ue, Re, Ie, De, Be;
1028
+ return [
1029
+ r(ke, { json: e(t) }, null, 8, ["json"]),
1030
+ e(t) ? (v(), D("div", Gt, [
1031
+ _("div", Xt, [
1032
+ 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, {
1033
+ key: 0,
1034
+ "onUpdate:modelValue": n[0] || (n[0] = (V) => {
1035
+ e(t).isFeedvibe = V, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], L.value = {});
1036
+ }),
1037
+ "label-placement": "right",
1038
+ "model-value": e(t).isFeedvibe || !1,
1039
+ label: "Feedvibe Campaign",
1040
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1041
+ }, null, 8, ["model-value"])) : A("", !0),
1042
+ e(t).isFeedvibe ? (v(), I(P, {
1043
+ key: 1,
1044
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1045
+ state: "warning"
1046
+ })) : A("", !0)
1047
+ ]),
1048
+ _("div", Zt, j(e(i)("connect.store.bundle.edit.basicInformation")), 1),
1049
+ r(H, {
1050
+ label: e(i)("connect.store.bundle.edit.bundleName"),
1051
+ modelValue: e(t).name,
1052
+ "onUpdate:modelValue": n[1] || (n[1] = (V) => e(t).name = V),
1053
+ "helper-state": e(G)(e(c), "name"),
1054
+ "helper-text": e(X)(e(c), "name")
1055
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1056
+ r(K, {
1057
+ modelValue: e(d).category,
1058
+ "onUpdate:modelValue": n[2] || (n[2] = (V) => e(d).category = V),
1059
+ label: "Store Category",
1060
+ items: e(m).map((V, Le) => ({ label: V, value: Le }))
1061
+ }, null, 8, ["modelValue", "items"]),
1062
+ r(lt, {
1063
+ label: e(i)("connect.store.bundle.edit.bundleImage"),
1064
+ class: "w-1/2 xs:w-2/3",
1065
+ "aspect-ratio": "16/9",
1066
+ thumbnail: e(t).image ?? void 0,
1067
+ file: e(u) ?? void 0,
1068
+ "onUpdate:file": n[3] || (n[3] = (V) => {
1069
+ u.value = V;
1070
+ }),
1071
+ "helper-state": e(G)(e(c), "image"),
1072
+ "helper-text": e(X)(e(c), "image")
1073
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1074
+ r(q, {
1075
+ "model-value": e(B.Dinero).fromFdoDinero(e(t).price).toUnit(),
1076
+ label: e(i)("connect.store.bundle.edit.bundlePrice"),
1077
+ min: 0,
1078
+ "max-fraction-digits": 2,
1079
+ "onUpdate:modelValue": n[4] || (n[4] = (V) => {
1080
+ e(t).price.amount = V * 10 ** e(t).price.precision;
1081
+ }),
1082
+ "is-currency": !0,
1083
+ "show-steppers": !1,
1084
+ "helper-text": e(X)(e(c), "price") || `${e(B.Dinero).fromNumber({ number: 1 }).toFormat(!0)} = ${e(B.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1085
+ "helper-state": e(G)(e(c), "price")
1086
+ }, {
1087
+ prepend: T(() => [
1088
+ de(j(e(B.Dinero).defaultCurrency()), 1)
1089
+ ]),
1090
+ _: 1
1091
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1092
+ r(q, {
1093
+ "model-value": e(B.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1094
+ label: e(i)("connect.store.bundle.edit.bundleValue"),
1095
+ min: 0,
1096
+ "max-fraction-digits": 2,
1097
+ "onUpdate:modelValue": n[5] || (n[5] = (V) => {
1098
+ e(t).originalPrice || (e(t).originalPrice = e(B.Dinero).zero().toObject()), e(t).originalPrice.amount = V * 10 ** e(t).originalPrice.precision;
1099
+ }),
1100
+ "is-currency": !0,
1101
+ "show-steppers": !1,
1102
+ "helper-text": e(X)(e(c), "originalPrice") || e(i)("connect.store.bundle.edit.originalPriceHelper"),
1103
+ "helper-state": e(G)(e(c), "originalPrice")
1104
+ }, {
1105
+ prepend: T(() => [
1106
+ de(j(e(B.Dinero).defaultCurrency()), 1)
1107
+ ]),
1108
+ _: 1
1109
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1110
+ e(t).isFeedvibe ? A("", !0) : (v(), I(q, {
1111
+ key: 0,
1112
+ "model-value": e(t).coinPrice ?? null,
1113
+ label: e(i)("connect.store.bundle.edit.pointNeeded"),
1114
+ min: 0,
1115
+ "onUpdate:modelValue": n[6] || (n[6] = (V) => {
1116
+ V > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = V;
1117
+ }),
1118
+ "show-steppers": !1,
1119
+ "helper-state": e(G)(e(c), "coinPrice"),
1120
+ "helper-text": e(X)(e(c), "coinPrice")
1121
+ }, {
1122
+ append: T(() => n[21] || (n[21] = [
1123
+ de(" point(s) ")
1124
+ ])),
1125
+ _: 1
1126
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1127
+ (Te = e(b).storeOption) != null && Te.stripe && !e(t).isFeedvibe ? (v(), D(J, { key: 1 }, [
1128
+ _("div", Qt, j(e(i)("connect.store.bundle.edit.subscriptionSettings")), 1),
1129
+ r(H, {
1130
+ label: e(i)("connect.store.bundle.edit.stripePriceId"),
1131
+ modelValue: e(t).stripePriceId,
1132
+ "onUpdate:modelValue": n[7] || (n[7] = (V) => e(t).stripePriceId = V),
1133
+ "helper-state": e(G)(e(c), "stripePriceId"),
1134
+ "helper-text": e(X)(e(c), "stripePriceId")
1135
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1136
+ e(t).stripePriceId ? (v(), I(q, {
1137
+ key: 0,
1138
+ "model-value": e(t).subscriptionValidity ?? null,
1139
+ min: 1,
1140
+ "onUpdate:modelValue": W,
1141
+ label: e(i)("connect.store.bundle.edit.subscriptionValidity"),
1142
+ "show-steppers": !1,
1143
+ "helper-state": e(G)(e(c), "subscriptionValidity"),
1144
+ "helper-text": e(X)(e(c), "subscriptionValidity")
1145
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : A("", !0)
1146
+ ], 64)) : A("", !0),
1147
+ e(t).isFeedvibe ? A("", !0) : (v(), D(J, { key: 2 }, [
1148
+ n[25] || (n[25] = _("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Credit", -1)),
1149
+ r(q, {
1150
+ modelValue: e(t).credit.normal,
1151
+ "onUpdate:modelValue": n[8] || (n[8] = (V) => e(t).credit.normal = V),
1152
+ label: "Normal credit",
1153
+ "show-steppers": !1,
1154
+ "helper-state": e(G)(e(c), "credit.normal"),
1155
+ "helper-text": e(X)(e(c), "credit.normal")
1156
+ }, {
1157
+ append: T(() => n[22] || (n[22] = [
1158
+ de(" credit ")
1159
+ ])),
1160
+ _: 1
1161
+ }, 8, ["modelValue", "helper-state", "helper-text"]),
1162
+ r(q, {
1163
+ "model-value": ((Ue = e(t).credit.free) == null ? void 0 : Ue.amount) ?? null,
1164
+ min: 0,
1165
+ "onUpdate:modelValue": n[9] || (n[9] = (V) => {
1166
+ e(t).credit.free || (e(t).credit.free = {
1167
+ amount: 0,
1168
+ day: 1
1169
+ }), e(t).credit.free.amount = V;
1170
+ }),
1171
+ label: "Free credit",
1172
+ "show-steppers": !1,
1173
+ "helper-state": e(G)(e(c), "credit.free.amount"),
1174
+ "helper-text": e(X)(e(c), "credit.free.amount")
1175
+ }, {
1176
+ append: T(() => n[23] || (n[23] = [
1177
+ de(" credit ")
1178
+ ])),
1179
+ _: 1
1180
+ }, 8, ["model-value", "helper-state", "helper-text"]),
1181
+ (Re = e(t).credit.free) != null && Re.amount ? (v(), I(q, {
1182
+ key: 0,
1183
+ disabled: !!e(t).stripePriceId,
1184
+ "model-value": ((Ie = e(t).credit.free) == null ? void 0 : Ie.day) ?? null,
1185
+ min: 0,
1186
+ "onUpdate:modelValue": n[10] || (n[10] = (V) => {
1187
+ e(t).credit.free || (e(t).credit.free = {
1188
+ amount: 0,
1189
+ day: 1
1190
+ }), e(t).credit.free.day = e(N) || V;
1191
+ }),
1192
+ label: "Free credit valid for",
1193
+ "show-steppers": !1,
1194
+ "helper-state": e(G)(e(c), "credit.free.day"),
1195
+ "helper-text": e(X)(e(c), "credit.free.day")
1196
+ }, {
1197
+ append: T(() => n[24] || (n[24] = [
1198
+ de(" day(s) ")
1199
+ ])),
1200
+ _: 1
1201
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : A("", !0)
1202
+ ], 64)),
1203
+ e(z) ? (v(), D(J, { key: 3 }, [
1204
+ n[26] || (n[26] = _("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1205
+ r(Jt, {
1206
+ modelValue: e(t).taxes,
1207
+ "onUpdate:modelValue": n[11] || (n[11] = (V) => e(t).taxes = V)
1208
+ }, null, 8, ["modelValue"]),
1209
+ r(H, {
1210
+ label: `Tax Charged (${e(le)})`,
1211
+ "model-value": e(w),
1212
+ disabled: ""
1213
+ }, null, 8, ["label", "model-value"])
1214
+ ], 64)) : A("", !0),
1215
+ r(q, {
1216
+ label: "Total Price",
1217
+ "model-value": e(U),
1218
+ disabled: !0
1219
+ }, null, 8, ["model-value"]),
1220
+ _("div", en, j(e(i)("connect.store.bundle.edit.bundleReward.title")), 1),
1221
+ _("div", tn, j(e(i)("connect.store.bundle.edit.bundleReward.description")), 1),
1222
+ _("div", nn, [
1223
+ _("div", on, [
1224
+ r(at, {
1225
+ label: `Reward type: ${e(l).length == 0 ? "All" : e(l)[0].name}`
1226
+ }, {
1227
+ default: T(() => [
1228
+ r(ie, {
1229
+ onClick: n[12] || (n[12] = (V) => l.value = []),
1230
+ label: "All"
1231
+ }),
1232
+ r(ie, {
1233
+ onClick: n[13] || (n[13] = (V) => l.value = [
1234
+ {
1235
+ id: "type",
1236
+ value: "VOUCHER",
1237
+ name: e(me).VOUCHER.name
1238
+ }
1239
+ ]),
1240
+ label: e(me).VOUCHER.name
1241
+ }, null, 8, ["label"]),
1242
+ r(ie, {
1243
+ onClick: n[14] || (n[14] = (V) => l.value = [
1244
+ {
1245
+ id: "type",
1246
+ value: "TITLE",
1247
+ name: e(me).TITLE.name
1248
+ }
1249
+ ]),
1250
+ label: e(me).TITLE.name
1251
+ }, null, 8, ["label"])
1252
+ ]),
1253
+ _: 1
1254
+ }, 8, ["label"])
1255
+ ]),
1256
+ r(ve, {
1257
+ modelValue: e(L),
1258
+ "onUpdate:modelValue": n[15] || (n[15] = (V) => oe(L) ? L.value = V : null),
1259
+ selection: "multiple",
1260
+ "column-filter": e(l),
1261
+ "column-defs": S,
1262
+ "row-data": e(F).filter(
1263
+ (V) => !e(t).isFeedvibe || V.collectible.type == "VOUCHER"
1264
+ ),
1265
+ "hide-footer": e(F).length <= 10
1266
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1267
+ r(P, {
1268
+ text: e(X)(e(c), "titles"),
1269
+ state: e(G)(e(c), "titles")
1270
+ }, null, 8, ["text", "state"])
1271
+ ]),
1272
+ _("div", ln, j(e(i)("connect.store.bundle.edit.advanceSetting")), 1),
1273
+ _("div", an, [
1274
+ r(C, {
1275
+ "model-value": e(t).internal ?? !1,
1276
+ "onUpdate:modelValue": n[16] || (n[16] = (V) => e(t).internal = V),
1277
+ "label-placement": "right",
1278
+ label: e(i)("connect.store.bundle.edit.internalBundle"),
1279
+ sublabel: e(i)("connect.store.bundle.edit.internalBundleDescription")
1280
+ }, null, 8, ["model-value", "label", "sublabel"]),
1281
+ r(C, {
1282
+ "model-value": e(t).hideInPos ?? !1,
1283
+ "onUpdate:modelValue": n[17] || (n[17] = (V) => e(t).hideInPos = V),
1284
+ "label-placement": "right",
1285
+ label: e(i)("connect.store.bundle.edit.hideInPos"),
1286
+ sublabel: e(i)("connect.store.bundle.edit.hideInPosDescription")
1287
+ }, null, 8, ["model-value", "label", "sublabel"]),
1288
+ r(q, {
1289
+ "model-value": ((Be = (De = e(t).config) == null ? void 0 : De.options) == null ? void 0 : Be.maxPerUser) || null,
1290
+ "onUpdate:modelValue": n[18] || (n[18] = (V) => e(ue).set(e(t), "config.options.maxPerUser", V)),
1291
+ label: e(i)("connect.store.bundle.edit.maxPerUser"),
1292
+ "show-steppers": !1,
1293
+ placeholder: "Unlimited"
1294
+ }, null, 8, ["model-value", "label"])
1295
+ ])
1296
+ ])) : A("", !0)
1297
+ ];
1298
+ }),
1299
+ _: 1
1300
+ }, 8, ["modelValue", "header"]);
1301
+ };
1302
+ }
1303
+ }), dn = { class: "flex gap-8 items-center flex-wrap" }, un = { class: "flex items-center gap-8" }, cn = /* @__PURE__ */ ee({
1304
+ __name: "SendBundleSheet",
1305
+ emits: ["success"],
1306
+ setup(g, { expose: x, emit: a }) {
1307
+ const { minor: f } = Ee, i = R(), b = R(""), o = R(""), m = R([]), d = R(!1), t = R();
1308
+ R(!0);
1309
+ function u(F) {
1310
+ d.value = !0, b.value = null, o.value = "", i.value = F.bundle;
1311
+ }
1312
+ function y() {
1313
+ d.value = !1;
1314
+ }
1315
+ async function c(F) {
1316
+ const $ = await ut.read({
1317
+ limit: 25,
1318
+ skip: 0,
1319
+ sortBy: "_id",
1320
+ search: F,
1321
+ descending: !1
1322
+ });
1323
+ m.value = $.resources.map((N) => ({
1324
+ label: `${N.name} (${N.phoneNumber})`,
1325
+ value: N._id
1326
+ })), await new Promise((N) => setTimeout(N, 100));
1327
+ }
1328
+ async function S() {
1329
+ if (!i.value || !b.value) return;
1330
+ const F = m.value.find(
1331
+ (N) => N.value === b.value
1332
+ );
1333
+ await he.confirm(
1334
+ `Are you sure you want to send bundle ${i.value.name} to ${F == null ? void 0 : F.label}?`,
1335
+ "Confirm",
1336
+ "Confirm",
1337
+ "Cancel"
1338
+ ) && await f(
1339
+ async () => {
1340
+ const N = {
1341
+ bundle: i.value._id,
1342
+ member: b.value,
1343
+ source: nt.enum.ADMIN,
1344
+ ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${o.value}`,
1345
+ withCoin: !1
1346
+ };
1347
+ await xe.sendBundle(N), y();
1348
+ },
1349
+ {
1350
+ message: "Sending bundle",
1351
+ successMessage: "Bundle sent"
1352
+ }
1353
+ );
1354
+ }
1355
+ const l = E(() => {
1356
+ var $, N, W;
1357
+ const F = [];
1358
+ return (($ = i.value) == null ? void 0 : $.price.amount) > 0 && F.push(
1359
+ `${B.Config.getCountry().currency.symbol}${je((N = i.value) == null ? void 0 : N.price)}`
1360
+ ), (W = i.value) != null && W.coinPrice && F.push(`${i.value.coinPrice} point(s)`), F.join(" or ");
1361
+ });
1362
+ return x({
1363
+ showSheet: u,
1364
+ hideSheet: y
1365
+ }), fe(async () => {
1366
+ await c("");
1367
+ }), (F, $) => {
1368
+ const N = h("FmCardMedia"), W = h("FmCardHeader"), Y = h("FmChip"), L = h("FmCardSection"), z = h("FmCard"), le = h("FmSelect"), s = h("FmTextField"), w = h("FmForm"), U = h("FmButton"), M = h("FmSideSheet");
1369
+ return v(), I(M, {
1370
+ "max-width": 560,
1371
+ "dismiss-away": !0,
1372
+ header: "Send bundle to member",
1373
+ modelValue: e(d),
1374
+ "onUpdate:modelValue": [
1375
+ $[4] || ($[4] = (k) => oe(d) ? d.value = k : null),
1376
+ $[5] || ($[5] = (k) => d.value = k)
1377
+ ]
1378
+ }, {
1379
+ "side-sheet-footer": T(() => [
1380
+ _("div", un, [
1381
+ r(U, {
1382
+ label: "Send",
1383
+ loading: e(_e)().isLoading,
1384
+ onClick: $[2] || ($[2] = async () => {
1385
+ var k;
1386
+ return (k = e(t)) == null ? void 0 : k.validateInputs();
1387
+ })
1388
+ }, null, 8, ["loading"]),
1389
+ r(U, {
1390
+ label: "Cancel",
1391
+ type: "button",
1392
+ variant: "tertiary",
1393
+ onClick: $[3] || ($[3] = (k) => d.value = !1)
1394
+ })
1395
+ ])
1396
+ ]),
1397
+ default: T(() => [
1398
+ r(w, {
1399
+ class: "space-y-16",
1400
+ ref_key: "form",
1401
+ ref: t,
1402
+ onValidationSuccess: S,
1403
+ blameFormChildOnValidationFailed: ""
1404
+ }, {
1405
+ default: T(() => [
1406
+ r(z, {
1407
+ class: "max-w-[700px]",
1408
+ horizontal: "",
1409
+ variant: "outlined"
1410
+ }, {
1411
+ default: T(() => {
1412
+ var k, O;
1413
+ return [
1414
+ (k = e(i)) != null && k.image ? (v(), I(N, {
1415
+ key: 0,
1416
+ width: "100",
1417
+ src: (O = e(i)) == null ? void 0 : O.image
1418
+ }, null, 8, ["src"])) : A("", !0),
1419
+ r(L, { class: "flex flex-col gap-16 justify-between" }, {
1420
+ default: T(() => {
1421
+ var p;
1422
+ return [
1423
+ r(W, {
1424
+ class: "p-0",
1425
+ title: (p = e(i)) == null ? void 0 : p.name,
1426
+ subtitle: e(l)
1427
+ }, null, 8, ["title", "subtitle"]),
1428
+ r(L, { class: "p-0" }, {
1429
+ default: T(() => {
1430
+ var n, C, P, H, K, q, ie, ve, ce, ge, ae;
1431
+ return [
1432
+ _("div", dn, [
1433
+ (n = e(i)) != null && n.isFeedvibe ? (v(), I(Y, {
1434
+ key: 0,
1435
+ label: "Feedvibe"
1436
+ })) : A("", !0),
1437
+ (P = (C = e(i)) == null ? void 0 : C.titles) != null && P.length ? (v(), I(Y, {
1438
+ key: 1,
1439
+ label: `${e(i).titles.length} title(s)`
1440
+ }, null, 8, ["label"])) : A("", !0),
1441
+ (K = (H = e(i)) == null ? void 0 : H.vouchers) != null && K.length ? (v(), I(Y, {
1442
+ key: 2,
1443
+ label: `${e(i).vouchers.length} voucher(s)`
1444
+ }, null, 8, ["label"])) : A("", !0),
1445
+ (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, {
1446
+ key: 3,
1447
+ label: `${(e(i).credit.normal || 0) + (((ae = e(i).credit.free) == null ? void 0 : ae.amount) || 0)} credit(s)`
1448
+ }, null, 8, ["label"])) : A("", !0)
1449
+ ])
1450
+ ];
1451
+ }),
1452
+ _: 1
1453
+ })
1454
+ ];
1455
+ }),
1456
+ _: 1
1457
+ })
1458
+ ];
1459
+ }),
1460
+ _: 1
1461
+ }),
1462
+ r(le, {
1463
+ modelValue: e(b),
1464
+ "onUpdate:modelValue": $[0] || ($[0] = (k) => oe(b) ? b.value = k : null),
1465
+ label: "Select member",
1466
+ searchable: "",
1467
+ items: e(m),
1468
+ onSearch: c,
1469
+ rules: [(k) => !!k > 0 || "Member is required"],
1470
+ "helper-text": "Type to search member"
1471
+ }, null, 8, ["modelValue", "items", "rules"]),
1472
+ r(s, {
1473
+ modelValue: e(o),
1474
+ "onUpdate:modelValue": $[1] || ($[1] = (k) => oe(o) ? o.value = k : null),
1475
+ label: "Reference (optional)",
1476
+ rules: [
1477
+ (k) => k.length < 50 || "Reference must be less than 50 characters"
1478
+ ]
1479
+ }, null, 8, ["modelValue", "rules"])
1480
+ ]),
1481
+ _: 1
1482
+ }, 512)
1483
+ ]),
1484
+ _: 1
1485
+ }, 8, ["modelValue"]);
1486
+ };
1487
+ }
1488
+ });
1489
+ 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" };
1490
+ 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({
1491
+ __name: "Store",
1492
+ setup(g) {
1493
+ const x = {
1494
+ label: "Setup payout account",
1495
+ value: "payout",
1496
+ isPrimary: !1
1497
+ }, { t: a } = be(), f = {
1498
+ label: a("connect.store.actions.setting"),
1499
+ value: "setting",
1500
+ isPrimary: !1
1501
+ }, i = {
1502
+ label: a("connect.store.actions.manageReward"),
1503
+ value: "create_reward"
1504
+ }, b = {
1505
+ label: a("connect.store.actions.addCategory"),
1506
+ value: "create_category",
1507
+ isPrimary: !0,
1508
+ prependIcon: "add"
1509
+ }, o = R(), m = ct(), d = $e(), { global: t, minor: u } = Ee, y = Ae(), c = E(() => d.sortedStoreCategories), S = E(() => d.sortedStoreCategories.map((s) => s.name)), l = R(), F = R();
1510
+ async function $(s) {
1511
+ var w;
1512
+ s === "setting" ? (w = l.value) == null || w.showSheet(!0, d.storeOption) : s === "create_category" ? W(-1) : s === "create_reward" ? await m.push({ name: Ze["$connect-STORE_REWARDS"] }) : s == "payout" && window.open(mn.paymentPortalUrl, "_blank");
1513
+ }
1514
+ async function N(s) {
1515
+ await u(
1516
+ async () => {
1517
+ var w;
1518
+ await xe.updateStore(s), await d.readMemberStore(), (w = l.value) == null || w.showSheet(!1);
1519
+ },
1520
+ {
1521
+ message: a("connect.store.setting.update.message"),
1522
+ successMessage: a("connect.store.setting.update.success")
1523
+ }
1524
+ );
1525
+ }
1526
+ async function W(s = -1) {
1527
+ var w, U;
1528
+ if ((!d.storeOption || !d.storeOption.company) && await he.confirm(
1529
+ a("connect.store.category.setup.title"),
1530
+ a("connect.store.category.setup.button"),
1531
+ a("connect.store.category.setup.action"),
1532
+ a("connect.common.cancel")
1533
+ ))
1534
+ return (w = l.value) == null ? void 0 : w.showSheet(!0);
1535
+ y.open({
1536
+ title: s == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
1537
+ contentComponent: wt,
1538
+ contentComponentProps: {
1539
+ initialValue: ((U = c.value[s]) == null ? void 0 : U.name) ?? "",
1540
+ action: s == -1 ? "add" : "edit"
1541
+ }
1542
+ }).onPrimary(async (M) => {
1543
+ M === null && !await he.remove(
1544
+ a("connect.store.category.remove.confirm"),
1545
+ a("connect.store.category.remove.title")
1546
+ ) || await u(
1547
+ async () => {
1548
+ const k = s == -1 ? [...c.value, { name: M, bundles: [] }] : [...c.value].map((O, p) => p == s ? { ...O, name: M } : O).filter((O) => O.name !== null);
1549
+ await xe.updateStoreBundle({
1550
+ categories: k
1551
+ }), await d.readMemberStore();
1552
+ },
1553
+ {
1554
+ message: M === null ? a("connect.store.category.update.deleting") : s == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
1555
+ 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")
1556
+ }
1557
+ );
1558
+ });
1559
+ }
1560
+ async function Y(s, w, U, M) {
1561
+ var p, n, C;
1562
+ 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);
1563
+ const k = Ne(c.value);
1564
+ w != M && (k[M].bundles.splice(U, 1), U = k[w].bundles.length), console.log(w, U, M, "ci, bi, originalCategoryIndex");
1565
+ const O = k[w];
1566
+ if (!O) {
1567
+ Xe.error("Unexpected error", 2e3);
1568
+ return;
1569
+ }
1570
+ if (s == null) {
1571
+ if (await he.remove(
1572
+ "Are you sure you want to delete this bundle?",
1573
+ "Delete bundle"
1574
+ ) == !1)
1575
+ return;
1576
+ O.bundles.splice(U, 1);
1577
+ } else
1578
+ U == -1 ? O.bundles.push(s) : O.bundles[U] = s;
1579
+ await u(
1580
+ async () => {
1581
+ var P, H;
1582
+ if (s != null) {
1583
+ const K = (P = F.value) == null ? void 0 : P.bundleImage;
1584
+ K === null && s.image ? (await Fe.delete(s.image), s.image = null) : K && (s.image = await Fe.update(
1585
+ Fe.bundleImagePath(void 0, K),
1586
+ K
1587
+ ));
1588
+ }
1589
+ await xe.updateStoreBundle({
1590
+ categories: k
1591
+ }), await d.readMemberStore(), await d.readMembership(), await d.readRewards(), (H = F.value) == null || H.showSheet(!1);
1592
+ },
1593
+ {
1594
+ message: `${s == null ? "Deleting" : U == -1 ? "Creating" : "Updating"} bundle`,
1595
+ successMessage: `Bundle ${s == null ? "deleted" : U == -1 ? "created" : "updated"} successfully`
1596
+ }
1597
+ );
1598
+ }
1599
+ function L(s) {
1600
+ var w;
1601
+ (w = F.value) == null || w.showSheet(!0, {
1602
+ ...s,
1603
+ bundle: s.bundle ? Ne(s.bundle) : void 0
1604
+ });
1605
+ }
1606
+ const z = R([]);
1607
+ function le(s) {
1608
+ var w;
1609
+ (w = o.value) == null || w.showSheet({
1610
+ bundle: s
1611
+ });
1612
+ }
1613
+ return fe(async () => {
1614
+ var s, w;
1615
+ await t(async () => {
1616
+ var U, M;
1617
+ if (await d.readMemberStore(), await d.readMembership(), await d.readRewards(), await d.readPayoutAccount(), (U = m.currentRoute.value.query) != null && U.action) {
1618
+ switch ((M = m.currentRoute.value.query) == null ? void 0 : M.action) {
1619
+ case "update_setting":
1620
+ $("setting");
1621
+ break;
1622
+ case "create_category":
1623
+ W(-1);
1624
+ break;
1625
+ case "create_feedvibe_bundle":
1626
+ y.open({
1627
+ title: "Select category",
1628
+ contentComponent: Pt
1629
+ }).onPrimary((k) => {
1630
+ y.close(), L({
1631
+ categories: S.value,
1632
+ category: k,
1633
+ index: -1,
1634
+ bundle: {
1635
+ ...ue.cloneDeep(Se),
1636
+ isFeedvibe: !0,
1637
+ price: B.Dinero.fromNumber({
1638
+ number: 10,
1639
+ precision: 2
1640
+ }).toObject()
1641
+ }
1642
+ });
1643
+ }).onTertiary(() => y.close());
1644
+ break;
1645
+ }
1646
+ m.replace({ query: {} });
1647
+ }
1648
+ }), z.value = [f, i, b], (((s = d.payoutAccount) == null ? void 0 : s.status) != "APPROVED" || ((w = d.payoutAccount) == null ? void 0 : w.enable) != !0) && (z.value = [
1649
+ x,
1650
+ f,
1651
+ i,
1652
+ b
1653
+ ]);
1654
+ }), (s, w) => {
1655
+ const U = h("FmPageHead"), M = h("FmButton"), k = h("FmCard");
1656
+ return v(), D(J, null, [
1657
+ r(U, {
1658
+ title: e(a)("connect.store.title"),
1659
+ actions: e(z),
1660
+ "onClick:action": $
1661
+ }, null, 8, ["title", "actions"]),
1662
+ _("div", pn, [
1663
+ e(c) && e(c).length > 0 ? (v(), D(J, { key: 0 }, [
1664
+ (v(!0), D(J, null, re(e(c), (O, p) => (v(), D("div", {
1665
+ key: O.name,
1666
+ class: "space-y-8 py-12"
1667
+ }, [
1668
+ _("div", yn, [
1669
+ _("div", fn, j(O.name), 1),
1670
+ r(ke, { json: O }, null, 8, ["json"]),
1671
+ r(M, {
1672
+ icon: "edit",
1673
+ size: "md",
1674
+ variant: "tertiary",
1675
+ onClick: (n) => W(p)
1676
+ }, null, 8, ["onClick"])
1677
+ ]),
1678
+ _("div", bn, [
1679
+ (v(!0), D(J, null, re(O.bundles, (n, C) => (v(), I(_t, {
1680
+ bundle: n,
1681
+ key: n._id,
1682
+ onEdit: (P) => L({
1683
+ bundle: n,
1684
+ category: p,
1685
+ index: C,
1686
+ categories: e(S)
1687
+ }),
1688
+ onDelete: (P) => Y(null, p, C),
1689
+ onSend: le
1690
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1691
+ r(Ct, {
1692
+ onCreate: (n) => L({
1693
+ category: p,
1694
+ index: -1,
1695
+ categories: e(S)
1696
+ })
1697
+ }, null, 8, ["onCreate"])
1698
+ ])
1699
+ ]))), 128)),
1700
+ r(rn, {
1701
+ ref_key: "bundleSheetRef",
1702
+ ref: F,
1703
+ onUpdate: Y
1704
+ }, null, 512)
1705
+ ], 64)) : (v(), I(k, {
1706
+ key: 1,
1707
+ variant: "outlined",
1708
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1709
+ }, {
1710
+ default: T(() => [
1711
+ w[1] || (w[1] = _("img", {
1712
+ src: We,
1713
+ class: "aspect-square w-[150px]"
1714
+ }, null, -1)),
1715
+ _("div", vn, [
1716
+ _("div", gn, j(e(a)("connect.store.bundle.title")), 1),
1717
+ _("div", hn, j(e(a)("connect.store.bundle.description")), 1)
1718
+ ]),
1719
+ r(M, {
1720
+ variant: "primary",
1721
+ label: e(a)("connect.store.actions.addCategory"),
1722
+ icon: "add",
1723
+ onClick: w[0] || (w[0] = (O) => W(-1))
1724
+ }, null, 8, ["label"])
1725
+ ]),
1726
+ _: 1
1727
+ })),
1728
+ r(zt, {
1729
+ ref_key: "settingSheetRef",
1730
+ ref: l,
1731
+ onUpdate: N
1732
+ }, null, 512),
1733
+ r(cn, {
1734
+ ref_key: "sendBundleSheetRef",
1735
+ ref: o
1736
+ }, null, 512)
1737
+ ])
1738
+ ], 64);
1739
+ };
1740
+ }
1741
+ });
1742
+ export {
1743
+ Jn as default
1744
+ };