@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,187 @@
1
+ import { defineComponent as F, ref as I, watch as v, onBeforeMount as D, openBlock as C, createElementBlock as M, createElementVNode as N, createVNode as u, unref as t, h as i } from "vue";
2
+ import { a as R } from "./index-B9DM5Vuv.js";
3
+ import { u as k, _ as L } from "./usePagination-DmZX0V64.js";
4
+ import { _ as O } from "./FilterChip.vue_vue_type_script_setup_true_lang-3bH-tZAm.js";
5
+ import { c as l } from "./string-Gcy5IM_H.js";
6
+ import "./index-BbpqZrkB.js";
7
+ import { useSnackbar as P, components as c } from "@feedmepos/ui-library";
8
+ import { useCoreStore as T } from "@feedmepos/mf-common";
9
+ import { F as U } from "./member-import-BxCrd9tq.js";
10
+ import { F as g } from "./FileSaver.min-w_ExQ0py.js";
11
+ import { h as m } from "./moment-D7p2TMB-.js";
12
+ import { useRouter as V } from "vue-router";
13
+ import { m as d } from "./index-BWlfW4Kr.js";
14
+ import { R as B } from "./app-DAtx6aZ4.js";
15
+ const $ = { class: "flex flex-col gap-16" }, Y = { class: "flex items-center" }, re = /* @__PURE__ */ F({
16
+ __name: "MemberImportHistory",
17
+ setup(z) {
18
+ const w = V(), b = T(), S = P(), n = I({ status: [] });
19
+ function _(e) {
20
+ return e === "COMPLETED" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : ["INVALID", "STOPPED"].includes(e) ? "text-fm-color-typo-error bg-fm-color-system-error-100" : ["UPLOADED", "VALIDATING", "QUEUED", "RUNNING", "CANCELLING"].includes(
21
+ e
22
+ ) ? "text-fm-color-typo-warning bg-fm-color-system-warning-100" : "text-fm-color-typo-info bg-fm-color-system-info-100";
23
+ }
24
+ function p(e) {
25
+ return m(e.originalFileExpiresAt).isAfter(m());
26
+ }
27
+ function f(e, o = !1) {
28
+ S.open({
29
+ type: "error",
30
+ message: o && e instanceof R && e.status === 410 ? "Original file has expired or is unavailable." : "Unable to download the import file. Please try again."
31
+ });
32
+ }
33
+ async function y(e) {
34
+ try {
35
+ g.saveAs(
36
+ await d.downloadOriginalImportFile(e._id.toString()),
37
+ e.file.originalName
38
+ );
39
+ } catch (o) {
40
+ f(o, !0);
41
+ }
42
+ }
43
+ async function h(e) {
44
+ try {
45
+ g.saveAs(
46
+ await d.downloadImportResult(e._id.toString()),
47
+ `member-import-${e._id}.csv`
48
+ );
49
+ } catch (o) {
50
+ f(o);
51
+ }
52
+ }
53
+ const x = [
54
+ {
55
+ header: "File",
56
+ accessorFn: (e) => e.file.originalName,
57
+ enableSorting: !1
58
+ },
59
+ {
60
+ header: "Import ID",
61
+ accessorFn: (e) => e._id.toString(),
62
+ enableSorting: !1
63
+ },
64
+ {
65
+ header: "Mode",
66
+ accessorFn: (e) => l.title(e.options.mode),
67
+ enableSorting: !1
68
+ },
69
+ {
70
+ header: "Status",
71
+ cell(e) {
72
+ const o = e.row.original.status;
73
+ return i(c.FmChip, {
74
+ label: l.title(o),
75
+ compact: !0,
76
+ class: _(o)
77
+ });
78
+ },
79
+ enableSorting: !1
80
+ },
81
+ {
82
+ header: "Rows",
83
+ accessorFn: (e) => `${e.summary.completed}/${e.summary.total} completed · ${e.summary.failed} failed`,
84
+ enableSorting: !1
85
+ },
86
+ {
87
+ header: "Created / completed",
88
+ accessorFn: (e) => [e.createdAt, e.completedAt].filter(Boolean).map((o) => m(o).format("D MMM YYYY, hh:mmA")).join(" / "),
89
+ enableSorting: !1
90
+ },
91
+ {
92
+ header: "Error",
93
+ cell(e) {
94
+ return i(
95
+ "div",
96
+ {
97
+ class: "max-w-[240px] truncate",
98
+ title: e.row.original.error ?? void 0
99
+ },
100
+ e.row.original.error || "-"
101
+ );
102
+ },
103
+ enableSorting: !1
104
+ },
105
+ {
106
+ header: "Actions",
107
+ cell(e) {
108
+ const o = e.row.original;
109
+ return i("div", { class: "flex gap-4" }, [
110
+ i(c.FmButton, {
111
+ icon: "download",
112
+ variant: "tertiary",
113
+ disabled: !p(o),
114
+ "aria-label": "Download original file",
115
+ title: p(o) ? "Download original file" : "Original file has expired",
116
+ onClick: (a) => {
117
+ a.stopPropagation(), y(o);
118
+ }
119
+ }),
120
+ i(c.FmButton, {
121
+ icon: "description",
122
+ variant: "tertiary",
123
+ disabled: o.summary.total === 0,
124
+ "aria-label": "Download result CSV",
125
+ title: "Download result CSV",
126
+ onClick: (a) => {
127
+ a.stopPropagation(), h(o);
128
+ }
129
+ })
130
+ ]);
131
+ },
132
+ enableSorting: !1
133
+ }
134
+ ], A = U.options.map((e) => ({
135
+ label: l.title(e),
136
+ value: e
137
+ })), { tableMeta: r, rowData: E, debouncedFetchData: s } = k(
138
+ (e) => d.readImportHistory(e, n.value.status),
139
+ { key: "createdAt", descending: !0 }
140
+ );
141
+ return v(
142
+ n,
143
+ () => {
144
+ s();
145
+ },
146
+ { deep: !0 }
147
+ ), D(async () => {
148
+ var e, o;
149
+ if (!((o = (e = b.sessionUser.value) == null ? void 0 : e.role) != null && o.isAdmin)) {
150
+ await w.replace({
151
+ name: B["$connect-LOYALTY_MEMBER_LIST"]
152
+ });
153
+ return;
154
+ }
155
+ await s();
156
+ }), (e, o) => (C(), M("div", $, [
157
+ N("div", Y, [
158
+ u(O, {
159
+ modelValue: t(n).status,
160
+ "onUpdate:modelValue": o[0] || (o[0] = (a) => t(n).status = a),
161
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
162
+ "right-icon": "keyboard_arrow_down",
163
+ label: "Status: ",
164
+ "show-item-label": !0,
165
+ items: t(A)
166
+ }, null, 8, ["modelValue", "items"])
167
+ ]),
168
+ u(L, {
169
+ loading: t(r).isLoading,
170
+ "row-data": t(E),
171
+ "row-count": t(r).totalRows,
172
+ "column-defs": x,
173
+ "page-count": t(r).pageCount,
174
+ "page-index": t(r).pageIndex,
175
+ "page-size": t(r).pageSize,
176
+ "shrink-at": !1,
177
+ onPageChange: o[1] || (o[1] = (a) => t(s)({
178
+ pageSize: a.pageSize,
179
+ pageIndex: a.pageIndex
180
+ }))
181
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size"])
182
+ ]));
183
+ }
184
+ });
185
+ export {
186
+ re as default
187
+ };
@@ -0,0 +1,334 @@
1
+ import { defineComponent as ye, ref as I, computed as Te, onMounted as xe, resolveComponent as D, openBlock as oe, createElementBlock as ve, createElementVNode as Me, createVNode as T, unref as i, withDirectives as Ne, vShow as Fe, createBlock as Ie, createCommentVNode as De, h as d } from "vue";
2
+ import { h } from "./moment-D7p2TMB-.js";
3
+ import { components as S } from "@feedmepos/ui-library";
4
+ import { e as Ee, M as Ve } from "./email-addresses-DZKMnoKf.js";
5
+ import { w as ke } from "./xlsx-Cm3vGmLN.js";
6
+ import "./index-BbpqZrkB.js";
7
+ import "./index-Bb4TieR_.js";
8
+ import { u as Be } from "./membership-ILB4aB4h.js";
9
+ import { u as Re, _ as Ye } from "./MemberDetailSheet.vue_vue_type_script_setup_true_lang-CiiBrlHY.js";
10
+ import { f as x } from "./number-leVwmDCm.js";
11
+ import { u as Ae } from "./loading-CzWOx4tE.js";
12
+ import { t as Pe } from "./money-CpIK1N_r.js";
13
+ import { u as Oe } from "./business-BZUIs8Ub.js";
14
+ import { u as Le, _ as ze } from "./usePagination-DmZX0V64.js";
15
+ import { g as Ke, a as je, b as Ue } from "./user-CBPsvnx9.js";
16
+ import { useRouter as $e } from "vue-router";
17
+ import { m as E } from "./index-BWlfW4Kr.js";
18
+ import { R as qe } from "./app-DAtx6aZ4.js";
19
+ import { o as ae } from "./objectId-dwaoBfJX.js";
20
+ const Je = { class: "flex items-center justify-end" }, ft = /* @__PURE__ */ ye({
21
+ __name: "MemberList",
22
+ setup(Ge) {
23
+ const ne = Re(), u = Be(), v = Oe(), { minor: ie } = Ae, se = $e(), re = [
24
+ {
25
+ header: "Name",
26
+ enableSorting: !0,
27
+ accessorKey: "name",
28
+ cell(t) {
29
+ return Ke(t.row.original);
30
+ }
31
+ },
32
+ {
33
+ header: "Phone",
34
+ enableSorting: !0,
35
+ accessorKey: "phoneNumber"
36
+ },
37
+ {
38
+ accessorFn: (t) => h(t.joinAt || ae(t._id.toString())).format("D MMM YYYY"),
39
+ header: "Customer Since",
40
+ accessorKey: "_id",
41
+ id: "_id"
42
+ },
43
+ {
44
+ accessorKey: "collection_TIER_0_balance",
45
+ header: "Tier",
46
+ enableSorting: !0,
47
+ cell(t) {
48
+ return je(
49
+ t.row.original,
50
+ u.sortedTiers
51
+ );
52
+ }
53
+ },
54
+ {
55
+ header: "Title",
56
+ enableSorting: !1,
57
+ cell(t) {
58
+ return Ue(
59
+ t.row.original,
60
+ u.sortedTitles
61
+ );
62
+ }
63
+ },
64
+ {
65
+ accessorKey: "collection_CREDIT_0_balance",
66
+ accessorFn: (t) => {
67
+ var o, a, n;
68
+ return x(((n = (a = (o = t.collection) == null ? void 0 : o.CREDIT) == null ? void 0 : a[0]) == null ? void 0 : n.balance) ?? 0, 2);
69
+ },
70
+ header: "Credit(s)",
71
+ enableSorting: !0
72
+ },
73
+ {
74
+ accessorKey: "collection_POINT_0_balance",
75
+ accessorFn: (t) => {
76
+ var o, a, n;
77
+ return x(((n = (a = (o = t.collection) == null ? void 0 : o.POINT) == null ? void 0 : a[0]) == null ? void 0 : n.balance) ?? 0, 2);
78
+ },
79
+ header: "Experience(s)",
80
+ enableSorting: !0
81
+ },
82
+ {
83
+ accessorKey: "collection_COIN_0_balance",
84
+ accessorFn: (t) => {
85
+ var o, a, n;
86
+ return x(((n = (a = (o = t.collection) == null ? void 0 : o.COIN) == null ? void 0 : a[0]) == null ? void 0 : n.balance) ?? 0, 2);
87
+ },
88
+ header: "Point(s)",
89
+ enableSorting: !0
90
+ },
91
+ {
92
+ accessorFn: (t) => {
93
+ var o;
94
+ return ((o = t.stats) == null ? void 0 : o.visitCount) ?? 0;
95
+ },
96
+ header: "Total visit",
97
+ accessorKey: "stats.visitCount",
98
+ id: "stats.visitCount"
99
+ },
100
+ {
101
+ accessorFn: (t) => {
102
+ var o;
103
+ return (o = t.stats) == null ? void 0 : o.lastVisit;
104
+ },
105
+ sortingFn: (t, o) => {
106
+ var a, n;
107
+ return new Date((a = t.original.stats) == null ? void 0 : a.lastVisit).getTime() - new Date((n = o.original.stats) == null ? void 0 : n.lastVisit).getTime();
108
+ },
109
+ id: "stats.lastVisit",
110
+ header: "Last visit",
111
+ cell(t) {
112
+ var o, a;
113
+ return d("div", { class: "flex items-center justify-end gap-4" }, [
114
+ d(
115
+ "span",
116
+ (o = t.row.original.stats) != null && o.lastVisit ? h((a = t.row.original.stats) == null ? void 0 : a.lastVisit).fromNow() : "NA"
117
+ ),
118
+ d(
119
+ S.FmTooltip,
120
+ {
121
+ content: h(t.row.original.stats.lastVisit).format(
122
+ "D MMM YYYY - hh:mmA"
123
+ )
124
+ },
125
+ [d(S.FmIcon, { name: "info", outline: !0, size: "sm" })]
126
+ )
127
+ ]);
128
+ }
129
+ },
130
+ {
131
+ id: "actions",
132
+ cell(t) {
133
+ return d(
134
+ S.FmMenu,
135
+ {
136
+ placement: "bottom-end",
137
+ onClick: (o) => {
138
+ o.stopPropagation();
139
+ }
140
+ },
141
+ {
142
+ "menu-button": () => d(S.FmButton, { icon: "more_vert", variant: "tertiary" }),
143
+ default: () => [
144
+ d(S.FmMenuItem, {
145
+ label: "Transaction details",
146
+ onClick: async (o) => {
147
+ o.stopPropagation(), await fe(t.row.original._id);
148
+ }
149
+ })
150
+ ]
151
+ }
152
+ );
153
+ }
154
+ }
155
+ ], { tableMeta: l, rowData: le, onSort: ce, debouncedFetchData: M, onSearch: de } = Le(E.read), V = I(), _ = I(!1), m = I(), ue = Te(() => v.locations.map((t) => ({
156
+ label: t.name,
157
+ value: t._id
158
+ })));
159
+ async function me() {
160
+ m.value = await E.readById(
161
+ m.value._id.toString()
162
+ ), _.value = !0;
163
+ }
164
+ async function pe() {
165
+ await M(), _.value = !1;
166
+ }
167
+ async function fe(t) {
168
+ await se.push({
169
+ name: qe["$connect-LOYALTY_MEMBER_TRANSACTIONS"],
170
+ params: { id: t }
171
+ });
172
+ }
173
+ const N = {
174
+ sortBy: "_id",
175
+ descending: !1,
176
+ rowsPerPage: 1e3
177
+ };
178
+ function F(t) {
179
+ const o = h(t);
180
+ return o.isValid() ? o.format("DD/MM/YYYY") : "";
181
+ }
182
+ async function ge() {
183
+ const t = new Ve(), o = N.rowsPerPage;
184
+ await ie(
185
+ async () => {
186
+ var C, r, p, k, B, R, Y, A, P, O, L, z, K, j, U, $, q, J, G, H, Q, W, X;
187
+ let a, n = !0;
188
+ for (; n; ) {
189
+ const w = await E.readCursor({
190
+ limit: o,
191
+ sortBy: N.sortBy,
192
+ descending: N.descending,
193
+ ...a ? { cursor: a } : {}
194
+ });
195
+ if (!w.resources.length)
196
+ break;
197
+ for (const e of w.resources) {
198
+ const be = (C = Ee.parseOneAddress(
199
+ e == null ? void 0 : e.email
200
+ )) != null && C.domain.includes("feedmepos.com") ? void 0 : e.email, he = (p = ((r = e == null ? void 0 : e.collection) == null ? void 0 : r.TITLE) || []) == null ? void 0 : p.reduce(
201
+ (s, c) => {
202
+ var g, b;
203
+ const f = (b = (g = u.sortedTitles) == null ? void 0 : g.find(
204
+ (y) => y._id === c.collectible
205
+ )) == null ? void 0 : b.name;
206
+ return !f || c.balance <= 0 || s.push(f), s;
207
+ },
208
+ []
209
+ ), Se = (u.sortedTitles || []).reduce(
210
+ (s, c) => {
211
+ var g, b, y, te;
212
+ const f = (te = (y = (b = (((g = e == null ? void 0 : e.collection) == null ? void 0 : g.TITLE) || []).find(
213
+ (we) => we.collectible === c._id
214
+ )) == null ? void 0 : b.expiryBalance) == null ? void 0 : y[0]) == null ? void 0 : te.expiredAt;
215
+ return s[c.name] = f ? h(f).format("DD/MM/YYYY") : "", s;
216
+ },
217
+ {}
218
+ ), _e = ((R = (B = (k = e.collection) == null ? void 0 : k.CREDIT) == null ? void 0 : B.at(0)) == null ? void 0 : R.balance) || 0, Z = ((O = (P = (A = (Y = e.collection) == null ? void 0 : Y.CREDIT) == null ? void 0 : A.at(0)) == null ? void 0 : P.expiryBalance) == null ? void 0 : O.reduce(
219
+ (s, c) => s + c.amount,
220
+ 0
221
+ )) || 0, ee = x(_e, 2), Ce = {
222
+ ID: e._id.toString(),
223
+ Name: ((L = e.name) == null ? void 0 : L.trim()) || "",
224
+ Phone: ((z = e == null ? void 0 : e.phoneNumber) == null ? void 0 : z.trim()) || "",
225
+ Email: be || "",
226
+ Gender: e.gender || "",
227
+ CardNo: e.cardNo || "",
228
+ Birthday: e != null && e.birthday ? F(e == null ? void 0 : e.birthday) : "",
229
+ Credit: (Number(ee) - Number(Z)).toFixed(2),
230
+ FreeCredit: Number(Z.toFixed(2)),
231
+ TotalCredit: Number(ee),
232
+ Exp: e != null && e.collection ? ((U = (j = (K = e.collection) == null ? void 0 : K.POINT) == null ? void 0 : j.at(0)) == null ? void 0 : U.balance) ?? 0 : 0,
233
+ Point: e != null && e.collection ? ((J = (q = ($ = e.collection) == null ? void 0 : $.COIN) == null ? void 0 : q.at(0)) == null ? void 0 : J.balance) ?? 0 : 0,
234
+ Tier: e != null && e.collection ? ((Q = (H = (G = e.collection) == null ? void 0 : G.TIER) == null ? void 0 : H.at(0)) == null ? void 0 : Q.balance) ?? 0 : 0,
235
+ Titles: he.join(","),
236
+ ...Se,
237
+ TotalTransaction: e.stats.visitCount,
238
+ AvgSpent: Pe(Number(e.stats.avgBillSize || 0)).toFormat(
239
+ !1
240
+ ),
241
+ TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
242
+ LastVisit: F(e.stats.lastVisit),
243
+ Feedback: ((W = e.stats) == null ? void 0 : W.feedbackCount) || 0,
244
+ JoinedAt: F(e.joinAt || ae(e._id)),
245
+ JoinedAtLocation: e.location && ((X = ue.value.find((s) => s.value == e.location)) == null ? void 0 : X.label) || "-",
246
+ VisitFrequency: `${Number(
247
+ Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
248
+ )}`
249
+ };
250
+ t.addRecord(Ce);
251
+ }
252
+ a = w.meta.nextCursor ?? void 0, n = w.meta.hasNext && !!a;
253
+ }
254
+ await ke(
255
+ t.buildExcel(),
256
+ `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
257
+ {
258
+ bookType: "xlsx",
259
+ bookSST: !1,
260
+ type: "array"
261
+ }
262
+ );
263
+ },
264
+ {
265
+ message: "Exporting member...",
266
+ successMessage: "Member exported successfully"
267
+ }
268
+ );
269
+ }
270
+ return xe(async () => {
271
+ await u.readMembership(), await v.readLocations(), await ne.read(), await v.readLocations(), await M();
272
+ }), (t, o) => {
273
+ const a = D("FmSearch"), n = D("FmButton"), C = D("FmSnackbar");
274
+ return oe(), ve("div", null, [
275
+ Me("div", Je, [
276
+ T(a, {
277
+ class: "mt-4",
278
+ modelValue: i(l).searchValue,
279
+ "onUpdate:modelValue": [
280
+ o[0] || (o[0] = (r) => i(l).searchValue = r),
281
+ i(de)
282
+ ],
283
+ placeholder: "Search",
284
+ collapsible: ""
285
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
286
+ T(n, {
287
+ icon: "ios_share",
288
+ variant: "tertiary",
289
+ onClick: ge
290
+ })
291
+ ]),
292
+ Ne(T(C, {
293
+ "z-index": 0,
294
+ class: "!max-w-full my-16",
295
+ title: "Info",
296
+ description: "Current list is not up to date, please refresh table for latest data.",
297
+ variant: "info",
298
+ dismissable: "",
299
+ onOnDismiss: o[1] || (o[1] = (r) => _.value = !1),
300
+ action: "Refresh",
301
+ onOnAction: pe
302
+ }, null, 512), [
303
+ [Fe, i(_)]
304
+ ]),
305
+ T(ze, {
306
+ loading: i(l).isLoading,
307
+ "row-data": i(le),
308
+ "row-count": i(l).totalRows,
309
+ "column-defs": re,
310
+ "shrink-at": !1,
311
+ "page-count": i(l).pageCount,
312
+ "page-index": i(l).pageIndex,
313
+ "page-size": i(l).pageSize,
314
+ onSortChange: i(ce),
315
+ onPageChange: o[2] || (o[2] = (r) => i(M)({ pageSize: r.pageSize, pageIndex: r.pageIndex })),
316
+ onRowClick: o[3] || (o[3] = (r) => {
317
+ var p;
318
+ m.value = r.original, (p = i(V)) == null || p.showSheet();
319
+ })
320
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
321
+ i(m) ? (oe(), Ie(Ye, {
322
+ key: 0,
323
+ ref_key: "sheetRef",
324
+ ref: V,
325
+ member: i(m),
326
+ "onUpdate:member": me
327
+ }, null, 8, ["member"])) : De("", !0)
328
+ ]);
329
+ };
330
+ }
331
+ });
332
+ export {
333
+ ft as default
334
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as d, ref as p, resolveComponent as _, openBlock as a, createElementBlock as f, createVNode as v, unref as o, createBlock as u, createCommentVNode as b } from "vue";
2
- import { _ as k, a as x } from "./StoreTransactions.vue_vue_type_script_setup_true_lang-Bb2sTsuA.js";
2
+ import { _ as k, a as x } from "./StoreTransactions.vue_vue_type_script_setup_true_lang-mm1jbcvo.js";
3
3
  import { useRouter as y } from "vue-router";
4
4
  const C = { class: "flex flex-col gap-y-32 pb-24" }, F = /* @__PURE__ */ d({
5
5
  __name: "MemberTransactions",