@feedmepos/mf-connect 0.1.0-beta.7 → 0.1.0-beta.70

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 (123) hide show
  1. package/dist/Analytic-DEQUEGlq.js +427 -0
  2. package/dist/{App-DalxIjTu.js → App-CcoU2SAx.js} +445 -420
  3. package/dist/AuditLogs-CiB6u06w.js +1886 -0
  4. package/dist/Bin-C2_1m5RT.js +166 -0
  5. package/dist/{Broadcast-uMAvsC--.js → Broadcast-TotIXDuJ.js} +56 -54
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-JxbENan8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CixQu3Pr.js} +6 -8
  7. package/dist/Card-Ce-_xMgS.js +896 -0
  8. package/dist/Collections-DKva6Doi.js +459 -0
  9. package/dist/{Credit-QlnatflM.js → Credit-BVUxIJ6C.js} +36 -34
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BKEumoan.js +2181 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BE07lc4M.js → EffectSheet.vue_vue_type_style_index_0_lang-ah4bz-qR.js} +49 -49
  14. package/dist/{Experience-Czy41ifp.js → Experience-DV3384o0.js} +32 -30
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-BrPLkFX8.js +118 -0
  16. package/dist/Game-DY83ti52.js +278 -0
  17. package/dist/Index-DEIaZ-2H.js +259 -0
  18. package/dist/Marketing-C2RwIlrg.js +20071 -0
  19. package/dist/Member-D4fc-wzd.js +333 -0
  20. package/dist/MemberList-DSMI6t_D.js +1598 -0
  21. package/dist/MemberTransactions-wXUlbbRq.js +45 -0
  22. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CtM73bcN.js → MessageInput.vue_vue_type_script_setup_true_lang-DYS0klKm.js} +135 -120
  23. package/dist/Mission-P_KLDEpg.js +296 -0
  24. package/dist/Overview-8vc0f1D7.js +1078 -0
  25. package/dist/{Point-By6ogYy_.js → Point-B4Y0Pq60.js} +55 -53
  26. package/dist/{Promotion-DKcBr-RI.js → Promotion-C1CbesgZ.js} +65 -57
  27. package/dist/Queue-BlPA7PNH.js +244 -0
  28. package/dist/Record-Cl1qXSSk.js +340 -0
  29. package/dist/Reward-jy6-W1Eh.js +442 -0
  30. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-d5JNNNHf.js +150 -0
  31. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DYul_Nu8.js +1640 -0
  32. package/dist/Segment-B36Nrvxs.js +568 -0
  33. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-jN0xUFNR.js +181 -0
  34. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLFTNooB.js +186 -0
  35. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-H_Sehhgf.js +147 -0
  36. package/dist/Setting-AgQf2X4W.js +1931 -0
  37. package/dist/Store-D3Mm0pan.js +1841 -0
  38. package/dist/StoreRewards-L0VLWz8l.js +423 -0
  39. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Zl_cXXSD.js +1028 -0
  40. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-nEdCD6la.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-b4mfueTj.js} +1 -1
  41. package/dist/{Tier-DvAs0-yx.js → Tier-DQq-375x.js} +327 -318
  42. package/dist/{Title-B_Trr39o.js → Title-OJxuBvaa.js} +224 -209
  43. package/dist/{Transaction-DCJw-b3H.js → Transaction-vgsYRfD7.js} +2 -2
  44. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cwi0mvC3.js +130 -0
  45. package/dist/Voucher-BFwLaoxe.js +354 -0
  46. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DNUBaNtJ.js +419 -0
  47. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DXkhu8e9.js → ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js} +1 -1
  48. package/dist/app-BQFTJ_hE.js +33357 -0
  49. package/dist/app-D7C3Fxfi.js +7077 -0
  50. package/dist/app.js +1 -1
  51. package/dist/{business-BC4-i1cU.js → business-vzpvmTdG.js} +1 -1
  52. package/dist/{campaign--0_yMbMV.js → campaign-BkxTDfsK.js} +2 -2
  53. package/dist/campaign-UQ8kMVeC.js +1810 -0
  54. package/dist/campaign.enum-BdT-e9h9.js +20 -0
  55. package/dist/campaign.fn-lc4ZhFCU.js +758 -0
  56. package/dist/collectible.enum-C8kd17Tz.js +19 -0
  57. package/dist/{collection.fn-3TwPe7aF.js → collection.fn-BIw1Y_tv.js} +2 -2
  58. package/dist/dto-CwzAhB8x.js +214 -0
  59. package/dist/{effect-BeR0LK61.js → effect-CJcvLlKG.js} +33 -16
  60. package/dist/email-addresses-BCJTQPT0.js +705 -0
  61. package/dist/{export-xeLLhqvh.js → export-URRwle1z.js} +5 -5
  62. package/dist/{helper-B5iqfKh8.js → helper-DccnE6zn.js} +1 -1
  63. package/dist/index-BiIZ7X6d.js +29556 -0
  64. package/dist/{index-CyKZ-SsN.js → index-BsRJ4kVb.js} +1 -1
  65. package/dist/{index-CU_d8jjU.js → index-C3lpXz_P.js} +1 -1
  66. package/dist/{index-Ct_wR519.js → index-CFA3EqId.js} +24 -21
  67. package/dist/{index-DP-dGMJC.js → index-CPRN3irj.js} +2230 -871
  68. package/dist/index-CaxFS90M.js +56 -0
  69. package/dist/index-CsaQJMAR.js +66 -0
  70. package/dist/index-D4MX9e5q.js +115 -0
  71. package/dist/index-DrE9VkxR.js +32 -0
  72. package/dist/index-EOPRlB9V.js +54 -0
  73. package/dist/{index-CAn5heDe.js → index-FcxOGFKj.js} +48 -4
  74. package/dist/{index-Bh-uaaBG.js → index-OScGm4mF.js} +1506 -1480
  75. package/dist/{index-BOdtpNkP.js → index-ghSGvG-m.js} +266 -173
  76. package/dist/index-vh86FiIQ.js +10 -0
  77. package/dist/{index.esm2017-5jeDA5Zo.js → index.esm2017-CE1CQHrP.js} +121 -121
  78. package/dist/loading-B8zghYbj.js +71 -0
  79. package/dist/{membership-D0nqqWNZ.js → membership-DoJMF2T6.js} +54 -46
  80. package/dist/money-CTR0rXZw.js +15 -0
  81. package/dist/number-Bhgz9eFP.js +12 -0
  82. package/dist/objectid-DdVJrRBw.js +145 -0
  83. package/dist/{loading-C-JDVajU.js → plugins-B5mQ7CHT.js} +3871 -3943
  84. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  85. package/dist/reward-DicsEEHe.js +36 -0
  86. package/dist/{rule-builder-BXt29Es4.js → rule-builder-BWb4JTrd.js} +1 -1
  87. package/dist/{rule-Dn_GgBCe.js → rule-s8siRar1.js} +185 -178
  88. package/dist/style.css +1 -1
  89. package/dist/{template-D2Oi3dxP.js → template-Qb5ozfLa.js} +5 -5
  90. package/dist/trigger-Bsb3Kj35.js +144 -0
  91. package/dist/user-DJ8aHRaM.js +54 -0
  92. package/dist/{vue-i18n-Dud8fvmw.js → vue-i18n-BG2U7GtN.js} +282 -282
  93. package/dist/{xlsx-CCRCidY2.js → xlsx-2QxyDFwt.js} +1 -1
  94. package/package.json +11 -7
  95. package/dist/Analytic-BMpS6jWb.js +0 -622
  96. package/dist/Card-DV8-g69L.js +0 -825
  97. package/dist/Collections-DRafEHT1.js +0 -453
  98. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-TDoMehSB.js +0 -2813
  99. package/dist/Game-CD3zSitz.js +0 -255
  100. package/dist/Marketing-NNes8z6Q.js +0 -316
  101. package/dist/Member-CTqBgYuV.js +0 -69
  102. package/dist/MemberList-B99tS5ce.js +0 -1733
  103. package/dist/MemberTransactions-D1YCXPOg.js +0 -38
  104. package/dist/Mission-XbBVKBiE.js +0 -261
  105. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D1ESqEFO.js +0 -1753
  106. package/dist/Segment-B8cszL-F.js +0 -437
  107. package/dist/Setting-aZYABlMW.js +0 -1901
  108. package/dist/Store-Bx2tyJwe.js +0 -1511
  109. package/dist/StoreRewards-DTp9G6gw.js +0 -401
  110. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B2W7ly5Z.js +0 -890
  111. package/dist/Voucher-jqv3ji90.js +0 -490
  112. package/dist/app-WlcUVbFb.js +0 -5764
  113. package/dist/app-_w0hjM7u.js +0 -53428
  114. package/dist/dto-Ns2dLn1B.js +0 -2770
  115. package/dist/index-BWb9vRCi.js +0 -29193
  116. package/dist/index-CpU9aqyW.js +0 -206
  117. package/dist/index-CqO_ZvtD.js +0 -99
  118. package/dist/index-CuvNtC_M.js +0 -61
  119. package/dist/index-DsNsA2uX.js +0 -298
  120. package/dist/index-WAMr3npT.js +0 -762
  121. package/dist/money-hdbrblud.js +0 -15
  122. package/dist/number-CRWGOZaW.js +0 -12
  123. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,1841 @@
1
+ import { defineComponent as ee, computed as j, resolveComponent as h, openBlock as g, createBlock as I, withCtx as T, createElementVNode as _, createElementBlock as B, createVNode as i, createCommentVNode as M, toDisplayString as L, unref as e, Fragment as X, renderList as re, ref as R, isRef as oe, reactive as Ke, onMounted as fe, watch as we, toRaw as He, createTextVNode as de, h as qe } from "vue";
2
+ import { _ as Ye } from "./tier-BJDhpH6X.js";
3
+ import { useDialog as Me, useDialogChild as Oe, components as We } from "@feedmepos/ui-library";
4
+ import { c as D, e as he, S as ze } from "./index-BiIZ7X6d.js";
5
+ import { u as Ee } from "./loading-B8zghYbj.js";
6
+ import { u as ke, C as me } from "./membership-DoJMF2T6.js";
7
+ import { a as Je, c as De } from "./object-qECH92oz.js";
8
+ import { _ as ue } from "./lodash-B5I3zXaY.js";
9
+ import { d as se, a as Ge, p as _e, n as Xe, f as Fe } from "./plugins-B5mQ7CHT.js";
10
+ import { u as be } from "./vue-i18n-BG2U7GtN.js";
11
+ import { Z, g as J, a as G } from "./zod-Bg2FbC-D.js";
12
+ import { z as Q, R as Ze } from "./app-D7C3Fxfi.js";
13
+ import { l as Qe, m as et, n as tt, o as Ae, p as nt } from "./index-CPRN3irj.js";
14
+ import { u as Se } from "./app-wDQR6dpb.js";
15
+ import { _ as te } from "./ZodTextField.vue_vue_type_script_setup_true_lang-ms40eptZ.js";
16
+ import { J as Pe } from "./JsonViewer-v8_C7l5N.js";
17
+ import { _ as ot } from "./index-OScGm4mF.js";
18
+ import { _ as at } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
19
+ import { _ as lt } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
20
+ import { z as st, a as rt } from "./money-CTR0rXZw.js";
21
+ import { F as it } from "./number-Bhgz9eFP.js";
22
+ import { t as dt } from "./helper-DccnE6zn.js";
23
+ import "./index-BsRJ4kVb.js";
24
+ import "./index-ghSGvG-m.js";
25
+ import "./index-C3lpXz_P.js";
26
+ import "./index-EOPRlB9V.js";
27
+ import { m as ut } from "./index-CFA3EqId.js";
28
+ import { m as Ce } from "./index-FcxOGFKj.js";
29
+ import { useRouter as ct } from "vue-router";
30
+ function je(v) {
31
+ return se.DineroFactory(v).toUnit();
32
+ }
33
+ function mt(v, x, l, f, r = [], b = []) {
34
+ const o = ot.compact(
35
+ x.map((t) => v.find((c) => c.systemCode === t.systemCode && c.taxCode === t.taxCode)).filter((t) => !!t && b.includes(t.systemCode))
36
+ ), m = o.reduce(
37
+ (t, c) => {
38
+ var y;
39
+ return Object.assign(t, {
40
+ [c.taxCode]: {
41
+ inclusive: ((y = r.find((d) => d.systemCode === c.systemCode)) == null ? void 0 : y.inclusive) || !1,
42
+ adjustment: {
43
+ level: 1,
44
+ type: {
45
+ type: "BY_MULTIPLIER",
46
+ amount: {
47
+ amount: c.rate.amount,
48
+ precision: c.rate.precision,
49
+ currency: "MYR"
50
+ }
51
+ }
52
+ }
53
+ }
54
+ });
55
+ },
56
+ {}
57
+ ), u = se.Calculator.calculate({
58
+ items: {
59
+ 0: {
60
+ quantity: 1,
61
+ adjustments: {
62
+ price: {
63
+ level: 0,
64
+ type: {
65
+ type: "BY_AMOUNT",
66
+ amount: se.DineroFactory(l).subtract(se.Dinero.fromNumber({ number: f }).toObject()).toObject()
67
+ }
68
+ }
69
+ },
70
+ taxes: m
71
+ }
72
+ },
73
+ adjustments: {},
74
+ roundToNearest: 0
75
+ });
76
+ return o.map((t) => ({
77
+ setting: t,
78
+ systemCode: t.systemCode,
79
+ name: t.name,
80
+ taxCode: t.taxCode,
81
+ rate: t.rate,
82
+ total: se.DineroFactory({
83
+ ...u.items[0].taxes[t.taxCode]
84
+ }).convertPrecision(2).toObject()
85
+ }));
86
+ }
87
+ function pt(v, x, l) {
88
+ return v ? v.reduce((f, r) => {
89
+ var b;
90
+ return (b = l.find((o) => o.systemCode === r.systemCode)) != null && b.inclusive || (f = se.DineroFactory(f.toObject()).add(r.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
+ }, gt = { class: "absolute top-0 right-0" }, vt = { 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(v, { emit: x }) {
103
+ const l = v, f = x, r = j(() => {
104
+ const o = [];
105
+ return l.bundle.price.amount > 0 && o.push(
106
+ `${D.Config.getCountry().currency.symbol}${je(l.bundle.price)}`
107
+ ), l.bundle.coinPrice && o.push(`${l.bundle.coinPrice} point(s)`), o.join(" or ");
108
+ }), b = j(() => {
109
+ var m, u;
110
+ const o = [];
111
+ if (l.bundle.titles.length > 0 && o.push(`${l.bundle.titles.length} title(s)`), l.bundle.vouchers.length > 0 && o.push(`${l.bundle.vouchers.length} voucher(s)`), l.bundle.credit.normal || (m = l.bundle.credit.free) != null && m.amount) {
112
+ const t = l.bundle.credit.normal + (((u = l.bundle.credit.free) == null ? void 0 : u.amount) ?? 0);
113
+ o.push(`${t} credit(s)`);
114
+ }
115
+ return o;
116
+ });
117
+ return (o, m) => {
118
+ const u = h("FmIcon"), t = h("FmChip"), c = h("FmButton"), y = h("FmMenuItem"), d = h("FmMenu"), V = h("FmCard");
119
+ return g(), I(V, {
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
+ v.bundle.image ? (g(), B("img", {
126
+ key: 1,
127
+ src: v.bundle.image,
128
+ class: "w-full h-full object-contain aspect-video"
129
+ }, null, 8, ft)) : (g(), I(u, {
130
+ key: 0,
131
+ name: "image",
132
+ outline: !0,
133
+ size: "md",
134
+ class: "text-fm-color-neutral-gray-200"
135
+ })),
136
+ v.bundle.isFeedvibe ? (g(), B("div", bt, [
137
+ i(t, {
138
+ label: "Feedvibe",
139
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
140
+ compact: ""
141
+ })
142
+ ])) : M("", !0),
143
+ _("div", gt, [
144
+ i(d, { placement: "bottom-end" }, {
145
+ "menu-button": T(() => [
146
+ i(c, {
147
+ icon: "more_vert",
148
+ variant: "tertiary"
149
+ })
150
+ ]),
151
+ default: T(() => [
152
+ i(y, {
153
+ onClick: m[0] || (m[0] = (a) => f("edit", v.bundle)),
154
+ icon: "edit",
155
+ label: "Edit"
156
+ }),
157
+ v.bundle.stripePriceId ? M("", !0) : (g(), I(y, {
158
+ key: 0,
159
+ onClick: m[1] || (m[1] = (a) => f("send", v.bundle)),
160
+ icon: "send",
161
+ label: "Send"
162
+ })),
163
+ i(y, {
164
+ onClick: m[2] || (m[2] = (a) => f("delete", v.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", vt, L(v.bundle.name), 1),
178
+ _("div", ht, L(e(r) || "Free"), 1),
179
+ _("div", xt, [
180
+ (g(!0), B(X, null, re(e(b), (a, S) => (g(), I(t, {
181
+ key: S,
182
+ label: a
183
+ }, null, 8, ["label"]))), 128))
184
+ ])
185
+ ]),
186
+ _: 1
187
+ });
188
+ };
189
+ }
190
+ }), Ct = /* @__PURE__ */ ee({
191
+ __name: "AddBundleCard",
192
+ emits: ["create"],
193
+ setup(v, { emit: x }) {
194
+ const { t: l } = be(), f = x;
195
+ return (r, b) => {
196
+ const o = h("FmButton"), m = h("FmCard");
197
+ return g(), 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
+ i(o, {
203
+ onClick: b[0] || (b[0] = (u) => f("create")),
204
+ label: e(l)("connect.store.actions.addBundle"),
205
+ icon: "add",
206
+ variant: "secondary"
207
+ }, null, 8, ["label"])
208
+ ]),
209
+ _: 1
210
+ });
211
+ };
212
+ }
213
+ }), St = { class: "space-y-16" }, Ft = { class: "flex w-full justify-between pb-16" }, Vt = { 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(v) {
226
+ const { t: x } = be(), l = v, f = Me(), { emitData: r, emitAction: b } = Oe(), o = R(l.initialValue), m = Q.string().min(1);
227
+ function u() {
228
+ r(o.value), b("primary"), f.close();
229
+ }
230
+ function t() {
231
+ r(null), b("primary"), f.close();
232
+ }
233
+ return (c, y) => {
234
+ const d = h("FmTextField"), V = h("FmButton");
235
+ return g(), B("div", St, [
236
+ i(d, {
237
+ modelValue: e(o),
238
+ "onUpdate:modelValue": y[0] || (y[0] = (a) => oe(o) ? o.value = a : null),
239
+ label: e(x)("connect.store.category.label"),
240
+ rules: [e(Z).toRule(e(m))]
241
+ }, null, 8, ["modelValue", "label", "rules"]),
242
+ _("div", Ft, [
243
+ _("div", null, [
244
+ v.action == "edit" ? (g(), I(V, {
245
+ key: 0,
246
+ onClick: t,
247
+ label: e(x)("connect.common.delete"),
248
+ variant: "destructive"
249
+ }, null, 8, ["label"])) : M("", !0)
250
+ ]),
251
+ _("div", Vt, [
252
+ i(V, {
253
+ label: e(x)("connect.common.cancel"),
254
+ variant: "tertiary",
255
+ onClick: y[1] || (y[1] = (a) => e(f).close())
256
+ }, null, 8, ["label"]),
257
+ i(V, {
258
+ label: v.action == "edit" ? e(x)("connect.common.edit") : e(x)("connect.common.add"),
259
+ disabled: !e(o),
260
+ onClick: u
261
+ }, null, 8, ["label", "disabled"])
262
+ ])
263
+ ])
264
+ ]);
265
+ };
266
+ }
267
+ }), kt = { class: "space-y-16" }, Pt = { class: "flex items-center justify-end gap-8 pb-16" }, $t = /* @__PURE__ */ ee({
268
+ __name: "SelectCategoryDialog",
269
+ setup(v) {
270
+ const { emitData: x, emitAction: l } = Oe(), f = ke(), r = R(), b = j(
271
+ () => f.sortedStoreCategories.map((o, m) => ({
272
+ label: o.name,
273
+ value: m
274
+ }))
275
+ );
276
+ return (o, m) => {
277
+ const u = h("FmSelect"), t = h("FmButton");
278
+ return g(), B("div", kt, [
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
+ i(u, {
281
+ placeholder: "Select a category",
282
+ items: e(b),
283
+ modelValue: e(r),
284
+ "onUpdate:modelValue": [
285
+ m[0] || (m[0] = (c) => oe(r) ? r.value = c : null),
286
+ m[1] || (m[1] = (c) => e(x)(c))
287
+ ],
288
+ label: "Category"
289
+ }, null, 8, ["items", "modelValue"]),
290
+ _("div", Pt, [
291
+ i(t, {
292
+ variant: "tertiary",
293
+ label: "Cancel",
294
+ onClick: m[2] || (m[2] = (c) => e(l)("tertiary"))
295
+ }),
296
+ i(t, {
297
+ label: "Select",
298
+ onClick: m[3] || (m[3] = (c) => e(l)("primary")),
299
+ disabled: e(r) == null
300
+ }, null, 8, ["disabled"])
301
+ ])
302
+ ]);
303
+ };
304
+ }
305
+ });
306
+ function xe(v) {
307
+ return v.states.map((x) => ({ label: x, value: x }));
308
+ }
309
+ const Tt = {
310
+ [he.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 xe(this);
331
+ }
332
+ },
333
+ [he.F_COUNTRY.enum.SG]: {
334
+ states: [],
335
+ get stateItems() {
336
+ return xe(this);
337
+ }
338
+ },
339
+ [he.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 xe(this);
377
+ }
378
+ },
379
+ [he.F_COUNTRY.enum.TH]: {
380
+ states: [
381
+ "Bangkok",
382
+ "Amnat Charoen",
383
+ "Ang Thong",
384
+ "Bueng Kan",
385
+ "Buri Ram",
386
+ "Chachoengsao",
387
+ "Chai Nat",
388
+ "Chaiyaphum",
389
+ "Chanthaburi",
390
+ "Chiang Mai",
391
+ "Chiang Rai",
392
+ "Chonburi",
393
+ "Chumphon",
394
+ "Kalasin",
395
+ "Kamphaeng Phet",
396
+ "Kanchanaburi",
397
+ "Khon Kaen",
398
+ "Krabi",
399
+ "Lampang",
400
+ "Lamphun",
401
+ "Loei",
402
+ "Lopburi",
403
+ "Mae Hong Son",
404
+ "Maha Sarakham",
405
+ "Mukdahan",
406
+ "Nakhon Nayok",
407
+ "Nakhon Pathom",
408
+ "Nakhon Phanom",
409
+ "Nakhon Ratchasima",
410
+ "Nakhon Sawan",
411
+ "Nakhon Si Thammarat",
412
+ "Nan",
413
+ "Narathiwat",
414
+ "Nong Bua Lamphu",
415
+ "Nong Khai",
416
+ "Nonthaburi",
417
+ "Pathum Thani",
418
+ "Pattani",
419
+ "Phang Nga",
420
+ "Phatthalung",
421
+ "Phayao",
422
+ "Phetchabun",
423
+ "Phetchaburi",
424
+ "Phichit",
425
+ "Phitsanulok",
426
+ "Phra Nakhon Si Ayutthaya",
427
+ "Phrae",
428
+ "Phuket",
429
+ "Prachinburi",
430
+ "Prachuap Khiri Khan",
431
+ "Ranong",
432
+ "Ratchaburi",
433
+ "Rayong",
434
+ "Roi Et",
435
+ "Sa Kaeo",
436
+ "Sakon Nakhon",
437
+ "Samut Prakan",
438
+ "Samut Sakhon",
439
+ "Samut Songkhram",
440
+ "Saraburi",
441
+ "Satun",
442
+ "Sing Buri",
443
+ "Sisaket",
444
+ "Songkhla",
445
+ "Sukhothai",
446
+ "Suphan Buri",
447
+ "Surat Thani",
448
+ "Surin",
449
+ "Tak",
450
+ "Trang",
451
+ "Trat",
452
+ "Ubon Ratchathani",
453
+ "Udon Thani",
454
+ "Uthai Thani",
455
+ "Uttaradit",
456
+ "Yala",
457
+ "Yasothon"
458
+ ],
459
+ get stateItems() {
460
+ return xe(this);
461
+ }
462
+ }
463
+ }, pe = () => D.Config.getCountry(), ye = {
464
+ get fullCurrency() {
465
+ return pe().currency;
466
+ },
467
+ get currency() {
468
+ return pe().currency.code;
469
+ },
470
+ get fullTax() {
471
+ return D.Country.getCountryFlattenTaxes(pe().code);
472
+ },
473
+ get taxSystem() {
474
+ return pe().taxSystems;
475
+ },
476
+ taxInclusion(v) {
477
+ return ye.taxSystem.map((x) => ({
478
+ systemCode: x.code,
479
+ inclusive: v !== void 0 ? v : !1
480
+ }));
481
+ },
482
+ groupedTaxOptions() {
483
+ const v = D.Country.getCountryFlattenTaxes(pe().code);
484
+ return ye.taxSystem.map((x) => ({
485
+ code: x.code,
486
+ options: v.map((l) => ({ ...l, feedmeTaxCode: ye.generateCode(l) })).filter((l) => l.systemCode === x.code)
487
+ }));
488
+ },
489
+ systemDefaultCode(v) {
490
+ const x = ye.groupedTaxOptions().find((l) => l.code === v);
491
+ return x == null ? void 0 : x.options.find((l) => l.default);
492
+ },
493
+ generateCode(v) {
494
+ return `${v.systemCode}/${v.taxCode}`;
495
+ }
496
+ }, ne = ye, Ut = /* @__PURE__ */ ee({
497
+ __name: "TaxInclusiveSetting",
498
+ props: {
499
+ modelValue: {
500
+ type: Array,
501
+ required: !0,
502
+ default: () => []
503
+ }
504
+ },
505
+ emits: ["update:model-value"],
506
+ setup(v, { emit: x }) {
507
+ const l = v, f = ne.taxSystem, r = x, b = R(l.modelValue);
508
+ function o(c, y) {
509
+ const d = ue.clone(l.modelValue), V = d.findIndex((a) => a.systemCode === c);
510
+ V >= 0 ? d[V].inclusive = y : d.push({
511
+ systemCode: c,
512
+ inclusive: y
513
+ }), b.value = d, r("update:model-value", d);
514
+ }
515
+ function m() {
516
+ return f.map((c) => {
517
+ const y = l.modelValue ? l.modelValue.find((d) => d.systemCode === c.code) : !1;
518
+ return {
519
+ label: c.name,
520
+ config: {
521
+ value: y ? y.inclusive : !1
522
+ },
523
+ input: (d) => {
524
+ o(c.code, d);
525
+ }
526
+ };
527
+ });
528
+ }
529
+ const u = Ke(m());
530
+ function t(c, y) {
531
+ return `${c} ${y ? "Inclusive" : "Exclusive"}`;
532
+ }
533
+ return fe(() => {
534
+ l.modelValue.length || o(f[0].code, !1);
535
+ }), we(
536
+ () => l.modelValue,
537
+ (c, y) => {
538
+ c != y && !c.length && o(f[0].code, !1);
539
+ }
540
+ ), (c, y) => {
541
+ const d = h("FmSwitch");
542
+ return g(!0), B(X, null, re(e(u), (V, a) => {
543
+ var S;
544
+ return g(), B("div", { key: a }, [
545
+ i(d, {
546
+ "model-value": ((S = e(b)[a]) == null ? void 0 : S.inclusive) || !1,
547
+ "label-placement": "left",
548
+ "onUpdate:modelValue": (k) => V.input(k)
549
+ }, {
550
+ label: T(() => {
551
+ var k;
552
+ return [
553
+ _("div", null, L(t(V.label, ((k = e(b)[a]) == null ? void 0 : k.inclusive) || !1)), 1)
554
+ ];
555
+ }),
556
+ _: 2
557
+ }, 1032, ["model-value", "onUpdate:modelValue"])
558
+ ]);
559
+ }), 128);
560
+ };
561
+ }
562
+ });
563
+ var Rt = { mode: "development", appMode: "mf" };
564
+ const It = { class: "space-y-8" }, Bt = {
565
+ key: 0,
566
+ class: "space-y-16"
567
+ }, Nt = /* @__PURE__ */ ee({
568
+ __name: "StripeSetting",
569
+ props: {
570
+ modelValue: {}
571
+ },
572
+ emits: ["update:modelValue"],
573
+ setup(v, { emit: x }) {
574
+ const l = v, f = x, r = R(!1);
575
+ we(r, (o, m) => {
576
+ m != o && (!l.modelValue && o ? f("update:modelValue", {
577
+ apiKey: "",
578
+ webhookSecret: ""
579
+ }) : o || f("update:modelValue", void 0));
580
+ });
581
+ const b = j(() => {
582
+ const o = Rt.mode === "development", m = D.Config.getCountry().code.toLowerCase(), u = m != "my" ? `.${m}` : "";
583
+ return `https://marketing${o ? "-dev" : ""}${u}.feedmeapi.com/stripe/${ze.getBusinessId()}/webhook`;
584
+ });
585
+ return fe(() => {
586
+ r.value = !!l.modelValue;
587
+ }), (o, m) => {
588
+ const u = h("FmSwitch"), t = h("FmTextField"), c = h("FmButton");
589
+ return g(), B("div", It, [
590
+ i(u, {
591
+ modelValue: e(r),
592
+ "onUpdate:modelValue": m[0] || (m[0] = (y) => oe(r) ? r.value = y : null),
593
+ value: "true",
594
+ label: "Enable Stripe"
595
+ }, null, 8, ["modelValue"]),
596
+ l.modelValue ? (g(), B("div", Bt, [
597
+ i(t, {
598
+ label: "API Key",
599
+ modelValue: l.modelValue.apiKey,
600
+ "onUpdate:modelValue": m[1] || (m[1] = (y) => l.modelValue.apiKey = y),
601
+ "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
602
+ }, null, 8, ["modelValue"]),
603
+ i(t, {
604
+ label: "Webhook URL",
605
+ "model-value": e(b),
606
+ readonly: "",
607
+ "helper-text": "Copy this URL to your Stripe dashboard"
608
+ }, {
609
+ append: T(() => [
610
+ i(c, {
611
+ icon: "content_copy",
612
+ variant: "tertiary",
613
+ onClick: m[2] || (m[2] = (y) => e(Ge)(e(b)))
614
+ })
615
+ ]),
616
+ _: 1
617
+ }, 8, ["model-value"]),
618
+ i(t, {
619
+ modelValue: l.modelValue.webhookSecret,
620
+ "onUpdate:modelValue": m[3] || (m[3] = (y) => l.modelValue.webhookSecret = y),
621
+ label: "Webhook Secret",
622
+ "helper-text": `Copy the webhook signing secret from your Stripe account and paste
623
+ here.`
624
+ }, null, 8, ["modelValue"])
625
+ ])) : M("", !0)
626
+ ]);
627
+ };
628
+ }
629
+ }), Dt = {
630
+ key: 0,
631
+ class: "space-y-16 pr-12"
632
+ }, At = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Mt = {
633
+ key: 1,
634
+ class: "space-y-16"
635
+ }, Ot = { 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" }, Kt = { class: "fm-typo-en-body-lg-400" }, Ht = { class: "space-y-16" }, qt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, Yt = { class: "flex items-center gap-8" }, Wt = /* @__PURE__ */ ee({
636
+ __name: "StoreSettingSheet",
637
+ emits: ["update"],
638
+ setup(v, { expose: x, emit: l }) {
639
+ const { t: f } = be(), r = l, b = R(!1), o = R(), m = R(!1), u = Qe.extend({
640
+ company: et.extend({
641
+ name: Q.string().min(1, "Company name is required"),
642
+ regNo: Q.string().min(1, "Registration number is required"),
643
+ address: tt.extend({
644
+ line1: Q.string().min(1, "Line 1 is required"),
645
+ line2: Q.string().optional(),
646
+ state: Q.string().min(1, "State is required"),
647
+ city: Q.string().min(1, "City is required"),
648
+ postcode: Q.string().min(1, "Postcode is required"),
649
+ country: Q.string().min(1, "Country is required")
650
+ }),
651
+ phoneNo: Q.string().min(1, "Phone number is required"),
652
+ sstRegNo: Q.string().optional()
653
+ })
654
+ }), t = j(() => u.safeParse(o.value).success);
655
+ function c() {
656
+ const V = u.safeParse(o.value);
657
+ V.success && r("update", V.data);
658
+ }
659
+ function y() {
660
+ return {
661
+ company: {
662
+ name: "",
663
+ address: {
664
+ line1: "",
665
+ line2: "",
666
+ city: "",
667
+ postcode: "",
668
+ state: "",
669
+ country: D.Config.getCountry().name
670
+ },
671
+ phoneNo: "",
672
+ regNo: "",
673
+ sstRegNo: ""
674
+ },
675
+ inclusiveTaxes: []
676
+ };
677
+ }
678
+ function d(V, a) {
679
+ b.value = V, V && (o.value = a != null && a.company ? a : y());
680
+ }
681
+ return x({
682
+ showSheet: d,
683
+ data: o
684
+ }), (V, a) => {
685
+ const S = h("FmIcon"), k = h("FmMenuItem"), A = h("FmMenu"), Y = h("FmSelect"), W = h("FmButton"), K = h("FmSideSheet");
686
+ return g(), I(K, {
687
+ "max-width": 560,
688
+ modelValue: e(b),
689
+ "onUpdate:modelValue": a[15] || (a[15] = (z) => oe(b) ? b.value = z : null),
690
+ header: e(f)("connect.store.setting.title")
691
+ }, {
692
+ "side-sheet-footer": T(() => [
693
+ _("div", Yt, [
694
+ i(W, {
695
+ label: e(f)("connect.common.save"),
696
+ onClick: c,
697
+ disabled: !e(t) || e(Se)().isLoading,
698
+ loading: e(Se)().isLoading
699
+ }, null, 8, ["label", "disabled", "loading"]),
700
+ i(W, {
701
+ label: e(f)("connect.common.cancel"),
702
+ onClick: a[14] || (a[14] = (z) => d(!1)),
703
+ variant: "tertiary"
704
+ }, null, 8, ["label"])
705
+ ])
706
+ ]),
707
+ default: T(() => {
708
+ var z, ae;
709
+ return [
710
+ i(Pe, { json: e(o) }, null, 8, ["json"]),
711
+ e(o) && e(o).company ? (g(), B("div", Dt, [
712
+ _("div", At, L(e(f)("connect.store.setting.company.legal_info")), 1),
713
+ i(te, {
714
+ modelValue: e(o).company.name,
715
+ "onUpdate:modelValue": a[0] || (a[0] = (s) => e(o).company.name = s),
716
+ label: e(f)("connect.store.setting.company.name"),
717
+ schema: e(Z).typeAtPath(e(u), "company.name")
718
+ }, null, 8, ["modelValue", "label", "schema"]),
719
+ i(te, {
720
+ modelValue: e(o).company.regNo,
721
+ "onUpdate:modelValue": a[1] || (a[1] = (s) => e(o).company.regNo = s),
722
+ label: e(f)("connect.store.setting.company.reg_no"),
723
+ schema: e(Z).typeAtPath(e(u), "company.regNo")
724
+ }, null, 8, ["modelValue", "label", "schema"]),
725
+ e(D.Config).getCountry().taxSystems.length ? (g(), I(te, {
726
+ key: 0,
727
+ modelValue: e(o).company.sstRegNo,
728
+ "onUpdate:modelValue": [
729
+ a[2] || (a[2] = (s) => e(o).company.sstRegNo = s),
730
+ a[3] || (a[3] = (s) => s ? null : e(o).inclusiveTaxes = [])
731
+ ],
732
+ label: e(f)("connect.store.setting.company.tax_reg_no"),
733
+ schema: e(Z).typeAtPath(e(u), "company.sstRegNo")
734
+ }, null, 8, ["modelValue", "label", "schema"])) : M("", !0),
735
+ (z = e(o).company) != null && z.sstRegNo && e(o).inclusiveTaxes ? (g(), B("div", Mt, [
736
+ _("div", Ot, L(e(f)("connect.store.setting.company.tax")), 1),
737
+ i(Ut, {
738
+ modelValue: e(o).inclusiveTaxes,
739
+ "onUpdate:modelValue": a[4] || (a[4] = (s) => e(o).inclusiveTaxes = s)
740
+ }, null, 8, ["modelValue"])
741
+ ])) : M("", !0),
742
+ i(te, {
743
+ modelValue: e(o).company.phoneNo,
744
+ "onUpdate:modelValue": a[5] || (a[5] = (s) => e(o).company.phoneNo = s),
745
+ label: e(f)("connect.store.setting.company.phone"),
746
+ schema: e(Z).typeAtPath(e(u), "company.phoneNo")
747
+ }, null, 8, ["modelValue", "label", "schema"]),
748
+ _("div", Et, L(e(f)("connect.store.setting.company.address.title")), 1),
749
+ i(te, {
750
+ modelValue: e(o).company.address.line1,
751
+ "onUpdate:modelValue": a[6] || (a[6] = (s) => e(o).company.address.line1 = s),
752
+ label: e(f)("connect.store.setting.company.address.line1"),
753
+ schema: e(Z).typeAtPath(e(u), "company.address.line1")
754
+ }, null, 8, ["modelValue", "label", "schema"]),
755
+ i(te, {
756
+ modelValue: e(o).company.address.line2,
757
+ "onUpdate:modelValue": a[7] || (a[7] = (s) => e(o).company.address.line2 = s),
758
+ label: e(f)("connect.store.setting.company.address.line2"),
759
+ schema: e(Z).typeAtPath(e(u), "company.address.line2")
760
+ }, null, 8, ["modelValue", "label", "schema"]),
761
+ _("div", jt, [
762
+ i(te, {
763
+ modelValue: e(o).company.address.city,
764
+ "onUpdate:modelValue": a[8] || (a[8] = (s) => e(o).company.address.city = s),
765
+ label: e(f)("connect.store.setting.company.address.city"),
766
+ schema: e(Z).typeAtPath(e(u), "company.address.city")
767
+ }, null, 8, ["modelValue", "label", "schema"]),
768
+ i(te, {
769
+ modelValue: e(o).company.address.postcode,
770
+ "onUpdate:modelValue": a[9] || (a[9] = (s) => e(o).company.address.postcode = s),
771
+ label: e(f)("connect.store.setting.company.address.postcode"),
772
+ schema: e(Z).typeAtPath(e(u), "company.address.postcode")
773
+ }, null, 8, ["modelValue", "label", "schema"]),
774
+ _("div", Lt, [
775
+ _("div", Kt, L(e(f)("connect.store.setting.company.address.state")), 1),
776
+ i(A, {
777
+ placement: "top-end",
778
+ "model-value": e(m)
779
+ }, {
780
+ "menu-button": T(() => [
781
+ i(te, {
782
+ modelValue: e(o).company.address.state,
783
+ "onUpdate:modelValue": a[10] || (a[10] = (s) => e(o).company.address.state = s),
784
+ schema: e(Z).typeAtPath(e(u), "company.address.state"),
785
+ onFocusChanged: a[11] || (a[11] = (s) => m.value = s)
786
+ }, {
787
+ append: T(() => [
788
+ i(S, {
789
+ name: e(m) ? "keyboard_arrow_up" : "keyboard_arrow_down"
790
+ }, null, 8, ["name"])
791
+ ]),
792
+ _: 1
793
+ }, 8, ["modelValue", "schema"])
794
+ ]),
795
+ default: T(() => [
796
+ (g(!0), B(X, null, re(e(Tt)[e(D.Config).getCountry().code].stateItems.filter(
797
+ (s) => {
798
+ var w, U;
799
+ return s.label.toLowerCase().includes(((U = (w = e(o)) == null ? void 0 : w.company) == null ? void 0 : U.address.state.toLowerCase()) ?? "");
800
+ }
801
+ ) || [], (s) => (g(), I(k, {
802
+ key: s.value,
803
+ "model-value": e(o).company.address.state === s.value,
804
+ label: s.label,
805
+ onClick: () => {
806
+ e(o).company.address.state = s.value, m.value = !1;
807
+ }
808
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
809
+ ]),
810
+ _: 1
811
+ }, 8, ["model-value"])
812
+ ]),
813
+ i(Y, {
814
+ label: e(f)("connect.store.setting.company.address.country"),
815
+ modelValue: e(o).company.address.country,
816
+ "onUpdate:modelValue": a[12] || (a[12] = (s) => e(o).company.address.country = s),
817
+ items: [
818
+ {
819
+ label: e(D.Config).getCountry().name,
820
+ value: e(D.Config).getCountry().name
821
+ }
822
+ ],
823
+ rules: [e(Z).ruleAtPath(e(u), "company.address.country")]
824
+ }, null, 8, ["label", "modelValue", "items", "rules"])
825
+ ]),
826
+ _("div", Ht, [
827
+ _("div", qt, L(e(f)("connect.store.setting.stripe.title")), 1),
828
+ i(Nt, {
829
+ "model-value": (ae = e(o)) == null ? void 0 : ae.stripe,
830
+ "onUpdate:modelValue": a[13] || (a[13] = (s) => e(o).stripe = s)
831
+ }, null, 8, ["model-value"])
832
+ ])
833
+ ])) : M("", !0)
834
+ ];
835
+ }),
836
+ _: 1
837
+ }, 8, ["modelValue", "header"]);
838
+ };
839
+ }
840
+ });
841
+ function zt(v, x = !0) {
842
+ return D.DineroFactory(v).toFormat(x);
843
+ }
844
+ const Jt = /* @__PURE__ */ ee({
845
+ __name: "TaxVariantSetting",
846
+ props: {
847
+ modelValue: {
848
+ type: Array,
849
+ required: !0,
850
+ default: () => []
851
+ }
852
+ },
853
+ emits: ["update:modelValue"],
854
+ setup(v, { emit: x }) {
855
+ const l = v, f = x;
856
+ fe(() => {
857
+ if (o.value.length !== b.value.length) {
858
+ const t = b.value.reduce((c, y) => {
859
+ const d = ne.systemDefaultCode(y.name);
860
+ if (!d) return c;
861
+ const { systemCode: V, taxCode: a } = d;
862
+ return y.value || c.push({ systemCode: V, taxCode: a }), c;
863
+ }, []);
864
+ u(t);
865
+ }
866
+ });
867
+ function r() {
868
+ return ne.groupedTaxOptions();
869
+ }
870
+ const b = j(() => r().map((t) => ({
871
+ name: t.code,
872
+ value: (o.value || []).find(
873
+ (c) => t.options.some((y) => y.feedmeTaxCode === c)
874
+ ),
875
+ options: t.options.map((c) => ({
876
+ label: `${c.name} (${it(c.rate)}%)`,
877
+ value: c.feedmeTaxCode
878
+ }))
879
+ }))), o = j(() => l.modelValue.map((t) => ne.generateCode(t)));
880
+ function m(t) {
881
+ const c = r().find(
882
+ (a) => a.options.some((S) => S.feedmeTaxCode === t)
883
+ ), y = c == null ? void 0 : c.options.find((a) => a.feedmeTaxCode === t);
884
+ if (!y) return;
885
+ const { systemCode: d, taxCode: V } = y;
886
+ u([{ systemCode: d, taxCode: V }]);
887
+ }
888
+ function u(t) {
889
+ const c = ue.clone(l.modelValue);
890
+ t.forEach((y) => {
891
+ const d = r().find(
892
+ (S) => S.options.some((k) => k.feedmeTaxCode === ne.generateCode(y))
893
+ ), V = (d == null ? void 0 : d.options) || [], a = c.findIndex(
894
+ (S) => V.some((k) => ne.generateCode(k) === ne.generateCode(S))
895
+ );
896
+ a >= 0 ? c.splice(a, 1, y) : c.push(y);
897
+ }), f("update:modelValue", c);
898
+ }
899
+ return (t, c) => {
900
+ const y = h("FmRadio"), d = h("FmRadioGroup");
901
+ return g(!0), B(X, null, re(e(b), (V) => (g(), B("div", {
902
+ key: V.name,
903
+ class: "flex items-start"
904
+ }, [
905
+ i(d, {
906
+ modelValue: V.value,
907
+ "onUpdate:modelValue": [
908
+ (a) => V.value = a,
909
+ c[0] || (c[0] = (a) => {
910
+ m(a);
911
+ })
912
+ ]
913
+ }, {
914
+ default: T(() => [
915
+ (g(!0), B(X, null, re(V.options, (a, S) => (g(), I(y, {
916
+ key: S,
917
+ value: a.value,
918
+ label: a.label
919
+ }, null, 8, ["value", "label"]))), 128))
920
+ ]),
921
+ _: 2
922
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
923
+ ]))), 128);
924
+ };
925
+ }
926
+ }), Ve = {
927
+ get _id() {
928
+ return (/* @__PURE__ */ new Date()).toISOString();
929
+ },
930
+ name: "",
931
+ price: D.Dinero.zero().toObject(),
932
+ originalPrice: D.Dinero.zero().toObject(),
933
+ vouchers: [],
934
+ credit: {
935
+ normal: 0,
936
+ free: {
937
+ amount: 0,
938
+ day: 0
939
+ }
940
+ },
941
+ config: {
942
+ options: {}
943
+ },
944
+ titles: [],
945
+ taxes: [],
946
+ taxTotals: [],
947
+ internal: !1,
948
+ priceWithTaxes: st()
949
+ }, Gt = {
950
+ key: 0,
951
+ class: "space-y-24 pr-12"
952
+ }, 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-[-16px]" }, tn = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, nn = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, on = { class: "space-y-8" }, an = { class: "flex items-center justify-between" }, ln = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, sn = { class: "space-y-8" }, rn = { class: "flex items-center gap-8" }, dn = /* @__PURE__ */ ee({
953
+ __name: "EditBundleSheet",
954
+ emits: ["update"],
955
+ setup(v, { expose: x, emit: l }) {
956
+ const f = l, { t: r } = be(), b = ke(), o = R(!1), m = R([]), u = R({
957
+ category: 0,
958
+ index: -1,
959
+ originalCategoryIndex: void 0
960
+ }), t = R(ue.cloneDeep(Ve)), c = R(), y = Ae, d = j(() => {
961
+ const p = y.safeParse(t.value);
962
+ return p.success ? [] : p.error.errors;
963
+ }), V = [
964
+ {
965
+ header: "Reward title",
966
+ accessorFn: (p) => p.collectible.name,
967
+ enableSorting: !0
968
+ },
969
+ {
970
+ id: "type",
971
+ header: "Reward type",
972
+ accessorFn: (p) => p.collectible.type,
973
+ cell(p) {
974
+ return me[p.row.original.collectible.type].chip();
975
+ }
976
+ },
977
+ {
978
+ header: "Description",
979
+ accessorFn: (p) => p.description,
980
+ cell(p) {
981
+ var C;
982
+ const n = p.row.original;
983
+ return n.collectible.type == "VOUCHER" || n.selectedReward == null ? n.description : qe(We.FmStepperField, {
984
+ "onUpdate:modelValue": ($) => {
985
+ t.value.titles = t.value.titles.map(
986
+ (E) => E.id == n.collectible._id ? { ...E, dayToExpire: $ } : E
987
+ );
988
+ },
989
+ modelValue: ((C = n.selectedReward) == null ? void 0 : C.extra) ?? 0,
990
+ appendText: "day(s)",
991
+ helperState: J(d.value, "titles"),
992
+ helperText: G(d.value, "titles"),
993
+ max: 9999,
994
+ rules: [($) => $ <= 9999 || "Maximum 9999 days allowed"],
995
+ showSteppers: !1,
996
+ disabled: !!t.value.stripePriceId
997
+ });
998
+ }
999
+ }
1000
+ ], a = R([]), S = j(() => b.bundleRewards.map((p) => {
1001
+ const n = k.value.find(($) => $.id == p._id), C = p.type === "VOUCHER" ? `${p.options.maxUse} use(s), ${dt(
1002
+ p.options.validityOption || {}
1003
+ )}` : "No expiry";
1004
+ return {
1005
+ collectible: p,
1006
+ description: C,
1007
+ selectedReward: n
1008
+ };
1009
+ })), k = j(() => {
1010
+ var p, n;
1011
+ return [
1012
+ ...((p = t.value) == null ? void 0 : p.titles.map((C) => ({
1013
+ id: C.id,
1014
+ extra: C.dayToExpire
1015
+ }))) ?? [],
1016
+ ...((n = t.value) == null ? void 0 : n.vouchers.map((C) => ({
1017
+ id: C,
1018
+ extra: void 0
1019
+ }))) ?? []
1020
+ ];
1021
+ }), A = j(
1022
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
1023
+ );
1024
+ function Y(p) {
1025
+ t.value.subscriptionValidity = p;
1026
+ for (const n of t.value.titles)
1027
+ n.dayToExpire = p;
1028
+ t.value.credit.free && (t.value.credit.free.day = p);
1029
+ }
1030
+ function W() {
1031
+ const p = S.value, n = t.value;
1032
+ if (!(!n || !p))
1033
+ for (let C = 0; C < p.length; C++) {
1034
+ const $ = p[C];
1035
+ K.value[C] ? $.collectible.type == "TITLE" ? n.titles.findIndex(
1036
+ (H) => H.id == $.collectible._id
1037
+ ) < 0 && n.titles.push({
1038
+ id: $.collectible._id,
1039
+ dayToExpire: A.value
1040
+ }) : n.vouchers.findIndex(
1041
+ (H) => H == $.collectible._id
1042
+ ) < 0 && n.vouchers.push($.collectible._id) : (n.titles = n.titles.filter((q) => q.id != $.collectible._id), n.vouchers = n.vouchers.filter(
1043
+ (q) => q != $.collectible._id
1044
+ ));
1045
+ }
1046
+ }
1047
+ const K = R({});
1048
+ we(K, W, { deep: !0 });
1049
+ const z = j(() => {
1050
+ var p, n;
1051
+ return (n = (p = b.storeOption) == null ? void 0 : p.company) == null ? void 0 : n.sstRegNo;
1052
+ }), ae = j(() => {
1053
+ var p, n, C;
1054
+ return (C = (n = (p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) == null ? void 0 : n[0]) != null && C.inclusive ? "Inclusive" : "Exclusive";
1055
+ }), s = j(() => {
1056
+ var p, n, C;
1057
+ return mt(
1058
+ ne.fullTax,
1059
+ He(t.value.taxes),
1060
+ t.value.price,
1061
+ Number(t.value.credit.normal),
1062
+ ((p = b.storeOption) == null ? void 0 : p.inclusiveTaxes) ?? [],
1063
+ (C = (n = b.storeOption) == null ? void 0 : n.company) != null && C.sstRegNo ? ne.taxSystem.map(($) => $.code) : []
1064
+ );
1065
+ }), w = j(() => s.value.reduce(
1066
+ (n, C) => n.add(C.total),
1067
+ rt()
1068
+ ).toFormat()), U = j(() => {
1069
+ var $;
1070
+ const p = pt(
1071
+ s.value,
1072
+ t.value.price,
1073
+ (($ = b.storeOption) == null ? void 0 : $.inclusiveTaxes) ?? []
1074
+ );
1075
+ t.value.priceWithTaxes = p;
1076
+ const n = zt(p, !1), C = Number(n.replace(/[^\d.-]/g, ""));
1077
+ return Number.isNaN(C) ? 0 : C;
1078
+ });
1079
+ function O() {
1080
+ t.value.taxTotals = s.value, f("update", Ae.parse(Je(t.value)));
1081
+ }
1082
+ function P() {
1083
+ return ue.cloneDeep(Ve);
1084
+ }
1085
+ function N(p, n) {
1086
+ o.value = p, p && n && (c.value = void 0, m.value = n.categories, t.value = n.bundle || P(), u.value.category = n.category, u.value.index = n.index, u.value.originalCategoryIndex = n.category, K.value = S.value.reduce((C, $, E) => (C[E] = !!$.selectedReward, C), {}));
1087
+ }
1088
+ return x({
1089
+ showSheet: N,
1090
+ bundleImage: c,
1091
+ target: u,
1092
+ data: t
1093
+ }), (p, n) => {
1094
+ const C = h("FmSwitch"), $ = h("FmHelperText"), E = h("FmTextField"), q = h("FmSelect"), H = h("FmStepperField"), ie = h("FmMenuItem"), ge = h("FmTable"), ce = h("FmButton"), ve = h("FmSideSheet");
1095
+ return g(), I(ve, {
1096
+ "max-width": 768,
1097
+ modelValue: e(o),
1098
+ "onUpdate:modelValue": n[20] || (n[20] = (le) => oe(o) ? o.value = le : null),
1099
+ header: e(u).index != -1 ? e(r)("connect.store.bundle.edit.title") : e(r)("connect.store.bundle.edit.create")
1100
+ }, {
1101
+ "side-sheet-footer": T(() => [
1102
+ _("div", rn, [
1103
+ i(ce, {
1104
+ label: e(u).index != -1 ? "Save" : "Add",
1105
+ onClick: O,
1106
+ disabled: e(d).length > 0,
1107
+ loading: e(Se)().isLoading
1108
+ }, null, 8, ["label", "disabled", "loading"]),
1109
+ i(ce, {
1110
+ label: "Cancel",
1111
+ onClick: n[19] || (n[19] = (le) => N(!1)),
1112
+ variant: "tertiary"
1113
+ })
1114
+ ])
1115
+ ]),
1116
+ default: T(() => {
1117
+ var le, $e, Te, Ue, Re, Ie, Be, Ne;
1118
+ return [
1119
+ i(Pe, { json: e(t) }, null, 8, ["json"]),
1120
+ e(t) ? (g(), B("div", Gt, [
1121
+ _("div", Xt, [
1122
+ e(D.Config).getCountry().code == "MY" && ((le = e(b).payoutAccount) == null ? void 0 : le.status) == "APPROVED" && (($e = e(b).payoutAccount) != null && $e.enable) ? (g(), I(C, {
1123
+ key: 0,
1124
+ "onUpdate:modelValue": n[0] || (n[0] = (F) => {
1125
+ e(t).isFeedvibe = F, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], K.value = {});
1126
+ }),
1127
+ "label-placement": "right",
1128
+ "model-value": e(t).isFeedvibe || !1,
1129
+ label: "Feedvibe Campaign",
1130
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1131
+ }, null, 8, ["model-value"])) : M("", !0),
1132
+ e(t).isFeedvibe ? (g(), I($, {
1133
+ key: 1,
1134
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app",
1135
+ state: "warning"
1136
+ })) : M("", !0)
1137
+ ]),
1138
+ _("div", Zt, L(e(r)("connect.store.bundle.edit.basicInformation")), 1),
1139
+ i(E, {
1140
+ label: e(r)("connect.store.bundle.edit.bundleName"),
1141
+ modelValue: e(t).name,
1142
+ "onUpdate:modelValue": n[1] || (n[1] = (F) => e(t).name = F),
1143
+ "helper-state": e(J)(e(d), "name"),
1144
+ "helper-text": e(G)(e(d), "name")
1145
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1146
+ i(q, {
1147
+ modelValue: e(u).category,
1148
+ "onUpdate:modelValue": n[2] || (n[2] = (F) => e(u).category = F),
1149
+ label: "Store Category",
1150
+ items: e(m).map((F, Le) => ({ label: F, value: Le }))
1151
+ }, null, 8, ["modelValue", "items"]),
1152
+ i(at, {
1153
+ label: e(r)("connect.store.bundle.edit.bundleImage"),
1154
+ class: "w-1/2 xs:w-2/3",
1155
+ "aspect-ratio": "16/9",
1156
+ thumbnail: e(t).image ?? void 0,
1157
+ file: e(c) ?? void 0,
1158
+ "onUpdate:file": n[3] || (n[3] = (F) => {
1159
+ c.value = F;
1160
+ }),
1161
+ "helper-state": e(J)(e(d), "image"),
1162
+ "helper-text": e(G)(e(d), "image")
1163
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1164
+ i(H, {
1165
+ "model-value": e(D.Dinero).fromFdoDinero(e(t).price).toUnit(),
1166
+ label: e(r)("connect.store.bundle.edit.bundlePrice"),
1167
+ min: 0,
1168
+ "max-fraction-digits": 2,
1169
+ "onUpdate:modelValue": n[4] || (n[4] = (F) => {
1170
+ e(t).price.amount = F * 10 ** e(t).price.precision;
1171
+ }),
1172
+ "is-currency": !0,
1173
+ "show-steppers": !1,
1174
+ "helper-text": e(G)(e(d), "price") || `${e(D.Dinero).fromNumber({ number: 1 }).toFormat(
1175
+ !0
1176
+ )} = ${e(D.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1177
+ "helper-state": e(J)(e(d), "price")
1178
+ }, {
1179
+ prepend: T(() => [
1180
+ de(L(e(D.Dinero).defaultCurrency()), 1)
1181
+ ]),
1182
+ _: 1
1183
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1184
+ i(H, {
1185
+ "model-value": e(D.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1186
+ label: e(r)("connect.store.bundle.edit.bundleValue"),
1187
+ min: 0,
1188
+ "max-fraction-digits": 2,
1189
+ "onUpdate:modelValue": n[5] || (n[5] = (F) => {
1190
+ e(t).originalPrice || (e(t).originalPrice = e(D.Dinero).zero().toObject()), e(t).originalPrice.amount = F * 10 ** e(t).originalPrice.precision;
1191
+ }),
1192
+ "is-currency": !0,
1193
+ "show-steppers": !1,
1194
+ "helper-text": e(G)(e(d), "originalPrice") || e(r)("connect.store.bundle.edit.originalPriceHelper"),
1195
+ "helper-state": e(J)(e(d), "originalPrice")
1196
+ }, {
1197
+ prepend: T(() => [
1198
+ de(L(e(D.Dinero).defaultCurrency()), 1)
1199
+ ]),
1200
+ _: 1
1201
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1202
+ e(t).isFeedvibe ? M("", !0) : (g(), I(H, {
1203
+ key: 0,
1204
+ "model-value": e(t).coinPrice ?? null,
1205
+ label: e(r)("connect.store.bundle.edit.pointNeeded"),
1206
+ min: 0,
1207
+ "onUpdate:modelValue": n[6] || (n[6] = (F) => {
1208
+ F > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = F;
1209
+ }),
1210
+ "show-steppers": !1,
1211
+ "helper-state": e(J)(e(d), "coinPrice"),
1212
+ "helper-text": e(G)(e(d), "coinPrice")
1213
+ }, {
1214
+ append: T(() => n[21] || (n[21] = [
1215
+ de(" point(s) ")
1216
+ ])),
1217
+ _: 1
1218
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1219
+ (Te = e(b).storeOption) != null && Te.stripe && !e(t).isFeedvibe ? (g(), B(X, { key: 1 }, [
1220
+ _("div", Qt, L(e(r)("connect.store.bundle.edit.subscriptionSettings")), 1),
1221
+ i(E, {
1222
+ label: e(r)("connect.store.bundle.edit.stripePriceId"),
1223
+ modelValue: e(t).stripePriceId,
1224
+ "onUpdate:modelValue": n[7] || (n[7] = (F) => e(t).stripePriceId = F),
1225
+ "helper-state": e(J)(e(d), "stripePriceId"),
1226
+ "helper-text": e(G)(e(d), "stripePriceId")
1227
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1228
+ e(t).stripePriceId ? (g(), I(H, {
1229
+ key: 0,
1230
+ "model-value": e(t).subscriptionValidity ?? null,
1231
+ min: 1,
1232
+ "onUpdate:modelValue": Y,
1233
+ label: e(r)("connect.store.bundle.edit.subscriptionValidity"),
1234
+ "show-steppers": !1,
1235
+ "helper-state": e(J)(e(d), "subscriptionValidity"),
1236
+ "helper-text": e(G)(e(d), "subscriptionValidity")
1237
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : M("", !0)
1238
+ ], 64)) : M("", !0),
1239
+ e(t).isFeedvibe ? M("", !0) : (g(), B(X, { key: 2 }, [
1240
+ _("div", en, L(e(r)("connect.store.bundle.edit.credit")), 1),
1241
+ i(H, {
1242
+ modelValue: e(t).credit.normal,
1243
+ "onUpdate:modelValue": n[8] || (n[8] = (F) => e(t).credit.normal = F),
1244
+ label: e(r)("connect.store.bundle.edit.normalCredit"),
1245
+ "show-steppers": !1,
1246
+ "helper-state": e(J)(e(d), "credit.normal"),
1247
+ "helper-text": e(G)(e(d), "credit.normal")
1248
+ }, {
1249
+ append: T(() => n[22] || (n[22] = [
1250
+ de(" credit ")
1251
+ ])),
1252
+ _: 1
1253
+ }, 8, ["modelValue", "label", "helper-state", "helper-text"]),
1254
+ i(H, {
1255
+ "model-value": ((Ue = e(t).credit.free) == null ? void 0 : Ue.amount) ?? null,
1256
+ min: 0,
1257
+ "onUpdate:modelValue": n[9] || (n[9] = (F) => {
1258
+ e(t).credit.free || (e(t).credit.free = {
1259
+ amount: 0,
1260
+ day: 1
1261
+ }), e(t).credit.free.amount = F;
1262
+ }),
1263
+ label: e(r)("connect.store.bundle.edit.freeCredit"),
1264
+ "show-steppers": !1,
1265
+ "helper-state": e(J)(e(d), "credit.free.amount"),
1266
+ "helper-text": e(G)(e(d), "credit.free.amount")
1267
+ }, {
1268
+ append: T(() => n[23] || (n[23] = [
1269
+ de(" credit ")
1270
+ ])),
1271
+ _: 1
1272
+ }, 8, ["model-value", "label", "helper-state", "helper-text"]),
1273
+ (Re = e(t).credit.free) != null && Re.amount ? (g(), I(H, {
1274
+ key: 0,
1275
+ disabled: !!e(t).stripePriceId,
1276
+ "model-value": ((Ie = e(t).credit.free) == null ? void 0 : Ie.day) ?? null,
1277
+ min: 0,
1278
+ "onUpdate:modelValue": n[10] || (n[10] = (F) => {
1279
+ e(t).credit.free || (e(t).credit.free = {
1280
+ amount: 0,
1281
+ day: 1
1282
+ }), e(t).credit.free.day = e(A) || F;
1283
+ }),
1284
+ label: "Free credit valid for",
1285
+ "show-steppers": !1,
1286
+ "helper-state": e(J)(e(d), "credit.free.day"),
1287
+ "helper-text": e(G)(e(d), "credit.free.day")
1288
+ }, {
1289
+ append: T(() => n[24] || (n[24] = [
1290
+ de(" day(s) ")
1291
+ ])),
1292
+ _: 1
1293
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : M("", !0)
1294
+ ], 64)),
1295
+ e(z) ? (g(), B(X, { key: 3 }, [
1296
+ n[25] || (n[25] = _("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1297
+ i(Jt, {
1298
+ modelValue: e(t).taxes,
1299
+ "onUpdate:modelValue": n[11] || (n[11] = (F) => e(t).taxes = F)
1300
+ }, null, 8, ["modelValue"]),
1301
+ i(E, {
1302
+ label: `Tax Charged (${e(ae)})`,
1303
+ "model-value": e(w),
1304
+ disabled: ""
1305
+ }, null, 8, ["label", "model-value"])
1306
+ ], 64)) : M("", !0),
1307
+ i(H, {
1308
+ label: "Total Price",
1309
+ "model-value": e(U),
1310
+ disabled: !0
1311
+ }, null, 8, ["model-value"]),
1312
+ _("div", tn, L(e(r)("connect.store.bundle.edit.bundleReward.title")), 1),
1313
+ _("div", nn, L(e(r)("connect.store.bundle.edit.bundleReward.description")), 1),
1314
+ _("div", on, [
1315
+ _("div", an, [
1316
+ i(lt, {
1317
+ label: `Reward type: ${e(a).length == 0 ? "All" : e(a)[0].name}`
1318
+ }, {
1319
+ default: T(() => [
1320
+ i(ie, {
1321
+ onClick: n[12] || (n[12] = (F) => a.value = []),
1322
+ label: "All"
1323
+ }),
1324
+ i(ie, {
1325
+ onClick: n[13] || (n[13] = (F) => a.value = [
1326
+ {
1327
+ id: "type",
1328
+ value: "VOUCHER",
1329
+ name: e(me).VOUCHER.name
1330
+ }
1331
+ ]),
1332
+ label: e(me).VOUCHER.name
1333
+ }, null, 8, ["label"]),
1334
+ i(ie, {
1335
+ onClick: n[14] || (n[14] = (F) => a.value = [
1336
+ {
1337
+ id: "type",
1338
+ value: "TITLE",
1339
+ name: e(me).TITLE.name
1340
+ }
1341
+ ]),
1342
+ label: e(me).TITLE.name
1343
+ }, null, 8, ["label"])
1344
+ ]),
1345
+ _: 1
1346
+ }, 8, ["label"])
1347
+ ]),
1348
+ i(ge, {
1349
+ modelValue: e(K),
1350
+ "onUpdate:modelValue": n[15] || (n[15] = (F) => oe(K) ? K.value = F : null),
1351
+ selection: "multiple",
1352
+ "column-filter": e(a),
1353
+ "column-defs": V,
1354
+ "row-data": e(S).filter(
1355
+ (F) => !e(t).isFeedvibe || F.collectible.type == "VOUCHER"
1356
+ ),
1357
+ "hide-footer": e(S).length <= 10
1358
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1359
+ i($, {
1360
+ text: e(G)(e(d), "titles"),
1361
+ state: e(J)(e(d), "titles")
1362
+ }, null, 8, ["text", "state"])
1363
+ ]),
1364
+ _("div", ln, L(e(r)("connect.store.bundle.edit.advanceSetting")), 1),
1365
+ _("div", sn, [
1366
+ i(C, {
1367
+ "model-value": e(t).internal ?? !1,
1368
+ "onUpdate:modelValue": n[16] || (n[16] = (F) => e(t).internal = F),
1369
+ "label-placement": "right",
1370
+ label: e(r)("connect.store.bundle.edit.internalBundle"),
1371
+ sublabel: e(r)("connect.store.bundle.edit.internalBundleDescription")
1372
+ }, null, 8, ["model-value", "label", "sublabel"]),
1373
+ i(C, {
1374
+ "model-value": e(t).hideInPos ?? !1,
1375
+ "onUpdate:modelValue": n[17] || (n[17] = (F) => e(t).hideInPos = F),
1376
+ "label-placement": "right",
1377
+ label: e(r)("connect.store.bundle.edit.hideInPos"),
1378
+ sublabel: e(r)("connect.store.bundle.edit.hideInPosDescription")
1379
+ }, null, 8, ["model-value", "label", "sublabel"]),
1380
+ i(H, {
1381
+ "model-value": ((Ne = (Be = e(t).config) == null ? void 0 : Be.options) == null ? void 0 : Ne.maxPerUser) || null,
1382
+ "onUpdate:modelValue": n[18] || (n[18] = (F) => e(ue).set(e(t), "config.options.maxPerUser", F)),
1383
+ label: e(r)("connect.store.bundle.edit.maxPerUser"),
1384
+ "show-steppers": !1,
1385
+ placeholder: "Unlimited"
1386
+ }, null, 8, ["model-value", "label"])
1387
+ ])
1388
+ ])) : M("", !0)
1389
+ ];
1390
+ }),
1391
+ _: 1
1392
+ }, 8, ["modelValue", "header"]);
1393
+ };
1394
+ }
1395
+ }), un = { class: "flex gap-8 items-center flex-wrap" }, cn = { class: "flex items-center gap-8" }, mn = /* @__PURE__ */ ee({
1396
+ __name: "SendBundleSheet",
1397
+ emits: ["success"],
1398
+ setup(v, { expose: x, emit: l }) {
1399
+ const { minor: f } = Ee, r = R(), b = R(""), o = R(""), m = R([]), u = R(!1), t = R();
1400
+ R(!0);
1401
+ function c(S) {
1402
+ u.value = !0, b.value = null, o.value = "", r.value = S.bundle;
1403
+ }
1404
+ function y() {
1405
+ u.value = !1;
1406
+ }
1407
+ async function d(S) {
1408
+ const k = await ut.read({
1409
+ limit: 25,
1410
+ skip: 0,
1411
+ sortBy: "_id",
1412
+ search: S,
1413
+ descending: !1
1414
+ });
1415
+ m.value = k.resources.map((A) => ({
1416
+ label: `${A.name} (${A.phoneNumber})`,
1417
+ value: A._id
1418
+ })), await new Promise((A) => setTimeout(A, 100));
1419
+ }
1420
+ async function V() {
1421
+ if (!r.value || !b.value) return;
1422
+ const S = m.value.find(
1423
+ (A) => A.value === b.value
1424
+ );
1425
+ await _e.confirm(
1426
+ `Are you sure you want to send bundle ${r.value.name} to ${S == null ? void 0 : S.label}?`,
1427
+ "Confirm",
1428
+ "Confirm",
1429
+ "Cancel"
1430
+ ) && await f(
1431
+ async () => {
1432
+ const A = {
1433
+ bundle: r.value._id,
1434
+ member: b.value,
1435
+ source: nt.enum.ADMIN,
1436
+ ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${o.value}`,
1437
+ withCoin: !1
1438
+ };
1439
+ await Ce.sendBundle(A), y();
1440
+ },
1441
+ {
1442
+ message: "Sending bundle",
1443
+ successMessage: "Bundle sent"
1444
+ }
1445
+ );
1446
+ }
1447
+ const a = j(() => {
1448
+ var k, A, Y;
1449
+ const S = [];
1450
+ return ((k = r.value) == null ? void 0 : k.price.amount) > 0 && S.push(
1451
+ `${D.Config.getCountry().currency.symbol}${je((A = r.value) == null ? void 0 : A.price)}`
1452
+ ), (Y = r.value) != null && Y.coinPrice && S.push(`${r.value.coinPrice} point(s)`), S.join(" or ");
1453
+ });
1454
+ return x({
1455
+ showSheet: c,
1456
+ hideSheet: y
1457
+ }), fe(async () => {
1458
+ await d("");
1459
+ }), (S, k) => {
1460
+ const A = h("FmCardMedia"), Y = h("FmCardHeader"), W = h("FmChip"), K = h("FmCardSection"), z = h("FmCard"), ae = h("FmSelect"), s = h("FmTextField"), w = h("FmForm"), U = h("FmButton"), O = h("FmSideSheet");
1461
+ return g(), I(O, {
1462
+ "max-width": 560,
1463
+ "dismiss-away": !0,
1464
+ header: "Send bundle to member",
1465
+ modelValue: e(u),
1466
+ "onUpdate:modelValue": [
1467
+ k[4] || (k[4] = (P) => oe(u) ? u.value = P : null),
1468
+ k[5] || (k[5] = (P) => u.value = P)
1469
+ ]
1470
+ }, {
1471
+ "side-sheet-footer": T(() => [
1472
+ _("div", cn, [
1473
+ i(U, {
1474
+ label: "Send",
1475
+ loading: e(Se)().isLoading,
1476
+ onClick: k[2] || (k[2] = async () => {
1477
+ var P;
1478
+ return (P = e(t)) == null ? void 0 : P.validateInputs();
1479
+ })
1480
+ }, null, 8, ["loading"]),
1481
+ i(U, {
1482
+ label: "Cancel",
1483
+ type: "button",
1484
+ variant: "tertiary",
1485
+ onClick: k[3] || (k[3] = (P) => u.value = !1)
1486
+ })
1487
+ ])
1488
+ ]),
1489
+ default: T(() => [
1490
+ i(w, {
1491
+ class: "space-y-16",
1492
+ ref_key: "form",
1493
+ ref: t,
1494
+ onValidationSuccess: V,
1495
+ blameFormChildOnValidationFailed: ""
1496
+ }, {
1497
+ default: T(() => [
1498
+ i(z, {
1499
+ class: "max-w-[700px]",
1500
+ horizontal: "",
1501
+ variant: "outlined"
1502
+ }, {
1503
+ default: T(() => {
1504
+ var P, N;
1505
+ return [
1506
+ (P = e(r)) != null && P.image ? (g(), I(A, {
1507
+ key: 0,
1508
+ width: "100",
1509
+ src: (N = e(r)) == null ? void 0 : N.image
1510
+ }, null, 8, ["src"])) : M("", !0),
1511
+ i(K, { class: "flex flex-col gap-16 justify-between" }, {
1512
+ default: T(() => {
1513
+ var p;
1514
+ return [
1515
+ i(Y, {
1516
+ class: "p-0",
1517
+ title: (p = e(r)) == null ? void 0 : p.name,
1518
+ subtitle: e(a)
1519
+ }, null, 8, ["title", "subtitle"]),
1520
+ i(K, { class: "p-0" }, {
1521
+ default: T(() => {
1522
+ var n, C, $, E, q, H, ie, ge, ce, ve, le;
1523
+ return [
1524
+ _("div", un, [
1525
+ (n = e(r)) != null && n.isFeedvibe ? (g(), I(W, {
1526
+ key: 0,
1527
+ label: "Feedvibe"
1528
+ })) : M("", !0),
1529
+ ($ = (C = e(r)) == null ? void 0 : C.titles) != null && $.length ? (g(), I(W, {
1530
+ key: 1,
1531
+ label: `${e(r).titles.length} title(s)`
1532
+ }, null, 8, ["label"])) : M("", !0),
1533
+ (q = (E = e(r)) == null ? void 0 : E.vouchers) != null && q.length ? (g(), I(W, {
1534
+ key: 2,
1535
+ label: `${e(r).vouchers.length} voucher(s)`
1536
+ }, null, 8, ["label"])) : M("", !0),
1537
+ (ie = (H = e(r)) == null ? void 0 : H.credit) != null && ie.normal || (ve = (ce = (ge = e(r)) == null ? void 0 : ge.credit) == null ? void 0 : ce.free) != null && ve.amount ? (g(), I(W, {
1538
+ key: 3,
1539
+ label: `${(e(r).credit.normal || 0) + (((le = e(r).credit.free) == null ? void 0 : le.amount) || 0)} credit(s)`
1540
+ }, null, 8, ["label"])) : M("", !0)
1541
+ ])
1542
+ ];
1543
+ }),
1544
+ _: 1
1545
+ })
1546
+ ];
1547
+ }),
1548
+ _: 1
1549
+ })
1550
+ ];
1551
+ }),
1552
+ _: 1
1553
+ }),
1554
+ i(ae, {
1555
+ modelValue: e(b),
1556
+ "onUpdate:modelValue": k[0] || (k[0] = (P) => oe(b) ? b.value = P : null),
1557
+ label: "Select member",
1558
+ searchable: "",
1559
+ items: e(m),
1560
+ onSearch: d,
1561
+ rules: [(P) => !!P > 0 || "Member is required"],
1562
+ "helper-text": "Type to search member"
1563
+ }, null, 8, ["modelValue", "items", "rules"]),
1564
+ i(s, {
1565
+ modelValue: e(o),
1566
+ "onUpdate:modelValue": k[1] || (k[1] = (P) => oe(o) ? o.value = P : null),
1567
+ label: "Reference (optional)",
1568
+ rules: [
1569
+ (P) => P.length < 50 || "Reference must be less than 50 characters"
1570
+ ]
1571
+ }, null, 8, ["modelValue", "rules"])
1572
+ ]),
1573
+ _: 1
1574
+ }, 512)
1575
+ ]),
1576
+ _: 1
1577
+ }, 8, ["modelValue"]);
1578
+ };
1579
+ }
1580
+ });
1581
+ var pn = { 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" };
1582
+ const yn = { class: "px-24 flex flex-col gap-y-16" }, fn = { class: "flex gap-8 items-center" }, bn = { class: "fm-typo-en-body-lg-600" }, gn = { 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" }, hn = { class: "fm-typo-en-title-sm-800" }, xn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Gn = /* @__PURE__ */ ee({
1583
+ __name: "Store",
1584
+ setup(v) {
1585
+ const x = {
1586
+ label: "Setup payout account",
1587
+ value: "payout",
1588
+ isPrimary: !1
1589
+ }, { t: l } = be(), f = {
1590
+ label: l("connect.store.actions.setting"),
1591
+ value: "setting",
1592
+ isPrimary: !1
1593
+ }, r = {
1594
+ label: l("connect.store.actions.manageReward"),
1595
+ value: "create_reward"
1596
+ }, b = {
1597
+ label: l("connect.store.actions.addCategory"),
1598
+ value: "create_category",
1599
+ isPrimary: !0,
1600
+ prependIcon: "add"
1601
+ }, o = R(), m = ct(), u = ke(), { global: t, minor: c } = Ee, y = Me(), d = j(() => u.sortedStoreCategories), V = j(() => u.sortedStoreCategories.map((s) => s.name)), a = R(), S = R();
1602
+ async function k(s) {
1603
+ var w;
1604
+ s === "setting" ? (w = a.value) == null || w.showSheet(!0, u.storeOption) : s === "create_category" ? Y(-1) : s === "create_reward" ? await m.push({ name: Ze["$connect-STORE_REWARDS"] }) : s == "payout" && window.open(pn.paymentPortalUrl, "_blank");
1605
+ }
1606
+ async function A(s) {
1607
+ await c(
1608
+ async () => {
1609
+ var w;
1610
+ await Ce.updateStore(s), await u.readMemberStore(), (w = a.value) == null || w.showSheet(!1);
1611
+ },
1612
+ {
1613
+ message: l("connect.store.setting.update.message"),
1614
+ successMessage: l("connect.store.setting.update.success")
1615
+ }
1616
+ );
1617
+ }
1618
+ async function Y(s = -1) {
1619
+ var w, U;
1620
+ if ((!u.storeOption || !u.storeOption.company) && await _e.confirm(
1621
+ l("connect.store.category.setup.title"),
1622
+ l("connect.store.category.setup.button"),
1623
+ l("connect.store.category.setup.action"),
1624
+ l("connect.common.cancel")
1625
+ ))
1626
+ return (w = a.value) == null ? void 0 : w.showSheet(!0);
1627
+ y.open({
1628
+ title: s == -1 ? l("connect.store.category.add") : l("connect.store.category.edit"),
1629
+ contentComponent: wt,
1630
+ contentComponentProps: {
1631
+ initialValue: ((U = d.value[s]) == null ? void 0 : U.name) ?? "",
1632
+ action: s == -1 ? "add" : "edit"
1633
+ }
1634
+ }).onPrimary(async (O) => {
1635
+ O === null && !await _e.remove(
1636
+ l("connect.store.category.remove.confirm"),
1637
+ l("connect.store.category.remove.title")
1638
+ ) || await c(
1639
+ async () => {
1640
+ const P = s == -1 ? [...d.value, { name: O, bundles: [] }] : [...d.value].map((N, p) => p == s ? { ...N, name: O } : N).filter((N) => N.name !== null);
1641
+ await Ce.updateStoreBundle({
1642
+ categories: P
1643
+ }), await u.readMemberStore();
1644
+ },
1645
+ {
1646
+ message: O === null ? l("connect.store.category.update.deleting") : s == -1 ? l("connect.store.category.update.creating") : l("connect.store.category.update.updating"),
1647
+ successMessage: O === null ? l("connect.store.category.update.success.deleted") : s == -1 ? l("connect.store.category.update.success.created") : l("connect.store.category.update.success.updated")
1648
+ }
1649
+ );
1650
+ });
1651
+ }
1652
+ async function W(s, w, U, O) {
1653
+ var p, n, C;
1654
+ w ?? (w = (p = S.value) == null ? void 0 : p.target.category), U ?? (U = (n = S.value) == null ? void 0 : n.target.index), O ?? (O = (C = S.value) == null ? void 0 : C.target.originalCategoryIndex);
1655
+ const P = De(d.value);
1656
+ for (const $ of P)
1657
+ for (const E of $.bundles)
1658
+ console.log(E, "bundle in payload"), "pf_vouchers" in E && delete E.pf_vouchers;
1659
+ w != O && (P[O].bundles.splice(U, 1), U = P[w].bundles.length), console.log(w, U, O, "ci, bi, originalCategoryIndex");
1660
+ const N = P[w];
1661
+ if (!N) {
1662
+ Xe.error("Unexpected error", 2e3);
1663
+ return;
1664
+ }
1665
+ if (s == null) {
1666
+ if (await _e.remove(
1667
+ "Are you sure you want to delete this bundle?",
1668
+ "Delete bundle"
1669
+ ) == !1)
1670
+ return;
1671
+ N.bundles.splice(U, 1);
1672
+ } else
1673
+ U == -1 ? N.bundles.push(s) : N.bundles[U] = s;
1674
+ await c(
1675
+ async () => {
1676
+ var $, E;
1677
+ if (s != null) {
1678
+ const q = ($ = S.value) == null ? void 0 : $.bundleImage;
1679
+ q === null && s.image ? (await Fe.delete(s.image), s.image = null) : q && (s.image = await Fe.update(
1680
+ Fe.bundleImagePath(void 0, q),
1681
+ q
1682
+ ));
1683
+ }
1684
+ await Ce.updateStoreBundle({
1685
+ categories: P
1686
+ }), await u.readMemberStore(), await u.readMembership(), await u.readRewards(), (E = S.value) == null || E.showSheet(!1);
1687
+ },
1688
+ {
1689
+ message: `${s == null ? "Deleting" : U == -1 ? "Creating" : "Updating"} bundle`,
1690
+ successMessage: `Bundle ${s == null ? "deleted" : U == -1 ? "created" : "updated"} successfully`
1691
+ }
1692
+ );
1693
+ }
1694
+ function K(s) {
1695
+ var w;
1696
+ (w = S.value) == null || w.showSheet(!0, {
1697
+ ...s,
1698
+ bundle: s.bundle ? De(s.bundle) : void 0
1699
+ });
1700
+ }
1701
+ const z = R([]);
1702
+ function ae(s) {
1703
+ var w;
1704
+ (w = o.value) == null || w.showSheet({
1705
+ bundle: s
1706
+ });
1707
+ }
1708
+ return fe(async () => {
1709
+ var w, U;
1710
+ await t(async () => {
1711
+ var O, P;
1712
+ if (await u.readMemberStore(), await u.readMembership(), await u.readRewards(), await u.readPayoutAccount(), (O = m.currentRoute.value.query) != null && O.action) {
1713
+ switch ((P = m.currentRoute.value.query) == null ? void 0 : P.action) {
1714
+ case "update_setting":
1715
+ k("setting");
1716
+ break;
1717
+ case "create_category":
1718
+ Y(-1);
1719
+ break;
1720
+ case "create_feedvibe_bundle":
1721
+ y.open({
1722
+ title: "Select category",
1723
+ contentComponent: $t
1724
+ }).onPrimary((N) => {
1725
+ y.close(), K({
1726
+ categories: V.value,
1727
+ category: N,
1728
+ index: -1,
1729
+ bundle: {
1730
+ ...ue.cloneDeep(Ve),
1731
+ isFeedvibe: !0,
1732
+ price: D.Dinero.fromNumber({
1733
+ number: 10,
1734
+ precision: 2
1735
+ }).toObject()
1736
+ }
1737
+ });
1738
+ }).onTertiary(() => y.close());
1739
+ break;
1740
+ }
1741
+ m.replace({ query: {} });
1742
+ }
1743
+ });
1744
+ const s = ((w = u.payoutAccount) == null ? void 0 : w.status) === "APPROVED" && ((U = u.payoutAccount) == null ? void 0 : U.enable) === !0;
1745
+ z.value = [
1746
+ ...s ? [] : [x],
1747
+ f,
1748
+ r,
1749
+ b
1750
+ ];
1751
+ }), (s, w) => {
1752
+ const U = h("FmPageHead"), O = h("FmButton"), P = h("FmCard");
1753
+ return g(), B(X, null, [
1754
+ i(U, {
1755
+ title: e(l)("connect.store.title"),
1756
+ actions: e(z),
1757
+ "onClick:action": k
1758
+ }, null, 8, ["title", "actions"]),
1759
+ _("div", yn, [
1760
+ e(d) && e(d).length > 0 ? (g(), B(X, { key: 0 }, [
1761
+ (g(!0), B(X, null, re(e(d), (N, p) => (g(), B("div", {
1762
+ key: N.name,
1763
+ class: "space-y-8 py-12"
1764
+ }, [
1765
+ _("div", fn, [
1766
+ _("div", bn, L(N.name), 1),
1767
+ i(Pe, { json: N }, null, 8, ["json"]),
1768
+ i(O, {
1769
+ icon: "edit",
1770
+ size: "md",
1771
+ variant: "tertiary",
1772
+ onClick: (n) => Y(p)
1773
+ }, null, 8, ["onClick"])
1774
+ ]),
1775
+ _("div", gn, [
1776
+ (g(!0), B(X, null, re(N.bundles, (n, C) => (g(), I(_t, {
1777
+ bundle: n,
1778
+ key: n._id,
1779
+ onEdit: ($) => K({
1780
+ bundle: n,
1781
+ category: p,
1782
+ index: C,
1783
+ categories: e(V)
1784
+ }),
1785
+ onDelete: ($) => W(null, p, C),
1786
+ onSend: ae
1787
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
1788
+ i(Ct, {
1789
+ onCreate: (n) => K({
1790
+ category: p,
1791
+ index: -1,
1792
+ categories: e(V)
1793
+ })
1794
+ }, null, 8, ["onCreate"])
1795
+ ])
1796
+ ]))), 128)),
1797
+ i(dn, {
1798
+ ref_key: "bundleSheetRef",
1799
+ ref: S,
1800
+ onUpdate: W
1801
+ }, null, 512)
1802
+ ], 64)) : (g(), I(P, {
1803
+ key: 1,
1804
+ variant: "outlined",
1805
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1806
+ }, {
1807
+ default: T(() => [
1808
+ w[1] || (w[1] = _("img", {
1809
+ src: Ye,
1810
+ class: "aspect-square w-[150px]"
1811
+ }, null, -1)),
1812
+ _("div", vn, [
1813
+ _("div", hn, L(e(l)("connect.store.bundle.title")), 1),
1814
+ _("div", xn, L(e(l)("connect.store.bundle.description")), 1)
1815
+ ]),
1816
+ i(O, {
1817
+ variant: "primary",
1818
+ label: e(l)("connect.store.actions.addCategory"),
1819
+ icon: "add",
1820
+ onClick: w[0] || (w[0] = (N) => Y(-1))
1821
+ }, null, 8, ["label"])
1822
+ ]),
1823
+ _: 1
1824
+ })),
1825
+ i(Wt, {
1826
+ ref_key: "settingSheetRef",
1827
+ ref: a,
1828
+ onUpdate: A
1829
+ }, null, 512),
1830
+ i(mn, {
1831
+ ref_key: "sendBundleSheetRef",
1832
+ ref: o
1833
+ }, null, 512)
1834
+ ])
1835
+ ], 64);
1836
+ };
1837
+ }
1838
+ });
1839
+ export {
1840
+ Gn as default
1841
+ };