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

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