@feedmepos/mf-connect 0.1.0-beta.8 → 0.1.0-beta.80

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