@feedmepos/mf-connect 0.1.0-beta.4 → 0.1.0-beta.41

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