@feedmepos/mf-connect 0.1.98-beta.52 → 0.1.98-beta.53

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 (120) hide show
  1. package/dist/{App-C9-lD2Hw.js → App-GVbZXaOb.js} +8 -8
  2. package/dist/{AuditLogs-mVSa1e2d.js → AuditLogs-COC3VF6K.js} +10 -10
  3. package/dist/{Bin-CHSDqvyp.js → Bin-BqN1F26B.js} +8 -8
  4. package/dist/{Broadcast-BUEwwGv8.js → Broadcast-BXP5eA1_.js} +11 -11
  5. package/dist/{CampaignAnalytic-D_qHmP-j.js → CampaignAnalytic-B3Vm1qDu.js} +6 -6
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DEzM1EH8.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CkX0_HxH.js} +7 -7
  7. package/dist/Card-UnclF25U.js +1084 -0
  8. package/dist/{Collections-CERrTLRX.js → Collections-DjrrHxTV.js} +8 -8
  9. package/dist/{Credit-JxLtbWS-.js → Credit-DoDJIxEC.js} +12 -12
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DKIxsZIb.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BM_btYhW.js} +34 -34
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Bu486h20.js → EffectSheet.vue_vue_type_style_index_0_lang-ftrIH_p9.js} +6 -6
  12. package/dist/{Experience-C-9zbUbV.js → Experience-Dr2Arehy.js} +12 -12
  13. package/dist/{FileSaver.min-B4bNs8iH.js → FileSaver.min-D9YchN9l.js} +1 -1
  14. package/dist/{Game-BYV8NF0m.js → Game-3dq-RL7M.js} +13 -13
  15. package/dist/{GiftCardSetup-CJi_--PA.js → GiftCardSetup-DD1r4qll.js} +9 -9
  16. package/dist/{Grab-Bgm7CS6o.js → Grab-Ca0WiQpm.js} +9 -9
  17. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CuC8sOKH.js → ImageInput.vue_vue_type_script_setup_true_lang-D66OFyD2.js} +1 -1
  18. package/dist/{Index-sjstmJ91.js → Index-8kZCkUM2.js} +10 -10
  19. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-Dk1_IA4x.js → LocationPicker.vue_vue_type_script_setup_true_lang-CUCAO-YP.js} +1 -1
  20. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-1COn62uz.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Cggoq2NY.js} +1 -1
  21. package/dist/{LoyaltyDashboard-D6d8uvqc.js → LoyaltyDashboard-DT-hdzf3.js} +10 -10
  22. package/dist/{MainLayout-JJUJwFTJ.js → MainLayout-7w0y1egK.js} +3 -3
  23. package/dist/{Marketing-DRCAImhs.js → Marketing-DPJc-3ff.js} +4 -4
  24. package/dist/{MarketingMaterialEdit-KiR6qhk6.js → MarketingMaterialEdit-D-hqhuMF.js} +6 -6
  25. package/dist/{Member-RbLwG_XD.js → Member-CkRqgHe4.js} +7 -7
  26. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-CKuNtryb.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dl8u5fl6.js} +23 -23
  27. package/dist/{MemberImportHistory-CSMmUYaF.js → MemberImportHistory-DAQ65F9g.js} +7 -7
  28. package/dist/{MemberList-CKe9oSOX.js → MemberList-D5FzPL99.js} +14 -14
  29. package/dist/{MemberTransactions-Cz9oW1ZB.js → MemberTransactions-DZaibYxC.js} +1 -1
  30. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Czt1s9hi.js → MessageInput.vue_vue_type_script_setup_true_lang-6xakpZEo.js} +10 -10
  31. package/dist/{Mission-PgkkwDkY.js → Mission-PXCFl4e-.js} +13 -13
  32. package/dist/{Overview-BiQvzE6U.js → Overview-BOlwqxBU.js} +19 -19
  33. package/dist/{Overview-kvJ0MdN-.js → Overview-CcDElaj4.js} +3 -3
  34. package/dist/{Point-q1JBP2YV.js → Point-CDSO_YG3.js} +12 -12
  35. package/dist/{Promotion-D4mlfhUW.js → Promotion-DVw7hepB.js} +13 -13
  36. package/dist/{Queue-C073ieg_.js → Queue-DUb4qqpc.js} +11 -11
  37. package/dist/{Record-BzrKG6WO.js → Record-r2Bj4Y-2.js} +9 -9
  38. package/dist/{Review-Ddzsk4S5.js → Review-D5sC1CpN.js} +2 -2
  39. package/dist/{ReviewFacebookCallback-B85JCrQU.js → ReviewFacebookCallback-C-pIS4uj.js} +5 -5
  40. package/dist/{ReviewGoogleCallback-DdK3pD4V.js → ReviewGoogleCallback-wKBmFpBe.js} +5 -5
  41. package/dist/{Reward-CG9HGB8d.js → Reward-eY6C0L7i.js} +16 -16
  42. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BSv9kF2a.js → RewardGroup.vue_vue_type_script_setup_true_lang-CEXYfR09.js} +12 -12
  43. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CpUO-nFy.js → RuleGroup.vue_vue_type_script_setup_true_lang-ifUAqLwG.js} +15 -15
  44. package/dist/{Segment-V_LOxVT5.js → Segment-CKXmFk6Q.js} +25 -25
  45. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-CrscmyI5.js → SelectItems.vue_vue_type_script_setup_true_lang-DD7KLdTt.js} +2 -2
  46. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DEg68hNO.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Bl3KaAjj.js} +13 -13
  47. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BFlPOyFp.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-tpcHzd48.js} +4 -4
  48. package/dist/{Setting-DHop8c8g.js → Setting-K-x016Eq.js} +14 -14
  49. package/dist/{SettingAdvertisements-YHMTZE3J.js → SettingAdvertisements-BGznpHIH.js} +12 -12
  50. package/dist/{Settings-BCaNCpJT.js → Settings-CrPLvP2-.js} +5 -5
  51. package/dist/{Store-Cs_8_ngC.js → Store-PbvFQ03o.js} +219 -222
  52. package/dist/{StoreRewards-DFoUaW2a.js → StoreRewards-pYNbeyOQ.js} +15 -15
  53. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C5YoHPxm.js +1329 -0
  54. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D5O5DKbh.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DOyli0Kj.js} +2 -2
  55. package/dist/{Tier-BmQh3fVh.js → Tier-BHlyTQfq.js} +25 -25
  56. package/dist/{Title-UT4g--1-.js → Title-CSuSHz1O.js} +22 -22
  57. package/dist/{Transaction-ESFus2Ol.js → Transaction-bKcfOmz1.js} +2 -2
  58. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BGh_tZBk.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-C6Pb93cp.js} +6 -6
  59. package/dist/{Voucher-DZL9Fdg9.js → Voucher-D_zf4aRU.js} +14 -14
  60. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BAQ9jtAM.js → VoucherEditor.vue_vue_type_script_setup_true_lang-D1VBWUFD.js} +12 -12
  61. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DYQUgY-k.js → ZodTextField.vue_vue_type_script_setup_true_lang-CRz6uhOz.js} +2 -2
  62. package/dist/{app-C38mcv88.js → app-DsVK_Z9F.js} +92 -67
  63. package/dist/app.js +1 -1
  64. package/dist/base.export-wsjx1b1F.js +75 -0
  65. package/dist/{business-2oH_ru_8.js → business-emEflb7G.js} +1 -1
  66. package/dist/{campaign-CMZqifqP.js → campaign-CH1zEmK_.js} +8 -8
  67. package/dist/{campaign-Bjso0Xy2.js → campaign-CczdPZEx.js} +2 -2
  68. package/dist/{campaign.enum-Y6SY-diZ.js → campaign.enum-jb40hQyq.js} +1 -1
  69. package/dist/{campaign.fn-FdFgkYSj.js → campaign.fn-ZvIMg3Jv.js} +125 -125
  70. package/dist/{collectible.enum-MBCR_vBG.js → collectible.enum-Q0sMqRej.js} +1 -1
  71. package/dist/{collection.fn-BXNobS3V.js → collection.fn-CpOJTvnW.js} +2 -2
  72. package/dist/currency-nVkRZfQp.js +7 -0
  73. package/dist/{duplicateCampaign-XPBqYkWX.js → duplicateCampaign-DszCNBjZ.js} +2 -2
  74. package/dist/{effect-DIBdj1V2.js → effect-De3cFxjA.js} +1 -1
  75. package/dist/{email-addresses-DV4VUh2g.js → email-addresses-BENEAxtQ.js} +2 -2
  76. package/dist/{helper-aWWZOhk-.js → helper-DjTmaBve.js} +1 -1
  77. package/dist/{index-DVA1kIwN.js → index-B-GBUWJi.js} +47 -46
  78. package/dist/{index-Pz3KsQfw.js → index-BEU1eux8.js} +1 -1
  79. package/dist/{index-CHhk4SQx.js → index-BH4TDRw4.js} +2 -2
  80. package/dist/{index-DlzhY2Gz.js → index-BMQVCeHN.js} +7 -7
  81. package/dist/{index-BGZVdX7n.js → index-BanLR_f4.js} +2 -2
  82. package/dist/{index-DafINJH8.js → index-Bj_LrRir.js} +1 -1
  83. package/dist/{index-DbULfnV3.js → index-BlsV0pDI.js} +7 -7
  84. package/dist/{index-WVDXkuyC.js → index-BxRbdJOU.js} +1 -1
  85. package/dist/{index-Dps3MKMS.js → index-CKfVSZcR.js} +2 -2
  86. package/dist/{index-BDxwnonR.js → index-DEtIu7G-.js} +3 -3
  87. package/dist/{index-C567s8tj.js → index-DlAwtfWQ.js} +3 -3
  88. package/dist/{index-HQFexw0Z.js → index-DrSpG2nV.js} +1 -1
  89. package/dist/{index-CeXhFaZg.js → index-DsviWEPT.js} +5 -5
  90. package/dist/{index-CueUIXPn.js → index-P2yevS6i.js} +1 -1
  91. package/dist/{index-WXnNDUyq.js → index-Wd_vLVMH.js} +3 -3
  92. package/dist/{index-DfXU3JsN.js → index-fl12LmlG.js} +1 -1
  93. package/dist/{index-BW0_NNEE.js → index-p0RFjPyp.js} +1 -1
  94. package/dist/{index-Br-UT1ir.js → index-vV9W0EhO.js} +1 -1
  95. package/dist/{index.esm2017-D9a8Ow55.js → index.esm2017-C-k-2kM3.js} +1 -1
  96. package/dist/{loading-C5r1cx-_.js → loading-TBGTHWt0.js} +1 -1
  97. package/dist/{lodash-BbPpFjHe.js → lodash-qQ2ie1zb.js} +1 -1
  98. package/dist/{member-import-CftPgU92.js → member-import-B_sizua-.js} +1 -1
  99. package/dist/{membership-C7KQ-KXT.js → membership-DJIuI4sn.js} +3 -3
  100. package/dist/{money-CxcffdSc.js → money-BOnCYNt8.js} +1 -1
  101. package/dist/{number-Cqd6VhtH.js → number-GrW7Sgoo.js} +1 -1
  102. package/dist/{objectid-CpTyDbom.js → objectid-DPTR7IEN.js} +12 -12
  103. package/dist/{plugins-BO66KEQi.js → plugins-D80BsQ8l.js} +3 -3
  104. package/dist/{reward-D369xt9c.js → reward-ByHQgT7i.js} +1 -1
  105. package/dist/{rule-Dc83EYyn.js → rule-Djn2x0ov.js} +3 -3
  106. package/dist/{rule-builder-CFK1__-e.js → rule-builder-Dp6YiO8-.js} +1 -1
  107. package/dist/{template-voSvaSNk.js → template-CR7fSIew.js} +6 -6
  108. package/dist/{timezone-DMQW1WZ5.js → timezone-BQH2AZ_H.js} +1 -1
  109. package/dist/{transaction.fn-BoPRNLs9.js → transaction.fn-sp8FkkYr.js} +1 -1
  110. package/dist/{trigger-D2uZtisI.js → trigger-Y9ted5Uv.js} +5 -5
  111. package/dist/{useMarketingMaterialActions-Cfc1aeg0.js → useMarketingMaterialActions-jZ3QuyxF.js} +3 -3
  112. package/dist/{usePagination-D6tENEun.js → usePagination-pzo4ADvP.js} +1 -1
  113. package/dist/{user-lQkrcDz7.js → user-BtkZFzFm.js} +1 -1
  114. package/dist/{vue-i18n-3ow1X-2g.js → vue-i18n-DHFwvj0q.js} +391 -391
  115. package/dist/{xlsx-BtLSi0cI.js → xlsx-BWsO-8j5.js} +1 -1
  116. package/dist/{zod-BkZnH28K.js → zod-BMKVB5Fl.js} +1 -1
  117. package/package.json +1 -1
  118. package/dist/Card-Bzbm3-sW.js +0 -1060
  119. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-gK0o53mY.js +0 -1075
  120. package/dist/export-DWSRMvQd.js +0 -97
@@ -1,1060 +0,0 @@
1
- import { defineComponent as W, ref as y, computed as E, watch as ce, onMounted as ee, resolveComponent as b, openBlock as f, createBlock as V, unref as e, isRef as X, withCtx as h, createElementVNode as r, createVNode as d, createElementBlock as U, Fragment as q, renderList as Z, createCommentVNode as M, normalizeClass as ye, createSlots as Se, h as Q, toDisplayString as T, createTextVNode as we, withModifiers as Fe } from "vue";
2
- import { _ as ke } from "./campaign-CpzFl8Vr.js";
3
- import { h as me } from "./moment-D7p2TMB-.js";
4
- import { useDialog as Ve, components as de } from "@feedmepos/ui-library";
5
- import "./index-BDxwnonR.js";
6
- import { u as te } from "./loading-C5r1cx-_.js";
7
- import { u as ve } from "./app-wDQR6dpb.js";
8
- import { u as le } from "./membership-C7KQ-KXT.js";
9
- import { _ as J } from "./CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js";
10
- import { p as xe, f as pe, n as $e } from "./plugins-BO66KEQi.js";
11
- import { m as H } from "./index-CueUIXPn.js";
12
- import { z as fe, R as Ie } from "./app-C38mcv88.js";
13
- import { Z as ge } from "./zod-BkZnH28K.js";
14
- import { _ as be } from "./ImageInput.vue_vue_type_script_setup_true_lang-CuC8sOKH.js";
15
- import "./index-DlzhY2Gz.js";
16
- import "./index-DVA1kIwN.js";
17
- import "./index-WXnNDUyq.js";
18
- import { b as Ae } from "./index-CeXhFaZg.js";
19
- import "./index-C567s8tj.js";
20
- import { O as Me } from "./objectid-CpTyDbom.js";
21
- import { u as Ce } from "./vue-i18n-3ow1X-2g.js";
22
- import { a as Ue, c as Be } from "./object-BYyQ0PZp.js";
23
- import { u as De } from "./business-2oH_ru_8.js";
24
- import { w as Ne } from "./xlsx-BtLSi0cI.js";
25
- import { a as Re, C as Pe } from "./export-DWSRMvQd.js";
26
- import { u as ze, _ as Ee } from "./usePagination-D6tENEun.js";
27
- import "./index-HQFexw0Z.js";
28
- import { useRouter as Le } from "vue-router";
29
- import { o as Te } from "./objectId-dwaoBfJX.js";
30
- const qe = { class: "space-y-16" }, Oe = { class: "gap-16 grid grid-cols-2" }, je = { class: "space-y-16" }, Ye = {
31
- key: 0,
32
- class: "flex flex-col gap-[16px] w-full"
33
- }, Ge = { class: "flex flex-col gap-[8px]" }, He = ["src"], Ke = { class: "flex pt-[24px] gap-[24px]" }, Qe = ["src", "onClick", "alt"], Ze = { class: "flex items-center gap-8" }, Xe = /* @__PURE__ */ W({
34
- __name: "CreateCardSheet",
35
- emits: ["success", "export"],
36
- setup(ae, { expose: j, emit: Y }) {
37
- const { minor: C } = te, _ = le(), B = y(), N = y(!1), $ = Y, p = y(!1);
38
- function S(c) {
39
- p.value = c, c && (s.value = {
40
- quantity: 1,
41
- code: "",
42
- codeConfig: {
43
- length: 16,
44
- charset: "1234567890",
45
- prefix: "",
46
- suffix: "",
47
- pattern: "####-####-####-####"
48
- }
49
- });
50
- }
51
- const s = y({
52
- quantity: 1,
53
- code: "",
54
- codeConfig: {
55
- length: 16,
56
- charset: "1234567890",
57
- prefix: "",
58
- suffix: "",
59
- pattern: "####-####-####-####"
60
- },
61
- setCardOnBind: !1,
62
- bundle: void 0
63
- }), k = [
64
- {
65
- label: "Bulk number",
66
- value: "bulk",
67
- sublabel: "Bulk generate unique number"
68
- },
69
- {
70
- label: "Custom number",
71
- value: "single",
72
- sublabel: "Enter your own custom number"
73
- }
74
- ], F = [
75
- {
76
- label: "Alphanumeric",
77
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
78
- },
79
- {
80
- label: "Alphabetic",
81
- value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
82
- },
83
- { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
84
- { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
85
- { label: "Numbers", value: "0123456789" },
86
- { label: "Custom", value: "" }
87
- ], D = y(F[0].value), I = y("bulk"), n = y(0), i = E(
88
- () => {
89
- var c;
90
- return (c = _.membership.design) == null ? void 0 : c[n.value];
91
- }
92
- ), w = y(!1), x = E(
93
- () => _.sortedStoreCategories.flatMap((c) => c.bundles)
94
- );
95
- async function u(c) {
96
- var m, R;
97
- if (await ((m = B.value) == null ? void 0 : m.validateInputs()), !N.value) return;
98
- c.design = (R = i.value) == null ? void 0 : R.image;
99
- const t = await xe.confirm(
100
- "",
101
- "Do you want to export generated card(s)?",
102
- "Export",
103
- "Generate and without export"
104
- );
105
- console.log(t), await C(
106
- async () => {
107
- const P = await H.createCards(c);
108
- console.log(P), await $("success"), t && await $("export", P);
109
- },
110
- {
111
- message: "Creating card(s)",
112
- successMessage: "Card(s) created"
113
- }
114
- );
115
- }
116
- return j({
117
- showSheet: S
118
- }), ce(
119
- () => s.value.codeConfig.length,
120
- (c, t) => {
121
- c != t && (s.value.codeConfig.pattern = "#".repeat(Number(c)));
122
- }
123
- ), ce(
124
- () => s.value.codeConfig.pattern,
125
- (c, t) => {
126
- c != t && (s.value.codeConfig.length = (s.value.codeConfig.pattern.match(/#/g) || []).length);
127
- }
128
- ), ee(async () => {
129
- await _.readMemberStore();
130
- }), (c, t) => {
131
- const m = b("FmRadio"), R = b("FmRadioGroup"), P = b("FmSwitch"), g = b("FmStepperField"), O = b("FmSelect"), z = b("FmTextField"), oe = b("FmTextarea"), G = b("FmButton"), ne = b("FmForm"), se = b("FmSideSheet");
132
- return f(), V(se, {
133
- "max-width": 560,
134
- "dismiss-away": !0,
135
- header: "Create collection",
136
- modelValue: e(p),
137
- "onUpdate:modelValue": [
138
- t[19] || (t[19] = (l) => X(p) ? p.value = l : null),
139
- t[20] || (t[20] = (l) => p.value = l)
140
- ]
141
- }, {
142
- "side-sheet-footer": h(() => [
143
- r("div", Ze, [
144
- d(G, {
145
- label: "Save",
146
- onClick: t[17] || (t[17] = (l) => u(e(s))),
147
- loading: e(ve)().isLoading
148
- }, null, 8, ["loading"]),
149
- d(G, {
150
- label: "Cancel",
151
- type: "button",
152
- variant: "tertiary",
153
- onClick: t[18] || (t[18] = (l) => p.value = !1)
154
- })
155
- ])
156
- ]),
157
- default: h(() => [
158
- d(ne, {
159
- ref_key: "form",
160
- ref: B,
161
- class: "space-y-40",
162
- onValidationSuccess: t[15] || (t[15] = (l) => N.value = !0),
163
- onValidationFailed: t[16] || (t[16] = (l) => N.value = !1)
164
- }, {
165
- default: h(() => {
166
- var l, a, A;
167
- return [
168
- r("div", null, [
169
- t[21] || (t[21] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
170
- d(R, {
171
- modelValue: e(I),
172
- "onUpdate:modelValue": t[0] || (t[0] = (o) => X(I) ? I.value = o : null),
173
- inline: !1
174
- }, {
175
- default: h(() => [
176
- (f(), U(q, null, Z(k, (o) => d(m, {
177
- key: o.value,
178
- value: o.value,
179
- label: o.label,
180
- sublabel: o.sublabel
181
- }, null, 8, ["value", "label", "sublabel"])), 64))
182
- ]),
183
- _: 1
184
- }, 8, ["modelValue"])
185
- ]),
186
- r("div", qe, [
187
- t[22] || (t[22] = r("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
188
- e(I) === "bulk" ? (f(), U(q, { key: 0 }, [
189
- d(P, {
190
- "model-value": e(w),
191
- "label-placement": "right",
192
- value: "true",
193
- label: "Advance number setting",
194
- required: !0,
195
- "onUpdate:modelValue": t[1] || (t[1] = () => w.value = !e(w))
196
- }, null, 8, ["model-value"]),
197
- e(w) ? (f(), U(q, { key: 0 }, [
198
- d(g, {
199
- "model-value": e(s).codeConfig.length || null,
200
- "onUpdate:modelValue": t[2] || (t[2] = (o) => e(s).codeConfig.length = o),
201
- label: "Code length",
202
- rules: [(o) => Number(o) >= 1 || "Code length must at least 1"],
203
- required: !0
204
- }, null, 8, ["model-value", "rules"]),
205
- d(O, {
206
- label: "Charset",
207
- "model-value": e(D),
208
- items: F,
209
- "helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
210
- "onUpdate:modelValue": t[3] || (t[3] = (o) => {
211
- D.value = o, e(s).codeConfig.charset = o;
212
- })
213
- }, null, 8, ["model-value", "helper-text"]),
214
- e(D) === "" ? (f(), V(z, {
215
- key: 0,
216
- modelValue: e(s).codeConfig.charset,
217
- "onUpdate:modelValue": t[4] || (t[4] = (o) => e(s).codeConfig.charset = o),
218
- label: "Custom Charset",
219
- required: ""
220
- }, null, 8, ["modelValue"])) : M("", !0),
221
- r("div", Oe, [
222
- d(z, {
223
- modelValue: e(s).codeConfig.prefix,
224
- "onUpdate:modelValue": t[5] || (t[5] = (o) => e(s).codeConfig.prefix = o),
225
- label: "Prefix (Optional)"
226
- }, null, 8, ["modelValue"]),
227
- d(z, {
228
- modelValue: e(s).codeConfig.suffix,
229
- "onUpdate:modelValue": t[6] || (t[6] = (o) => e(s).codeConfig.suffix = o),
230
- label: "Suffix (Optional)"
231
- }, null, 8, ["modelValue"])
232
- ]),
233
- d(z, {
234
- modelValue: e(s).codeConfig.pattern,
235
- "onUpdate:modelValue": t[7] || (t[7] = (o) => e(s).codeConfig.pattern = o),
236
- label: "Pattern",
237
- required: !0
238
- }, null, 8, ["modelValue"])
239
- ], 64)) : M("", !0),
240
- d(z, {
241
- modelValue: e(s).quantity,
242
- "onUpdate:modelValue": t[8] || (t[8] = (o) => e(s).quantity = o),
243
- label: "Number of code",
244
- rules: [
245
- (o) => o >= 1 || "Quantity cannot be less than 1",
246
- (o) => o <= 1e4 || "Quantity cannot more than 10,000"
247
- ],
248
- required: !0,
249
- "helper-text": `${e(s).quantity} card will be created`
250
- }, null, 8, ["modelValue", "rules", "helper-text"])
251
- ], 64)) : M("", !0),
252
- e(I) !== "bulk" ? (f(), V(oe, {
253
- key: 1,
254
- modelValue: e(s).code,
255
- "onUpdate:modelValue": t[9] || (t[9] = (o) => e(s).code = o),
256
- label: "Custom Card Number",
257
- rules: [(o) => e(I) != "single" || !!o || "Custom code is required"],
258
- placeholder: "(For multiple numbers, please enter in the new row.)"
259
- }, null, 8, ["modelValue", "rules"])) : M("", !0)
260
- ]),
261
- r("div", je, [
262
- t[23] || (t[23] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
263
- d(P, {
264
- "label-placement": "right",
265
- label: "Set card number on bind",
266
- sublabel: "Automatically set the card number when the user binds the card",
267
- "model-value": e(s).setCardOnBind || !1,
268
- "onUpdate:modelValue": t[10] || (t[10] = (o) => e(s).setCardOnBind = o)
269
- }, null, 8, ["model-value"]),
270
- d(J, {
271
- label: "Activate bundle on bind",
272
- placeholder: "Select bundle",
273
- items: e(x).filter((o) => !o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
274
- modelValue: e(s).bundle,
275
- "onUpdate:modelValue": t[12] || (t[12] = (o) => e(s).bundle = o)
276
- }, {
277
- append: h(() => [
278
- e(s).bundle ? (f(), V(G, {
279
- key: 0,
280
- icon: "link_off",
281
- variant: "plain",
282
- onClick: t[11] || (t[11] = (o) => e(s).bundle = void 0)
283
- })) : M("", !0)
284
- ]),
285
- _: 1
286
- }, 8, ["items", "modelValue"]),
287
- (a = (l = e(_).store) == null ? void 0 : l.stripe) != null && a.apiKey ? (f(), V(J, {
288
- key: 0,
289
- label: "Linked subscription bundle",
290
- placeholder: "Select bundle",
291
- items: e(x).filter((o) => o.stripePriceId).map((o) => ({ label: o.name, value: o._id })),
292
- modelValue: e(s).subscriptionBundle,
293
- "onUpdate:modelValue": t[14] || (t[14] = (o) => e(s).subscriptionBundle = o)
294
- }, {
295
- append: h(() => [
296
- e(s).subscriptionBundle ? (f(), V(G, {
297
- key: 0,
298
- icon: "link_off",
299
- variant: "plain",
300
- onClick: t[13] || (t[13] = (o) => e(s).subscriptionBundle = void 0)
301
- })) : M("", !0)
302
- ]),
303
- _: 1
304
- }, 8, ["items", "modelValue"])) : M("", !0)
305
- ]),
306
- e(_).membership.design ? (f(), U("div", Ye, [
307
- r("div", Ge, [
308
- t[24] || (t[24] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
309
- r("img", {
310
- src: (A = e(i)) == null ? void 0 : A.image,
311
- class: "aspect-[16/9]"
312
- }, null, 8, He),
313
- r("div", Ke, [
314
- (f(!0), U(q, null, Z(e(_).membership.design, (o, L) => (f(), U("img", {
315
- src: o.image,
316
- key: `image_${L}`,
317
- class: ye(["w-[112px] h-[63px] cursor-pointer", `${e(n) === L ? "border-[2px] border-fm-color-primary" : ""}`]),
318
- onClick: (ie) => n.value = L,
319
- alt: `ai_image_predict_${L}`,
320
- style: { objectFit: "cover" }
321
- }, null, 10, Qe))), 128))
322
- ])
323
- ])
324
- ])) : M("", !0)
325
- ];
326
- }),
327
- _: 1
328
- }, 512)
329
- ]),
330
- _: 1
331
- }, 8, ["modelValue"]);
332
- };
333
- }
334
- }), Je = { class: "space-y-16" }, We = {
335
- key: 0,
336
- class: "flex flex-col gap-[16px] w-full"
337
- }, et = { class: "flex flex-col gap-[8px]" }, tt = ["src"], lt = { class: "flex pt-[24px] gap-[24px]" }, at = ["src", "onClick", "alt"], ot = { class: "flex items-center gap-8" }, nt = /* @__PURE__ */ W({
338
- __name: "EditCardSheet",
339
- emits: ["success"],
340
- setup(ae, { expose: j, emit: Y }) {
341
- const { minor: C } = te, _ = le(), B = y(), N = y(!1), $ = Y, p = y({
342
- _id: "",
343
- business: "",
344
- serialNumber: ""
345
- }), S = y(!1);
346
- function s(n, i) {
347
- var w;
348
- S.value = n, n && i && (p.value = i, k.value = (w = _.membership.design) == null ? void 0 : w.findIndex(
349
- (x) => x.image === i.design
350
- ));
351
- }
352
- const k = y(0), F = E(
353
- () => {
354
- var n;
355
- return (n = _.membership.design) == null ? void 0 : n[k.value];
356
- }
357
- ), D = E(
358
- () => _.sortedStoreCategories.flatMap(
359
- (n) => n.bundles
360
- )
361
- );
362
- async function I(n) {
363
- var i, w;
364
- await ((i = B.value) == null ? void 0 : i.validateInputs()), N.value && (n.design = (w = F.value) == null ? void 0 : w.image, await C(
365
- async () => {
366
- await H.updateCard(n), await $("success");
367
- },
368
- {
369
- message: "Updating card",
370
- successMessage: "Card updated"
371
- }
372
- ));
373
- }
374
- return j({
375
- showSheet: s
376
- }), ee(async () => {
377
- await _.readMemberStore();
378
- }), (n, i) => {
379
- const w = b("FmTextField"), x = b("FmSwitch"), u = b("FmButton"), c = b("FmForm"), t = b("FmSideSheet");
380
- return f(), V(t, {
381
- "max-width": 560,
382
- "dismiss-away": !0,
383
- header: "Edit card",
384
- modelValue: e(S),
385
- "onUpdate:modelValue": [
386
- i[10] || (i[10] = (m) => X(S) ? S.value = m : null),
387
- i[11] || (i[11] = (m) => S.value = m)
388
- ]
389
- }, {
390
- "side-sheet-footer": h(() => [
391
- r("div", ot, [
392
- d(u, {
393
- label: "Save",
394
- disabled: !!e(p).redeemedAt,
395
- onClick: i[8] || (i[8] = (m) => I(e(p))),
396
- loading: e(ve)().isLoading
397
- }, null, 8, ["disabled", "loading"]),
398
- d(u, {
399
- label: "Cancel",
400
- type: "button",
401
- variant: "tertiary",
402
- onClick: i[9] || (i[9] = (m) => S.value = !1)
403
- })
404
- ])
405
- ]),
406
- default: h(() => [
407
- d(c, {
408
- ref_key: "form",
409
- ref: B,
410
- class: "space-y-40",
411
- onValidationSuccess: i[6] || (i[6] = (m) => N.value = !0),
412
- onValidationFailed: i[7] || (i[7] = (m) => N.value = !1)
413
- }, {
414
- default: h(() => {
415
- var m, R, P;
416
- return [
417
- r("div", Je, [
418
- d(w, {
419
- modelValue: e(p).serialNumber,
420
- "onUpdate:modelValue": i[0] || (i[0] = (g) => e(p).serialNumber = g),
421
- label: "Card Number",
422
- rules: [
423
- e(ge).toRule(e(fe).string().min(1, "Card number is required")),
424
- e(ge).toRule(
425
- e(fe).string().max(50, "Card number must be less than 50 characters")
426
- )
427
- ],
428
- required: !0
429
- }, null, 8, ["modelValue", "rules"]),
430
- i[12] || (i[12] = r("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
431
- d(x, {
432
- "label-placement": "right",
433
- label: "Set card number on bind",
434
- "model-value": e(p).setCardOnBind || !1,
435
- "onUpdate:modelValue": i[1] || (i[1] = (g) => e(p).setCardOnBind = g)
436
- }, null, 8, ["model-value"]),
437
- d(J, {
438
- label: "Activate bundle on bind",
439
- placeholder: "Select bundle",
440
- items: e(D).filter((g) => !g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
441
- modelValue: e(p).bundle,
442
- "onUpdate:modelValue": i[3] || (i[3] = (g) => e(p).bundle = g)
443
- }, {
444
- append: h(() => [
445
- e(p).bundle ? (f(), V(u, {
446
- key: 0,
447
- icon: "link_off",
448
- variant: "plain",
449
- onClick: i[2] || (i[2] = (g) => e(p).bundle = null)
450
- })) : M("", !0)
451
- ]),
452
- _: 1
453
- }, 8, ["items", "modelValue"]),
454
- (R = (m = e(_).store) == null ? void 0 : m.stripe) != null && R.apiKey ? (f(), V(J, {
455
- key: 0,
456
- label: "Linked subscription bundle",
457
- placeholder: "Select bundle",
458
- items: e(D).filter((g) => g.stripePriceId).map((g) => ({ label: g.name, value: g._id })),
459
- modelValue: e(p).subscriptionBundle,
460
- "onUpdate:modelValue": i[5] || (i[5] = (g) => e(p).subscriptionBundle = g)
461
- }, {
462
- append: h(() => [
463
- e(p).subscriptionBundle ? (f(), V(u, {
464
- key: 0,
465
- icon: "link_off",
466
- variant: "plain",
467
- onClick: i[4] || (i[4] = (g) => e(p).subscriptionBundle = null)
468
- })) : M("", !0)
469
- ]),
470
- _: 1
471
- }, 8, ["items", "modelValue"])) : M("", !0)
472
- ]),
473
- e(_).membership.design ? (f(), U("div", We, [
474
- r("div", et, [
475
- i[13] || (i[13] = r("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
476
- r("img", {
477
- src: (P = e(F)) == null ? void 0 : P.image,
478
- class: "aspect-[16/9]"
479
- }, null, 8, tt),
480
- r("div", lt, [
481
- (f(!0), U(q, null, Z(e(_).membership.design, (g, O) => (f(), U("img", {
482
- src: g.image,
483
- key: `image_${O}`,
484
- class: ye(["w-[112px] h-[63px] cursor-pointer", `${e(k) === O ? "border-[2px] border-fm-color-primary" : ""}`]),
485
- onClick: (z) => k.value = O,
486
- alt: `ai_image_predict_${O}`,
487
- style: { objectFit: "cover" }
488
- }, null, 10, at))), 128))
489
- ])
490
- ])
491
- ])) : M("", !0)
492
- ];
493
- }),
494
- _: 1
495
- }, 512)
496
- ]),
497
- _: 1
498
- }, 8, ["modelValue"]);
499
- };
500
- }
501
- }), st = {
502
- key: 0,
503
- class: "grid grid-cols-2 gap-8"
504
- }, it = { class: "flex items-center gap-8" }, rt = { class: "flex items-center gap-8" }, dt = 5, ut = /* @__PURE__ */ W({
505
- __name: "CardDesignSheet",
506
- emits: ["success"],
507
- setup(ae, { expose: j, emit: Y }) {
508
- const { t: C } = Ce(), { minor: _ } = te, B = le(), N = Ve(), $ = y(!1);
509
- y(), y(!1);
510
- const p = y(), S = y(null);
511
- E(() => {
512
- var x, u;
513
- return Math.min((((u = (x = p.value) == null ? void 0 : x.design) == null ? void 0 : u.length) ?? 0) + 1, dt);
514
- });
515
- const s = Y, k = E(() => {
516
- var x, u;
517
- return ((u = (x = B.membership) == null ? void 0 : x.design) == null ? void 0 : u.filter((c) => c.image)) || [];
518
- }), F = y(!1);
519
- function D(x) {
520
- F.value = x;
521
- }
522
- function I() {
523
- $.value = !0;
524
- }
525
- async function n() {
526
- await _(
527
- async () => {
528
- var c;
529
- const x = Ue(p.value), u = Ae.parse(x);
530
- if (u.design = (u == null ? void 0 : u.design) || [], S.value) {
531
- const t = Me().toHexString(), m = await pe.update(
532
- pe.designPath(t, S.value),
533
- S.value
534
- );
535
- (c = u.design) == null || c.push({
536
- _id: t,
537
- image: m
538
- });
539
- }
540
- await H.update(u), await w(), await s("success"), S.value = null, $.value = !1;
541
- },
542
- {
543
- message: "Saving card design",
544
- successMessage: "Card design saved"
545
- }
546
- );
547
- }
548
- async function i(x, u) {
549
- x ? S.value = x : u && N.open({
550
- title: "Delete Design",
551
- message: "Are you sure you want to delete this design?",
552
- primaryActions: { text: "Delete", close: !0 },
553
- secondaryActions: { text: "Cancel", close: !1 }
554
- }).onPrimary(async () => {
555
- var t, m;
556
- const c = (t = p.value.design) == null ? void 0 : t.findIndex((R) => R._id == u);
557
- console.log(c), c !== -1 && ((m = p.value.design) == null || m.splice(c, 1)), await n();
558
- }).onSecondary(() => {
559
- N.close();
560
- });
561
- }
562
- async function w() {
563
- await B.readMembership(), p.value = B.membership;
564
- }
565
- return j({
566
- showSheet: D
567
- }), ee(async () => {
568
- await w(), k.value.length || ($.value = !0);
569
- }), (x, u) => {
570
- const c = b("FmButton"), t = b("FmSideSheet");
571
- return f(), V(t, {
572
- "max-width": 560,
573
- "dismiss-away": !0,
574
- header: e(C)("connect.loyalty.card.design.title"),
575
- modelValue: e(F),
576
- "onUpdate:modelValue": [
577
- u[2] || (u[2] = (m) => X(F) ? F.value = m : null),
578
- u[3] || (u[3] = (m) => F.value = m)
579
- ]
580
- }, Se({
581
- default: h(() => [
582
- e($) ? M("", !0) : (f(), U("div", st, [
583
- (f(!0), U(q, null, Z(e(k), (m) => (f(), V(be, {
584
- key: String(m._id),
585
- "image-fit": "cover",
586
- label: "",
587
- "aspect-ratio": "16/9",
588
- thumbnail: m.image,
589
- accept: ".png, .jpg, .jpeg, .gif",
590
- "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
591
- file: void 0,
592
- "delete-button": !1
593
- }, {
594
- "delete-button": h(() => [
595
- d(c, {
596
- class: "!text-neutral-50 !bg-neutral-700",
597
- icon: "delete",
598
- variant: "tertiary",
599
- onClick: (R) => i(null, m._id)
600
- }, null, 8, ["onClick"])
601
- ]),
602
- _: 2
603
- }, 1032, ["thumbnail"]))), 128))
604
- ])),
605
- e($) ? (f(), V(be, {
606
- key: 1,
607
- "image-fit": "cover",
608
- label: "",
609
- "aspect-ratio": "16/9",
610
- accept: ".png, .jpg, .jpeg, .gif",
611
- "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
612
- "onUpdate:file": i
613
- })) : M("", !0)
614
- ]),
615
- _: 2
616
- }, [
617
- e($) ? {
618
- name: "side-sheet-footer",
619
- fn: h(() => [
620
- r("div", rt, [
621
- d(c, {
622
- label: e(C)("connect.common.save"),
623
- onClick: n,
624
- disabled: !e(S)
625
- }, null, 8, ["label", "disabled"]),
626
- d(c, {
627
- label: e(C)("connect.common.cancel"),
628
- type: "button",
629
- variant: "tertiary",
630
- onClick: u[1] || (u[1] = (m) => $.value = !1)
631
- }, null, 8, ["label"])
632
- ])
633
- ]),
634
- key: "1"
635
- } : {
636
- name: "side-sheet-footer",
637
- fn: h(() => [
638
- r("div", it, [
639
- d(c, {
640
- label: e(C)("connect.loyalty.card.design.add"),
641
- icon: "add",
642
- onClick: I
643
- }, null, 8, ["label"]),
644
- d(c, {
645
- label: e(C)("connect.common.cancel"),
646
- type: "button",
647
- variant: "tertiary",
648
- onClick: u[0] || (u[0] = (m) => F.value = !1)
649
- }, null, 8, ["label"])
650
- ])
651
- ]),
652
- key: "0"
653
- }
654
- ]), 1032, ["header", "modelValue"]);
655
- };
656
- }
657
- }), ct = { class: "flex flex-col gap-4" }, mt = { class: "flex items-center" }, pt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, ft = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary max-w-[640px]" }, gt = { class: "px-24 flex flex-col pb-24 gap-y-16" }, bt = { class: "flex items-center gap-8 flex-wrap p-12 mt-8 rounded-md bg-fm-color-neutral-gray-100" }, yt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, vt = { class: "grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 gap-16" }, xt = { class: "fm-typo-en-body-md-500 text-fm-color-typo-secondary" }, Ct = { class: "fm-typo-en-title-md-800 text-fm-color-typo-primary" }, _t = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-tertiary" }, ht = { class: "flex items-center gap-16 flex-wrap" }, St = { class: "flex-1 min-w-0" }, wt = { class: "flex items-center gap-8 flex-none" }, Ft = { class: "flex flex-col gap-16 text-center" }, kt = { class: "fm-typo-en-title-sm-800" }, Vt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, $t = { class: "flex gap-x-8" }, ol = /* @__PURE__ */ W({
658
- __name: "Card",
659
- setup(ae) {
660
- const j = Le();
661
- function Y() {
662
- j.push({ name: Ie["$connect-STORE"] });
663
- }
664
- const C = y(), _ = E(() => {
665
- if (!C.value) return null;
666
- const l = C.value.totalIssued;
667
- return l ? Math.round(C.value.claimed / l * 100) : 0;
668
- });
669
- function B(l) {
670
- return l === void 0 ? "—" : String(l);
671
- }
672
- const N = E(() => {
673
- var l, a, A;
674
- return [
675
- {
676
- key: "totalIssued",
677
- title: n("connect.loyalty.card.stats.totalIssued"),
678
- value: B((l = C.value) == null ? void 0 : l.totalIssued),
679
- description: n("connect.loyalty.card.stats.totalIssuedHint")
680
- },
681
- {
682
- key: "claimed",
683
- title: n("connect.loyalty.card.stats.claimed"),
684
- value: B((a = C.value) == null ? void 0 : a.claimed),
685
- description: _.value === null ? "" : n("connect.loyalty.card.stats.claimedHint", {
686
- rate: _.value
687
- })
688
- },
689
- {
690
- key: "unclaimed",
691
- title: n("connect.loyalty.card.stats.unclaimed"),
692
- value: B((A = C.value) == null ? void 0 : A.unclaimed),
693
- description: n("connect.loyalty.card.stats.unclaimedHint")
694
- }
695
- ];
696
- });
697
- async function $() {
698
- try {
699
- C.value = await H.readCardStats();
700
- } catch (l) {
701
- C.value = void 0, console.error("Failed to load card stats", l);
702
- }
703
- }
704
- const { minor: p, global: S } = te, s = y(), k = y(), F = y(), D = De(), I = le(), { t: n } = Ce(), i = E(
705
- () => I.sortedStoreCategories.flatMap((l) => l.bundles)
706
- );
707
- function w(l) {
708
- return !!l.member || !!l.redeemedAt;
709
- }
710
- const x = [
711
- {
712
- header: n("connect.loyalty.card.table.card_number"),
713
- accessorFn: (l) => l.serialNumber
714
- },
715
- {
716
- header: n("connect.loyalty.card.table.type"),
717
- accessorFn: (l) => l.giftCard ? n("connect.loyalty.card.table.typeGiftCard") : n("connect.loyalty.card.table.typeRedemption")
718
- },
719
- {
720
- header: n("connect.loyalty.card.table.bundle"),
721
- // A gift card carries its value on itself rather than pointing at a bundle in
722
- // Store.categories, so fall back to its program name and amount.
723
- accessorFn: (l) => {
724
- var a;
725
- return l.giftCard ? `${l.giftCard.programName} · RM${l.giftCard.amount}` : ((a = i.value.find((A) => A._id === l.bundle)) == null ? void 0 : a.name) || "-";
726
- }
727
- },
728
- {
729
- header: n("connect.loyalty.card.table.status"),
730
- accessorKey: "member",
731
- enableSorting: !1,
732
- cell(l) {
733
- const a = w(l.row.original);
734
- return Q(de.FmChip, {
735
- label: n(a ? "connect.loyalty.card.table.statusClaimed" : "connect.loyalty.card.table.statusUnclaimed"),
736
- variant: a ? "success" : "neutral",
737
- compact: !0
738
- });
739
- }
740
- },
741
- {
742
- header: n("connect.loyalty.card.table.claimed_by"),
743
- accessorKey: "user",
744
- enableSorting: !1,
745
- cell(l) {
746
- const a = l.row.original.pf_member;
747
- return Q(
748
- "div",
749
- {
750
- class: "flex items-center gap-x-8"
751
- },
752
- [
753
- Q(de.FmAvatar, {
754
- name: a != null && a.photoUrl || a == null ? void 0 : a.name,
755
- src: (a == null ? void 0 : a.photoUrl) ?? void 0,
756
- size: "sm"
757
- }),
758
- Q("span", { class: "fm-typo-en-body-sm-400" }, a == null ? void 0 : a.name)
759
- ]
760
- );
761
- }
762
- },
763
- {
764
- header: n("connect.loyalty.card.table.phone"),
765
- accessorFn: (l) => {
766
- var a;
767
- return ((a = l.pf_member) == null ? void 0 : a.phoneNumber) || "-";
768
- },
769
- accessorKey: "pf_member.phoneNumber"
770
- },
771
- {
772
- header: n("connect.loyalty.card.table.created_at"),
773
- accessorKey: "_id",
774
- accessorFn: (l) => me(Te(l._id.toString())).format("DD MMM YYYY hh:mmA")
775
- },
776
- {
777
- header: n("connect.loyalty.card.table.claimed_at"),
778
- accessorKey: "redeemedAt",
779
- accessorFn: (l) => l.redeemedAt ? me(l.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
780
- },
781
- {
782
- header: n("connect.loyalty.card.table.actions"),
783
- cell(l) {
784
- return Q(de.FmButton, {
785
- variant: "tertiary",
786
- icon: "delete",
787
- iconColor: "neutral-gray-400",
788
- disabled: !!l.row.original.redeemedAt || !!l.row.original.giftCard,
789
- onClick: (a) => {
790
- a.stopPropagation(), G(l.row.original);
791
- }
792
- });
793
- }
794
- }
795
- ], u = y("ALL"), c = E(() => {
796
- var a, A, o;
797
- const l = (L) => L === void 0 ? "" : ` ${L}`;
798
- return [
799
- {
800
- label: `${n("connect.loyalty.card.filters.all")}${l(
801
- (a = C.value) == null ? void 0 : a.totalIssued
802
- )}`,
803
- value: "ALL"
804
- },
805
- {
806
- label: `${n("connect.loyalty.card.table.statusClaimed")}${l(
807
- (A = C.value) == null ? void 0 : A.claimed
808
- )}`,
809
- value: "CLAIMED"
810
- },
811
- {
812
- label: `${n("connect.loyalty.card.table.statusUnclaimed")}${l(
813
- (o = C.value) == null ? void 0 : o.unclaimed
814
- )}`,
815
- value: "UNCLAIMED"
816
- }
817
- ];
818
- }), { tableMeta: t, rowData: m, onSort: R, debouncedFetchData: P, onSearch: g } = ze(
819
- (l) => (
820
- // `usePagination` accepts any fetch function, so the filter rides along with
821
- // its pagination params instead of the composable needing to know about it.
822
- H.readCards({
823
- ...l,
824
- status: u.value === "ALL" ? void 0 : u.value
825
- })
826
- )
827
- );
828
- function O(l) {
829
- u.value = l, z({ pageIndex: 0, pageSize: t.value.pageSize });
830
- }
831
- async function z(l) {
832
- var a;
833
- await Promise.all([$(), P(l)]), (a = s.value) == null || a.showSheet(!1);
834
- }
835
- const oe = E(() => D.isPremium ? [
836
- {
837
- label: n("connect.loyalty.card.actions.manage_design"),
838
- value: "design",
839
- isPrimary: !1
840
- },
841
- {
842
- label: n("connect.loyalty.card.actions.create"),
843
- value: "create",
844
- isPrimary: !0,
845
- prependIcon: "add"
846
- }
847
- ] : []);
848
- async function G(l) {
849
- await xe.remove(
850
- `Are you sure you want to remove card ${l.serialNumber}?`
851
- ) && await p(
852
- async () => {
853
- await H.deleteCard(l._id.toString()), await P({ pageSize: 10, pageIndex: 0 });
854
- },
855
- {
856
- message: `Removing card ${l.serialNumber}`,
857
- successMessage: `Removed card ${l.serialNumber} successfully`
858
- }
859
- );
860
- }
861
- async function ne(l) {
862
- if (!l || l.length === 0)
863
- return;
864
- const a = new Pe(), A = l.map((o) => ({
865
- CardNumber: o
866
- }));
867
- a.addRecords(A), await Ne(
868
- a.buildExcel(),
869
- `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
870
- {
871
- bookType: "xlsx",
872
- bookSST: !1,
873
- type: "array"
874
- }
875
- );
876
- }
877
- const se = (l) => {
878
- var a;
879
- if (l.redeemedAt || l.giftCard) {
880
- $e.error("Update not permitted", 2e3);
881
- return;
882
- }
883
- (a = k == null ? void 0 : k.value) == null || a.showSheet(!0, l);
884
- };
885
- return ee(async () => {
886
- await S(async () => {
887
- await D.readPremium(), await I.readMemberStore(), await I.readMembership(), await z();
888
- });
889
- }), (l, a) => {
890
- const A = b("FmPill"), o = b("FmPageHead"), L = b("FmIcon"), ie = b("FmCard"), _e = b("FmTabs"), he = b("FmSearch"), re = b("FmButton");
891
- return f(), U(q, null, [
892
- d(o, {
893
- title: e(n)("connect.loyalty.card.title"),
894
- actions: e(oe),
895
- "onClick:action": a[0] || (a[0] = (v) => {
896
- var K, ue;
897
- console.log(v), v === "design" && ((K = e(F)) == null || K.showSheet(!0)), v === "create" && ((ue = e(s)) == null || ue.showSheet(!0));
898
- })
899
- }, {
900
- title: h(() => [
901
- r("div", ct, [
902
- r("div", mt, [
903
- r("span", pt, T(e(n)("connect.loyalty.card.title")), 1),
904
- d(A, {
905
- class: "ml-8",
906
- variant: "premium"
907
- })
908
- ]),
909
- r("span", ft, T(e(n)("connect.loyalty.card.description")), 1)
910
- ])
911
- ]),
912
- _: 1
913
- }, 8, ["title", "actions"]),
914
- r("div", gt, [
915
- r("div", bt, [
916
- d(L, {
917
- name: "info",
918
- size: "sm",
919
- class: "text-fm-color-primary flex-none"
920
- }),
921
- r("span", yt, T(e(n)("connect.loyalty.card.giftCardSignpost")), 1),
922
- r("button", {
923
- type: "button",
924
- class: "inline-flex items-center gap-4 fm-typo-en-body-md-600 text-fm-color-primary",
925
- onClick: Y
926
- }, [
927
- we(T(e(n)("connect.loyalty.card.giftCardSignpostAction")) + " ", 1),
928
- d(L, {
929
- name: "arrow_forward",
930
- size: "sm"
931
- })
932
- ])
933
- ]),
934
- r("div", vt, [
935
- (f(!0), U(q, null, Z(e(N), (v) => (f(), V(ie, {
936
- key: v.key,
937
- variant: "outlined",
938
- class: "flex flex-col gap-8 p-16"
939
- }, {
940
- default: h(() => [
941
- r("div", xt, T(v.title), 1),
942
- r("div", Ct, T(v.value), 1),
943
- r("div", _t, T(v.description), 1)
944
- ]),
945
- _: 2
946
- }, 1024))), 128))
947
- ]),
948
- e(m).length > 0 || e(m).length <= 0 && e(t).searchValue || e(t).pageCount > 0 ? (f(), U(q, { key: 0 }, [
949
- r("div", ht, [
950
- r("div", St, [
951
- d(_e, {
952
- "model-value": e(u),
953
- items: e(c),
954
- "onUpdate:modelValue": O
955
- }, null, 8, ["model-value", "items"])
956
- ]),
957
- r("div", wt, [
958
- d(he, {
959
- modelValue: e(t).searchValue,
960
- "onUpdate:modelValue": [
961
- a[1] || (a[1] = (v) => e(t).searchValue = v),
962
- e(g)
963
- ],
964
- placeholder: e(n)("connect.loyalty.card.searchPlaceholder")
965
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"]),
966
- d(re, {
967
- icon: "ios_share",
968
- variant: "tertiary",
969
- onClick: Fe(e(Re), ["prevent"])
970
- }, null, 8, ["onClick"])
971
- ])
972
- ]),
973
- d(Ee, {
974
- loading: e(t).isLoading,
975
- "row-data": e(m),
976
- "row-count": e(t).totalRows,
977
- "column-defs": x,
978
- "shrink-at": !1,
979
- "page-count": e(t).pageCount,
980
- "page-index": e(t).pageIndex,
981
- "page-size": e(t).pageSize,
982
- onSortChange: e(R),
983
- onPageChange: a[2] || (a[2] = (v) => {
984
- e(P)({
985
- pageSize: v.pageSize,
986
- pageIndex: v.pageIndex
987
- });
988
- }),
989
- onRowClick: a[3] || (a[3] = (v) => {
990
- se(e(Be)(v.original));
991
- })
992
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
993
- ], 64)) : (f(), V(ie, {
994
- key: 1,
995
- variant: "outlined",
996
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
997
- }, {
998
- default: h(() => [
999
- a[8] || (a[8] = r("img", {
1000
- src: ke,
1001
- class: "aspect-square w-[150px]"
1002
- }, null, -1)),
1003
- r("div", Ft, [
1004
- r("div", kt, T(e(n)("connect.loyalty.card.empty_state.title")), 1),
1005
- r("div", Vt, T(e(n)("connect.loyalty.card.empty_state.description")), 1)
1006
- ]),
1007
- r("div", $t, [
1008
- d(re, {
1009
- variant: "primary",
1010
- label: e(n)("connect.loyalty.card.actions.add"),
1011
- icon: "add",
1012
- disabled: !e(D).isPremium,
1013
- onClick: a[4] || (a[4] = () => {
1014
- var v;
1015
- return (v = e(s)) == null ? void 0 : v.showSheet(!0);
1016
- })
1017
- }, null, 8, ["label", "disabled"]),
1018
- d(re, {
1019
- variant: "secondary",
1020
- label: e(n)("connect.loyalty.card.actions.manage_design"),
1021
- disabled: !e(D).isPremium,
1022
- onClick: a[5] || (a[5] = () => {
1023
- var v;
1024
- return (v = e(F)) == null ? void 0 : v.showSheet(!0);
1025
- })
1026
- }, null, 8, ["label", "disabled"])
1027
- ])
1028
- ]),
1029
- _: 1
1030
- })),
1031
- d(Xe, {
1032
- ref_key: "sheetRef",
1033
- ref: s,
1034
- onSuccess: a[6] || (a[6] = (v) => z()),
1035
- onExport: ne
1036
- }, null, 512),
1037
- d(ut, {
1038
- ref_key: "designSheetRef",
1039
- ref: F,
1040
- onSuccess: z
1041
- }, null, 512),
1042
- d(nt, {
1043
- ref_key: "editSheetRef",
1044
- ref: k,
1045
- onSuccess: a[7] || (a[7] = (v) => {
1046
- var K;
1047
- z({
1048
- pageSize: e(t).pageSize,
1049
- pageIndex: e(t).pageIndex
1050
- }), (K = e(k)) == null || K.showSheet(!1);
1051
- })
1052
- }, null, 512)
1053
- ])
1054
- ], 64);
1055
- };
1056
- }
1057
- });
1058
- export {
1059
- ol as default
1060
- };