@feedmepos/mf-connect 0.1.111-prod → 0.1.113-prod

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 (126) hide show
  1. package/dist/{App-D3pYl3WL.js → App-2J4yDonr.js} +83 -80
  2. package/dist/{Bin-DOZqpbYH.js → Bin-BU_hVuxJ.js} +8 -8
  3. package/dist/{Broadcast-DZ4SP99P.js → Broadcast-CoirZUyr.js} +11 -11
  4. package/dist/{CampaignAnalytic-cFKvCgxX.js → CampaignAnalytic-DUUmFMvy.js} +7 -7
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B0eVEubS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BZirReIy.js} +49 -32
  6. package/dist/Card-DS2K_LFv.js +1085 -0
  7. package/dist/{Collections-9QK5hbLo.js → Collections-BFdRdPHR.js} +9 -9
  8. package/dist/{Credit-8Ouy4O9a.js → Credit-CODfiox3.js} +11 -11
  9. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CJA-yunY.js → DateRangeChip.vue_vue_type_script_setup_true_lang-B2T5G1hZ.js} +1 -1
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYxswo-Z.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DyIOw_HH.js} +34 -33
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Dv0q3B8m.js → EffectSheet.vue_vue_type_style_index_0_lang-KvZebiOu.js} +6 -6
  12. package/dist/{Experience-DMh4hR1S.js → Experience-BGBWc8Ep.js} +12 -12
  13. package/dist/{FileSaver.min-Bx9mdUgJ.js → FileSaver.min-DJAN3Eu0.js} +1 -1
  14. package/dist/{Game-CL0TZvg1.js → Game-6yyn0uAd.js} +12 -12
  15. package/dist/GiftCardSetup-B096bTm0.js +748 -0
  16. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Bz5kIfoM.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-ChvUXdF-.js} +7 -7
  17. package/dist/{Goals-Dz5Vp-lj.js → Goals-Db2mwbRo.js} +4 -4
  18. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CaPDI3vY.js → ImageInput.vue_vue_type_script_setup_true_lang-xdEzwMcS.js} +1 -1
  19. package/dist/{Index-kH8aAegB.js → Index-580WNkG2.js} +10 -10
  20. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-CFrgC3Ka.js → LocationPicker.vue_vue_type_script_setup_true_lang-BkAQXKNJ.js} +1 -1
  21. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DPIFLdBc.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CR6sSnx4.js} +1 -1
  22. package/dist/{LoyaltyDashboard-BBxEoWol.js → LoyaltyDashboard-Clr2aiUP.js} +15 -15
  23. package/dist/{MainLayout-2BLwDyHQ.js → MainLayout-_iCyT5mw.js} +3 -3
  24. package/dist/{Marketing-C4OnSV-c.js → Marketing-fq1wxANq.js} +4 -4
  25. package/dist/{MarketingMaterialEdit-DFhpsI2-.js → MarketingMaterialEdit-0h7E0n5e.js} +6 -6
  26. package/dist/{Member-CT9WwxP0.js → Member-BfRy196y.js} +7 -7
  27. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-C7yznkUn.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-BAR44Qcp.js} +26 -25
  28. package/dist/{MemberImportHistory-B__BFID7.js → MemberImportHistory-C4622Ivs.js} +7 -7
  29. package/dist/{MemberList-DgLI4wty.js → MemberList-DqtsMN_N.js} +14 -14
  30. package/dist/{MemberTransactions-UFx_DZYe.js → MemberTransactions-DsUoFg3z.js} +1 -1
  31. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BFjZA8Y6.js → MessageInput.vue_vue_type_script_setup_true_lang-CzFMUgXM.js} +3369 -3290
  32. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Df9bxbUl.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CVQYcuQ6.js} +1 -1
  33. package/dist/{Mission-CawzGzDu.js → Mission-B0GO4LiM.js} +13 -13
  34. package/dist/{Overview-D19oSo24.js → Overview-CVITimwN.js} +57 -56
  35. package/dist/{Overview-CAtTlEVa.js → Overview-XpJJmHqs.js} +4 -4
  36. package/dist/{Point-BPAGmKAj.js → Point-B7aCrMkI.js} +13 -13
  37. package/dist/{Promotion-B0Uf9vjL.js → Promotion-DfVcuXHy.js} +13 -13
  38. package/dist/{Queue-CJEAFss_.js → Queue-BT7O2cvj.js} +20 -19
  39. package/dist/{Record-s6hSQG2P.js → Record-CAc030dz.js} +9 -9
  40. package/dist/{Review-DhNCbAOm.js → Review-CyXo4GTY.js} +2 -2
  41. package/dist/{ReviewFacebookCallback-DeZqcpJo.js → ReviewFacebookCallback--IcyheQA.js} +5 -5
  42. package/dist/{ReviewGoogleCallback-D8ENWii2.js → ReviewGoogleCallback-BxiFOl0B.js} +5 -5
  43. package/dist/{Reward-BT00QsXL.js → Reward-ChfNtdwX.js} +16 -16
  44. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DaZDGhbm.js → RewardGroup.vue_vue_type_script_setup_true_lang-CpQu_QBQ.js} +25 -24
  45. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BvxbKSkB.js → RuleGroup.vue_vue_type_script_setup_true_lang--5K-qagY.js} +17 -16
  46. package/dist/{Segment-BuGhX9zg.js → Segment-H2zBDZeh.js} +32 -31
  47. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DB718_4P.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-B0jCJ-Xq.js} +24 -23
  48. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CkgXxy0C.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-DW_ViNZM.js} +4 -4
  49. package/dist/{Setting-BOWPp05N.js → Setting-D4XOHSHT.js} +56 -56
  50. package/dist/{SettingAdvertisements-aqFErKAr.js → SettingAdvertisements-DPQHP3-B.js} +12 -12
  51. package/dist/{Settings-DekXvE-R.js → Settings-Dt_oLoGl.js} +5 -5
  52. package/dist/Store-B2f5HVQc.js +2622 -0
  53. package/dist/{StoreRewards-D2pTL2oA.js → StoreRewards-QxfaEt9f.js} +15 -15
  54. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Db2cd6ny.js +1264 -0
  55. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C-C3RSeW.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D9L-AayN.js} +2 -2
  56. package/dist/{Tier-OyE8oH2r.js → Tier-BSk4rBm8.js} +104 -103
  57. package/dist/{Title-DAl7CKL_.js → Title-CIzpB8TT.js} +34 -33
  58. package/dist/Transaction-BjxxNEHa.js +45 -0
  59. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C0yHxQVr.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BMutYxOU.js} +6 -6
  60. package/dist/{Voucher-D2QGWSxs.js → Voucher-B2lFq21Y.js} +18 -18
  61. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Bt2YB745.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BWV631It.js} +12 -12
  62. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BzCL64Jo.js → ZodTextField.vue_vue_type_script_setup_true_lang-BCoB0Fsa.js} +2 -2
  63. package/dist/{app-QxosLNkH.js → app-DgFVWdhA.js} +5693 -4883
  64. package/dist/app.js +1 -1
  65. package/dist/base.export-B6Rojjek.js +75 -0
  66. package/dist/{business-CbqG6NXr.js → business-C6ID0exl.js} +1 -1
  67. package/dist/{campaign-Rj7oDBnN.js → campaign-BgSJXWdU.js} +2 -2
  68. package/dist/{campaign-Co4Lq-Wz.js → campaign-DDfFBFye.js} +8 -8
  69. package/dist/{campaign.enum-B7vdNYKd.js → campaign.enum-CVvm0LMm.js} +1 -1
  70. package/dist/{campaign.fn-DolD3lYJ.js → campaign.fn-DRabv93K.js} +164 -164
  71. package/dist/{collectible.enum-BsQseg7-.js → collectible.enum-DGQVW464.js} +1 -1
  72. package/dist/{collection.fn-EbUIyB1X.js → collection.fn-dV4F8R-j.js} +2 -2
  73. package/dist/currency-DlHi_3WN.js +7 -0
  74. package/dist/{effect-B_91OlcX.js → effect-BJgmiWY4.js} +1 -1
  75. package/dist/{email-addresses-DXnYZG-e.js → email-addresses-3GTx_xTh.js} +2 -2
  76. package/dist/{helper-_uhiXya1.js → helper-BX0JQP06.js} +1 -1
  77. package/dist/{index-BWgc2-Qz.js → index-2xed2K8D.js} +1 -1
  78. package/dist/index-BHT6cvWA.js +738 -0
  79. package/dist/{index-CWUmrVo_.js → index-BIpAzktM.js} +795 -789
  80. package/dist/{index-DlQJZNwD.js → index-BeCKw7Y3.js} +4 -1
  81. package/dist/{index-xuFTeVrb.js → index-Bl5aHABH.js} +10 -9
  82. package/dist/{index-Cp7oHMm3.js → index-CNULhBPM.js} +17 -16
  83. package/dist/{index-DzBzClHP.js → index-CiFReW-F.js} +1 -1
  84. package/dist/{index-aCuOvuEC.js → index-CmhDYsk6.js} +20 -14
  85. package/dist/index-Cnw0B8Lc.js +53 -0
  86. package/dist/{index-Df4l6y-S.js → index-CtBLnWVG.js} +1805 -2128
  87. package/dist/{index-BZ2b0Pk6.js → index-DRNdJ_KC.js} +3 -3
  88. package/dist/{index-uuNGb1nv.js → index-DdMVrWZy.js} +4 -3
  89. package/dist/{index-CDm0BWa3.js → index-DeNbsrQx.js} +1 -1
  90. package/dist/{index-BBihP1s2.js → index-QaWLGgEC.js} +2 -2
  91. package/dist/{index-tbo0pMIu.js → index-R0qlOO6J.js} +1 -1
  92. package/dist/{index-CzYxnDWP.js → index-Y2Pu1YkB.js} +11 -6
  93. package/dist/{index-C_1iqF1Q.js → index-nmw7_9ZE.js} +1 -1
  94. package/dist/{index-DuhRCI0L.js → index-o2OQljHs.js} +1 -1
  95. package/dist/{index-DlGnYR5y.js → index-uXgPJlic.js} +3 -3
  96. package/dist/{index.esm2017-B72iWwk_.js → index.esm2017-Dum0onrS.js} +1 -1
  97. package/dist/{loading-rIhCiB_S.js → loading-B2mSdkfy.js} +1 -1
  98. package/dist/{lodash-B6fOjfjd.js → lodash-DtOypaKt.js} +1 -1
  99. package/dist/{member-import-CbHn7zss.js → member-import-C2pLnh44.js} +1 -1
  100. package/dist/{membership-DkJN7jyQ.js → membership-BWyBGF4n.js} +3 -3
  101. package/dist/{money-ChbDx6Nq.js → money-3lCCVCeP.js} +1 -1
  102. package/dist/{number-9TEd27Ku.js → number-zlqy2MLG.js} +1 -1
  103. package/dist/objectid-b2KGvMA7.js +145 -0
  104. package/dist/{onboarding-BN3MKVRs.js → onboarding-BqD3B4M1.js} +3 -3
  105. package/dist/{onboardingSetup-D9xhdgS3.js → onboardingSetup-CCQ90jg7.js} +2 -2
  106. package/dist/{plugins-CCibSJZa.js → plugins-Bj3npYnL.js} +3 -3
  107. package/dist/{reward-DjasF-NL.js → reward-5dDuZEb7.js} +1 -1
  108. package/dist/{rule-DqeChj0e.js → rule-NqLeSyoO.js} +3 -3
  109. package/dist/{rule-builder-DT854ycI.js → rule-builder-BzYwbbj4.js} +1 -1
  110. package/dist/{template-BeCVA0-N.js → template-fjUz6xrU.js} +7 -7
  111. package/dist/{timezone-D0nC1LDx.js → timezone-B0lkgvh-.js} +1 -1
  112. package/dist/{transaction.fn-BkF4Ad2z.js → transaction.fn-CACuVUBe.js} +2 -2
  113. package/dist/{trigger-CxpXoQJO.js → trigger-BKJwKTJx.js} +14 -14
  114. package/dist/{useMarketingMaterialActions-p0-fyMkm.js → useMarketingMaterialActions-DERvOmen.js} +3 -3
  115. package/dist/{usePagination-CrC-1v4L.js → usePagination-FkjroUq2.js} +1 -1
  116. package/dist/{user-CrylHgF1.js → user-H9MnsLbu.js} +1 -1
  117. package/dist/{vue-i18n-BjtkXdmG.js → vue-i18n-DbJO6sZW.js} +356 -356
  118. package/dist/{xlsx-CJNYF7-l.js → xlsx-BVmtIl_i.js} +166 -166
  119. package/dist/{zod-Dzn9S95S.js → zod-DI7OBdxu.js} +1 -1
  120. package/package.json +1 -1
  121. package/dist/Card-B5ni027Q.js +0 -911
  122. package/dist/Store-DpVlMuau.js +0 -1998
  123. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CNDv6eiZ.js +0 -1009
  124. package/dist/Transaction-mvKzTgLx.js +0 -39
  125. package/dist/export-D0hWZSfH.js +0 -97
  126. package/dist/objectid-CGol1NeA.js +0 -145
@@ -0,0 +1,1085 @@
1
+ import { defineComponent as oe, ref as y, computed as E, watch as ge, onMounted as ne, resolveComponent as b, openBlock as f, createBlock as I, unref as e, isRef as le, withCtx as w, createElementVNode as r, createVNode as d, createElementBlock as D, Fragment as O, renderList as J, createCommentVNode as N, normalizeClass as we, createSlots as Ie, h as be, toDisplayString as q, createTextVNode as Me, withModifiers as Be } from "vue";
2
+ import { _ as Ue } from "./campaign-CpzFl8Vr.js";
3
+ import { h as ye } from "./moment-D7p2TMB-.js";
4
+ import { useDialog as Ne, components as ve } from "@feedmepos/ui-library";
5
+ import "./index-DdMVrWZy.js";
6
+ import { u as se } from "./loading-B2mSdkfy.js";
7
+ import { u as Fe } from "./app-wDQR6dpb.js";
8
+ import { u as ie } from "./membership-BWyBGF4n.js";
9
+ import { _ as ae } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
10
+ import { p as ke, f as xe, n as De } from "./plugins-Bj3npYnL.js";
11
+ import { m as H } from "./index-BeCKw7Y3.js";
12
+ import { z as Ce, R as Re } from "./app-DgFVWdhA.js";
13
+ import { Z as _e } from "./zod-DI7OBdxu.js";
14
+ import { _ as he } from "./ImageInput.vue_vue_type_script_setup_true_lang-xdEzwMcS.js";
15
+ import "./index-CtBLnWVG.js";
16
+ import "./index-uXgPJlic.js";
17
+ import { b as Pe } from "./index-BHT6cvWA.js";
18
+ import "./index-CNULhBPM.js";
19
+ import "./index-DRNdJ_KC.js";
20
+ import "./index-2xed2K8D.js";
21
+ import { O as Le } from "./objectid-b2KGvMA7.js";
22
+ import { u as Ve } from "./vue-i18n-DbJO6sZW.js";
23
+ import { a as Te, c as Ee } from "./object-BYyQ0PZp.js";
24
+ import { u as ze } from "./business-C6ID0exl.js";
25
+ import { w as qe } from "./xlsx-BVmtIl_i.js";
26
+ import { B as Oe, e as je } from "./base.export-B6Rojjek.js";
27
+ import { u as Ye, _ as Ge } from "./usePagination-FkjroUq2.js";
28
+ import "./index-DeNbsrQx.js";
29
+ import { g as He } from "./user-H9MnsLbu.js";
30
+ import { useRouter as Ke } from "vue-router";
31
+ import { o as Qe } from "./objectId-dwaoBfJX.js";
32
+ class Se extends Oe {
33
+ }
34
+ const Ze = { class: "space-y-16" }, Xe = { class: "gap-16 grid grid-cols-2" }, Je = { class: "space-y-16" }, We = {
35
+ key: 0,
36
+ class: "flex flex-col gap-[16px] w-full"
37
+ }, 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__ */ oe({
38
+ __name: "CreateCardSheet",
39
+ emits: ["success", "export"],
40
+ setup(W, { expose: Y, emit: G }) {
41
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y(!1);
42
+ function F(u) {
43
+ p.value = u, u && (s.value = {
44
+ quantity: 1,
45
+ code: "",
46
+ codeConfig: {
47
+ length: 16,
48
+ charset: "1234567890",
49
+ prefix: "",
50
+ suffix: "",
51
+ pattern: "####-####-####-####"
52
+ }
53
+ });
54
+ }
55
+ const s = y({
56
+ quantity: 1,
57
+ code: "",
58
+ codeConfig: {
59
+ length: 16,
60
+ charset: "1234567890",
61
+ prefix: "",
62
+ suffix: "",
63
+ pattern: "####-####-####-####"
64
+ },
65
+ setCardOnBind: !1,
66
+ bundle: void 0
67
+ }), $ = [
68
+ {
69
+ label: "Bulk number",
70
+ value: "bulk",
71
+ sublabel: "Bulk generate unique number"
72
+ },
73
+ {
74
+ label: "Custom number",
75
+ value: "single",
76
+ sublabel: "Enter your own custom number"
77
+ }
78
+ ], k = [
79
+ {
80
+ label: "Alphanumeric",
81
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
82
+ },
83
+ {
84
+ label: "Alphabetic",
85
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
86
+ },
87
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
88
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
89
+ { label: "Numbers", value: "0123456789" },
90
+ { label: "Custom", value: "" }
91
+ ], P = y(k[0].value), B = y("bulk"), a = y(0), i = E(
92
+ () => {
93
+ var u;
94
+ return (u = h.membership.design) == null ? void 0 : u[a.value];
95
+ }
96
+ ), S = y(!1), v = E(
97
+ () => h.sortedStoreCategories.flatMap((u) => u.bundles)
98
+ );
99
+ async function c(u) {
100
+ var m, T;
101
+ if (await ((m = R.value) == null ? void 0 : m.validateInputs()), !L.value) return;
102
+ u.design = (T = i.value) == null ? void 0 : T.image;
103
+ const l = await ke.confirm(
104
+ "",
105
+ "Do you want to export generated card(s)?",
106
+ "Export",
107
+ "Generate and without export"
108
+ );
109
+ console.log(l), await C(
110
+ async () => {
111
+ const A = await H.createCards(u);
112
+ console.log(A), await M("success"), l && await M("export", A);
113
+ },
114
+ {
115
+ message: "Creating card(s)",
116
+ successMessage: "Card(s) created"
117
+ }
118
+ );
119
+ }
120
+ return Y({
121
+ showSheet: F
122
+ }), ge(
123
+ () => s.value.codeConfig.length,
124
+ (u, l) => {
125
+ u != l && (s.value.codeConfig.pattern = "#".repeat(Number(u)));
126
+ }
127
+ ), ge(
128
+ () => s.value.codeConfig.pattern,
129
+ (u, l) => {
130
+ u != l && (s.value.codeConfig.length = (s.value.codeConfig.pattern.match(/#/g) || []).length);
131
+ }
132
+ ), ne(async () => {
133
+ await h.readMemberStore();
134
+ }), (u, l) => {
135
+ const m = b("FmRadio"), T = b("FmRadioGroup"), A = b("FmSwitch"), g = b("FmStepperField"), _ = b("FmSelect"), z = b("FmTextField"), re = b("FmTextarea"), j = b("FmButton"), de = b("FmForm"), ue = b("FmSideSheet");
136
+ return f(), I(ue, {
137
+ "max-width": 560,
138
+ "dismiss-away": !0,
139
+ header: "Create collection",
140
+ modelValue: e(p),
141
+ "onUpdate:modelValue": [
142
+ l[19] || (l[19] = (V) => le(p) ? p.value = V : null),
143
+ l[20] || (l[20] = (V) => p.value = V)
144
+ ]
145
+ }, {
146
+ "side-sheet-footer": w(() => [
147
+ r("div", ot, [
148
+ d(j, {
149
+ label: "Save",
150
+ onClick: l[17] || (l[17] = (V) => c(e(s))),
151
+ loading: e(Fe)().isLoading
152
+ }, null, 8, ["loading"]),
153
+ d(j, {
154
+ label: "Cancel",
155
+ type: "button",
156
+ variant: "tertiary",
157
+ onClick: l[18] || (l[18] = (V) => p.value = !1)
158
+ })
159
+ ])
160
+ ]),
161
+ default: w(() => [
162
+ d(de, {
163
+ ref_key: "form",
164
+ ref: R,
165
+ class: "space-y-40",
166
+ onValidationSuccess: l[15] || (l[15] = (V) => L.value = !0),
167
+ onValidationFailed: l[16] || (l[16] = (V) => L.value = !1)
168
+ }, {
169
+ default: w(() => {
170
+ var V, ee, te;
171
+ return [
172
+ r("div", null, [
173
+ l[21] || (l[21] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
174
+ d(T, {
175
+ modelValue: e(B),
176
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => le(B) ? B.value = o : null),
177
+ inline: !1
178
+ }, {
179
+ default: w(() => [
180
+ (f(), D(O, null, J($, (o) => d(m, {
181
+ key: o.value,
182
+ value: o.value,
183
+ label: o.label,
184
+ sublabel: o.sublabel
185
+ }, null, 8, ["value", "label", "sublabel"])), 64))
186
+ ]),
187
+ _: 1
188
+ }, 8, ["modelValue"])
189
+ ]),
190
+ r("div", Ze, [
191
+ l[22] || (l[22] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
192
+ e(B) === "bulk" ? (f(), D(O, { key: 0 }, [
193
+ d(A, {
194
+ "model-value": e(S),
195
+ "label-placement": "right",
196
+ value: "true",
197
+ label: "Advance number setting",
198
+ required: !0,
199
+ "onUpdate:modelValue": l[1] || (l[1] = () => S.value = !e(S))
200
+ }, null, 8, ["model-value"]),
201
+ e(S) ? (f(), D(O, { key: 0 }, [
202
+ d(g, {
203
+ "model-value": e(s).codeConfig.length || null,
204
+ "onUpdate:modelValue": l[2] || (l[2] = (o) => e(s).codeConfig.length = o),
205
+ label: "Code length",
206
+ rules: [(o) => Number(o) >= 1 || "Code length must at least 1"],
207
+ required: !0
208
+ }, null, 8, ["model-value", "rules"]),
209
+ d(_, {
210
+ label: "Charset",
211
+ "model-value": e(P),
212
+ items: k,
213
+ "helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
214
+ "onUpdate:modelValue": l[3] || (l[3] = (o) => {
215
+ P.value = o, e(s).codeConfig.charset = o;
216
+ })
217
+ }, null, 8, ["model-value", "helper-text"]),
218
+ e(P) === "" ? (f(), I(z, {
219
+ key: 0,
220
+ modelValue: e(s).codeConfig.charset,
221
+ "onUpdate:modelValue": l[4] || (l[4] = (o) => e(s).codeConfig.charset = o),
222
+ label: "Custom Charset",
223
+ required: ""
224
+ }, null, 8, ["modelValue"])) : N("", !0),
225
+ r("div", Xe, [
226
+ d(z, {
227
+ modelValue: e(s).codeConfig.prefix,
228
+ "onUpdate:modelValue": l[5] || (l[5] = (o) => e(s).codeConfig.prefix = o),
229
+ label: "Prefix (Optional)"
230
+ }, null, 8, ["modelValue"]),
231
+ d(z, {
232
+ modelValue: e(s).codeConfig.suffix,
233
+ "onUpdate:modelValue": l[6] || (l[6] = (o) => e(s).codeConfig.suffix = o),
234
+ label: "Suffix (Optional)"
235
+ }, null, 8, ["modelValue"])
236
+ ]),
237
+ d(z, {
238
+ modelValue: e(s).codeConfig.pattern,
239
+ "onUpdate:modelValue": l[7] || (l[7] = (o) => e(s).codeConfig.pattern = o),
240
+ label: "Pattern",
241
+ required: !0
242
+ }, null, 8, ["modelValue"])
243
+ ], 64)) : N("", !0),
244
+ d(z, {
245
+ modelValue: e(s).quantity,
246
+ "onUpdate:modelValue": l[8] || (l[8] = (o) => e(s).quantity = o),
247
+ label: "Number of code",
248
+ rules: [
249
+ (o) => o >= 1 || "Quantity cannot be less than 1",
250
+ (o) => o <= 1e4 || "Quantity cannot more than 10,000"
251
+ ],
252
+ required: !0,
253
+ "helper-text": `${e(s).quantity} card will be created`
254
+ }, null, 8, ["modelValue", "rules", "helper-text"])
255
+ ], 64)) : N("", !0),
256
+ e(B) !== "bulk" ? (f(), I(re, {
257
+ key: 1,
258
+ modelValue: e(s).code,
259
+ "onUpdate:modelValue": l[9] || (l[9] = (o) => e(s).code = o),
260
+ label: "Custom Card Number",
261
+ rules: [(o) => e(B) != "single" || !!o || "Custom code is required"],
262
+ placeholder: "(For multiple numbers, please enter in the new row.)"
263
+ }, null, 8, ["modelValue", "rules"])) : N("", !0)
264
+ ]),
265
+ r("div", Je, [
266
+ l[23] || (l[23] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
267
+ d(A, {
268
+ "label-placement": "right",
269
+ label: "Set card number on bind",
270
+ sublabel: "Automatically set the card number when the user binds the card",
271
+ "model-value": e(s).setCardOnBind || !1,
272
+ "onUpdate:modelValue": l[10] || (l[10] = (o) => e(s).setCardOnBind = o)
273
+ }, null, 8, ["model-value"]),
274
+ d(ae, {
275
+ label: "Activate bundle on bind",
276
+ placeholder: "Select bundle",
277
+ items: e(v).filter((o) => !o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
278
+ modelValue: e(s).bundle,
279
+ "onUpdate:modelValue": l[12] || (l[12] = (o) => e(s).bundle = o)
280
+ }, {
281
+ append: w(() => [
282
+ e(s).bundle ? (f(), I(j, {
283
+ key: 0,
284
+ icon: "link_off",
285
+ variant: "plain",
286
+ onClick: l[11] || (l[11] = (o) => e(s).bundle = void 0)
287
+ })) : N("", !0)
288
+ ]),
289
+ _: 1
290
+ }, 8, ["items", "modelValue"]),
291
+ (ee = (V = e(h).store) == null ? void 0 : V.stripe) != null && ee.apiKey ? (f(), I(ae, {
292
+ key: 0,
293
+ label: "Linked subscription bundle",
294
+ placeholder: "Select bundle",
295
+ items: e(v).filter((o) => o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
296
+ modelValue: e(s).subscriptionBundle,
297
+ "onUpdate:modelValue": l[14] || (l[14] = (o) => e(s).subscriptionBundle = o)
298
+ }, {
299
+ append: w(() => [
300
+ e(s).subscriptionBundle ? (f(), I(j, {
301
+ key: 0,
302
+ icon: "link_off",
303
+ variant: "plain",
304
+ onClick: l[13] || (l[13] = (o) => e(s).subscriptionBundle = void 0)
305
+ })) : N("", !0)
306
+ ]),
307
+ _: 1
308
+ }, 8, ["items", "modelValue"])) : N("", !0)
309
+ ]),
310
+ e(h).membership.design ? (f(), D("div", We, [
311
+ r("div", et, [
312
+ l[24] || (l[24] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
313
+ r("img", {
314
+ src: (te = e(i)) == null ? void 0 : te.image,
315
+ class: "aspect-[16/9]"
316
+ }, null, 8, tt),
317
+ r("div", lt, [
318
+ (f(!0), D(O, null, J(e(h).membership.design, (o, K) => (f(), D("img", {
319
+ src: o.image,
320
+ key: `image_${K}`,
321
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e(a) === K ? "border-[2px] border-fm-color-primary" : ""}`]),
322
+ onClick: (me) => a.value = K,
323
+ alt: `ai_image_predict_${K}`,
324
+ style: { objectFit: "cover" }
325
+ }, null, 10, at))), 128))
326
+ ])
327
+ ])
328
+ ])) : N("", !0)
329
+ ];
330
+ }),
331
+ _: 1
332
+ }, 512)
333
+ ]),
334
+ _: 1
335
+ }, 8, ["modelValue"]);
336
+ };
337
+ }
338
+ }), st = { class: "space-y-16" }, it = {
339
+ key: 0,
340
+ class: "flex flex-col gap-[16px] w-full"
341
+ }, rt = { class: "flex flex-col gap-[8px]" }, dt = ["src"], ut = { class: "flex pt-[24px] gap-[24px]" }, ct = ["src", "onClick", "alt"], mt = { class: "flex items-center gap-8" }, pt = /* @__PURE__ */ oe({
342
+ __name: "EditCardSheet",
343
+ emits: ["success"],
344
+ setup(W, { expose: Y, emit: G }) {
345
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y({
346
+ _id: "",
347
+ business: "",
348
+ serialNumber: ""
349
+ }), F = y(!1);
350
+ function s(a, i) {
351
+ var S;
352
+ F.value = a, a && i && (p.value = i, $.value = (S = h.membership.design) == null ? void 0 : S.findIndex(
353
+ (v) => v.image === i.design
354
+ ));
355
+ }
356
+ const $ = y(0), k = E(
357
+ () => {
358
+ var a;
359
+ return (a = h.membership.design) == null ? void 0 : a[$.value];
360
+ }
361
+ ), P = E(
362
+ () => h.sortedStoreCategories.flatMap(
363
+ (a) => a.bundles
364
+ )
365
+ );
366
+ async function B(a) {
367
+ var i, S;
368
+ await ((i = R.value) == null ? void 0 : i.validateInputs()), L.value && (a.design = (S = k.value) == null ? void 0 : S.image, await C(
369
+ async () => {
370
+ await H.updateCard(a), await M("success");
371
+ },
372
+ {
373
+ message: "Updating card",
374
+ successMessage: "Card updated"
375
+ }
376
+ ));
377
+ }
378
+ return Y({
379
+ showSheet: s
380
+ }), ne(async () => {
381
+ await h.readMemberStore();
382
+ }), (a, i) => {
383
+ const S = b("FmTextField"), v = b("FmSwitch"), c = b("FmButton"), u = b("FmForm"), l = b("FmSideSheet");
384
+ return f(), I(l, {
385
+ "max-width": 560,
386
+ "dismiss-away": !0,
387
+ header: "Edit card",
388
+ modelValue: e(F),
389
+ "onUpdate:modelValue": [
390
+ i[10] || (i[10] = (m) => le(F) ? F.value = m : null),
391
+ i[11] || (i[11] = (m) => F.value = m)
392
+ ]
393
+ }, {
394
+ "side-sheet-footer": w(() => [
395
+ r("div", mt, [
396
+ d(c, {
397
+ label: "Save",
398
+ disabled: !!e(p).redeemedAt,
399
+ onClick: i[8] || (i[8] = (m) => B(e(p))),
400
+ loading: e(Fe)().isLoading
401
+ }, null, 8, ["disabled", "loading"]),
402
+ d(c, {
403
+ label: "Cancel",
404
+ type: "button",
405
+ variant: "tertiary",
406
+ onClick: i[9] || (i[9] = (m) => F.value = !1)
407
+ })
408
+ ])
409
+ ]),
410
+ default: w(() => [
411
+ d(u, {
412
+ ref_key: "form",
413
+ ref: R,
414
+ class: "space-y-40",
415
+ onValidationSuccess: i[6] || (i[6] = (m) => L.value = !0),
416
+ onValidationFailed: i[7] || (i[7] = (m) => L.value = !1)
417
+ }, {
418
+ default: w(() => {
419
+ var m, T, A;
420
+ return [
421
+ r("div", st, [
422
+ d(S, {
423
+ modelValue: e(p).serialNumber,
424
+ "onUpdate:modelValue": i[0] || (i[0] = (g) => e(p).serialNumber = g),
425
+ label: "Card Number",
426
+ rules: [
427
+ e(_e).toRule(e(Ce).string().min(1, "Card number is required")),
428
+ e(_e).toRule(
429
+ e(Ce).string().max(50, "Card number must be less than 50 characters")
430
+ )
431
+ ],
432
+ required: !0
433
+ }, null, 8, ["modelValue", "rules"]),
434
+ i[12] || (i[12] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
435
+ d(v, {
436
+ "label-placement": "right",
437
+ label: "Set card number on bind",
438
+ "model-value": e(p).setCardOnBind || !1,
439
+ "onUpdate:modelValue": i[1] || (i[1] = (g) => e(p).setCardOnBind = g)
440
+ }, null, 8, ["model-value"]),
441
+ d(ae, {
442
+ label: "Activate bundle on bind",
443
+ placeholder: "Select bundle",
444
+ items: e(P).filter((g) => !g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
445
+ modelValue: e(p).bundle,
446
+ "onUpdate:modelValue": i[3] || (i[3] = (g) => e(p).bundle = g)
447
+ }, {
448
+ append: w(() => [
449
+ e(p).bundle ? (f(), I(c, {
450
+ key: 0,
451
+ icon: "link_off",
452
+ variant: "plain",
453
+ onClick: i[2] || (i[2] = (g) => e(p).bundle = null)
454
+ })) : N("", !0)
455
+ ]),
456
+ _: 1
457
+ }, 8, ["items", "modelValue"]),
458
+ (T = (m = e(h).store) == null ? void 0 : m.stripe) != null && T.apiKey ? (f(), I(ae, {
459
+ key: 0,
460
+ label: "Linked subscription bundle",
461
+ placeholder: "Select bundle",
462
+ items: e(P).filter((g) => g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
463
+ modelValue: e(p).subscriptionBundle,
464
+ "onUpdate:modelValue": i[5] || (i[5] = (g) => e(p).subscriptionBundle = g)
465
+ }, {
466
+ append: w(() => [
467
+ e(p).subscriptionBundle ? (f(), I(c, {
468
+ key: 0,
469
+ icon: "link_off",
470
+ variant: "plain",
471
+ onClick: i[4] || (i[4] = (g) => e(p).subscriptionBundle = null)
472
+ })) : N("", !0)
473
+ ]),
474
+ _: 1
475
+ }, 8, ["items", "modelValue"])) : N("", !0)
476
+ ]),
477
+ e(h).membership.design ? (f(), D("div", it, [
478
+ r("div", rt, [
479
+ i[13] || (i[13] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
480
+ r("img", {
481
+ src: (A = e(k)) == null ? void 0 : A.image,
482
+ class: "aspect-[16/9]"
483
+ }, null, 8, dt),
484
+ r("div", ut, [
485
+ (f(!0), D(O, null, J(e(h).membership.design, (g, _) => (f(), D("img", {
486
+ src: g.image,
487
+ key: `image_${_}`,
488
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e($) === _ ? "border-[2px] border-fm-color-primary" : ""}`]),
489
+ onClick: (z) => $.value = _,
490
+ alt: `ai_image_predict_${_}`,
491
+ style: { objectFit: "cover" }
492
+ }, null, 10, ct))), 128))
493
+ ])
494
+ ])
495
+ ])) : N("", !0)
496
+ ];
497
+ }),
498
+ _: 1
499
+ }, 512)
500
+ ]),
501
+ _: 1
502
+ }, 8, ["modelValue"]);
503
+ };
504
+ }
505
+ }), ft = {
506
+ key: 0,
507
+ class: "grid grid-cols-2 gap-8"
508
+ }, gt = { class: "flex items-center gap-8" }, bt = { class: "flex items-center gap-8" }, yt = 5, vt = /* @__PURE__ */ oe({
509
+ __name: "CardDesignSheet",
510
+ emits: ["success"],
511
+ setup(W, { expose: Y, emit: G }) {
512
+ const { t: C } = Ve(), { minor: h } = se, R = ie(), L = Ne(), M = y(!1);
513
+ y(), y(!1);
514
+ const p = y(), F = y(null);
515
+ E(() => {
516
+ var v, c;
517
+ return Math.min((((c = (v = p.value) == null ? void 0 : v.design) == null ? void 0 : c.length) ?? 0) + 1, yt);
518
+ });
519
+ const s = G, $ = E(() => {
520
+ var v, c;
521
+ return ((c = (v = R.membership) == null ? void 0 : v.design) == null ? void 0 : c.filter((u) => u.image)) || [];
522
+ }), k = y(!1);
523
+ function P(v) {
524
+ k.value = v;
525
+ }
526
+ function B() {
527
+ M.value = !0;
528
+ }
529
+ async function a() {
530
+ await h(
531
+ async () => {
532
+ var u;
533
+ const v = Te(p.value), c = Pe.parse(v);
534
+ if (c.design = (c == null ? void 0 : c.design) || [], F.value) {
535
+ const l = Le().toHexString(), m = await xe.update(
536
+ xe.designPath(l, F.value),
537
+ F.value
538
+ );
539
+ (u = c.design) == null || u.push({
540
+ _id: l,
541
+ image: m
542
+ });
543
+ }
544
+ await H.update(c), await S(), await s("success"), F.value = null, M.value = !1;
545
+ },
546
+ {
547
+ message: "Saving card design",
548
+ successMessage: "Card design saved"
549
+ }
550
+ );
551
+ }
552
+ async function i(v, c) {
553
+ v ? F.value = v : c && L.open({
554
+ title: "Delete Design",
555
+ message: "Are you sure you want to delete this design?",
556
+ primaryActions: { text: "Delete", close: !0 },
557
+ secondaryActions: { text: "Cancel", close: !1 }
558
+ }).onPrimary(async () => {
559
+ var l, m;
560
+ const u = (l = p.value.design) == null ? void 0 : l.findIndex((T) => T._id == c);
561
+ console.log(u), u !== -1 && ((m = p.value.design) == null || m.splice(u, 1)), await a();
562
+ }).onSecondary(() => {
563
+ L.close();
564
+ });
565
+ }
566
+ async function S() {
567
+ await R.readMembership(), p.value = R.membership;
568
+ }
569
+ return Y({
570
+ showSheet: P
571
+ }), ne(async () => {
572
+ await S(), $.value.length || (M.value = !0);
573
+ }), (v, c) => {
574
+ const u = b("FmButton"), l = b("FmSideSheet");
575
+ return f(), I(l, {
576
+ "max-width": 560,
577
+ "dismiss-away": !0,
578
+ header: e(C)("connect.loyalty.card.design.title"),
579
+ modelValue: e(k),
580
+ "onUpdate:modelValue": [
581
+ c[2] || (c[2] = (m) => le(k) ? k.value = m : null),
582
+ c[3] || (c[3] = (m) => k.value = m)
583
+ ]
584
+ }, Ie({
585
+ default: w(() => [
586
+ e(M) ? N("", !0) : (f(), D("div", ft, [
587
+ (f(!0), D(O, null, J(e($), (m) => (f(), I(he, {
588
+ key: String(m._id),
589
+ "image-fit": "cover",
590
+ label: "",
591
+ "aspect-ratio": "16/9",
592
+ thumbnail: m.image,
593
+ accept: ".png, .jpg, .jpeg, .gif",
594
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
595
+ file: void 0,
596
+ "delete-button": !1
597
+ }, {
598
+ "delete-button": w(() => [
599
+ d(u, {
600
+ class: "!text-neutral-50 !bg-neutral-700",
601
+ icon: "delete",
602
+ variant: "tertiary",
603
+ onClick: (T) => i(null, m._id)
604
+ }, null, 8, ["onClick"])
605
+ ]),
606
+ _: 2
607
+ }, 1032, ["thumbnail"]))), 128))
608
+ ])),
609
+ e(M) ? (f(), I(he, {
610
+ key: 1,
611
+ "image-fit": "cover",
612
+ label: "",
613
+ "aspect-ratio": "16/9",
614
+ accept: ".png, .jpg, .jpeg, .gif",
615
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
616
+ "onUpdate:file": i
617
+ })) : N("", !0)
618
+ ]),
619
+ _: 2
620
+ }, [
621
+ e(M) ? {
622
+ name: "side-sheet-footer",
623
+ fn: w(() => [
624
+ r("div", bt, [
625
+ d(u, {
626
+ label: e(C)("connect.common.save"),
627
+ onClick: a,
628
+ disabled: !e(F)
629
+ }, null, 8, ["label", "disabled"]),
630
+ d(u, {
631
+ label: e(C)("connect.common.cancel"),
632
+ type: "button",
633
+ variant: "tertiary",
634
+ onClick: c[1] || (c[1] = (m) => M.value = !1)
635
+ }, null, 8, ["label"])
636
+ ])
637
+ ]),
638
+ key: "1"
639
+ } : {
640
+ name: "side-sheet-footer",
641
+ fn: w(() => [
642
+ r("div", gt, [
643
+ d(u, {
644
+ label: e(C)("connect.loyalty.card.design.add"),
645
+ icon: "add",
646
+ onClick: B
647
+ }, null, 8, ["label"]),
648
+ d(u, {
649
+ label: e(C)("connect.common.cancel"),
650
+ type: "button",
651
+ variant: "tertiary",
652
+ onClick: c[0] || (c[0] = (m) => k.value = !1)
653
+ }, null, 8, ["label"])
654
+ ])
655
+ ]),
656
+ key: "0"
657
+ }
658
+ ]), 1032, ["header", "modelValue"]);
659
+ };
660
+ }
661
+ }), xt = { class: "flex flex-col gap-4" }, Ct = { class: "flex items-center" }, _t = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, ht = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary max-w-[640px]" }, St = { class: "px-24 flex flex-col pb-24 gap-y-16" }, wt = { class: "flex items-center gap-8 flex-wrap p-12 mt-8 rounded-md bg-fm-color-neutral-gray-100" }, Ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, kt = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-16" }, Vt = { class: "fm-typo-en-body-md-500 text-fm-color-typo-secondary" }, $t = { class: "fm-typo-en-title-md-800 text-fm-color-typo-primary" }, At = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, It = { class: "flex items-center gap-16 flex-wrap" }, Mt = { class: "flex-1 min-w-0" }, Bt = { class: "flex items-center gap-8 flex-none" }, Ut = { class: "flex flex-col gap-16 text-center" }, Nt = { class: "fm-typo-en-title-sm-800" }, Dt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Rt = { class: "flex gap-x-8" }, fl = /* @__PURE__ */ oe({
662
+ __name: "Card",
663
+ setup(W) {
664
+ const Y = Ke();
665
+ function G() {
666
+ Y.push({ name: Re["$connect-STORE"] });
667
+ }
668
+ const C = y(), h = E(() => {
669
+ if (!C.value) return null;
670
+ const t = C.value.totalIssued;
671
+ return t ? Math.round(C.value.claimed / t * 100) : 0;
672
+ });
673
+ function R(t) {
674
+ return t === void 0 ? "—" : String(t);
675
+ }
676
+ const L = E(() => {
677
+ var t, n, U;
678
+ return [
679
+ {
680
+ key: "totalIssued",
681
+ title: a("connect.loyalty.card.stats.totalIssued"),
682
+ value: R((t = C.value) == null ? void 0 : t.totalIssued),
683
+ description: a("connect.loyalty.card.stats.totalIssuedHint")
684
+ },
685
+ {
686
+ key: "claimed",
687
+ title: a("connect.loyalty.card.stats.claimed"),
688
+ value: R((n = C.value) == null ? void 0 : n.claimed),
689
+ description: h.value === null ? "" : a("connect.loyalty.card.stats.claimedHint", {
690
+ rate: h.value
691
+ })
692
+ },
693
+ {
694
+ key: "unclaimed",
695
+ title: a("connect.loyalty.card.stats.unclaimed"),
696
+ value: R((U = C.value) == null ? void 0 : U.unclaimed),
697
+ description: a("connect.loyalty.card.stats.unclaimedHint")
698
+ }
699
+ ];
700
+ });
701
+ async function M() {
702
+ try {
703
+ C.value = await H.readCardStats();
704
+ } catch (t) {
705
+ C.value = void 0, console.error("Failed to load card stats", t);
706
+ }
707
+ }
708
+ const { minor: p, global: F } = se, s = y(), $ = y(), k = y(), P = ze(), B = ie(), { t: a } = Ve(), i = E(
709
+ () => B.sortedStoreCategories.flatMap((t) => t.bundles)
710
+ );
711
+ function S(t) {
712
+ return !!t.member || !!t.redeemedAt;
713
+ }
714
+ function v(t) {
715
+ return t.giftCard ? a("connect.loyalty.card.table.typeGiftCard") : a("connect.loyalty.card.table.typeRedemption");
716
+ }
717
+ function c(t) {
718
+ var n;
719
+ return t.giftCard ? `${t.giftCard.programName} · RM${t.giftCard.amount}` : ((n = i.value.find((U) => U._id === t.bundle)) == null ? void 0 : n.name) || "-";
720
+ }
721
+ function u(t) {
722
+ return S(t) ? a("connect.loyalty.card.table.statusClaimed") : a("connect.loyalty.card.table.statusUnclaimed");
723
+ }
724
+ function l(t) {
725
+ return ye(Qe(t._id.toString())).format(
726
+ "DD MMM YYYY hh:mmA"
727
+ );
728
+ }
729
+ function m(t) {
730
+ return t.redeemedAt ? ye(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-";
731
+ }
732
+ const T = [
733
+ {
734
+ header: a("connect.loyalty.card.table.card_number"),
735
+ accessorFn: (t) => t.serialNumber
736
+ },
737
+ {
738
+ header: a("connect.loyalty.card.table.type"),
739
+ accessorFn: v
740
+ },
741
+ {
742
+ header: a("connect.loyalty.card.table.bundle"),
743
+ accessorFn: c
744
+ },
745
+ {
746
+ header: a("connect.loyalty.card.table.status"),
747
+ accessorKey: "member",
748
+ enableSorting: !1,
749
+ cell(t) {
750
+ const n = S(t.row.original);
751
+ return be(ve.FmChip, {
752
+ label: u(t.row.original),
753
+ variant: n ? "success" : "plain",
754
+ compact: !0
755
+ });
756
+ }
757
+ },
758
+ {
759
+ header: a("connect.loyalty.card.table.claimed_by"),
760
+ accessorKey: "user",
761
+ enableSorting: !1,
762
+ cell: (t) => t.row.original.pf_member ? He(t.row.original.pf_member) : "-"
763
+ },
764
+ {
765
+ header: a("connect.loyalty.card.table.phone"),
766
+ accessorFn: (t) => {
767
+ var n;
768
+ return ((n = t.pf_member) == null ? void 0 : n.phoneNumber) || "-";
769
+ },
770
+ accessorKey: "pf_member.phoneNumber"
771
+ },
772
+ {
773
+ header: a("connect.loyalty.card.table.created_at"),
774
+ accessorKey: "_id",
775
+ accessorFn: l
776
+ },
777
+ {
778
+ header: a("connect.loyalty.card.table.claimed_at"),
779
+ accessorKey: "redeemedAt",
780
+ accessorFn: m
781
+ },
782
+ {
783
+ header: a("connect.loyalty.card.table.actions"),
784
+ cell(t) {
785
+ return be(ve.FmButton, {
786
+ variant: "tertiary",
787
+ icon: "delete",
788
+ iconColor: "neutral-gray-400",
789
+ disabled: !!t.row.original.redeemedAt || !!t.row.original.giftCard,
790
+ onClick: (n) => {
791
+ n.stopPropagation(), te(t.row.original);
792
+ }
793
+ });
794
+ }
795
+ }
796
+ ], A = y("ALL"), g = E(() => {
797
+ var n, U, Q;
798
+ const t = (Z) => Z === void 0 ? "" : ` ${Z}`;
799
+ return [
800
+ {
801
+ label: `${a("connect.loyalty.card.filters.all")}${t(
802
+ (n = C.value) == null ? void 0 : n.totalIssued
803
+ )}`,
804
+ value: "ALL"
805
+ },
806
+ {
807
+ label: `${a("connect.loyalty.card.table.statusClaimed")}${t(
808
+ (U = C.value) == null ? void 0 : U.claimed
809
+ )}`,
810
+ value: "CLAIMED"
811
+ },
812
+ {
813
+ label: `${a("connect.loyalty.card.table.statusUnclaimed")}${t(
814
+ (Q = C.value) == null ? void 0 : Q.unclaimed
815
+ )}`,
816
+ value: "UNCLAIMED"
817
+ }
818
+ ];
819
+ }), { tableMeta: _, rowData: z, onSort: re, debouncedFetchData: j, onSearch: de } = Ye(
820
+ (t) => (
821
+ // `usePagination` accepts any fetch function, so the filter rides along with
822
+ // its pagination params instead of the composable needing to know about it.
823
+ H.readCards({
824
+ ...t,
825
+ status: A.value === "ALL" ? void 0 : A.value
826
+ })
827
+ )
828
+ );
829
+ function ue(t) {
830
+ A.value = t, V({ pageIndex: 0, pageSize: _.value.pageSize });
831
+ }
832
+ async function V(t) {
833
+ var n;
834
+ await Promise.all([M(), j(t)]), (n = s.value) == null || n.showSheet(!1);
835
+ }
836
+ const ee = E(() => P.isPremium ? [
837
+ {
838
+ label: a("connect.loyalty.card.actions.manage_design"),
839
+ value: "design",
840
+ isPrimary: !1
841
+ },
842
+ {
843
+ label: a("connect.loyalty.card.actions.create"),
844
+ value: "create",
845
+ isPrimary: !0,
846
+ prependIcon: "add"
847
+ }
848
+ ] : []);
849
+ async function te(t) {
850
+ await ke.remove(
851
+ `Are you sure you want to remove card ${t.serialNumber}?`
852
+ ) && await p(
853
+ async () => {
854
+ await H.deleteCard(t._id.toString()), await j({ pageSize: 10, pageIndex: 0 });
855
+ },
856
+ {
857
+ message: `Removing card ${t.serialNumber}`,
858
+ successMessage: `Removed card ${t.serialNumber} successfully`
859
+ }
860
+ );
861
+ }
862
+ async function o() {
863
+ return je({
864
+ exporter: new Se(),
865
+ readFunction: (t) => H.readCards({
866
+ ...t,
867
+ search: _.value.searchValue,
868
+ status: A.value === "ALL" ? void 0 : A.value
869
+ }),
870
+ transformRecord: (t) => {
871
+ var n, U;
872
+ return {
873
+ "Card Number": t.serialNumber,
874
+ Type: v(t),
875
+ Bundle: c(t),
876
+ Status: u(t),
877
+ "Claimed by": ((n = t.pf_member) == null ? void 0 : n.name) || "-",
878
+ Phone: ((U = t.pf_member) == null ? void 0 : U.phoneNumber) || "-",
879
+ "Created at": l(t),
880
+ "Claimed at": m(t)
881
+ };
882
+ },
883
+ filename: "cards"
884
+ });
885
+ }
886
+ async function K(t) {
887
+ if (!t || t.length === 0)
888
+ return;
889
+ const n = new Se(), U = t.map((Q) => ({
890
+ "Card Number": Q
891
+ }));
892
+ n.addRecords(U), await qe(
893
+ n.buildExcel(),
894
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
895
+ {
896
+ bookType: "xlsx",
897
+ bookSST: !1,
898
+ type: "array"
899
+ }
900
+ );
901
+ }
902
+ const me = (t) => {
903
+ var n;
904
+ if (t.redeemedAt || t.giftCard) {
905
+ De.error("Update not permitted", 2e3);
906
+ return;
907
+ }
908
+ (n = $ == null ? void 0 : $.value) == null || n.showSheet(!0, t);
909
+ };
910
+ return ne(async () => {
911
+ await F(async () => {
912
+ await P.readPremium(), await B.readMemberStore(), await B.readMembership(), await V();
913
+ });
914
+ }), (t, n) => {
915
+ const U = b("FmPill"), Q = b("FmPageHead"), Z = b("FmIcon"), pe = b("FmCard"), $e = b("FmTabs"), Ae = b("FmSearch"), ce = b("FmButton");
916
+ return f(), D(O, null, [
917
+ d(Q, {
918
+ title: e(a)("connect.loyalty.card.title"),
919
+ actions: e(ee),
920
+ "onClick:action": n[0] || (n[0] = (x) => {
921
+ var X, fe;
922
+ console.log(x), x === "design" && ((X = e(k)) == null || X.showSheet(!0)), x === "create" && ((fe = e(s)) == null || fe.showSheet(!0));
923
+ })
924
+ }, {
925
+ title: w(() => [
926
+ r("div", xt, [
927
+ r("div", Ct, [
928
+ r("span", _t, q(e(a)("connect.loyalty.card.title")), 1),
929
+ d(U, {
930
+ class: "ml-8",
931
+ variant: "premium"
932
+ })
933
+ ]),
934
+ r("span", ht, q(e(a)("connect.loyalty.card.description")), 1)
935
+ ])
936
+ ]),
937
+ _: 1
938
+ }, 8, ["title", "actions"]),
939
+ r("div", St, [
940
+ r("div", wt, [
941
+ d(Z, {
942
+ name: "info",
943
+ size: "sm",
944
+ class: "text-fm-color-primary flex-none"
945
+ }),
946
+ r("span", Ft, q(e(a)("connect.loyalty.card.giftCardSignpost")), 1),
947
+ r("button", {
948
+ type: "button",
949
+ class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-primary",
950
+ onClick: G
951
+ }, [
952
+ Me(q(e(a)("connect.loyalty.card.giftCardSignpostAction")) + " ", 1),
953
+ d(Z, {
954
+ name: "arrow_forward",
955
+ size: "sm"
956
+ })
957
+ ])
958
+ ]),
959
+ r("div", kt, [
960
+ (f(!0), D(O, null, J(e(L), (x) => (f(), I(pe, {
961
+ key: x.key,
962
+ variant: "outlined",
963
+ class: "flex flex-col gap-8 p-16"
964
+ }, {
965
+ default: w(() => [
966
+ r("div", Vt, q(x.title), 1),
967
+ r("div", $t, q(x.value), 1),
968
+ r("div", At, q(x.description), 1)
969
+ ]),
970
+ _: 2
971
+ }, 1024))), 128))
972
+ ]),
973
+ e(z).length > 0 || e(z).length <= 0 && e(_).searchValue || e(_).pageCount > 0 ? (f(), D(O, { key: 0 }, [
974
+ r("div", It, [
975
+ r("div", Mt, [
976
+ d($e, {
977
+ "model-value": e(A),
978
+ items: e(g),
979
+ "onUpdate:modelValue": ue
980
+ }, null, 8, ["model-value", "items"])
981
+ ]),
982
+ r("div", Bt, [
983
+ d(Ae, {
984
+ modelValue: e(_).searchValue,
985
+ "onUpdate:modelValue": [
986
+ n[1] || (n[1] = (x) => e(_).searchValue = x),
987
+ e(de)
988
+ ],
989
+ placeholder: e(a)("connect.loyalty.card.searchPlaceholder")
990
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
991
+ d(ce, {
992
+ icon: "ios_share",
993
+ variant: "tertiary",
994
+ onClick: Be(o, ["prevent"])
995
+ })
996
+ ])
997
+ ]),
998
+ d(Ge, {
999
+ loading: e(_).isLoading,
1000
+ "row-data": e(z),
1001
+ "row-count": e(_).totalRows,
1002
+ "column-defs": T,
1003
+ "shrink-at": !1,
1004
+ "page-count": e(_).pageCount,
1005
+ "page-index": e(_).pageIndex,
1006
+ "page-size": e(_).pageSize,
1007
+ onSortChange: e(re),
1008
+ onPageChange: n[2] || (n[2] = (x) => {
1009
+ e(j)({
1010
+ pageSize: x.pageSize,
1011
+ pageIndex: x.pageIndex
1012
+ });
1013
+ }),
1014
+ onRowClick: n[3] || (n[3] = (x) => {
1015
+ me(e(Ee)(x.original));
1016
+ })
1017
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
1018
+ ], 64)) : (f(), I(pe, {
1019
+ key: 1,
1020
+ variant: "outlined",
1021
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1022
+ }, {
1023
+ default: w(() => [
1024
+ n[8] || (n[8] = r("img", {
1025
+ src: Ue,
1026
+ class: "aspect-square w-[150px]"
1027
+ }, null, -1)),
1028
+ r("div", Ut, [
1029
+ r("div", Nt, q(e(a)("connect.loyalty.card.empty_state.title")), 1),
1030
+ r("div", Dt, q(e(a)("connect.loyalty.card.empty_state.description")), 1)
1031
+ ]),
1032
+ r("div", Rt, [
1033
+ d(ce, {
1034
+ variant: "primary",
1035
+ label: e(a)("connect.loyalty.card.actions.add"),
1036
+ icon: "add",
1037
+ disabled: !e(P).isPremium,
1038
+ onClick: n[4] || (n[4] = () => {
1039
+ var x;
1040
+ return (x = e(s)) == null ? void 0 : x.showSheet(!0);
1041
+ })
1042
+ }, null, 8, ["label", "disabled"]),
1043
+ d(ce, {
1044
+ variant: "secondary",
1045
+ label: e(a)("connect.loyalty.card.actions.manage_design"),
1046
+ disabled: !e(P).isPremium,
1047
+ onClick: n[5] || (n[5] = () => {
1048
+ var x;
1049
+ return (x = e(k)) == null ? void 0 : x.showSheet(!0);
1050
+ })
1051
+ }, null, 8, ["label", "disabled"])
1052
+ ])
1053
+ ]),
1054
+ _: 1
1055
+ })),
1056
+ d(nt, {
1057
+ ref_key: "sheetRef",
1058
+ ref: s,
1059
+ onSuccess: n[6] || (n[6] = (x) => V()),
1060
+ onExport: K
1061
+ }, null, 512),
1062
+ d(vt, {
1063
+ ref_key: "designSheetRef",
1064
+ ref: k,
1065
+ onSuccess: V
1066
+ }, null, 512),
1067
+ d(pt, {
1068
+ ref_key: "editSheetRef",
1069
+ ref: $,
1070
+ onSuccess: n[7] || (n[7] = (x) => {
1071
+ var X;
1072
+ V({
1073
+ pageSize: e(_).pageSize,
1074
+ pageIndex: e(_).pageIndex
1075
+ }), (X = e($)) == null || X.showSheet(!1);
1076
+ })
1077
+ }, null, 512)
1078
+ ])
1079
+ ], 64);
1080
+ };
1081
+ }
1082
+ });
1083
+ export {
1084
+ fl as default
1085
+ };