@feedmepos/mf-connect 0.1.38-beta.2 → 0.1.39-prod

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 (110) hide show
  1. package/dist/Analytic-D8WCDkga.js +427 -0
  2. package/dist/{App-D11A2JY1.js → App-CTnXtg1W.js} +352 -364
  3. package/dist/{Bin-9wV4Ah3M.js → Bin-BY6-bvFj.js} +8 -8
  4. package/dist/{Broadcast-I3BtSk8V.js → Broadcast-5VTEIQAr.js} +40 -40
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-XJqTXbKr.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BuAQxEM4.js} +18 -18
  6. package/dist/{Card-CqALG5RM.js → Card-8ivdV-Qz.js} +159 -159
  7. package/dist/{Collections-rg3SzoUb.js → Collections-CFszRHmE.js} +91 -103
  8. package/dist/{Credit-BNn1sYZv.js → Credit-DFslY__4.js} +74 -74
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-PJ8q72XH.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BvCLYtJ3.js} +488 -489
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Sww7KNle.js → EffectSheet.vue_vue_type_style_index_0_lang-Ci_bp7GH.js} +94 -94
  11. package/dist/{Experience-D_Qm8SUj.js → Experience-BxfiZNlY.js} +41 -41
  12. package/dist/{Game-CKXgXm6Q.js → Game-0FZJcLmj.js} +31 -31
  13. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
  14. package/dist/{Index-D4DGfUHd.js → Index-ByeKKbuM.js} +10 -10
  15. package/dist/Marketing-C7F4abzg.js +319 -0
  16. package/dist/{Member-B55vWHDd.js → Member-DP0fLSIV.js} +64 -64
  17. package/dist/MemberList-DFW2bMbr.js +1606 -0
  18. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  19. package/dist/{MemberTransactions-CP5EI-W0.js → MemberTransactions-CW62fvgx.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-iJXNbgsB.js +455 -0
  21. package/dist/{Mission-CFvhROuB.js → Mission-DEgQHJw6.js} +21 -21
  22. package/dist/{Overview-4273yNwL.js → Overview-5jDtZKi8.js} +335 -335
  23. package/dist/{Point-B_-_C919.js → Point-D2lB1-xB.js} +41 -41
  24. package/dist/{Promotion-D2S3COxk.js → Promotion-Diz1gIa0.js} +42 -42
  25. package/dist/{Queue-BmS1Oi-C.js → Queue-DIAuq7HG.js} +51 -51
  26. package/dist/{Record-DRBl0M8g.js → Record-T608yda1.js} +9 -9
  27. package/dist/{Reward-8056NmfK.js → Reward-fZzHrHCW.js} +173 -173
  28. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CJ_WC2gV.js → RewardGroup.vue_vue_type_script_setup_true_lang-YOKVfimM.js} +11 -11
  29. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DqNQl_nz.js → RuleGroup.vue_vue_type_script_setup_true_lang-C3_lmBe5.js} +431 -431
  30. package/dist/Segment-DDQIzsrk.js +882 -0
  31. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-4nNkkklE.js → SelectItems.vue_vue_type_script_setup_true_lang-B5oUf91Q.js} +2 -2
  32. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dnf2oxOG.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-C2U6Kzvx.js} +11 -11
  33. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BLYP-5U9.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRmqgxES.js} +3 -3
  34. package/dist/{Setting-BrJfYoru.js → Setting-CQNyXmp4.js} +432 -432
  35. package/dist/{Store-Bpl_4yZW.js → Store-CIA1Rtsg.js} +210 -210
  36. package/dist/StoreRewards-D5zlE6cE.js +423 -0
  37. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkTYngJ_.js +995 -0
  38. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-QucRaI08.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-D8l3fQyz.js} +1 -1
  39. package/dist/{Tier-_LnXg3n6.js → Tier-jFXVOje_.js} +106 -106
  40. package/dist/{Title-B7AGStvx.js → Title-DVpZ1YMK.js} +131 -133
  41. package/dist/{Transaction-Chxv6V7u.js → Transaction-BF_wmok6.js} +2 -2
  42. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CzXNmobp.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cex1Z43W.js} +6 -6
  43. package/dist/{Voucher-C5z2kOq9.js → Voucher-CaBMU5w0.js} +37 -37
  44. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BXt2fLOD.js +419 -0
  45. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BlXzEWA6.js → ZodTextField.vue_vue_type_script_setup_true_lang-CtHjWpUe.js} +1 -1
  46. package/dist/{app-BVojNX0w.js → app-CPhyKlyf.js} +1 -1
  47. package/dist/{app-7cvPyHJ7.js → app-DuIzRGvb.js} +124 -161
  48. package/dist/app.js +3 -4
  49. package/dist/{business-CmxV69wT.js → business-TTvv3aTz.js} +1 -1
  50. package/dist/{campaign-Dq5C_no-.js → campaign-BiMCoAzx.js} +3 -5
  51. package/dist/{campaign-CT_cNJEL.js → campaign-CjEVStN1.js} +9 -9
  52. package/dist/{campaign.enum-dp7yHKzF.js → campaign.enum-DpYmj9jp.js} +1 -1
  53. package/dist/campaign.fn-DJ6J98jS.js +758 -0
  54. package/dist/{collectible.enum-DxbB4DxT.js → collectible.enum-Cgmm_s-C.js} +1 -1
  55. package/dist/{collection.fn-CNZRdUgy.js → collection.fn-BsYCNgfJ.js} +2 -2
  56. package/dist/{dto-CT9zZbv9.js → dto-DgmHIlZ2.js} +4 -4
  57. package/dist/{effect-FIlOEC4H.js → effect-DnAVIDFy.js} +1 -1
  58. package/dist/{email-addresses-Ba7xImfX.js → email-addresses-CMRgb6Uv.js} +1 -1
  59. package/dist/{export-uzjZFNF9.js → export-DtarK6IJ.js} +3 -3
  60. package/dist/{helper-D4sAZde0.js → helper-BKZghMbF.js} +1 -1
  61. package/dist/{index-l2F5MnLF.js → index-2OAcPmuQ.js} +1 -1
  62. package/dist/{index-BI3m1Ehv.js → index-B0YZKHyu.js} +3 -3
  63. package/dist/{index-CH3z92VV.js → index-B5oXFFlO.js} +1 -1
  64. package/dist/{index-CvBcve-r.js → index-BQ3KHJXX.js} +1 -1
  65. package/dist/{index-B9pl4zRZ.js → index-B_893fH7.js} +79 -179
  66. package/dist/{index-CNJLP3D5.js → index-BoR-BOFw.js} +1 -1
  67. package/dist/{index-DNxa8Rqx.js → index-C7rl1eHp.js} +449 -516
  68. package/dist/{index-BXz54M1s.js → index-CBcbwf0k.js} +1 -1
  69. package/dist/{index-CS3Jmojj.js → index-CIztuDE4.js} +2462 -2453
  70. package/dist/{index-D5rvMvzx.js → index-CK67enPK.js} +1 -1
  71. package/dist/index-CuvNtC_M.js +61 -0
  72. package/dist/index-D2uZzjpn.js +44 -0
  73. package/dist/{index-CUfS9Kp1.js → index-DWdAUovq.js} +9 -9
  74. package/dist/{index-CONvJfKv.js → index-DkWcEDHA.js} +1 -1
  75. package/dist/{index-BjU8LVUC.js → index-VHu8hYtE.js} +385 -376
  76. package/dist/{index.esm2017-ATcsD5N4.js → index.esm2017-DkwLmmR_.js} +127 -127
  77. package/dist/{loading-BWGQSrCB.js → loading-BFkEqWR6.js} +1 -1
  78. package/dist/{membership-Cc4OZ8-U.js → membership-D0eN3i_T.js} +3 -3
  79. package/dist/{money-D7p8nfun.js → money-DS9ZQwSP.js} +1 -1
  80. package/dist/{number-CMJjC4qz.js → number-C8Gt93v9.js} +1 -1
  81. package/dist/objectid-Cr99eTPd.js +145 -0
  82. package/dist/{plugins-eQis66QR.js → plugins-DK_ue6Xa.js} +2 -2
  83. package/dist/{reward-DrnzbG20.js → reward-CW2dSLDW.js} +1 -1
  84. package/dist/{rule-CtRxkYXB.js → rule-CebKyXSm.js} +3 -3
  85. package/dist/{rule-builder-Di9RIYHF.js → rule-builder-kQq14RfN.js} +17 -17
  86. package/dist/style.css +1 -1
  87. package/dist/{template-C3UfY0v5.js → template-CxUxlb6-.js} +64 -64
  88. package/dist/{trigger-C9U7Zgad.js → trigger-RqJo06KA.js} +4 -4
  89. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  90. package/dist/{user-D7n9yYmO.js → user-DhV5Iy52.js} +1 -1
  91. package/dist/{vue-i18n-Bz45zC04.js → vue-i18n-BtvUK9hI.js} +419 -419
  92. package/dist/{xlsx-D4S4qbcZ.js → xlsx-WnLDq4qn.js} +381 -381
  93. package/package.json +3 -9
  94. package/dist/Analytic-BjSfI2Ff.js +0 -761
  95. package/dist/AuditLogs-DWCFYoRg.js +0 -1887
  96. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +0 -58
  97. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  98. package/dist/Marketing-Dn9A1vgH.js +0 -20073
  99. package/dist/MemberList-BWTG9Ohy.js +0 -1606
  100. package/dist/MemberOverview-wL_ailso.js +0 -58
  101. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-D--_An-f.js +0 -60279
  102. package/dist/Segment-Bzq-pyhc.js +0 -882
  103. package/dist/StoreRewards-Cu7n7Pjz.js +0 -423
  104. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-T3Wo2maC.js +0 -1029
  105. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DdGMrk2C.js +0 -419
  106. package/dist/campaign.fn-BYZgKDN7.js +0 -758
  107. package/dist/index-CsaQJMAR.js +0 -66
  108. package/dist/index-CwsMG2cV.js +0 -56
  109. package/dist/objectid-D5T27iny.js +0 -145
  110. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
@@ -1,882 +0,0 @@
1
- import { defineComponent as ee, ref as z, resolveComponent as b, openBlock as p, createElementBlock as k, createElementVNode as l, createVNode as r, unref as t, createCommentVNode as le, withCtx as E, Fragment as O, renderList as ie, createBlock as J, toDisplayString as $, normalizeClass as re, onMounted as Se, computed as ce, isRef as Ie, createSlots as Me, h as Y, onBeforeMount as Te } from "vue";
2
- import { _ as Ee } from "./campaign-CpzFl8Vr.js";
3
- import { p as Ae } from "./plugins-eQis66QR.js";
4
- import { u as De } from "./loading-BWGQSrCB.js";
5
- import { FmButtonVariant as ae, useSnackbar as Re, components as X } from "@feedmepos/ui-library";
6
- import { u as we, _ as be } from "./usePagination-BeF5K3M7.js";
7
- import { u as Fe } from "./vue-i18n-Bz45zC04.js";
8
- import "./index-B9pl4zRZ.js";
9
- import { i as $e, j as R, c as fe } from "./index-DNxa8Rqx.js";
10
- import "./index-CUfS9Kp1.js";
11
- import "./index-CONvJfKv.js";
12
- import "./index-BI3m1Ehv.js";
13
- import { u as ne, w as he } from "./xlsx-D4S4qbcZ.js";
14
- import { e as Pe, M as Be } from "./email-addresses-Ba7xImfX.js";
15
- import { Z as Ne } from "./zod-Bg2FbC-D.js";
16
- import { u as Ve } from "./app-wDQR6dpb.js";
17
- import { F as ye, z as Ye } from "./index-CS3Jmojj.js";
18
- import { R as ge } from "./rule-builder-Di9RIYHF.js";
19
- import { _ as Ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BlXzEWA6.js";
20
- import { _ as Le } from "./RuleGroup.vue_vue_type_script_setup_true_lang-DqNQl_nz.js";
21
- import { u as ze, v as Oe, w as je } from "./index.esm2017-ATcsD5N4.js";
22
- import { F as qe } from "./FileSaver.min-NlMItPOc.js";
23
- import { h as H } from "./moment-BWErdI6_.js";
24
- import { s as B, u as Ge } from "./membership-Cc4OZ8-U.js";
25
- import { o as He } from "./objectId-dwaoBfJX.js";
26
- import { u as Ce } from "./business-CmxV69wT.js";
27
- import { f as Je } from "./number-CMJjC4qz.js";
28
- import { t as Qe } from "./money-D7p8nfun.js";
29
- import "./index-CNJLP3D5.js";
30
- import { useRouter as We } from "vue-router";
31
- import { m as ve } from "./index-CvBcve-r.js";
32
- import { R as _e } from "./app-7cvPyHJ7.js";
33
- const Ze = $e.extend({
34
- _id: ye.optional(),
35
- business: ye.optional(),
36
- file: Ye.any().nullish()
37
- });
38
- var Ke = { firebase: { apiKey: "AIzaSyAj8JdCHtP0Vc5vZobCfgoLzWxPIn0WUG4", authDomain: "feedme-dev-4c3ef.firebaseapp.com", databaseURL: "https://feedme-dev-4c3ef.firebaseio.com", projectId: "feedme-dev-4c3ef", storageBucket: "feedme-dev-4c3ef.appspot.com", messagingSenderId: "458797803788", appId: "1:458797803788:web:37f2af2926a84288f0c129", measurementId: "G-J2QG09D2Q7" }, assetBucketUrl: "feedme-dev-4c3ef.appspot.com", importFilesBucketUrl: "feedme-dev-4c3ef.appspot.com", clientId: "1a362d621873497b277ea55258cc82594ba148d235257f7bd44ea2acc132d8a4" };
39
- const Xe = { class: "flex flex-col space-y-16" }, et = {
40
- key: 0,
41
- class: /* @__PURE__ */ re([
42
- "p-16 pl-24 space-x-8",
43
- "bg-fm-color-primary-oats rounded-lg",
44
- "flex items-center",
45
- "justify-between"
46
- ])
47
- }, tt = { class: "flex justify-end" }, ot = {
48
- key: 1,
49
- class: /* @__PURE__ */ re([
50
- "flex items-center",
51
- "border border-fm-color-neutral-gray-300",
52
- "p-16 space-x-16 rounded-md"
53
- ])
54
- }, at = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, nt = /* @__PURE__ */ ee({
55
- __name: "ImportSegment",
56
- props: {
57
- importFile: {}
58
- },
59
- emits: ["update:file"],
60
- setup(e, { emit: _ }) {
61
- const x = e, h = _, { t: m } = Fe(), y = z(null), f = z(null), F = ["Id"], i = [
62
- {
63
- label: "CSV",
64
- icon: "csv",
65
- value: "csv"
66
- },
67
- {
68
- label: "Excel",
69
- icon: "description",
70
- value: "xlsx"
71
- }
72
- ];
73
- async function n() {
74
- if (x.importFile)
75
- try {
76
- const S = ze(void 0, Ke.importFilesBucketUrl), g = Oe(S, x.importFile), w = await je(g);
77
- window.open(w, "_blank");
78
- } catch (S) {
79
- console.log(S);
80
- }
81
- }
82
- async function c(S) {
83
- switch (S) {
84
- case "csv":
85
- const g = new Blob([F.join(",")], {
86
- type: "text/csv;charset=utf-8;"
87
- });
88
- qe.saveAs(g, "ImportSegmentTemplate.csv");
89
- break;
90
- case "xlsx":
91
- const w = ne.aoa_to_sheet([F]), I = ne.book_new();
92
- ne.book_append_sheet(I, w, "Sheet1"), he(I, "ImportSegmentTemplate.xlsx");
93
- break;
94
- }
95
- }
96
- function C(S) {
97
- y.value = S, h("update:file", y.value);
98
- }
99
- function A(S) {
100
- var w, I;
101
- const g = ((I = (w = S.target) == null ? void 0 : w.files) == null ? void 0 : I[0]) ?? null;
102
- C(g);
103
- }
104
- return (S, g) => {
105
- const w = b("FmButton"), I = b("FmMenuItem"), u = b("FmMenu"), s = b("FmDropField");
106
- return p(), k("div", Xe, [
107
- g[2] || (g[2] = l("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
108
- S.importFile ? (p(), k("div", et, [
109
- r(w, {
110
- label: t(m)("View uploaded file"),
111
- variant: t(ae).Plain,
112
- icon: "file_present",
113
- onClick: n
114
- }, null, 8, ["label", "variant"])
115
- ])) : le("", !0),
116
- l("div", null, [
117
- l("div", tt, [
118
- r(u, { class: "" }, {
119
- "menu-button": E(() => [
120
- r(w, {
121
- variant: "tertiary",
122
- icon: "download",
123
- label: "Download Template"
124
- })
125
- ]),
126
- default: E(() => [
127
- (p(), k(O, null, ie(i, (v) => r(I, {
128
- key: v.value,
129
- icon: v.icon,
130
- label: v.label,
131
- onClick: (U) => c(v.value),
132
- selectable: ""
133
- }, null, 8, ["icon", "label", "onClick"])), 64))
134
- ]),
135
- _: 1
136
- })
137
- ]),
138
- y.value ? (p(), k("div", ot, [
139
- r(w, {
140
- variant: t(ae).Tertiary,
141
- "prepend-icon": "attach_file"
142
- }, null, 8, ["variant"]),
143
- l("p", at, $(y.value.name), 1),
144
- l("label", {
145
- ref_key: "fileLabelRef",
146
- ref: f,
147
- htmlFor: "file"
148
- }, [
149
- r(w, {
150
- variant: t(ae).Plain,
151
- label: t(m)("Replace File"),
152
- onClick: g[1] || (g[1] = () => {
153
- var v;
154
- return (v = f.value) == null ? void 0 : v.click();
155
- })
156
- }, null, 8, ["variant", "label"]),
157
- l("input", {
158
- id: "file",
159
- accept: ".csv",
160
- class: "hidden",
161
- type: "file",
162
- multiple: "",
163
- onChange: A
164
- }, null, 32)
165
- ], 512)
166
- ])) : (p(), J(s, {
167
- key: 0,
168
- onFileUpload: g[0] || (g[0] = (v) => C(v)),
169
- accept: ".csv, .xlsx",
170
- "max-file-size": 2e7
171
- }))
172
- ])
173
- ]);
174
- };
175
- }
176
- }), st = { class: "space-y-16 pr-12" }, lt = { class: "fm-typo-en-title-md-800" }, it = { class: "flex space-x-8" }, rt = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, ct = { class: "text-fm-color-typo-secondary" }, dt = /* @__PURE__ */ ee({
177
- __name: "ReviewSegment",
178
- props: {
179
- title: {},
180
- segment: {}
181
- },
182
- setup(e) {
183
- const _ = e, x = [
184
- {
185
- header: "Name",
186
- accessorFn: (n) => n.name
187
- },
188
- {
189
- header: "Id",
190
- accessorFn: (n) => n._id
191
- },
192
- {
193
- header: "Customer Since",
194
- accessorFn: (n) => H(He(n._id.toString())).format("DD MMM YYYY")
195
- },
196
- {
197
- header: "Phone",
198
- accessorFn: (n) => n.phoneNumber
199
- },
200
- {
201
- header: "Birthday",
202
- accessorFn: (n) => H(n.birthday).format("DD MMM YYYY")
203
- },
204
- {
205
- header: "Last Visit",
206
- accessorFn: (n) => H(n.stats.lastVisit).format("DD MMM YYYY")
207
- }
208
- ];
209
- async function h(n) {
210
- return _.segment._id ? (console.log(n), await B.paginateSegmentUsers(
211
- _.segment._id,
212
- n
213
- )) : {
214
- resources: [],
215
- meta: {
216
- totalResources: 0,
217
- totalPages: 0,
218
- skip: n.skip,
219
- limit: n.limit,
220
- sortBy: n.sortBy
221
- }
222
- };
223
- }
224
- const { tableMeta: m, rowData: y, onSort: f, debouncedFetchData: F, onSearch: i } = we(h);
225
- return Se(async () => {
226
- await F();
227
- }), (n, c) => (p(), k("div", st, [
228
- l("div", lt, $(_.title), 1),
229
- l("div", it, [
230
- l("div", rt, $(n.segment.members.length), 1),
231
- l("div", ct, [
232
- c[1] || (c[1] = l("div", null, "contacts in your segment", -1)),
233
- l("div", null, "as of " + $(t(H)(n.segment.lastUpdated).format("DD MMM YYYY")), 1)
234
- ])
235
- ]),
236
- r(be, {
237
- loading: t(m).isLoading,
238
- "row-data": t(y),
239
- "row-count": t(m).totalRows,
240
- "column-defs": x,
241
- "page-size": t(m).pageSize,
242
- "page-count": t(m).pageCount,
243
- "page-index": t(m).pageIndex,
244
- onSortChange: t(f),
245
- onPageChange: c[0] || (c[0] = (C) => t(F)({ pageSize: C.pageSize, pageIndex: C.pageIndex }))
246
- }, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
247
- ]));
248
- }
249
- }), ut = { class: "space-y-24" }, pt = { class: "grid grid-cols-2 gap-16" }, mt = { class: "fm-typo-en-title-sm-800" }, ft = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, yt = /* @__PURE__ */ ee({
250
- __name: "SegmentTypeOption",
251
- props: {
252
- modelValue: {},
253
- errorText: {}
254
- },
255
- emits: ["update:model-value"],
256
- setup(e, { emit: _ }) {
257
- const x = e, h = _, m = [
258
- {
259
- label: "Dynamic",
260
- sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
261
- value: R.enum.DYNAMIC
262
- },
263
- {
264
- label: "Static",
265
- sublabel: "Segment statistics are based on imported data and will not be recalculated.",
266
- value: R.enum.STATIC
267
- }
268
- ];
269
- function y(f) {
270
- f !== x.modelValue && h("update:model-value", f);
271
- }
272
- return (f, F) => {
273
- const i = b("FmCard"), n = b("FmHelperText");
274
- return p(), k("div", ut, [
275
- l("div", pt, [
276
- (p(), k(O, null, ie(m, (c) => r(i, {
277
- variant: "outlined",
278
- class: re(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
279
- "col-span-2": m.length == 1,
280
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": f.modelValue === c.value,
281
- "hover:bg-fm-color-opacity-sm": f.modelValue !== c.value
282
- }]),
283
- onClick: (C) => y(c.value),
284
- key: c.value
285
- }, {
286
- default: E(() => [
287
- l("div", mt, $(c.label), 1),
288
- l("div", ft, $(c.sublabel), 1)
289
- ]),
290
- _: 2
291
- }, 1032, ["class", "onClick"])), 64))
292
- ]),
293
- f.errorText ? (p(), J(n, {
294
- key: 0,
295
- class: "!mt-4",
296
- text: f.errorText,
297
- state: "error"
298
- }, null, 8, ["text"])) : le("", !0)
299
- ]);
300
- };
301
- }
302
- }), gt = { class: "flex items-center gap-x-8" }, vt = {
303
- key: 0,
304
- class: "space-y-16 pr-12"
305
- }, _t = { class: "flex flex-col space-y-16" }, xt = {
306
- key: 0,
307
- class: "flex flex-col space-y-16"
308
- }, St = {
309
- key: 1,
310
- class: "flex flex-col space-y-16"
311
- }, wt = {
312
- key: 2,
313
- class: "flex flex-col space-y-16"
314
- }, bt = { class: "flex items-center gap-8" }, Ft = /* @__PURE__ */ ee({
315
- __name: "SegmentSheet",
316
- emits: ["update:model-value"],
317
- setup(e, { expose: _, emit: x }) {
318
- const h = Ve(), m = z(!1), y = z(!1), f = {
319
- name: "",
320
- isActive: !0,
321
- type: R.enum.DYNAMIC,
322
- rule: ge.scaffoldGroup(),
323
- members: []
324
- }, F = Ze, i = z(f), n = ce(() => {
325
- const u = F.safeParse(i.value);
326
- return u.success ? [] : u.error.errors;
327
- });
328
- function c(u) {
329
- m.value = !0, y.value = !1, u ? i.value = {
330
- ...u,
331
- isActive: u.isActive !== !1,
332
- type: u.type ?? (u.importFile ? R.enum.STATIC : R.enum.DYNAMIC)
333
- } : i.value = { ...f };
334
- }
335
- function C() {
336
- m.value = !1;
337
- }
338
- async function A() {
339
- F.safeParse(i.value).success && (y.value = !0);
340
- }
341
- function S() {
342
- y.value = !1;
343
- }
344
- async function g() {
345
- i.value.type === R.enum.STATIC ? (i.value.rule = ge.scaffoldGroup(), i.value.isActive = !0) : i.value.file = void 0, I("update:model-value", i.value);
346
- }
347
- async function w(u) {
348
- i.value.type = u;
349
- }
350
- Se(async () => {
351
- });
352
- const I = x;
353
- return _({
354
- showSheet: c,
355
- hideSheet: C
356
- }), (u, s) => {
357
- const v = b("FmButton"), U = b("FmSwitch"), a = b("FmSideSheet");
358
- return p(), J(a, {
359
- modelValue: t(m),
360
- "onUpdate:modelValue": s[8] || (s[8] = (o) => Ie(m) ? m.value = o : null),
361
- header: "Add segment",
362
- "dismiss-away": "",
363
- "close-button": !0,
364
- "max-width": 1100
365
- }, Me({
366
- "side-sheet-footer": E(() => [
367
- l("div", bt, [
368
- t(y) || t(i).type === t(R).enum.STATIC ? (p(), k(O, { key: 0 }, [
369
- r(v, {
370
- label: "Save Segment",
371
- onClick: g,
372
- loading: t(h).isLoading,
373
- disabled: t(n).length > 0 || t(h).isLoading
374
- }, null, 8, ["loading", "disabled"]),
375
- r(v, {
376
- label: "Cancel",
377
- onClick: s[6] || (s[6] = (o) => S()),
378
- variant: "tertiary"
379
- })
380
- ], 64)) : (p(), k(O, { key: 1 }, [
381
- r(v, {
382
- label: "Review Segment",
383
- disabled: t(n).length > 0 || t(h).isLoading,
384
- onClick: A
385
- }, null, 8, ["disabled"]),
386
- r(v, {
387
- label: "Cancel",
388
- onClick: s[7] || (s[7] = (o) => C()),
389
- variant: "tertiary"
390
- })
391
- ], 64))
392
- ])
393
- ]),
394
- default: E(() => {
395
- var o;
396
- return [
397
- t(y) ? (p(), J(dt, {
398
- key: 1,
399
- title: t(i).name,
400
- segment: t(i)
401
- }, null, 8, ["title", "segment"])) : (p(), k("div", vt, [
402
- r(Ue, {
403
- modelValue: t(i).name,
404
- "onUpdate:modelValue": s[1] || (s[1] = (d) => t(i).name = d),
405
- label: "Segment title",
406
- schema: t(Ne).typeAtPath(t(F), "name")
407
- }, null, 8, ["modelValue", "schema"]),
408
- l("div", _t, [
409
- s[10] || (s[10] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
410
- r(yt, {
411
- "model-value": t(i).type,
412
- "onUpdate:modelValue": s[2] || (s[2] = (d) => {
413
- w(d);
414
- })
415
- }, null, 8, ["model-value"])
416
- ]),
417
- t(i).type === t(R).enum.DYNAMIC ? (p(), k("div", xt, [
418
- s[11] || (s[11] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
419
- r(Le, {
420
- "trigger-type": "MEMBERSHIP_JOINED",
421
- includeOnly: "user",
422
- "model-value": (o = t(i)) == null ? void 0 : o.rule,
423
- "onUpdate:modelValue": s[3] || (s[3] = (d) => {
424
- t(i).rule = d;
425
- })
426
- }, null, 8, ["model-value"])
427
- ])) : (p(), k("div", St, [
428
- r(nt, {
429
- importFile: t(i).importFile,
430
- "onUpdate:file": s[4] || (s[4] = (d) => {
431
- t(i).file = d;
432
- })
433
- }, null, 8, ["importFile"])
434
- ])),
435
- t(i).type === t(R).enum.DYNAMIC ? (p(), k("div", wt, [
436
- s[12] || (s[12] = l("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
437
- r(U, {
438
- "model-value": t(i).isActive ?? !0,
439
- "onUpdate:modelValue": s[5] || (s[5] = (d) => t(i).isActive = d),
440
- label: "Active",
441
- sublabel: "When enabled, this will recalculate the segment statistics daily.",
442
- "label-placement": "right"
443
- }, null, 8, ["model-value"])
444
- ])) : le("", !0)
445
- ]))
446
- ];
447
- }),
448
- _: 2
449
- }, [
450
- t(y) ? {
451
- name: "side-sheet-header",
452
- fn: E(() => [
453
- l("div", gt, [
454
- r(v, {
455
- icon: "arrow_back",
456
- variant: "tertiary",
457
- onClick: s[0] || (s[0] = (o) => y.value = !1)
458
- }),
459
- s[9] || (s[9] = l("div", null, "Review segment", -1))
460
- ])
461
- ]),
462
- key: "0"
463
- } : void 0
464
- ]), 1032, ["modelValue"]);
465
- };
466
- }
467
- }), xe = Ge(), ht = Ce();
468
- function se(e) {
469
- const _ = H(e);
470
- return _.isValid() ? _.format("DD/MM/YYYY") : "";
471
- }
472
- const Ct = {
473
- mapMemberExportRow: (e) => {
474
- var n, c, C, A, S, g, w, I, u, s, v, U, a, o, d, P, D, N, V, j, q, G, te, M, Q, de, ue, pe;
475
- const _ = ce(() => ht.locations.map((T) => ({
476
- label: T.name,
477
- value: T._id
478
- }))), x = (n = Pe.parseOneAddress(
479
- e == null ? void 0 : e.email
480
- )) != null && n.domain.includes("feedmepos.com") ? void 0 : e.email, h = (C = ((c = e == null ? void 0 : e.collection) == null ? void 0 : c.TITLE) || []) == null ? void 0 : C.reduce(
481
- (T, L) => {
482
- var Z, K;
483
- const W = (K = (Z = xe.sortedTitles) == null ? void 0 : Z.find(
484
- (oe) => oe._id === L.collectible
485
- )) == null ? void 0 : K.name;
486
- return !W || L.balance <= 0 || T.push(W), T;
487
- },
488
- []
489
- ), m = (xe.sortedTitles || []).reduce(
490
- (T, L) => {
491
- var Z, K, oe, me;
492
- const W = (me = (oe = (K = (((Z = e == null ? void 0 : e.collection) == null ? void 0 : Z.TITLE) || []).find(
493
- (ke) => ke.collectible === L._id
494
- )) == null ? void 0 : K.expiryBalance) == null ? void 0 : oe[0]) == null ? void 0 : me.expiredAt;
495
- return T[L.name] = W ? H(W).format("DD/MM/YYYY") : "", T;
496
- },
497
- {}
498
- ), y = ((g = (S = (A = e.collection) == null ? void 0 : A.CREDIT) == null ? void 0 : S.at(0)) == null ? void 0 : g.balance) || 0, f = ((s = (u = (I = (w = e.collection) == null ? void 0 : w.CREDIT) == null ? void 0 : I.at(0)) == null ? void 0 : u.expiryBalance) == null ? void 0 : s.reduce(
499
- (T, L) => T + L.amount,
500
- 0
501
- )) || 0, F = Je(y, 2);
502
- return {
503
- ID: e._id.toString(),
504
- Name: ((v = e.name) == null ? void 0 : v.trim()) || "",
505
- Phone: ((U = e == null ? void 0 : e.phoneNumber) == null ? void 0 : U.trim()) || "",
506
- Email: x || "",
507
- Gender: e.gender || "",
508
- CardNo: e.cardNo || "",
509
- Birthday: e != null && e.birthday ? se(e == null ? void 0 : e.birthday) : "",
510
- Credit: parseFloat((Number(F) - Number(f)).toFixed(2)),
511
- FreeCredit: Number(f.toFixed(2)),
512
- TotalCredit: Number(F),
513
- Exp: e != null && e.collection ? ((d = (o = (a = e.collection) == null ? void 0 : a.POINT) == null ? void 0 : o.at(0)) == null ? void 0 : d.balance) ?? 0 : 0,
514
- Point: e != null && e.collection ? ((N = (D = (P = e.collection) == null ? void 0 : P.COIN) == null ? void 0 : D.at(0)) == null ? void 0 : N.balance) ?? 0 : 0,
515
- Level: e != null && e.collection ? ((q = (j = (V = e.collection) == null ? void 0 : V.TIER) == null ? void 0 : j.at(0)) == null ? void 0 : q.balance) ?? 0 : 0,
516
- Tier: e != null && e.collection ? ((M = (te = (G = e.collection) == null ? void 0 : G.TIER) == null ? void 0 : te.at(0)) == null ? void 0 : M.balance) ?? 0 : 0,
517
- Titles: h.join(","),
518
- ...m,
519
- TotalTransaction: e.stats.visitCount,
520
- AvgSpent: Qe(Number(e.stats.avgBillSize || 0)).toFormat(
521
- !1
522
- ),
523
- TotalSpent: e.stats.avgBillSize * e.stats.visitCount,
524
- LastVisit: se(e.stats.lastVisit),
525
- Feedback: ((Q = e.stats) == null ? void 0 : Q.feedbackCount) || 0,
526
- LastSeasonTierEarned: ((de = e.stats) == null ? void 0 : de.lastSeasonTierEarned) || 0,
527
- LastSeasonPointEarned: ((ue = e.stats) == null ? void 0 : ue.lastSeasonPointEarned) || 0,
528
- JoinedAt: se(e.joinAt || void 0),
529
- JoinedAtLocation: e.location && ((pe = _.value.find((T) => T.value == e.location)) == null ? void 0 : pe.label) || "-",
530
- VisitFrequency: `${Number(
531
- Math.ceil(e.stats.avgVisitFrequency).toFixed(0)
532
- )}`
533
- };
534
- }
535
- }, kt = { class: "flex items-center" }, It = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Mt = { class: "px-24 flex flex-col gap-y-16" }, Tt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Et = { class: "fm-typo-en-body-md-600" }, At = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, uo = /* @__PURE__ */ ee({
536
- __name: "Segment",
537
- setup(e) {
538
- const { minor: _ } = De, { t: x } = Fe(), h = Ce(), { mapMemberExportRow: m } = Ct, y = Re(), f = We(), F = z(0), i = [
539
- {
540
- header: x("connect.loyalty.segment.table.name"),
541
- accessorFn: (a) => a.name
542
- },
543
- {
544
- header: x("connect.loyalty.segment.table.status"),
545
- enableSorting: !1,
546
- cell(a) {
547
- const o = a.row.original.isActive === !1 ? "Inactive" : "Active";
548
- return Y(X.FmChip, {
549
- class: a.row.original.isActive === !1 ? "text-fm-color-typo-error bg-fm-color-system-error-100" : "text-fm-color-typo-success bg-fm-color-system-success-100",
550
- label: o,
551
- compact: !0
552
- });
553
- }
554
- },
555
- {
556
- header: x("connect.loyalty.segment.table.total_customers"),
557
- accessorFn: (a) => a.memberCount ?? 0
558
- },
559
- {
560
- header: x("connect.loyalty.segment.table.customer_percentage"),
561
- accessorFn: (a) => ((a.memberCount ?? 0) * 100 / F.value).toFixed(2)
562
- },
563
- {
564
- header: x("connect.loyalty.segment.table.actions"),
565
- meta: {
566
- maxWidth: "100px"
567
- },
568
- cell(a) {
569
- return Y("div", { class: "flex items-center justify-end" }, [
570
- Y(
571
- X.FmMenu,
572
- {
573
- placement: "bottom-end",
574
- onClick: (o) => {
575
- o.stopPropagation();
576
- }
577
- },
578
- {
579
- "menu-button": () => Y(X.FmButton, {
580
- icon: "more_vert",
581
- iconColor: "neutral-gray-400",
582
- variant: "tertiary"
583
- }),
584
- default: () => [
585
- Y(
586
- X.FmMenuItem,
587
- {
588
- onClick: async (o) => {
589
- o.stopPropagation(), w(a.row.original);
590
- }
591
- },
592
- {
593
- label: Y(
594
- "div",
595
- {
596
- class: "fm-typo-en-body-md-400"
597
- },
598
- "Export"
599
- )
600
- }
601
- ),
602
- Y(
603
- X.FmMenuItem,
604
- {
605
- onClick: async (o) => {
606
- o.stopPropagation(), g(a.row.original);
607
- }
608
- },
609
- {
610
- label: Y(
611
- "div",
612
- {
613
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
614
- },
615
- "Remove"
616
- )
617
- }
618
- )
619
- ]
620
- }
621
- )
622
- ]);
623
- }
624
- }
625
- ], n = z(null), { tableMeta: c, rowData: C, debouncedFetchData: A } = we(
626
- B.readAll
627
- );
628
- async function S() {
629
- await _(
630
- async () => {
631
- await B.refreshSegments(), await A({ pageSize: 10, pageIndex: 0 });
632
- },
633
- { message: "Refreshing segmentations" }
634
- );
635
- }
636
- async function g(a) {
637
- await Ae.remove(`Are you sure you want to remove ${a.name}?`) && await _(
638
- async () => {
639
- await B.delete(a._id), await A({ pageSize: 10, pageIndex: 0 });
640
- },
641
- {
642
- message: `Removing ${a.name}`,
643
- successMessage: `Removed ${a.name} successfully`
644
- }
645
- );
646
- }
647
- async function w(a) {
648
- const o = {
649
- sortBy: "_id",
650
- descending: !1,
651
- rowsPerPage: 1e3,
652
- page: 1,
653
- rowsNumber: 0
654
- }, d = new Be(), P = (await ve.read({
655
- limit: 1,
656
- skip: 0,
657
- sortBy: o.sortBy,
658
- descending: o.descending
659
- })).meta.totalResources ?? 0, D = o.rowsPerPage;
660
- await _(
661
- async () => {
662
- for (let N = 0; N < P; N += D) {
663
- const V = {
664
- ...o,
665
- limit: D,
666
- skip: o.page - 1,
667
- sortBy: o.sortBy,
668
- descending: o.descending
669
- }, j = await B.paginateSegmentUsers(
670
- a._id,
671
- V
672
- );
673
- for (const q of j.resources) {
674
- const G = m(q);
675
- d.addRecord(G);
676
- }
677
- o.page++;
678
- }
679
- await he(
680
- d.buildExcel(),
681
- `[${a.name}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
682
- {
683
- bookType: "xlsx",
684
- bookSST: !1,
685
- type: "array"
686
- }
687
- ), o.page = 1;
688
- },
689
- {
690
- message: "Exporting member...",
691
- successMessage: "Member exported successfully"
692
- }
693
- );
694
- }
695
- async function I(a) {
696
- await _(
697
- async () => {
698
- var o;
699
- if (a.type === R.enum.STATIC) {
700
- const d = new FormData();
701
- if (d.append("file", a.file), a._id) {
702
- const { members: P, _id: D, file: N, ...V } = a;
703
- d.append("segment", JSON.stringify(V)), await B.updateStatic(a._id, d);
704
- } else {
705
- const { file: P, ...D } = a;
706
- d.append("segment", JSON.stringify(D)), await B.createStatic(d);
707
- }
708
- a.file && y.open({
709
- type: "info",
710
- title: "Import begins soon. Check Queue for updates.",
711
- action: "View",
712
- onAction: async () => {
713
- await f.push({
714
- name: _e["$connect-QUEUE"],
715
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
716
- });
717
- }
718
- });
719
- } else if (a._id) {
720
- const { members: d, _id: P, ...D } = a;
721
- await B.update(a._id, D);
722
- } else
723
- await B.create(a);
724
- await A({ pageSize: 10, pageIndex: 0 }), (o = n.value) == null || o.hideSheet();
725
- },
726
- {
727
- message: "Saving segment",
728
- successMessage: "Segment saved"
729
- }
730
- );
731
- }
732
- function u(a) {
733
- var o;
734
- (o = n.value) == null || o.showSheet(a);
735
- }
736
- const s = {
737
- label: x("connect.navigation.queue"),
738
- value: "queue",
739
- isPrimary: !1,
740
- prependIcon: "work_history"
741
- }, v = ce(() => h.isPremium ? [
742
- s,
743
- {
744
- label: "Refresh segments",
745
- value: "refresh",
746
- prependIcon: "refresh"
747
- },
748
- {
749
- label: "Add segment",
750
- value: "add",
751
- isPrimary: !0,
752
- prependIcon: "add"
753
- }
754
- ] : []);
755
- function U(a) {
756
- switch (a) {
757
- case "add":
758
- u();
759
- break;
760
- case "refresh":
761
- S();
762
- break;
763
- case "queue":
764
- f.push({
765
- name: _e["$connect-QUEUE"],
766
- query: { type: [fe.enum.SEGMENTATION_IMPORTED] }
767
- });
768
- break;
769
- }
770
- }
771
- return Te(async () => {
772
- const { meta: a } = await ve.read({
773
- limit: 1,
774
- skip: 0,
775
- sortBy: "_id",
776
- search: void 0,
777
- descending: !1
778
- });
779
- F.value = a.totalResources ?? 0, await A({ pageSize: 10, pageIndex: 0 }), await h.readPremium(), await h.readLocations();
780
- }), (a, o) => {
781
- const d = b("FmPill"), P = b("FmPageHead"), D = b("FmIcon"), N = b("FmMenuItem"), V = b("FmMenu"), j = b("FmListItem"), q = b("FmList"), G = b("FmButton"), te = b("FmCard");
782
- return p(), k(O, null, [
783
- r(P, {
784
- title: "Segments",
785
- actions: t(v),
786
- "onClick:action": o[0] || (o[0] = (M) => U(M))
787
- }, {
788
- title: E(() => [
789
- l("div", kt, [
790
- l("span", It, $(t(x)("connect.loyalty.segment.title")), 1),
791
- r(d, { variant: "premium" })
792
- ])
793
- ]),
794
- _: 1
795
- }, 8, ["actions"]),
796
- l("div", Mt, [
797
- t(C).length > 0 || t(c).searchValue || t(c).isLoading ? (p(), k(O, { key: 0 }, [
798
- r(be, {
799
- loading: t(c).isLoading,
800
- "row-data": t(C),
801
- "row-count": t(c).totalRows,
802
- "column-defs": i,
803
- "shrink-at": !1,
804
- "page-count": t(c).pageCount,
805
- "page-index": t(c).pageIndex,
806
- "page-size": t(c).pageSize,
807
- onRowClick: o[1] || (o[1] = (M) => {
808
- u(M.original);
809
- }),
810
- onPageChange: t(A)
811
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
812
- r(q, { class: "w-full hidden xs:block" }, {
813
- default: E(() => [
814
- (p(!0), k(O, null, ie(t(C), (M) => (p(), J(j, {
815
- key: M._id.toString(),
816
- tag: "label",
817
- onClick: (Q) => u(M)
818
- }, {
819
- default: E(() => [
820
- l("div", null, [
821
- l("div", Tt, $((M.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
822
- l("div", Et, $(M.name), 1),
823
- l("div", At, $(((M.memberCount ?? 0) * 100 / t(F)).toFixed(2)) + "% of customers ", 1)
824
- ])
825
- ]),
826
- append: E(() => [
827
- r(V, { "stop-click-propagation": !0 }, {
828
- "menu-button": E(() => [
829
- r(D, { name: "more_vert" })
830
- ]),
831
- default: E(() => [
832
- r(N, {
833
- class: "text-fm-color-typo-error fm-typo-en-body-md-400",
834
- label: "Remove",
835
- "onUpdate:modelValue": (Q) => Q && g(M)
836
- }, null, 8, ["onUpdate:modelValue"])
837
- ]),
838
- _: 2
839
- }, 1024)
840
- ]),
841
- _: 2
842
- }, 1032, ["onClick"]))), 128))
843
- ]),
844
- _: 1
845
- })
846
- ], 64)) : (p(), J(te, {
847
- key: 1,
848
- variant: "outlined",
849
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
850
- }, {
851
- default: E(() => [
852
- o[3] || (o[3] = l("img", {
853
- src: Ee,
854
- class: "aspect-square w-[150px]"
855
- }, null, -1)),
856
- o[4] || (o[4] = l("div", { class: "flex flex-col gap-16 text-center" }, [
857
- l("div", { class: "fm-typo-en-title-sm-800" }, "Create customer segments"),
858
- l("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Segments allow you to categorize your customers based on various criteria, enabling targeted marketing and personalized experiences. ")
859
- ], -1)),
860
- r(G, {
861
- variant: "primary",
862
- label: "Create segment",
863
- disabled: !t(h).isPremium,
864
- icon: "add",
865
- onClick: o[2] || (o[2] = (M) => u())
866
- }, null, 8, ["disabled"])
867
- ]),
868
- _: 1
869
- })),
870
- r(Ft, {
871
- ref_key: "sheetRef",
872
- ref: n,
873
- "onUpdate:modelValue": I
874
- }, null, 512)
875
- ])
876
- ], 64);
877
- };
878
- }
879
- });
880
- export {
881
- uo as default
882
- };