@feedmepos/mf-connect 0.1.98-beta.39 → 0.1.98-beta.40

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 (151) hide show
  1. package/package.json +1 -1
  2. package/dist/App-DwjQisFZ.js +0 -4785
  3. package/dist/AuditLogs-DMGqmriL.js +0 -2014
  4. package/dist/Bin-4wvIqogM.js +0 -166
  5. package/dist/Broadcast-DPpuSZ8_.js +0 -269
  6. package/dist/CampaignAnalytic-CXFDo2X_.js +0 -1826
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-SLoy1-Kd.js +0 -122
  8. package/dist/Card-C8SA6un0.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-BCpSiM_4.js +0 -541
  11. package/dist/Credit-C8RTBpP7.js +0 -286
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0OI5QzpR.js +0 -3382
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js +0 -351
  16. package/dist/Experience-Bg3kFQQE.js +0 -285
  17. package/dist/FileSaver.min-DMUuMi9w.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  20. package/dist/Game-D3DbkRUj.js +0 -356
  21. package/dist/GiftCardSetup-CxlMM4up.js +0 -542
  22. package/dist/Grab-DvEK8ixP.js +0 -301
  23. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js +0 -145
  24. package/dist/Index-Do_9DXuY.js +0 -259
  25. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  26. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js +0 -48
  27. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-D6wJN9Gj.js +0 -18737
  28. package/dist/LoyaltyDashboard-B4WqycGN.js +0 -1345
  29. package/dist/MainLayout-DdxLaufS.js +0 -143
  30. package/dist/Marketing-CcFEMwKB.js +0 -236
  31. package/dist/MarketingMaterialEdit-DoYFaMf7.js +0 -1036
  32. package/dist/Member-BussgBln.js +0 -281
  33. package/dist/MemberList-BXJxSsjo.js +0 -1603
  34. package/dist/MemberOverview-wL_ailso.js +0 -58
  35. package/dist/MemberTransactions-O-XY5nz3.js +0 -45
  36. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DsxrIO0r.js +0 -60957
  37. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +0 -38
  38. package/dist/Mission-CPkM-8Ns.js +0 -360
  39. package/dist/Overview-BJjpYUJN.js +0 -1080
  40. package/dist/Overview-C5KF_Jxj.js +0 -1316
  41. package/dist/Point-FDFwR3Hk.js +0 -288
  42. package/dist/Promotion-qtucKxn0.js +0 -423
  43. package/dist/Queue-d91tocPX.js +0 -261
  44. package/dist/Record-CvkK2iLq.js +0 -342
  45. package/dist/Review-C_zLGtzU.js +0 -45
  46. package/dist/ReviewFacebookCallback-Bidg3P76.js +0 -238
  47. package/dist/ReviewGoogleCallback-DL0lxMBL.js +0 -213
  48. package/dist/Reward-BTsQaI-J.js +0 -442
  49. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BjxA4eMX.js +0 -150
  50. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js +0 -1913
  51. package/dist/Segment-BgFyB3BK.js +0 -1017
  52. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CkhjFNvZ.js +0 -181
  53. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-HYbRyACe.js +0 -189
  54. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-7dv3cAW3.js +0 -226
  55. package/dist/Setting-BxHoCSxw.js +0 -2047
  56. package/dist/SettingAdvertisements-WfvuE4fA.js +0 -264
  57. package/dist/Settings-B42SAvEx.js +0 -179
  58. package/dist/Store-BnvWfCy-.js +0 -2413
  59. package/dist/StoreRewards-BRzAMqR-.js +0 -540
  60. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C3FJr1L5.js +0 -1075
  61. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js +0 -7007
  62. package/dist/Tier-BrzLNat2.js +0 -972
  63. package/dist/Title-EnlaNXld.js +0 -569
  64. package/dist/Transaction-BiXNxUGX.js +0 -39
  65. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Db5_DKQ0.js +0 -130
  66. package/dist/Voucher-C2dyk-jj.js +0 -444
  67. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js +0 -421
  68. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js +0 -56
  69. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  70. package/dist/app-Bt8HrAEr.js +0 -60740
  71. package/dist/app-wDQR6dpb.js +0 -39
  72. package/dist/app.js +0 -7
  73. package/dist/business-BwtQpfUr.js +0 -82
  74. package/dist/campaign-B6U9lwKi.js +0 -255
  75. package/dist/campaign-C6Cb9s3C.js +0 -100
  76. package/dist/campaign-CpzFl8Vr.js +0 -4
  77. package/dist/campaign.enum-Dx-Zo68Q.js +0 -26
  78. package/dist/campaign.fn-B0x2EGhw.js +0 -776
  79. package/dist/collectible.enum-Liy2wH3s.js +0 -19
  80. package/dist/collection.fn-DfoA9sJV.js +0 -26
  81. package/dist/duplicateCampaign-Cnq5N-V8.js +0 -51
  82. package/dist/effect-B2REbrv8.js +0 -89
  83. package/dist/email-addresses-BzmOsxLn.js +0 -705
  84. package/dist/export-jHpRhPQu.js +0 -97
  85. package/dist/feedme.ico +0 -0
  86. package/dist/google-C3S8u0mT.js +0 -4
  87. package/dist/helper-DQAHX1kX.js +0 -86
  88. package/dist/index-4GG-yjdN.js +0 -2963
  89. package/dist/index-BWgMbKOB.js +0 -85
  90. package/dist/index-BccUpf0U.js +0 -3
  91. package/dist/index-BkgkJkVs.js +0 -8919
  92. package/dist/index-C0PKVTf9.js +0 -32
  93. package/dist/index-C8cXXcLk.js +0 -45
  94. package/dist/index-CTTGf4TM.js +0 -151
  95. package/dist/index-C_H8jFYf.js +0 -2743
  96. package/dist/index-CuvNtC_M.js +0 -61
  97. package/dist/index-DJN4auwx.js +0 -146
  98. package/dist/index-DMr9ohGV.js +0 -1139
  99. package/dist/index-DQTo_ytu.js +0 -31
  100. package/dist/index-DW7-0rf_.js +0 -53
  101. package/dist/index-Da7J83jM.js +0 -2706
  102. package/dist/index-Di1Z4vLS.js +0 -27550
  103. package/dist/index-FoKZGh7Z.js +0 -67
  104. package/dist/index-N25Px7RQ.js +0 -72
  105. package/dist/index-PgblELTo.js +0 -897
  106. package/dist/index-STBMTK1u.js +0 -28900
  107. package/dist/index-hP3Mgc0u.js +0 -55
  108. package/dist/index-vh86FiIQ.js +0 -10
  109. package/dist/index.esm2017-DV56jzfJ.js +0 -3069
  110. package/dist/loading-D__sDcq1.js +0 -72
  111. package/dist/lodash-DgkDIHoV.js +0 -3678
  112. package/dist/membership-CBjt1MGx.js +0 -255
  113. package/dist/moment-D7p2TMB-.js +0 -2583
  114. package/dist/money-BFUbPKDM.js +0 -15
  115. package/dist/number-CJb8OUa3.js +0 -12
  116. package/dist/object-BYyQ0PZp.js +0 -18
  117. package/dist/objectId-dwaoBfJX.js +0 -7
  118. package/dist/objectid-BMUFNR9T.js +0 -145
  119. package/dist/plugins-D95ZeD-9.js +0 -1788
  120. package/dist/remy-Qz_pNsUS.js +0 -13
  121. package/dist/reward-CSfV_XFK.js +0 -36
  122. package/dist/rule-DIzVHy2z.js +0 -1969
  123. package/dist/rule-builder-DF7fCvec.js +0 -126
  124. package/dist/string-Gcy5IM_H.js +0 -32
  125. package/dist/style.css +0 -4
  126. package/dist/template-r3lAQP1B.js +0 -188
  127. package/dist/tier-BJDhpH6X.js +0 -4
  128. package/dist/tiers/tier=1.png +0 -0
  129. package/dist/tiers/tier=2.png +0 -0
  130. package/dist/tiers/tier=3.png +0 -0
  131. package/dist/tiers/tier=4.png +0 -0
  132. package/dist/timezone-D40qRUoz.js +0 -20
  133. package/dist/titles/type=diamond.png +0 -0
  134. package/dist/titles/type=drinks.png +0 -0
  135. package/dist/titles/type=food.png +0 -0
  136. package/dist/titles/type=heart.png +0 -0
  137. package/dist/titles/type=medal.png +0 -0
  138. package/dist/titles/type=spend.png +0 -0
  139. package/dist/titles/type=thank-you.png +0 -0
  140. package/dist/titles/type=thumbs-up.png +0 -0
  141. package/dist/titles/type=years.png +0 -0
  142. package/dist/transaction.fn-DV-cpfOj.js +0 -64
  143. package/dist/trigger-BEJaSv5R.js +0 -213
  144. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  145. package/dist/type_drinks-D6jnpvwV.js +0 -4
  146. package/dist/useMarketingMaterialActions-Bd5BDfE1.js +0 -96
  147. package/dist/usePagination-DLIo76-X.js +0 -220
  148. package/dist/user-DtEjuhyM.js +0 -55
  149. package/dist/vue-i18n-dQ1XCaUv.js +0 -2365
  150. package/dist/xlsx-BUMZsTov.js +0 -15491
  151. package/dist/zod-B_pVZhsV.js +0 -91
@@ -1,1017 +0,0 @@
1
- import { defineComponent as le, ref as W, resolveComponent as S, openBlock as r, createElementBlock as k, createElementVNode as s, createVNode as d, unref as e, createCommentVNode as J, withCtx as $, Fragment as Z, renderList as me, createBlock as V, toDisplayString as D, normalizeClass as ce, computed as O, onMounted as we, isRef as Te, createSlots as Ee, h as B, onBeforeMount as De } from "vue";
2
- import { _ as $e } from "./campaign-CpzFl8Vr.js";
3
- import { n as Ae, p as Pe } from "./plugins-D95ZeD-9.js";
4
- import { u as Re } from "./loading-D__sDcq1.js";
5
- import { FmButtonVariant as re, useSnackbar as Ne, components as ae } from "@feedmepos/ui-library";
6
- import { u as Fe, _ as Ce } from "./usePagination-DLIo76-X.js";
7
- import { u as pe } from "./vue-i18n-dQ1XCaUv.js";
8
- import "./index-Da7J83jM.js";
9
- import { g as Be, h as U, D as Ue, i as Ve } from "./index-4GG-yjdN.js";
10
- import "./index-BkgkJkVs.js";
11
- import { F as ye } from "./index-Di1Z4vLS.js";
12
- import { a as ge } from "./index-PgblELTo.js";
13
- import "./index-hP3Mgc0u.js";
14
- import { u as de, w as ke } from "./xlsx-BUMZsTov.js";
15
- import { e as Le, M as Ye } from "./email-addresses-BzmOsxLn.js";
16
- import { Z as ze } from "./zod-B_pVZhsV.js";
17
- import { u as Oe } from "./app-wDQR6dpb.js";
18
- import { z as je } from "./index-C_H8jFYf.js";
19
- import { R as ve } from "./rule-builder-DF7fCvec.js";
20
- import { _ as qe } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js";
21
- import { _ as Ge } from "./RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js";
22
- import { u as He, v as Je, w as Ke } from "./index.esm2017-DV56jzfJ.js";
23
- import { F as Qe } from "./FileSaver.min-DMUuMi9w.js";
24
- import { h as se } from "./moment-D7p2TMB-.js";
25
- import { s as z, u as We } from "./membership-CBjt1MGx.js";
26
- import { o as Ze } from "./objectId-dwaoBfJX.js";
27
- import { J as Xe } from "./JsonViewer-v8_C7l5N.js";
28
- import { u as Ie } from "./business-BwtQpfUr.js";
29
- import { f as et } from "./number-CJb8OUa3.js";
30
- import { t as tt } from "./money-BFUbPKDM.js";
31
- import "./index-BccUpf0U.js";
32
- import { useRouter as ot } from "vue-router";
33
- import { m as _e } from "./index-BWgMbKOB.js";
34
- import { R as xe } from "./app-Bt8HrAEr.js";
35
- const nt = Be.extend({
36
- _id: ye.optional(),
37
- business: ye.optional(),
38
- file: je.any().nullish()
39
- });
40
- var at = { 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" };
41
- const st = { class: "flex flex-col space-y-16" }, lt = {
42
- key: 0,
43
- class: /* @__PURE__ */ ce([
44
- "p-16 pl-24 space-x-8",
45
- "bg-fm-color-primary-oats rounded-lg",
46
- "flex items-center",
47
- "justify-between"
48
- ])
49
- }, it = { class: "flex justify-end" }, ct = {
50
- key: 1,
51
- class: /* @__PURE__ */ ce([
52
- "flex items-center",
53
- "border border-fm-color-neutral-gray-300",
54
- "p-16 space-x-16 rounded-md"
55
- ])
56
- }, rt = { class: "fm-typo-en-body-lg-400 flex-1 truncate" }, dt = /* @__PURE__ */ le({
57
- __name: "ImportSegment",
58
- props: {
59
- importFile: {}
60
- },
61
- emits: ["update:file"],
62
- setup(t, { emit: f }) {
63
- const c = t, M = f, { t: b } = pe(), _ = W(null), u = W(null), T = ["Id"], E = [
64
- {
65
- label: "CSV",
66
- icon: "csv",
67
- value: "csv"
68
- },
69
- {
70
- label: "Excel",
71
- icon: "description",
72
- value: "xlsx"
73
- }
74
- ];
75
- async function a() {
76
- if (c.importFile)
77
- try {
78
- const y = He(void 0, at.importFilesBucketUrl), p = Je(y, c.importFile), g = await Ke(p);
79
- window.open(g, "_blank");
80
- } catch (y) {
81
- console.log(y), Ae.error("Failed to download uploaded file");
82
- }
83
- }
84
- async function m(y) {
85
- switch (y) {
86
- case "csv":
87
- const p = new Blob([T.join(",")], {
88
- type: "text/csv;charset=utf-8;"
89
- });
90
- Qe.saveAs(p, "ImportSegmentTemplate.csv");
91
- break;
92
- case "xlsx":
93
- const g = de.aoa_to_sheet([T]), x = de.book_new();
94
- de.book_append_sheet(x, g, "Sheet1"), ke(x, "ImportSegmentTemplate.xlsx");
95
- break;
96
- }
97
- }
98
- function i(y) {
99
- _.value = y, M("update:file", _.value);
100
- }
101
- function A(y) {
102
- var g, x;
103
- const p = ((x = (g = y.target) == null ? void 0 : g.files) == null ? void 0 : x[0]) ?? null;
104
- i(p);
105
- }
106
- return (y, p) => {
107
- const g = S("FmButton"), x = S("FmMenuItem"), j = S("FmMenu"), q = S("FmDropField");
108
- return r(), k("div", st, [
109
- p[2] || (p[2] = s("div", { class: "fm-typo-en-title-sm-800" }, "Upload File", -1)),
110
- t.importFile ? (r(), k("div", lt, [
111
- d(g, {
112
- label: e(b)("View uploaded file"),
113
- variant: e(re).Plain,
114
- icon: "file_present",
115
- onClick: a
116
- }, null, 8, ["label", "variant"])
117
- ])) : J("", !0),
118
- s("div", null, [
119
- s("div", it, [
120
- d(j, { class: "" }, {
121
- "menu-button": $(() => [
122
- d(g, {
123
- variant: "tertiary",
124
- icon: "download",
125
- label: "Download Template"
126
- })
127
- ]),
128
- default: $(() => [
129
- (r(), k(Z, null, me(E, (I) => d(x, {
130
- key: I.value,
131
- icon: I.icon,
132
- label: I.label,
133
- onClick: (G) => m(I.value),
134
- selectable: ""
135
- }, null, 8, ["icon", "label", "onClick"])), 64))
136
- ]),
137
- _: 1
138
- })
139
- ]),
140
- _.value ? (r(), k("div", ct, [
141
- d(g, {
142
- variant: e(re).Tertiary,
143
- "prepend-icon": "attach_file"
144
- }, null, 8, ["variant"]),
145
- s("p", rt, D(_.value.name), 1),
146
- s("label", {
147
- ref_key: "fileLabelRef",
148
- ref: u,
149
- htmlFor: "file"
150
- }, [
151
- d(g, {
152
- variant: e(re).Plain,
153
- label: e(b)("Replace File"),
154
- onClick: p[1] || (p[1] = () => {
155
- var I;
156
- return (I = u.value) == null ? void 0 : I.click();
157
- })
158
- }, null, 8, ["variant", "label"]),
159
- s("input", {
160
- id: "file",
161
- accept: ".csv",
162
- class: "hidden",
163
- type: "file",
164
- multiple: "",
165
- onChange: A
166
- }, null, 32)
167
- ], 512)
168
- ])) : (r(), V(q, {
169
- key: 0,
170
- onFileUpload: p[0] || (p[0] = (I) => i(I)),
171
- accept: ".csv, .xlsx",
172
- "max-file-size": 2e7
173
- }))
174
- ])
175
- ]);
176
- };
177
- }
178
- }), ut = { class: "space-y-16 pr-12" }, mt = { class: "fm-typo-en-title-md-800" }, pt = { class: "flex space-x-8" }, ft = { class: "fm-typo-en-title-md-800 text-fm-color-primary" }, yt = { class: "text-fm-color-typo-secondary" }, Se = /* @__PURE__ */ le({
179
- __name: "ReviewSegment",
180
- props: {
181
- title: {},
182
- segment: {}
183
- },
184
- setup(t) {
185
- const f = t, c = O(
186
- () => f.segment.memberCount ?? f.segment.members.length
187
- ), M = O(
188
- () => f.segment.lastUpdated ? se(f.segment.lastUpdated).format("DD MMM YYYY") : "Not refreshed yet"
189
- ), b = [
190
- {
191
- header: "Name",
192
- accessorFn: (i) => i.name
193
- },
194
- {
195
- header: "Id",
196
- accessorFn: (i) => i._id
197
- },
198
- {
199
- header: "Customer Since",
200
- accessorFn: (i) => se(Ze(i._id.toString())).format("DD MMM YYYY")
201
- },
202
- {
203
- header: "Phone",
204
- accessorFn: (i) => i.phoneNumber
205
- },
206
- {
207
- header: "Birthday",
208
- accessorFn: (i) => se(i.birthday).format("DD MMM YYYY")
209
- },
210
- {
211
- header: "Last Visit",
212
- accessorFn: (i) => se(i.stats.lastVisit).format("DD MMM YYYY")
213
- }
214
- ];
215
- async function _(i) {
216
- return f.segment._id ? (console.log(i), await z.paginateSegmentUsers(
217
- f.segment._id,
218
- i
219
- )) : {
220
- resources: [],
221
- meta: {
222
- totalResources: 0,
223
- totalPages: 0,
224
- skip: i.skip,
225
- limit: i.limit,
226
- sortBy: i.sortBy
227
- }
228
- };
229
- }
230
- const { tableMeta: u, rowData: T, onSort: E, debouncedFetchData: a, onSearch: m } = Fe(_);
231
- return we(async () => {
232
- await a();
233
- }), (i, A) => (r(), k("div", ut, [
234
- s("div", mt, D(f.title), 1),
235
- s("div", pt, [
236
- s("div", ft, D(e(c)), 1),
237
- s("div", yt, [
238
- A[1] || (A[1] = s("div", null, "contacts in your segment", -1)),
239
- s("div", null, "as of " + D(e(M)), 1)
240
- ])
241
- ]),
242
- d(Ce, {
243
- loading: e(u).isLoading,
244
- "row-data": e(T),
245
- "row-count": e(u).totalRows,
246
- "column-defs": b,
247
- "page-size": e(u).pageSize,
248
- "page-count": e(u).pageCount,
249
- "page-index": e(u).pageIndex,
250
- onSortChange: e(E),
251
- onPageChange: A[0] || (A[0] = (y) => e(a)({ pageSize: y.pageSize, pageIndex: y.pageIndex }))
252
- }, null, 8, ["loading", "row-data", "row-count", "page-size", "page-count", "page-index", "onSortChange"])
253
- ]));
254
- }
255
- }), gt = { class: "space-y-24" }, vt = { class: "grid grid-cols-2 gap-16" }, _t = { class: "fm-typo-en-title-sm-800" }, xt = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, St = /* @__PURE__ */ le({
256
- __name: "SegmentTypeOption",
257
- props: {
258
- modelValue: {},
259
- errorText: {}
260
- },
261
- emits: ["update:model-value"],
262
- setup(t, { emit: f }) {
263
- const c = t, M = f, b = [
264
- {
265
- label: "Dynamic",
266
- sublabel: "Segment statistics are based on rules configured and will be recalculated automatically when rule changes.",
267
- value: U.enum.DYNAMIC
268
- },
269
- {
270
- label: "Static",
271
- sublabel: "Segment statistics are based on imported data and will not be recalculated.",
272
- value: U.enum.STATIC
273
- }
274
- ];
275
- function _(u) {
276
- u !== c.modelValue && M("update:model-value", u);
277
- }
278
- return (u, T) => {
279
- const E = S("FmCard"), a = S("FmHelperText");
280
- return r(), k("div", gt, [
281
- s("div", vt, [
282
- (r(), k(Z, null, me(b, (m) => d(E, {
283
- variant: "outlined",
284
- class: ce(["p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-2", {
285
- "col-span-2": b.length == 1,
286
- "border-fm-color-primary bg-fm-color-system-warning-100 hover:border-[var(--fm-color-system-orange-300)]": t.modelValue === m.value,
287
- "hover:bg-fm-color-opacity-sm": t.modelValue !== m.value
288
- }]),
289
- onClick: (i) => _(m.value),
290
- key: m.value
291
- }, {
292
- default: $(() => [
293
- s("div", _t, D(m.label), 1),
294
- s("div", xt, D(m.sublabel), 1)
295
- ]),
296
- _: 2
297
- }, 1032, ["class", "onClick"])), 64))
298
- ]),
299
- t.errorText ? (r(), V(a, {
300
- key: 0,
301
- class: "!mt-4",
302
- text: t.errorText,
303
- state: "error"
304
- }, null, 8, ["text"])) : J("", !0)
305
- ]);
306
- };
307
- }
308
- }), ht = { class: "flex items-center gap-x-8" }, bt = {
309
- key: 0,
310
- class: "space-y-16 pr-12"
311
- }, wt = {
312
- key: 0,
313
- class: "flex flex-col gap-12"
314
- }, Ft = { class: "flex flex-wrap items-center gap-8" }, Ct = { class: "fm-typo-en-title-sm-800" }, kt = { class: "flex flex-col gap-4" }, It = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Mt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Tt = {
315
- key: 2,
316
- class: "flex flex-col space-y-16"
317
- }, Et = {
318
- key: 3,
319
- class: "flex flex-col space-y-16"
320
- }, Dt = {
321
- key: 4,
322
- class: "flex flex-col space-y-16"
323
- }, $t = {
324
- key: 5,
325
- class: "flex flex-col space-y-16"
326
- }, At = { class: "flex items-center gap-8" }, Pt = /* @__PURE__ */ le({
327
- __name: "SegmentSheet",
328
- emits: ["update:model-value"],
329
- setup(t, { expose: f, emit: c }) {
330
- const M = Oe(), { t: b } = pe(), _ = W(!1), u = W(!1), T = {
331
- name: "",
332
- isActive: !0,
333
- type: U.enum.DYNAMIC,
334
- rule: ve.scaffoldGroup(),
335
- members: []
336
- }, E = nt, a = W(T), m = O(() => !!a.value.defaultKey), i = O(
337
- () => a.value.defaultKey ? `connect.loyalty.segment.default_segments.${a.value.defaultKey.toLowerCase()}` : void 0
338
- ), A = O(
339
- () => i.value ? b(`${i.value}.name`) : a.value.name
340
- ), y = O(() => {
341
- const v = a.value.defaultKey;
342
- return v ? b(Ue[v]) : a.value.description ?? "";
343
- }), p = O(() => {
344
- const v = E.safeParse(a.value);
345
- return v.success ? [] : v.error.errors;
346
- });
347
- function g(v) {
348
- _.value = !0, u.value = !1, v ? a.value = {
349
- ...v,
350
- isActive: v.isActive !== !1,
351
- type: v.type ?? (v.importFile ? U.enum.STATIC : U.enum.DYNAMIC)
352
- } : a.value = { ...T };
353
- }
354
- function x() {
355
- _.value = !1;
356
- }
357
- async function j() {
358
- E.safeParse(a.value).success && (u.value = !0);
359
- }
360
- function q(v) {
361
- v === U.enum.STATIC ? x() : u.value = !1;
362
- }
363
- async function I() {
364
- a.value.type === U.enum.STATIC ? (a.value.rule = ve.scaffoldGroup(), a.value.isActive = !0) : a.value.file = void 0, K("update:model-value", a.value);
365
- }
366
- async function G(v) {
367
- a.value.type = v;
368
- }
369
- we(async () => {
370
- });
371
- const K = c;
372
- return f({
373
- showSheet: g,
374
- hideSheet: x
375
- }), (v, l) => {
376
- const P = S("FmButton"), X = S("FmChip"), ee = S("FmCard"), te = S("FmSwitch"), o = S("FmSideSheet");
377
- return r(), V(o, {
378
- modelValue: e(_),
379
- "onUpdate:modelValue": l[9] || (l[9] = (n) => Te(_) ? _.value = n : null),
380
- header: e(m) ? e(b)("connect.loyalty.segment.default_segments.default_segment") : e(a)._id ? "Edit segment" : "Add segment",
381
- "dismiss-away": "",
382
- "close-button": !0,
383
- "max-width": 1100
384
- }, Ee({
385
- "side-sheet-footer": $(() => [
386
- s("div", At, [
387
- e(m) ? (r(), V(P, {
388
- key: 0,
389
- label: e(b)("connect.loyalty.segment.default_segments.close"),
390
- onClick: l[6] || (l[6] = (n) => x()),
391
- variant: "tertiary"
392
- }, null, 8, ["label"])) : e(u) || e(a).type === e(U).enum.STATIC ? (r(), k(Z, { key: 1 }, [
393
- d(P, {
394
- label: "Save Segment",
395
- onClick: I,
396
- loading: e(M).isLoading,
397
- disabled: e(p).length > 0 || e(M).isLoading
398
- }, null, 8, ["loading", "disabled"]),
399
- d(P, {
400
- label: "Cancel",
401
- onClick: l[7] || (l[7] = (n) => q(e(a).type)),
402
- variant: "tertiary"
403
- })
404
- ], 64)) : (r(), k(Z, { key: 2 }, [
405
- d(P, {
406
- label: "Review Segment",
407
- disabled: e(p).length > 0 || e(M).isLoading,
408
- onClick: j
409
- }, null, 8, ["disabled"]),
410
- d(P, {
411
- label: "Cancel",
412
- onClick: l[8] || (l[8] = (n) => x()),
413
- variant: "tertiary"
414
- })
415
- ], 64))
416
- ])
417
- ]),
418
- default: $(() => {
419
- var n, F;
420
- return [
421
- d(Xe, { json: e(a) }, null, 8, ["json"]),
422
- e(u) ? (r(), V(Se, {
423
- key: 1,
424
- title: e(a).name,
425
- segment: e(a)
426
- }, null, 8, ["title", "segment"])) : (r(), k("div", bt, [
427
- e(m) ? (r(), k("div", wt, [
428
- s("div", Ft, [
429
- s("div", Ct, D(e(A)), 1),
430
- d(X, {
431
- label: e(b)("connect.loyalty.segment.default_segments.system"),
432
- compact: "",
433
- class: "text-fm-color-typo-info bg-fm-color-system-info-100"
434
- }, null, 8, ["label"])
435
- ]),
436
- d(ee, {
437
- variant: "outlined",
438
- class: "p-16"
439
- }, {
440
- default: $(() => [
441
- s("div", kt, [
442
- s("div", It, D(e(b)("connect.loyalty.segment.default_segments.description")), 1),
443
- s("div", Mt, D(e(y)), 1)
444
- ])
445
- ]),
446
- _: 1
447
- })
448
- ])) : (r(), V(qe, {
449
- key: 1,
450
- modelValue: e(a).name,
451
- "onUpdate:modelValue": l[1] || (l[1] = (w) => e(a).name = w),
452
- label: "Segment title",
453
- schema: e(ze).typeAtPath(e(E), "name")
454
- }, null, 8, ["modelValue", "schema"])),
455
- e(m) ? J("", !0) : (r(), k("div", Tt, [
456
- l[11] || (l[11] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Type", -1)),
457
- d(St, {
458
- "model-value": e(a).type,
459
- "onUpdate:modelValue": l[2] || (l[2] = (w) => {
460
- G(w);
461
- })
462
- }, null, 8, ["model-value"])
463
- ])),
464
- e(a).type === e(U).enum.DYNAMIC && !e(m) ? (r(), k("div", Et, [
465
- l[12] || (l[12] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Filter", -1)),
466
- d(Ge, {
467
- "trigger-type": "MEMBERSHIP_JOINED",
468
- includeOnly: "user",
469
- "model-value": (n = e(a)) == null ? void 0 : n.rule,
470
- "onUpdate:modelValue": l[3] || (l[3] = (w) => {
471
- e(a).rule = w;
472
- })
473
- }, null, 8, ["model-value"])
474
- ])) : e(m) ? J("", !0) : (r(), k("div", Dt, [
475
- d(dt, {
476
- importFile: e(a).importFile,
477
- "onUpdate:file": l[4] || (l[4] = (w) => {
478
- e(a).file = w;
479
- })
480
- }, null, 8, ["importFile"])
481
- ])),
482
- e(a).type === e(U).enum.DYNAMIC && !e(m) ? (r(), k("div", $t, [
483
- l[13] || (l[13] = s("div", { class: "fm-typo-en-title-sm-800" }, "Segment Status", -1)),
484
- d(te, {
485
- "model-value": e(a).isActive ?? !0,
486
- "onUpdate:modelValue": l[5] || (l[5] = (w) => e(a).isActive = w),
487
- label: "Active",
488
- sublabel: "When enabled, this will recalculate the segment statistics daily.",
489
- "label-placement": "right"
490
- }, null, 8, ["model-value"])
491
- ])) : J("", !0),
492
- e(m) ? (r(), V(Se, {
493
- key: (F = e(a)._id) == null ? void 0 : F.toString(),
494
- title: e(b)("connect.loyalty.segment.default_segments.members"),
495
- segment: e(a)
496
- }, null, 8, ["title", "segment"])) : J("", !0)
497
- ]))
498
- ];
499
- }),
500
- _: 2
501
- }, [
502
- e(u) && !e(m) ? {
503
- name: "side-sheet-header",
504
- fn: $(() => [
505
- s("div", ht, [
506
- d(P, {
507
- icon: "arrow_back",
508
- variant: "tertiary",
509
- onClick: l[0] || (l[0] = (n) => u.value = !1)
510
- }),
511
- l[10] || (l[10] = s("div", null, "Review segment", -1))
512
- ])
513
- ]),
514
- key: "0"
515
- } : void 0
516
- ]), 1032, ["modelValue", "header"]);
517
- };
518
- }
519
- }), he = We(), Rt = Ie();
520
- function ue(t) {
521
- const f = se(t);
522
- return f.isValid() ? f.format("DD/MM/YYYY") : "";
523
- }
524
- const Nt = {
525
- mapMemberExportRow: (t) => {
526
- var a, m, i, A, y, p, g, x, j, q, I, G, K, v, l, P, X, ee, te, o, n, F, w, R, H, L, oe, ne;
527
- const f = O(() => Rt.locations.map((C) => ({
528
- label: C.name,
529
- value: C._id
530
- }))), c = (a = Le.parseOneAddress(
531
- t == null ? void 0 : t.email
532
- )) != null && a.domain.includes("feedmepos.com") ? void 0 : t.email, M = (i = ((m = t == null ? void 0 : t.collection) == null ? void 0 : m.TITLE) || []) == null ? void 0 : i.reduce(
533
- (C, N) => {
534
- var h, Y;
535
- const Q = (Y = (h = he.sortedTitles) == null ? void 0 : h.find(
536
- (ie) => ie._id === N.collectible
537
- )) == null ? void 0 : Y.name;
538
- return !Q || N.balance <= 0 || C.push(Q), C;
539
- },
540
- []
541
- ), b = (he.sortedTitles || []).reduce(
542
- (C, N) => {
543
- var h, Y, ie, fe;
544
- const Q = (fe = (ie = (Y = (((h = t == null ? void 0 : t.collection) == null ? void 0 : h.TITLE) || []).find(
545
- (Me) => Me.collectible === N._id
546
- )) == null ? void 0 : Y.expiryBalance) == null ? void 0 : ie[0]) == null ? void 0 : fe.expiredAt;
547
- return C[N.name] = Q ? se(Q).format("DD/MM/YYYY") : "", C;
548
- },
549
- {}
550
- ), _ = ((p = (y = (A = t.collection) == null ? void 0 : A.CREDIT) == null ? void 0 : y.at(0)) == null ? void 0 : p.balance) || 0, u = ((q = (j = (x = (g = t.collection) == null ? void 0 : g.CREDIT) == null ? void 0 : x.at(0)) == null ? void 0 : j.expiryBalance) == null ? void 0 : q.reduce(
551
- (C, N) => C + N.amount,
552
- 0
553
- )) || 0, T = et(_, 2);
554
- return {
555
- ID: t._id.toString(),
556
- Name: ((I = t.name) == null ? void 0 : I.trim()) || "",
557
- Phone: ((G = t == null ? void 0 : t.phoneNumber) == null ? void 0 : G.trim()) || "",
558
- Email: c || "",
559
- Gender: t.gender || "",
560
- CardNo: t.cardNo || "",
561
- Birthday: t != null && t.birthday ? ue(t == null ? void 0 : t.birthday) : "",
562
- Credit: parseFloat((Number(T) - Number(u)).toFixed(2)),
563
- FreeCredit: Number(u.toFixed(2)),
564
- TotalCredit: Number(T),
565
- Exp: t != null && t.collection ? ((l = (v = (K = t.collection) == null ? void 0 : K.POINT) == null ? void 0 : v.at(0)) == null ? void 0 : l.balance) ?? 0 : 0,
566
- Point: t != null && t.collection ? ((ee = (X = (P = t.collection) == null ? void 0 : P.COIN) == null ? void 0 : X.at(0)) == null ? void 0 : ee.balance) ?? 0 : 0,
567
- Level: t != null && t.collection ? ((n = (o = (te = t.collection) == null ? void 0 : te.TIER) == null ? void 0 : o.at(0)) == null ? void 0 : n.balance) ?? 0 : 0,
568
- Tier: t != null && t.collection ? ((R = (w = (F = t.collection) == null ? void 0 : F.TIER) == null ? void 0 : w.at(0)) == null ? void 0 : R.balance) ?? 0 : 0,
569
- Titles: M.join(","),
570
- ...b,
571
- TotalTransaction: t.stats.visitCount,
572
- AvgSpent: tt(Number(t.stats.avgBillSize || 0)).toFormat(
573
- !1
574
- ),
575
- TotalSpent: t.stats.avgBillSize * t.stats.visitCount,
576
- LastVisit: ue(t.stats.lastVisit),
577
- Feedback: ((H = t.stats) == null ? void 0 : H.feedbackCount) || 0,
578
- LastSeasonTierEarned: ((L = t.stats) == null ? void 0 : L.lastSeasonTierEarned) || 0,
579
- LastSeasonPointEarned: ((oe = t.stats) == null ? void 0 : oe.lastSeasonPointEarned) || 0,
580
- JoinedAt: ue(t.joinAt || void 0),
581
- JoinedAtLocation: t.location && ((ne = f.value.find((C) => C.value == t.location)) == null ? void 0 : ne.label) || "-",
582
- VisitFrequency: `${Number(
583
- Math.ceil(t.stats.avgVisitFrequency).toFixed(0)
584
- )}`
585
- };
586
- }
587
- }, Bt = { class: "flex items-center" }, Ut = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Vt = { class: "px-24 flex flex-col gap-y-16" }, Lt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, Yt = { class: "flex flex-wrap items-center gap-8" }, zt = { class: "fm-typo-en-body-md-600" }, Ot = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, jt = { class: "flex flex-col gap-16 text-center" }, qt = { class: "fm-typo-en-title-sm-800" }, Gt = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, be = "text-fm-color-typo-info bg-fm-color-system-info-100", Mo = /* @__PURE__ */ le({
588
- __name: "Segment",
589
- setup(t) {
590
- const { minor: f } = Re, { t: c } = pe(), M = Ie(), { mapMemberExportRow: b } = Nt, _ = Ne(), u = ot(), T = W(0);
591
- function E(o) {
592
- return !!o.defaultKey;
593
- }
594
- function a(o) {
595
- return o ? `connect.loyalty.segment.default_segments.${o.toLowerCase()}` : void 0;
596
- }
597
- function m(o) {
598
- const n = a(o.defaultKey);
599
- return n ? c(`${n}.name`) : o.name;
600
- }
601
- function i(o) {
602
- return T.value <= 0 ? "0.00" : ((o ?? 0) * 100 / T.value).toFixed(2);
603
- }
604
- const A = [
605
- {
606
- header: c("connect.loyalty.segment.table.name"),
607
- accessorFn: (o) => o.name,
608
- cell(o) {
609
- return B("div", { class: "flex flex-wrap items-center gap-8" }, [
610
- B("span", m(o.row.original)),
611
- ...E(o.row.original) ? [
612
- B(ae.FmChip, {
613
- class: be,
614
- label: c("connect.loyalty.segment.default_segments.system"),
615
- compact: !0
616
- })
617
- ] : []
618
- ]);
619
- }
620
- },
621
- {
622
- header: c("connect.loyalty.segment.table.status"),
623
- enableSorting: !1,
624
- cell(o) {
625
- const n = o.row.original.isActive === !1 ? "Inactive" : "Active";
626
- return B(ae.FmChip, {
627
- class: o.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",
628
- label: n,
629
- compact: !0
630
- });
631
- }
632
- },
633
- {
634
- header: c("connect.loyalty.segment.table.total_customers"),
635
- accessorFn: (o) => o.memberCount ?? 0
636
- },
637
- {
638
- header: c("connect.loyalty.segment.table.customer_percentage"),
639
- accessorFn: (o) => i(o.memberCount)
640
- },
641
- {
642
- header: c("connect.loyalty.segment.table.actions"),
643
- meta: {
644
- maxWidth: "100px"
645
- },
646
- cell(o) {
647
- return B("div", { class: "flex items-center justify-end" }, [
648
- B(
649
- ae.FmMenu,
650
- {
651
- placement: "bottom-end",
652
- onClick: (n) => {
653
- n.stopPropagation();
654
- }
655
- },
656
- {
657
- "menu-button": () => B(ae.FmButton, {
658
- icon: "more_vert",
659
- iconColor: "neutral-gray-400",
660
- variant: "tertiary"
661
- }),
662
- default: () => [
663
- B(
664
- ae.FmMenuItem,
665
- {
666
- onClick: async (n) => {
667
- n.stopPropagation(), K(o.row.original);
668
- }
669
- },
670
- {
671
- label: B(
672
- "div",
673
- {
674
- class: "fm-typo-en-body-md-400"
675
- },
676
- "Export"
677
- )
678
- }
679
- ),
680
- ...E(o.row.original) ? [] : [
681
- B(
682
- ae.FmMenuItem,
683
- {
684
- onClick: async (n) => {
685
- n.stopPropagation(), G(o.row.original);
686
- }
687
- },
688
- {
689
- label: B(
690
- "div",
691
- {
692
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
693
- },
694
- "Remove"
695
- )
696
- }
697
- )
698
- ]
699
- ]
700
- }
701
- )
702
- ]);
703
- }
704
- }
705
- ], y = W(null), { tableMeta: p, rowData: g, debouncedFetchData: x } = Fe(
706
- z.readAll
707
- ), j = O(() => g.value.length === 0 ? !1 : Ve.some(
708
- (o) => !g.value.some((n) => n.defaultKey === o)
709
- ));
710
- async function q() {
711
- var o;
712
- try {
713
- await z.refreshSegments(), _.open({ type: "info", title: "Segment refresh queued" });
714
- } catch (n) {
715
- if (((n == null ? void 0 : n.status) ?? ((o = n == null ? void 0 : n.response) == null ? void 0 : o.status)) === 409) {
716
- _.open({
717
- type: "info",
718
- title: "Segment refresh already in progress"
719
- });
720
- return;
721
- }
722
- _.open({
723
- type: "error",
724
- title: (n == null ? void 0 : n.message) ?? "Failed to queue segment refresh"
725
- });
726
- }
727
- }
728
- async function I() {
729
- await f(
730
- async () => {
731
- await z.startDefaultSegments(), await x({ pageSize: 10, pageIndex: 0 });
732
- },
733
- {
734
- message: c(
735
- "connect.loyalty.segment.default_segments.get_started.loading"
736
- ),
737
- successMessage: c(
738
- "connect.loyalty.segment.default_segments.get_started.success"
739
- )
740
- }
741
- );
742
- }
743
- async function G(o) {
744
- await Pe.remove(`Are you sure you want to remove ${o.name}?`) && await f(
745
- async () => {
746
- await z.delete(o._id), await x({ pageSize: 10, pageIndex: 0 });
747
- },
748
- {
749
- message: `Removing ${o.name}`,
750
- successMessage: `Removed ${o.name} successfully`
751
- }
752
- );
753
- }
754
- async function K(o) {
755
- const n = {
756
- sortBy: "_id",
757
- descending: !1,
758
- rowsPerPage: 1e3,
759
- page: 1,
760
- rowsNumber: 0
761
- }, F = new Ye(), w = m(o), R = (await _e.read({
762
- limit: 1,
763
- skip: 0,
764
- sortBy: n.sortBy,
765
- descending: n.descending
766
- })).meta.totalResources ?? 0, H = n.rowsPerPage;
767
- await f(
768
- async () => {
769
- for (let L = 0; L < R; L += H) {
770
- const oe = {
771
- ...n,
772
- limit: H,
773
- skip: n.page - 1,
774
- sortBy: n.sortBy,
775
- descending: n.descending
776
- }, ne = await z.paginateSegmentUsers(
777
- o._id,
778
- oe
779
- );
780
- for (const C of ne.resources) {
781
- const N = b(C);
782
- F.addRecord(N);
783
- }
784
- n.page++;
785
- }
786
- await ke(
787
- F.buildExcel(),
788
- `[${w}]-members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
789
- {
790
- bookType: "xlsx",
791
- bookSST: !1,
792
- type: "array"
793
- }
794
- ), n.page = 1;
795
- },
796
- {
797
- message: "Exporting member...",
798
- successMessage: "Member exported successfully"
799
- }
800
- );
801
- }
802
- async function v(o) {
803
- await f(
804
- async () => {
805
- var n;
806
- if (o.type === U.enum.STATIC) {
807
- const F = new FormData();
808
- if (F.append("file", o.file), o._id) {
809
- const { members: w, _id: R, file: H, ...L } = o;
810
- F.append("segment", JSON.stringify(L)), await z.updateStatic(o._id, F);
811
- } else {
812
- const { file: w, ...R } = o;
813
- F.append("segment", JSON.stringify(R)), await z.createStatic(F);
814
- }
815
- o.file && _.open({
816
- type: "info",
817
- title: "Import begins soon. Check Queue for updates.",
818
- action: "View",
819
- onAction: async () => {
820
- await u.push({
821
- name: xe["$connect-QUEUE"],
822
- query: { type: [ge.enum.SEGMENTATION_IMPORTED] }
823
- });
824
- }
825
- });
826
- } else if (o._id) {
827
- const { members: F, _id: w, ...R } = o;
828
- await z.update(o._id, R);
829
- } else
830
- await z.create(o);
831
- await x({ pageSize: 10, pageIndex: 0 }), (n = y.value) == null || n.hideSheet();
832
- },
833
- {
834
- message: "Saving segment",
835
- successMessage: "Segment saved"
836
- }
837
- );
838
- }
839
- function l(o) {
840
- var n;
841
- (n = y.value) == null || n.showSheet(o);
842
- }
843
- const P = {
844
- label: c("connect.navigation.queue"),
845
- value: "queue",
846
- isPrimary: !1,
847
- prependIcon: "work_history"
848
- }, X = {
849
- label: c("connect.loyalty.segment.default_segments.get_started.action"),
850
- value: "start-default-segments",
851
- isPrimary: !1,
852
- prependIcon: "auto_awesome"
853
- }, ee = O(() => {
854
- if (!M.isPremium)
855
- return [];
856
- const o = [P];
857
- return j.value && o.push(X), o.push(
858
- {
859
- label: c("connect.loyalty.segment.actions.refresh"),
860
- value: "refresh",
861
- prependIcon: "refresh"
862
- },
863
- {
864
- label: c("connect.loyalty.segment.actions.add"),
865
- value: "add",
866
- isPrimary: !0,
867
- prependIcon: "add"
868
- }
869
- ), o;
870
- });
871
- function te(o) {
872
- switch (o) {
873
- case "add":
874
- l();
875
- break;
876
- case "refresh":
877
- q();
878
- break;
879
- case "queue":
880
- u.push({
881
- name: xe["$connect-QUEUE"],
882
- query: { type: [ge.enum.SEGMENTATION_IMPORTED] }
883
- });
884
- break;
885
- case "start-default-segments":
886
- I();
887
- break;
888
- }
889
- }
890
- return De(async () => {
891
- const { meta: o } = await _e.read({
892
- limit: 1,
893
- skip: 0,
894
- sortBy: "_id",
895
- search: void 0,
896
- descending: !1
897
- });
898
- T.value = o.totalResources ?? 0, await x({ pageSize: 10, pageIndex: 0 }), await M.readPremium(), await M.readLocations();
899
- }), (o, n) => {
900
- const F = S("FmPill"), w = S("FmPageHead"), R = S("FmChip"), H = S("FmIcon"), L = S("FmMenuItem"), oe = S("FmMenu"), ne = S("FmListItem"), C = S("FmList"), N = S("FmButton"), Q = S("FmCard");
901
- return r(), k(Z, null, [
902
- d(w, {
903
- title: "Segments",
904
- actions: e(ee),
905
- "onClick:action": n[0] || (n[0] = (h) => te(h))
906
- }, {
907
- title: $(() => [
908
- s("div", Bt, [
909
- s("span", Ut, D(e(c)("connect.loyalty.segment.title")), 1),
910
- d(F, { variant: "premium" })
911
- ])
912
- ]),
913
- _: 1
914
- }, 8, ["actions"]),
915
- s("div", Vt, [
916
- e(g).length > 0 || e(p).searchValue || e(p).isLoading ? (r(), k(Z, { key: 0 }, [
917
- d(Ce, {
918
- loading: e(p).isLoading,
919
- "row-data": e(g),
920
- "row-count": e(p).totalRows,
921
- "column-defs": A,
922
- "shrink-at": !1,
923
- "page-count": e(p).pageCount,
924
- "page-index": e(p).pageIndex,
925
- "page-size": e(p).pageSize,
926
- onRowClick: n[1] || (n[1] = (h) => {
927
- l(h.original);
928
- }),
929
- onPageChange: e(x)
930
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onPageChange"]),
931
- d(C, { class: "w-full hidden xs:!block" }, {
932
- default: $(() => [
933
- (r(!0), k(Z, null, me(e(g), (h) => (r(), V(ne, {
934
- key: h._id.toString(),
935
- tag: "label",
936
- onClick: (Y) => l(h)
937
- }, {
938
- default: $(() => [
939
- s("div", null, [
940
- s("div", Lt, D((h.memberCount ?? 0).toLocaleString()) + " total customers ", 1),
941
- s("div", Yt, [
942
- s("span", zt, D(m(h)), 1),
943
- E(h) ? (r(), V(R, {
944
- key: 0,
945
- class: ce(be),
946
- label: e(c)("connect.loyalty.segment.default_segments.system"),
947
- compact: ""
948
- }, null, 8, ["label"])) : J("", !0)
949
- ]),
950
- s("div", Ot, D(i(h.memberCount)) + "% of customers ", 1)
951
- ])
952
- ]),
953
- append: $(() => [
954
- d(oe, { "stop-click-propagation": !0 }, {
955
- "menu-button": $(() => [
956
- d(H, { name: "more_vert" })
957
- ]),
958
- default: $(() => [
959
- d(L, {
960
- class: "fm-typo-en-body-md-400",
961
- label: "Export",
962
- "onUpdate:modelValue": (Y) => Y && K(h)
963
- }, null, 8, ["onUpdate:modelValue"]),
964
- E(h) ? J("", !0) : (r(), V(L, {
965
- key: 0,
966
- class: "text-fm-color-typo-error fm-typo-en-body-md-400",
967
- label: "Remove",
968
- "onUpdate:modelValue": (Y) => Y && G(h)
969
- }, null, 8, ["onUpdate:modelValue"]))
970
- ]),
971
- _: 2
972
- }, 1024)
973
- ]),
974
- _: 2
975
- }, 1032, ["onClick"]))), 128))
976
- ]),
977
- _: 1
978
- })
979
- ], 64)) : (r(), V(Q, {
980
- key: 1,
981
- variant: "outlined",
982
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
983
- }, {
984
- default: $(() => [
985
- n[3] || (n[3] = s("img", {
986
- src: $e,
987
- class: "aspect-square w-[150px]"
988
- }, null, -1)),
989
- s("div", jt, [
990
- s("div", qt, D(e(c)("connect.loyalty.segment.default_segments.get_started.title")), 1),
991
- s("div", Gt, D(e(c)(
992
- "connect.loyalty.segment.default_segments.get_started.description"
993
- )), 1)
994
- ]),
995
- d(N, {
996
- variant: "primary",
997
- label: e(c)("connect.loyalty.segment.default_segments.get_started.action"),
998
- disabled: !e(M).isPremium,
999
- icon: "auto_awesome",
1000
- onClick: n[2] || (n[2] = (h) => I())
1001
- }, null, 8, ["label", "disabled"])
1002
- ]),
1003
- _: 1
1004
- })),
1005
- d(Pt, {
1006
- ref_key: "sheetRef",
1007
- ref: y,
1008
- "onUpdate:modelValue": v
1009
- }, null, 512)
1010
- ])
1011
- ], 64);
1012
- };
1013
- }
1014
- });
1015
- export {
1016
- Mo as default
1017
- };