@feedmepos/mf-connect 0.1.98-beta.7 → 0.1.98-beta.72

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 (152) hide show
  1. package/dist/{App-BonFFUVJ.js → App-DpYceiwG.js} +812 -666
  2. package/dist/{AuditLogs-CaQisyMC.js → AuditLogs-CG98b2qE.js} +14 -13
  3. package/dist/{Bin-Mu8gAiHw.js → Bin-vdipv2fF.js} +8 -8
  4. package/dist/Broadcast-ChwVqheE.js +303 -0
  5. package/dist/CampaignAnalytic-4PHO849x.js +1830 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BoLZVrCU.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DmnN4pjm.js} +6 -5
  7. package/dist/Card-B6ol3PQw.js +1084 -0
  8. package/dist/{Collections-CByXxRW_.js → Collections-DodNIUr1.js} +14 -13
  9. package/dist/Credit-CJQyAZYw.js +286 -0
  10. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang--FqHJ7Ez.js +53 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CA31QP-A.js +4277 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BXsAX1Xa.js → EffectSheet.vue_vue_type_style_index_0_lang-DkKhdp7G.js} +35 -35
  13. package/dist/{Experience-B7J-aqPK.js → Experience-iLAKddx_.js} +112 -86
  14. package/dist/{FileSaver.min-D_F_MSZt.js → FileSaver.min-w_ExQ0py.js} +1 -1
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js +138 -0
  16. package/dist/Game-DWdUbsAg.js +356 -0
  17. package/dist/GiftCardSetup-DnQ5vwxu.js +736 -0
  18. package/dist/{Grab-C45MmlD9.js → Grab-CFLRHs5w.js} +33 -32
  19. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CPPcB3PC.js → ImageInput.vue_vue_type_script_setup_true_lang-uQJvjvTe.js} +1 -1
  20. package/dist/{Index-vQ6uP49O.js → Index-CUy4z2tS.js} +10 -10
  21. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Cj3hN3tg.js → LocationPicker.vue_vue_type_script_setup_true_lang-hKJ41Fe_.js} +1 -1
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DU9eIein.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BDmtqTVC.js} +1 -1
  23. package/dist/LoyaltyDashboard-C5o7KriA.js +2865 -0
  24. package/dist/MainLayout-Dt0ywph3.js +143 -0
  25. package/dist/{Marketing-B6xMdQvW.js → Marketing-BHwxzBZ0.js} +7 -6
  26. package/dist/{MarketingMaterialEdit-0cZN4bek.js → MarketingMaterialEdit-B6k4ceGx.js} +15 -14
  27. package/dist/Member-DcPZfTj6.js +654 -0
  28. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-CiiBrlHY.js +1279 -0
  29. package/dist/MemberImportHistory-DmPMuu1g.js +187 -0
  30. package/dist/MemberList-f9JejfNW.js +334 -0
  31. package/dist/{MemberTransactions-Bg-ziZy8.js → MemberTransactions-D1YSXeX-.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-jbDJkbZh.js → MessageInput.vue_vue_type_script_setup_true_lang-freeE-DP.js} +5928 -5644
  33. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-m7ytg0ok.js +40 -0
  34. package/dist/Mission-BaaEl5BV.js +360 -0
  35. package/dist/Overview-CviY55Gs.js +1316 -0
  36. package/dist/{Overview-nsyJGSCq.js → Overview-fx-0E3b8.js} +21 -20
  37. package/dist/Point-BfqtflbC.js +288 -0
  38. package/dist/Promotion-Be2ogRYt.js +423 -0
  39. package/dist/{Queue-Dkipt6fw.js → Queue-CLSUL-Cx.js} +14 -13
  40. package/dist/{Record-BFqx6vM-.js → Record-CpTMQT7B.js} +9 -9
  41. package/dist/Review-DzSDx7dY.js +45 -0
  42. package/dist/ReviewFacebookCallback-CvbPJADM.js +238 -0
  43. package/dist/ReviewGoogleCallback-DJlqMbh3.js +213 -0
  44. package/dist/{Reward-DjFEE7I_.js → Reward-DJOmd6Z5.js} +35 -35
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BzZ6VH80.js → RewardGroup.vue_vue_type_script_setup_true_lang-DY9fYxwc.js} +14 -13
  46. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-A9jQX4jt.js → RuleGroup.vue_vue_type_script_setup_true_lang-BgYK4hpo.js} +196 -186
  47. package/dist/{Segment-BAjdUfZ6.js → Segment-G6xmeEaq.js} +275 -276
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CAQPFzRH.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C3O0biLZ.js} +37 -36
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Gkz8jhES.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CWP5sGT7.js} +4 -4
  50. package/dist/{Setting-BK7y0XC-.js → Setting-CKp441AW.js} +14 -14
  51. package/dist/{SettingAdvertisements-DfQ645xr.js → SettingAdvertisements-C4Uf-DgK.js} +12 -12
  52. package/dist/Settings-CTvMVwp6.js +230 -0
  53. package/dist/Store-Bzei6Xev.js +2612 -0
  54. package/dist/{StoreRewards-usHKOGmB.js → StoreRewards-DMQNIpF5.js} +15 -15
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-mm1jbcvo.js +1329 -0
  56. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DrcWUZuR.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BspBXIO2.js} +2 -2
  57. package/dist/{Tier-BF3V430O.js → Tier-BN32RwYr.js} +2580 -754
  58. package/dist/{Title-DwPuqKfJ.js → Title-BIhgfRUI.js} +39 -37
  59. package/dist/Transaction-CPjA7IN9.js +45 -0
  60. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DToNRTJS.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DSutMvfk.js} +26 -26
  61. package/dist/{Voucher-DnhVIl_o.js → Voucher-CGJtn9bC.js} +156 -133
  62. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-Btb3UZCn.js → VoucherEditor.vue_vue_type_script_setup_true_lang-B-IwtPvx.js} +118 -124
  63. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-EFUW9DMY.js → ZodTextField.vue_vue_type_script_setup_true_lang-Ce9xPwqA.js} +2 -2
  64. package/dist/{app-i3r-6ZVm.js → app-DAtx6aZ4.js} +45039 -37428
  65. package/dist/app.js +1 -1
  66. package/dist/base.export-BtRC4aWM.js +75 -0
  67. package/dist/{business-i0Gxk7gG.js → business-BZUIs8Ub.js} +5 -5
  68. package/dist/campaign-B6I6PuY4.js +100 -0
  69. package/dist/campaign-DKjBjV2k.js +398 -0
  70. package/dist/{campaign.enum-CbUTfxek.js → campaign.enum-BQy3e845.js} +1 -1
  71. package/dist/{campaign.fn-BjHSIDd1.js → campaign.fn--qVJ3jeH.js} +77 -77
  72. package/dist/{collectible.enum-DN7E_kHg.js → collectible.enum-vcvRFGl0.js} +1 -1
  73. package/dist/collection.fn-C3bMPBkC.js +26 -0
  74. package/dist/currency--R6VPInw.js +7 -0
  75. package/dist/{duplicateCampaign-DmdJQEIA.js → duplicateCampaign-aIsX9cCi.js} +11 -11
  76. package/dist/{effect-DM4AzeQl.js → effect-CbjmtRph.js} +1 -1
  77. package/dist/{email-addresses-BlqVJhwZ.js → email-addresses-DZKMnoKf.js} +209 -201
  78. package/dist/google-C3S8u0mT.js +4 -0
  79. package/dist/{helper-CkdISSVP.js → helper-BGqw2-RO.js} +1 -1
  80. package/dist/index-7TKoSEJ2.js +14550 -0
  81. package/dist/index-B9DM5Vuv.js +32437 -0
  82. package/dist/index-BWlfW4Kr.js +137 -0
  83. package/dist/{index-Cl8t41Sk.js → index-Bb4TieR_.js} +5 -5
  84. package/dist/{index-D6qeYVNz.js → index-BbpqZrkB.js} +1 -1
  85. package/dist/{index-4EtrCy_K.js → index-C22GPEM-.js} +4 -4
  86. package/dist/{index-FD50UHqf.js → index-CVYbfRGO.js} +105 -123
  87. package/dist/index-CVvSd60O.js +53 -0
  88. package/dist/{index-vI-ndGu_.js → index-CXL5WAH0.js} +5 -5
  89. package/dist/{index-B6xi1soU.js → index-ClP7Xy6Q.js} +1 -1
  90. package/dist/{index-BWsj6lCJ.js → index-D-P90w8K.js} +14 -14
  91. package/dist/{index-CxdLExX0.js → index-D_o9LsHU.js} +24 -9
  92. package/dist/{index-BrboOmPq.js → index-DcA0B-Y5.js} +347 -216
  93. package/dist/index-FnsjvtSo.js +901 -0
  94. package/dist/{index-DgzNGQgE.js → index-LlFZ5kxi.js} +2083 -2559
  95. package/dist/{index-CB7ytKOE.js → index-LnCoUCnx.js} +1588 -1522
  96. package/dist/index-kkhrPH6s.js +151 -0
  97. package/dist/index-v8Zv-2ko.js +72 -0
  98. package/dist/{index.esm2017-BX5CyKoc.js → index.esm2017-DO7bbE7J.js} +132 -132
  99. package/dist/{loading-DTKDhqew.js → loading-CzWOx4tE.js} +1 -1
  100. package/dist/{lodash-CCPBsqhe.js → lodash-B_gr6Ayu.js} +1 -1
  101. package/dist/member-import-BxCrd9tq.js +187 -0
  102. package/dist/membership-ILB4aB4h.js +274 -0
  103. package/dist/{money-wMK3QkZ5.js → money-CpIK1N_r.js} +1 -1
  104. package/dist/{number-DjKVlWn0.js → number-leVwmDCm.js} +1 -1
  105. package/dist/objectid-8hKuNcMN.js +145 -0
  106. package/dist/{plugins-D25PaNJk.js → plugins-DLIgnFIF.js} +13 -12
  107. package/dist/remy-Qz_pNsUS.js +13 -0
  108. package/dist/{reward-E63jqJHm.js → reward-DqT0zF01.js} +1 -1
  109. package/dist/{rule-RVvPtAnk.js → rule-DBtMGLxD.js} +335 -275
  110. package/dist/style.css +1 -1
  111. package/dist/{template-zNxOQaqe.js → template-CYKGCWY4.js} +6 -6
  112. package/dist/timezone-Brs5nrTL.js +20 -0
  113. package/dist/transaction.fn-0ZZcVp-j.js +71 -0
  114. package/dist/{trigger-BXV02FhP.js → trigger-LhNre1L9.js} +17 -17
  115. package/dist/useMarketingMaterialActions-DbDRMmhM.js +96 -0
  116. package/dist/{usePagination-BPcPhEnp.js → usePagination-DmZX0V64.js} +1 -1
  117. package/dist/{user-Bd8S7R5u.js → user-CBPsvnx9.js} +1 -1
  118. package/dist/vue-i18n-BPeSHE3c.js +2365 -0
  119. package/dist/{xlsx-_tQC9Ezf.js → xlsx-Cm3vGmLN.js} +440 -440
  120. package/dist/{zod-C1j2GLZP.js → zod-GTEcy37q.js} +1 -1
  121. package/package.json +10 -6
  122. package/dist/Broadcast-Cy-i-WOT.js +0 -266
  123. package/dist/Card-f2XOtWxp.js +0 -910
  124. package/dist/Credit-CcZF4aQS.js +0 -260
  125. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  126. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C7KZ8GMx.js +0 -3377
  127. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  128. package/dist/Game-CUW7NeVG.js +0 -330
  129. package/dist/LoyaltyDashboard-GqyUwvXz.js +0 -1082
  130. package/dist/MainLayout-R5NxIBR-.js +0 -41
  131. package/dist/Member-CC5F6Bmz.js +0 -280
  132. package/dist/MemberList-Cq4zxopX.js +0 -1601
  133. package/dist/Mission-DcCZ6tAG.js +0 -334
  134. package/dist/Point-D1vLd5hL.js +0 -262
  135. package/dist/Promotion-Cv7MW5RJ.js +0 -397
  136. package/dist/Review-CKhakUMe.js +0 -1123
  137. package/dist/ReviewFacebookCallback-xgRpXQAg.js +0 -243
  138. package/dist/ReviewGoogleCallback-Cqi_43qi.js +0 -208
  139. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DDqK4kV1.js +0 -181
  140. package/dist/Store-uTRQ6KbC.js +0 -1996
  141. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Bb2sTsuA.js +0 -1130
  142. package/dist/Transaction-CnTEfMGU.js +0 -39
  143. package/dist/campaign-CbMlARNI.js +0 -219
  144. package/dist/campaign-f7FT91GR.js +0 -277
  145. package/dist/export-DQR-0lmK.js +0 -97
  146. package/dist/index-COrXX9MR.js +0 -52
  147. package/dist/index-CWiaP-aV.js +0 -28900
  148. package/dist/index-jVfDVEtz.js +0 -85
  149. package/dist/membership-rifuatxU.js +0 -255
  150. package/dist/objectid-DjpWkCxH.js +0 -145
  151. package/dist/useMarketingMaterialActions-5TFNqZVo.js +0 -107
  152. package/dist/vue-i18n-CgMK-TaC.js +0 -2365
@@ -0,0 +1,1084 @@
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-Bb4TieR_.js";
6
+ import { u as se } from "./loading-CzWOx4tE.js";
7
+ import { u as Fe } from "./app-wDQR6dpb.js";
8
+ import { u as ie } from "./membership-ILB4aB4h.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-DLIgnFIF.js";
11
+ import { m as H } from "./index-D_o9LsHU.js";
12
+ import { z as Ce, R as Re } from "./app-DAtx6aZ4.js";
13
+ import { Z as _e } from "./zod-GTEcy37q.js";
14
+ import { _ as he } from "./ImageInput.vue_vue_type_script_setup_true_lang-uQJvjvTe.js";
15
+ import "./index-DcA0B-Y5.js";
16
+ import "./index-LlFZ5kxi.js";
17
+ import "./index-LnCoUCnx.js";
18
+ import { b as Pe } from "./index-FnsjvtSo.js";
19
+ import "./index-CXL5WAH0.js";
20
+ import { O as Le } from "./objectid-8hKuNcMN.js";
21
+ import { u as Ve } from "./vue-i18n-BPeSHE3c.js";
22
+ import { a as Te, c as Ee } from "./object-BYyQ0PZp.js";
23
+ import { u as ze } from "./business-BZUIs8Ub.js";
24
+ import { w as qe } from "./xlsx-Cm3vGmLN.js";
25
+ import { B as Oe, e as je } from "./base.export-BtRC4aWM.js";
26
+ import { u as Ye, _ as Ge } from "./usePagination-DmZX0V64.js";
27
+ import "./index-BbpqZrkB.js";
28
+ import { g as He } from "./user-CBPsvnx9.js";
29
+ import { useRouter as Ke } from "vue-router";
30
+ import { o as Qe } from "./objectId-dwaoBfJX.js";
31
+ class Se extends Oe {
32
+ }
33
+ const Ze = { class: "space-y-16" }, Xe = { class: "gap-16 grid grid-cols-2" }, Je = { class: "space-y-16" }, We = {
34
+ key: 0,
35
+ class: "flex flex-col gap-[16px] w-full"
36
+ }, 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({
37
+ __name: "CreateCardSheet",
38
+ emits: ["success", "export"],
39
+ setup(W, { expose: Y, emit: G }) {
40
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y(!1);
41
+ function F(u) {
42
+ p.value = u, u && (s.value = {
43
+ quantity: 1,
44
+ code: "",
45
+ codeConfig: {
46
+ length: 16,
47
+ charset: "1234567890",
48
+ prefix: "",
49
+ suffix: "",
50
+ pattern: "####-####-####-####"
51
+ }
52
+ });
53
+ }
54
+ const s = y({
55
+ quantity: 1,
56
+ code: "",
57
+ codeConfig: {
58
+ length: 16,
59
+ charset: "1234567890",
60
+ prefix: "",
61
+ suffix: "",
62
+ pattern: "####-####-####-####"
63
+ },
64
+ setCardOnBind: !1,
65
+ bundle: void 0
66
+ }), $ = [
67
+ {
68
+ label: "Bulk number",
69
+ value: "bulk",
70
+ sublabel: "Bulk generate unique number"
71
+ },
72
+ {
73
+ label: "Custom number",
74
+ value: "single",
75
+ sublabel: "Enter your own custom number"
76
+ }
77
+ ], k = [
78
+ {
79
+ label: "Alphanumeric",
80
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
81
+ },
82
+ {
83
+ label: "Alphabetic",
84
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
85
+ },
86
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
87
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
88
+ { label: "Numbers", value: "0123456789" },
89
+ { label: "Custom", value: "" }
90
+ ], P = y(k[0].value), B = y("bulk"), a = y(0), i = E(
91
+ () => {
92
+ var u;
93
+ return (u = h.membership.design) == null ? void 0 : u[a.value];
94
+ }
95
+ ), S = y(!1), v = E(
96
+ () => h.sortedStoreCategories.flatMap((u) => u.bundles)
97
+ );
98
+ async function c(u) {
99
+ var m, T;
100
+ if (await ((m = R.value) == null ? void 0 : m.validateInputs()), !L.value) return;
101
+ u.design = (T = i.value) == null ? void 0 : T.image;
102
+ const l = await ke.confirm(
103
+ "",
104
+ "Do you want to export generated card(s)?",
105
+ "Export",
106
+ "Generate and without export"
107
+ );
108
+ console.log(l), await C(
109
+ async () => {
110
+ const A = await H.createCards(u);
111
+ console.log(A), await M("success"), l && await M("export", A);
112
+ },
113
+ {
114
+ message: "Creating card(s)",
115
+ successMessage: "Card(s) created"
116
+ }
117
+ );
118
+ }
119
+ return Y({
120
+ showSheet: F
121
+ }), ge(
122
+ () => s.value.codeConfig.length,
123
+ (u, l) => {
124
+ u != l && (s.value.codeConfig.pattern = "#".repeat(Number(u)));
125
+ }
126
+ ), ge(
127
+ () => s.value.codeConfig.pattern,
128
+ (u, l) => {
129
+ u != l && (s.value.codeConfig.length = (s.value.codeConfig.pattern.match(/#/g) || []).length);
130
+ }
131
+ ), ne(async () => {
132
+ await h.readMemberStore();
133
+ }), (u, l) => {
134
+ 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");
135
+ return f(), I(ue, {
136
+ "max-width": 560,
137
+ "dismiss-away": !0,
138
+ header: "Create collection",
139
+ modelValue: e(p),
140
+ "onUpdate:modelValue": [
141
+ l[19] || (l[19] = (V) => le(p) ? p.value = V : null),
142
+ l[20] || (l[20] = (V) => p.value = V)
143
+ ]
144
+ }, {
145
+ "side-sheet-footer": w(() => [
146
+ r("div", ot, [
147
+ d(j, {
148
+ label: "Save",
149
+ onClick: l[17] || (l[17] = (V) => c(e(s))),
150
+ loading: e(Fe)().isLoading
151
+ }, null, 8, ["loading"]),
152
+ d(j, {
153
+ label: "Cancel",
154
+ type: "button",
155
+ variant: "tertiary",
156
+ onClick: l[18] || (l[18] = (V) => p.value = !1)
157
+ })
158
+ ])
159
+ ]),
160
+ default: w(() => [
161
+ d(de, {
162
+ ref_key: "form",
163
+ ref: R,
164
+ class: "space-y-40",
165
+ onValidationSuccess: l[15] || (l[15] = (V) => L.value = !0),
166
+ onValidationFailed: l[16] || (l[16] = (V) => L.value = !1)
167
+ }, {
168
+ default: w(() => {
169
+ var V, ee, te;
170
+ return [
171
+ r("div", null, [
172
+ l[21] || (l[21] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
173
+ d(T, {
174
+ modelValue: e(B),
175
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => le(B) ? B.value = o : null),
176
+ inline: !1
177
+ }, {
178
+ default: w(() => [
179
+ (f(), D(O, null, J($, (o) => d(m, {
180
+ key: o.value,
181
+ value: o.value,
182
+ label: o.label,
183
+ sublabel: o.sublabel
184
+ }, null, 8, ["value", "label", "sublabel"])), 64))
185
+ ]),
186
+ _: 1
187
+ }, 8, ["modelValue"])
188
+ ]),
189
+ r("div", Ze, [
190
+ l[22] || (l[22] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
191
+ e(B) === "bulk" ? (f(), D(O, { key: 0 }, [
192
+ d(A, {
193
+ "model-value": e(S),
194
+ "label-placement": "right",
195
+ value: "true",
196
+ label: "Advance number setting",
197
+ required: !0,
198
+ "onUpdate:modelValue": l[1] || (l[1] = () => S.value = !e(S))
199
+ }, null, 8, ["model-value"]),
200
+ e(S) ? (f(), D(O, { key: 0 }, [
201
+ d(g, {
202
+ "model-value": e(s).codeConfig.length || null,
203
+ "onUpdate:modelValue": l[2] || (l[2] = (o) => e(s).codeConfig.length = o),
204
+ label: "Code length",
205
+ rules: [(o) => Number(o) >= 1 || "Code length must at least 1"],
206
+ required: !0
207
+ }, null, 8, ["model-value", "rules"]),
208
+ d(_, {
209
+ label: "Charset",
210
+ "model-value": e(P),
211
+ items: k,
212
+ "helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
213
+ "onUpdate:modelValue": l[3] || (l[3] = (o) => {
214
+ P.value = o, e(s).codeConfig.charset = o;
215
+ })
216
+ }, null, 8, ["model-value", "helper-text"]),
217
+ e(P) === "" ? (f(), I(z, {
218
+ key: 0,
219
+ modelValue: e(s).codeConfig.charset,
220
+ "onUpdate:modelValue": l[4] || (l[4] = (o) => e(s).codeConfig.charset = o),
221
+ label: "Custom Charset",
222
+ required: ""
223
+ }, null, 8, ["modelValue"])) : N("", !0),
224
+ r("div", Xe, [
225
+ d(z, {
226
+ modelValue: e(s).codeConfig.prefix,
227
+ "onUpdate:modelValue": l[5] || (l[5] = (o) => e(s).codeConfig.prefix = o),
228
+ label: "Prefix (Optional)"
229
+ }, null, 8, ["modelValue"]),
230
+ d(z, {
231
+ modelValue: e(s).codeConfig.suffix,
232
+ "onUpdate:modelValue": l[6] || (l[6] = (o) => e(s).codeConfig.suffix = o),
233
+ label: "Suffix (Optional)"
234
+ }, null, 8, ["modelValue"])
235
+ ]),
236
+ d(z, {
237
+ modelValue: e(s).codeConfig.pattern,
238
+ "onUpdate:modelValue": l[7] || (l[7] = (o) => e(s).codeConfig.pattern = o),
239
+ label: "Pattern",
240
+ required: !0
241
+ }, null, 8, ["modelValue"])
242
+ ], 64)) : N("", !0),
243
+ d(z, {
244
+ modelValue: e(s).quantity,
245
+ "onUpdate:modelValue": l[8] || (l[8] = (o) => e(s).quantity = o),
246
+ label: "Number of code",
247
+ rules: [
248
+ (o) => o >= 1 || "Quantity cannot be less than 1",
249
+ (o) => o <= 1e4 || "Quantity cannot more than 10,000"
250
+ ],
251
+ required: !0,
252
+ "helper-text": `${e(s).quantity} card will be created`
253
+ }, null, 8, ["modelValue", "rules", "helper-text"])
254
+ ], 64)) : N("", !0),
255
+ e(B) !== "bulk" ? (f(), I(re, {
256
+ key: 1,
257
+ modelValue: e(s).code,
258
+ "onUpdate:modelValue": l[9] || (l[9] = (o) => e(s).code = o),
259
+ label: "Custom Card Number",
260
+ rules: [(o) => e(B) != "single" || !!o || "Custom code is required"],
261
+ placeholder: "(For multiple numbers, please enter in the new row.)"
262
+ }, null, 8, ["modelValue", "rules"])) : N("", !0)
263
+ ]),
264
+ r("div", Je, [
265
+ l[23] || (l[23] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
266
+ d(A, {
267
+ "label-placement": "right",
268
+ label: "Set card number on bind",
269
+ sublabel: "Automatically set the card number when the user binds the card",
270
+ "model-value": e(s).setCardOnBind || !1,
271
+ "onUpdate:modelValue": l[10] || (l[10] = (o) => e(s).setCardOnBind = o)
272
+ }, null, 8, ["model-value"]),
273
+ d(ae, {
274
+ label: "Activate bundle on bind",
275
+ placeholder: "Select bundle",
276
+ items: e(v).filter((o) => !o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
277
+ modelValue: e(s).bundle,
278
+ "onUpdate:modelValue": l[12] || (l[12] = (o) => e(s).bundle = o)
279
+ }, {
280
+ append: w(() => [
281
+ e(s).bundle ? (f(), I(j, {
282
+ key: 0,
283
+ icon: "link_off",
284
+ variant: "plain",
285
+ onClick: l[11] || (l[11] = (o) => e(s).bundle = void 0)
286
+ })) : N("", !0)
287
+ ]),
288
+ _: 1
289
+ }, 8, ["items", "modelValue"]),
290
+ (ee = (V = e(h).store) == null ? void 0 : V.stripe) != null && ee.apiKey ? (f(), I(ae, {
291
+ key: 0,
292
+ label: "Linked subscription bundle",
293
+ placeholder: "Select bundle",
294
+ items: e(v).filter((o) => o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
295
+ modelValue: e(s).subscriptionBundle,
296
+ "onUpdate:modelValue": l[14] || (l[14] = (o) => e(s).subscriptionBundle = o)
297
+ }, {
298
+ append: w(() => [
299
+ e(s).subscriptionBundle ? (f(), I(j, {
300
+ key: 0,
301
+ icon: "link_off",
302
+ variant: "plain",
303
+ onClick: l[13] || (l[13] = (o) => e(s).subscriptionBundle = void 0)
304
+ })) : N("", !0)
305
+ ]),
306
+ _: 1
307
+ }, 8, ["items", "modelValue"])) : N("", !0)
308
+ ]),
309
+ e(h).membership.design ? (f(), D("div", We, [
310
+ r("div", et, [
311
+ l[24] || (l[24] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
312
+ r("img", {
313
+ src: (te = e(i)) == null ? void 0 : te.image,
314
+ class: "aspect-[16/9]"
315
+ }, null, 8, tt),
316
+ r("div", lt, [
317
+ (f(!0), D(O, null, J(e(h).membership.design, (o, K) => (f(), D("img", {
318
+ src: o.image,
319
+ key: `image_${K}`,
320
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e(a) === K ? "border-[2px] border-fm-color-primary" : ""}`]),
321
+ onClick: (me) => a.value = K,
322
+ alt: `ai_image_predict_${K}`,
323
+ style: { objectFit: "cover" }
324
+ }, null, 10, at))), 128))
325
+ ])
326
+ ])
327
+ ])) : N("", !0)
328
+ ];
329
+ }),
330
+ _: 1
331
+ }, 512)
332
+ ]),
333
+ _: 1
334
+ }, 8, ["modelValue"]);
335
+ };
336
+ }
337
+ }), st = { class: "space-y-16" }, it = {
338
+ key: 0,
339
+ class: "flex flex-col gap-[16px] w-full"
340
+ }, 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({
341
+ __name: "EditCardSheet",
342
+ emits: ["success"],
343
+ setup(W, { expose: Y, emit: G }) {
344
+ const { minor: C } = se, h = ie(), R = y(), L = y(!1), M = G, p = y({
345
+ _id: "",
346
+ business: "",
347
+ serialNumber: ""
348
+ }), F = y(!1);
349
+ function s(a, i) {
350
+ var S;
351
+ F.value = a, a && i && (p.value = i, $.value = (S = h.membership.design) == null ? void 0 : S.findIndex(
352
+ (v) => v.image === i.design
353
+ ));
354
+ }
355
+ const $ = y(0), k = E(
356
+ () => {
357
+ var a;
358
+ return (a = h.membership.design) == null ? void 0 : a[$.value];
359
+ }
360
+ ), P = E(
361
+ () => h.sortedStoreCategories.flatMap(
362
+ (a) => a.bundles
363
+ )
364
+ );
365
+ async function B(a) {
366
+ var i, S;
367
+ await ((i = R.value) == null ? void 0 : i.validateInputs()), L.value && (a.design = (S = k.value) == null ? void 0 : S.image, await C(
368
+ async () => {
369
+ await H.updateCard(a), await M("success");
370
+ },
371
+ {
372
+ message: "Updating card",
373
+ successMessage: "Card updated"
374
+ }
375
+ ));
376
+ }
377
+ return Y({
378
+ showSheet: s
379
+ }), ne(async () => {
380
+ await h.readMemberStore();
381
+ }), (a, i) => {
382
+ const S = b("FmTextField"), v = b("FmSwitch"), c = b("FmButton"), u = b("FmForm"), l = b("FmSideSheet");
383
+ return f(), I(l, {
384
+ "max-width": 560,
385
+ "dismiss-away": !0,
386
+ header: "Edit card",
387
+ modelValue: e(F),
388
+ "onUpdate:modelValue": [
389
+ i[10] || (i[10] = (m) => le(F) ? F.value = m : null),
390
+ i[11] || (i[11] = (m) => F.value = m)
391
+ ]
392
+ }, {
393
+ "side-sheet-footer": w(() => [
394
+ r("div", mt, [
395
+ d(c, {
396
+ label: "Save",
397
+ disabled: !!e(p).redeemedAt,
398
+ onClick: i[8] || (i[8] = (m) => B(e(p))),
399
+ loading: e(Fe)().isLoading
400
+ }, null, 8, ["disabled", "loading"]),
401
+ d(c, {
402
+ label: "Cancel",
403
+ type: "button",
404
+ variant: "tertiary",
405
+ onClick: i[9] || (i[9] = (m) => F.value = !1)
406
+ })
407
+ ])
408
+ ]),
409
+ default: w(() => [
410
+ d(u, {
411
+ ref_key: "form",
412
+ ref: R,
413
+ class: "space-y-40",
414
+ onValidationSuccess: i[6] || (i[6] = (m) => L.value = !0),
415
+ onValidationFailed: i[7] || (i[7] = (m) => L.value = !1)
416
+ }, {
417
+ default: w(() => {
418
+ var m, T, A;
419
+ return [
420
+ r("div", st, [
421
+ d(S, {
422
+ modelValue: e(p).serialNumber,
423
+ "onUpdate:modelValue": i[0] || (i[0] = (g) => e(p).serialNumber = g),
424
+ label: "Card Number",
425
+ rules: [
426
+ e(_e).toRule(e(Ce).string().min(1, "Card number is required")),
427
+ e(_e).toRule(
428
+ e(Ce).string().max(50, "Card number must be less than 50 characters")
429
+ )
430
+ ],
431
+ required: !0
432
+ }, null, 8, ["modelValue", "rules"]),
433
+ i[12] || (i[12] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
434
+ d(v, {
435
+ "label-placement": "right",
436
+ label: "Set card number on bind",
437
+ "model-value": e(p).setCardOnBind || !1,
438
+ "onUpdate:modelValue": i[1] || (i[1] = (g) => e(p).setCardOnBind = g)
439
+ }, null, 8, ["model-value"]),
440
+ d(ae, {
441
+ label: "Activate bundle on bind",
442
+ placeholder: "Select bundle",
443
+ items: e(P).filter((g) => !g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
444
+ modelValue: e(p).bundle,
445
+ "onUpdate:modelValue": i[3] || (i[3] = (g) => e(p).bundle = g)
446
+ }, {
447
+ append: w(() => [
448
+ e(p).bundle ? (f(), I(c, {
449
+ key: 0,
450
+ icon: "link_off",
451
+ variant: "plain",
452
+ onClick: i[2] || (i[2] = (g) => e(p).bundle = null)
453
+ })) : N("", !0)
454
+ ]),
455
+ _: 1
456
+ }, 8, ["items", "modelValue"]),
457
+ (T = (m = e(h).store) == null ? void 0 : m.stripe) != null && T.apiKey ? (f(), I(ae, {
458
+ key: 0,
459
+ label: "Linked subscription bundle",
460
+ placeholder: "Select bundle",
461
+ items: e(P).filter((g) => g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
462
+ modelValue: e(p).subscriptionBundle,
463
+ "onUpdate:modelValue": i[5] || (i[5] = (g) => e(p).subscriptionBundle = g)
464
+ }, {
465
+ append: w(() => [
466
+ e(p).subscriptionBundle ? (f(), I(c, {
467
+ key: 0,
468
+ icon: "link_off",
469
+ variant: "plain",
470
+ onClick: i[4] || (i[4] = (g) => e(p).subscriptionBundle = null)
471
+ })) : N("", !0)
472
+ ]),
473
+ _: 1
474
+ }, 8, ["items", "modelValue"])) : N("", !0)
475
+ ]),
476
+ e(h).membership.design ? (f(), D("div", it, [
477
+ r("div", rt, [
478
+ i[13] || (i[13] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
479
+ r("img", {
480
+ src: (A = e(k)) == null ? void 0 : A.image,
481
+ class: "aspect-[16/9]"
482
+ }, null, 8, dt),
483
+ r("div", ut, [
484
+ (f(!0), D(O, null, J(e(h).membership.design, (g, _) => (f(), D("img", {
485
+ src: g.image,
486
+ key: `image_${_}`,
487
+ class: we(["w-[112px] h-[63px] cursor-pointer", `${e($) === _ ? "border-[2px] border-fm-color-primary" : ""}`]),
488
+ onClick: (z) => $.value = _,
489
+ alt: `ai_image_predict_${_}`,
490
+ style: { objectFit: "cover" }
491
+ }, null, 10, ct))), 128))
492
+ ])
493
+ ])
494
+ ])) : N("", !0)
495
+ ];
496
+ }),
497
+ _: 1
498
+ }, 512)
499
+ ]),
500
+ _: 1
501
+ }, 8, ["modelValue"]);
502
+ };
503
+ }
504
+ }), ft = {
505
+ key: 0,
506
+ class: "grid grid-cols-2 gap-8"
507
+ }, gt = { class: "flex items-center gap-8" }, bt = { class: "flex items-center gap-8" }, yt = 5, vt = /* @__PURE__ */ oe({
508
+ __name: "CardDesignSheet",
509
+ emits: ["success"],
510
+ setup(W, { expose: Y, emit: G }) {
511
+ const { t: C } = Ve(), { minor: h } = se, R = ie(), L = Ne(), M = y(!1);
512
+ y(), y(!1);
513
+ const p = y(), F = y(null);
514
+ E(() => {
515
+ var v, c;
516
+ return Math.min((((c = (v = p.value) == null ? void 0 : v.design) == null ? void 0 : c.length) ?? 0) + 1, yt);
517
+ });
518
+ const s = G, $ = E(() => {
519
+ var v, c;
520
+ return ((c = (v = R.membership) == null ? void 0 : v.design) == null ? void 0 : c.filter((u) => u.image)) || [];
521
+ }), k = y(!1);
522
+ function P(v) {
523
+ k.value = v;
524
+ }
525
+ function B() {
526
+ M.value = !0;
527
+ }
528
+ async function a() {
529
+ await h(
530
+ async () => {
531
+ var u;
532
+ const v = Te(p.value), c = Pe.parse(v);
533
+ if (c.design = (c == null ? void 0 : c.design) || [], F.value) {
534
+ const l = Le().toHexString(), m = await xe.update(
535
+ xe.designPath(l, F.value),
536
+ F.value
537
+ );
538
+ (u = c.design) == null || u.push({
539
+ _id: l,
540
+ image: m
541
+ });
542
+ }
543
+ await H.update(c), await S(), await s("success"), F.value = null, M.value = !1;
544
+ },
545
+ {
546
+ message: "Saving card design",
547
+ successMessage: "Card design saved"
548
+ }
549
+ );
550
+ }
551
+ async function i(v, c) {
552
+ v ? F.value = v : c && L.open({
553
+ title: "Delete Design",
554
+ message: "Are you sure you want to delete this design?",
555
+ primaryActions: { text: "Delete", close: !0 },
556
+ secondaryActions: { text: "Cancel", close: !1 }
557
+ }).onPrimary(async () => {
558
+ var l, m;
559
+ const u = (l = p.value.design) == null ? void 0 : l.findIndex((T) => T._id == c);
560
+ console.log(u), u !== -1 && ((m = p.value.design) == null || m.splice(u, 1)), await a();
561
+ }).onSecondary(() => {
562
+ L.close();
563
+ });
564
+ }
565
+ async function S() {
566
+ await R.readMembership(), p.value = R.membership;
567
+ }
568
+ return Y({
569
+ showSheet: P
570
+ }), ne(async () => {
571
+ await S(), $.value.length || (M.value = !0);
572
+ }), (v, c) => {
573
+ const u = b("FmButton"), l = b("FmSideSheet");
574
+ return f(), I(l, {
575
+ "max-width": 560,
576
+ "dismiss-away": !0,
577
+ header: e(C)("connect.loyalty.card.design.title"),
578
+ modelValue: e(k),
579
+ "onUpdate:modelValue": [
580
+ c[2] || (c[2] = (m) => le(k) ? k.value = m : null),
581
+ c[3] || (c[3] = (m) => k.value = m)
582
+ ]
583
+ }, Ie({
584
+ default: w(() => [
585
+ e(M) ? N("", !0) : (f(), D("div", ft, [
586
+ (f(!0), D(O, null, J(e($), (m) => (f(), I(he, {
587
+ key: String(m._id),
588
+ "image-fit": "cover",
589
+ label: "",
590
+ "aspect-ratio": "16/9",
591
+ thumbnail: m.image,
592
+ accept: ".png, .jpg, .jpeg, .gif",
593
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
594
+ file: void 0,
595
+ "delete-button": !1
596
+ }, {
597
+ "delete-button": w(() => [
598
+ d(u, {
599
+ class: "!text-neutral-50 !bg-neutral-700",
600
+ icon: "delete",
601
+ variant: "tertiary",
602
+ onClick: (T) => i(null, m._id)
603
+ }, null, 8, ["onClick"])
604
+ ]),
605
+ _: 2
606
+ }, 1032, ["thumbnail"]))), 128))
607
+ ])),
608
+ e(M) ? (f(), I(he, {
609
+ key: 1,
610
+ "image-fit": "cover",
611
+ label: "",
612
+ "aspect-ratio": "16/9",
613
+ accept: ".png, .jpg, .jpeg, .gif",
614
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
615
+ "onUpdate:file": i
616
+ })) : N("", !0)
617
+ ]),
618
+ _: 2
619
+ }, [
620
+ e(M) ? {
621
+ name: "side-sheet-footer",
622
+ fn: w(() => [
623
+ r("div", bt, [
624
+ d(u, {
625
+ label: e(C)("connect.common.save"),
626
+ onClick: a,
627
+ disabled: !e(F)
628
+ }, null, 8, ["label", "disabled"]),
629
+ d(u, {
630
+ label: e(C)("connect.common.cancel"),
631
+ type: "button",
632
+ variant: "tertiary",
633
+ onClick: c[1] || (c[1] = (m) => M.value = !1)
634
+ }, null, 8, ["label"])
635
+ ])
636
+ ]),
637
+ key: "1"
638
+ } : {
639
+ name: "side-sheet-footer",
640
+ fn: w(() => [
641
+ r("div", gt, [
642
+ d(u, {
643
+ label: e(C)("connect.loyalty.card.design.add"),
644
+ icon: "add",
645
+ onClick: B
646
+ }, null, 8, ["label"]),
647
+ d(u, {
648
+ label: e(C)("connect.common.cancel"),
649
+ type: "button",
650
+ variant: "tertiary",
651
+ onClick: c[0] || (c[0] = (m) => k.value = !1)
652
+ }, null, 8, ["label"])
653
+ ])
654
+ ]),
655
+ key: "0"
656
+ }
657
+ ]), 1032, ["header", "modelValue"]);
658
+ };
659
+ }
660
+ }), 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" }, pl = /* @__PURE__ */ oe({
661
+ __name: "Card",
662
+ setup(W) {
663
+ const Y = Ke();
664
+ function G() {
665
+ Y.push({ name: Re["$connect-STORE"] });
666
+ }
667
+ const C = y(), h = E(() => {
668
+ if (!C.value) return null;
669
+ const t = C.value.totalIssued;
670
+ return t ? Math.round(C.value.claimed / t * 100) : 0;
671
+ });
672
+ function R(t) {
673
+ return t === void 0 ? "—" : String(t);
674
+ }
675
+ const L = E(() => {
676
+ var t, n, U;
677
+ return [
678
+ {
679
+ key: "totalIssued",
680
+ title: a("connect.loyalty.card.stats.totalIssued"),
681
+ value: R((t = C.value) == null ? void 0 : t.totalIssued),
682
+ description: a("connect.loyalty.card.stats.totalIssuedHint")
683
+ },
684
+ {
685
+ key: "claimed",
686
+ title: a("connect.loyalty.card.stats.claimed"),
687
+ value: R((n = C.value) == null ? void 0 : n.claimed),
688
+ description: h.value === null ? "" : a("connect.loyalty.card.stats.claimedHint", {
689
+ rate: h.value
690
+ })
691
+ },
692
+ {
693
+ key: "unclaimed",
694
+ title: a("connect.loyalty.card.stats.unclaimed"),
695
+ value: R((U = C.value) == null ? void 0 : U.unclaimed),
696
+ description: a("connect.loyalty.card.stats.unclaimedHint")
697
+ }
698
+ ];
699
+ });
700
+ async function M() {
701
+ try {
702
+ C.value = await H.readCardStats();
703
+ } catch (t) {
704
+ C.value = void 0, console.error("Failed to load card stats", t);
705
+ }
706
+ }
707
+ const { minor: p, global: F } = se, s = y(), $ = y(), k = y(), P = ze(), B = ie(), { t: a } = Ve(), i = E(
708
+ () => B.sortedStoreCategories.flatMap((t) => t.bundles)
709
+ );
710
+ function S(t) {
711
+ return !!t.member || !!t.redeemedAt;
712
+ }
713
+ function v(t) {
714
+ return t.giftCard ? a("connect.loyalty.card.table.typeGiftCard") : a("connect.loyalty.card.table.typeRedemption");
715
+ }
716
+ function c(t) {
717
+ var n;
718
+ return t.giftCard ? `${t.giftCard.programName} · RM${t.giftCard.amount}` : ((n = i.value.find((U) => U._id === t.bundle)) == null ? void 0 : n.name) || "-";
719
+ }
720
+ function u(t) {
721
+ return S(t) ? a("connect.loyalty.card.table.statusClaimed") : a("connect.loyalty.card.table.statusUnclaimed");
722
+ }
723
+ function l(t) {
724
+ return ye(Qe(t._id.toString())).format(
725
+ "DD MMM YYYY hh:mmA"
726
+ );
727
+ }
728
+ function m(t) {
729
+ return t.redeemedAt ? ye(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-";
730
+ }
731
+ const T = [
732
+ {
733
+ header: a("connect.loyalty.card.table.card_number"),
734
+ accessorFn: (t) => t.serialNumber
735
+ },
736
+ {
737
+ header: a("connect.loyalty.card.table.type"),
738
+ accessorFn: v
739
+ },
740
+ {
741
+ header: a("connect.loyalty.card.table.bundle"),
742
+ accessorFn: c
743
+ },
744
+ {
745
+ header: a("connect.loyalty.card.table.status"),
746
+ accessorKey: "member",
747
+ enableSorting: !1,
748
+ cell(t) {
749
+ const n = S(t.row.original);
750
+ return be(ve.FmChip, {
751
+ label: u(t.row.original),
752
+ variant: n ? "success" : "plain",
753
+ compact: !0
754
+ });
755
+ }
756
+ },
757
+ {
758
+ header: a("connect.loyalty.card.table.claimed_by"),
759
+ accessorKey: "user",
760
+ enableSorting: !1,
761
+ cell: (t) => t.row.original.pf_member ? He(t.row.original.pf_member) : "-"
762
+ },
763
+ {
764
+ header: a("connect.loyalty.card.table.phone"),
765
+ accessorFn: (t) => {
766
+ var n;
767
+ return ((n = t.pf_member) == null ? void 0 : n.phoneNumber) || "-";
768
+ },
769
+ accessorKey: "pf_member.phoneNumber"
770
+ },
771
+ {
772
+ header: a("connect.loyalty.card.table.created_at"),
773
+ accessorKey: "_id",
774
+ accessorFn: l
775
+ },
776
+ {
777
+ header: a("connect.loyalty.card.table.claimed_at"),
778
+ accessorKey: "redeemedAt",
779
+ accessorFn: m
780
+ },
781
+ {
782
+ header: a("connect.loyalty.card.table.actions"),
783
+ cell(t) {
784
+ return be(ve.FmButton, {
785
+ variant: "tertiary",
786
+ icon: "delete",
787
+ iconColor: "neutral-gray-400",
788
+ disabled: !!t.row.original.redeemedAt || !!t.row.original.giftCard,
789
+ onClick: (n) => {
790
+ n.stopPropagation(), te(t.row.original);
791
+ }
792
+ });
793
+ }
794
+ }
795
+ ], A = y("ALL"), g = E(() => {
796
+ var n, U, Q;
797
+ const t = (Z) => Z === void 0 ? "" : ` ${Z}`;
798
+ return [
799
+ {
800
+ label: `${a("connect.loyalty.card.filters.all")}${t(
801
+ (n = C.value) == null ? void 0 : n.totalIssued
802
+ )}`,
803
+ value: "ALL"
804
+ },
805
+ {
806
+ label: `${a("connect.loyalty.card.table.statusClaimed")}${t(
807
+ (U = C.value) == null ? void 0 : U.claimed
808
+ )}`,
809
+ value: "CLAIMED"
810
+ },
811
+ {
812
+ label: `${a("connect.loyalty.card.table.statusUnclaimed")}${t(
813
+ (Q = C.value) == null ? void 0 : Q.unclaimed
814
+ )}`,
815
+ value: "UNCLAIMED"
816
+ }
817
+ ];
818
+ }), { tableMeta: _, rowData: z, onSort: re, debouncedFetchData: j, onSearch: de } = Ye(
819
+ (t) => (
820
+ // `usePagination` accepts any fetch function, so the filter rides along with
821
+ // its pagination params instead of the composable needing to know about it.
822
+ H.readCards({
823
+ ...t,
824
+ status: A.value === "ALL" ? void 0 : A.value
825
+ })
826
+ )
827
+ );
828
+ function ue(t) {
829
+ A.value = t, V({ pageIndex: 0, pageSize: _.value.pageSize });
830
+ }
831
+ async function V(t) {
832
+ var n;
833
+ await Promise.all([M(), j(t)]), (n = s.value) == null || n.showSheet(!1);
834
+ }
835
+ const ee = E(() => P.isPremium ? [
836
+ {
837
+ label: a("connect.loyalty.card.actions.manage_design"),
838
+ value: "design",
839
+ isPrimary: !1
840
+ },
841
+ {
842
+ label: a("connect.loyalty.card.actions.create"),
843
+ value: "create",
844
+ isPrimary: !0,
845
+ prependIcon: "add"
846
+ }
847
+ ] : []);
848
+ async function te(t) {
849
+ await ke.remove(
850
+ `Are you sure you want to remove card ${t.serialNumber}?`
851
+ ) && await p(
852
+ async () => {
853
+ await H.deleteCard(t._id.toString()), await j({ pageSize: 10, pageIndex: 0 });
854
+ },
855
+ {
856
+ message: `Removing card ${t.serialNumber}`,
857
+ successMessage: `Removed card ${t.serialNumber} successfully`
858
+ }
859
+ );
860
+ }
861
+ async function o() {
862
+ return je({
863
+ exporter: new Se(),
864
+ readFunction: (t) => H.readCards({
865
+ ...t,
866
+ search: _.value.searchValue,
867
+ status: A.value === "ALL" ? void 0 : A.value
868
+ }),
869
+ transformRecord: (t) => {
870
+ var n, U;
871
+ return {
872
+ "Card Number": t.serialNumber,
873
+ Type: v(t),
874
+ Bundle: c(t),
875
+ Status: u(t),
876
+ "Claimed by": ((n = t.pf_member) == null ? void 0 : n.name) || "-",
877
+ Phone: ((U = t.pf_member) == null ? void 0 : U.phoneNumber) || "-",
878
+ "Created at": l(t),
879
+ "Claimed at": m(t)
880
+ };
881
+ },
882
+ filename: "cards"
883
+ });
884
+ }
885
+ async function K(t) {
886
+ if (!t || t.length === 0)
887
+ return;
888
+ const n = new Se(), U = t.map((Q) => ({
889
+ "Card Number": Q
890
+ }));
891
+ n.addRecords(U), await qe(
892
+ n.buildExcel(),
893
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
894
+ {
895
+ bookType: "xlsx",
896
+ bookSST: !1,
897
+ type: "array"
898
+ }
899
+ );
900
+ }
901
+ const me = (t) => {
902
+ var n;
903
+ if (t.redeemedAt || t.giftCard) {
904
+ De.error("Update not permitted", 2e3);
905
+ return;
906
+ }
907
+ (n = $ == null ? void 0 : $.value) == null || n.showSheet(!0, t);
908
+ };
909
+ return ne(async () => {
910
+ await F(async () => {
911
+ await P.readPremium(), await B.readMemberStore(), await B.readMembership(), await V();
912
+ });
913
+ }), (t, n) => {
914
+ const U = b("FmPill"), Q = b("FmPageHead"), Z = b("FmIcon"), pe = b("FmCard"), $e = b("FmTabs"), Ae = b("FmSearch"), ce = b("FmButton");
915
+ return f(), D(O, null, [
916
+ d(Q, {
917
+ title: e(a)("connect.loyalty.card.title"),
918
+ actions: e(ee),
919
+ "onClick:action": n[0] || (n[0] = (x) => {
920
+ var X, fe;
921
+ console.log(x), x === "design" && ((X = e(k)) == null || X.showSheet(!0)), x === "create" && ((fe = e(s)) == null || fe.showSheet(!0));
922
+ })
923
+ }, {
924
+ title: w(() => [
925
+ r("div", xt, [
926
+ r("div", Ct, [
927
+ r("span", _t, q(e(a)("connect.loyalty.card.title")), 1),
928
+ d(U, {
929
+ class: "ml-8",
930
+ variant: "premium"
931
+ })
932
+ ]),
933
+ r("span", ht, q(e(a)("connect.loyalty.card.description")), 1)
934
+ ])
935
+ ]),
936
+ _: 1
937
+ }, 8, ["title", "actions"]),
938
+ r("div", St, [
939
+ r("div", wt, [
940
+ d(Z, {
941
+ name: "info",
942
+ size: "sm",
943
+ class: "text-fm-color-primary flex-none"
944
+ }),
945
+ r("span", Ft, q(e(a)("connect.loyalty.card.giftCardSignpost")), 1),
946
+ r("button", {
947
+ type: "button",
948
+ class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-primary",
949
+ onClick: G
950
+ }, [
951
+ Me(q(e(a)("connect.loyalty.card.giftCardSignpostAction")) + " ", 1),
952
+ d(Z, {
953
+ name: "arrow_forward",
954
+ size: "sm"
955
+ })
956
+ ])
957
+ ]),
958
+ r("div", kt, [
959
+ (f(!0), D(O, null, J(e(L), (x) => (f(), I(pe, {
960
+ key: x.key,
961
+ variant: "outlined",
962
+ class: "flex flex-col gap-8 p-16"
963
+ }, {
964
+ default: w(() => [
965
+ r("div", Vt, q(x.title), 1),
966
+ r("div", $t, q(x.value), 1),
967
+ r("div", At, q(x.description), 1)
968
+ ]),
969
+ _: 2
970
+ }, 1024))), 128))
971
+ ]),
972
+ e(z).length > 0 || e(z).length <= 0 && e(_).searchValue || e(_).pageCount > 0 ? (f(), D(O, { key: 0 }, [
973
+ r("div", It, [
974
+ r("div", Mt, [
975
+ d($e, {
976
+ "model-value": e(A),
977
+ items: e(g),
978
+ "onUpdate:modelValue": ue
979
+ }, null, 8, ["model-value", "items"])
980
+ ]),
981
+ r("div", Bt, [
982
+ d(Ae, {
983
+ modelValue: e(_).searchValue,
984
+ "onUpdate:modelValue": [
985
+ n[1] || (n[1] = (x) => e(_).searchValue = x),
986
+ e(de)
987
+ ],
988
+ placeholder: e(a)("connect.loyalty.card.searchPlaceholder")
989
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
990
+ d(ce, {
991
+ icon: "ios_share",
992
+ variant: "tertiary",
993
+ onClick: Be(o, ["prevent"])
994
+ })
995
+ ])
996
+ ]),
997
+ d(Ge, {
998
+ loading: e(_).isLoading,
999
+ "row-data": e(z),
1000
+ "row-count": e(_).totalRows,
1001
+ "column-defs": T,
1002
+ "shrink-at": !1,
1003
+ "page-count": e(_).pageCount,
1004
+ "page-index": e(_).pageIndex,
1005
+ "page-size": e(_).pageSize,
1006
+ onSortChange: e(re),
1007
+ onPageChange: n[2] || (n[2] = (x) => {
1008
+ e(j)({
1009
+ pageSize: x.pageSize,
1010
+ pageIndex: x.pageIndex
1011
+ });
1012
+ }),
1013
+ onRowClick: n[3] || (n[3] = (x) => {
1014
+ me(e(Ee)(x.original));
1015
+ })
1016
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
1017
+ ], 64)) : (f(), I(pe, {
1018
+ key: 1,
1019
+ variant: "outlined",
1020
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
1021
+ }, {
1022
+ default: w(() => [
1023
+ n[8] || (n[8] = r("img", {
1024
+ src: Ue,
1025
+ class: "aspect-square w-[150px]"
1026
+ }, null, -1)),
1027
+ r("div", Ut, [
1028
+ r("div", Nt, q(e(a)("connect.loyalty.card.empty_state.title")), 1),
1029
+ r("div", Dt, q(e(a)("connect.loyalty.card.empty_state.description")), 1)
1030
+ ]),
1031
+ r("div", Rt, [
1032
+ d(ce, {
1033
+ variant: "primary",
1034
+ label: e(a)("connect.loyalty.card.actions.add"),
1035
+ icon: "add",
1036
+ disabled: !e(P).isPremium,
1037
+ onClick: n[4] || (n[4] = () => {
1038
+ var x;
1039
+ return (x = e(s)) == null ? void 0 : x.showSheet(!0);
1040
+ })
1041
+ }, null, 8, ["label", "disabled"]),
1042
+ d(ce, {
1043
+ variant: "secondary",
1044
+ label: e(a)("connect.loyalty.card.actions.manage_design"),
1045
+ disabled: !e(P).isPremium,
1046
+ onClick: n[5] || (n[5] = () => {
1047
+ var x;
1048
+ return (x = e(k)) == null ? void 0 : x.showSheet(!0);
1049
+ })
1050
+ }, null, 8, ["label", "disabled"])
1051
+ ])
1052
+ ]),
1053
+ _: 1
1054
+ })),
1055
+ d(nt, {
1056
+ ref_key: "sheetRef",
1057
+ ref: s,
1058
+ onSuccess: n[6] || (n[6] = (x) => V()),
1059
+ onExport: K
1060
+ }, null, 512),
1061
+ d(vt, {
1062
+ ref_key: "designSheetRef",
1063
+ ref: k,
1064
+ onSuccess: V
1065
+ }, null, 512),
1066
+ d(pt, {
1067
+ ref_key: "editSheetRef",
1068
+ ref: $,
1069
+ onSuccess: n[7] || (n[7] = (x) => {
1070
+ var X;
1071
+ V({
1072
+ pageSize: e(_).pageSize,
1073
+ pageIndex: e(_).pageIndex
1074
+ }), (X = e($)) == null || X.showSheet(!1);
1075
+ })
1076
+ }, null, 512)
1077
+ ])
1078
+ ], 64);
1079
+ };
1080
+ }
1081
+ });
1082
+ export {
1083
+ pl as default
1084
+ };