@feedmepos/mf-connect 0.1.111-prod → 0.1.113-beta.3

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 (162) hide show
  1. package/README.md +66 -1
  2. package/dist/{App-D3pYl3WL.js → App-YfpYV7C0.js} +738 -689
  3. package/dist/AuditLogs-kD0_HO_p.js +2016 -0
  4. package/dist/{Bin-DOZqpbYH.js → Bin-Dr-Xp3pn.js} +8 -8
  5. package/dist/Broadcast-CEbHu2xA.js +306 -0
  6. package/dist/{CampaignAnalytic-cFKvCgxX.js → CampaignAnalytic-DDiGxPwp.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B0eVEubS.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cc_Yho9-.js} +49 -32
  8. package/dist/Card-BUnwg0eM.js +1086 -0
  9. package/dist/{Collections-9QK5hbLo.js → Collections-CKyBkKq2.js} +197 -185
  10. package/dist/{Credit-8Ouy4O9a.js → Credit-CJOXWLV1.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CJA-yunY.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DmEBLeNI.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Ce5R4Un6.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Dv0q3B8m.js → EffectSheet.vue_vue_type_style_index_0_lang-CMFmlqfF.js} +32 -32
  14. package/dist/{Experience-DMh4hR1S.js → Experience-C_Am5CTY.js} +32 -31
  15. package/dist/{FileSaver.min-Bx9mdUgJ.js → FileSaver.min-CueAGbjq.js} +1 -1
  16. package/dist/{Game-CL0TZvg1.js → Game-B6GO_LVU.js} +19 -18
  17. package/dist/GiftCardSetup-CVLDDpI2.js +748 -0
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Bz5kIfoM.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-isfGhKO1.js} +7 -7
  19. package/dist/{Goals-Dz5Vp-lj.js → Goals-BX-sMV2V.js} +4 -4
  20. package/dist/Grab-Bh335Srh.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CaPDI3vY.js → ImageInput.vue_vue_type_script_setup_true_lang-srSgUY3e.js} +1 -1
  22. package/dist/{Index-kH8aAegB.js → Index-CyXRbwcm.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-CFrgC3Ka.js → LocationPicker.vue_vue_type_script_setup_true_lang-S3GB2Ems.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DPIFLdBc.js → LottieAnimation.vue_vue_type_script_setup_true_lang-ZlWHXwXZ.js} +1 -1
  25. package/dist/{LoyaltyDashboard-BBxEoWol.js → LoyaltyDashboard-DrTq8oiu.js} +15 -15
  26. package/dist/MainLayout-KbKkpX5n.js +4 -0
  27. package/dist/{MainLayout-2BLwDyHQ.js → MainLayout.vue_vue_type_script_setup_true_lang-2D5ate_s.js} +5 -4
  28. package/dist/{Marketing-C4OnSV-c.js → Marketing-DQT1MWQg.js} +4 -4
  29. package/dist/MarketingMaterialEdit-fSqr53-M.js +1037 -0
  30. package/dist/{Member-CT9WwxP0.js → Member-DwDUCzlv.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-C7yznkUn.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DaQ4Lw8f.js} +43 -49
  32. package/dist/{MemberImportHistory-B__BFID7.js → MemberImportHistory-D4ezvJGZ.js} +7 -7
  33. package/dist/{MemberList-DgLI4wty.js → MemberList-DFieV7Qk.js} +103 -105
  34. package/dist/{MemberTransactions-UFx_DZYe.js → MemberTransactions-BPOXyAuC.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BFjZA8Y6.js → MessageInput.vue_vue_type_script_setup_true_lang-DhfsgDd4.js} +4821 -4690
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Df9bxbUl.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CX8bk_IQ.js} +1 -1
  37. package/dist/{Mission-CawzGzDu.js → Mission-nErb05Es.js} +22 -21
  38. package/dist/{Overview-D19oSo24.js → Overview-7G31a7B-.js} +58 -56
  39. package/dist/{Overview-CAtTlEVa.js → Overview-DuJr_hAg.js} +145 -144
  40. package/dist/{Point-BPAGmKAj.js → Point-PWDLemD4.js} +22 -21
  41. package/dist/{Promotion-B0Uf9vjL.js → Promotion-N80Tj8M6.js} +137 -131
  42. package/dist/{Queue-CJEAFss_.js → Queue-M7ZpgiMT.js} +49 -47
  43. package/dist/{Record-s6hSQG2P.js → Record-NhxrdvWv.js} +9 -9
  44. package/dist/{Review-DhNCbAOm.js → Review-DiAaAzIG.js} +2 -2
  45. package/dist/ReviewFacebookCallback-JdyxFbNl.js +225 -0
  46. package/dist/{ReviewGoogleCallback-D8ENWii2.js → ReviewGoogleCallback-BXbI3Bsh.js} +5 -5
  47. package/dist/{Reward-BT00QsXL.js → Reward-yTaOqOT8.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DaZDGhbm.js → RewardGroup.vue_vue_type_script_setup_true_lang-BWPfjZ9K.js} +26 -24
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cz2H9MKe.js +1923 -0
  50. package/dist/{Segment-BuGhX9zg.js → Segment-DE9Bcd6R.js} +287 -287
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DB718_4P.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-pmv0cb4J.js} +37 -35
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CkgXxy0C.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BeWwkTix.js} +4 -4
  53. package/dist/Setting-C0JAxIRT.js +574 -0
  54. package/dist/{SettingAdvertisements-aqFErKAr.js → SettingAdvertisements-DxueyKU8.js} +12 -12
  55. package/dist/Settings-Cs46AcxZ.js +286 -0
  56. package/dist/Store-DqQae9nE.js +2629 -0
  57. package/dist/{StoreRewards-D2pTL2oA.js → StoreRewards-JxSUsOzJ.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-qgrBtUNX.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-D7ifzgsI.js +7007 -0
  60. package/dist/{Tier-OyE8oH2r.js → Tier-DWhgWush.js} +2576 -686
  61. package/dist/{Title-DAl7CKL_.js → Title-DUNeMdz8.js} +104 -101
  62. package/dist/Transaction-DAv-LVhC.js +45 -0
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-C0yHxQVr.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cih-9IoW.js} +26 -26
  64. package/dist/{Voucher-D2QGWSxs.js → Voucher-uLTq9RSK.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Bt2YB745.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BevVL_Kx.js} +16 -16
  66. package/dist/WhatsappAccount-BpXQ4q0P.js +158 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-EssnbsgT.js +39 -0
  68. package/dist/WhatsappBot-DB4NRZMd.js +589 -0
  69. package/dist/WhatsappBotLogs-DDN4H_bv.js +372 -0
  70. package/dist/WhatsappBotSettings-Bkv1VNwF.js +387 -0
  71. package/dist/WhatsappBotTickets-DAKgnE6T.js +162 -0
  72. package/dist/WhatsappLayout-DSnq84Uo.js +21 -0
  73. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-1BvxPD-k.js +195 -0
  74. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BzCL64Jo.js → ZodTextField.vue_vue_type_script_setup_true_lang-CR-F0x1r.js} +2 -2
  75. package/dist/{app-QxosLNkH.js → app-Devzv4gO.js} +12854 -9732
  76. package/dist/app.js +4 -3
  77. package/dist/base.export-CCSMkvAm.js +75 -0
  78. package/dist/browser-BSAOEeIM.js +1478 -0
  79. package/dist/{business-CbqG6NXr.js → business-BjAmUqNA.js} +1 -1
  80. package/dist/campaign-C5c47GqT.js +400 -0
  81. package/dist/{campaign-Rj7oDBnN.js → campaign-CTe-T5Gd.js} +31 -25
  82. package/dist/{campaign.enum-B7vdNYKd.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  83. package/dist/campaign.fn-DxAO8A5b.js +776 -0
  84. package/dist/{collectible.enum-BsQseg7-.js → collectible.enum-Liy2wH3s.js} +1 -1
  85. package/dist/{collection.fn-EbUIyB1X.js → collection.fn-C9l-OtNt.js} +2 -2
  86. package/dist/currency-mwm4AWXK.js +7 -0
  87. package/dist/duplicateCampaign-BbC4AwQ1.js +51 -0
  88. package/dist/{effect-B_91OlcX.js → effect-D8ba9z0K.js} +1 -1
  89. package/dist/{email-addresses-DXnYZG-e.js → email-addresses-BR5J6_Jz.js} +2 -2
  90. package/dist/feature-flag-C-5NdFW8.js +868 -0
  91. package/dist/feature-flag-CNcU4_3r.js +50 -0
  92. package/dist/google-BQK68wbe.js +5 -0
  93. package/dist/{helper-_uhiXya1.js → helper-D9cEaMIv.js} +1 -1
  94. package/dist/index-0H82-X0n.js +80 -0
  95. package/dist/{index-Cp7oHMm3.js → index-B1jP-_Z_.js} +691 -229
  96. package/dist/{index-BZ2b0Pk6.js → index-B7HH6vKF.js} +8 -7
  97. package/dist/{index-tbo0pMIu.js → index-BFaZp6Et.js} +29 -15
  98. package/dist/index-B_gzo75q.js +53 -0
  99. package/dist/{index-DlQJZNwD.js → index-BfoDdVQS.js} +22 -6
  100. package/dist/{index-CDm0BWa3.js → index-BvY2hQac.js} +1 -1
  101. package/dist/index-Byg4ztr-.js +902 -0
  102. package/dist/{index-BWgc2-Qz.js → index-CZfqqrVu.js} +4 -3
  103. package/dist/index-C_H8jFYf.js +2743 -0
  104. package/dist/{index-xuFTeVrb.js → index-CmzjBrHR.js} +11 -9
  105. package/dist/{index-BBihP1s2.js → index-Ct6YjTIW.js} +2 -2
  106. package/dist/{index-Df4l6y-S.js → index-D34iYRdc.js} +1900 -2121
  107. package/dist/{index-DuhRCI0L.js → index-D4k1G2oE.js} +4 -4
  108. package/dist/{index-uuNGb1nv.js → index-DnepoNWn.js} +8028 -10766
  109. package/dist/index-Drmh0FT-.js +14571 -0
  110. package/dist/{index-DlGnYR5y.js → index-DtcUCknS.js} +2700 -2613
  111. package/dist/{index-C_1iqF1Q.js → index-DwTBiVts.js} +1 -1
  112. package/dist/{index-CWUmrVo_.js → index-OvnHt5x5.js} +800 -793
  113. package/dist/index-RwNlbTO8.js +115 -0
  114. package/dist/{index-CzYxnDWP.js → index-VqAbYyHH.js} +11 -6
  115. package/dist/{index-DzBzClHP.js → index-yGSko6Eq.js} +1 -1
  116. package/dist/{index.esm2017-B72iWwk_.js → index.esm2017-DLb2VyCT.js} +156 -156
  117. package/dist/{loading-rIhCiB_S.js → loading-CUNk5u1d.js} +1 -1
  118. package/dist/{lodash-B6fOjfjd.js → lodash-BJXravls.js} +1 -1
  119. package/dist/{member-import-CbHn7zss.js → member-import-DjYoddBi.js} +6 -5
  120. package/dist/{membership-DkJN7jyQ.js → membership-ByJUFP8f.js} +3 -3
  121. package/dist/{money-ChbDx6Nq.js → money-Bf2IEMJJ.js} +1 -1
  122. package/dist/{number-9TEd27Ku.js → number-CRBHrRUL.js} +1 -1
  123. package/dist/objectid-58gyOvdR.js +145 -0
  124. package/dist/{onboarding-BN3MKVRs.js → onboarding-CQ3lw7eY.js} +25 -25
  125. package/dist/{onboardingSetup-D9xhdgS3.js → onboardingSetup-CsdZKGFk.js} +2 -2
  126. package/dist/{plugins-CCibSJZa.js → plugins-iTZLbJGy.js} +3 -3
  127. package/dist/{MarketingMaterialEdit-DFhpsI2-.js → remy-icon-BhUGu2NI.js} +2 -1031
  128. package/dist/{reward-DjasF-NL.js → reward-DTN6JpEd.js} +1 -1
  129. package/dist/{rule-DqeChj0e.js → rule-BYACNQOL.js} +572 -492
  130. package/dist/style.css +1 -1
  131. package/dist/template--Vr0PCjB.js +188 -0
  132. package/dist/{timezone-D0nC1LDx.js → timezone-DwzjOED-.js} +1 -1
  133. package/dist/{transaction.fn-BkF4Ad2z.js → transaction.fn-DapYe3n7.js} +2 -2
  134. package/dist/{trigger-CxpXoQJO.js → trigger-D8r76yb0.js} +18 -18
  135. package/dist/{useMarketingMaterialActions-p0-fyMkm.js → useMarketingMaterialActions-CdMmibPE.js} +3 -3
  136. package/dist/{usePagination-CrC-1v4L.js → usePagination-BRcQJkO1.js} +1 -1
  137. package/dist/useWhatsappAccount-BOJ8fz84.js +62 -0
  138. package/dist/{user-CrylHgF1.js → user-vBZFKqXQ.js} +1 -1
  139. package/dist/vue-i18n-Cw6fF11e.js +2365 -0
  140. package/dist/{xlsx-CJNYF7-l.js → xlsx-Muy_Rjhk.js} +440 -440
  141. package/dist/{zod-Dzn9S95S.js → zod-CCPTOeUz.js} +1 -1
  142. package/package.json +12 -3
  143. package/dist/Broadcast-DZ4SP99P.js +0 -271
  144. package/dist/Card-B5ni027Q.js +0 -911
  145. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYxswo-Z.js +0 -2430
  146. package/dist/ReviewFacebookCallback-DeZqcpJo.js +0 -238
  147. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BvxbKSkB.js +0 -1882
  148. package/dist/Setting-BOWPp05N.js +0 -2036
  149. package/dist/Settings-DekXvE-R.js +0 -179
  150. package/dist/Store-DpVlMuau.js +0 -1998
  151. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CNDv6eiZ.js +0 -1009
  152. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-C-C3RSeW.js +0 -142
  153. package/dist/Transaction-mvKzTgLx.js +0 -39
  154. package/dist/campaign-Co4Lq-Wz.js +0 -228
  155. package/dist/campaign.fn-DolD3lYJ.js +0 -776
  156. package/dist/export-D0hWZSfH.js +0 -97
  157. package/dist/google-C3S8u0mT.js +0 -4
  158. package/dist/index-aCuOvuEC.js +0 -45
  159. package/dist/objectid-CGol1NeA.js +0 -145
  160. package/dist/rule-builder-DT854ycI.js +0 -102
  161. package/dist/template-BeCVA0-N.js +0 -236
  162. package/dist/vue-i18n-BjtkXdmG.js +0 -2365
@@ -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-DnepoNWn.js";
6
+ import { u as se } from "./loading-CUNk5u1d.js";
7
+ import { u as Fe } from "./app-wDQR6dpb.js";
8
+ import { u as ie } from "./membership-ByJUFP8f.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-iTZLbJGy.js";
11
+ import { m as H } from "./index-BfoDdVQS.js";
12
+ import { z as Ce, R as Re } from "./app-Devzv4gO.js";
13
+ import { Z as _e } from "./zod-CCPTOeUz.js";
14
+ import { _ as he } from "./ImageInput.vue_vue_type_script_setup_true_lang-srSgUY3e.js";
15
+ import "./index-B1jP-_Z_.js";
16
+ import "./index-D34iYRdc.js";
17
+ import "./index-DtcUCknS.js";
18
+ import { b as Pe } from "./index-Byg4ztr-.js";
19
+ import "./index-B7HH6vKF.js";
20
+ import "./index-RwNlbTO8.js";
21
+ import "./index-CZfqqrVu.js";
22
+ import { O as Le } from "./objectid-58gyOvdR.js";
23
+ import { u as Ve } from "./vue-i18n-Cw6fF11e.js";
24
+ import { a as Te, c as Ee } from "./object-BYyQ0PZp.js";
25
+ import { u as ze } from "./business-BjAmUqNA.js";
26
+ import { w as qe } from "./xlsx-Muy_Rjhk.js";
27
+ import { B as Oe, e as je } from "./base.export-CCSMkvAm.js";
28
+ import { u as Ye, _ as Ge } from "./usePagination-BRcQJkO1.js";
29
+ import "./index-BvY2hQac.js";
30
+ import { g as He } from "./user-vBZFKqXQ.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
+ };