@feedmepos/mf-connect 0.1.98-beta.44 → 0.1.98-beta.45

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 (115) hide show
  1. package/dist/{App-B1sVRUgU.js → App-BX2UE7QI.js} +40 -37
  2. package/dist/{AuditLogs-jIv5rADu.js → AuditLogs-Crhi9QVp.js} +10 -10
  3. package/dist/{Bin-BFb2FxJL.js → Bin-xPurvadn.js} +8 -8
  4. package/dist/{Broadcast-C-yR1YzE.js → Broadcast-CUYyGJY-.js} +11 -11
  5. package/dist/{CampaignAnalytic-D2Udb-1I.js → CampaignAnalytic-BfUdUO6Y.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pp80jczz.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BoXhFyzX.js} +7 -7
  7. package/dist/Card-CISdGnSl.js +1060 -0
  8. package/dist/{Collections-DoDZlLT5.js → Collections-N7QyYqC-.js} +8 -8
  9. package/dist/{Credit-D-ss0yae.js → Credit-DpgSuzmF.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DbkQVmGE.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Ber_smZ-.js} +32 -32
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-B8LawUFT.js → EffectSheet.vue_vue_type_style_index_0_lang-CoJVTW3E.js} +6 -6
  12. package/dist/{Experience-OMwgCv-k.js → Experience-DO7c3BW8.js} +12 -12
  13. package/dist/{FileSaver.min-Ck08usZi.js → FileSaver.min-Bjq1OZ_L.js} +1 -1
  14. package/dist/{Game-S5m1kti2.js → Game-BHtJD6LM.js} +13 -13
  15. package/dist/GiftCardSetup-Dg-kNVsD.js +633 -0
  16. package/dist/{Grab-CgVDlh8N.js → Grab-BOMxmAcZ.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-B9JaZNoF.js → ImageInput.vue_vue_type_script_setup_true_lang-bEHeJol7.js} +1 -1
  18. package/dist/{Index-BZRQSQt3.js → Index-S2H2GVM8.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-CZp2vyhp.js → LocationPicker.vue_vue_type_script_setup_true_lang-cgXkx7R_.js} +1 -1
  20. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-D9iMrk0m.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CQQJuVCF.js} +1 -1
  21. package/dist/{LoyaltyDashboard-CkJsz_FM.js → LoyaltyDashboard-CbwiKazp.js} +7 -7
  22. package/dist/{MainLayout-y2AvCI7H.js → MainLayout-CPS8NNOv.js} +3 -3
  23. package/dist/{Marketing-CdekCDN6.js → Marketing-zIfCm74o.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-r3xPXa_W.js → MarketingMaterialEdit-D8Gj0bOa.js} +6 -6
  25. package/dist/{Member-D4O-38yG.js → Member-Wf4LUqGi.js} +12 -12
  26. package/dist/{MemberList-ABpFaISm.js → MemberList-CzLYfaf5.js} +26 -26
  27. package/dist/{MemberTransactions-DK-x6c7P.js → MemberTransactions-CeaEuCte.js} +1 -1
  28. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DGPNmiR9.js → MessageInput.vue_vue_type_script_setup_true_lang-BDqO9M6_.js} +10 -10
  29. package/dist/{Mission-5RhDQ1MF.js → Mission-B4UV0vB0.js} +13 -13
  30. package/dist/{Overview-B52hUVqf.js → Overview-DIX5ot1i.js} +19 -19
  31. package/dist/{Overview-0ukOrJQs.js → Overview-Ddua14pp.js} +3 -3
  32. package/dist/{Point-TSd4Uvmd.js → Point-CIFEhEU0.js} +12 -12
  33. package/dist/{Promotion-BBpfsz8N.js → Promotion-DJRRCgsu.js} +13 -13
  34. package/dist/{Queue-BgnYKxGG.js → Queue-PxS_JYvd.js} +11 -11
  35. package/dist/{Record-CAtURV9U.js → Record-DbOoWfsG.js} +9 -9
  36. package/dist/{Review-CuSrZB-m.js → Review-BmUzIF6a.js} +2 -2
  37. package/dist/{ReviewFacebookCallback-DQTVwxJo.js → ReviewFacebookCallback-ABDk27W_.js} +5 -5
  38. package/dist/{ReviewGoogleCallback-Dn1bMM23.js → ReviewGoogleCallback-JiGhuvNs.js} +5 -5
  39. package/dist/{Reward-GArpJo5Q.js → Reward-C9JJh35t.js} +16 -16
  40. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CuOxAvxV.js → RewardGroup.vue_vue_type_script_setup_true_lang-CoHS8BGv.js} +12 -12
  41. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BZTg3pTi.js → RuleGroup.vue_vue_type_script_setup_true_lang-CH_hNR0X.js} +15 -15
  42. package/dist/{Segment-BNoD4VPH.js → Segment-BDF6homc.js} +25 -25
  43. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-JrfOr5Px.js → SelectItems.vue_vue_type_script_setup_true_lang-CotltnlA.js} +2 -2
  44. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-BY8aFZsB.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dm1Rm5yj.js} +13 -13
  45. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-KVaH8rrU.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bu3TFRAU.js} +4 -4
  46. package/dist/{Setting-CRYXwRFL.js → Setting-I1UmwNUM.js} +14 -14
  47. package/dist/{SettingAdvertisements-Cqp6piIi.js → SettingAdvertisements-BTSCR7Ca.js} +12 -12
  48. package/dist/{Settings-DNkUFLud.js → Settings-F8t7rjZL.js} +5 -5
  49. package/dist/Store-DH9SeWMt.js +2615 -0
  50. package/dist/{StoreRewards-DDlMWlTG.js → StoreRewards-EkAXltsf.js} +15 -15
  51. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Zedck9Xi.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CXQyU9vZ.js} +21 -21
  52. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C3RBFu6J.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-lnEbqNTU.js} +2 -2
  53. package/dist/{Tier-t2Ce3rxu.js → Tier-DuKpa1Ma.js} +25 -25
  54. package/dist/{Title-CdI511i0.js → Title-DlupKRiB.js} +22 -22
  55. package/dist/Transaction-jCh6b6-e.js +45 -0
  56. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DsZxEZw9.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DOvKneyI.js} +6 -6
  57. package/dist/{Voucher-D1QRj4Ps.js → Voucher-QOyU02Mg.js} +14 -14
  58. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BVCNUWYO.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DH3SHPmi.js} +12 -12
  59. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-W_7pFEAG.js → ZodTextField.vue_vue_type_script_setup_true_lang-DA98LDj7.js} +2 -2
  60. package/dist/{app-D4yjN_fQ.js → app-CNi4ejgf.js} +522 -357
  61. package/dist/app.js +1 -1
  62. package/dist/{business-Dq1_o57i.js → business-D_DxmzRi.js} +1 -1
  63. package/dist/{campaign-CNkbWJTf.js → campaign-CQOgVXhK.js} +2 -2
  64. package/dist/{campaign-B7NIPxHs.js → campaign-DgLtIuZl.js} +7 -7
  65. package/dist/{campaign.fn-qKzOoBBQ.js → campaign.fn-DaygvaVk.js} +83 -83
  66. package/dist/{collection.fn-BNRVdqye.js → collection.fn-C2FPUyIL.js} +2 -2
  67. package/dist/{duplicateCampaign-D29czqvn.js → duplicateCampaign-C1GvaB0K.js} +2 -2
  68. package/dist/{effect-B0ikJb6x.js → effect-CZW6UzGQ.js} +1 -1
  69. package/dist/{email-addresses-D0ZUpClg.js → email-addresses-C0rpNk69.js} +2 -2
  70. package/dist/{export-Cr4mjkQZ.js → export-BljjhGlT.js} +3 -3
  71. package/dist/{helper-ClPuPdgQ.js → helper-BNVm1awI.js} +1 -1
  72. package/dist/{index-BcHiQWdr.js → index--l25G-H2.js} +2 -2
  73. package/dist/{index-B2hKSeR1.js → index-20y5ETqa.js} +1 -1
  74. package/dist/{index-By93YZmr.js → index-B3VxErFJ.js} +11 -6
  75. package/dist/{index-DfMsF_gT.js → index-BLcxRCDQ.js} +4 -4
  76. package/dist/{index-Dpk1tAhn.js → index-BTMG_CZc.js} +2 -2
  77. package/dist/{index-DpSlYwDW.js → index-Bl2Io2q7.js} +2 -2
  78. package/dist/{index-CuHNDW6e.js → index-C41OQn3b.js} +1 -1
  79. package/dist/{index-CnckzYTa.js → index-CP9JOHTI.js} +1 -1
  80. package/dist/{index-CFk1uqb8.js → index-CTDIDrHN.js} +1 -1
  81. package/dist/{index-DL7_OC7M.js → index-ChPTYhTe.js} +1 -1
  82. package/dist/{index-GjzeMN4u.js → index-ClMqJYPu.js} +480 -480
  83. package/dist/{index-Dyc5Dpgs.js → index-CuSyySq9.js} +1 -1
  84. package/dist/{index-DiqNx6FV.js → index-IL6JQ0Uk.js} +1 -1
  85. package/dist/{index-C8cXXcLk.js → index-JlyOHqyG.js} +19 -13
  86. package/dist/{index-BOfM9FNu.js → index-_RZ5EbvD.js} +7 -7
  87. package/dist/{index-BrP_OwGm.js → index-aRRiC6b9.js} +7 -7
  88. package/dist/{index-nuptxtNP.js → index-jN921Dx6.js} +3 -3
  89. package/dist/{index-CuPBtB3W.js → index-sBl1JAut.js} +1 -1
  90. package/dist/{index.esm2017-D3pI9NTE.js → index.esm2017-D2J5P0Jx.js} +1 -1
  91. package/dist/{loading-DLrpThuY.js → loading-fSLeqKr_.js} +1 -1
  92. package/dist/{lodash-BIVtqtkS.js → lodash-CanxPAR4.js} +1 -1
  93. package/dist/{membership-PNg3pIQf.js → membership-BrdyfO2y.js} +2 -2
  94. package/dist/{money-Ck2sBYbh.js → money-W_YTwyxP.js} +1 -1
  95. package/dist/{number-dfEMJDkz.js → number-j1vVuQpy.js} +1 -1
  96. package/dist/{objectid-Bz-UKgI1.js → objectid-DhwxE2Ct.js} +9 -9
  97. package/dist/{plugins-D4_SIsjZ.js → plugins-2XgEvjxm.js} +3 -3
  98. package/dist/{reward-UzeAq0jY.js → reward-Bk3FZbGj.js} +1 -1
  99. package/dist/{rule-6OCvKihv.js → rule-M9AijHS0.js} +3 -3
  100. package/dist/{rule-builder-VwyrN58i.js → rule-builder-C4yj8l-c.js} +1 -1
  101. package/dist/{template-DtwmJYOa.js → template-BguoWqRC.js} +6 -6
  102. package/dist/{timezone-CHqOZvJX.js → timezone-DdkTIxnK.js} +1 -1
  103. package/dist/{transaction.fn-rUQ2fYVQ.js → transaction.fn-BpfxFtTu.js} +1 -1
  104. package/dist/{trigger-BT3dj5qY.js → trigger-C7MXRREg.js} +5 -5
  105. package/dist/{useMarketingMaterialActions-Dgq_G1qO.js → useMarketingMaterialActions-CgJpHDNv.js} +3 -3
  106. package/dist/{usePagination-a1XSuIrr.js → usePagination-Csc19YZ0.js} +1 -1
  107. package/dist/{user-CFls8m-e.js → user-DCwNBNr2.js} +1 -1
  108. package/dist/{vue-i18n-CzEcAXx-.js → vue-i18n-BIpsBqfV.js} +397 -397
  109. package/dist/{xlsx-DKPe4AfX.js → xlsx-Esg-74Jx.js} +1 -1
  110. package/dist/{zod-D2Q81R3d.js → zod-D9ri6sIU.js} +1 -1
  111. package/package.json +1 -1
  112. package/dist/Card-CzzNo7nk.js +0 -996
  113. package/dist/GiftCardSetup-CR8NpUJv.js +0 -542
  114. package/dist/Store-Dnt8VDQA.js +0 -2413
  115. package/dist/Transaction-C2BHJU7_.js +0 -39
@@ -0,0 +1,2615 @@
1
+ import { defineComponent as X, computed as D, resolveComponent as v, openBlock as m, createBlock as R, withCtx as I, createElementVNode as n, toDisplayString as F, createVNode as i, createCommentVNode as M, createElementBlock as T, unref as e, Fragment as W, renderList as de, ref as O, isRef as ve, reactive as at, onMounted as Ee, watch as He, toRaw as st, createTextVNode as le, h as lt, normalizeStyle as Qe, normalizeClass as $e } from "vue";
2
+ import { _ as it } from "./tier-BJDhpH6X.js";
3
+ import { useDialog as ze, useDialogChild as We, components as rt } from "@feedmepos/ui-library";
4
+ import { c as j, e as Me, S as Ge } from "./index-BTMG_CZc.js";
5
+ import { u as et } from "./loading-fSLeqKr_.js";
6
+ import { u as Ye, C as Te } from "./membership-BrdyfO2y.js";
7
+ import { j as ct, k as dt, l as ut, m as Xe, n as mt, o as pt } from "./index-ClMqJYPu.js";
8
+ import { a as ft, c as Ae } from "./object-BYyQ0PZp.js";
9
+ import { _ as pe } from "./lodash-CanxPAR4.js";
10
+ import { c as Ce } from "./index-jN921Dx6.js";
11
+ import { u as he } from "./vue-i18n-BIpsBqfV.js";
12
+ import { Z as re, g as ae, a as se } from "./zod-D9ri6sIU.js";
13
+ import { z as ce, R as Oe } from "./app-CNi4ejgf.js";
14
+ import { u as Le } from "./app-wDQR6dpb.js";
15
+ import { _ as ge } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DA98LDj7.js";
16
+ import { c as yt, p as Ie, n as gt, f as je } from "./plugins-2XgEvjxm.js";
17
+ import { J as Je } from "./JsonViewer-v8_C7l5N.js";
18
+ import { _ as bt } from "./index-Bl2Io2q7.js";
19
+ import { _ as vt } from "./ImageInput.vue_vue_type_script_setup_true_lang-bEHeJol7.js";
20
+ import { _ as ht } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
21
+ import { z as xt, a as _t } from "./money-W_YTwyxP.js";
22
+ import { F as Ct } from "./number-j1vVuQpy.js";
23
+ import { a as St, t as Ft } from "./helper-BNVm1awI.js";
24
+ import "./index-C41OQn3b.js";
25
+ import "./index-_RZ5EbvD.js";
26
+ import "./index-BLcxRCDQ.js";
27
+ import "./index--l25G-H2.js";
28
+ import { m as wt } from "./index-sBl1JAut.js";
29
+ import { m as Ue } from "./index-20y5ETqa.js";
30
+ import { g as qe } from "./index-ChPTYhTe.js";
31
+ import { u as $t } from "./business-D_DxmzRi.js";
32
+ import { useRouter as kt } from "vue-router";
33
+ function tt(b) {
34
+ return Ce.DineroFactory(b).toUnit();
35
+ }
36
+ function ot(b, a, c, g, d = [], h = []) {
37
+ const o = bt.compact(
38
+ a.map((t) => b.find((r) => r.systemCode === t.systemCode && r.taxCode === t.taxCode)).filter((t) => !!t && h.includes(t.systemCode))
39
+ ), l = o.reduce(
40
+ (t, r) => {
41
+ var p;
42
+ return Object.assign(t, {
43
+ [r.taxCode]: {
44
+ inclusive: ((p = d.find((y) => y.systemCode === r.systemCode)) == null ? void 0 : p.inclusive) || !1,
45
+ adjustment: {
46
+ level: 1,
47
+ type: {
48
+ type: "BY_MULTIPLIER",
49
+ amount: {
50
+ amount: r.rate.amount,
51
+ precision: r.rate.precision,
52
+ currency: "MYR"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ });
58
+ },
59
+ {}
60
+ ), f = Ce.Calculator.calculate({
61
+ items: {
62
+ 0: {
63
+ quantity: 1,
64
+ adjustments: {
65
+ price: {
66
+ level: 0,
67
+ type: {
68
+ type: "BY_AMOUNT",
69
+ amount: Ce.DineroFactory(c).subtract(Ce.Dinero.fromNumber({ number: g }).toObject()).toObject()
70
+ }
71
+ }
72
+ },
73
+ taxes: l
74
+ }
75
+ },
76
+ adjustments: {},
77
+ roundToNearest: 0
78
+ });
79
+ return o.map((t) => ({
80
+ setting: t,
81
+ systemCode: t.systemCode,
82
+ name: t.name,
83
+ taxCode: t.taxCode,
84
+ rate: t.rate,
85
+ total: Ce.DineroFactory({
86
+ ...f.items[0].taxes[t.taxCode].amount
87
+ }).convertPrecision(2).toObject()
88
+ }));
89
+ }
90
+ function nt(b, a, c) {
91
+ return b ? b.reduce((g, d) => {
92
+ var h;
93
+ return (h = c.find((o) => o.systemCode === d.systemCode)) != null && h.inclusive || (g = Ce.DineroFactory(g.toObject()).add(d.total)), g;
94
+ }, Ce.DineroFactory(a)).toObject() : Ce.DineroFactory(a).toObject();
95
+ }
96
+ const Pt = { class: "flex justify-between items-start gap-4 w-full" }, Vt = { class: "fm-typo-en-body-lg-600 text-left pt-4 break-words line-clamp-2" }, Tt = { class: "flex-shrink-0 -mr-8 -mt-8" }, Rt = { class: "relative h-[120px] aspect-video flex mx-auto items-center justify-center border rounded-md border-fm-color-neutral-gray-300" }, It = ["src"], Ut = {
97
+ key: 2,
98
+ class: "absolute top-2 left-2"
99
+ }, Dt = { class: "flex flex-col gap-8 flex-1 text-left w-full" }, Et = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Bt = { class: "flex gap-8 items-center flex-wrap" }, Nt = /* @__PURE__ */ X({
100
+ __name: "StoreBundleCard",
101
+ props: {
102
+ bundle: { type: Object, required: !0 }
103
+ },
104
+ emits: ["edit", "delete", "send"],
105
+ setup(b, { emit: a }) {
106
+ const c = b, g = a, d = D(() => {
107
+ const o = [];
108
+ return c.bundle.price.amount > 0 && o.push(
109
+ `${j.Config.getCountry().currency.symbol}${tt(c.bundle.price)}`
110
+ ), c.bundle.coinPrice && o.push(`${c.bundle.coinPrice} point(s)`), o.join(" or ");
111
+ }), h = D(() => {
112
+ var l, f;
113
+ const o = [];
114
+ if (c.bundle.titles.length > 0 && o.push(`${c.bundle.titles.length} title(s)`), c.bundle.vouchers.length > 0 && o.push(`${c.bundle.vouchers.length} voucher(s)`), c.bundle.credit.normal || (l = c.bundle.credit.free) != null && l.amount) {
115
+ const t = c.bundle.credit.normal + (((f = c.bundle.credit.free) == null ? void 0 : f.amount) ?? 0);
116
+ o.push(`${t} credit(s)`);
117
+ }
118
+ return o;
119
+ });
120
+ return (o, l) => {
121
+ const f = v("FmButton"), t = v("FmMenuItem"), r = v("FmMenu"), p = v("FmIcon"), y = v("FmChip"), w = v("FmCard");
122
+ return m(), R(w, {
123
+ variant: "outlined",
124
+ class: "flex flex-col gap-y-8 p-16 min-h-[240px] h-full"
125
+ }, {
126
+ default: I(() => [
127
+ n("div", Pt, [
128
+ n("div", Vt, F(b.bundle.name), 1),
129
+ n("div", Tt, [
130
+ i(r, { placement: "bottom-end" }, {
131
+ "menu-button": I(() => [
132
+ i(f, {
133
+ icon: "more_vert",
134
+ variant: "tertiary"
135
+ })
136
+ ]),
137
+ default: I(() => [
138
+ i(t, {
139
+ onClick: l[0] || (l[0] = (u) => g("edit", b.bundle)),
140
+ icon: "edit",
141
+ label: "Edit"
142
+ }),
143
+ b.bundle.stripePriceId ? M("", !0) : (m(), R(t, {
144
+ key: 0,
145
+ onClick: l[1] || (l[1] = (u) => g("send", b.bundle)),
146
+ icon: "send",
147
+ label: "Send"
148
+ })),
149
+ i(t, {
150
+ onClick: l[2] || (l[2] = (u) => g("delete", b.bundle)),
151
+ icon: "delete"
152
+ }, {
153
+ label: I(() => [...l[3] || (l[3] = [
154
+ n("div", { class: "text-fm-color-typo-error fm-typo-en-body-md-400" }, " Delete ", -1)
155
+ ])]),
156
+ _: 1
157
+ })
158
+ ]),
159
+ _: 1
160
+ })
161
+ ])
162
+ ]),
163
+ n("div", Rt, [
164
+ b.bundle.image ? (m(), T("img", {
165
+ key: 1,
166
+ src: b.bundle.image,
167
+ class: "w-full h-full object-contain aspect-video"
168
+ }, null, 8, It)) : (m(), R(p, {
169
+ key: 0,
170
+ name: "image",
171
+ outline: !0,
172
+ size: "md",
173
+ class: "text-fm-color-neutral-gray-200"
174
+ })),
175
+ b.bundle.isFeedvibe ? (m(), T("div", Ut, [
176
+ i(y, {
177
+ label: "Feedvibe",
178
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
179
+ compact: ""
180
+ })
181
+ ])) : M("", !0)
182
+ ]),
183
+ n("div", Dt, [
184
+ n("div", Et, F(e(d) || "Free"), 1),
185
+ n("div", Bt, [
186
+ (m(!0), T(W, null, de(e(h), (u, S) => (m(), R(y, {
187
+ key: S,
188
+ label: u
189
+ }, null, 8, ["label"]))), 128))
190
+ ])
191
+ ])
192
+ ]),
193
+ _: 1
194
+ });
195
+ };
196
+ }
197
+ }), Mt = /* @__PURE__ */ X({
198
+ __name: "AddBundleCard",
199
+ emits: ["create"],
200
+ setup(b, { emit: a }) {
201
+ const { t: c } = he(), g = a;
202
+ return (d, h) => {
203
+ const o = v("FmButton"), l = v("FmCard");
204
+ return m(), R(l, {
205
+ variant: "outlined",
206
+ class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
207
+ }, {
208
+ default: I(() => [
209
+ i(o, {
210
+ onClick: h[0] || (h[0] = (f) => g("create")),
211
+ label: e(c)("connect.store.actions.addBundle"),
212
+ icon: "add",
213
+ variant: "secondary"
214
+ }, null, 8, ["label"])
215
+ ]),
216
+ _: 1
217
+ });
218
+ };
219
+ }
220
+ }), Ot = { class: "space-y-16" }, Lt = { class: "flex w-full justify-between pb-16" }, At = { class: "flex items-center justify-end gap-8" }, jt = /* @__PURE__ */ X({
221
+ __name: "CategoryDialog",
222
+ props: {
223
+ action: {
224
+ type: String,
225
+ default: () => "add"
226
+ },
227
+ initialValue: {
228
+ type: String,
229
+ default: () => ""
230
+ }
231
+ },
232
+ setup(b) {
233
+ const { t: a } = he(), c = b, g = ze(), { emitData: d, emitAction: h } = We(), o = O(c.initialValue), l = ce.string().min(1);
234
+ function f() {
235
+ d(o.value), h("primary"), g.close();
236
+ }
237
+ function t() {
238
+ d(null), h("primary"), g.close();
239
+ }
240
+ return (r, p) => {
241
+ const y = v("FmTextField"), w = v("FmButton");
242
+ return m(), T("div", Ot, [
243
+ i(y, {
244
+ modelValue: e(o),
245
+ "onUpdate:modelValue": p[0] || (p[0] = (u) => ve(o) ? o.value = u : null),
246
+ label: e(a)("connect.store.category.label"),
247
+ rules: [e(re).toRule(e(l))]
248
+ }, null, 8, ["modelValue", "label", "rules"]),
249
+ n("div", Lt, [
250
+ n("div", null, [
251
+ b.action == "edit" ? (m(), R(w, {
252
+ key: 0,
253
+ onClick: t,
254
+ label: e(a)("connect.common.delete"),
255
+ variant: "destructive"
256
+ }, null, 8, ["label"])) : M("", !0)
257
+ ]),
258
+ n("div", At, [
259
+ i(w, {
260
+ label: e(a)("connect.common.cancel"),
261
+ variant: "tertiary",
262
+ onClick: p[1] || (p[1] = (u) => e(g).close())
263
+ }, null, 8, ["label"]),
264
+ i(w, {
265
+ label: b.action == "edit" ? e(a)("connect.common.edit") : e(a)("connect.common.add"),
266
+ disabled: !e(o),
267
+ onClick: f
268
+ }, null, 8, ["label", "disabled"])
269
+ ])
270
+ ])
271
+ ]);
272
+ };
273
+ }
274
+ }), qt = { class: "space-y-16" }, Gt = { class: "flex items-center justify-end gap-8 pb-16" }, Kt = /* @__PURE__ */ X({
275
+ __name: "SelectCategoryDialog",
276
+ setup(b) {
277
+ const { emitData: a, emitAction: c } = We(), g = Ye(), d = O(), h = D(
278
+ () => g.sortedStoreCategories.map((o, l) => ({
279
+ label: o.name,
280
+ value: l
281
+ }))
282
+ );
283
+ return (o, l) => {
284
+ const f = v("FmSelect"), t = v("FmButton");
285
+ return m(), T("div", qt, [
286
+ l[4] || (l[4] = n("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Select a category to create FeedMe CNY 2025 bundle ", -1)),
287
+ i(f, {
288
+ placeholder: "Select a category",
289
+ items: e(h),
290
+ modelValue: e(d),
291
+ "onUpdate:modelValue": [
292
+ l[0] || (l[0] = (r) => ve(d) ? d.value = r : null),
293
+ l[1] || (l[1] = (r) => e(a)(r))
294
+ ],
295
+ label: "Category"
296
+ }, null, 8, ["items", "modelValue"]),
297
+ n("div", Gt, [
298
+ i(t, {
299
+ variant: "tertiary",
300
+ label: "Cancel",
301
+ onClick: l[2] || (l[2] = (r) => e(c)("tertiary"))
302
+ }),
303
+ i(t, {
304
+ label: "Select",
305
+ onClick: l[3] || (l[3] = (r) => e(c)("primary")),
306
+ disabled: e(d) == null
307
+ }, null, 8, ["disabled"])
308
+ ])
309
+ ]);
310
+ };
311
+ }
312
+ });
313
+ function be(b) {
314
+ return b.states.map((a) => ({ label: a, value: a }));
315
+ }
316
+ const Ht = {
317
+ [Me.F_COUNTRY.enum.MY]: {
318
+ states: [
319
+ "Johor",
320
+ "Kedah",
321
+ "Kelantan",
322
+ "Kuala Lumpur",
323
+ "Labuan",
324
+ "Melaka",
325
+ "Negeri Sembilan",
326
+ "Pahang",
327
+ "Perak",
328
+ "Perlis",
329
+ "Pulau Pinang",
330
+ "Putrajaya",
331
+ "Sabah",
332
+ "Sarawak",
333
+ "Selangor",
334
+ "Terengganu"
335
+ ],
336
+ get stateItems() {
337
+ return be(this);
338
+ }
339
+ },
340
+ [Me.F_COUNTRY.enum.SG]: {
341
+ states: [],
342
+ get stateItems() {
343
+ return be(this);
344
+ }
345
+ },
346
+ JP: {
347
+ states: [],
348
+ get stateItems() {
349
+ return be(this);
350
+ }
351
+ },
352
+ AE: {
353
+ states: [],
354
+ get stateItems() {
355
+ return be(this);
356
+ }
357
+ },
358
+ AU: {
359
+ states: [],
360
+ get stateItems() {
361
+ return be(this);
362
+ }
363
+ },
364
+ MO: {
365
+ states: [],
366
+ get stateItems() {
367
+ return be(this);
368
+ }
369
+ },
370
+ VN: {
371
+ states: [],
372
+ get stateItems() {
373
+ return be(this);
374
+ }
375
+ },
376
+ [Me.F_COUNTRY.enum.ID]: {
377
+ states: [
378
+ "Aceh",
379
+ "Bali",
380
+ "Bangka-Belitung",
381
+ "Banten",
382
+ "Bengkulu",
383
+ "Central Java",
384
+ "Central Sulawesi",
385
+ "Daerah Istimewa Yogyakarta",
386
+ "East Java",
387
+ "East Kalimantan",
388
+ "East Nusa Tenggara",
389
+ "Gorontalo",
390
+ "Jakarta Raya",
391
+ "Jambi",
392
+ "Kalimantan Tengah",
393
+ "Lampung",
394
+ "Maluku",
395
+ "Maluku Utara",
396
+ "North Sulawesi",
397
+ "North Sumatra",
398
+ "Nusa Tenggara Barat",
399
+ "Papua",
400
+ "Riau",
401
+ "Riau Islands",
402
+ "South Kalimantan",
403
+ "South Sulawesi",
404
+ "South Sumatra",
405
+ "Sulawesi Barat",
406
+ "Sulawesi Tenggara",
407
+ "West Java",
408
+ "West Kalimantan",
409
+ "West Papua",
410
+ "West Sumatra"
411
+ ],
412
+ get stateItems() {
413
+ return be(this);
414
+ }
415
+ },
416
+ [Me.F_COUNTRY.enum.TH]: {
417
+ states: [
418
+ "Bangkok",
419
+ "Amnat Charoen",
420
+ "Ang Thong",
421
+ "Bueng Kan",
422
+ "Buri Ram",
423
+ "Chachoengsao",
424
+ "Chai Nat",
425
+ "Chaiyaphum",
426
+ "Chanthaburi",
427
+ "Chiang Mai",
428
+ "Chiang Rai",
429
+ "Chonburi",
430
+ "Chumphon",
431
+ "Kalasin",
432
+ "Kamphaeng Phet",
433
+ "Kanchanaburi",
434
+ "Khon Kaen",
435
+ "Krabi",
436
+ "Lampang",
437
+ "Lamphun",
438
+ "Loei",
439
+ "Lopburi",
440
+ "Mae Hong Son",
441
+ "Maha Sarakham",
442
+ "Mukdahan",
443
+ "Nakhon Nayok",
444
+ "Nakhon Pathom",
445
+ "Nakhon Phanom",
446
+ "Nakhon Ratchasima",
447
+ "Nakhon Sawan",
448
+ "Nakhon Si Thammarat",
449
+ "Nan",
450
+ "Narathiwat",
451
+ "Nong Bua Lamphu",
452
+ "Nong Khai",
453
+ "Nonthaburi",
454
+ "Pathum Thani",
455
+ "Pattani",
456
+ "Phang Nga",
457
+ "Phatthalung",
458
+ "Phayao",
459
+ "Phetchabun",
460
+ "Phetchaburi",
461
+ "Phichit",
462
+ "Phitsanulok",
463
+ "Phra Nakhon Si Ayutthaya",
464
+ "Phrae",
465
+ "Phuket",
466
+ "Prachinburi",
467
+ "Prachuap Khiri Khan",
468
+ "Ranong",
469
+ "Ratchaburi",
470
+ "Rayong",
471
+ "Roi Et",
472
+ "Sa Kaeo",
473
+ "Sakon Nakhon",
474
+ "Samut Prakan",
475
+ "Samut Sakhon",
476
+ "Samut Songkhram",
477
+ "Saraburi",
478
+ "Satun",
479
+ "Sing Buri",
480
+ "Sisaket",
481
+ "Songkhla",
482
+ "Sukhothai",
483
+ "Suphan Buri",
484
+ "Surat Thani",
485
+ "Surin",
486
+ "Tak",
487
+ "Trang",
488
+ "Trat",
489
+ "Ubon Ratchathani",
490
+ "Udon Thani",
491
+ "Uthai Thani",
492
+ "Uttaradit",
493
+ "Yala",
494
+ "Yasothon"
495
+ ],
496
+ get stateItems() {
497
+ return be(this);
498
+ }
499
+ }
500
+ }, Re = () => j.Config.getCountry(), De = {
501
+ get fullCurrency() {
502
+ return Re().currency;
503
+ },
504
+ get currency() {
505
+ return Re().currency.code;
506
+ },
507
+ get fullTax() {
508
+ return j.Country.getCountryFlattenTaxes(Re().code);
509
+ },
510
+ get taxSystem() {
511
+ return Re().taxSystems;
512
+ },
513
+ taxInclusion(b) {
514
+ return De.taxSystem.map((a) => ({
515
+ systemCode: a.code,
516
+ inclusive: b !== void 0 ? b : !1
517
+ }));
518
+ },
519
+ groupedTaxOptions() {
520
+ const b = j.Country.getCountryFlattenTaxes(Re().code);
521
+ return De.taxSystem.map((a) => ({
522
+ code: a.code,
523
+ options: b.map((c) => ({ ...c, feedmeTaxCode: De.generateCode(c) })).filter((c) => c.systemCode === a.code)
524
+ }));
525
+ },
526
+ systemDefaultCode(b) {
527
+ const a = De.groupedTaxOptions().find((c) => c.code === b);
528
+ return a == null ? void 0 : a.options.find((c) => c.default);
529
+ },
530
+ generateCode(b) {
531
+ return `${b.systemCode}/${b.taxCode}`;
532
+ }
533
+ }, Q = De, zt = /* @__PURE__ */ X({
534
+ __name: "TaxInclusiveSetting",
535
+ props: {
536
+ modelValue: {
537
+ type: Array,
538
+ required: !0,
539
+ default: () => []
540
+ }
541
+ },
542
+ emits: ["update:model-value"],
543
+ setup(b, { emit: a }) {
544
+ const c = b, g = Q.taxSystem, d = a, h = O(c.modelValue);
545
+ function o(r, p) {
546
+ const y = pe.clone(c.modelValue), w = y.findIndex((u) => u.systemCode === r);
547
+ w >= 0 ? y[w].inclusive = p : y.push({
548
+ systemCode: r,
549
+ inclusive: p
550
+ }), h.value = y, d("update:model-value", y);
551
+ }
552
+ function l() {
553
+ return g.map((r) => {
554
+ const p = c.modelValue ? c.modelValue.find((y) => y.systemCode === r.code) : !1;
555
+ return {
556
+ label: r.name,
557
+ config: {
558
+ value: p ? p.inclusive : !1
559
+ },
560
+ input: (y) => {
561
+ o(r.code, y);
562
+ }
563
+ };
564
+ });
565
+ }
566
+ const f = at(l());
567
+ function t(r, p) {
568
+ return `${r} ${p ? "Inclusive" : "Exclusive"}`;
569
+ }
570
+ return Ee(() => {
571
+ c.modelValue.length || o(g[0].code, !1);
572
+ }), He(
573
+ () => c.modelValue,
574
+ (r, p) => {
575
+ r != p && !r.length && o(g[0].code, !1);
576
+ }
577
+ ), (r, p) => {
578
+ const y = v("FmSwitch");
579
+ return m(!0), T(W, null, de(e(f), (w, u) => {
580
+ var S;
581
+ return m(), T("div", { key: u }, [
582
+ i(y, {
583
+ "model-value": ((S = e(h)[u]) == null ? void 0 : S.inclusive) || !1,
584
+ "label-placement": "left",
585
+ "onUpdate:modelValue": ($) => w.input($)
586
+ }, {
587
+ label: I(() => {
588
+ var $;
589
+ return [
590
+ n("div", null, F(t(w.label, (($ = e(h)[u]) == null ? void 0 : $.inclusive) || !1)), 1)
591
+ ];
592
+ }),
593
+ _: 2
594
+ }, 1032, ["model-value", "onUpdate:modelValue"])
595
+ ]);
596
+ }), 128);
597
+ };
598
+ }
599
+ });
600
+ var Wt = { mode: "development", appMode: "mf" };
601
+ const Yt = { class: "space-y-8" }, Jt = {
602
+ key: 0,
603
+ class: "space-y-16"
604
+ }, Xt = /* @__PURE__ */ X({
605
+ __name: "StripeSetting",
606
+ props: {
607
+ modelValue: {}
608
+ },
609
+ emits: ["update:modelValue"],
610
+ setup(b, { emit: a }) {
611
+ const c = b, g = a, d = O(!1);
612
+ He(d, (o, l) => {
613
+ l != o && (!c.modelValue && o ? g("update:modelValue", {
614
+ apiKey: "",
615
+ webhookSecret: ""
616
+ }) : o || g("update:modelValue", void 0));
617
+ });
618
+ const h = D(() => {
619
+ const o = Wt.mode === "development", l = j.Config.getCountry().code.toLowerCase(), f = l != "my" ? `.${l}` : "";
620
+ return `https://marketing${o ? "-dev" : ""}${f}.feedmeapi.com/stripe/${Ge.getBusinessId()}/webhook`;
621
+ });
622
+ return Ee(() => {
623
+ d.value = !!c.modelValue;
624
+ }), (o, l) => {
625
+ const f = v("FmSwitch"), t = v("FmTextField"), r = v("FmButton");
626
+ return m(), T("div", Yt, [
627
+ i(f, {
628
+ modelValue: e(d),
629
+ "onUpdate:modelValue": l[0] || (l[0] = (p) => ve(d) ? d.value = p : null),
630
+ value: "true",
631
+ label: "Enable Stripe"
632
+ }, null, 8, ["modelValue"]),
633
+ c.modelValue ? (m(), T("div", Jt, [
634
+ i(t, {
635
+ label: "API Key",
636
+ modelValue: c.modelValue.apiKey,
637
+ "onUpdate:modelValue": l[1] || (l[1] = (p) => c.modelValue.apiKey = p),
638
+ "helper-text": "Go to Stripe Dashboard get your API Key and paste here."
639
+ }, null, 8, ["modelValue"]),
640
+ i(t, {
641
+ label: "Webhook URL",
642
+ "model-value": e(h),
643
+ readonly: "",
644
+ "helper-text": "Copy this URL to your Stripe dashboard"
645
+ }, {
646
+ append: I(() => [
647
+ i(r, {
648
+ icon: "content_copy",
649
+ variant: "tertiary",
650
+ onClick: l[2] || (l[2] = (p) => e(yt)(e(h)))
651
+ })
652
+ ]),
653
+ _: 1
654
+ }, 8, ["model-value"]),
655
+ i(t, {
656
+ modelValue: c.modelValue.webhookSecret,
657
+ "onUpdate:modelValue": l[3] || (l[3] = (p) => c.modelValue.webhookSecret = p),
658
+ label: "Webhook Secret",
659
+ "helper-text": `Copy the webhook signing secret from your Stripe account and paste
660
+ here.`
661
+ }, null, 8, ["modelValue"])
662
+ ])) : M("", !0)
663
+ ]);
664
+ };
665
+ }
666
+ }), Zt = {
667
+ key: 0,
668
+ class: "space-y-16 pr-12"
669
+ }, Qt = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, eo = {
670
+ key: 1,
671
+ class: "space-y-16"
672
+ }, to = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, oo = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, no = { class: "grid grid-cols-2 gap-x-16 gap-y-16" }, ao = { class: "space-y-4" }, so = { class: "fm-typo-en-body-lg-400" }, lo = { class: "space-y-16" }, io = { class: "fm-typo-en-title-sm-800 !mb-[-12px]" }, ro = { class: "flex items-center gap-8" }, co = /* @__PURE__ */ X({
673
+ __name: "StoreSettingSheet",
674
+ emits: ["update"],
675
+ setup(b, { expose: a, emit: c }) {
676
+ const { t: g } = he(), d = c, h = O(!1), o = O(), l = O(!1), f = ct.extend({
677
+ company: dt.extend({
678
+ name: ce.string().min(1, "Company name is required"),
679
+ regNo: ce.string().min(1, "Registration number is required"),
680
+ address: ut.extend({
681
+ line1: ce.string().min(1, "Line 1 is required"),
682
+ line2: ce.string().optional(),
683
+ state: ce.string().min(1, "State is required"),
684
+ city: ce.string().min(1, "City is required"),
685
+ postcode: ce.string().min(1, "Postcode is required"),
686
+ country: ce.string().min(1, "Country is required")
687
+ }),
688
+ phoneNo: ce.string().min(1, "Phone number is required"),
689
+ sstRegNo: ce.string().optional()
690
+ })
691
+ }), t = D(() => f.safeParse(o.value).success);
692
+ function r() {
693
+ const w = f.safeParse(o.value);
694
+ w.success && d("update", w.data);
695
+ }
696
+ function p() {
697
+ return {
698
+ company: {
699
+ name: "",
700
+ address: {
701
+ line1: "",
702
+ line2: "",
703
+ city: "",
704
+ postcode: "",
705
+ state: "",
706
+ country: j.Config.getCountry().name
707
+ },
708
+ phoneNo: "",
709
+ regNo: "",
710
+ sstRegNo: ""
711
+ },
712
+ inclusiveTaxes: []
713
+ };
714
+ }
715
+ function y(w, u) {
716
+ h.value = w, w && (o.value = u != null && u.company ? pe.cloneDeep(u) : p());
717
+ }
718
+ return a({
719
+ showSheet: y,
720
+ data: o
721
+ }), (w, u) => {
722
+ const S = v("FmIcon"), $ = v("FmMenuItem"), N = v("FmMenu"), ue = v("FmSelect"), oe = v("FmButton"), z = v("FmSideSheet");
723
+ return m(), R(z, {
724
+ "max-width": 560,
725
+ modelValue: e(h),
726
+ "onUpdate:modelValue": u[15] || (u[15] = (te) => ve(h) ? h.value = te : null),
727
+ header: e(g)("connect.store.setting.title")
728
+ }, {
729
+ "side-sheet-footer": I(() => [
730
+ n("div", ro, [
731
+ i(oe, {
732
+ label: e(g)("connect.common.save"),
733
+ onClick: r,
734
+ disabled: !e(t) || e(Le)().isLoading,
735
+ loading: e(Le)().isLoading
736
+ }, null, 8, ["label", "disabled", "loading"]),
737
+ i(oe, {
738
+ label: e(g)("connect.common.cancel"),
739
+ onClick: u[14] || (u[14] = (te) => y(!1)),
740
+ variant: "tertiary"
741
+ }, null, 8, ["label"])
742
+ ])
743
+ ]),
744
+ default: I(() => {
745
+ var te, me;
746
+ return [
747
+ i(Je, { json: e(o) }, null, 8, ["json"]),
748
+ e(o) && e(o).company ? (m(), T("div", Zt, [
749
+ n("div", Qt, F(e(g)("connect.store.setting.company.legal_info")), 1),
750
+ i(ge, {
751
+ modelValue: e(o).company.name,
752
+ "onUpdate:modelValue": u[0] || (u[0] = (V) => e(o).company.name = V),
753
+ label: e(g)("connect.store.setting.company.name"),
754
+ schema: e(re).typeAtPath(e(f), "company.name")
755
+ }, null, 8, ["modelValue", "label", "schema"]),
756
+ i(ge, {
757
+ modelValue: e(o).company.regNo,
758
+ "onUpdate:modelValue": u[1] || (u[1] = (V) => e(o).company.regNo = V),
759
+ label: e(g)("connect.store.setting.company.reg_no"),
760
+ schema: e(re).typeAtPath(e(f), "company.regNo")
761
+ }, null, 8, ["modelValue", "label", "schema"]),
762
+ e(j.Config).getCountry().taxSystems.length ? (m(), R(ge, {
763
+ key: 0,
764
+ modelValue: e(o).company.sstRegNo,
765
+ "onUpdate:modelValue": [
766
+ u[2] || (u[2] = (V) => e(o).company.sstRegNo = V),
767
+ u[3] || (u[3] = (V) => V ? null : e(o).inclusiveTaxes = [])
768
+ ],
769
+ label: e(g)("connect.store.setting.company.tax_reg_no"),
770
+ schema: e(re).typeAtPath(e(f), "company.sstRegNo")
771
+ }, null, 8, ["modelValue", "label", "schema"])) : M("", !0),
772
+ (te = e(o).company) != null && te.sstRegNo && e(o).inclusiveTaxes ? (m(), T("div", eo, [
773
+ n("div", to, F(e(g)("connect.store.setting.company.tax")), 1),
774
+ i(zt, {
775
+ modelValue: e(o).inclusiveTaxes,
776
+ "onUpdate:modelValue": u[4] || (u[4] = (V) => e(o).inclusiveTaxes = V)
777
+ }, null, 8, ["modelValue"])
778
+ ])) : M("", !0),
779
+ i(ge, {
780
+ modelValue: e(o).company.phoneNo,
781
+ "onUpdate:modelValue": u[5] || (u[5] = (V) => e(o).company.phoneNo = V),
782
+ label: e(g)("connect.store.setting.company.phone"),
783
+ schema: e(re).typeAtPath(e(f), "company.phoneNo")
784
+ }, null, 8, ["modelValue", "label", "schema"]),
785
+ n("div", oo, F(e(g)("connect.store.setting.company.address.title")), 1),
786
+ i(ge, {
787
+ modelValue: e(o).company.address.line1,
788
+ "onUpdate:modelValue": u[6] || (u[6] = (V) => e(o).company.address.line1 = V),
789
+ label: e(g)("connect.store.setting.company.address.line1"),
790
+ schema: e(re).typeAtPath(e(f), "company.address.line1")
791
+ }, null, 8, ["modelValue", "label", "schema"]),
792
+ i(ge, {
793
+ modelValue: e(o).company.address.line2,
794
+ "onUpdate:modelValue": u[7] || (u[7] = (V) => e(o).company.address.line2 = V),
795
+ label: e(g)("connect.store.setting.company.address.line2"),
796
+ schema: e(re).typeAtPath(e(f), "company.address.line2")
797
+ }, null, 8, ["modelValue", "label", "schema"]),
798
+ n("div", no, [
799
+ i(ge, {
800
+ modelValue: e(o).company.address.city,
801
+ "onUpdate:modelValue": u[8] || (u[8] = (V) => e(o).company.address.city = V),
802
+ label: e(g)("connect.store.setting.company.address.city"),
803
+ schema: e(re).typeAtPath(e(f), "company.address.city")
804
+ }, null, 8, ["modelValue", "label", "schema"]),
805
+ i(ge, {
806
+ modelValue: e(o).company.address.postcode,
807
+ "onUpdate:modelValue": u[9] || (u[9] = (V) => e(o).company.address.postcode = V),
808
+ label: e(g)("connect.store.setting.company.address.postcode"),
809
+ schema: e(re).typeAtPath(e(f), "company.address.postcode")
810
+ }, null, 8, ["modelValue", "label", "schema"]),
811
+ n("div", ao, [
812
+ n("div", so, F(e(g)("connect.store.setting.company.address.state")), 1),
813
+ i(N, {
814
+ placement: "top-end",
815
+ "model-value": e(l)
816
+ }, {
817
+ "menu-button": I(() => [
818
+ i(ge, {
819
+ modelValue: e(o).company.address.state,
820
+ "onUpdate:modelValue": u[10] || (u[10] = (V) => e(o).company.address.state = V),
821
+ schema: e(re).typeAtPath(e(f), "company.address.state"),
822
+ onFocusChanged: u[11] || (u[11] = (V) => l.value = V)
823
+ }, {
824
+ append: I(() => [
825
+ i(S, {
826
+ name: e(l) ? "keyboard_arrow_up" : "keyboard_arrow_down"
827
+ }, null, 8, ["name"])
828
+ ]),
829
+ _: 1
830
+ }, 8, ["modelValue", "schema"])
831
+ ]),
832
+ default: I(() => [
833
+ (m(!0), T(W, null, de(e(Ht)[e(j.Config).getCountry().code].stateItems.filter(
834
+ (V) => {
835
+ var xe, fe;
836
+ return V.label.toLowerCase().includes(((fe = (xe = e(o)) == null ? void 0 : xe.company) == null ? void 0 : fe.address.state.toLowerCase()) ?? "");
837
+ }
838
+ ) || [], (V) => (m(), R($, {
839
+ key: V.value,
840
+ "model-value": e(o).company.address.state === V.value,
841
+ label: V.label,
842
+ onClick: () => {
843
+ e(o).company.address.state = V.value, l.value = !1;
844
+ }
845
+ }, null, 8, ["model-value", "label", "onClick"]))), 128))
846
+ ]),
847
+ _: 1
848
+ }, 8, ["model-value"])
849
+ ]),
850
+ i(ue, {
851
+ label: e(g)("connect.store.setting.company.address.country"),
852
+ modelValue: e(o).company.address.country,
853
+ "onUpdate:modelValue": u[12] || (u[12] = (V) => e(o).company.address.country = V),
854
+ items: [
855
+ {
856
+ label: e(j.Config).getCountry().name,
857
+ value: e(j.Config).getCountry().name
858
+ }
859
+ ],
860
+ rules: [e(re).ruleAtPath(e(f), "company.address.country")]
861
+ }, null, 8, ["label", "modelValue", "items", "rules"])
862
+ ]),
863
+ n("div", lo, [
864
+ n("div", io, F(e(g)("connect.store.setting.stripe.title")), 1),
865
+ i(Xt, {
866
+ "model-value": (me = e(o)) == null ? void 0 : me.stripe,
867
+ "onUpdate:modelValue": u[13] || (u[13] = (V) => e(o).stripe = V)
868
+ }, null, 8, ["model-value"])
869
+ ])
870
+ ])) : M("", !0)
871
+ ];
872
+ }),
873
+ _: 1
874
+ }, 8, ["modelValue", "header"]);
875
+ };
876
+ }
877
+ });
878
+ function uo(b, a = !0) {
879
+ return j.DineroFactory(b).toFormat(a);
880
+ }
881
+ const mo = /* @__PURE__ */ X({
882
+ __name: "TaxVariantSetting",
883
+ props: {
884
+ modelValue: {
885
+ type: Array,
886
+ required: !0,
887
+ default: () => []
888
+ }
889
+ },
890
+ emits: ["update:modelValue"],
891
+ setup(b, { emit: a }) {
892
+ const c = b, g = a;
893
+ Ee(() => {
894
+ if (o.value.length !== h.value.length) {
895
+ const t = h.value.reduce((r, p) => {
896
+ const y = Q.systemDefaultCode(p.name);
897
+ if (!y) return r;
898
+ const { systemCode: w, taxCode: u } = y;
899
+ return p.value || r.push({ systemCode: w, taxCode: u }), r;
900
+ }, []);
901
+ f(t);
902
+ }
903
+ });
904
+ function d() {
905
+ return Q.groupedTaxOptions();
906
+ }
907
+ const h = D(() => d().map((t) => ({
908
+ name: t.code,
909
+ value: (o.value || []).find(
910
+ (r) => t.options.some((p) => p.feedmeTaxCode === r)
911
+ ),
912
+ options: t.options.map((r) => ({
913
+ label: `${r.name} (${Ct(r.rate)}%)`,
914
+ value: r.feedmeTaxCode
915
+ }))
916
+ }))), o = D(() => c.modelValue.map((t) => Q.generateCode(t)));
917
+ function l(t) {
918
+ const r = d().find(
919
+ (u) => u.options.some((S) => S.feedmeTaxCode === t)
920
+ ), p = r == null ? void 0 : r.options.find((u) => u.feedmeTaxCode === t);
921
+ if (!p) return;
922
+ const { systemCode: y, taxCode: w } = p;
923
+ f([{ systemCode: y, taxCode: w }]);
924
+ }
925
+ function f(t) {
926
+ const r = pe.clone(c.modelValue);
927
+ t.forEach((p) => {
928
+ const y = d().find(
929
+ (S) => S.options.some(($) => $.feedmeTaxCode === Q.generateCode(p))
930
+ ), w = (y == null ? void 0 : y.options) || [], u = r.findIndex(
931
+ (S) => w.some(($) => Q.generateCode($) === Q.generateCode(S))
932
+ );
933
+ u >= 0 ? r.splice(u, 1, p) : r.push(p);
934
+ }), g("update:modelValue", r);
935
+ }
936
+ return (t, r) => {
937
+ const p = v("FmRadio"), y = v("FmRadioGroup");
938
+ return m(!0), T(W, null, de(e(h), (w) => (m(), T("div", {
939
+ key: w.name,
940
+ class: "flex items-start"
941
+ }, [
942
+ i(y, {
943
+ modelValue: w.value,
944
+ "onUpdate:modelValue": [
945
+ (u) => w.value = u,
946
+ r[0] || (r[0] = (u) => {
947
+ l(u);
948
+ })
949
+ ]
950
+ }, {
951
+ default: I(() => [
952
+ (m(!0), T(W, null, de(w.options, (u, S) => (m(), R(p, {
953
+ key: S,
954
+ value: u.value,
955
+ label: u.label
956
+ }, null, 8, ["value", "label"]))), 128))
957
+ ]),
958
+ _: 2
959
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
960
+ ]))), 128);
961
+ };
962
+ }
963
+ }), Ke = {
964
+ get _id() {
965
+ return (/* @__PURE__ */ new Date()).toISOString();
966
+ },
967
+ name: "",
968
+ price: j.Dinero.zero().toObject(),
969
+ originalPrice: j.Dinero.zero().toObject(),
970
+ vouchers: [],
971
+ credit: {
972
+ normal: 0,
973
+ free: {
974
+ amount: 0,
975
+ day: 0
976
+ }
977
+ },
978
+ config: {
979
+ options: {}
980
+ },
981
+ titles: [],
982
+ taxes: [],
983
+ taxTotals: [],
984
+ internal: !1,
985
+ priceWithTaxes: xt()
986
+ }, po = {
987
+ key: 0,
988
+ class: "space-y-24 pr-12"
989
+ }, fo = { class: "space-y-8" }, yo = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, go = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, bo = { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, vo = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, ho = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary !mb-[-16px]" }, xo = { class: "space-y-8" }, _o = { class: "flex items-center justify-between" }, Co = { class: "fm-typo-en-title-sm-800 !mb-[-20px]" }, So = { class: "space-y-8" }, Fo = { class: "flex items-center gap-8" }, wo = /* @__PURE__ */ X({
990
+ __name: "EditBundleSheet",
991
+ emits: ["update"],
992
+ setup(b, { expose: a, emit: c }) {
993
+ const g = c, { t: d } = he(), h = Ye(), o = O(!1), l = O([]), f = O({
994
+ category: 0,
995
+ index: -1,
996
+ originalCategoryIndex: void 0
997
+ }), t = O(pe.cloneDeep(Ke)), r = O(), p = Xe, y = D(() => {
998
+ const C = p.safeParse(t.value);
999
+ return C.success ? [] : C.error.errors;
1000
+ }), w = [
1001
+ {
1002
+ header: "Reward title",
1003
+ accessorFn: (C) => C.collectible.name,
1004
+ enableSorting: !0
1005
+ },
1006
+ {
1007
+ id: "type",
1008
+ header: "Reward type",
1009
+ accessorFn: (C) => C.collectible.type,
1010
+ cell(C) {
1011
+ return Te[C.row.original.collectible.type].chip();
1012
+ }
1013
+ },
1014
+ {
1015
+ header: "Description",
1016
+ accessorFn: (C) => C.description,
1017
+ cell(C) {
1018
+ var k;
1019
+ const s = C.row.original;
1020
+ return s.collectible.type == "VOUCHER" || s.selectedReward == null ? s.description : lt(rt.FmStepperField, {
1021
+ "onUpdate:modelValue": (E) => {
1022
+ t.value.titles = t.value.titles.map(
1023
+ (J) => J.id == s.collectible._id ? { ...J, dayToExpire: E } : J
1024
+ );
1025
+ },
1026
+ modelValue: ((k = s.selectedReward) == null ? void 0 : k.extra) ?? 0,
1027
+ appendText: "day(s)",
1028
+ helperState: ae(y.value, "titles"),
1029
+ helperText: se(y.value, "titles"),
1030
+ max: 9999,
1031
+ rules: [(E) => E <= 9999 || "Maximum 9999 days allowed"],
1032
+ showSteppers: !1,
1033
+ disabled: !!t.value.stripePriceId
1034
+ });
1035
+ }
1036
+ }
1037
+ ], u = O([]), S = D(() => {
1038
+ var s;
1039
+ const C = (s = t.value) != null && s.isFeedvibe ? "STORE_BUNDLE:FEEDVIBE" : "STORE_BUNDLE:DEFAULT";
1040
+ return h.bundleRewards.filter((k) => {
1041
+ var E;
1042
+ return (E = t.value) != null && E.isFeedvibe && k.type !== "VOUCHER" ? !1 : St(k.capabilities, C);
1043
+ }).map((k) => {
1044
+ const E = $.value.find((Z) => Z.id == k._id), J = k.type === "VOUCHER" ? `${k.options.maxUse} use(s), ${Ft(
1045
+ k.options.validityOption || {}
1046
+ )}` : "No expiry";
1047
+ return {
1048
+ collectible: k,
1049
+ description: J,
1050
+ selectedReward: E
1051
+ };
1052
+ });
1053
+ }), $ = D(() => {
1054
+ var C, s;
1055
+ return [
1056
+ ...((C = t.value) == null ? void 0 : C.titles.map((k) => ({
1057
+ id: k.id,
1058
+ extra: k.dayToExpire
1059
+ }))) ?? [],
1060
+ ...((s = t.value) == null ? void 0 : s.vouchers.map((k) => ({
1061
+ id: k,
1062
+ extra: void 0
1063
+ }))) ?? []
1064
+ ];
1065
+ }), N = D(
1066
+ () => t.value.stripePriceId && t.value.subscriptionValidity ? t.value.subscriptionValidity : 0
1067
+ );
1068
+ function ue(C) {
1069
+ t.value.subscriptionValidity = C;
1070
+ for (const s of t.value.titles)
1071
+ s.dayToExpire = C;
1072
+ t.value.credit.free && (t.value.credit.free.day = C);
1073
+ }
1074
+ function oe() {
1075
+ const C = S.value, s = t.value;
1076
+ if (!(!s || !C))
1077
+ for (let k = 0; k < C.length; k++) {
1078
+ const E = C[k];
1079
+ z.value[k] ? E.collectible.type == "TITLE" ? s.titles.findIndex(
1080
+ (A) => A.id == E.collectible._id
1081
+ ) < 0 && s.titles.push({
1082
+ id: E.collectible._id,
1083
+ dayToExpire: N.value
1084
+ }) : s.vouchers.findIndex(
1085
+ (A) => A == E.collectible._id
1086
+ ) < 0 && s.vouchers.push(E.collectible._id) : (s.titles = s.titles.filter((Z) => Z.id != E.collectible._id), s.vouchers = s.vouchers.filter(
1087
+ (Z) => Z != E.collectible._id
1088
+ ));
1089
+ }
1090
+ }
1091
+ const z = O({});
1092
+ He(z, oe, { deep: !0 });
1093
+ const te = D(() => {
1094
+ var C, s;
1095
+ return (s = (C = h.storeOption) == null ? void 0 : C.company) == null ? void 0 : s.sstRegNo;
1096
+ }), me = D(() => {
1097
+ var C, s, k;
1098
+ return (k = (s = (C = h.storeOption) == null ? void 0 : C.inclusiveTaxes) == null ? void 0 : s[0]) != null && k.inclusive ? "Inclusive" : "Exclusive";
1099
+ }), V = D(() => {
1100
+ var C, s, k;
1101
+ return ot(
1102
+ Q.fullTax,
1103
+ st(t.value.taxes),
1104
+ t.value.price,
1105
+ Number(t.value.credit.normal),
1106
+ ((C = h.storeOption) == null ? void 0 : C.inclusiveTaxes) ?? [],
1107
+ (k = (s = h.storeOption) == null ? void 0 : s.company) != null && k.sstRegNo ? Q.taxSystem.map((E) => E.code) : []
1108
+ );
1109
+ }), xe = D(() => V.value.reduce(
1110
+ (s, k) => s.add(k.total),
1111
+ _t()
1112
+ ).toFormat()), fe = D(() => {
1113
+ var E;
1114
+ const C = nt(
1115
+ V.value,
1116
+ t.value.price,
1117
+ ((E = h.storeOption) == null ? void 0 : E.inclusiveTaxes) ?? []
1118
+ );
1119
+ t.value.priceWithTaxes = C;
1120
+ const s = uo(C, !1), k = Number(s.replace(/[^\d.-]/g, ""));
1121
+ return Number.isNaN(k) ? 0 : k;
1122
+ });
1123
+ function Ve() {
1124
+ t.value.taxTotals = V.value, g("update", Xe.parse(ft(t.value)));
1125
+ }
1126
+ function q() {
1127
+ return pe.cloneDeep(Ke);
1128
+ }
1129
+ function Se(C, s) {
1130
+ o.value = C, C && s && (r.value = void 0, l.value = s.categories, t.value = s.bundle || q(), f.value.category = s.category, f.value.index = s.index, f.value.originalCategoryIndex = s.category, z.value = S.value.reduce((k, E, J) => (k[J] = !!E.selectedReward, k), {}));
1131
+ }
1132
+ return a({
1133
+ showSheet: Se,
1134
+ bundleImage: r,
1135
+ target: f,
1136
+ data: t
1137
+ }), (C, s) => {
1138
+ const k = v("FmSwitch"), E = v("FmHelperText"), J = v("FmTextField"), Z = v("FmSelect"), A = v("FmStepperField"), _e = v("FmMenuItem"), ke = v("FmTable"), Fe = v("FmButton"), ye = v("FmSideSheet");
1139
+ return m(), R(ye, {
1140
+ "max-width": 768,
1141
+ modelValue: e(o),
1142
+ "onUpdate:modelValue": s[21] || (s[21] = (ie) => ve(o) ? o.value = ie : null),
1143
+ header: e(f).index != -1 ? e(d)("connect.store.bundle.edit.title") : e(d)("connect.store.bundle.edit.create")
1144
+ }, {
1145
+ "side-sheet-footer": I(() => [
1146
+ n("div", Fo, [
1147
+ i(Fe, {
1148
+ label: e(f).index != -1 ? "Save" : "Add",
1149
+ onClick: Ve,
1150
+ disabled: e(y).length > 0,
1151
+ loading: e(Le)().isLoading
1152
+ }, null, 8, ["label", "disabled", "loading"]),
1153
+ i(Fe, {
1154
+ label: "Cancel",
1155
+ onClick: s[20] || (s[20] = (ie) => Se(!1)),
1156
+ variant: "tertiary"
1157
+ })
1158
+ ])
1159
+ ]),
1160
+ default: I(() => {
1161
+ var ie, Pe, Be, Ne, x, P, B, H, G, L;
1162
+ return [
1163
+ i(Je, { json: e(t) }, null, 8, ["json"]),
1164
+ e(t) ? (m(), T("div", po, [
1165
+ n("div", fo, [
1166
+ e(j.Config).getCountry().code == "MY" && ((ie = e(h).payoutAccount) == null ? void 0 : ie.status) == "APPROVED" && ((Pe = e(h).payoutAccount) != null && Pe.enable) ? (m(), R(k, {
1167
+ key: 0,
1168
+ "onUpdate:modelValue": s[0] || (s[0] = (_) => {
1169
+ e(t).isFeedvibe = _, e(t).isFeedvibe && (e(t).credit.normal = 0, e(t).coinPrice = 0, e(t).titles = [], z.value = {}, e(t).hideInPos = !0, e(t).internal = !0);
1170
+ }),
1171
+ "label-placement": "right",
1172
+ "model-value": e(t).isFeedvibe || !1,
1173
+ label: "Feedvibe Campaign",
1174
+ sublabel: "Bundle will be appear for Feedvibe campaign use"
1175
+ }, null, 8, ["model-value"])) : M("", !0),
1176
+ e(t).isFeedvibe ? (m(), R(E, {
1177
+ key: 1,
1178
+ text: "There will be a 15% charge for FeedVibe bundles sold in the FeedVibe app. FeedVibe bundles only show up in the FeedVibe app and cannot be sold in the POS and mini program. For more information, please contact support.",
1179
+ state: "warning"
1180
+ })) : M("", !0)
1181
+ ]),
1182
+ n("div", yo, F(e(d)("connect.store.bundle.edit.basicInformation")), 1),
1183
+ i(J, {
1184
+ label: e(d)("connect.store.bundle.edit.bundleName"),
1185
+ modelValue: e(t).name,
1186
+ "onUpdate:modelValue": s[1] || (s[1] = (_) => e(t).name = _),
1187
+ "helper-state": e(ae)(e(y), "name"),
1188
+ "helper-text": e(se)(e(y), "name")
1189
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1190
+ i(Z, {
1191
+ modelValue: e(f).category,
1192
+ "onUpdate:modelValue": s[2] || (s[2] = (_) => e(f).category = _),
1193
+ label: "Store Category",
1194
+ items: e(l).map((_, U) => ({ label: _, value: U }))
1195
+ }, null, 8, ["modelValue", "items"]),
1196
+ i(vt, {
1197
+ label: e(d)("connect.store.bundle.edit.bundleImage"),
1198
+ class: "w-1/2 xs:w-2/3",
1199
+ "aspect-ratio": "16/9",
1200
+ thumbnail: e(t).image ?? void 0,
1201
+ file: e(r) ?? void 0,
1202
+ "onUpdate:file": s[3] || (s[3] = (_) => {
1203
+ r.value = _;
1204
+ }),
1205
+ "helper-state": e(ae)(e(y), "image"),
1206
+ "helper-text": e(se)(e(y), "image")
1207
+ }, null, 8, ["label", "thumbnail", "file", "helper-state", "helper-text"]),
1208
+ i(A, {
1209
+ "model-value": e(j.Dinero).fromFdoDinero(e(t).price).toUnit(),
1210
+ label: e(d)("connect.store.bundle.edit.bundlePrice"),
1211
+ min: 0,
1212
+ "max-fraction-digits": 2,
1213
+ "onUpdate:modelValue": s[4] || (s[4] = (_) => {
1214
+ e(t).price.amount = _ * 10 ** e(t).price.precision;
1215
+ }),
1216
+ "is-currency": !0,
1217
+ "show-steppers": !1,
1218
+ "helper-text": e(se)(e(y), "price") || `${e(j.Dinero).fromNumber({ number: 1 }).toFormat(
1219
+ !0
1220
+ )} = ${e(j.Dinero).fromNumber({ number: 1 }).toUnit()} credit`,
1221
+ "helper-state": e(ae)(e(y), "price")
1222
+ }, {
1223
+ prepend: I(() => [
1224
+ le(F(e(j.Dinero).defaultCurrency()), 1)
1225
+ ]),
1226
+ _: 1
1227
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1228
+ i(A, {
1229
+ "model-value": e(j.Dinero).fromFdoDinero(e(t).originalPrice).toUnit(),
1230
+ label: e(d)("connect.store.bundle.edit.bundleValue"),
1231
+ min: 0,
1232
+ "max-fraction-digits": 2,
1233
+ "onUpdate:modelValue": s[5] || (s[5] = (_) => {
1234
+ e(t).originalPrice || (e(t).originalPrice = e(j.Dinero).zero().toObject()), e(t).originalPrice.amount = _ * 10 ** e(t).originalPrice.precision;
1235
+ }),
1236
+ "is-currency": !0,
1237
+ "show-steppers": !1,
1238
+ "helper-text": e(se)(e(y), "originalPrice") || e(d)("connect.store.bundle.edit.originalPriceHelper"),
1239
+ "helper-state": e(ae)(e(y), "originalPrice")
1240
+ }, {
1241
+ prepend: I(() => [
1242
+ le(F(e(j.Dinero).defaultCurrency()), 1)
1243
+ ]),
1244
+ _: 1
1245
+ }, 8, ["model-value", "label", "helper-text", "helper-state"]),
1246
+ e(t).isFeedvibe ? M("", !0) : (m(), R(A, {
1247
+ key: 0,
1248
+ "model-value": e(t).coinPrice ?? null,
1249
+ label: e(d)("connect.store.bundle.edit.pointNeeded"),
1250
+ min: 0,
1251
+ "onUpdate:modelValue": s[6] || (s[6] = (_) => {
1252
+ _ > 0 && e(t).credit.normal > 0 && (e(t).credit.normal = 0), e(t).coinPrice = _;
1253
+ }),
1254
+ "show-steppers": !1,
1255
+ "helper-state": e(ae)(e(y), "coinPrice"),
1256
+ "helper-text": e(se)(e(y), "coinPrice")
1257
+ }, {
1258
+ append: I(() => [...s[22] || (s[22] = [
1259
+ le(" point(s) ", -1)
1260
+ ])]),
1261
+ _: 1
1262
+ }, 8, ["model-value", "label", "helper-state", "helper-text"])),
1263
+ (Be = e(h).storeOption) != null && Be.stripe && !e(t).isFeedvibe ? (m(), T(W, { key: 1 }, [
1264
+ n("div", go, F(e(d)("connect.store.bundle.edit.subscriptionSettings")), 1),
1265
+ i(J, {
1266
+ label: e(d)("connect.store.bundle.edit.stripePriceId"),
1267
+ modelValue: e(t).stripePriceId,
1268
+ "onUpdate:modelValue": s[7] || (s[7] = (_) => e(t).stripePriceId = _),
1269
+ "helper-state": e(ae)(e(y), "stripePriceId"),
1270
+ "helper-text": e(se)(e(y), "stripePriceId")
1271
+ }, null, 8, ["label", "modelValue", "helper-state", "helper-text"]),
1272
+ e(t).stripePriceId ? (m(), R(A, {
1273
+ key: 0,
1274
+ "model-value": e(t).subscriptionValidity ?? null,
1275
+ min: 1,
1276
+ "onUpdate:modelValue": ue,
1277
+ label: e(d)("connect.store.bundle.edit.subscriptionValidity"),
1278
+ "show-steppers": !1,
1279
+ "helper-state": e(ae)(e(y), "subscriptionValidity"),
1280
+ "helper-text": e(se)(e(y), "subscriptionValidity")
1281
+ }, null, 8, ["model-value", "label", "helper-state", "helper-text"])) : M("", !0)
1282
+ ], 64)) : M("", !0),
1283
+ e(t).isFeedvibe ? M("", !0) : (m(), T(W, { key: 2 }, [
1284
+ n("div", bo, F(e(d)("connect.store.bundle.edit.credit")), 1),
1285
+ i(A, {
1286
+ modelValue: e(t).credit.normal,
1287
+ "onUpdate:modelValue": s[8] || (s[8] = (_) => e(t).credit.normal = _),
1288
+ label: e(d)("connect.store.bundle.edit.normalCredit"),
1289
+ "show-steppers": !1,
1290
+ "helper-state": e(ae)(e(y), "credit.normal"),
1291
+ "helper-text": e(se)(e(y), "credit.normal")
1292
+ }, {
1293
+ append: I(() => [...s[23] || (s[23] = [
1294
+ le(" credit ", -1)
1295
+ ])]),
1296
+ _: 1
1297
+ }, 8, ["modelValue", "label", "helper-state", "helper-text"]),
1298
+ i(A, {
1299
+ "model-value": ((Ne = e(t).credit.free) == null ? void 0 : Ne.amount) ?? null,
1300
+ min: 0,
1301
+ "onUpdate:modelValue": s[9] || (s[9] = (_) => {
1302
+ e(t).credit.free || (e(t).credit.free = {
1303
+ amount: 0,
1304
+ day: 1
1305
+ }), e(t).credit.free.amount = _;
1306
+ }),
1307
+ label: e(d)("connect.store.bundle.edit.freeCredit"),
1308
+ "show-steppers": !1,
1309
+ "helper-state": e(ae)(e(y), "credit.free.amount"),
1310
+ "helper-text": e(se)(e(y), "credit.free.amount")
1311
+ }, {
1312
+ append: I(() => [...s[24] || (s[24] = [
1313
+ le(" credit ", -1)
1314
+ ])]),
1315
+ _: 1
1316
+ }, 8, ["model-value", "label", "helper-state", "helper-text"]),
1317
+ (x = e(t).credit.free) != null && x.amount ? (m(), R(A, {
1318
+ key: 0,
1319
+ disabled: !!e(t).stripePriceId,
1320
+ "model-value": ((P = e(t).credit.free) == null ? void 0 : P.day) ?? null,
1321
+ min: 0,
1322
+ "onUpdate:modelValue": s[10] || (s[10] = (_) => {
1323
+ e(t).credit.free || (e(t).credit.free = {
1324
+ amount: 0,
1325
+ day: 1
1326
+ }), e(t).credit.free.day = e(N) || _;
1327
+ }),
1328
+ label: "Free credit valid for",
1329
+ "show-steppers": !1,
1330
+ "helper-state": e(ae)(e(y), "credit.free.day"),
1331
+ "helper-text": e(se)(e(y), "credit.free.day")
1332
+ }, {
1333
+ append: I(() => [...s[25] || (s[25] = [
1334
+ le(" day(s) ", -1)
1335
+ ])]),
1336
+ _: 1
1337
+ }, 8, ["disabled", "model-value", "helper-state", "helper-text"])) : M("", !0)
1338
+ ], 64)),
1339
+ e(te) ? (m(), T(W, { key: 3 }, [
1340
+ s[26] || (s[26] = n("div", { class: "fm-typo-en-title-sm-800 !mb-[-16px]" }, "Taxes", -1)),
1341
+ i(mo, {
1342
+ modelValue: e(t).taxes,
1343
+ "onUpdate:modelValue": s[11] || (s[11] = (_) => e(t).taxes = _)
1344
+ }, null, 8, ["modelValue"]),
1345
+ i(J, {
1346
+ label: `Tax Charged (${e(me)})`,
1347
+ "model-value": e(xe),
1348
+ disabled: ""
1349
+ }, null, 8, ["label", "model-value"])
1350
+ ], 64)) : M("", !0),
1351
+ i(A, {
1352
+ label: "Total Price",
1353
+ "model-value": e(fe),
1354
+ disabled: !0
1355
+ }, null, 8, ["model-value"]),
1356
+ n("div", vo, F(e(d)("connect.store.bundle.edit.bundleReward.title")), 1),
1357
+ n("div", ho, F(e(d)("connect.store.bundle.edit.bundleReward.description")), 1),
1358
+ n("div", xo, [
1359
+ n("div", _o, [
1360
+ i(ht, {
1361
+ label: `Reward type: ${e(u).length == 0 ? "All" : e(u)[0].name}`
1362
+ }, {
1363
+ default: I(() => [
1364
+ i(_e, {
1365
+ onClick: s[12] || (s[12] = (_) => u.value = []),
1366
+ label: "All"
1367
+ }),
1368
+ i(_e, {
1369
+ onClick: s[13] || (s[13] = (_) => u.value = [
1370
+ {
1371
+ id: "type",
1372
+ value: "VOUCHER",
1373
+ name: e(Te).VOUCHER.name
1374
+ }
1375
+ ]),
1376
+ label: e(Te).VOUCHER.name
1377
+ }, null, 8, ["label"]),
1378
+ i(_e, {
1379
+ onClick: s[14] || (s[14] = (_) => u.value = [
1380
+ {
1381
+ id: "type",
1382
+ value: "TITLE",
1383
+ name: e(Te).TITLE.name
1384
+ }
1385
+ ]),
1386
+ label: e(Te).TITLE.name
1387
+ }, null, 8, ["label"])
1388
+ ]),
1389
+ _: 1
1390
+ }, 8, ["label"])
1391
+ ]),
1392
+ i(ke, {
1393
+ modelValue: e(z),
1394
+ "onUpdate:modelValue": s[15] || (s[15] = (_) => ve(z) ? z.value = _ : null),
1395
+ selection: "multiple",
1396
+ "column-filter": e(u),
1397
+ "column-defs": w,
1398
+ "row-data": e(S),
1399
+ "hide-footer": e(S).length <= 10
1400
+ }, null, 8, ["modelValue", "column-filter", "row-data", "hide-footer"]),
1401
+ i(E, {
1402
+ text: e(se)(e(y), "titles"),
1403
+ state: e(ae)(e(y), "titles")
1404
+ }, null, 8, ["text", "state"])
1405
+ ]),
1406
+ n("div", Co, F(e(d)("connect.store.bundle.edit.advanceSetting")), 1),
1407
+ n("div", So, [
1408
+ e(t).isFeedvibe ? M("", !0) : (m(), T(W, { key: 0 }, [
1409
+ i(k, {
1410
+ "model-value": e(t).internal ?? !1,
1411
+ "onUpdate:modelValue": s[16] || (s[16] = (_) => e(t).internal = _),
1412
+ "label-placement": "right",
1413
+ label: e(d)("connect.store.bundle.edit.internalBundle"),
1414
+ sublabel: e(d)("connect.store.bundle.edit.internalBundleDescription")
1415
+ }, null, 8, ["model-value", "label", "sublabel"]),
1416
+ i(k, {
1417
+ "model-value": e(t).hideInPos ?? !1,
1418
+ "onUpdate:modelValue": s[17] || (s[17] = (_) => e(t).hideInPos = _),
1419
+ "label-placement": "right",
1420
+ label: e(d)("connect.store.bundle.edit.hideInPos"),
1421
+ sublabel: e(d)("connect.store.bundle.edit.hideInPosDescription")
1422
+ }, null, 8, ["model-value", "label", "sublabel"])
1423
+ ], 64)),
1424
+ i(A, {
1425
+ "model-value": ((H = (B = e(t).config) == null ? void 0 : B.options) == null ? void 0 : H.maxPerUser) || null,
1426
+ "onUpdate:modelValue": s[18] || (s[18] = (_) => e(pe).set(e(t), "config.options.maxPerUser", _)),
1427
+ label: e(d)("connect.store.bundle.edit.maxPerUser"),
1428
+ "show-steppers": !1,
1429
+ placeholder: e(d)("connect.store.bundle.edit.unlimited")
1430
+ }, null, 8, ["model-value", "label", "placeholder"]),
1431
+ i(A, {
1432
+ "model-value": ((L = (G = e(t).config) == null ? void 0 : G.options) == null ? void 0 : L.maxReceive) || null,
1433
+ "onUpdate:modelValue": s[19] || (s[19] = (_) => e(pe).set(e(t), "config.options.maxReceive", _)),
1434
+ label: e(d)("connect.store.bundle.edit.maxReceive"),
1435
+ "show-steppers": !1,
1436
+ placeholder: e(d)("connect.store.bundle.edit.unlimited")
1437
+ }, null, 8, ["model-value", "label", "placeholder"])
1438
+ ])
1439
+ ])) : M("", !0)
1440
+ ];
1441
+ }),
1442
+ _: 1
1443
+ }, 8, ["modelValue", "header"]);
1444
+ };
1445
+ }
1446
+ }), $o = { class: "flex gap-8 items-center flex-wrap" }, ko = { class: "flex items-center gap-8" }, Po = /* @__PURE__ */ X({
1447
+ __name: "SendBundleSheet",
1448
+ emits: ["success"],
1449
+ setup(b, { expose: a, emit: c }) {
1450
+ const { minor: g } = et, d = O(), h = O(""), o = O(""), l = O([]), f = O(!1), t = O();
1451
+ O(!0);
1452
+ function r(S) {
1453
+ f.value = !0, h.value = null, o.value = "", d.value = S.bundle;
1454
+ }
1455
+ function p() {
1456
+ f.value = !1;
1457
+ }
1458
+ async function y(S) {
1459
+ const $ = await wt.read({
1460
+ limit: 25,
1461
+ skip: 0,
1462
+ sortBy: "_id",
1463
+ search: S,
1464
+ descending: !1
1465
+ });
1466
+ l.value = $.resources.map((N) => ({
1467
+ label: `${N.name} (${N.phoneNumber})`,
1468
+ value: N._id
1469
+ })), await new Promise((N) => setTimeout(N, 100));
1470
+ }
1471
+ async function w() {
1472
+ if (!d.value || !h.value) return;
1473
+ const S = l.value.find(
1474
+ (N) => N.value === h.value
1475
+ );
1476
+ await Ie.confirm(
1477
+ `Are you sure you want to send bundle ${d.value.name} to ${S == null ? void 0 : S.label}?`,
1478
+ "Confirm",
1479
+ "Confirm",
1480
+ "Cancel"
1481
+ ) && await g(
1482
+ async () => {
1483
+ const N = {
1484
+ bundle: d.value._id,
1485
+ member: h.value,
1486
+ source: mt.enum.ADMIN,
1487
+ ref: `ADMIN:${(/* @__PURE__ */ new Date()).toISOString()}:${o.value}`,
1488
+ withCoin: !1
1489
+ };
1490
+ await Ue.sendBundle(N), p();
1491
+ },
1492
+ {
1493
+ message: "Sending bundle",
1494
+ successMessage: "Bundle sent"
1495
+ }
1496
+ );
1497
+ }
1498
+ const u = D(() => {
1499
+ var $, N, ue;
1500
+ const S = [];
1501
+ return (($ = d.value) == null ? void 0 : $.price.amount) > 0 && S.push(
1502
+ `${j.Config.getCountry().currency.symbol}${tt((N = d.value) == null ? void 0 : N.price)}`
1503
+ ), (ue = d.value) != null && ue.coinPrice && S.push(`${d.value.coinPrice} point(s)`), S.join(" or ");
1504
+ });
1505
+ return a({
1506
+ showSheet: r,
1507
+ hideSheet: p
1508
+ }), Ee(async () => {
1509
+ await y("");
1510
+ }), (S, $) => {
1511
+ const N = v("FmCardMedia"), ue = v("FmCardHeader"), oe = v("FmChip"), z = v("FmCardSection"), te = v("FmCard"), me = v("FmSelect"), V = v("FmTextField"), xe = v("FmForm"), fe = v("FmButton"), Ve = v("FmSideSheet");
1512
+ return m(), R(Ve, {
1513
+ "max-width": 560,
1514
+ "dismiss-away": !0,
1515
+ header: "Send bundle to member",
1516
+ modelValue: e(f),
1517
+ "onUpdate:modelValue": [
1518
+ $[4] || ($[4] = (q) => ve(f) ? f.value = q : null),
1519
+ $[5] || ($[5] = (q) => f.value = q)
1520
+ ]
1521
+ }, {
1522
+ "side-sheet-footer": I(() => [
1523
+ n("div", ko, [
1524
+ i(fe, {
1525
+ label: "Send",
1526
+ loading: e(Le)().isLoading,
1527
+ onClick: $[2] || ($[2] = async () => {
1528
+ var q;
1529
+ return (q = e(t)) == null ? void 0 : q.validateInputs();
1530
+ })
1531
+ }, null, 8, ["loading"]),
1532
+ i(fe, {
1533
+ label: "Cancel",
1534
+ type: "button",
1535
+ variant: "tertiary",
1536
+ onClick: $[3] || ($[3] = (q) => f.value = !1)
1537
+ })
1538
+ ])
1539
+ ]),
1540
+ default: I(() => [
1541
+ i(xe, {
1542
+ class: "space-y-16",
1543
+ ref_key: "form",
1544
+ ref: t,
1545
+ onValidationSuccess: w,
1546
+ blameFormChildOnValidationFailed: ""
1547
+ }, {
1548
+ default: I(() => [
1549
+ i(te, {
1550
+ class: "max-w-[700px]",
1551
+ horizontal: "",
1552
+ variant: "outlined"
1553
+ }, {
1554
+ default: I(() => {
1555
+ var q, Se;
1556
+ return [
1557
+ (q = e(d)) != null && q.image ? (m(), R(N, {
1558
+ key: 0,
1559
+ width: "100",
1560
+ src: (Se = e(d)) == null ? void 0 : Se.image
1561
+ }, null, 8, ["src"])) : M("", !0),
1562
+ i(z, { class: "flex flex-col gap-16 justify-between" }, {
1563
+ default: I(() => {
1564
+ var C;
1565
+ return [
1566
+ i(ue, {
1567
+ class: "p-0",
1568
+ title: (C = e(d)) == null ? void 0 : C.name,
1569
+ subtitle: e(u)
1570
+ }, null, 8, ["title", "subtitle"]),
1571
+ i(z, { class: "p-0" }, {
1572
+ default: I(() => {
1573
+ var s, k, E, J, Z, A, _e, ke, Fe, ye, ie;
1574
+ return [
1575
+ n("div", $o, [
1576
+ (s = e(d)) != null && s.isFeedvibe ? (m(), R(oe, {
1577
+ key: 0,
1578
+ label: "Feedvibe"
1579
+ })) : M("", !0),
1580
+ (E = (k = e(d)) == null ? void 0 : k.titles) != null && E.length ? (m(), R(oe, {
1581
+ key: 1,
1582
+ label: `${e(d).titles.length} title(s)`
1583
+ }, null, 8, ["label"])) : M("", !0),
1584
+ (Z = (J = e(d)) == null ? void 0 : J.vouchers) != null && Z.length ? (m(), R(oe, {
1585
+ key: 2,
1586
+ label: `${e(d).vouchers.length} voucher(s)`
1587
+ }, null, 8, ["label"])) : M("", !0),
1588
+ (_e = (A = e(d)) == null ? void 0 : A.credit) != null && _e.normal || (ye = (Fe = (ke = e(d)) == null ? void 0 : ke.credit) == null ? void 0 : Fe.free) != null && ye.amount ? (m(), R(oe, {
1589
+ key: 3,
1590
+ label: `${(e(d).credit.normal || 0) + (((ie = e(d).credit.free) == null ? void 0 : ie.amount) || 0)} credit(s)`
1591
+ }, null, 8, ["label"])) : M("", !0)
1592
+ ])
1593
+ ];
1594
+ }),
1595
+ _: 1
1596
+ })
1597
+ ];
1598
+ }),
1599
+ _: 1
1600
+ })
1601
+ ];
1602
+ }),
1603
+ _: 1
1604
+ }),
1605
+ i(me, {
1606
+ modelValue: e(h),
1607
+ "onUpdate:modelValue": $[0] || ($[0] = (q) => ve(h) ? h.value = q : null),
1608
+ label: "Select member",
1609
+ searchable: "",
1610
+ items: e(l),
1611
+ onSearch: y,
1612
+ rules: [(q) => !!q > 0 || "Member is required"],
1613
+ "helper-text": "Type to search member"
1614
+ }, null, 8, ["modelValue", "items", "rules"]),
1615
+ i(V, {
1616
+ modelValue: e(o),
1617
+ "onUpdate:modelValue": $[1] || ($[1] = (q) => ve(o) ? o.value = q : null),
1618
+ label: "Reference (optional)",
1619
+ rules: [
1620
+ (q) => q.length < 50 || "Reference must be less than 50 characters"
1621
+ ]
1622
+ }, null, 8, ["modelValue", "rules"])
1623
+ ]),
1624
+ _: 1
1625
+ }, 512)
1626
+ ]),
1627
+ _: 1
1628
+ }, 8, ["modelValue"]);
1629
+ };
1630
+ }
1631
+ }), Vo = { class: "flex items-center gap-8" }, To = { class: "flex-shrink-0 -mr-8 -mt-8" }, Ro = ["title"], Io = ["src"], Uo = { class: "relative flex items-center gap-6 min-w-0" }, Do = { class: "fm-typo-en-body-sm-600 tracking-[0.08em] truncate" }, Eo = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, Bo = {
1632
+ key: 0,
1633
+ class: "flex items-center gap-6"
1634
+ }, No = "linear-gradient(135deg,#FF9455,#B25300)", Mo = /* @__PURE__ */ X({
1635
+ __name: "GiftCardProgramCard",
1636
+ props: {
1637
+ program: {},
1638
+ disabled: { type: Boolean }
1639
+ },
1640
+ emits: ["edit", "setLive", "deactivate"],
1641
+ setup(b, { emit: a }) {
1642
+ const c = b, g = a, d = D(() => pt(c.program)), h = D(() => {
1643
+ const { denominations: f, anyAmount: t } = d.value, r = [], p = [
1644
+ ...f,
1645
+ ...t ? [t.min, t.max] : []
1646
+ ];
1647
+ if (p.length) {
1648
+ const y = Math.min(...p), w = Math.max(...p);
1649
+ r.push(y === w ? `RM${y}` : `RM${y}–RM${w}`);
1650
+ }
1651
+ return t && r.push("Any amount"), r.join(" · ");
1652
+ }), o = D(() => {
1653
+ var f;
1654
+ return ((f = c.program.designs) == null ? void 0 : f[0]) ?? null;
1655
+ }), l = D(() => {
1656
+ const f = c.program.numberFormat, t = (f == null ? void 0 : f.prefix) ?? "GC", r = Math.max(4, Math.min(Number((f == null ? void 0 : f.length) ?? 12), 16));
1657
+ return `${t}${"•".repeat(r)}`;
1658
+ });
1659
+ return (f, t) => {
1660
+ const r = v("FmChip"), p = v("FmButton"), y = v("FmMenuItem"), w = v("FmMenu"), u = v("FmIcon"), S = v("FmCard");
1661
+ return m(), R(S, {
1662
+ variant: "outlined",
1663
+ class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px]"
1664
+ }, {
1665
+ default: I(() => [
1666
+ n("div", Vo, [
1667
+ i(r, {
1668
+ label: "Gift card",
1669
+ variant: "neutral",
1670
+ compact: ""
1671
+ }),
1672
+ i(r, {
1673
+ label: b.program.active ? "Live" : "Inactive",
1674
+ variant: b.program.active ? "success" : "neutral",
1675
+ compact: ""
1676
+ }, null, 8, ["label", "variant"]),
1677
+ t[4] || (t[4] = n("div", { class: "flex-1" }, null, -1)),
1678
+ n("div", To, [
1679
+ i(w, { placement: "bottom-end" }, {
1680
+ "menu-button": I(() => [
1681
+ i(p, {
1682
+ icon: "more_vert",
1683
+ variant: "tertiary"
1684
+ })
1685
+ ]),
1686
+ default: I(() => [
1687
+ i(y, {
1688
+ onClick: t[0] || (t[0] = ($) => g("edit")),
1689
+ icon: "edit",
1690
+ label: "Edit"
1691
+ }),
1692
+ b.program.active ? (m(), R(y, {
1693
+ key: 1,
1694
+ onClick: t[2] || (t[2] = ($) => g("deactivate")),
1695
+ icon: "pause_circle",
1696
+ label: "Set inactive"
1697
+ })) : (m(), R(y, {
1698
+ key: 0,
1699
+ onClick: t[1] || (t[1] = ($) => g("setLive")),
1700
+ icon: "check_circle",
1701
+ label: "Set live"
1702
+ }))
1703
+ ]),
1704
+ _: 1
1705
+ })
1706
+ ])
1707
+ ]),
1708
+ n("div", {
1709
+ class: "fm-typo-en-body-lg-600 truncate",
1710
+ title: b.program.name
1711
+ }, F(b.program.name), 9, Ro),
1712
+ n("div", {
1713
+ class: "relative h-[120px] aspect-[1.586/1] mx-auto rounded-md overflow-hidden flex flex-col p-8 text-fm-color-typo-white",
1714
+ style: Qe({ background: No })
1715
+ }, [
1716
+ e(o) ? (m(), T("img", {
1717
+ key: 0,
1718
+ src: e(o),
1719
+ alt: "",
1720
+ class: "absolute inset-0 w-full h-full object-cover"
1721
+ }, null, 8, Io)) : M("", !0),
1722
+ t[6] || (t[6] = n("div", { class: "relative flex items-start justify-between gap-4" }, [
1723
+ n("span", { class: "fm-typo-en-body-sm-600" }, "FeedMe"),
1724
+ n("span", { class: "fm-typo-en-body-sm-600 uppercase tracking-[0.1em] opacity-90 whitespace-nowrap" }, " Gift Card ")
1725
+ ], -1)),
1726
+ t[7] || (t[7] = n("div", { class: "flex-1" }, null, -1)),
1727
+ n("div", Uo, [
1728
+ t[5] || (t[5] = n("span", { class: "w-[20px] h-[14px] rounded-sm flex-none bg-gradient-to-br from-[#F4D479] to-[#C99B3B]" }, null, -1)),
1729
+ n("span", Do, F(e(l)), 1)
1730
+ ])
1731
+ ], 4),
1732
+ n("div", Eo, F(e(h)), 1),
1733
+ t[9] || (t[9] = n("div", { class: "flex-1" }, null, -1)),
1734
+ b.program.active ? (m(), T("div", Bo, [
1735
+ i(u, {
1736
+ name: "check",
1737
+ size: "sm",
1738
+ class: "text-fm-color-system-success-400"
1739
+ }),
1740
+ t[8] || (t[8] = n("span", { class: "fm-typo-en-body-sm-600 text-fm-color-system-success-400" }, " Live to customers ", -1))
1741
+ ])) : (m(), R(p, {
1742
+ key: 1,
1743
+ label: "Set live",
1744
+ variant: "secondary",
1745
+ size: "md",
1746
+ disabled: b.disabled,
1747
+ onClick: t[3] || (t[3] = ($) => g("setLive"))
1748
+ }, null, 8, ["disabled"]))
1749
+ ]),
1750
+ _: 1
1751
+ });
1752
+ };
1753
+ }
1754
+ }), Oo = { class: "rounded-lg border-1 border-fm-color-primary p-24 flex flex-col gap-16" }, Lo = { class: "flex items-start gap-16" }, Ao = { class: "w-40 h-40 rounded-md flex-none grid place-items-center bg-fm-color-primary" }, jo = { class: "flex flex-col gap-4" }, qo = { class: "fm-typo-en-body-lg-600" }, Go = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ko = { class: "rounded-md border-1 border-fm-color-neutral-gray-200" }, Ho = { class: "flex-1 min-w-0" }, zo = { class: "fm-typo-en-body-md-600" }, Wo = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yo = /* @__PURE__ */ X({
1755
+ __name: "StoreOnboarding",
1756
+ props: {
1757
+ settingStatus: {},
1758
+ payoutStatus: {},
1759
+ requiresPayout: { type: Boolean, default: !0 }
1760
+ },
1761
+ emits: ["setupStoreSetting", "setupPayout"],
1762
+ setup(b, { emit: a }) {
1763
+ const { t: c } = he(), g = b, d = a, h = D(() => [
1764
+ {
1765
+ key: "payout",
1766
+ title: c("connect.store.onboarding.payoutTitle"),
1767
+ description: c("connect.store.onboarding.payoutDescription"),
1768
+ status: g.payoutStatus,
1769
+ action: "setupPayout"
1770
+ },
1771
+ {
1772
+ key: "setting",
1773
+ title: c("connect.store.onboarding.settingTitle"),
1774
+ description: c("connect.store.onboarding.settingDescription"),
1775
+ status: g.settingStatus,
1776
+ action: "setupStoreSetting"
1777
+ }
1778
+ ].filter((l) => l.key !== "payout" || g.requiresPayout));
1779
+ return (o, l) => {
1780
+ const f = v("FmIcon"), t = v("FmChip"), r = v("FmButton");
1781
+ return m(), T("div", Oo, [
1782
+ n("div", Lo, [
1783
+ n("span", Ao, [
1784
+ i(f, {
1785
+ name: "warning",
1786
+ class: "text-fm-color-typo-white"
1787
+ })
1788
+ ]),
1789
+ n("div", jo, [
1790
+ n("div", qo, F(e(c)("connect.store.onboarding.title")), 1),
1791
+ n("div", Go, F(e(c)("connect.store.onboarding.description")), 1)
1792
+ ])
1793
+ ]),
1794
+ n("div", Ko, [
1795
+ (m(!0), T(W, null, de(e(h), (p, y) => (m(), T("div", {
1796
+ key: p.key,
1797
+ class: $e(["flex items-center gap-16 p-16", y > 0 ? "border-t-1 border-fm-color-neutral-gray-200" : ""])
1798
+ }, [
1799
+ n("span", {
1800
+ class: $e([
1801
+ "w-24 h-24 rounded-sm flex-none grid place-items-center fm-typo-en-body-sm-600",
1802
+ p.status === "COMPLETE" ? "bg-fm-color-system-success-100 text-fm-color-typo-success" : "bg-fm-color-primary-oats text-fm-color-primary"
1803
+ ])
1804
+ }, [
1805
+ p.status === "COMPLETE" ? (m(), R(f, {
1806
+ key: 0,
1807
+ name: "check",
1808
+ size: "sm"
1809
+ })) : (m(), T(W, { key: 1 }, [
1810
+ le(F(y + 1), 1)
1811
+ ], 64))
1812
+ ], 2),
1813
+ n("div", Ho, [
1814
+ n("div", zo, F(p.title), 1),
1815
+ n("div", Wo, F(p.description), 1)
1816
+ ]),
1817
+ i(t, {
1818
+ label: e(c)(
1819
+ p.status === "COMPLETE" ? "connect.store.onboarding.complete" : p.status === "PENDING" ? "connect.store.onboarding.pendingApproval" : "connect.store.onboarding.incomplete"
1820
+ ),
1821
+ variant: "plain",
1822
+ class: $e(
1823
+ p.status === "COMPLETE" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-warning bg-fm-color-system-warning-100"
1824
+ ),
1825
+ compact: ""
1826
+ }, null, 8, ["label", "class"]),
1827
+ p.status !== "COMPLETE" ? (m(), R(r, {
1828
+ key: 0,
1829
+ class: "flex-none",
1830
+ label: e(c)(
1831
+ p.status === "PENDING" ? "connect.store.onboarding.editDetails" : "connect.store.onboarding.setupNow"
1832
+ ),
1833
+ variant: "primary",
1834
+ onClick: (w) => p.action === "setupPayout" ? d("setupPayout") : d("setupStoreSetting")
1835
+ }, null, 8, ["label", "onClick"])) : M("", !0)
1836
+ ], 2))), 128))
1837
+ ])
1838
+ ]);
1839
+ };
1840
+ }
1841
+ }), Jo = { class: "rounded-lg bg-fm-color-system-success-100 p-16 flex items-start gap-16" }, Xo = { class: "w-40 h-40 rounded-md flex-none grid place-items-center bg-fm-color-system-success-400" }, Zo = { class: "flex-1 flex flex-col gap-4" }, Qo = { class: "fm-typo-en-body-lg-600" }, en = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, tn = /* @__PURE__ */ X({
1842
+ __name: "StoreAllSet",
1843
+ emits: ["dismiss"],
1844
+ setup(b, { emit: a }) {
1845
+ const { t: c } = he(), g = a;
1846
+ return (d, h) => {
1847
+ const o = v("FmIcon"), l = v("FmButton");
1848
+ return m(), T("div", Jo, [
1849
+ n("span", Xo, [
1850
+ i(o, {
1851
+ name: "check_circle",
1852
+ class: "text-fm-color-typo-white"
1853
+ })
1854
+ ]),
1855
+ n("div", Zo, [
1856
+ n("div", Qo, F(e(c)("connect.store.allSet.title")), 1),
1857
+ n("div", en, F(e(c)("connect.store.allSet.description")), 1)
1858
+ ]),
1859
+ i(l, {
1860
+ class: "flex-none",
1861
+ icon: "close",
1862
+ size: "md",
1863
+ variant: "tertiary",
1864
+ onClick: h[0] || (h[0] = (f) => g("dismiss"))
1865
+ })
1866
+ ]);
1867
+ };
1868
+ }
1869
+ }), on = { class: "space-y-16" }, nn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, an = { class: "space-y-8" }, sn = { class: "h-8 rounded-full bg-fm-color-neutral-gray-200 overflow-hidden" }, ln = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, rn = { class: "space-y-8" }, cn = { class: "flex-1 min-w-0" }, dn = { class: "fm-typo-en-body-md-600" }, un = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mn = { class: "flex items-center justify-end gap-8 pb-16" }, pn = /* @__PURE__ */ X({
1870
+ __name: "StoreSetupDialog",
1871
+ props: {
1872
+ settingStatus: {},
1873
+ payoutStatus: {},
1874
+ requiresPayout: { type: Boolean, default: !0 }
1875
+ },
1876
+ setup(b) {
1877
+ const { t: a } = he(), c = b, g = ze(), { emitData: d, emitAction: h } = We(), o = D(() => [
1878
+ {
1879
+ key: "payout",
1880
+ title: a("connect.store.onboarding.payoutTitle"),
1881
+ description: a("connect.store.onboarding.payoutDescription"),
1882
+ status: c.payoutStatus,
1883
+ action: "setupPayout",
1884
+ actionLabel: a(
1885
+ c.payoutStatus === "PENDING" ? "connect.store.onboarding.editDetails" : "connect.store.onboarding.payoutAction"
1886
+ )
1887
+ },
1888
+ {
1889
+ key: "setting",
1890
+ title: a("connect.store.onboarding.settingTitle"),
1891
+ description: a("connect.store.onboarding.settingDescription"),
1892
+ status: c.settingStatus,
1893
+ action: "setupStoreSetting",
1894
+ actionLabel: a("connect.store.onboarding.settingTitle")
1895
+ }
1896
+ ].filter((p) => p.key !== "payout" || c.requiresPayout)), l = D(
1897
+ () => o.value.filter((r) => r.status === "COMPLETE").length
1898
+ ), f = D(
1899
+ () => o.value.find((r) => r.status !== "COMPLETE")
1900
+ );
1901
+ function t() {
1902
+ f.value && (d(f.value.action), h("primary"), g.close());
1903
+ }
1904
+ return (r, p) => {
1905
+ const y = v("FmIcon"), w = v("FmChip"), u = v("FmButton");
1906
+ return m(), T("div", on, [
1907
+ n("div", nn, F(e(a)("connect.store.setupDialog.description")), 1),
1908
+ n("div", an, [
1909
+ n("div", sn, [
1910
+ n("div", {
1911
+ class: "h-full rounded-full bg-fm-color-primary transition-all",
1912
+ style: Qe({ width: `${e(l) / e(o).length * 100}%` })
1913
+ }, null, 4)
1914
+ ]),
1915
+ n("div", ln, F(e(a)("connect.store.setupDialog.progress", {
1916
+ done: e(l),
1917
+ total: e(o).length
1918
+ })), 1)
1919
+ ]),
1920
+ n("div", rn, [
1921
+ (m(!0), T(W, null, de(e(o), (S, $) => {
1922
+ var N;
1923
+ return m(), T("div", {
1924
+ key: S.key,
1925
+ class: $e([
1926
+ "rounded-md border-1 p-16 flex items-center gap-16",
1927
+ S.key === ((N = e(f)) == null ? void 0 : N.key) ? "border-fm-color-primary" : "border-fm-color-neutral-gray-200"
1928
+ ])
1929
+ }, [
1930
+ n("span", {
1931
+ class: $e([
1932
+ "w-24 h-24 rounded-sm flex-none grid place-items-center fm-typo-en-body-sm-600",
1933
+ S.status === "COMPLETE" ? "bg-fm-color-system-success-100 text-fm-color-typo-success" : "bg-fm-color-primary-oats text-fm-color-primary"
1934
+ ])
1935
+ }, [
1936
+ S.status === "COMPLETE" ? (m(), R(y, {
1937
+ key: 0,
1938
+ name: "check",
1939
+ size: "sm"
1940
+ })) : (m(), T(W, { key: 1 }, [
1941
+ le(F($ + 1), 1)
1942
+ ], 64))
1943
+ ], 2),
1944
+ n("div", cn, [
1945
+ n("div", dn, F(S.title), 1),
1946
+ n("div", un, F(S.description), 1)
1947
+ ]),
1948
+ i(w, {
1949
+ label: e(a)(
1950
+ S.status === "COMPLETE" ? "connect.store.onboarding.complete" : S.status === "PENDING" ? "connect.store.onboarding.pendingApproval" : "connect.store.onboarding.incomplete"
1951
+ ),
1952
+ variant: "plain",
1953
+ class: $e(
1954
+ S.status === "COMPLETE" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-warning bg-fm-color-system-warning-100"
1955
+ ),
1956
+ compact: ""
1957
+ }, null, 8, ["label", "class"])
1958
+ ], 2);
1959
+ }), 128))
1960
+ ]),
1961
+ n("div", mn, [
1962
+ i(u, {
1963
+ label: e(a)("connect.common.cancel"),
1964
+ variant: "tertiary",
1965
+ onClick: p[0] || (p[0] = (S) => e(g).close())
1966
+ }, null, 8, ["label"]),
1967
+ e(f) ? (m(), R(u, {
1968
+ key: 0,
1969
+ label: e(f).actionLabel,
1970
+ variant: "primary",
1971
+ onClick: t
1972
+ }, null, 8, ["label"])) : M("", !0)
1973
+ ])
1974
+ ]);
1975
+ };
1976
+ }
1977
+ });
1978
+ function fn(b, a, c = !0) {
1979
+ const g = (a == null ? void 0 : a.status) === "APPROVED" && a.enable ? "COMPLETE" : (a == null ? void 0 : a.status) === "PENDING" ? "PENDING" : "INCOMPLETE", d = c;
1980
+ return {
1981
+ settingStatus: b ? "COMPLETE" : "INCOMPLETE",
1982
+ payoutStatus: g,
1983
+ requiresPayout: d,
1984
+ complete: b && (!d || g === "COMPLETE")
1985
+ };
1986
+ }
1987
+ const yn = { class: "grid lg:grid-cols-2 gap-32 items-center" }, gn = { class: "flex flex-col gap-16" }, bn = { class: "flex flex-col gap-8" }, vn = { class: "fm-typo-en-title-md-800" }, hn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary max-w-[460px]" }, xn = { class: "flex flex-col gap-16" }, _n = { class: "w-40 h-40 rounded-md flex-none grid place-items-center bg-fm-color-primary-oats text-fm-color-primary" }, Cn = { class: "flex flex-col gap-2" }, Sn = { class: "fm-typo-en-body-md-600" }, Fn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, wn = { class: "flex items-center gap-16 pt-8" }, $n = { class: "relative rounded-lg overflow-hidden aspect-[4/3] flex items-end justify-center bg-gradient-to-br from-[#FFF3E6] to-[#FDE6D0]" }, kn = { class: "absolute inset-0 grid place-items-center" }, Pn = { class: "relative w-[68%] max-w-[320px]" }, Vn = { class: "relative w-full aspect-[1.586/1] rounded-lg p-16 flex flex-col justify-between text-fm-color-typo-white bg-gradient-to-br from-[#C98A4B] to-[#A96A2E] rotate-[-3deg]" }, Tn = { class: "flex flex-col" }, Rn = { class: "fm-typo-en-body-sm-400 uppercase tracking-[0.12em] opacity-90" }, In = /* @__PURE__ */ X({
1988
+ __name: "GiftCardUpsell",
1989
+ props: {
1990
+ premium: { type: Boolean }
1991
+ },
1992
+ emits: ["upgrade", "comparePlans", "create"],
1993
+ setup(b, { emit: a }) {
1994
+ const { t: c } = he(), g = a, d = [
1995
+ {
1996
+ icon: "send",
1997
+ title: "connect.store.giftCard.benefitGiftTitle",
1998
+ description: "connect.store.giftCard.benefitGiftDescription"
1999
+ },
2000
+ {
2001
+ icon: "bar_chart",
2002
+ title: "connect.store.giftCard.benefitSalesTitle",
2003
+ description: "connect.store.giftCard.benefitSalesDescription"
2004
+ },
2005
+ {
2006
+ icon: "favorite",
2007
+ title: "connect.store.giftCard.benefitLoyaltyTitle",
2008
+ description: "connect.store.giftCard.benefitLoyaltyDescription"
2009
+ }
2010
+ ];
2011
+ return (h, o) => {
2012
+ const l = v("FmIcon"), f = v("FmButton"), t = v("FmCard");
2013
+ return m(), R(t, {
2014
+ variant: "outlined",
2015
+ class: "p-24"
2016
+ }, {
2017
+ default: I(() => [
2018
+ n("div", yn, [
2019
+ n("div", gn, [
2020
+ n("span", {
2021
+ class: $e([
2022
+ "self-start inline-flex items-center gap-4 px-8 py-4 rounded-sm fm-typo-en-body-sm-600 tracking-[0.05em]",
2023
+ b.premium ? "bg-fm-color-system-success-100 text-fm-color-typo-success" : "bg-fm-color-secondary-blueberry text-fm-color-typo-white uppercase"
2024
+ ])
2025
+ }, [
2026
+ i(l, {
2027
+ name: b.premium ? "check" : "stars",
2028
+ size: "sm"
2029
+ }, null, 8, ["name"]),
2030
+ le(" " + F(b.premium ? e(c)("connect.store.giftCard.includedInPlan") : e(c)("connect.store.giftCard.premium")), 1)
2031
+ ], 2),
2032
+ n("div", bn, [
2033
+ n("div", vn, F(e(c)("connect.store.giftCard.upsellTitle")), 1),
2034
+ n("div", hn, F(e(c)("connect.store.giftCard.upsellDescription")), 1)
2035
+ ]),
2036
+ n("div", xn, [
2037
+ (m(), T(W, null, de(d, (r) => n("div", {
2038
+ key: r.icon,
2039
+ class: "flex items-start gap-12"
2040
+ }, [
2041
+ n("span", _n, [
2042
+ i(l, {
2043
+ name: r.icon
2044
+ }, null, 8, ["name"])
2045
+ ]),
2046
+ n("div", Cn, [
2047
+ n("div", Sn, F(e(c)(r.title)), 1),
2048
+ n("div", Fn, F(e(c)(r.description)), 1)
2049
+ ])
2050
+ ])), 64))
2051
+ ]),
2052
+ n("div", wn, [
2053
+ b.premium ? (m(), R(f, {
2054
+ key: 0,
2055
+ label: e(c)("connect.store.giftCard.createGiftCard"),
2056
+ variant: "primary",
2057
+ icon: "add",
2058
+ onClick: o[0] || (o[0] = (r) => g("create"))
2059
+ }, null, 8, ["label"])) : (m(), T(W, { key: 1 }, [
2060
+ i(f, {
2061
+ label: e(c)("connect.store.giftCard.upgrade"),
2062
+ variant: "primary",
2063
+ onClick: o[1] || (o[1] = (r) => g("upgrade"))
2064
+ }, null, 8, ["label"]),
2065
+ n("button", {
2066
+ type: "button",
2067
+ class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-typo-primary",
2068
+ onClick: o[2] || (o[2] = (r) => g("comparePlans"))
2069
+ }, [
2070
+ le(F(e(c)("connect.store.giftCard.comparePlans")) + " ", 1),
2071
+ i(l, {
2072
+ name: "chevron_right",
2073
+ size: "sm"
2074
+ })
2075
+ ])
2076
+ ], 64))
2077
+ ])
2078
+ ]),
2079
+ n("div", $n, [
2080
+ n("div", kn, [
2081
+ n("div", Pn, [
2082
+ o[6] || (o[6] = n("div", { class: "absolute -left-[14%] top-[6%] w-full aspect-[1.586/1] rounded-lg bg-gradient-to-br from-[#3A3A3C] to-[#1C1C1E] rotate-[-8deg]" }, null, -1)),
2083
+ n("div", Vn, [
2084
+ o[5] || (o[5] = n("span", { class: "fm-typo-en-body-md-600" }, "FeedMe", -1)),
2085
+ n("div", Tn, [
2086
+ n("span", Rn, F(e(c)("connect.store.giftCard.giftCardLabel")), 1),
2087
+ o[4] || (o[4] = n("span", { class: "fm-typo-en-title-md-800" }, "RM100", -1))
2088
+ ])
2089
+ ])
2090
+ ])
2091
+ ]),
2092
+ b.premium ? M("", !0) : (m(), T("button", {
2093
+ key: 0,
2094
+ type: "button",
2095
+ class: "relative mb-24 inline-flex items-center gap-8 px-16 py-8 rounded-full bg-fm-color-neutral-black text-fm-color-typo-white fm-typo-en-body-sm-600",
2096
+ onClick: o[3] || (o[3] = (r) => g("upgrade"))
2097
+ }, [
2098
+ i(l, {
2099
+ name: "lock",
2100
+ size: "sm"
2101
+ }),
2102
+ le(" " + F(e(c)("connect.store.giftCard.unlockNow")), 1)
2103
+ ]))
2104
+ ])
2105
+ ])
2106
+ ]),
2107
+ _: 1
2108
+ });
2109
+ };
2110
+ }
2111
+ });
2112
+ var Ze = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "feedmedev.vip", crmUrl: "crm.feedmedev.cc", paymentPortalUrl: "https://portal.feedmedev.cc/payment/payout-account", licensePortalUrl: "https://license.feedmedev.cc/", marketingV1Portal: "https://marketing-v1.feedmedev.cc", voucherAppUrl: "https://voucher.feedmedev.cc/" };
2113
+ const Un = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary max-w-[640px]" }, Dn = { class: "px-24 flex flex-col gap-y-16" }, En = { class: "space-y-8 py-12" }, Bn = { class: "flex gap-8 items-center" }, Nn = { class: "fm-typo-en-body-lg-600" }, Mn = {
2114
+ key: 1,
2115
+ class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary"
2116
+ }, On = {
2117
+ key: 1,
2118
+ class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24"
2119
+ }, Ln = { class: "flex gap-8 items-center" }, An = { class: "fm-typo-en-body-lg-600" }, jn = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-24" }, qn = { class: "flex flex-col gap-16 text-center" }, Gn = { class: "fm-typo-en-title-sm-800" }, Kn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Fa = /* @__PURE__ */ X({
2120
+ __name: "Store",
2121
+ setup(b) {
2122
+ const { t: a } = he(), c = {
2123
+ label: a("connect.store.actions.setting"),
2124
+ value: "setting",
2125
+ isPrimary: !1
2126
+ }, g = {
2127
+ label: a("connect.store.actions.manageReward"),
2128
+ value: "create_reward"
2129
+ }, d = {
2130
+ label: a("connect.store.actions.addCategory"),
2131
+ value: "create_category",
2132
+ isPrimary: !0,
2133
+ prependIcon: "add"
2134
+ }, h = O(), o = kt(), l = Ye(), { global: f, minor: t } = et, r = ze(), p = D(() => l.sortedStoreCategories), y = D(() => l.sortedStoreCategories.map((x) => x.name)), w = O(), u = O(), S = $t(), $ = O([]), N = D(() => S.isPremium), ue = D(() => {
2135
+ var x;
2136
+ return !!((x = l.storeOption) != null && x.company);
2137
+ }), oe = O(!1), z = D(
2138
+ () => fn(
2139
+ ue.value,
2140
+ l.payoutAccount,
2141
+ !oe.value || N.value
2142
+ )
2143
+ ), te = D(() => !z.value.complete), me = O(!1);
2144
+ function V() {
2145
+ return `connect.store.allSetDismissed.${Ge.getBusinessId()}`;
2146
+ }
2147
+ function xe() {
2148
+ try {
2149
+ return localStorage.getItem(V()) === "1";
2150
+ } catch {
2151
+ return !1;
2152
+ }
2153
+ }
2154
+ function fe() {
2155
+ me.value = !0;
2156
+ try {
2157
+ localStorage.setItem(V(), "1");
2158
+ } catch {
2159
+ }
2160
+ }
2161
+ const Ve = {
2162
+ name: Oe["$connect-TRANSACTION"],
2163
+ query: { tab: "store" }
2164
+ };
2165
+ function q() {
2166
+ window.open(
2167
+ `${Ze.licensePortalUrl}business/${Ge.businessId}/settings`,
2168
+ "_blank"
2169
+ );
2170
+ }
2171
+ function Se() {
2172
+ window.open("https://feedme.ai/pricing", "_blank", "noopener");
2173
+ }
2174
+ async function C() {
2175
+ if (N.value)
2176
+ try {
2177
+ $.value = await qe.readPrograms();
2178
+ } catch {
2179
+ $.value = [];
2180
+ }
2181
+ }
2182
+ function s() {
2183
+ o.push({ name: Oe["$connect-STORE_GIFT_CARD_SETUP"] });
2184
+ }
2185
+ function k(x) {
2186
+ o.push({
2187
+ name: Oe["$connect-STORE_GIFT_CARD_SETUP"],
2188
+ params: { id: String(x._id) }
2189
+ });
2190
+ }
2191
+ async function E(x) {
2192
+ await Ie.confirm(
2193
+ `Set "${x.name}" live? Only one gift card can be live at a time, so any other will be set inactive.`,
2194
+ "Set live",
2195
+ "Set live",
2196
+ "Cancel"
2197
+ ) && await t(
2198
+ async () => {
2199
+ await qe.activateProgram(String(x._id)), await C();
2200
+ },
2201
+ { message: "Setting live", successMessage: "Gift card is live" }
2202
+ );
2203
+ }
2204
+ async function J(x) {
2205
+ await t(
2206
+ async () => {
2207
+ await qe.deactivateProgram(String(x._id)), await C();
2208
+ },
2209
+ { message: "Updating gift card", successMessage: "Gift card set inactive" }
2210
+ );
2211
+ }
2212
+ function Z() {
2213
+ r.open({
2214
+ title: a("connect.store.setupDialog.title"),
2215
+ contentComponent: pn,
2216
+ contentComponentProps: {
2217
+ settingStatus: z.value.settingStatus,
2218
+ payoutStatus: z.value.payoutStatus,
2219
+ requiresPayout: z.value.requiresPayout
2220
+ }
2221
+ }).onPrimary((x) => {
2222
+ A(x === "setupPayout" ? "payout" : "setting");
2223
+ });
2224
+ }
2225
+ async function A(x) {
2226
+ var P;
2227
+ x === "setting" ? (P = w.value) == null || P.showSheet(!0, l.storeOption) : x === "create_category" ? ye(-1) : x === "create_reward" ? await o.push({ name: Oe["$connect-STORE_REWARDS"] }) : x == "payout" && window.open(Ze.paymentPortalUrl, "_blank");
2228
+ }
2229
+ function _e(x, P) {
2230
+ var _;
2231
+ const B = !!((_ = P.company) != null && _.sstRegNo), H = P.inclusiveTaxes ?? [], G = Q.taxSystem.map((U) => U.code), L = B ? H.flatMap((U) => {
2232
+ console.log(U, "inclusive tax");
2233
+ const K = Q.systemDefaultCode(U.systemCode);
2234
+ return K ? [{ systemCode: U.systemCode, taxCode: K.taxCode }] : [];
2235
+ }) : [];
2236
+ return console.log([
2237
+ ["hasSstRegNo", B],
2238
+ ["defaultTaxCodes", L],
2239
+ ["inclusiveTaxes", H],
2240
+ ["taxSystemCodes", G]
2241
+ ]), x.map((U) => ({
2242
+ ...U,
2243
+ bundles: U.bundles.map((K) => {
2244
+ const { pf_vouchers: ee, ...Y } = K;
2245
+ if (!B)
2246
+ return {
2247
+ ...Y,
2248
+ taxes: [],
2249
+ taxTotals: [],
2250
+ priceWithTaxes: { ...Y.price }
2251
+ };
2252
+ const ne = L, we = ot(
2253
+ Q.fullTax,
2254
+ ne,
2255
+ Y.price,
2256
+ Number(Y.credit.normal),
2257
+ H,
2258
+ G
2259
+ );
2260
+ return {
2261
+ ...Y,
2262
+ taxes: ne,
2263
+ taxTotals: we,
2264
+ priceWithTaxes: nt(
2265
+ we,
2266
+ Y.price,
2267
+ H
2268
+ )
2269
+ };
2270
+ })
2271
+ }));
2272
+ }
2273
+ async function ke(x, P, B) {
2274
+ const H = !B && !!P, G = !!B && !P;
2275
+ let L;
2276
+ if (H) {
2277
+ const U = Q.taxSystem[0] ? Q.systemDefaultCode(Q.taxSystem[0].code) : void 0, K = U ? `${U.name} (${U.taxCode})` : a("connect.store.taxPropagation.defaultTax");
2278
+ L = a("connect.store.taxPropagation.addConfirm", {
2279
+ taxCode: K
2280
+ });
2281
+ } else G ? L = a("connect.store.taxPropagation.removeConfirm") : L = a("connect.store.taxPropagation.updateConfirm");
2282
+ await Ie.confirm(
2283
+ L,
2284
+ a("connect.store.taxPropagation.title"),
2285
+ a("connect.store.taxPropagation.confirm"),
2286
+ a("connect.common.cancel")
2287
+ ) && await t(
2288
+ async () => {
2289
+ const U = Ae(l.sortedStoreCategories), K = _e(U, x);
2290
+ await Ue.updateStoreBundle({ categories: K }), await l.readMemberStore(), await l.readMembership(), await l.readRewards();
2291
+ },
2292
+ {
2293
+ message: a("connect.store.taxPropagation.updating"),
2294
+ successMessage: a("connect.store.taxPropagation.success")
2295
+ }
2296
+ );
2297
+ }
2298
+ async function Fe(x) {
2299
+ var K, ee, Y, ne;
2300
+ const P = ((ee = (K = l.storeOption) == null ? void 0 : K.company) == null ? void 0 : ee.sstRegNo) ?? "", B = pe.cloneDeep(
2301
+ ((Y = l.storeOption) == null ? void 0 : Y.inclusiveTaxes) ?? []
2302
+ ), H = ((ne = x.company) == null ? void 0 : ne.sstRegNo) ?? "";
2303
+ await t(
2304
+ async () => {
2305
+ var we;
2306
+ await Ue.updateStore(x), await l.readMemberStore(), (we = w.value) == null || we.showSheet(!1);
2307
+ },
2308
+ {
2309
+ message: a("connect.store.setting.update.message"),
2310
+ successMessage: a("connect.store.setting.update.success")
2311
+ }
2312
+ );
2313
+ const G = P !== H, L = !pe.isEqual(
2314
+ B,
2315
+ x.inclusiveTaxes ?? []
2316
+ );
2317
+ !(G || L) || l.sortedStoreCategories.flatMap(
2318
+ (we) => we.bundles
2319
+ ).length === 0 || await ke(x, H, P);
2320
+ }
2321
+ async function ye(x = -1) {
2322
+ var P;
2323
+ if (te.value) {
2324
+ Z();
2325
+ return;
2326
+ }
2327
+ r.open({
2328
+ title: x == -1 ? a("connect.store.category.add") : a("connect.store.category.edit"),
2329
+ contentComponent: jt,
2330
+ contentComponentProps: {
2331
+ initialValue: ((P = p.value[x]) == null ? void 0 : P.name) ?? "",
2332
+ action: x == -1 ? "add" : "edit"
2333
+ }
2334
+ }).onPrimary(async (B) => {
2335
+ B === null && !await Ie.remove(
2336
+ a("connect.store.category.remove.confirm"),
2337
+ a("connect.store.category.remove.title")
2338
+ ) || await t(
2339
+ async () => {
2340
+ const H = x == -1 ? [...p.value, { name: B, bundles: [] }] : [...p.value].map((G, L) => L == x ? { ...G, name: B } : G).filter((G) => G.name !== null);
2341
+ await Ue.updateStoreBundle({
2342
+ categories: H
2343
+ }), await l.readMemberStore();
2344
+ },
2345
+ {
2346
+ message: B === null ? a("connect.store.category.update.deleting") : x == -1 ? a("connect.store.category.update.creating") : a("connect.store.category.update.updating"),
2347
+ successMessage: B === null ? a("connect.store.category.update.success.deleted") : x == -1 ? a("connect.store.category.update.success.created") : a("connect.store.category.update.success.updated")
2348
+ }
2349
+ );
2350
+ });
2351
+ }
2352
+ async function ie(x, P, B, H) {
2353
+ var _, U, K;
2354
+ P ?? (P = (_ = u.value) == null ? void 0 : _.target.category), B ?? (B = (U = u.value) == null ? void 0 : U.target.index), H ?? (H = (K = u.value) == null ? void 0 : K.target.originalCategoryIndex);
2355
+ const G = Ae(p.value);
2356
+ for (const ee of G)
2357
+ for (const Y of ee.bundles)
2358
+ console.log(Y, "bundle in payload"), "pf_vouchers" in Y && delete Y.pf_vouchers;
2359
+ P != H && H != null && (G[H].bundles.splice(B, 1), B = G[P].bundles.length);
2360
+ const L = G[P];
2361
+ if (!L) {
2362
+ gt.error("Unexpected error", 2e3);
2363
+ return;
2364
+ }
2365
+ if (x == null) {
2366
+ if (await Ie.remove(
2367
+ a("connect.store.bundle.delete.confirm"),
2368
+ a("connect.store.bundle.delete.title")
2369
+ ) == !1)
2370
+ return;
2371
+ L.bundles.splice(B, 1);
2372
+ } else
2373
+ B == -1 ? L.bundles.push(x) : L.bundles[B] = x;
2374
+ await t(
2375
+ async () => {
2376
+ var ee, Y;
2377
+ if (x != null) {
2378
+ const ne = (ee = u.value) == null ? void 0 : ee.bundleImage;
2379
+ ne === null && x.image ? (await je.delete(x.image), x.image = null) : ne && (x.image = await je.update(
2380
+ je.bundleImagePath(void 0, ne),
2381
+ ne
2382
+ ));
2383
+ }
2384
+ await Ue.updateStoreBundle({
2385
+ categories: G
2386
+ }), await l.readMemberStore(), await l.readMembership(), await l.readRewards(), (Y = u.value) == null || Y.showSheet(!1);
2387
+ },
2388
+ {
2389
+ message: `${x == null ? "Deleting" : B == -1 ? "Creating" : "Updating"} bundle`,
2390
+ successMessage: `Bundle ${x == null ? "deleted" : B == -1 ? "created" : "updated"} successfully`
2391
+ }
2392
+ );
2393
+ }
2394
+ function Pe(x) {
2395
+ var P;
2396
+ if (te.value) {
2397
+ Z();
2398
+ return;
2399
+ }
2400
+ (P = u.value) == null || P.showSheet(!0, {
2401
+ ...x,
2402
+ bundle: x.bundle ? Ae(x.bundle) : void 0
2403
+ });
2404
+ }
2405
+ const Be = D(() => [
2406
+ c,
2407
+ g,
2408
+ d
2409
+ ]);
2410
+ function Ne(x) {
2411
+ var P;
2412
+ (P = h.value) == null || P.showSheet({
2413
+ bundle: x
2414
+ });
2415
+ }
2416
+ return Ee(async () => {
2417
+ await f(async () => {
2418
+ var x, P;
2419
+ if (await l.readMemberStore(), await l.readMembership(), await l.readRewards(), await l.readPayoutAccount(), await S.readPremium(), oe.value = !0, me.value = xe(), await C(), (x = o.currentRoute.value.query) != null && x.action) {
2420
+ switch ((P = o.currentRoute.value.query) == null ? void 0 : P.action) {
2421
+ case "update_setting":
2422
+ A("setting");
2423
+ break;
2424
+ case "create_category":
2425
+ ye(-1);
2426
+ break;
2427
+ case "create_feedvibe_bundle":
2428
+ r.open({
2429
+ title: "Select category",
2430
+ contentComponent: Kt
2431
+ }).onPrimary((B) => {
2432
+ r.close(), Pe({
2433
+ categories: y.value,
2434
+ category: B,
2435
+ index: -1,
2436
+ bundle: {
2437
+ ...pe.cloneDeep(Ke),
2438
+ isFeedvibe: !0,
2439
+ price: j.Dinero.fromNumber({
2440
+ number: 10,
2441
+ precision: 2
2442
+ }).toObject()
2443
+ }
2444
+ });
2445
+ }).onTertiary(() => r.close());
2446
+ break;
2447
+ }
2448
+ o.replace({ query: {} });
2449
+ }
2450
+ });
2451
+ }), (x, P) => {
2452
+ const B = v("RouterLink"), H = v("FmPageHead"), G = v("FmPill"), L = v("FmButton"), _ = v("FmCard");
2453
+ return m(), T(W, null, [
2454
+ i(H, {
2455
+ title: e(a)("connect.store.title"),
2456
+ actions: e(Be),
2457
+ "onClick:action": A
2458
+ }, {
2459
+ description: I(() => [
2460
+ n("span", Un, F(e(a)("connect.store.description")), 1),
2461
+ i(B, {
2462
+ to: Ve,
2463
+ class: "ml-8 fm-typo-en-link-md-600 text-fm-color-primary"
2464
+ }, {
2465
+ default: I(() => [
2466
+ le(F(e(a)("connect.store.viewTransactions")), 1)
2467
+ ]),
2468
+ _: 1
2469
+ })
2470
+ ]),
2471
+ _: 1
2472
+ }, 8, ["title", "actions"]),
2473
+ n("div", Dn, [
2474
+ e(te) ? (m(), R(Yo, {
2475
+ key: 0,
2476
+ class: "mt-12",
2477
+ "setting-status": e(z).settingStatus,
2478
+ "payout-status": e(z).payoutStatus,
2479
+ "requires-payout": e(z).requiresPayout,
2480
+ onSetupStoreSetting: P[0] || (P[0] = (U) => A("setting")),
2481
+ onSetupPayout: P[1] || (P[1] = (U) => A("payout"))
2482
+ }, null, 8, ["setting-status", "payout-status", "requires-payout"])) : e(me) ? M("", !0) : (m(), R(tn, {
2483
+ key: 1,
2484
+ class: "mt-12",
2485
+ onDismiss: fe
2486
+ })),
2487
+ n("div", En, [
2488
+ n("div", Bn, [
2489
+ n("div", Nn, F(e(a)("connect.store.giftCard.title")), 1),
2490
+ i(G, {
2491
+ variant: "premium",
2492
+ label: e(a)("connect.store.giftCard.new")
2493
+ }, null, 8, ["label"]),
2494
+ e(N) && e($).length ? (m(), R(L, {
2495
+ key: 0,
2496
+ icon: "edit",
2497
+ size: "md",
2498
+ variant: "tertiary",
2499
+ onClick: P[2] || (P[2] = (U) => k(e($)[0]))
2500
+ })) : M("", !0),
2501
+ P[4] || (P[4] = n("div", { class: "flex-1" }, null, -1)),
2502
+ e(N) && e($).length ? (m(), T("div", Mn, F(e(a)("connect.store.giftCard.oneLiveHint")), 1)) : M("", !0)
2503
+ ]),
2504
+ !e(N) || !e($).length ? (m(), R(In, {
2505
+ key: 0,
2506
+ premium: e(N),
2507
+ onUpgrade: q,
2508
+ onComparePlans: Se,
2509
+ onCreate: s
2510
+ }, null, 8, ["premium"])) : (m(), T("div", On, [
2511
+ (m(!0), T(W, null, de(e($), (U) => (m(), R(Mo, {
2512
+ key: String(U._id),
2513
+ program: U,
2514
+ onEdit: (K) => k(U),
2515
+ onSetLive: (K) => E(U),
2516
+ onDeactivate: (K) => J(U)
2517
+ }, null, 8, ["program", "onEdit", "onSetLive", "onDeactivate"]))), 128)),
2518
+ i(_, {
2519
+ variant: "outlined",
2520
+ class: "flex flex-col gap-y-8 p-16 h-full min-h-[240px] items-center justify-center"
2521
+ }, {
2522
+ default: I(() => [
2523
+ i(L, {
2524
+ label: e(a)("connect.store.giftCard.addGiftCard"),
2525
+ icon: "add",
2526
+ variant: "secondary",
2527
+ onClick: s
2528
+ }, null, 8, ["label"])
2529
+ ]),
2530
+ _: 1
2531
+ })
2532
+ ]))
2533
+ ]),
2534
+ e(p) && e(p).length > 0 ? (m(), T(W, { key: 2 }, [
2535
+ (m(!0), T(W, null, de(e(p), (U, K) => (m(), T("div", {
2536
+ key: U.name,
2537
+ class: "space-y-8 py-12"
2538
+ }, [
2539
+ n("div", Ln, [
2540
+ n("div", An, F(U.name), 1),
2541
+ i(Je, { json: U }, null, 8, ["json"]),
2542
+ i(L, {
2543
+ icon: "edit",
2544
+ size: "md",
2545
+ variant: "tertiary",
2546
+ onClick: (ee) => ye(K)
2547
+ }, null, 8, ["onClick"])
2548
+ ]),
2549
+ n("div", jn, [
2550
+ (m(!0), T(W, null, de(U.bundles, (ee, Y) => (m(), R(Nt, {
2551
+ bundle: ee,
2552
+ key: ee._id,
2553
+ onEdit: (ne) => Pe({
2554
+ bundle: ee,
2555
+ category: K,
2556
+ index: Y,
2557
+ categories: e(y)
2558
+ }),
2559
+ onDelete: (ne) => ie(null, K, Y),
2560
+ onSend: Ne
2561
+ }, null, 8, ["bundle", "onEdit", "onDelete"]))), 128)),
2562
+ i(Mt, {
2563
+ onCreate: (ee) => Pe({
2564
+ category: K,
2565
+ index: -1,
2566
+ categories: e(y)
2567
+ })
2568
+ }, null, 8, ["onCreate"])
2569
+ ])
2570
+ ]))), 128)),
2571
+ i(wo, {
2572
+ ref_key: "bundleSheetRef",
2573
+ ref: u,
2574
+ onUpdate: ie
2575
+ }, null, 512)
2576
+ ], 64)) : (m(), R(_, {
2577
+ key: 3,
2578
+ variant: "outlined",
2579
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
2580
+ }, {
2581
+ default: I(() => [
2582
+ P[5] || (P[5] = n("img", {
2583
+ src: it,
2584
+ class: "aspect-square w-[150px]"
2585
+ }, null, -1)),
2586
+ n("div", qn, [
2587
+ n("div", Gn, F(e(a)("connect.store.bundle.title")), 1),
2588
+ n("div", Kn, F(e(a)("connect.store.bundle.description")), 1)
2589
+ ]),
2590
+ i(L, {
2591
+ variant: "primary",
2592
+ label: e(a)("connect.store.actions.addCategory"),
2593
+ icon: "add",
2594
+ onClick: P[3] || (P[3] = (U) => ye(-1))
2595
+ }, null, 8, ["label"])
2596
+ ]),
2597
+ _: 1
2598
+ })),
2599
+ i(co, {
2600
+ ref_key: "settingSheetRef",
2601
+ ref: w,
2602
+ onUpdate: Fe
2603
+ }, null, 512),
2604
+ i(Po, {
2605
+ ref_key: "sendBundleSheetRef",
2606
+ ref: h
2607
+ }, null, 512)
2608
+ ])
2609
+ ], 64);
2610
+ };
2611
+ }
2612
+ });
2613
+ export {
2614
+ Fa as default
2615
+ };