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

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 (112) hide show
  1. package/dist/{App-B3CAyfBN.js → App-B1sVRUgU.js} +8 -8
  2. package/dist/{AuditLogs-6Nx6aZDu.js → AuditLogs-jIv5rADu.js} +10 -10
  3. package/dist/{Bin-CvxKrShs.js → Bin-BFb2FxJL.js} +8 -8
  4. package/dist/{Broadcast-DtGZvaI8.js → Broadcast-C-yR1YzE.js} +11 -11
  5. package/dist/{CampaignAnalytic-Ch3r1Rvg.js → CampaignAnalytic-D2Udb-1I.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D5V8gcBo.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pp80jczz.js} +7 -7
  7. package/dist/Card-CzzNo7nk.js +996 -0
  8. package/dist/{Collections-BXBpPmnS.js → Collections-DoDZlLT5.js} +8 -8
  9. package/dist/{Credit-C733PkQ7.js → Credit-D-ss0yae.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DL93wXB3.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DbkQVmGE.js} +32 -32
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-78ACNCQb.js → EffectSheet.vue_vue_type_style_index_0_lang-B8LawUFT.js} +6 -6
  12. package/dist/{Experience-B5TE29sq.js → Experience-OMwgCv-k.js} +12 -12
  13. package/dist/{FileSaver.min-uNXEaKFf.js → FileSaver.min-Ck08usZi.js} +1 -1
  14. package/dist/{Game-sVgPJlky.js → Game-S5m1kti2.js} +13 -13
  15. package/dist/{GiftCardSetup-DnDJAEkL.js → GiftCardSetup-CR8NpUJv.js} +69 -69
  16. package/dist/{Grab-s5MAs0OX.js → Grab-CgVDlh8N.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CmLV1NBe.js → ImageInput.vue_vue_type_script_setup_true_lang-B9JaZNoF.js} +1 -1
  18. package/dist/{Index-ClMsQE_a.js → Index-BZRQSQt3.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Bhhtt6Tx.js → LocationPicker.vue_vue_type_script_setup_true_lang-CZp2vyhp.js} +1 -1
  20. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BubkhiNi.js → LottieAnimation.vue_vue_type_script_setup_true_lang-D9iMrk0m.js} +1 -1
  21. package/dist/{LoyaltyDashboard-1HbbXSc2.js → LoyaltyDashboard-CkJsz_FM.js} +7 -7
  22. package/dist/{MainLayout-CxHx8E6E.js → MainLayout-y2AvCI7H.js} +3 -3
  23. package/dist/{Marketing-JoBpCgYv.js → Marketing-CdekCDN6.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-CWZYM5Yk.js → MarketingMaterialEdit-r3xPXa_W.js} +6 -6
  25. package/dist/{Member-97blstVa.js → Member-D4O-38yG.js} +12 -12
  26. package/dist/{MemberList-CdcutIMW.js → MemberList-ABpFaISm.js} +26 -26
  27. package/dist/{MemberTransactions-CXW1gGcm.js → MemberTransactions-DK-x6c7P.js} +1 -1
  28. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BYF5TTe5.js → MessageInput.vue_vue_type_script_setup_true_lang-DGPNmiR9.js} +9 -9
  29. package/dist/{Mission-BHjuhYLP.js → Mission-5RhDQ1MF.js} +13 -13
  30. package/dist/{Overview-BAY6pqBp.js → Overview-0ukOrJQs.js} +3 -3
  31. package/dist/{Overview-D8fc_MlB.js → Overview-B52hUVqf.js} +19 -19
  32. package/dist/{Point-DbRROw9n.js → Point-TSd4Uvmd.js} +12 -12
  33. package/dist/{Promotion-Il9bEPzn.js → Promotion-BBpfsz8N.js} +13 -13
  34. package/dist/{Queue-BCMs3-Kw.js → Queue-BgnYKxGG.js} +11 -11
  35. package/dist/{Record-DIHRf5iG.js → Record-CAtURV9U.js} +9 -9
  36. package/dist/{Review-CcS_JCae.js → Review-CuSrZB-m.js} +2 -2
  37. package/dist/{ReviewFacebookCallback-QzevpKzX.js → ReviewFacebookCallback-DQTVwxJo.js} +5 -5
  38. package/dist/{ReviewGoogleCallback-K8bqS2A4.js → ReviewGoogleCallback-Dn1bMM23.js} +5 -5
  39. package/dist/{Reward-B8L_xU15.js → Reward-GArpJo5Q.js} +16 -16
  40. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-9oZZkhfs.js → RewardGroup.vue_vue_type_script_setup_true_lang-CuOxAvxV.js} +12 -12
  41. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DJZIbazu.js → RuleGroup.vue_vue_type_script_setup_true_lang-BZTg3pTi.js} +15 -15
  42. package/dist/{Segment-DmepUJOa.js → Segment-BNoD4VPH.js} +25 -25
  43. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BNyULlPJ.js → SelectItems.vue_vue_type_script_setup_true_lang-JrfOr5Px.js} +2 -2
  44. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-ClXst_jA.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BY8aFZsB.js} +13 -13
  45. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BfpKPA2p.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-KVaH8rrU.js} +4 -4
  46. package/dist/{Setting-CtHKuMIu.js → Setting-CRYXwRFL.js} +14 -14
  47. package/dist/{SettingAdvertisements-BrLybMH8.js → SettingAdvertisements-Cqp6piIi.js} +12 -12
  48. package/dist/Settings-DNkUFLud.js +230 -0
  49. package/dist/{Store-Ce2SbX0d.js → Store-Dnt8VDQA.js} +31 -31
  50. package/dist/{StoreRewards-Bm81xn3d.js → StoreRewards-DDlMWlTG.js} +15 -15
  51. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-R5MWAGzJ.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Zedck9Xi.js} +21 -21
  52. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BMujGIhR.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C3RBFu6J.js} +2 -2
  53. package/dist/{Tier-DiPQgsjw.js → Tier-t2Ce3rxu.js} +25 -25
  54. package/dist/{Title-CMPiLqUp.js → Title-CdI511i0.js} +22 -22
  55. package/dist/{Transaction-DA2jVRko.js → Transaction-C2BHJU7_.js} +2 -2
  56. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-4ys1liCk.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DsZxEZw9.js} +6 -6
  57. package/dist/{Voucher-CZMOj1Xu.js → Voucher-D1QRj4Ps.js} +14 -14
  58. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BGbrah1l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BVCNUWYO.js} +12 -12
  59. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DvYcjxky.js → ZodTextField.vue_vue_type_script_setup_true_lang-W_7pFEAG.js} +2 -2
  60. package/dist/{app-B3qT3nsb.js → app-D4yjN_fQ.js} +141 -61
  61. package/dist/app.js +1 -1
  62. package/dist/{business-BbVttO00.js → business-Dq1_o57i.js} +1 -1
  63. package/dist/{campaign-BNM35vw2.js → campaign-B7NIPxHs.js} +7 -7
  64. package/dist/{campaign-C6p9x-9d.js → campaign-CNkbWJTf.js} +2 -2
  65. package/dist/{campaign.fn-TfiVDVkR.js → campaign.fn-qKzOoBBQ.js} +61 -61
  66. package/dist/{collection.fn-CKl_NLpS.js → collection.fn-BNRVdqye.js} +2 -2
  67. package/dist/{duplicateCampaign-BFg9AZ-l.js → duplicateCampaign-D29czqvn.js} +2 -2
  68. package/dist/{effect-CGbgx9kS.js → effect-B0ikJb6x.js} +1 -1
  69. package/dist/{email-addresses-CzatVfeH.js → email-addresses-D0ZUpClg.js} +2 -2
  70. package/dist/{export-DjvICnFV.js → export-Cr4mjkQZ.js} +3 -3
  71. package/dist/{helper-HQorVUMh.js → helper-ClPuPdgQ.js} +1 -1
  72. package/dist/{index-CKxNuOh2.js → index-B2hKSeR1.js} +4 -1
  73. package/dist/{index-OsrR99nz.js → index-BOfM9FNu.js} +35 -27
  74. package/dist/{index-bXngr6rb.js → index-BcHiQWdr.js} +2 -2
  75. package/dist/{index-C_-av7al.js → index-BrP_OwGm.js} +7 -7
  76. package/dist/{index-Ym4KAIL3.js → index-By93YZmr.js} +1 -1
  77. package/dist/{index-DI9TwnmP.js → index-CFk1uqb8.js} +1 -1
  78. package/dist/{index-Bf2N1qeK.js → index-CnckzYTa.js} +1 -1
  79. package/dist/{index-DWYB78be.js → index-CuHNDW6e.js} +1 -1
  80. package/dist/{index-auyC0MNX.js → index-CuPBtB3W.js} +1 -1
  81. package/dist/{index-BNzGRDns.js → index-DL7_OC7M.js} +1 -1
  82. package/dist/{index-C4pslTm_.js → index-DfMsF_gT.js} +3 -3
  83. package/dist/{index-CGiyd5Q7.js → index-DiqNx6FV.js} +1 -1
  84. package/dist/{index-DwcKpsO0.js → index-DpSlYwDW.js} +2 -2
  85. package/dist/{index-BNKPvyUY.js → index-Dpk1tAhn.js} +2 -2
  86. package/dist/{index-BPtDWOrz.js → index-Dyc5Dpgs.js} +1 -1
  87. package/dist/{index-DjjsQxLD.js → index-GjzeMN4u.js} +88 -75
  88. package/dist/{index-DC9OMIQu.js → index-nuptxtNP.js} +3 -3
  89. package/dist/{index.esm2017-DjodoeJW.js → index.esm2017-D3pI9NTE.js} +1 -1
  90. package/dist/{loading-DYYV5H0l.js → loading-DLrpThuY.js} +1 -1
  91. package/dist/{lodash-CChygi2L.js → lodash-BIVtqtkS.js} +1 -1
  92. package/dist/{membership-DwhS8gsL.js → membership-PNg3pIQf.js} +2 -2
  93. package/dist/{money-19HRkrob.js → money-Ck2sBYbh.js} +1 -1
  94. package/dist/{number-blMtEdkv.js → number-dfEMJDkz.js} +1 -1
  95. package/dist/{objectid-BetMyH-a.js → objectid-Bz-UKgI1.js} +8 -8
  96. package/dist/{plugins-Ci4CKjMq.js → plugins-D4_SIsjZ.js} +3 -3
  97. package/dist/{reward-DsENxEEE.js → reward-UzeAq0jY.js} +1 -1
  98. package/dist/{rule-Dtk4Xv3Y.js → rule-6OCvKihv.js} +3 -3
  99. package/dist/{rule-builder-CvACRFlj.js → rule-builder-VwyrN58i.js} +1 -1
  100. package/dist/{template-yQY1n3kU.js → template-DtwmJYOa.js} +6 -6
  101. package/dist/{timezone-DSXtFjzU.js → timezone-CHqOZvJX.js} +1 -1
  102. package/dist/{transaction.fn-V-QeX59p.js → transaction.fn-rUQ2fYVQ.js} +1 -1
  103. package/dist/{trigger-C-KQqjJ5.js → trigger-BT3dj5qY.js} +5 -5
  104. package/dist/{useMarketingMaterialActions-CwlbleSs.js → useMarketingMaterialActions-Dgq_G1qO.js} +3 -3
  105. package/dist/{usePagination-CyrlK5t1.js → usePagination-a1XSuIrr.js} +1 -1
  106. package/dist/{user-e-9bpi9B.js → user-CFls8m-e.js} +1 -1
  107. package/dist/{vue-i18n-BllhhX6m.js → vue-i18n-CzEcAXx-.js} +436 -436
  108. package/dist/{xlsx-D_mKpQNd.js → xlsx-DKPe4AfX.js} +440 -440
  109. package/dist/{zod-BJAeJJJS.js → zod-D2Q81R3d.js} +1 -1
  110. package/package.json +1 -1
  111. package/dist/Card-sfr6w0_O.js +0 -911
  112. package/dist/Settings-BlZVvVtV.js +0 -179
@@ -0,0 +1,996 @@
1
+ import { defineComponent as te, ref as x, computed as z, watch as ie, onMounted as le, resolveComponent as v, openBlock as c, createBlock as F, unref as e, isRef as W, withCtx as h, createElementVNode as d, createVNode as u, createElementBlock as M, Fragment as E, renderList as Z, createCommentVNode as $, normalizeClass as fe, createSlots as ye, h as J, toDisplayString as O, createTextVNode as ve, withModifiers as xe } from "vue";
2
+ import { _ as Ce } from "./campaign-CpzFl8Vr.js";
3
+ import { h as re } from "./moment-D7p2TMB-.js";
4
+ import { useDialog as _e, components as de } from "@feedmepos/ui-library";
5
+ import "./index-nuptxtNP.js";
6
+ import { u as ae } from "./loading-DLrpThuY.js";
7
+ import { u as ge } from "./app-wDQR6dpb.js";
8
+ import { u as oe } from "./membership-PNg3pIQf.js";
9
+ import { _ as ee } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
10
+ import { p as be, f as ue, n as Se } from "./plugins-D4_SIsjZ.js";
11
+ import { m as H } from "./index-B2hKSeR1.js";
12
+ import { z as me, R as he } from "./app-D4yjN_fQ.js";
13
+ import { Z as ce } from "./zod-D2Q81R3d.js";
14
+ import { _ as pe } from "./ImageInput.vue_vue_type_script_setup_true_lang-B9JaZNoF.js";
15
+ import "./index-BOfM9FNu.js";
16
+ import "./index-GjzeMN4u.js";
17
+ import "./index-DpSlYwDW.js";
18
+ import { b as we } from "./index-DfMsF_gT.js";
19
+ import "./index-BcHiQWdr.js";
20
+ import { O as ke } from "./objectid-Bz-UKgI1.js";
21
+ import { a as Fe, c as Ve } from "./object-BYyQ0PZp.js";
22
+ import { u as $e } from "./business-Dq1_o57i.js";
23
+ import { w as Me } from "./xlsx-DKPe4AfX.js";
24
+ import { a as Ie, C as Ue } from "./export-Cr4mjkQZ.js";
25
+ import { u as Ae, _ as Be } from "./usePagination-a1XSuIrr.js";
26
+ import { u as De } from "./vue-i18n-CzEcAXx-.js";
27
+ import "./index-CuHNDW6e.js";
28
+ import { useRouter as Re } from "vue-router";
29
+ import { o as Ne } from "./objectId-dwaoBfJX.js";
30
+ const Pe = { class: "space-y-16" }, qe = { class: "gap-16 grid grid-cols-2" }, ze = { class: "space-y-16" }, Ee = {
31
+ key: 0,
32
+ class: "flex flex-col gap-[16px] w-full"
33
+ }, Te = { class: "flex flex-col gap-[8px]" }, je = ["src"], Oe = { class: "flex pt-[24px] gap-[24px]" }, Le = ["src", "onClick", "alt"], Ye = { class: "flex items-center gap-8" }, Ge = /* @__PURE__ */ te({
34
+ __name: "CreateCardSheet",
35
+ emits: ["success", "export"],
36
+ setup(ne, { expose: L, emit: Y }) {
37
+ const { minor: V } = ae, C = oe(), A = x(), w = x(!1), B = Y, m = x(!1);
38
+ function D(f) {
39
+ m.value = f, f && (n.value = {
40
+ quantity: 1,
41
+ code: "",
42
+ codeConfig: {
43
+ length: 16,
44
+ charset: "1234567890",
45
+ prefix: "",
46
+ suffix: "",
47
+ pattern: "####-####-####-####"
48
+ }
49
+ });
50
+ }
51
+ const n = x({
52
+ quantity: 1,
53
+ code: "",
54
+ codeConfig: {
55
+ length: 16,
56
+ charset: "1234567890",
57
+ prefix: "",
58
+ suffix: "",
59
+ pattern: "####-####-####-####"
60
+ },
61
+ setCardOnBind: !1,
62
+ bundle: void 0
63
+ }), S = [
64
+ {
65
+ label: "Bulk number",
66
+ value: "bulk",
67
+ sublabel: "Bulk generate unique number"
68
+ },
69
+ {
70
+ label: "Custom number",
71
+ value: "single",
72
+ sublabel: "Enter your own custom number"
73
+ }
74
+ ], N = [
75
+ {
76
+ label: "Alphanumeric",
77
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
78
+ },
79
+ {
80
+ label: "Alphabetic",
81
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
82
+ },
83
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
84
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
85
+ { label: "Numbers", value: "0123456789" },
86
+ { label: "Custom", value: "" }
87
+ ], I = x(N[0].value), k = x("bulk"), s = x(0), i = z(
88
+ () => {
89
+ var f;
90
+ return (f = C.membership.design) == null ? void 0 : f[s.value];
91
+ }
92
+ ), p = x(!1), r = z(
93
+ () => C.sortedStoreCategories.flatMap((f) => f.bundles)
94
+ );
95
+ async function b(f) {
96
+ var _, R;
97
+ if (await ((_ = A.value) == null ? void 0 : _.validateInputs()), !w.value) return;
98
+ f.design = (R = i.value) == null ? void 0 : R.image;
99
+ const t = await be.confirm(
100
+ "",
101
+ "Do you want to export generated card(s)?",
102
+ "Export",
103
+ "Generate and without export"
104
+ );
105
+ console.log(t), await V(
106
+ async () => {
107
+ const P = await H.createCards(f);
108
+ console.log(P), await B("success"), t && await B("export", P);
109
+ },
110
+ {
111
+ message: "Creating card(s)",
112
+ successMessage: "Card(s) created"
113
+ }
114
+ );
115
+ }
116
+ return L({
117
+ showSheet: D
118
+ }), ie(
119
+ () => n.value.codeConfig.length,
120
+ (f, t) => {
121
+ f != t && (n.value.codeConfig.pattern = "#".repeat(Number(f)));
122
+ }
123
+ ), ie(
124
+ () => n.value.codeConfig.pattern,
125
+ (f, t) => {
126
+ f != t && (n.value.codeConfig.length = (n.value.codeConfig.pattern.match(/#/g) || []).length);
127
+ }
128
+ ), le(async () => {
129
+ await C.readMemberStore();
130
+ }), (f, t) => {
131
+ const _ = v("FmRadio"), R = v("FmRadioGroup"), P = v("FmSwitch"), y = v("FmStepperField"), T = v("FmSelect"), j = v("FmTextField"), o = v("FmTextarea"), l = v("FmButton"), q = v("FmForm"), K = v("FmSideSheet");
132
+ return c(), F(K, {
133
+ "max-width": 560,
134
+ "dismiss-away": !0,
135
+ header: "Create collection",
136
+ modelValue: e(m),
137
+ "onUpdate:modelValue": [
138
+ t[19] || (t[19] = (U) => W(m) ? m.value = U : null),
139
+ t[20] || (t[20] = (U) => m.value = U)
140
+ ]
141
+ }, {
142
+ "side-sheet-footer": h(() => [
143
+ d("div", Ye, [
144
+ u(l, {
145
+ label: "Save",
146
+ onClick: t[17] || (t[17] = (U) => b(e(n))),
147
+ loading: e(ge)().isLoading
148
+ }, null, 8, ["loading"]),
149
+ u(l, {
150
+ label: "Cancel",
151
+ type: "button",
152
+ variant: "tertiary",
153
+ onClick: t[18] || (t[18] = (U) => m.value = !1)
154
+ })
155
+ ])
156
+ ]),
157
+ default: h(() => [
158
+ u(q, {
159
+ ref_key: "form",
160
+ ref: A,
161
+ class: "space-y-40",
162
+ onValidationSuccess: t[15] || (t[15] = (U) => w.value = !0),
163
+ onValidationFailed: t[16] || (t[16] = (U) => w.value = !1)
164
+ }, {
165
+ default: h(() => {
166
+ var U, Q, X;
167
+ return [
168
+ d("div", null, [
169
+ t[21] || (t[21] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
170
+ u(R, {
171
+ modelValue: e(k),
172
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => W(k) ? k.value = a : null),
173
+ inline: !1
174
+ }, {
175
+ default: h(() => [
176
+ (c(), M(E, null, Z(S, (a) => u(_, {
177
+ key: a.value,
178
+ value: a.value,
179
+ label: a.label,
180
+ sublabel: a.sublabel
181
+ }, null, 8, ["value", "label", "sublabel"])), 64))
182
+ ]),
183
+ _: 1
184
+ }, 8, ["modelValue"])
185
+ ]),
186
+ d("div", Pe, [
187
+ t[22] || (t[22] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
188
+ e(k) === "bulk" ? (c(), M(E, { key: 0 }, [
189
+ u(P, {
190
+ "model-value": e(p),
191
+ "label-placement": "right",
192
+ value: "true",
193
+ label: "Advance number setting",
194
+ required: !0,
195
+ "onUpdate:modelValue": t[1] || (t[1] = () => p.value = !e(p))
196
+ }, null, 8, ["model-value"]),
197
+ e(p) ? (c(), M(E, { key: 0 }, [
198
+ u(y, {
199
+ "model-value": e(n).codeConfig.length || null,
200
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => e(n).codeConfig.length = a),
201
+ label: "Code length",
202
+ rules: [(a) => Number(a) >= 1 || "Code length must at least 1"],
203
+ required: !0
204
+ }, null, 8, ["model-value", "rules"]),
205
+ u(T, {
206
+ label: "Charset",
207
+ "model-value": e(I),
208
+ items: N,
209
+ "helper-text": e(n).codeConfig.charset.length > 62 ? `${e(n).codeConfig.charset.substring(0, 62)}...` : e(n).codeConfig.charset,
210
+ "onUpdate:modelValue": t[3] || (t[3] = (a) => {
211
+ I.value = a, e(n).codeConfig.charset = a;
212
+ })
213
+ }, null, 8, ["model-value", "helper-text"]),
214
+ e(I) === "" ? (c(), F(j, {
215
+ key: 0,
216
+ modelValue: e(n).codeConfig.charset,
217
+ "onUpdate:modelValue": t[4] || (t[4] = (a) => e(n).codeConfig.charset = a),
218
+ label: "Custom Charset",
219
+ required: ""
220
+ }, null, 8, ["modelValue"])) : $("", !0),
221
+ d("div", qe, [
222
+ u(j, {
223
+ modelValue: e(n).codeConfig.prefix,
224
+ "onUpdate:modelValue": t[5] || (t[5] = (a) => e(n).codeConfig.prefix = a),
225
+ label: "Prefix (Optional)"
226
+ }, null, 8, ["modelValue"]),
227
+ u(j, {
228
+ modelValue: e(n).codeConfig.suffix,
229
+ "onUpdate:modelValue": t[6] || (t[6] = (a) => e(n).codeConfig.suffix = a),
230
+ label: "Suffix (Optional)"
231
+ }, null, 8, ["modelValue"])
232
+ ]),
233
+ u(j, {
234
+ modelValue: e(n).codeConfig.pattern,
235
+ "onUpdate:modelValue": t[7] || (t[7] = (a) => e(n).codeConfig.pattern = a),
236
+ label: "Pattern",
237
+ required: !0
238
+ }, null, 8, ["modelValue"])
239
+ ], 64)) : $("", !0),
240
+ u(j, {
241
+ modelValue: e(n).quantity,
242
+ "onUpdate:modelValue": t[8] || (t[8] = (a) => e(n).quantity = a),
243
+ label: "Number of code",
244
+ rules: [
245
+ (a) => a >= 1 || "Quantity cannot be less than 1",
246
+ (a) => a <= 1e4 || "Quantity cannot more than 10,000"
247
+ ],
248
+ required: !0,
249
+ "helper-text": `${e(n).quantity} card will be created`
250
+ }, null, 8, ["modelValue", "rules", "helper-text"])
251
+ ], 64)) : $("", !0),
252
+ e(k) !== "bulk" ? (c(), F(o, {
253
+ key: 1,
254
+ modelValue: e(n).code,
255
+ "onUpdate:modelValue": t[9] || (t[9] = (a) => e(n).code = a),
256
+ label: "Custom Card Number",
257
+ rules: [(a) => e(k) != "single" || !!a || "Custom code is required"],
258
+ placeholder: "(For multiple numbers, please enter in the new row.)"
259
+ }, null, 8, ["modelValue", "rules"])) : $("", !0)
260
+ ]),
261
+ d("div", ze, [
262
+ t[23] || (t[23] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
263
+ u(P, {
264
+ "label-placement": "right",
265
+ label: "Set card number on bind",
266
+ sublabel: "Automatically set the card number when the user binds the card",
267
+ "model-value": e(n).setCardOnBind || !1,
268
+ "onUpdate:modelValue": t[10] || (t[10] = (a) => e(n).setCardOnBind = a)
269
+ }, null, 8, ["model-value"]),
270
+ u(ee, {
271
+ label: "Activate bundle on bind",
272
+ placeholder: "Select bundle",
273
+ items: e(r).filter((a) => !a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
274
+ modelValue: e(n).bundle,
275
+ "onUpdate:modelValue": t[12] || (t[12] = (a) => e(n).bundle = a)
276
+ }, {
277
+ append: h(() => [
278
+ e(n).bundle ? (c(), F(l, {
279
+ key: 0,
280
+ icon: "link_off",
281
+ variant: "plain",
282
+ onClick: t[11] || (t[11] = (a) => e(n).bundle = void 0)
283
+ })) : $("", !0)
284
+ ]),
285
+ _: 1
286
+ }, 8, ["items", "modelValue"]),
287
+ (Q = (U = e(C).store) == null ? void 0 : U.stripe) != null && Q.apiKey ? (c(), F(ee, {
288
+ key: 0,
289
+ label: "Linked subscription bundle",
290
+ placeholder: "Select bundle",
291
+ items: e(r).filter((a) => a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
292
+ modelValue: e(n).subscriptionBundle,
293
+ "onUpdate:modelValue": t[14] || (t[14] = (a) => e(n).subscriptionBundle = a)
294
+ }, {
295
+ append: h(() => [
296
+ e(n).subscriptionBundle ? (c(), F(l, {
297
+ key: 0,
298
+ icon: "link_off",
299
+ variant: "plain",
300
+ onClick: t[13] || (t[13] = (a) => e(n).subscriptionBundle = void 0)
301
+ })) : $("", !0)
302
+ ]),
303
+ _: 1
304
+ }, 8, ["items", "modelValue"])) : $("", !0)
305
+ ]),
306
+ e(C).membership.design ? (c(), M("div", Ee, [
307
+ d("div", Te, [
308
+ t[24] || (t[24] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
309
+ d("img", {
310
+ src: (X = e(i)) == null ? void 0 : X.image,
311
+ class: "aspect-[16/9]"
312
+ }, null, 8, je),
313
+ d("div", Oe, [
314
+ (c(!0), M(E, null, Z(e(C).membership.design, (a, g) => (c(), M("img", {
315
+ src: a.image,
316
+ key: `image_${g}`,
317
+ class: fe(["w-[112px] h-[63px] cursor-pointer", `${e(s) === g ? "border-[2px] border-fm-color-primary" : ""}`]),
318
+ onClick: (G) => s.value = g,
319
+ alt: `ai_image_predict_${g}`,
320
+ style: { objectFit: "cover" }
321
+ }, null, 10, Le))), 128))
322
+ ])
323
+ ])
324
+ ])) : $("", !0)
325
+ ];
326
+ }),
327
+ _: 1
328
+ }, 512)
329
+ ]),
330
+ _: 1
331
+ }, 8, ["modelValue"]);
332
+ };
333
+ }
334
+ }), He = { class: "space-y-16" }, Ke = {
335
+ key: 0,
336
+ class: "flex flex-col gap-[16px] w-full"
337
+ }, Qe = { class: "flex flex-col gap-[8px]" }, Ze = ["src"], Xe = { class: "flex pt-[24px] gap-[24px]" }, Je = ["src", "onClick", "alt"], We = { class: "flex items-center gap-8" }, et = /* @__PURE__ */ te({
338
+ __name: "EditCardSheet",
339
+ emits: ["success"],
340
+ setup(ne, { expose: L, emit: Y }) {
341
+ const { minor: V } = ae, C = oe(), A = x(), w = x(!1), B = Y, m = x({
342
+ _id: "",
343
+ business: "",
344
+ serialNumber: ""
345
+ }), D = x(!1);
346
+ function n(s, i) {
347
+ var p;
348
+ D.value = s, s && i && (m.value = i, S.value = (p = C.membership.design) == null ? void 0 : p.findIndex(
349
+ (r) => r.image === i.design
350
+ ));
351
+ }
352
+ const S = x(0), N = z(
353
+ () => {
354
+ var s;
355
+ return (s = C.membership.design) == null ? void 0 : s[S.value];
356
+ }
357
+ ), I = z(
358
+ () => C.sortedStoreCategories.flatMap(
359
+ (s) => s.bundles
360
+ )
361
+ );
362
+ async function k(s) {
363
+ var i, p;
364
+ await ((i = A.value) == null ? void 0 : i.validateInputs()), w.value && (s.design = (p = N.value) == null ? void 0 : p.image, await V(
365
+ async () => {
366
+ await H.updateCard(s), await B("success");
367
+ },
368
+ {
369
+ message: "Updating card",
370
+ successMessage: "Card updated"
371
+ }
372
+ ));
373
+ }
374
+ return L({
375
+ showSheet: n
376
+ }), le(async () => {
377
+ await C.readMemberStore();
378
+ }), (s, i) => {
379
+ const p = v("FmTextField"), r = v("FmSwitch"), b = v("FmButton"), f = v("FmForm"), t = v("FmSideSheet");
380
+ return c(), F(t, {
381
+ "max-width": 560,
382
+ "dismiss-away": !0,
383
+ header: "Edit card",
384
+ modelValue: e(D),
385
+ "onUpdate:modelValue": [
386
+ i[10] || (i[10] = (_) => W(D) ? D.value = _ : null),
387
+ i[11] || (i[11] = (_) => D.value = _)
388
+ ]
389
+ }, {
390
+ "side-sheet-footer": h(() => [
391
+ d("div", We, [
392
+ u(b, {
393
+ label: "Save",
394
+ disabled: !!e(m).redeemedAt,
395
+ onClick: i[8] || (i[8] = (_) => k(e(m))),
396
+ loading: e(ge)().isLoading
397
+ }, null, 8, ["disabled", "loading"]),
398
+ u(b, {
399
+ label: "Cancel",
400
+ type: "button",
401
+ variant: "tertiary",
402
+ onClick: i[9] || (i[9] = (_) => D.value = !1)
403
+ })
404
+ ])
405
+ ]),
406
+ default: h(() => [
407
+ u(f, {
408
+ ref_key: "form",
409
+ ref: A,
410
+ class: "space-y-40",
411
+ onValidationSuccess: i[6] || (i[6] = (_) => w.value = !0),
412
+ onValidationFailed: i[7] || (i[7] = (_) => w.value = !1)
413
+ }, {
414
+ default: h(() => {
415
+ var _, R, P;
416
+ return [
417
+ d("div", He, [
418
+ u(p, {
419
+ modelValue: e(m).serialNumber,
420
+ "onUpdate:modelValue": i[0] || (i[0] = (y) => e(m).serialNumber = y),
421
+ label: "Card Number",
422
+ rules: [
423
+ e(ce).toRule(e(me).string().min(1, "Card number is required")),
424
+ e(ce).toRule(
425
+ e(me).string().max(50, "Card number must be less than 50 characters")
426
+ )
427
+ ],
428
+ required: !0
429
+ }, null, 8, ["modelValue", "rules"]),
430
+ i[12] || (i[12] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
431
+ u(r, {
432
+ "label-placement": "right",
433
+ label: "Set card number on bind",
434
+ "model-value": e(m).setCardOnBind || !1,
435
+ "onUpdate:modelValue": i[1] || (i[1] = (y) => e(m).setCardOnBind = y)
436
+ }, null, 8, ["model-value"]),
437
+ u(ee, {
438
+ label: "Activate bundle on bind",
439
+ placeholder: "Select bundle",
440
+ items: e(I).filter((y) => !y.stripePriceId).map((y) => ({ label: y.name, value: y._id })),
441
+ modelValue: e(m).bundle,
442
+ "onUpdate:modelValue": i[3] || (i[3] = (y) => e(m).bundle = y)
443
+ }, {
444
+ append: h(() => [
445
+ e(m).bundle ? (c(), F(b, {
446
+ key: 0,
447
+ icon: "link_off",
448
+ variant: "plain",
449
+ onClick: i[2] || (i[2] = (y) => e(m).bundle = null)
450
+ })) : $("", !0)
451
+ ]),
452
+ _: 1
453
+ }, 8, ["items", "modelValue"]),
454
+ (R = (_ = e(C).store) == null ? void 0 : _.stripe) != null && R.apiKey ? (c(), F(ee, {
455
+ key: 0,
456
+ label: "Linked subscription bundle",
457
+ placeholder: "Select bundle",
458
+ items: e(I).filter((y) => y.stripePriceId).map((y) => ({ label: y.name, value: y._id })),
459
+ modelValue: e(m).subscriptionBundle,
460
+ "onUpdate:modelValue": i[5] || (i[5] = (y) => e(m).subscriptionBundle = y)
461
+ }, {
462
+ append: h(() => [
463
+ e(m).subscriptionBundle ? (c(), F(b, {
464
+ key: 0,
465
+ icon: "link_off",
466
+ variant: "plain",
467
+ onClick: i[4] || (i[4] = (y) => e(m).subscriptionBundle = null)
468
+ })) : $("", !0)
469
+ ]),
470
+ _: 1
471
+ }, 8, ["items", "modelValue"])) : $("", !0)
472
+ ]),
473
+ e(C).membership.design ? (c(), M("div", Ke, [
474
+ d("div", Qe, [
475
+ i[13] || (i[13] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
476
+ d("img", {
477
+ src: (P = e(N)) == null ? void 0 : P.image,
478
+ class: "aspect-[16/9]"
479
+ }, null, 8, Ze),
480
+ d("div", Xe, [
481
+ (c(!0), M(E, null, Z(e(C).membership.design, (y, T) => (c(), M("img", {
482
+ src: y.image,
483
+ key: `image_${T}`,
484
+ class: fe(["w-[112px] h-[63px] cursor-pointer", `${e(S) === T ? "border-[2px] border-fm-color-primary" : ""}`]),
485
+ onClick: (j) => S.value = T,
486
+ alt: `ai_image_predict_${T}`,
487
+ style: { objectFit: "cover" }
488
+ }, null, 10, Je))), 128))
489
+ ])
490
+ ])
491
+ ])) : $("", !0)
492
+ ];
493
+ }),
494
+ _: 1
495
+ }, 512)
496
+ ]),
497
+ _: 1
498
+ }, 8, ["modelValue"]);
499
+ };
500
+ }
501
+ }), tt = {
502
+ key: 0,
503
+ class: "grid grid-cols-1 gap-8"
504
+ }, lt = { class: "flex items-center gap-8" }, at = { class: "flex items-center gap-8" }, ot = 5, nt = /* @__PURE__ */ te({
505
+ __name: "CardDesignSheet",
506
+ emits: ["success"],
507
+ setup(ne, { expose: L, emit: Y }) {
508
+ const { minor: V } = ae, C = oe(), A = _e(), w = x(!1);
509
+ x(), x(!1);
510
+ const B = x(), m = x(null);
511
+ z(() => {
512
+ var p, r;
513
+ return Math.min((((r = (p = B.value) == null ? void 0 : p.design) == null ? void 0 : r.length) ?? 0) + 1, ot);
514
+ });
515
+ const D = Y, n = z(() => {
516
+ var p, r;
517
+ return ((r = (p = C.membership) == null ? void 0 : p.design) == null ? void 0 : r.filter((b) => b.image)) || [];
518
+ }), S = x(!1);
519
+ function N(p) {
520
+ S.value = p;
521
+ }
522
+ function I() {
523
+ w.value = !0;
524
+ }
525
+ async function k() {
526
+ await V(
527
+ async () => {
528
+ var b;
529
+ const p = Fe(B.value), r = we.parse(p);
530
+ if (r.design = (r == null ? void 0 : r.design) || [], m.value) {
531
+ const f = ke().toHexString(), t = await ue.update(
532
+ ue.designPath(f, m.value),
533
+ m.value
534
+ );
535
+ (b = r.design) == null || b.push({
536
+ _id: f,
537
+ image: t
538
+ });
539
+ }
540
+ await H.update(r), await i(), await D("success"), m.value = null, w.value = !1;
541
+ },
542
+ {
543
+ message: "Saving card design",
544
+ successMessage: "Card design saved"
545
+ }
546
+ );
547
+ }
548
+ async function s(p, r) {
549
+ p ? m.value = p : r && A.open({
550
+ title: "Delete Design",
551
+ message: "Are you sure you want to delete this design?",
552
+ primaryActions: { text: "Delete", close: !0 },
553
+ secondaryActions: { text: "Cancel", close: !1 }
554
+ }).onPrimary(async () => {
555
+ var f, t;
556
+ const b = (f = B.value.design) == null ? void 0 : f.findIndex((_) => _._id == r);
557
+ console.log(b), b !== -1 && ((t = B.value.design) == null || t.splice(b, 1)), await k();
558
+ }).onSecondary(() => {
559
+ A.close();
560
+ });
561
+ }
562
+ async function i() {
563
+ await C.readMembership(), B.value = C.membership;
564
+ }
565
+ return L({
566
+ showSheet: N
567
+ }), le(async () => {
568
+ await i(), n.value.length || (w.value = !0);
569
+ }), (p, r) => {
570
+ const b = v("FmButton"), f = v("FmSideSheet");
571
+ return c(), F(f, {
572
+ "max-width": 560,
573
+ "dismiss-away": !0,
574
+ header: "Manage Design",
575
+ modelValue: e(S),
576
+ "onUpdate:modelValue": [
577
+ r[2] || (r[2] = (t) => W(S) ? S.value = t : null),
578
+ r[3] || (r[3] = (t) => S.value = t)
579
+ ]
580
+ }, ye({
581
+ default: h(() => [
582
+ e(w) ? $("", !0) : (c(), M("div", tt, [
583
+ (c(!0), M(E, null, Z(e(n), (t) => (c(), F(pe, {
584
+ key: String(t._id),
585
+ "image-fit": "cover",
586
+ label: "",
587
+ "aspect-ratio": "16/9",
588
+ thumbnail: t.image,
589
+ accept: ".png, .jpg, .jpeg, .gif",
590
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
591
+ file: void 0,
592
+ "delete-button": !1
593
+ }, {
594
+ "delete-button": h(() => [
595
+ u(b, {
596
+ class: "!text-neutral-50 !bg-neutral-700",
597
+ icon: "delete",
598
+ variant: "tertiary",
599
+ onClick: (_) => s(null, t._id)
600
+ }, null, 8, ["onClick"])
601
+ ]),
602
+ _: 2
603
+ }, 1032, ["thumbnail"]))), 128))
604
+ ])),
605
+ e(w) ? (c(), F(pe, {
606
+ key: 1,
607
+ "image-fit": "cover",
608
+ label: "",
609
+ "aspect-ratio": "16/9",
610
+ accept: ".png, .jpg, .jpeg, .gif",
611
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
612
+ "onUpdate:file": s
613
+ })) : $("", !0)
614
+ ]),
615
+ _: 2
616
+ }, [
617
+ e(w) ? {
618
+ name: "side-sheet-footer",
619
+ fn: h(() => [
620
+ d("div", at, [
621
+ u(b, {
622
+ label: "Save",
623
+ onClick: k,
624
+ disabled: !e(m)
625
+ }, null, 8, ["disabled"]),
626
+ u(b, {
627
+ label: "Cancel",
628
+ type: "button",
629
+ variant: "tertiary",
630
+ onClick: r[1] || (r[1] = (t) => w.value = !1)
631
+ })
632
+ ])
633
+ ]),
634
+ key: "1"
635
+ } : {
636
+ name: "side-sheet-footer",
637
+ fn: h(() => [
638
+ d("div", lt, [
639
+ u(b, {
640
+ label: "Add Design",
641
+ onClick: I
642
+ }),
643
+ u(b, {
644
+ label: "Cancel",
645
+ type: "button",
646
+ variant: "tertiary",
647
+ onClick: r[0] || (r[0] = (t) => S.value = !1)
648
+ })
649
+ ])
650
+ ]),
651
+ key: "0"
652
+ }
653
+ ]), 1032, ["modelValue"]);
654
+ };
655
+ }
656
+ }), st = { class: "flex items-center" }, it = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, rt = { class: "px-24 flex flex-col pb-24 gap-y-16" }, dt = { class: "flex items-center gap-8 flex-wrap pt-8" }, ut = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, mt = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-16" }, ct = { class: "fm-typo-en-body-md-500 text-fm-color-typo-secondary" }, pt = { class: "fm-typo-en-title-md-800 text-fm-color-typo-primary" }, ft = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, gt = { class: "flex items-center justify-end" }, bt = { class: "flex flex-col gap-16 text-center" }, yt = { class: "fm-typo-en-title-sm-800" }, vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, xt = { class: "flex gap-x-8" }, Qt = /* @__PURE__ */ te({
657
+ __name: "Card",
658
+ setup(ne) {
659
+ const L = Re();
660
+ function Y() {
661
+ L.push({ name: he["$connect-STORE"] });
662
+ }
663
+ const V = x(), C = z(() => {
664
+ if (!V.value) return null;
665
+ const o = V.value.totalIssued;
666
+ return o ? Math.round(V.value.claimed / o * 100) : 0;
667
+ });
668
+ function A(o) {
669
+ return o === void 0 ? "—" : String(o);
670
+ }
671
+ const w = z(() => {
672
+ var o, l, q;
673
+ return [
674
+ {
675
+ key: "totalIssued",
676
+ title: s("connect.loyalty.card.stats.totalIssued"),
677
+ value: A((o = V.value) == null ? void 0 : o.totalIssued),
678
+ description: s("connect.loyalty.card.stats.totalIssuedHint")
679
+ },
680
+ {
681
+ key: "claimed",
682
+ title: s("connect.loyalty.card.stats.claimed"),
683
+ value: A((l = V.value) == null ? void 0 : l.claimed),
684
+ description: C.value === null ? "" : s("connect.loyalty.card.stats.claimedHint", {
685
+ rate: C.value
686
+ })
687
+ },
688
+ {
689
+ key: "unclaimed",
690
+ title: s("connect.loyalty.card.stats.unclaimed"),
691
+ value: A((q = V.value) == null ? void 0 : q.unclaimed),
692
+ description: s("connect.loyalty.card.stats.unclaimedHint")
693
+ }
694
+ ];
695
+ });
696
+ async function B() {
697
+ try {
698
+ V.value = await H.readCardStats();
699
+ } catch (o) {
700
+ V.value = void 0, console.error("Failed to load card stats", o);
701
+ }
702
+ }
703
+ const { minor: m, global: D } = ae, n = x(), S = x(), N = x(), I = $e(), k = oe(), { t: s } = De(), i = z(
704
+ () => k.sortedStoreCategories.flatMap((o) => o.bundles)
705
+ ), p = [
706
+ {
707
+ header: s("connect.loyalty.card.table.type"),
708
+ accessorFn: (o) => o.giftCard ? s("connect.loyalty.card.table.typeGiftCard") : s("connect.loyalty.card.table.typeRedemption")
709
+ },
710
+ {
711
+ header: s("connect.loyalty.card.table.card_number"),
712
+ accessorFn: (o) => o.serialNumber
713
+ },
714
+ {
715
+ header: s("connect.loyalty.card.table.redeemed_by"),
716
+ accessorKey: "user",
717
+ enableSorting: !1,
718
+ cell(o) {
719
+ const l = o.row.original.pf_member;
720
+ return J(
721
+ "div",
722
+ {
723
+ class: "flex items-center gap-x-8"
724
+ },
725
+ [
726
+ J(de.FmAvatar, {
727
+ name: l != null && l.photoUrl || l == null ? void 0 : l.name,
728
+ src: (l == null ? void 0 : l.photoUrl) ?? void 0,
729
+ size: "sm"
730
+ }),
731
+ J("span", { class: "fm-typo-en-body-sm-400" }, l == null ? void 0 : l.name)
732
+ ]
733
+ );
734
+ }
735
+ },
736
+ {
737
+ header: s("connect.loyalty.card.table.phone"),
738
+ accessorFn: (o) => {
739
+ var l;
740
+ return ((l = o.pf_member) == null ? void 0 : l.phoneNumber) || "-";
741
+ },
742
+ accessorKey: "pf_member.phoneNumber"
743
+ },
744
+ {
745
+ header: s("connect.loyalty.card.table.created_at"),
746
+ accessorKey: "_id",
747
+ accessorFn: (o) => re(Ne(o._id.toString())).format("DD MMM YYYY hh:mmA")
748
+ },
749
+ {
750
+ header: s("connect.loyalty.card.table.bundle"),
751
+ // A gift card carries its value on itself rather than pointing at a bundle in
752
+ // Store.categories, so fall back to its program name and amount.
753
+ accessorFn: (o) => {
754
+ var l;
755
+ return o.giftCard ? `${o.giftCard.programName} · RM${o.giftCard.amount}` : ((l = i.value.find((q) => q._id === o.bundle)) == null ? void 0 : l.name) || "-";
756
+ }
757
+ },
758
+ {
759
+ header: s("connect.loyalty.card.table.redeemed_at"),
760
+ accessorKey: "redeemedAt",
761
+ accessorFn: (o) => o.redeemedAt ? re(o.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
762
+ },
763
+ {
764
+ header: s("connect.loyalty.card.table.actions"),
765
+ cell(o) {
766
+ return J(de.FmButton, {
767
+ variant: "tertiary",
768
+ icon: "delete",
769
+ iconColor: "neutral-gray-400",
770
+ disabled: !!o.row.original.redeemedAt || !!o.row.original.giftCard,
771
+ onClick: (l) => {
772
+ l.stopPropagation(), y(o.row.original);
773
+ }
774
+ });
775
+ }
776
+ }
777
+ ], { tableMeta: r, rowData: b, onSort: f, debouncedFetchData: t, onSearch: _ } = Ae(H.readCards);
778
+ async function R(o) {
779
+ var l;
780
+ await Promise.all([B(), t(o)]), (l = n.value) == null || l.showSheet(!1);
781
+ }
782
+ const P = z(() => I.isPremium ? [
783
+ {
784
+ label: s("connect.loyalty.card.actions.create"),
785
+ value: "create",
786
+ isPrimary: !0
787
+ },
788
+ {
789
+ label: s("connect.loyalty.card.actions.manage_design"),
790
+ value: "design",
791
+ isPrimary: !0
792
+ }
793
+ ] : []);
794
+ async function y(o) {
795
+ await be.remove(
796
+ `Are you sure you want to remove card ${o.serialNumber}?`
797
+ ) && await m(
798
+ async () => {
799
+ await H.deleteCard(o._id.toString()), await t({ pageSize: 10, pageIndex: 0 });
800
+ },
801
+ {
802
+ message: `Removing card ${o.serialNumber}`,
803
+ successMessage: `Removed card ${o.serialNumber} successfully`
804
+ }
805
+ );
806
+ }
807
+ async function T(o) {
808
+ if (!o || o.length === 0)
809
+ return;
810
+ const l = new Ue(), q = o.map((K) => ({
811
+ CardNumber: K
812
+ }));
813
+ l.addRecords(q), await Me(
814
+ l.buildExcel(),
815
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
816
+ {
817
+ bookType: "xlsx",
818
+ bookSST: !1,
819
+ type: "array"
820
+ }
821
+ );
822
+ }
823
+ const j = (o) => {
824
+ var l;
825
+ if (o.redeemedAt || o.giftCard) {
826
+ Se.error("Update not permitted", 2e3);
827
+ return;
828
+ }
829
+ (l = S == null ? void 0 : S.value) == null || l.showSheet(!0, o);
830
+ };
831
+ return le(async () => {
832
+ await D(async () => {
833
+ await I.readPremium(), await k.readMemberStore(), await k.readMembership(), await R();
834
+ });
835
+ }), (o, l) => {
836
+ const q = v("FmPill"), K = v("FmPageHead"), U = v("FmIcon"), Q = v("FmCard"), X = v("FmSearch"), a = v("FmButton");
837
+ return c(), M(E, null, [
838
+ u(K, {
839
+ title: e(s)("connect.loyalty.card.title"),
840
+ actions: e(P),
841
+ "onClick:action": l[0] || (l[0] = (g) => {
842
+ var G, se;
843
+ console.log(g), g === "design" && ((G = e(N)) == null || G.showSheet(!0)), g === "create" && ((se = e(n)) == null || se.showSheet(!0));
844
+ })
845
+ }, {
846
+ title: h(() => [
847
+ d("div", st, [
848
+ d("span", it, O(e(s)("connect.loyalty.card.title")), 1),
849
+ u(q, {
850
+ class: "ml-8",
851
+ variant: "premium"
852
+ })
853
+ ])
854
+ ]),
855
+ _: 1
856
+ }, 8, ["title", "actions"]),
857
+ d("div", rt, [
858
+ d("div", dt, [
859
+ u(U, {
860
+ name: "info",
861
+ size: "sm",
862
+ class: "text-fm-color-primary flex-none"
863
+ }),
864
+ d("span", ut, O(e(s)("connect.loyalty.card.giftCardSignpost")), 1),
865
+ d("button", {
866
+ type: "button",
867
+ class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-primary",
868
+ onClick: Y
869
+ }, [
870
+ ve(O(e(s)("connect.loyalty.card.giftCardSignpostAction")) + " ", 1),
871
+ u(U, {
872
+ name: "arrow_forward",
873
+ size: "sm"
874
+ })
875
+ ])
876
+ ]),
877
+ d("div", mt, [
878
+ (c(!0), M(E, null, Z(e(w), (g) => (c(), F(Q, {
879
+ key: g.key,
880
+ variant: "outlined",
881
+ class: "flex flex-col gap-8 p-16"
882
+ }, {
883
+ default: h(() => [
884
+ d("div", ct, O(g.title), 1),
885
+ d("div", pt, O(g.value), 1),
886
+ d("div", ft, O(g.description), 1)
887
+ ]),
888
+ _: 2
889
+ }, 1024))), 128))
890
+ ]),
891
+ e(b).length > 0 || e(b).length <= 0 && e(r).searchValue || e(r).pageCount > 0 ? (c(), M(E, { key: 0 }, [
892
+ d("div", gt, [
893
+ u(X, {
894
+ class: "mt-4",
895
+ modelValue: e(r).searchValue,
896
+ "onUpdate:modelValue": [
897
+ l[1] || (l[1] = (g) => e(r).searchValue = g),
898
+ e(_)
899
+ ],
900
+ placeholder: "Search",
901
+ collapsible: ""
902
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
903
+ u(a, {
904
+ icon: "ios_share",
905
+ variant: "tertiary",
906
+ onClick: xe(e(Ie), ["prevent"])
907
+ }, null, 8, ["onClick"])
908
+ ]),
909
+ u(Be, {
910
+ loading: e(r).isLoading,
911
+ "row-data": e(b),
912
+ "row-count": e(r).totalRows,
913
+ "column-defs": p,
914
+ "shrink-at": !1,
915
+ "page-count": e(r).pageCount,
916
+ "page-index": e(r).pageIndex,
917
+ "page-size": e(r).pageSize,
918
+ onSortChange: e(f),
919
+ onPageChange: l[2] || (l[2] = (g) => {
920
+ e(t)({
921
+ pageSize: g.pageSize,
922
+ pageIndex: g.pageIndex
923
+ });
924
+ }),
925
+ onRowClick: l[3] || (l[3] = (g) => {
926
+ j(e(Ve)(g.original));
927
+ })
928
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
929
+ ], 64)) : (c(), F(Q, {
930
+ key: 1,
931
+ variant: "outlined",
932
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
933
+ }, {
934
+ default: h(() => [
935
+ l[8] || (l[8] = d("img", {
936
+ src: Ce,
937
+ class: "aspect-square w-[150px]"
938
+ }, null, -1)),
939
+ d("div", bt, [
940
+ d("div", yt, O(e(s)("connect.loyalty.card.empty_state.title")), 1),
941
+ d("div", vt, O(e(s)("connect.loyalty.card.empty_state.description")), 1)
942
+ ]),
943
+ d("div", xt, [
944
+ u(a, {
945
+ variant: "primary",
946
+ label: e(s)("connect.loyalty.card.actions.add"),
947
+ icon: "add",
948
+ disabled: !e(I).isPremium,
949
+ onClick: l[4] || (l[4] = () => {
950
+ var g;
951
+ return (g = e(n)) == null ? void 0 : g.showSheet(!0);
952
+ })
953
+ }, null, 8, ["label", "disabled"]),
954
+ u(a, {
955
+ variant: "secondary",
956
+ label: e(s)("connect.loyalty.card.actions.manage_design"),
957
+ disabled: !e(I).isPremium,
958
+ onClick: l[5] || (l[5] = () => {
959
+ var g;
960
+ return (g = e(N)) == null ? void 0 : g.showSheet(!0);
961
+ })
962
+ }, null, 8, ["label", "disabled"])
963
+ ])
964
+ ]),
965
+ _: 1
966
+ })),
967
+ u(Ge, {
968
+ ref_key: "sheetRef",
969
+ ref: n,
970
+ onSuccess: l[6] || (l[6] = (g) => R()),
971
+ onExport: T
972
+ }, null, 512),
973
+ u(nt, {
974
+ ref_key: "designSheetRef",
975
+ ref: N,
976
+ onSuccess: R
977
+ }, null, 512),
978
+ u(et, {
979
+ ref_key: "editSheetRef",
980
+ ref: S,
981
+ onSuccess: l[7] || (l[7] = (g) => {
982
+ var G;
983
+ R({
984
+ pageSize: e(r).pageSize,
985
+ pageIndex: e(r).pageIndex
986
+ }), (G = e(S)) == null || G.showSheet(!1);
987
+ })
988
+ }, null, 512)
989
+ ])
990
+ ], 64);
991
+ };
992
+ }
993
+ });
994
+ export {
995
+ Qt as default
996
+ };