@feedmepos/mf-connect 0.1.98-beta.8 → 0.1.98-beta.80

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 (167) hide show
  1. package/dist/{App-DsB2o1oB.js → App-DievprEi.js} +853 -683
  2. package/dist/{AuditLogs-BcfgiYnJ.js → AuditLogs-DrdqOhZL.js} +16 -13
  3. package/dist/{Bin-DMr7K8Kj.js → Bin-Ci2k3z77.js} +8 -8
  4. package/dist/Broadcast-CpDMAG1o.js +306 -0
  5. package/dist/CampaignAnalytic-uRyGaLaN.js +1830 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CwGoEBsW.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DtGe2Og1.js} +8 -5
  7. package/dist/Card-tb98Kyr-.js +1086 -0
  8. package/dist/{Collections-B0uGC2FE.js → Collections-P1S5WjnJ.js} +14 -13
  9. package/dist/Credit-DwK7JYf-.js +286 -0
  10. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-Cyk0iIsd.js +53 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-8r29jKh9.js +4432 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-DJLxGk7W.js → EffectSheet.vue_vue_type_style_index_0_lang-BML_-v8I.js} +36 -36
  13. package/dist/Experience-BejtRlOj.js +288 -0
  14. package/dist/{FileSaver.min-BlA0oZEC.js → FileSaver.min-C-hmBaHm.js} +1 -1
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js +138 -0
  16. package/dist/Game-n8qL896g.js +356 -0
  17. package/dist/GiftCardSetup-Bgsfcu7N.js +736 -0
  18. package/dist/GoalPickerPanel.vue_vue_type_script_setup_true_lang-CzL68PPP.js +424 -0
  19. package/dist/Goals-BB8LJlq3.js +247 -0
  20. package/dist/{Grab-DmmwrGzk.js → Grab-COq3Ujst.js} +33 -32
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DNtLW0yQ.js → ImageInput.vue_vue_type_script_setup_true_lang-BmLclEyi.js} +1 -1
  22. package/dist/{Index-m7l4insz.js → Index-BdkIinaE.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-B9sJ-M20.js → LocationPicker.vue_vue_type_script_setup_true_lang-DsWv3DVb.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-Dsg2sWjF.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DvOzGF8c.js} +1 -1
  25. package/dist/LoyaltyDashboard-D4Jtpw0n.js +2911 -0
  26. package/dist/MainLayout-Ca-Xm3eZ.js +143 -0
  27. package/dist/{Marketing-C9pSIdBU.js → Marketing-Cpe4s7NZ.js} +7 -6
  28. package/dist/{MarketingMaterialEdit-BEF2T9LR.js → MarketingMaterialEdit-nTeS9VVx.js} +15 -14
  29. package/dist/Member-DgGZ4Cdg.js +654 -0
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-_O3B-FIA.js +1281 -0
  31. package/dist/MemberImportHistory-rdlbDVWU.js +187 -0
  32. package/dist/MemberList-BC4aRJTt.js +334 -0
  33. package/dist/{MemberTransactions-CAut1TQb.js → MemberTransactions-BFfdTttp.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-1AuHixPC.js → MessageInput.vue_vue_type_script_setup_true_lang-DXajAQy9.js} +5928 -5644
  35. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8xVDzdO3.js +40 -0
  36. package/dist/Mission-BWCNKTjU.js +363 -0
  37. package/dist/Overview--Q7vzhNK.js +1316 -0
  38. package/dist/{Overview-DOJj4XvO.js → Overview-i02Wnyjn.js} +23 -20
  39. package/dist/Point-CiWxqny5.js +297 -0
  40. package/dist/Promotion-B0G9qfBm.js +426 -0
  41. package/dist/{Queue-55G2gtP5.js → Queue-YfwgYmzH.js} +16 -13
  42. package/dist/{Record-DNPI02c6.js → Record-CCuwrPKW.js} +9 -9
  43. package/dist/Review-ymsfdh7Q.js +45 -0
  44. package/dist/ReviewFacebookCallback-DyDExWvP.js +238 -0
  45. package/dist/ReviewGoogleCallback-DNyg3n2S.js +213 -0
  46. package/dist/{Reward-CnP8R2pS.js → Reward-BKIb0ezH.js} +28 -28
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BN71h9IK.js → RewardGroup.vue_vue_type_script_setup_true_lang-DPaaNgpr.js} +26 -23
  48. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CtB9Ls5-.js → RuleGroup.vue_vue_type_script_setup_true_lang-BLFLybFn.js} +198 -186
  49. package/dist/{Segment-CxiQnnyj.js → Segment-D5_pp7fh.js} +278 -276
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B1vj5f7T.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLLjIA-D.js} +45 -42
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-cWx0G3nM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRIcZwnU.js} +4 -4
  52. package/dist/Setting-CD78gIMU.js +574 -0
  53. package/dist/{SettingAdvertisements-Vt7w1WN3.js → SettingAdvertisements-C2AIT4s4.js} +12 -12
  54. package/dist/Settings-DI_tryQV.js +230 -0
  55. package/dist/Store-BV2JTRNZ.js +2615 -0
  56. package/dist/{StoreRewards-DILeipMG.js → StoreRewards-Bk55YXyO.js} +15 -15
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BZZ1fqwg.js +1331 -0
  58. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-C7lVeybl.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BrEzWVrH.js} +2 -2
  59. package/dist/{Tier-BAZ1xuKL.js → Tier-CO2K30Ew.js} +2576 -757
  60. package/dist/{Title-CcNAt47f.js → Title-qProQh3T.js} +41 -37
  61. package/dist/Transaction-qL5L-fE_.js +45 -0
  62. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-hUjQVZ_U.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Co1BPScS.js} +26 -26
  63. package/dist/Voucher-VFD1LY9Y.js +837 -0
  64. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CTQDxc5l.js → VoucherEditor.vue_vue_type_script_setup_true_lang-9QyTl7iq.js} +118 -124
  65. package/dist/WhatsappAccount-CxSGqm7H.js +325 -0
  66. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-D8L6izf0.js +96 -0
  67. package/dist/WhatsappBot-C4Oz7Xwv.js +441 -0
  68. package/dist/WhatsappBotSettings-CKqaWzwE.js +136 -0
  69. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DuRKA4cj.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bcsi94dw.js} +2 -2
  70. package/dist/{app-Z-UKRG5V.js → app-BEYzXWZO.js} +50954 -42517
  71. package/dist/app.js +1 -1
  72. package/dist/base.export-S_82Elmg.js +75 -0
  73. package/dist/browser-BSAOEeIM.js +1478 -0
  74. package/dist/{business-C7EF6cKC.js → business-DH7djUl8.js} +5 -5
  75. package/dist/campaign-DlHDgoFX.js +100 -0
  76. package/dist/campaign-k_WHxsOR.js +400 -0
  77. package/dist/{campaign.enum-BNN2gLFY.js → campaign.enum-Dx-Zo68Q.js} +1 -1
  78. package/dist/{campaign.fn-Bd34dVnx.js → campaign.fn-B-4JRzft.js} +67 -67
  79. package/dist/{collectible.enum-DO9HdJGH.js → collectible.enum-Liy2wH3s.js} +1 -1
  80. package/dist/collection.fn-zQwWDzZT.js +26 -0
  81. package/dist/currency-CQVHXBFe.js +7 -0
  82. package/dist/{duplicateCampaign-2ODeDw3a.js → duplicateCampaign-YTXMbJTj.js} +11 -11
  83. package/dist/{effect-BcB8IlTI.js → effect-CQkVLHWi.js} +1 -1
  84. package/dist/{email-addresses-BcTeU4Sh.js → email-addresses-BIoVbPGC.js} +209 -201
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/{helper-BSgrCJRv.js → helper-BCkTvF4m.js} +1 -1
  87. package/dist/{index-CoHWpylO.js → index-B-bQnb0_.js} +2115 -2557
  88. package/dist/index-BAJOC43K.js +14550 -0
  89. package/dist/{index-HXiYGO4_.js → index-BFIHEBnX.js} +6343 -7693
  90. package/dist/{index-VlFWaBrg.js → index-BJIQe3QJ.js} +1 -1
  91. package/dist/{index-BpI-BI4H.js → index-BJkRTH5T.js} +4 -4
  92. package/dist/index-BOJogkKQ.js +172 -0
  93. package/dist/{index-BoYEqLif.js → index-BRPajAkE.js} +1517 -263
  94. package/dist/{index-CsoBDon4.js → index-BTkxgos0.js} +1590 -1523
  95. package/dist/index-BUP4aHq8.js +32438 -0
  96. package/dist/index-BYvnqARr.js +902 -0
  97. package/dist/{index-hlyg-wxV.js → index-Bonq819P.js} +1 -1
  98. package/dist/{index-CIBPhxlC.js → index-C6mOI2Pp.js} +105 -123
  99. package/dist/{index-Bf6jNZit.js → index-CDIe15AY.js} +24 -9
  100. package/dist/index-CTrcdIkt.js +137 -0
  101. package/dist/index-C_H8jFYf.js +2743 -0
  102. package/dist/index-CpnchVe1.js +74 -0
  103. package/dist/index-D5AR7A5e.js +151 -0
  104. package/dist/index-D7-Q86HI.js +54 -0
  105. package/dist/index-DdOj8Hew.js +53 -0
  106. package/dist/{index-iMPtFp54.js → index-Dvqguh2B.js} +10 -9
  107. package/dist/{index-Bm0QPucw.js → index-hAKRfE-4.js} +14 -14
  108. package/dist/index-o2Ga_qaX.js +39 -0
  109. package/dist/{index.esm2017-CM7OnEyP.js → index.esm2017-D0fhMMPG.js} +128 -128
  110. package/dist/{loading-CSXr0Yqz.js → loading-C686AMVG.js} +1 -1
  111. package/dist/{lodash-Bh7XKI-R.js → lodash-CANlWUWW.js} +1 -1
  112. package/dist/member-import-UzJ6ByIS.js +188 -0
  113. package/dist/membership-DCVzFaFy.js +274 -0
  114. package/dist/{money-BZIST_m9.js → money-DuazwoX7.js} +1 -1
  115. package/dist/{number-DXLR2w95.js → number-B2HFiV0g.js} +1 -1
  116. package/dist/objectid-Bq-oVMdP.js +145 -0
  117. package/dist/onboarding-BxvNxz-9.js +131 -0
  118. package/dist/onboardingSetup-CcvKmyx8.js +17 -0
  119. package/dist/{plugins-4FlbwoES.js → plugins-C39O5j42.js} +13 -12
  120. package/dist/remy-Qz_pNsUS.js +13 -0
  121. package/dist/{reward-DUbl79bZ.js → reward-HYt-2nxt.js} +1 -1
  122. package/dist/{rule-BQUoZ4l_.js → rule-3xNIYM7z.js} +337 -275
  123. package/dist/style.css +1 -1
  124. package/dist/{template-BoiSG7G7.js → template-D37Z_b0m.js} +6 -6
  125. package/dist/timezone-JwnQgpaU.js +20 -0
  126. package/dist/transaction.fn-C5vswLI_.js +71 -0
  127. package/dist/{trigger-D5g5m6tT.js → trigger-Bc6s2cvq.js} +17 -17
  128. package/dist/useMarketingMaterialActions-DMGyAXcy.js +96 -0
  129. package/dist/{usePagination-DHePBBoR.js → usePagination-DLOOwiiY.js} +1 -1
  130. package/dist/{user-C_ToSo-g.js → user-CTIGugVF.js} +1 -1
  131. package/dist/{vue-i18n-BcYh6_51.js → vue-i18n-Dpic36zz.js} +287 -287
  132. package/dist/{xlsx-h4G1C-xj.js → xlsx-CT9_1SFr.js} +786 -786
  133. package/dist/{zod-CgigfJar.js → zod-CGVrMcDl.js} +1 -1
  134. package/package.json +10 -6
  135. package/dist/Broadcast-C9akM-TB.js +0 -266
  136. package/dist/Card-DRkIYs0M.js +0 -910
  137. package/dist/Credit-V5YA_hGx.js +0 -260
  138. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  139. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CYQMXARx.js +0 -3377
  140. package/dist/Experience-WTWy5yY6.js +0 -259
  141. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  142. package/dist/Game-BwOfTCW5.js +0 -330
  143. package/dist/LoyaltyDashboard-CJdhYiea.js +0 -1082
  144. package/dist/MainLayout-Du5kZOtA.js +0 -41
  145. package/dist/Member-DUV_vbPI.js +0 -280
  146. package/dist/MemberList-Ye4nOk-i.js +0 -1601
  147. package/dist/Mission-BBmCGpt8.js +0 -334
  148. package/dist/Point-Bzg6hi6o.js +0 -262
  149. package/dist/Promotion-BMXIp_ef.js +0 -397
  150. package/dist/Review-CYNPPxYU.js +0 -1141
  151. package/dist/ReviewFacebookCallback-0SUkKAaC.js +0 -243
  152. package/dist/ReviewGoogleCallback-BZEzx68n.js +0 -208
  153. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C4vohf6c.js +0 -181
  154. package/dist/Setting-jHAjccod.js +0 -2047
  155. package/dist/Store-Cu-hKmVa.js +0 -1996
  156. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CGz6CTWA.js +0 -1130
  157. package/dist/Transaction-D7DO3dKQ.js +0 -39
  158. package/dist/Voucher-Cq-n1CaC.js +0 -421
  159. package/dist/campaign--MjoY1Mn.js +0 -219
  160. package/dist/campaign-DHBuP4UA.js +0 -277
  161. package/dist/export-CjB7qxZ9.js +0 -97
  162. package/dist/index-BIAjmMga.js +0 -85
  163. package/dist/index-Bv4MBLQ5.js +0 -52
  164. package/dist/index-hbyCVNa7.js +0 -30289
  165. package/dist/membership-CfredTm3.js +0 -255
  166. package/dist/objectid-Dg4ZodlT.js +0 -145
  167. package/dist/useMarketingMaterialActions-B-Jlw2Z9.js +0 -107
@@ -0,0 +1,1086 @@
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-BFIHEBnX.js";
6
+ import { u as se } from "./loading-C686AMVG.js";
7
+ import { u as Fe } from "./app-wDQR6dpb.js";
8
+ import { u as ie } from "./membership-DCVzFaFy.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-C39O5j42.js";
11
+ import { m as H } from "./index-CDIe15AY.js";
12
+ import { z as Ce, R as Re } from "./app-BEYzXWZO.js";
13
+ import { Z as _e } from "./zod-CGVrMcDl.js";
14
+ import { _ as he } from "./ImageInput.vue_vue_type_script_setup_true_lang-BmLclEyi.js";
15
+ import "./index-BRPajAkE.js";
16
+ import "./index-B-bQnb0_.js";
17
+ import "./index-BTkxgos0.js";
18
+ import { b as Pe } from "./index-BYvnqARr.js";
19
+ import "./index-Dvqguh2B.js";
20
+ import "./index-o2Ga_qaX.js";
21
+ import "./index-BOJogkKQ.js";
22
+ import { O as Le } from "./objectid-Bq-oVMdP.js";
23
+ import { u as Ve } from "./vue-i18n-Dpic36zz.js";
24
+ import { a as Te, c as Ee } from "./object-BYyQ0PZp.js";
25
+ import { u as ze } from "./business-DH7djUl8.js";
26
+ import { w as qe } from "./xlsx-CT9_1SFr.js";
27
+ import { B as Oe, e as je } from "./base.export-S_82Elmg.js";
28
+ import { u as Ye, _ as Ge } from "./usePagination-DLOOwiiY.js";
29
+ import "./index-Bonq819P.js";
30
+ import { g as He } from "./user-CTIGugVF.js";
31
+ import { useRouter as Ke } from "vue-router";
32
+ import { o as Qe } from "./objectId-dwaoBfJX.js";
33
+ class Se extends Oe {
34
+ }
35
+ const Ze = { class: "space-y-16" }, Xe = { class: "gap-16 grid grid-cols-2" }, Je = { class: "space-y-16" }, We = {
36
+ key: 0,
37
+ class: "flex flex-col gap-[16px] w-full"
38
+ }, 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({
39
+ __name: "CreateCardSheet",
40
+ emits: ["success", "export"],
41
+ setup(W, { expose: Y, emit: G }) {
42
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y(!1);
43
+ function F(u) {
44
+ p.value = u, u && (s.value = {
45
+ quantity: 1,
46
+ code: "",
47
+ codeConfig: {
48
+ length: 16,
49
+ charset: "1234567890",
50
+ prefix: "",
51
+ suffix: "",
52
+ pattern: "####-####-####-####"
53
+ }
54
+ });
55
+ }
56
+ const s = y({
57
+ quantity: 1,
58
+ code: "",
59
+ codeConfig: {
60
+ length: 16,
61
+ charset: "1234567890",
62
+ prefix: "",
63
+ suffix: "",
64
+ pattern: "####-####-####-####"
65
+ },
66
+ setCardOnBind: !1,
67
+ bundle: void 0
68
+ }), $ = [
69
+ {
70
+ label: "Bulk number",
71
+ value: "bulk",
72
+ sublabel: "Bulk generate unique number"
73
+ },
74
+ {
75
+ label: "Custom number",
76
+ value: "single",
77
+ sublabel: "Enter your own custom number"
78
+ }
79
+ ], k = [
80
+ {
81
+ label: "Alphanumeric",
82
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
83
+ },
84
+ {
85
+ label: "Alphabetic",
86
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
87
+ },
88
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
89
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
90
+ { label: "Numbers", value: "0123456789" },
91
+ { label: "Custom", value: "" }
92
+ ], P = y(k[0].value), B = y("bulk"), a = y(0), i = E(
93
+ () => {
94
+ var u;
95
+ return (u = h.membership.design) == null ? void 0 : u[a.value];
96
+ }
97
+ ), S = y(!1), v = E(
98
+ () => h.sortedStoreCategories.flatMap((u) => u.bundles)
99
+ );
100
+ async function c(u) {
101
+ var m, T;
102
+ if (await ((m = R.value) == null ? void 0 : m.validateInputs()), !L.value) return;
103
+ u.design = (T = i.value) == null ? void 0 : T.image;
104
+ const l = await ke.confirm(
105
+ "",
106
+ "Do you want to export generated card(s)?",
107
+ "Export",
108
+ "Generate and without export"
109
+ );
110
+ console.log(l), await C(
111
+ async () => {
112
+ const A = await H.createCards(u);
113
+ console.log(A), await M("success"), l && await M("export", A);
114
+ },
115
+ {
116
+ message: "Creating card(s)",
117
+ successMessage: "Card(s) created"
118
+ }
119
+ );
120
+ }
121
+ return Y({
122
+ showSheet: F
123
+ }), ge(
124
+ () => s.value.codeConfig.length,
125
+ (u, l) => {
126
+ u != l && (s.value.codeConfig.pattern = "#".repeat(Number(u)));
127
+ }
128
+ ), ge(
129
+ () => s.value.codeConfig.pattern,
130
+ (u, l) => {
131
+ u != l && (s.value.codeConfig.length = (s.value.codeConfig.pattern.match(/#/g) || []).length);
132
+ }
133
+ ), ne(async () => {
134
+ await h.readMemberStore();
135
+ }), (u, l) => {
136
+ 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");
137
+ return f(), I(ue, {
138
+ "max-width": 560,
139
+ "dismiss-away": !0,
140
+ header: "Create collection",
141
+ modelValue: e(p),
142
+ "onUpdate:modelValue": [
143
+ l[19] || (l[19] = (V) => le(p) ? p.value = V : null),
144
+ l[20] || (l[20] = (V) => p.value = V)
145
+ ]
146
+ }, {
147
+ "side-sheet-footer": w(() => [
148
+ r("div", ot, [
149
+ d(j, {
150
+ label: "Save",
151
+ onClick: l[17] || (l[17] = (V) => c(e(s))),
152
+ loading: e(Fe)().isLoading
153
+ }, null, 8, ["loading"]),
154
+ d(j, {
155
+ label: "Cancel",
156
+ type: "button",
157
+ variant: "tertiary",
158
+ onClick: l[18] || (l[18] = (V) => p.value = !1)
159
+ })
160
+ ])
161
+ ]),
162
+ default: w(() => [
163
+ d(de, {
164
+ ref_key: "form",
165
+ ref: R,
166
+ class: "space-y-40",
167
+ onValidationSuccess: l[15] || (l[15] = (V) => L.value = !0),
168
+ onValidationFailed: l[16] || (l[16] = (V) => L.value = !1)
169
+ }, {
170
+ default: w(() => {
171
+ var V, ee, te;
172
+ return [
173
+ r("div", null, [
174
+ l[21] || (l[21] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
175
+ d(T, {
176
+ modelValue: e(B),
177
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => le(B) ? B.value = o : null),
178
+ inline: !1
179
+ }, {
180
+ default: w(() => [
181
+ (f(), D(O, null, J($, (o) => d(m, {
182
+ key: o.value,
183
+ value: o.value,
184
+ label: o.label,
185
+ sublabel: o.sublabel
186
+ }, null, 8, ["value", "label", "sublabel"])), 64))
187
+ ]),
188
+ _: 1
189
+ }, 8, ["modelValue"])
190
+ ]),
191
+ r("div", Ze, [
192
+ l[22] || (l[22] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
193
+ e(B) === "bulk" ? (f(), D(O, { key: 0 }, [
194
+ d(A, {
195
+ "model-value": e(S),
196
+ "label-placement": "right",
197
+ value: "true",
198
+ label: "Advance number setting",
199
+ required: !0,
200
+ "onUpdate:modelValue": l[1] || (l[1] = () => S.value = !e(S))
201
+ }, null, 8, ["model-value"]),
202
+ e(S) ? (f(), D(O, { key: 0 }, [
203
+ d(g, {
204
+ "model-value": e(s).codeConfig.length || null,
205
+ "onUpdate:modelValue": l[2] || (l[2] = (o) => e(s).codeConfig.length = o),
206
+ label: "Code length",
207
+ rules: [(o) => Number(o) >= 1 || "Code length must at least 1"],
208
+ required: !0
209
+ }, null, 8, ["model-value", "rules"]),
210
+ d(_, {
211
+ label: "Charset",
212
+ "model-value": e(P),
213
+ items: k,
214
+ "helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
215
+ "onUpdate:modelValue": l[3] || (l[3] = (o) => {
216
+ P.value = o, e(s).codeConfig.charset = o;
217
+ })
218
+ }, null, 8, ["model-value", "helper-text"]),
219
+ e(P) === "" ? (f(), I(z, {
220
+ key: 0,
221
+ modelValue: e(s).codeConfig.charset,
222
+ "onUpdate:modelValue": l[4] || (l[4] = (o) => e(s).codeConfig.charset = o),
223
+ label: "Custom Charset",
224
+ required: ""
225
+ }, null, 8, ["modelValue"])) : N("", !0),
226
+ r("div", Xe, [
227
+ d(z, {
228
+ modelValue: e(s).codeConfig.prefix,
229
+ "onUpdate:modelValue": l[5] || (l[5] = (o) => e(s).codeConfig.prefix = o),
230
+ label: "Prefix (Optional)"
231
+ }, null, 8, ["modelValue"]),
232
+ d(z, {
233
+ modelValue: e(s).codeConfig.suffix,
234
+ "onUpdate:modelValue": l[6] || (l[6] = (o) => e(s).codeConfig.suffix = o),
235
+ label: "Suffix (Optional)"
236
+ }, null, 8, ["modelValue"])
237
+ ]),
238
+ d(z, {
239
+ modelValue: e(s).codeConfig.pattern,
240
+ "onUpdate:modelValue": l[7] || (l[7] = (o) => e(s).codeConfig.pattern = o),
241
+ label: "Pattern",
242
+ required: !0
243
+ }, null, 8, ["modelValue"])
244
+ ], 64)) : N("", !0),
245
+ d(z, {
246
+ modelValue: e(s).quantity,
247
+ "onUpdate:modelValue": l[8] || (l[8] = (o) => e(s).quantity = o),
248
+ label: "Number of code",
249
+ rules: [
250
+ (o) => o >= 1 || "Quantity cannot be less than 1",
251
+ (o) => o <= 1e4 || "Quantity cannot more than 10,000"
252
+ ],
253
+ required: !0,
254
+ "helper-text": `${e(s).quantity} card will be created`
255
+ }, null, 8, ["modelValue", "rules", "helper-text"])
256
+ ], 64)) : N("", !0),
257
+ e(B) !== "bulk" ? (f(), I(re, {
258
+ key: 1,
259
+ modelValue: e(s).code,
260
+ "onUpdate:modelValue": l[9] || (l[9] = (o) => e(s).code = o),
261
+ label: "Custom Card Number",
262
+ rules: [(o) => e(B) != "single" || !!o || "Custom code is required"],
263
+ placeholder: "(For multiple numbers, please enter in the new row.)"
264
+ }, null, 8, ["modelValue", "rules"])) : N("", !0)
265
+ ]),
266
+ r("div", Je, [
267
+ l[23] || (l[23] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
268
+ d(A, {
269
+ "label-placement": "right",
270
+ label: "Set card number on bind",
271
+ sublabel: "Automatically set the card number when the user binds the card",
272
+ "model-value": e(s).setCardOnBind || !1,
273
+ "onUpdate:modelValue": l[10] || (l[10] = (o) => e(s).setCardOnBind = o)
274
+ }, null, 8, ["model-value"]),
275
+ d(ae, {
276
+ label: "Activate bundle on bind",
277
+ placeholder: "Select bundle",
278
+ items: e(v).filter((o) => !o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
279
+ modelValue: e(s).bundle,
280
+ "onUpdate:modelValue": l[12] || (l[12] = (o) => e(s).bundle = o)
281
+ }, {
282
+ append: w(() => [
283
+ e(s).bundle ? (f(), I(j, {
284
+ key: 0,
285
+ icon: "link_off",
286
+ variant: "plain",
287
+ onClick: l[11] || (l[11] = (o) => e(s).bundle = void 0)
288
+ })) : N("", !0)
289
+ ]),
290
+ _: 1
291
+ }, 8, ["items", "modelValue"]),
292
+ (ee = (V = e(h).store) == null ? void 0 : V.stripe) != null && ee.apiKey ? (f(), I(ae, {
293
+ key: 0,
294
+ label: "Linked subscription bundle",
295
+ placeholder: "Select bundle",
296
+ items: e(v).filter((o) => o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
297
+ modelValue: e(s).subscriptionBundle,
298
+ "onUpdate:modelValue": l[14] || (l[14] = (o) => e(s).subscriptionBundle = o)
299
+ }, {
300
+ append: w(() => [
301
+ e(s).subscriptionBundle ? (f(), I(j, {
302
+ key: 0,
303
+ icon: "link_off",
304
+ variant: "plain",
305
+ onClick: l[13] || (l[13] = (o) => e(s).subscriptionBundle = void 0)
306
+ })) : N("", !0)
307
+ ]),
308
+ _: 1
309
+ }, 8, ["items", "modelValue"])) : N("", !0)
310
+ ]),
311
+ e(h).membership.design ? (f(), D("div", We, [
312
+ r("div", et, [
313
+ l[24] || (l[24] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
314
+ r("img", {
315
+ src: (te = e(i)) == null ? void 0 : te.image,
316
+ class: "aspect-[16/9]"
317
+ }, null, 8, tt),
318
+ r("div", lt, [
319
+ (f(!0), D(O, null, J(e(h).membership.design, (o, K) => (f(), D("img", {
320
+ src: o.image,
321
+ key: `image_${K}`,
322
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e(a) === K ? "border-[2px] border-fm-color-primary" : ""}`]),
323
+ onClick: (me) => a.value = K,
324
+ alt: `ai_image_predict_${K}`,
325
+ style: { objectFit: "cover" }
326
+ }, null, 10, at))), 128))
327
+ ])
328
+ ])
329
+ ])) : N("", !0)
330
+ ];
331
+ }),
332
+ _: 1
333
+ }, 512)
334
+ ]),
335
+ _: 1
336
+ }, 8, ["modelValue"]);
337
+ };
338
+ }
339
+ }), st = { class: "space-y-16" }, it = {
340
+ key: 0,
341
+ class: "flex flex-col gap-[16px] w-full"
342
+ }, 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({
343
+ __name: "EditCardSheet",
344
+ emits: ["success"],
345
+ setup(W, { expose: Y, emit: G }) {
346
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y({
347
+ _id: "",
348
+ business: "",
349
+ serialNumber: ""
350
+ }), F = y(!1);
351
+ function s(a, i) {
352
+ var S;
353
+ F.value = a, a && i && (p.value = i, $.value = (S = h.membership.design) == null ? void 0 : S.findIndex(
354
+ (v) => v.image === i.design
355
+ ));
356
+ }
357
+ const $ = y(0), k = E(
358
+ () => {
359
+ var a;
360
+ return (a = h.membership.design) == null ? void 0 : a[$.value];
361
+ }
362
+ ), P = E(
363
+ () => h.sortedStoreCategories.flatMap(
364
+ (a) => a.bundles
365
+ )
366
+ );
367
+ async function B(a) {
368
+ var i, S;
369
+ await ((i = R.value) == null ? void 0 : i.validateInputs()), L.value && (a.design = (S = k.value) == null ? void 0 : S.image, await C(
370
+ async () => {
371
+ await H.updateCard(a), await M("success");
372
+ },
373
+ {
374
+ message: "Updating card",
375
+ successMessage: "Card updated"
376
+ }
377
+ ));
378
+ }
379
+ return Y({
380
+ showSheet: s
381
+ }), ne(async () => {
382
+ await h.readMemberStore();
383
+ }), (a, i) => {
384
+ const S = b("FmTextField"), v = b("FmSwitch"), c = b("FmButton"), u = b("FmForm"), l = b("FmSideSheet");
385
+ return f(), I(l, {
386
+ "max-width": 560,
387
+ "dismiss-away": !0,
388
+ header: "Edit card",
389
+ modelValue: e(F),
390
+ "onUpdate:modelValue": [
391
+ i[10] || (i[10] = (m) => le(F) ? F.value = m : null),
392
+ i[11] || (i[11] = (m) => F.value = m)
393
+ ]
394
+ }, {
395
+ "side-sheet-footer": w(() => [
396
+ r("div", mt, [
397
+ d(c, {
398
+ label: "Save",
399
+ disabled: !!e(p).redeemedAt,
400
+ onClick: i[8] || (i[8] = (m) => B(e(p))),
401
+ loading: e(Fe)().isLoading
402
+ }, null, 8, ["disabled", "loading"]),
403
+ d(c, {
404
+ label: "Cancel",
405
+ type: "button",
406
+ variant: "tertiary",
407
+ onClick: i[9] || (i[9] = (m) => F.value = !1)
408
+ })
409
+ ])
410
+ ]),
411
+ default: w(() => [
412
+ d(u, {
413
+ ref_key: "form",
414
+ ref: R,
415
+ class: "space-y-40",
416
+ onValidationSuccess: i[6] || (i[6] = (m) => L.value = !0),
417
+ onValidationFailed: i[7] || (i[7] = (m) => L.value = !1)
418
+ }, {
419
+ default: w(() => {
420
+ var m, T, A;
421
+ return [
422
+ r("div", st, [
423
+ d(S, {
424
+ modelValue: e(p).serialNumber,
425
+ "onUpdate:modelValue": i[0] || (i[0] = (g) => e(p).serialNumber = g),
426
+ label: "Card Number",
427
+ rules: [
428
+ e(_e).toRule(e(Ce).string().min(1, "Card number is required")),
429
+ e(_e).toRule(
430
+ e(Ce).string().max(50, "Card number must be less than 50 characters")
431
+ )
432
+ ],
433
+ required: !0
434
+ }, null, 8, ["modelValue", "rules"]),
435
+ i[12] || (i[12] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
436
+ d(v, {
437
+ "label-placement": "right",
438
+ label: "Set card number on bind",
439
+ "model-value": e(p).setCardOnBind || !1,
440
+ "onUpdate:modelValue": i[1] || (i[1] = (g) => e(p).setCardOnBind = g)
441
+ }, null, 8, ["model-value"]),
442
+ d(ae, {
443
+ label: "Activate bundle on bind",
444
+ placeholder: "Select bundle",
445
+ items: e(P).filter((g) => !g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
446
+ modelValue: e(p).bundle,
447
+ "onUpdate:modelValue": i[3] || (i[3] = (g) => e(p).bundle = g)
448
+ }, {
449
+ append: w(() => [
450
+ e(p).bundle ? (f(), I(c, {
451
+ key: 0,
452
+ icon: "link_off",
453
+ variant: "plain",
454
+ onClick: i[2] || (i[2] = (g) => e(p).bundle = null)
455
+ })) : N("", !0)
456
+ ]),
457
+ _: 1
458
+ }, 8, ["items", "modelValue"]),
459
+ (T = (m = e(h).store) == null ? void 0 : m.stripe) != null && T.apiKey ? (f(), I(ae, {
460
+ key: 0,
461
+ label: "Linked subscription bundle",
462
+ placeholder: "Select bundle",
463
+ items: e(P).filter((g) => g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
464
+ modelValue: e(p).subscriptionBundle,
465
+ "onUpdate:modelValue": i[5] || (i[5] = (g) => e(p).subscriptionBundle = g)
466
+ }, {
467
+ append: w(() => [
468
+ e(p).subscriptionBundle ? (f(), I(c, {
469
+ key: 0,
470
+ icon: "link_off",
471
+ variant: "plain",
472
+ onClick: i[4] || (i[4] = (g) => e(p).subscriptionBundle = null)
473
+ })) : N("", !0)
474
+ ]),
475
+ _: 1
476
+ }, 8, ["items", "modelValue"])) : N("", !0)
477
+ ]),
478
+ e(h).membership.design ? (f(), D("div", it, [
479
+ r("div", rt, [
480
+ i[13] || (i[13] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
481
+ r("img", {
482
+ src: (A = e(k)) == null ? void 0 : A.image,
483
+ class: "aspect-[16/9]"
484
+ }, null, 8, dt),
485
+ r("div", ut, [
486
+ (f(!0), D(O, null, J(e(h).membership.design, (g, _) => (f(), D("img", {
487
+ src: g.image,
488
+ key: `image_${_}`,
489
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e($) === _ ? "border-[2px] border-fm-color-primary" : ""}`]),
490
+ onClick: (z) => $.value = _,
491
+ alt: `ai_image_predict_${_}`,
492
+ style: { objectFit: "cover" }
493
+ }, null, 10, ct))), 128))
494
+ ])
495
+ ])
496
+ ])) : N("", !0)
497
+ ];
498
+ }),
499
+ _: 1
500
+ }, 512)
501
+ ]),
502
+ _: 1
503
+ }, 8, ["modelValue"]);
504
+ };
505
+ }
506
+ }), ft = {
507
+ key: 0,
508
+ class: "grid grid-cols-2 gap-8"
509
+ }, gt = { class: "flex items-center gap-8" }, bt = { class: "flex items-center gap-8" }, yt = 5, vt = /* @__PURE__ */ oe({
510
+ __name: "CardDesignSheet",
511
+ emits: ["success"],
512
+ setup(W, { expose: Y, emit: G }) {
513
+ const { t: C } = Ve(), { minor: h } = se, R = ie(), L = Ne(), M = y(!1);
514
+ y(), y(!1);
515
+ const p = y(), F = y(null);
516
+ E(() => {
517
+ var v, c;
518
+ return Math.min((((c = (v = p.value) == null ? void 0 : v.design) == null ? void 0 : c.length) ?? 0) + 1, yt);
519
+ });
520
+ const s = G, $ = E(() => {
521
+ var v, c;
522
+ return ((c = (v = R.membership) == null ? void 0 : v.design) == null ? void 0 : c.filter((u) => u.image)) || [];
523
+ }), k = y(!1);
524
+ function P(v) {
525
+ k.value = v;
526
+ }
527
+ function B() {
528
+ M.value = !0;
529
+ }
530
+ async function a() {
531
+ await h(
532
+ async () => {
533
+ var u;
534
+ const v = Te(p.value), c = Pe.parse(v);
535
+ if (c.design = (c == null ? void 0 : c.design) || [], F.value) {
536
+ const l = Le().toHexString(), m = await xe.update(
537
+ xe.designPath(l, F.value),
538
+ F.value
539
+ );
540
+ (u = c.design) == null || u.push({
541
+ _id: l,
542
+ image: m
543
+ });
544
+ }
545
+ await H.update(c), await S(), await s("success"), F.value = null, M.value = !1;
546
+ },
547
+ {
548
+ message: "Saving card design",
549
+ successMessage: "Card design saved"
550
+ }
551
+ );
552
+ }
553
+ async function i(v, c) {
554
+ v ? F.value = v : c && L.open({
555
+ title: "Delete Design",
556
+ message: "Are you sure you want to delete this design?",
557
+ primaryActions: { text: "Delete", close: !0 },
558
+ secondaryActions: { text: "Cancel", close: !1 }
559
+ }).onPrimary(async () => {
560
+ var l, m;
561
+ const u = (l = p.value.design) == null ? void 0 : l.findIndex((T) => T._id == c);
562
+ console.log(u), u !== -1 && ((m = p.value.design) == null || m.splice(u, 1)), await a();
563
+ }).onSecondary(() => {
564
+ L.close();
565
+ });
566
+ }
567
+ async function S() {
568
+ await R.readMembership(), p.value = R.membership;
569
+ }
570
+ return Y({
571
+ showSheet: P
572
+ }), ne(async () => {
573
+ await S(), $.value.length || (M.value = !0);
574
+ }), (v, c) => {
575
+ const u = b("FmButton"), l = b("FmSideSheet");
576
+ return f(), I(l, {
577
+ "max-width": 560,
578
+ "dismiss-away": !0,
579
+ header: e(C)("connect.loyalty.card.design.title"),
580
+ modelValue: e(k),
581
+ "onUpdate:modelValue": [
582
+ c[2] || (c[2] = (m) => le(k) ? k.value = m : null),
583
+ c[3] || (c[3] = (m) => k.value = m)
584
+ ]
585
+ }, Ie({
586
+ default: w(() => [
587
+ e(M) ? N("", !0) : (f(), D("div", ft, [
588
+ (f(!0), D(O, null, J(e($), (m) => (f(), I(he, {
589
+ key: String(m._id),
590
+ "image-fit": "cover",
591
+ label: "",
592
+ "aspect-ratio": "16/9",
593
+ thumbnail: m.image,
594
+ accept: ".png, .jpg, .jpeg, .gif",
595
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
596
+ file: void 0,
597
+ "delete-button": !1
598
+ }, {
599
+ "delete-button": w(() => [
600
+ d(u, {
601
+ class: "!text-neutral-50 !bg-neutral-700",
602
+ icon: "delete",
603
+ variant: "tertiary",
604
+ onClick: (T) => i(null, m._id)
605
+ }, null, 8, ["onClick"])
606
+ ]),
607
+ _: 2
608
+ }, 1032, ["thumbnail"]))), 128))
609
+ ])),
610
+ e(M) ? (f(), I(he, {
611
+ key: 1,
612
+ "image-fit": "cover",
613
+ label: "",
614
+ "aspect-ratio": "16/9",
615
+ accept: ".png, .jpg, .jpeg, .gif",
616
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
617
+ "onUpdate:file": i
618
+ })) : N("", !0)
619
+ ]),
620
+ _: 2
621
+ }, [
622
+ e(M) ? {
623
+ name: "side-sheet-footer",
624
+ fn: w(() => [
625
+ r("div", bt, [
626
+ d(u, {
627
+ label: e(C)("connect.common.save"),
628
+ onClick: a,
629
+ disabled: !e(F)
630
+ }, null, 8, ["label", "disabled"]),
631
+ d(u, {
632
+ label: e(C)("connect.common.cancel"),
633
+ type: "button",
634
+ variant: "tertiary",
635
+ onClick: c[1] || (c[1] = (m) => M.value = !1)
636
+ }, null, 8, ["label"])
637
+ ])
638
+ ]),
639
+ key: "1"
640
+ } : {
641
+ name: "side-sheet-footer",
642
+ fn: w(() => [
643
+ r("div", gt, [
644
+ d(u, {
645
+ label: e(C)("connect.loyalty.card.design.add"),
646
+ icon: "add",
647
+ onClick: B
648
+ }, null, 8, ["label"]),
649
+ d(u, {
650
+ label: e(C)("connect.common.cancel"),
651
+ type: "button",
652
+ variant: "tertiary",
653
+ onClick: c[0] || (c[0] = (m) => k.value = !1)
654
+ }, null, 8, ["label"])
655
+ ])
656
+ ]),
657
+ key: "0"
658
+ }
659
+ ]), 1032, ["header", "modelValue"]);
660
+ };
661
+ }
662
+ }), 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" }, gl = /* @__PURE__ */ oe({
663
+ __name: "Card",
664
+ setup(W) {
665
+ const Y = Ke();
666
+ function G() {
667
+ Y.push({ name: Re["$connect-STORE"] });
668
+ }
669
+ const C = y(), h = E(() => {
670
+ if (!C.value) return null;
671
+ const t = C.value.totalIssued;
672
+ return t ? Math.round(C.value.claimed / t * 100) : 0;
673
+ });
674
+ function R(t) {
675
+ return t === void 0 ? "—" : String(t);
676
+ }
677
+ const L = E(() => {
678
+ var t, n, U;
679
+ return [
680
+ {
681
+ key: "totalIssued",
682
+ title: a("connect.loyalty.card.stats.totalIssued"),
683
+ value: R((t = C.value) == null ? void 0 : t.totalIssued),
684
+ description: a("connect.loyalty.card.stats.totalIssuedHint")
685
+ },
686
+ {
687
+ key: "claimed",
688
+ title: a("connect.loyalty.card.stats.claimed"),
689
+ value: R((n = C.value) == null ? void 0 : n.claimed),
690
+ description: h.value === null ? "" : a("connect.loyalty.card.stats.claimedHint", {
691
+ rate: h.value
692
+ })
693
+ },
694
+ {
695
+ key: "unclaimed",
696
+ title: a("connect.loyalty.card.stats.unclaimed"),
697
+ value: R((U = C.value) == null ? void 0 : U.unclaimed),
698
+ description: a("connect.loyalty.card.stats.unclaimedHint")
699
+ }
700
+ ];
701
+ });
702
+ async function M() {
703
+ try {
704
+ C.value = await H.readCardStats();
705
+ } catch (t) {
706
+ C.value = void 0, console.error("Failed to load card stats", t);
707
+ }
708
+ }
709
+ const { minor: p, global: F } = se, s = y(), $ = y(), k = y(), P = ze(), B = ie(), { t: a } = Ve(), i = E(
710
+ () => B.sortedStoreCategories.flatMap((t) => t.bundles)
711
+ );
712
+ function S(t) {
713
+ return !!t.member || !!t.redeemedAt;
714
+ }
715
+ function v(t) {
716
+ return t.giftCard ? a("connect.loyalty.card.table.typeGiftCard") : a("connect.loyalty.card.table.typeRedemption");
717
+ }
718
+ function c(t) {
719
+ var n;
720
+ return t.giftCard ? `${t.giftCard.programName} · RM${t.giftCard.amount}` : ((n = i.value.find((U) => U._id === t.bundle)) == null ? void 0 : n.name) || "-";
721
+ }
722
+ function u(t) {
723
+ return S(t) ? a("connect.loyalty.card.table.statusClaimed") : a("connect.loyalty.card.table.statusUnclaimed");
724
+ }
725
+ function l(t) {
726
+ return ye(Qe(t._id.toString())).format(
727
+ "DD MMM YYYY hh:mmA"
728
+ );
729
+ }
730
+ function m(t) {
731
+ return t.redeemedAt ? ye(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-";
732
+ }
733
+ const T = [
734
+ {
735
+ header: a("connect.loyalty.card.table.card_number"),
736
+ accessorFn: (t) => t.serialNumber
737
+ },
738
+ {
739
+ header: a("connect.loyalty.card.table.type"),
740
+ accessorFn: v
741
+ },
742
+ {
743
+ header: a("connect.loyalty.card.table.bundle"),
744
+ accessorFn: c
745
+ },
746
+ {
747
+ header: a("connect.loyalty.card.table.status"),
748
+ accessorKey: "member",
749
+ enableSorting: !1,
750
+ cell(t) {
751
+ const n = S(t.row.original);
752
+ return be(ve.FmChip, {
753
+ label: u(t.row.original),
754
+ variant: n ? "success" : "plain",
755
+ compact: !0
756
+ });
757
+ }
758
+ },
759
+ {
760
+ header: a("connect.loyalty.card.table.claimed_by"),
761
+ accessorKey: "user",
762
+ enableSorting: !1,
763
+ cell: (t) => t.row.original.pf_member ? He(t.row.original.pf_member) : "-"
764
+ },
765
+ {
766
+ header: a("connect.loyalty.card.table.phone"),
767
+ accessorFn: (t) => {
768
+ var n;
769
+ return ((n = t.pf_member) == null ? void 0 : n.phoneNumber) || "-";
770
+ },
771
+ accessorKey: "pf_member.phoneNumber"
772
+ },
773
+ {
774
+ header: a("connect.loyalty.card.table.created_at"),
775
+ accessorKey: "_id",
776
+ accessorFn: l
777
+ },
778
+ {
779
+ header: a("connect.loyalty.card.table.claimed_at"),
780
+ accessorKey: "redeemedAt",
781
+ accessorFn: m
782
+ },
783
+ {
784
+ header: a("connect.loyalty.card.table.actions"),
785
+ cell(t) {
786
+ return be(ve.FmButton, {
787
+ variant: "tertiary",
788
+ icon: "delete",
789
+ iconColor: "neutral-gray-400",
790
+ disabled: !!t.row.original.redeemedAt || !!t.row.original.giftCard,
791
+ onClick: (n) => {
792
+ n.stopPropagation(), te(t.row.original);
793
+ }
794
+ });
795
+ }
796
+ }
797
+ ], A = y("ALL"), g = E(() => {
798
+ var n, U, Q;
799
+ const t = (Z) => Z === void 0 ? "" : ` ${Z}`;
800
+ return [
801
+ {
802
+ label: `${a("connect.loyalty.card.filters.all")}${t(
803
+ (n = C.value) == null ? void 0 : n.totalIssued
804
+ )}`,
805
+ value: "ALL"
806
+ },
807
+ {
808
+ label: `${a("connect.loyalty.card.table.statusClaimed")}${t(
809
+ (U = C.value) == null ? void 0 : U.claimed
810
+ )}`,
811
+ value: "CLAIMED"
812
+ },
813
+ {
814
+ label: `${a("connect.loyalty.card.table.statusUnclaimed")}${t(
815
+ (Q = C.value) == null ? void 0 : Q.unclaimed
816
+ )}`,
817
+ value: "UNCLAIMED"
818
+ }
819
+ ];
820
+ }), { tableMeta: _, rowData: z, onSort: re, debouncedFetchData: j, onSearch: de } = Ye(
821
+ (t) => (
822
+ // `usePagination` accepts any fetch function, so the filter rides along with
823
+ // its pagination params instead of the composable needing to know about it.
824
+ H.readCards({
825
+ ...t,
826
+ status: A.value === "ALL" ? void 0 : A.value
827
+ })
828
+ )
829
+ );
830
+ function ue(t) {
831
+ A.value = t, V({ pageIndex: 0, pageSize: _.value.pageSize });
832
+ }
833
+ async function V(t) {
834
+ var n;
835
+ await Promise.all([M(), j(t)]), (n = s.value) == null || n.showSheet(!1);
836
+ }
837
+ const ee = E(() => P.isPremium ? [
838
+ {
839
+ label: a("connect.loyalty.card.actions.manage_design"),
840
+ value: "design",
841
+ isPrimary: !1
842
+ },
843
+ {
844
+ label: a("connect.loyalty.card.actions.create"),
845
+ value: "create",
846
+ isPrimary: !0,
847
+ prependIcon: "add"
848
+ }
849
+ ] : []);
850
+ async function te(t) {
851
+ await ke.remove(
852
+ `Are you sure you want to remove card ${t.serialNumber}?`
853
+ ) && await p(
854
+ async () => {
855
+ await H.deleteCard(t._id.toString()), await j({ pageSize: 10, pageIndex: 0 });
856
+ },
857
+ {
858
+ message: `Removing card ${t.serialNumber}`,
859
+ successMessage: `Removed card ${t.serialNumber} successfully`
860
+ }
861
+ );
862
+ }
863
+ async function o() {
864
+ return je({
865
+ exporter: new Se(),
866
+ readFunction: (t) => H.readCards({
867
+ ...t,
868
+ search: _.value.searchValue,
869
+ status: A.value === "ALL" ? void 0 : A.value
870
+ }),
871
+ transformRecord: (t) => {
872
+ var n, U;
873
+ return {
874
+ "Card Number": t.serialNumber,
875
+ Type: v(t),
876
+ Bundle: c(t),
877
+ Status: u(t),
878
+ "Claimed by": ((n = t.pf_member) == null ? void 0 : n.name) || "-",
879
+ Phone: ((U = t.pf_member) == null ? void 0 : U.phoneNumber) || "-",
880
+ "Created at": l(t),
881
+ "Claimed at": m(t)
882
+ };
883
+ },
884
+ filename: "cards"
885
+ });
886
+ }
887
+ async function K(t) {
888
+ if (!t || t.length === 0)
889
+ return;
890
+ const n = new Se(), U = t.map((Q) => ({
891
+ "Card Number": Q
892
+ }));
893
+ n.addRecords(U), await qe(
894
+ n.buildExcel(),
895
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
896
+ {
897
+ bookType: "xlsx",
898
+ bookSST: !1,
899
+ type: "array"
900
+ }
901
+ );
902
+ }
903
+ const me = (t) => {
904
+ var n;
905
+ if (t.redeemedAt || t.giftCard) {
906
+ De.error("Update not permitted", 2e3);
907
+ return;
908
+ }
909
+ (n = $ == null ? void 0 : $.value) == null || n.showSheet(!0, t);
910
+ };
911
+ return ne(async () => {
912
+ await F(async () => {
913
+ await P.readPremium(), await B.readMemberStore(), await B.readMembership(), await V();
914
+ });
915
+ }), (t, n) => {
916
+ const U = b("FmPill"), Q = b("FmPageHead"), Z = b("FmIcon"), pe = b("FmCard"), $e = b("FmTabs"), Ae = b("FmSearch"), ce = b("FmButton");
917
+ return f(), D(O, null, [
918
+ d(Q, {
919
+ title: e(a)("connect.loyalty.card.title"),
920
+ actions: e(ee),
921
+ "onClick:action": n[0] || (n[0] = (x) => {
922
+ var X, fe;
923
+ console.log(x), x === "design" && ((X = e(k)) == null || X.showSheet(!0)), x === "create" && ((fe = e(s)) == null || fe.showSheet(!0));
924
+ })
925
+ }, {
926
+ title: w(() => [
927
+ r("div", xt, [
928
+ r("div", Ct, [
929
+ r("span", _t, q(e(a)("connect.loyalty.card.title")), 1),
930
+ d(U, {
931
+ class: "ml-8",
932
+ variant: "premium"
933
+ })
934
+ ]),
935
+ r("span", ht, q(e(a)("connect.loyalty.card.description")), 1)
936
+ ])
937
+ ]),
938
+ _: 1
939
+ }, 8, ["title", "actions"]),
940
+ r("div", St, [
941
+ r("div", wt, [
942
+ d(Z, {
943
+ name: "info",
944
+ size: "sm",
945
+ class: "text-fm-color-primary flex-none"
946
+ }),
947
+ r("span", Ft, q(e(a)("connect.loyalty.card.giftCardSignpost")), 1),
948
+ r("button", {
949
+ type: "button",
950
+ class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-primary",
951
+ onClick: G
952
+ }, [
953
+ Me(q(e(a)("connect.loyalty.card.giftCardSignpostAction")) + " ", 1),
954
+ d(Z, {
955
+ name: "arrow_forward",
956
+ size: "sm"
957
+ })
958
+ ])
959
+ ]),
960
+ r("div", kt, [
961
+ (f(!0), D(O, null, J(e(L), (x) => (f(), I(pe, {
962
+ key: x.key,
963
+ variant: "outlined",
964
+ class: "flex flex-col gap-8 p-16"
965
+ }, {
966
+ default: w(() => [
967
+ r("div", Vt, q(x.title), 1),
968
+ r("div", $t, q(x.value), 1),
969
+ r("div", At, q(x.description), 1)
970
+ ]),
971
+ _: 2
972
+ }, 1024))), 128))
973
+ ]),
974
+ e(z).length > 0 || e(z).length <= 0 && e(_).searchValue || e(_).pageCount > 0 ? (f(), D(O, { key: 0 }, [
975
+ r("div", It, [
976
+ r("div", Mt, [
977
+ d($e, {
978
+ "model-value": e(A),
979
+ items: e(g),
980
+ "onUpdate:modelValue": ue
981
+ }, null, 8, ["model-value", "items"])
982
+ ]),
983
+ r("div", Bt, [
984
+ d(Ae, {
985
+ modelValue: e(_).searchValue,
986
+ "onUpdate:modelValue": [
987
+ n[1] || (n[1] = (x) => e(_).searchValue = x),
988
+ e(de)
989
+ ],
990
+ placeholder: e(a)("connect.loyalty.card.searchPlaceholder")
991
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
992
+ d(ce, {
993
+ icon: "ios_share",
994
+ variant: "tertiary",
995
+ onClick: Be(o, ["prevent"])
996
+ })
997
+ ])
998
+ ]),
999
+ d(Ge, {
1000
+ loading: e(_).isLoading,
1001
+ "row-data": e(z),
1002
+ "row-count": e(_).totalRows,
1003
+ "column-defs": T,
1004
+ "shrink-at": !1,
1005
+ "page-count": e(_).pageCount,
1006
+ "page-index": e(_).pageIndex,
1007
+ "page-size": e(_).pageSize,
1008
+ onSortChange: e(re),
1009
+ onPageChange: n[2] || (n[2] = (x) => {
1010
+ e(j)({
1011
+ pageSize: x.pageSize,
1012
+ pageIndex: x.pageIndex
1013
+ });
1014
+ }),
1015
+ onRowClick: n[3] || (n[3] = (x) => {
1016
+ me(e(Ee)(x.original));
1017
+ })
1018
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
1019
+ ], 64)) : (f(), I(pe, {
1020
+ key: 1,
1021
+ variant: "outlined",
1022
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1023
+ }, {
1024
+ default: w(() => [
1025
+ n[8] || (n[8] = r("img", {
1026
+ src: Ue,
1027
+ class: "aspect-square w-[150px]"
1028
+ }, null, -1)),
1029
+ r("div", Ut, [
1030
+ r("div", Nt, q(e(a)("connect.loyalty.card.empty_state.title")), 1),
1031
+ r("div", Dt, q(e(a)("connect.loyalty.card.empty_state.description")), 1)
1032
+ ]),
1033
+ r("div", Rt, [
1034
+ d(ce, {
1035
+ variant: "primary",
1036
+ label: e(a)("connect.loyalty.card.actions.add"),
1037
+ icon: "add",
1038
+ disabled: !e(P).isPremium,
1039
+ onClick: n[4] || (n[4] = () => {
1040
+ var x;
1041
+ return (x = e(s)) == null ? void 0 : x.showSheet(!0);
1042
+ })
1043
+ }, null, 8, ["label", "disabled"]),
1044
+ d(ce, {
1045
+ variant: "secondary",
1046
+ label: e(a)("connect.loyalty.card.actions.manage_design"),
1047
+ disabled: !e(P).isPremium,
1048
+ onClick: n[5] || (n[5] = () => {
1049
+ var x;
1050
+ return (x = e(k)) == null ? void 0 : x.showSheet(!0);
1051
+ })
1052
+ }, null, 8, ["label", "disabled"])
1053
+ ])
1054
+ ]),
1055
+ _: 1
1056
+ })),
1057
+ d(nt, {
1058
+ ref_key: "sheetRef",
1059
+ ref: s,
1060
+ onSuccess: n[6] || (n[6] = (x) => V()),
1061
+ onExport: K
1062
+ }, null, 512),
1063
+ d(vt, {
1064
+ ref_key: "designSheetRef",
1065
+ ref: k,
1066
+ onSuccess: V
1067
+ }, null, 512),
1068
+ d(pt, {
1069
+ ref_key: "editSheetRef",
1070
+ ref: $,
1071
+ onSuccess: n[7] || (n[7] = (x) => {
1072
+ var X;
1073
+ V({
1074
+ pageSize: e(_).pageSize,
1075
+ pageIndex: e(_).pageIndex
1076
+ }), (X = e($)) == null || X.showSheet(!1);
1077
+ })
1078
+ }, null, 512)
1079
+ ])
1080
+ ], 64);
1081
+ };
1082
+ }
1083
+ });
1084
+ export {
1085
+ gl as default
1086
+ };