@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,342 +0,0 @@
1
- var q = Object.defineProperty;
2
- var G = (g, o, m) => o in g ? q(g, o, { enumerable: !0, configurable: !0, writable: !0, value: m }) : g[o] = m;
3
- var z = (g, o, m) => G(g, typeof o != "symbol" ? o + "" : o, m);
4
- import { defineComponent as T, ref as B, computed as H, resolveComponent as C, openBlock as I, createBlock as J, unref as n, isRef as Q, withCtx as X, createElementBlock as U, createVNode as w, withModifiers as Z, createCommentVNode as ee, createElementVNode as N, h, onMounted as re, Fragment as te } from "vue";
5
- import { u as oe, _ as ae } from "./usePagination-DLIo76-X.js";
6
- import { g as A } from "./user-DtEjuhyM.js";
7
- import { components as R } from "@feedmepos/ui-library";
8
- import "./index-Di1Z4vLS.js";
9
- import { u as j } from "./vue-i18n-dQ1XCaUv.js";
10
- import { u as L } from "./loading-D__sDcq1.js";
11
- import { useCoreStore as se } from "@feedmepos/mf-common";
12
- import { r as v } from "./index-C0PKVTf9.js";
13
- import { c as ie, a as ne } from "./object-BYyQ0PZp.js";
14
- import { u as ce } from "./membership-CBjt1MGx.js";
15
- import { c as le } from "./string-Gcy5IM_H.js";
16
- import { c as de } from "./plugins-D95ZeD-9.js";
17
- import { u as V, w as me } from "./xlsx-BUMZsTov.js";
18
- import { e as f } from "./index-vh86FiIQ.js";
19
- import { h as ue } from "./moment-D7p2TMB-.js";
20
- import { o as pe } from "./objectId-dwaoBfJX.js";
21
- const fe = {
22
- key: 0,
23
- class: "flex justify-end mb-16"
24
- }, ge = { class: "flex flex-col space-y-16 pr-12" }, he = /* @__PURE__ */ T({
25
- __name: "UpdateCriteriaProgressSheet",
26
- emits: ["refresh"],
27
- setup(g, { expose: o, emit: m }) {
28
- const y = m;
29
- j();
30
- const { minor: k } = L, l = B(!1), d = B({}), F = se(), S = [
31
- {
32
- header: "Criteria title",
33
- accessorFn: (a) => a.name
34
- },
35
- {
36
- header: "Status",
37
- cell(a) {
38
- var u;
39
- const e = a.row.original, r = (u = d.value.criteria_progress) == null ? void 0 : u.find(
40
- (_) => _.criteria === e._id
41
- ), i = r ? "Completed" : "Pending", c = r ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-warning bg-fm-color-system-warning-100";
42
- return [
43
- h(R.FmChip, {
44
- label: i,
45
- compact: !0,
46
- class: c
47
- })
48
- ];
49
- }
50
- },
51
- {
52
- id: "actions",
53
- cell(a) {
54
- var i;
55
- const e = a.row.original;
56
- return [
57
- !((i = d.value.criteria_progress) == null ? void 0 : i.some(
58
- (c) => c.criteria === e._id
59
- )) && e.type == "MANUAL" ? h(R.FmButton, {
60
- variant: "secondary",
61
- label: "Mark as completed",
62
- size: "md",
63
- onClick: (c) => {
64
- c.stopPropagation(), x(e._id.toString());
65
- }
66
- }) : null
67
- ];
68
- }
69
- }
70
- ], M = H(() => {
71
- var e, r, i, c;
72
- return (((r = (e = d.value) == null ? void 0 : e.criteria_progress) == null ? void 0 : r.filter(
73
- (u) => {
74
- var _;
75
- return (_ = d.value) == null ? void 0 : _.criteria.some(
76
- (P) => P._id.toString() === u.criteria.toString()
77
- );
78
- }
79
- )) || []).length == ((i = d.value) == null ? void 0 : i.criteria.length) && ((c = d.value) == null ? void 0 : c.status) != "COMPLETED";
80
- });
81
- async function x(a) {
82
- var r;
83
- const e = ie(ne(d.value));
84
- e.criteria_progress = [
85
- {
86
- criteria: a,
87
- ref: `ADMIN:${(r = F.user) == null ? void 0 : r.id}:${(/* @__PURE__ */ new Date()).toISOString()}`,
88
- completedAt: /* @__PURE__ */ new Date()
89
- }
90
- ], k(
91
- async () => {
92
- await v.updateCriteriaProgress(
93
- d.value._id,
94
- e
95
- ), l.value = !1, y("refresh");
96
- },
97
- {
98
- message: "Updating criteria progress",
99
- successMessage: "Criteria progress updated successfully"
100
- }
101
- );
102
- }
103
- function t(a, e) {
104
- l.value = a, d.value = e;
105
- }
106
- function s() {
107
- l.value = !1;
108
- }
109
- return o({
110
- showSheet: t,
111
- hideSheet: s,
112
- data: d
113
- }), (a, e) => {
114
- const r = C("FmButton"), i = C("FmTable"), c = C("FmSideSheet");
115
- return I(), J(c, {
116
- "max-width": 768,
117
- modelValue: n(l),
118
- "onUpdate:modelValue": e[1] || (e[1] = (u) => Q(l) ? l.value = u : null),
119
- header: "Referee Criteria"
120
- }, {
121
- default: X(() => [
122
- n(M) ? (I(), U("div", fe, [
123
- w(r, {
124
- icon: "refresh",
125
- label: "Refresh",
126
- onClick: e[0] || (e[0] = Z((u) => x(n(d)._id), ["stop"]))
127
- })
128
- ])) : ee("", !0),
129
- N("div", ge, [
130
- w(i, {
131
- "row-data": n(d).criteria,
132
- "hide-footer": !0,
133
- "page-size": 100,
134
- "column-defs": S
135
- }, null, 8, ["row-data"])
136
- ])
137
- ]),
138
- _: 1
139
- }, 8, ["modelValue"]);
140
- };
141
- }
142
- });
143
- class _e {
144
- constructor() {
145
- z(this, "data", []);
146
- }
147
- addRecord(o) {
148
- this.data.push(o);
149
- }
150
- buildExcel() {
151
- const o = V.book_new(), m = V.json_to_sheet(this.data);
152
- return V.book_append_sheet(o, m, "Referrals"), o;
153
- }
154
- }
155
- const we = { class: "flex items-center justify-end" }, ze = /* @__PURE__ */ T({
156
- __name: "Record",
157
- setup(g) {
158
- const { t: o } = j();
159
- ce();
160
- const { minor: m } = L, y = B(null), k = [
161
- {
162
- header: "ID",
163
- meta: {
164
- maxWidth: "100px"
165
- },
166
- cell(t) {
167
- return h("div", { class: "flex items-center" }, [
168
- h(R.FmIcon, {
169
- name: "content_copy",
170
- outline: !0,
171
- size: "sm",
172
- class: "cursor-pointer mr-4",
173
- onClick: (s) => {
174
- s.preventDefault(), s.stopPropagation(), de(t.row.original._id.toString());
175
- }
176
- }),
177
- h(
178
- "div",
179
- { class: "pr-2 text-ellipsis overflow-hidden" },
180
- t.row.original._id.toString()
181
- )
182
- ]);
183
- },
184
- enableSorting: !1
185
- },
186
- {
187
- header: o("connect.referral.record.referer_info"),
188
- enableSorting: !0,
189
- cell(t) {
190
- return t.row.original.pf_referer ? A(t.row.original.pf_referer, !0) : "N/A";
191
- }
192
- },
193
- {
194
- header: o("connect.referral.record.referee_info"),
195
- enableSorting: !0,
196
- cell(t) {
197
- return t.row.original.pf_referee ? A(t.row.original.pf_referee, !0) : "N/A";
198
- }
199
- },
200
- {
201
- header: o("connect.referral.record.referee_criteria"),
202
- accessorKey: "criteria",
203
- id: "criteria",
204
- cell(t) {
205
- var r;
206
- const a = (((r = t.row.original.criteria_progress) == null ? void 0 : r.filter(
207
- (i) => t.row.original.criteria.some(
208
- (c) => c._id.toString() === i.criteria.toString()
209
- )
210
- )) || []).length, e = t.row.original.criteria.length;
211
- return e === 0 ? h("div", "No criteria") : h("div", `${a}/${e} completed criteria`);
212
- }
213
- },
214
- {
215
- header: o("connect.referral.record.status"),
216
- id: "status",
217
- cell(t) {
218
- const s = t.row.original.status;
219
- return h(R.FmChip, {
220
- label: le.title(s.replace("_", " ")),
221
- compact: !0,
222
- class: s == "COMPLETED" ? "text-fm-color-typo-success bg-fm-color-system-success-100" : "text-fm-color-typo-primary bg-fm-color-system-primary-100"
223
- });
224
- }
225
- }
226
- ], { tableMeta: l, rowData: d, onSort: F, debouncedFetchData: S, onSearch: M } = oe(v.readRecords);
227
- async function x() {
228
- const t = new _e(), s = (await v.readRecords({
229
- limit: 1,
230
- skip: 0,
231
- sortBy: f.sortBy,
232
- descending: f.descending
233
- })).meta.totalResources ?? 0, a = f.rowsPerPage;
234
- await m(
235
- async () => {
236
- var e, r, i, c;
237
- for (let u = 0; u < s; u += a) {
238
- const _ = {
239
- ...f,
240
- limit: a,
241
- skip: f.page - 1,
242
- sortBy: f.sortBy,
243
- descending: f.descending
244
- }, P = await v.readRecords(_);
245
- for (const p of P.resources) {
246
- const E = (p.criteria || []).reduce(
247
- (b, D) => {
248
- var $;
249
- const Y = (($ = p.criteria_progress) == null ? void 0 : $.filter(
250
- (K) => p.criteria.some(
251
- (W) => W._id.toString() === K.criteria.toString()
252
- )
253
- )) || [];
254
- return b[D.name] = Y.length > 0 ? "Completed" : "In Progress", b;
255
- },
256
- {}
257
- );
258
- console.log(E);
259
- const O = {
260
- ID: p._id.toString(),
261
- RefererName: ((e = p.pf_referer) == null ? void 0 : e.name) ?? "",
262
- RefererPhone: ((r = p.pf_referer) == null ? void 0 : r.phoneNumber) ?? "",
263
- RefereeName: ((i = p.pf_referee) == null ? void 0 : i.name) ?? "",
264
- RefereePhone: ((c = p.pf_referee) == null ? void 0 : c.phoneNumber) ?? "",
265
- ReferredAt: ue(pe(p._id)).format(
266
- "DD/MM/YYYY"
267
- ),
268
- Status: p.status,
269
- Criteria: Object.entries(E).map(([b, D]) => `${b}: ${D}`).join(", ")
270
- };
271
- t.addRecord(O);
272
- }
273
- f.page++;
274
- }
275
- await me(
276
- t.buildExcel(),
277
- `referrals-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
278
- {
279
- bookType: "xlsx",
280
- bookSST: !1,
281
- type: "array"
282
- }
283
- ), f.page = 1;
284
- },
285
- {
286
- message: "Exporting referral records...",
287
- successMessage: "Referral record exported successfully"
288
- }
289
- );
290
- }
291
- return re(async () => {
292
- await S();
293
- }), (t, s) => {
294
- const a = C("FmSearch"), e = C("FmButton");
295
- return I(), U(te, null, [
296
- N("div", null, [
297
- N("div", we, [
298
- w(a, {
299
- class: "mt-4",
300
- modelValue: n(l).searchValue,
301
- "onUpdate:modelValue": [
302
- s[0] || (s[0] = (r) => n(l).searchValue = r),
303
- n(M)
304
- ],
305
- placeholder: "Search",
306
- collapsible: ""
307
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
308
- w(e, {
309
- icon: "ios_share",
310
- variant: "tertiary",
311
- onClick: x
312
- })
313
- ]),
314
- w(ae, {
315
- loading: n(l).isLoading,
316
- "row-data": n(d),
317
- "row-count": n(l).totalRows,
318
- "column-defs": k,
319
- "shrink-at": !1,
320
- "page-count": n(l).pageCount,
321
- "page-index": n(l).pageIndex,
322
- "page-size": n(l).pageSize,
323
- onSortChange: n(F),
324
- onPageChange: s[1] || (s[1] = (r) => n(S)({ pageSize: r.pageSize, pageIndex: r.pageIndex })),
325
- onRowClick: s[2] || (s[2] = (r) => {
326
- var i;
327
- return (i = n(y)) == null ? void 0 : i.showSheet(!0, r.original);
328
- })
329
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
330
- ]),
331
- w(he, {
332
- ref_key: "updateCriteriaProgressSheetRef",
333
- ref: y,
334
- onRefresh: n(S)
335
- }, null, 8, ["onRefresh"])
336
- ], 64);
337
- };
338
- }
339
- });
340
- export {
341
- ze as default
342
- };
@@ -1,45 +0,0 @@
1
- import { defineComponent as d, computed as v, resolveComponent as n, openBlock as f, createElementBlock as E, Fragment as R, createVNode as a, unref as l, createElementVNode as s } from "vue";
2
- import { u as b } from "./vue-i18n-dQ1XCaUv.js";
3
- import { R as r } from "./app-Bt8HrAEr.js";
4
- import { useRouter as V } from "vue-router";
5
- const w = { class: "flex flex-col" }, T = { class: "px-24" }, S = /* @__PURE__ */ d({
6
- __name: "Review",
7
- setup(g) {
8
- const { t } = b(), c = V(), o = [
9
- {
10
- label: t("connect.review.tabs.overview"),
11
- value: r["$connect-REVIEW_OVERVIEW"]
12
- },
13
- {
14
- label: t("connect.review.tabs.settings"),
15
- value: r["$connect-REVIEW_SETTINGS"]
16
- }
17
- ], m = v(
18
- () => o.find((e) => e.value === c.currentRoute.value.name) ?? o[0]
19
- );
20
- async function u(e) {
21
- await c.push({ name: e });
22
- }
23
- return (e, x) => {
24
- const i = n("FmPageHead"), _ = n("FmTabs"), p = n("RouterView");
25
- return f(), E(R, null, [
26
- a(i, {
27
- title: l(t)("connect.navigation.review")
28
- }, null, 8, ["title"]),
29
- s("div", w, [
30
- s("div", T, [
31
- a(_, {
32
- "model-value": l(m).value,
33
- items: o,
34
- "onUpdate:modelValue": u
35
- }, null, 8, ["model-value"])
36
- ]),
37
- a(p)
38
- ])
39
- ], 64);
40
- };
41
- }
42
- });
43
- export {
44
- S as default
45
- };
@@ -1,238 +0,0 @@
1
- import { defineComponent as C, computed as M, openBlock as l, createElementBlock as g, normalizeClass as j, createElementVNode as u, createBlock as T, unref as e, toDisplayString as h, createCommentVNode as S, createVNode as y, onMounted as B, ref as P, Fragment as $, renderList as U, resolveComponent as z, isRef as V } from "vue";
2
- import { u as R } from "./vue-i18n-dQ1XCaUv.js";
3
- import { components as I } from "@feedmepos/ui-library";
4
- import { r as L } from "./index-N25Px7RQ.js";
5
- import { u as A } from "./business-BwtQpfUr.js";
6
- import { _ as H } from "./LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js";
7
- import { R as D } from "./app-Bt8HrAEr.js";
8
- import { useRouter as G } from "vue-router";
9
- const O = ["src"], W = { class: "fm-typo-en-body-md-600 flex-1 truncate" }, q = {
10
- key: 2,
11
- class: "fm-typo-en-body-sm-400 text-fm-color-primary-500 shrink-0"
12
- }, J = /* @__PURE__ */ C({
13
- __name: "FacebookPageConfig",
14
- props: {
15
- page: {},
16
- expanded: { type: Boolean },
17
- availableLocations: {}
18
- },
19
- emits: ["toggleExpand", "toggleLocation"],
20
- setup(s, { emit: n }) {
21
- const _ = s, f = n, { t: i } = R(), m = M(() => _.page.locationIds);
22
- return (w, p) => (l(), g("div", {
23
- class: j([
24
- "rounded-lg border overflow-hidden transition-colors",
25
- s.expanded ? "border-fm-color-primary-500" : "border-fm-color-neutral-gray-200"
26
- ])
27
- }, [
28
- u("button", {
29
- class: "w-full flex items-center gap-12 p-16 bg-white text-left hover:bg-fm-color-neutral-gray-50 transition-colors",
30
- onClick: p[0] || (p[0] = (c) => f("toggleExpand"))
31
- }, [
32
- s.page.pageProfileImageUrl ? (l(), g("img", {
33
- key: 0,
34
- src: s.page.pageProfileImageUrl,
35
- class: "w-32 h-32 rounded-full shrink-0 object-cover"
36
- }, null, 8, O)) : (l(), T(e(I).FmIcon, {
37
- key: 1,
38
- name: "thumb_up",
39
- class: "text-fm-color-neutral-gray-400 shrink-0"
40
- })),
41
- u("span", W, h(s.page.pageName), 1),
42
- s.page.locationIds.length > 0 ? (l(), g("span", q, h(e(i)("connect.review.locationsSelected", s.page.locationIds.length)), 1)) : S("", !0),
43
- y(e(I).FmIcon, {
44
- name: s.expanded ? "expand_less" : "expand_more",
45
- class: "text-fm-color-neutral-gray-400 shrink-0"
46
- }, null, 8, ["name"])
47
- ]),
48
- s.expanded ? (l(), T(H, {
49
- key: 0,
50
- locations: s.availableLocations,
51
- "selected-ids": e(m),
52
- onToggle: p[1] || (p[1] = (c) => f("toggleLocation", c))
53
- }, null, 8, ["locations", "selected-ids"])) : S("", !0)
54
- ], 2));
55
- }
56
- }), K = { class: "flex flex-col gap-8" }, Q = /* @__PURE__ */ C({
57
- __name: "FacebookPageLocationMapping",
58
- props: {
59
- pages: {}
60
- },
61
- emits: ["update:pages"],
62
- setup(s, { emit: n }) {
63
- const _ = s, f = A();
64
- B(() => f.readLocations());
65
- const i = n, m = P(null), w = M(() => {
66
- const r = /* @__PURE__ */ new Set();
67
- for (const v of _.pages)
68
- v.locationIds.forEach((a) => r.add(a));
69
- return r;
70
- });
71
- function p(r) {
72
- const v = new Set(r.locationIds);
73
- return f.locations.filter((a) => {
74
- const b = a._id.toString();
75
- return !w.value.has(b) || v.has(b);
76
- });
77
- }
78
- function c(r, v) {
79
- const a = v._id.toString(), b = _.pages.map((o) => {
80
- if (o.facebookPageId !== r) return o;
81
- const t = o.locationIds.includes(a);
82
- return {
83
- ...o,
84
- locationIds: t ? o.locationIds.filter((k) => k !== a) : [...o.locationIds, a]
85
- };
86
- });
87
- i("update:pages", b);
88
- }
89
- function F(r) {
90
- m.value = m.value === r ? null : r;
91
- }
92
- return (r, v) => (l(), g("div", K, [
93
- (l(!0), g($, null, U(s.pages, (a) => (l(), T(J, {
94
- key: a.facebookPageId,
95
- page: a,
96
- expanded: e(m) === a.facebookPageId,
97
- "available-locations": p(a),
98
- onToggleExpand: (b) => F(a.facebookPageId),
99
- onToggleLocation: (b) => c(a.facebookPageId, b)
100
- }, null, 8, ["page", "expanded", "available-locations", "onToggleExpand", "onToggleLocation"]))), 128))
101
- ]));
102
- }
103
- }), X = { class: "flex flex-col min-h-full gap-16 p-24" }, Y = {
104
- key: 0,
105
- class: "flex flex-col items-center justify-center flex-1 gap-16"
106
- }, Z = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ee = {
107
- key: 1,
108
- class: "flex flex-col items-center justify-center flex-1 gap-16"
109
- }, oe = { class: "fm-typo-en-body-lg-600" }, te = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ne = {
110
- key: 2,
111
- class: "flex flex-col items-center justify-center flex-1 gap-16"
112
- }, ae = { class: "fm-typo-en-body-lg-600" }, se = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ce = { class: "fm-typo-en-body-lg-600" }, le = { class: "flex gap-8 justify-end mt-auto pt-8" }, ve = /* @__PURE__ */ C({
113
- __name: "ReviewFacebookCallback",
114
- setup(s) {
115
- const { t: n } = R(), _ = G();
116
- function f() {
117
- return _.replace({ name: D["$connect-REVIEW_SETTINGS"] });
118
- }
119
- const i = P([]), m = P(!1), w = P(!1), p = P(!1), c = P(null), F = M(
120
- () => i.value.some((o) => o.locationIds.length > 0)
121
- );
122
- function r(o, t) {
123
- const k = new Map(
124
- t.map((d) => [d.facebookPageId, d])
125
- );
126
- return o.map((d) => {
127
- var x;
128
- return {
129
- ...d,
130
- locationIds: ((x = k.get(d.facebookPageId)) == null ? void 0 : x.locationIds) ?? []
131
- };
132
- });
133
- }
134
- function v(o, t) {
135
- return o instanceof Error ? o.message : t;
136
- }
137
- async function a() {
138
- var d;
139
- const o = window.location.hash;
140
- if (!o) {
141
- c.value = n("connect.review.noToken");
142
- return;
143
- }
144
- const k = new URLSearchParams(o.slice(1)).get("access_token");
145
- if (!k) {
146
- c.value = n("connect.review.noToken");
147
- return;
148
- }
149
- m.value = !0;
150
- try {
151
- const x = await L.getSource(), N = ((d = x == null ? void 0 : x.facebook) == null ? void 0 : d.pages) ?? [], E = await L.connectFacebook(k);
152
- i.value = r((E == null ? void 0 : E.pages) ?? [], N), i.value.length === 0 && (c.value = n("connect.review.facebook.noPages"));
153
- } catch (x) {
154
- c.value = v(x, n("connect.review.facebook.failed"));
155
- } finally {
156
- m.value = !1;
157
- }
158
- }
159
- async function b() {
160
- const o = i.value.filter((t) => t.locationIds.length > 0).map((t) => ({
161
- facebookPageId: t.facebookPageId,
162
- locationIds: t.locationIds
163
- }));
164
- if (o.length === 0) {
165
- c.value = n("connect.review.noMappings");
166
- return;
167
- }
168
- w.value = !0;
169
- try {
170
- await L.updateFacebookPages(o), p.value = !0, setTimeout(f, 2e3);
171
- } catch (t) {
172
- c.value = v(t, n("connect.review.facebook.failed"));
173
- } finally {
174
- w.value = !1;
175
- }
176
- }
177
- return B(a), (o, t) => {
178
- const k = z("FmPageHead");
179
- return l(), g($, null, [
180
- y(k, {
181
- title: e(n)("connect.navigation.review")
182
- }, null, 8, ["title"]),
183
- u("div", X, [
184
- e(m) ? (l(), g("div", Y, [
185
- y(e(I).FmIcon, {
186
- name: "sync",
187
- size: "xl",
188
- class: "animate-spin text-fm-color-neutral-gray-400"
189
- }),
190
- u("p", Z, h(e(n)("connect.review.facebook.fetching")), 1)
191
- ])) : e(p) ? (l(), g("div", ee, [
192
- y(e(I).FmIcon, {
193
- name: "check_circle",
194
- size: "xl",
195
- class: "text-fm-color-typo-success"
196
- }),
197
- u("p", oe, h(e(n)("connect.review.facebook.success")), 1),
198
- u("p", te, h(e(n)("connect.review.redirecting")), 1)
199
- ])) : e(c) ? (l(), g("div", ne, [
200
- y(e(I).FmIcon, {
201
- name: "error",
202
- size: "xl",
203
- class: "text-fm-color-system-error-500"
204
- }),
205
- u("p", ae, h(e(n)("connect.review.errorTitle")), 1),
206
- u("p", se, h(e(c)), 1),
207
- y(e(I).FmButton, {
208
- label: e(n)("connect.review.goBack"),
209
- onClick: t[0] || (t[0] = (d) => f())
210
- }, null, 8, ["label"])
211
- ])) : e(i).length > 0 ? (l(), g($, { key: 3 }, [
212
- u("p", ce, h(e(n)("connect.review.facebook.selectPage")), 1),
213
- y(Q, {
214
- pages: e(i),
215
- "onUpdate:pages": t[1] || (t[1] = (d) => V(i) ? i.value = d : null)
216
- }, null, 8, ["pages"]),
217
- u("div", le, [
218
- y(e(I).FmButton, {
219
- variant: "outlined",
220
- label: e(n)("connect.review.cancel"),
221
- onClick: t[2] || (t[2] = (d) => f())
222
- }, null, 8, ["label"]),
223
- y(e(I).FmButton, {
224
- label: e(n)("connect.review.connect"),
225
- disabled: !e(F),
226
- loading: e(w),
227
- onClick: b
228
- }, null, 8, ["label", "disabled", "loading"])
229
- ])
230
- ], 64)) : S("", !0)
231
- ])
232
- ], 64);
233
- };
234
- }
235
- });
236
- export {
237
- ve as default
238
- };