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

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