@feedmepos/mf-connect 0.1.98-beta.13 → 0.1.98-beta.15

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 (138) hide show
  1. package/package.json +1 -1
  2. package/dist/App-DQqZfak3.js +0 -4782
  3. package/dist/AuditLogs-C19m85wp.js +0 -2013
  4. package/dist/Bin-GjJ5Q2ae.js +0 -166
  5. package/dist/Broadcast-CVTBL0T0.js +0 -266
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B6BYvVmq.js +0 -120
  7. package/dist/Card-DzYit3v6.js +0 -910
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-CaU7auvn.js +0 -540
  10. package/dist/Credit-B_eUMV0R.js +0 -260
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  12. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bgcm1S_g.js +0 -3377
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CZLoCJM4.js +0 -351
  15. package/dist/Experience-B7kxE07l.js +0 -259
  16. package/dist/FileSaver.min-BBvy4uPh.js +0 -74
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  19. package/dist/Game-B98hcWvR.js +0 -330
  20. package/dist/Grab-RdxV7xhM.js +0 -300
  21. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBYekrJp.js +0 -145
  22. package/dist/Index-CvMVxCY5.js +0 -259
  23. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  24. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-D4-wjMg6.js +0 -48
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Jir8zY8e.js +0 -18737
  26. package/dist/LoyaltyDashboard-B1OzFT4q.js +0 -1082
  27. package/dist/MainLayout-De_edc-D.js +0 -41
  28. package/dist/Marketing-B7-To3XF.js +0 -235
  29. package/dist/MarketingMaterialEdit-DGONncxn.js +0 -1035
  30. package/dist/Member-DEGCrqnh.js +0 -280
  31. package/dist/MemberList-vKYbpLVu.js +0 -1601
  32. package/dist/MemberOverview-wL_ailso.js +0 -58
  33. package/dist/MemberTransactions-CGC3vYKC.js +0 -45
  34. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BP9YtuPA.js +0 -60802
  35. package/dist/Mission-hxf_AIGL.js +0 -334
  36. package/dist/Overview-NvgUuMYp.js +0 -949
  37. package/dist/Overview-iRLMLoAo.js +0 -1079
  38. package/dist/Point-tkUTXOCe.js +0 -262
  39. package/dist/Promotion-DNUcMKJQ.js +0 -397
  40. package/dist/Queue-5XYiIuG8.js +0 -260
  41. package/dist/Record-B5aYp7eF.js +0 -342
  42. package/dist/Review-BqaHlzXV.js +0 -45
  43. package/dist/ReviewFacebookCallback-BqlFkSB7.js +0 -248
  44. package/dist/ReviewGoogleCallback-ssKL4jh4.js +0 -213
  45. package/dist/Reward-1xOMowTW.js +0 -442
  46. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Db3FSfIc.js +0 -149
  47. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cmrp2Tia.js +0 -1911
  48. package/dist/Segment-BMBwsUug.js +0 -1014
  49. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DSfdei-h.js +0 -181
  50. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BJVeGJ5J.js +0 -188
  51. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-OBZubKUy.js +0 -226
  52. package/dist/Setting-DWygYkHW.js +0 -2047
  53. package/dist/SettingAdvertisements-TYB1b7dB.js +0 -264
  54. package/dist/Settings-DynjmCPL.js +0 -220
  55. package/dist/Store-DRYkmigC.js +0 -1996
  56. package/dist/StoreRewards-DU8eWbXE.js +0 -540
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkqBjEFm.js +0 -1130
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l6KmXVBZ.js +0 -7007
  59. package/dist/Tier-4k8SxKtl.js +0 -969
  60. package/dist/Title-B9lWQ_jl.js +0 -566
  61. package/dist/Transaction-C38Yd0tf.js +0 -39
  62. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-D6tgpKpc.js +0 -130
  63. package/dist/Voucher-BQbqC7RV.js +0 -421
  64. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-erwpbvYi.js +0 -421
  65. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-Dt05b7fU.js +0 -56
  66. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  67. package/dist/app-BTm9mz0r.js +0 -59940
  68. package/dist/app-wDQR6dpb.js +0 -39
  69. package/dist/app.js +0 -7
  70. package/dist/business-B7GwHLce.js +0 -82
  71. package/dist/campaign-BCdKDHgz.js +0 -277
  72. package/dist/campaign-CpzFl8Vr.js +0 -4
  73. package/dist/campaign-DWlsbsKQ.js +0 -219
  74. package/dist/campaign.enum-BgK4maXz.js +0 -26
  75. package/dist/campaign.fn-DxnwGCB2.js +0 -776
  76. package/dist/collectible.enum-CdOSUDwG.js +0 -19
  77. package/dist/duplicateCampaign-BSHe0P-g.js +0 -51
  78. package/dist/effect-C7wkN_13.js +0 -89
  79. package/dist/email-addresses-DJycNI7L.js +0 -705
  80. package/dist/export-uIHWDxuh.js +0 -97
  81. package/dist/feedme.ico +0 -0
  82. package/dist/google-BQK68wbe.js +0 -5
  83. package/dist/helper-czpAhAIw.js +0 -86
  84. package/dist/index-5Sa4xS2m.js +0 -151
  85. package/dist/index-5WGEWCcI.js +0 -3
  86. package/dist/index-B2C7kc4z.js +0 -31
  87. package/dist/index-B5eb6_bi.js +0 -3678
  88. package/dist/index-B7nE1Pb2.js +0 -67
  89. package/dist/index-BFAHLexA.js +0 -32
  90. package/dist/index-BanxlNli.js +0 -8910
  91. package/dist/index-ByHoFriu.js +0 -85
  92. package/dist/index-Ca2bBJuR.js +0 -54
  93. package/dist/index-CuvNtC_M.js +0 -61
  94. package/dist/index-D-kYrDAi.js +0 -30289
  95. package/dist/index-D2gAYMIp.js +0 -28900
  96. package/dist/index-DWxmK2NJ.js +0 -61
  97. package/dist/index-U_rwkNKU.js +0 -2819
  98. package/dist/index-knizSLfz.js +0 -1157
  99. package/dist/index-vh86FiIQ.js +0 -10
  100. package/dist/index.esm2017-DFVkiPjd.js +0 -3069
  101. package/dist/loading-B3OgwEC8.js +0 -72
  102. package/dist/lodash-CiRTkvui.js +0 -3678
  103. package/dist/membership-s2VKnu_8.js +0 -255
  104. package/dist/moment-D7p2TMB-.js +0 -2583
  105. package/dist/money-DqxOXYd0.js +0 -15
  106. package/dist/number-Bt4sacaM.js +0 -12
  107. package/dist/object-BYyQ0PZp.js +0 -18
  108. package/dist/objectId-dwaoBfJX.js +0 -7
  109. package/dist/objectid-CxCupSWP.js +0 -145
  110. package/dist/plugins-CQ1JAqJB.js +0 -1788
  111. package/dist/reward-pjbal-XX.js +0 -36
  112. package/dist/rule-CzU2GAur.js +0 -1969
  113. package/dist/string-Gcy5IM_H.js +0 -32
  114. package/dist/style.css +0 -4
  115. package/dist/template-7yiMSL1f.js +0 -188
  116. package/dist/tier-BJDhpH6X.js +0 -4
  117. package/dist/tiers/tier=1.png +0 -0
  118. package/dist/tiers/tier=2.png +0 -0
  119. package/dist/tiers/tier=3.png +0 -0
  120. package/dist/tiers/tier=4.png +0 -0
  121. package/dist/titles/type=diamond.png +0 -0
  122. package/dist/titles/type=drinks.png +0 -0
  123. package/dist/titles/type=food.png +0 -0
  124. package/dist/titles/type=heart.png +0 -0
  125. package/dist/titles/type=medal.png +0 -0
  126. package/dist/titles/type=spend.png +0 -0
  127. package/dist/titles/type=thank-you.png +0 -0
  128. package/dist/titles/type=thumbs-up.png +0 -0
  129. package/dist/titles/type=years.png +0 -0
  130. package/dist/trigger-C5bqlYHn.js +0 -213
  131. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  132. package/dist/type_drinks-D6jnpvwV.js +0 -4
  133. package/dist/useMarketingMaterialActions-CW_QRtQb.js +0 -107
  134. package/dist/usePagination-D2pke4vy.js +0 -220
  135. package/dist/user-BcXrT_t5.js +0 -55
  136. package/dist/vue-i18n-CFNkj6JK.js +0 -2365
  137. package/dist/xlsx-DyVY5_Qx.js +0 -15491
  138. package/dist/zod-BD_8DRqQ.js +0 -91
@@ -1,248 +0,0 @@
1
- import { defineComponent as C, computed as M, openBlock as l, createElementBlock as f, normalizeClass as j, createElementVNode as g, createBlock as T, unref as e, toDisplayString as h, createCommentVNode as S, createVNode as k, onMounted as B, ref as I, Fragment as $, renderList as U, resolveComponent as z, isRef as V } from "vue";
2
- import { u as R } from "./vue-i18n-CFNkj6JK.js";
3
- import { components as w } from "@feedmepos/ui-library";
4
- import { r as L } from "./index-DWxmK2NJ.js";
5
- import { u as A } from "./business-B7GwHLce.js";
6
- import { _ as H } from "./LocationPicker.vue_vue_type_script_setup_true_lang-D4-wjMg6.js";
7
- import { R as D } from "./app-BTm9mz0r.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 P = s, p = n, { t: i } = R(), v = M(
22
- () => P.page.locations.map((x) => x._id)
23
- );
24
- return (x, b) => (l(), f("div", {
25
- class: j([
26
- "rounded-lg border overflow-hidden transition-colors",
27
- s.expanded ? "border-fm-color-primary-500" : "border-fm-color-neutral-gray-200"
28
- ])
29
- }, [
30
- g("button", {
31
- class: "w-full flex items-center gap-12 p-16 bg-white text-left hover:bg-fm-color-neutral-gray-50 transition-colors",
32
- onClick: b[0] || (b[0] = (c) => p("toggleExpand"))
33
- }, [
34
- s.page.pageProfileImageUrl ? (l(), f("img", {
35
- key: 0,
36
- src: s.page.pageProfileImageUrl,
37
- class: "w-32 h-32 rounded-full shrink-0 object-cover"
38
- }, null, 8, O)) : (l(), T(e(w).FmIcon, {
39
- key: 1,
40
- name: "thumb_up",
41
- class: "text-fm-color-neutral-gray-400 shrink-0"
42
- })),
43
- g("span", W, h(s.page.pageName), 1),
44
- s.page.locations.length > 0 ? (l(), f("span", q, h(e(i)("connect.review.locationsSelected", s.page.locations.length)), 1)) : S("", !0),
45
- k(e(w).FmIcon, {
46
- name: s.expanded ? "expand_less" : "expand_more",
47
- class: "text-fm-color-neutral-gray-400 shrink-0"
48
- }, null, 8, ["name"])
49
- ]),
50
- s.expanded ? (l(), T(H, {
51
- key: 0,
52
- locations: s.availableLocations,
53
- "selected-ids": e(v),
54
- onToggle: b[1] || (b[1] = (c) => p("toggleLocation", c))
55
- }, null, 8, ["locations", "selected-ids"])) : S("", !0)
56
- ], 2));
57
- }
58
- }), K = { class: "flex flex-col gap-8" }, Q = /* @__PURE__ */ C({
59
- __name: "FacebookPageLocationMapping",
60
- props: {
61
- pages: {}
62
- },
63
- emits: ["update:pages"],
64
- setup(s, { emit: n }) {
65
- const P = s, p = A();
66
- B(() => p.readLocations());
67
- const i = n, v = I(null), x = M(() => {
68
- const r = /* @__PURE__ */ new Set();
69
- for (const m of P.pages)
70
- m.locations.forEach((a) => r.add(a._id));
71
- return r;
72
- });
73
- function b(r) {
74
- const m = new Set(r.locations.map((a) => a._id));
75
- return p.locations.filter((a) => {
76
- const y = a._id.toString();
77
- return !x.value.has(y) || m.has(y);
78
- });
79
- }
80
- function c(r, m) {
81
- const a = m._id.toString(), y = P.pages.map((o) => {
82
- if (o.facebookPageId !== r) return o;
83
- const t = o.locations.some(
84
- (d) => d._id === a
85
- );
86
- return {
87
- ...o,
88
- locations: t ? o.locations.filter((d) => d._id !== a) : [
89
- ...o.locations,
90
- {
91
- _id: a,
92
- name: m.name
93
- }
94
- ]
95
- };
96
- });
97
- i("update:pages", y);
98
- }
99
- function F(r) {
100
- v.value = v.value === r ? null : r;
101
- }
102
- return (r, m) => (l(), f("div", K, [
103
- (l(!0), f($, null, U(s.pages, (a) => (l(), T(J, {
104
- key: a.facebookPageId,
105
- page: a,
106
- expanded: e(v) === a.facebookPageId,
107
- "available-locations": b(a),
108
- onToggleExpand: (y) => F(a.facebookPageId),
109
- onToggleLocation: (y) => c(a.facebookPageId, y)
110
- }, null, 8, ["page", "expanded", "available-locations", "onToggleExpand", "onToggleLocation"]))), 128))
111
- ]));
112
- }
113
- }), X = { class: "flex flex-col min-h-full gap-16 p-24" }, Y = {
114
- key: 0,
115
- class: "flex flex-col items-center justify-center flex-1 gap-16"
116
- }, Z = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ee = {
117
- key: 1,
118
- class: "flex flex-col items-center justify-center flex-1 gap-16"
119
- }, oe = { class: "fm-typo-en-body-lg-600" }, te = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ne = {
120
- key: 2,
121
- class: "flex flex-col items-center justify-center flex-1 gap-16"
122
- }, 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({
123
- __name: "ReviewFacebookCallback",
124
- setup(s) {
125
- const { t: n } = R(), P = G();
126
- function p() {
127
- return P.replace({ name: D["$connect-REVIEW_SETTINGS"] });
128
- }
129
- const i = I([]), v = I(!1), x = I(!1), b = I(!1), c = I(null), F = M(
130
- () => i.value.some((o) => o.locations.length > 0)
131
- );
132
- function r(o, t) {
133
- const d = new Map(
134
- t.map((u) => [u.facebookPageId, u])
135
- );
136
- return o.map((u) => {
137
- var _;
138
- return {
139
- ...u,
140
- locations: ((_ = d.get(u.facebookPageId)) == null ? void 0 : _.locations) ?? []
141
- };
142
- });
143
- }
144
- function m(o, t) {
145
- return o instanceof Error ? o.message : t;
146
- }
147
- async function a() {
148
- var u;
149
- const o = window.location.hash;
150
- if (!o) {
151
- c.value = n("connect.review.noToken");
152
- return;
153
- }
154
- const d = new URLSearchParams(o.slice(1)).get("access_token");
155
- if (!d) {
156
- c.value = n("connect.review.noToken");
157
- return;
158
- }
159
- v.value = !0;
160
- try {
161
- const _ = await L.getSource(), N = ((u = _ == null ? void 0 : _.facebook) == null ? void 0 : u.pages) ?? [], E = await L.connectFacebook(d);
162
- i.value = r((E == null ? void 0 : E.pages) ?? [], N), i.value.length === 0 && (c.value = n("connect.review.facebook.noPages"));
163
- } catch (_) {
164
- c.value = m(_, n("connect.review.facebook.failed"));
165
- } finally {
166
- v.value = !1;
167
- }
168
- }
169
- async function y() {
170
- const o = i.value.filter((t) => t.locations.length > 0).map((t) => ({
171
- facebookPageId: t.facebookPageId,
172
- locationIds: t.locations.map((d) => d._id)
173
- }));
174
- if (o.length === 0) {
175
- c.value = n("connect.review.noMappings");
176
- return;
177
- }
178
- x.value = !0;
179
- try {
180
- await L.updateFacebookPages(o), b.value = !0, setTimeout(p, 2e3);
181
- } catch (t) {
182
- c.value = m(t, n("connect.review.facebook.failed"));
183
- } finally {
184
- x.value = !1;
185
- }
186
- }
187
- return B(a), (o, t) => {
188
- const d = z("FmPageHead");
189
- return l(), f($, null, [
190
- k(d, {
191
- title: e(n)("connect.navigation.review")
192
- }, null, 8, ["title"]),
193
- g("div", X, [
194
- e(v) ? (l(), f("div", Y, [
195
- k(e(w).FmIcon, {
196
- name: "sync",
197
- size: "xl",
198
- class: "animate-spin text-fm-color-neutral-gray-400"
199
- }),
200
- g("p", Z, h(e(n)("connect.review.facebook.fetching")), 1)
201
- ])) : e(b) ? (l(), f("div", ee, [
202
- k(e(w).FmIcon, {
203
- name: "check_circle",
204
- size: "xl",
205
- class: "text-fm-color-typo-success"
206
- }),
207
- g("p", oe, h(e(n)("connect.review.facebook.success")), 1),
208
- g("p", te, h(e(n)("connect.review.redirecting")), 1)
209
- ])) : e(c) ? (l(), f("div", ne, [
210
- k(e(w).FmIcon, {
211
- name: "error",
212
- size: "xl",
213
- class: "text-fm-color-system-error-500"
214
- }),
215
- g("p", ae, h(e(n)("connect.review.errorTitle")), 1),
216
- g("p", se, h(e(c)), 1),
217
- k(e(w).FmButton, {
218
- label: e(n)("connect.review.goBack"),
219
- onClick: t[0] || (t[0] = (u) => p())
220
- }, null, 8, ["label"])
221
- ])) : e(i).length > 0 ? (l(), f($, { key: 3 }, [
222
- g("p", ce, h(e(n)("connect.review.facebook.selectPage")), 1),
223
- k(Q, {
224
- pages: e(i),
225
- "onUpdate:pages": t[1] || (t[1] = (u) => V(i) ? i.value = u : null)
226
- }, null, 8, ["pages"]),
227
- g("div", le, [
228
- k(e(w).FmButton, {
229
- variant: "outlined",
230
- label: e(n)("connect.review.cancel"),
231
- onClick: t[2] || (t[2] = (u) => p())
232
- }, null, 8, ["label"]),
233
- k(e(w).FmButton, {
234
- label: e(n)("connect.review.connect"),
235
- disabled: !e(F),
236
- loading: e(x),
237
- onClick: y
238
- }, null, 8, ["label", "disabled", "loading"])
239
- ])
240
- ], 64)) : S("", !0)
241
- ])
242
- ], 64);
243
- };
244
- }
245
- });
246
- export {
247
- ve as default
248
- };
@@ -1,213 +0,0 @@
1
- import { defineComponent as E, onMounted as T, ref as w, computed as B, openBlock as d, createElementBlock as p, Fragment as F, renderList as j, normalizeClass as z, unref as e, createElementVNode as m, createVNode as u, toDisplayString as y, createCommentVNode as S, createBlock as P, resolveComponent as U, isRef as V } from "vue";
2
- import { u as A } from "./vue-i18n-CFNkj6JK.js";
3
- import { components as v } from "@feedmepos/ui-library";
4
- import { r as C } from "./index-DWxmK2NJ.js";
5
- import { u as H } from "./business-B7GwHLce.js";
6
- import { _ as D } from "./LocationPicker.vue_vue_type_script_setup_true_lang-D4-wjMg6.js";
7
- import { R as O } from "./app-BTm9mz0r.js";
8
- import { useRouter as W } from "vue-router";
9
- const q = { class: "flex flex-col gap-8" }, J = ["onClick"], K = { class: "fm-typo-en-body-md-600 flex-1 truncate" }, Q = {
10
- key: 0,
11
- class: "fm-typo-en-body-sm-400 text-fm-color-primary-500 shrink-0"
12
- }, X = /* @__PURE__ */ E({
13
- __name: "GoogleLocationMapping",
14
- props: {
15
- locations: {}
16
- },
17
- emits: ["update:locations"],
18
- setup(k, { emit: a }) {
19
- const N = k, b = a, i = H();
20
- T(() => i.readLocations());
21
- const g = w(null), h = B(() => {
22
- const l = /* @__PURE__ */ new Set();
23
- for (const r of N.locations)
24
- r.locationId && l.add(r.locationId);
25
- return l;
26
- });
27
- function L(l) {
28
- return i.locations.filter((r) => {
29
- const t = r._id.toString();
30
- return !h.value.has(t) || l.locationId === t;
31
- });
32
- }
33
- function f(l, r) {
34
- const t = r._id.toString(), _ = N.locations.map((n) => {
35
- if (n.googleLocationName !== l) return n;
36
- const o = n.locationId === t;
37
- return {
38
- ...n,
39
- locationId: o ? null : t,
40
- locationName: o ? null : r.name
41
- };
42
- });
43
- b("update:locations", _);
44
- }
45
- function I(l) {
46
- g.value = g.value === l ? null : l;
47
- }
48
- return (l, r) => (d(), p("div", q, [
49
- (d(!0), p(F, null, j(k.locations, (t) => (d(), p("div", {
50
- key: t.googleLocationName,
51
- class: z([
52
- "rounded-lg border overflow-hidden transition-colors",
53
- e(g) === t.googleLocationName ? "border-fm-color-primary-500" : "border-fm-color-neutral-gray-200"
54
- ])
55
- }, [
56
- m("button", {
57
- class: "w-full flex items-center gap-12 p-16 bg-white text-left hover:bg-fm-color-neutral-gray-50 transition-colors",
58
- onClick: (_) => I(t.googleLocationName)
59
- }, [
60
- u(e(v).FmIcon, {
61
- name: "storefront",
62
- class: "text-fm-color-neutral-gray-400 shrink-0"
63
- }),
64
- m("span", K, y(t.displayName || t.googleLocationName), 1),
65
- t.locationName ? (d(), p("span", Q, y(t.locationName), 1)) : S("", !0),
66
- u(e(v).FmIcon, {
67
- name: e(g) === t.googleLocationName ? "expand_less" : "expand_more",
68
- class: "text-fm-color-neutral-gray-400 shrink-0"
69
- }, null, 8, ["name"])
70
- ], 8, J),
71
- e(g) === t.googleLocationName ? (d(), P(D, {
72
- key: 0,
73
- locations: L(t),
74
- "selected-ids": t.locationId ? [t.locationId] : [],
75
- onToggle: (_) => f(t.googleLocationName, _)
76
- }, null, 8, ["locations", "selected-ids", "onToggle"])) : S("", !0)
77
- ], 2))), 128))
78
- ]));
79
- }
80
- }), Y = { class: "flex flex-col min-h-full gap-16 p-24" }, Z = {
81
- key: 0,
82
- class: "flex flex-col items-center justify-center flex-1 gap-16"
83
- }, ee = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, oe = {
84
- key: 1,
85
- class: "flex flex-col items-center justify-center flex-1 gap-16"
86
- }, te = { class: "fm-typo-en-body-lg-600" }, ne = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ae = {
87
- key: 2,
88
- class: "flex flex-col items-center justify-center flex-1 gap-16"
89
- }, le = { 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" }, ie = { class: "flex gap-8 justify-end mt-auto pt-8" }, ve = /* @__PURE__ */ E({
90
- __name: "ReviewGoogleCallback",
91
- setup(k) {
92
- const { t: a } = A(), N = W();
93
- function b() {
94
- return N.replace({ name: O["$connect-REVIEW_SETTINGS"] });
95
- }
96
- const i = w([]), g = w(!1), h = w(!1), L = w(!1), f = w(null), I = B(
97
- () => i.value.some((n) => n.locationId !== null)
98
- );
99
- function l(n, o) {
100
- return n instanceof Error ? n.message : o;
101
- }
102
- function r(n, o) {
103
- const x = new Map(
104
- o.map((s) => [s.googleLocationName, s.location])
105
- );
106
- return n.map((s) => {
107
- const c = x.get(s.googleLocationName) ?? null;
108
- return {
109
- googleLocationName: s.googleLocationName,
110
- displayName: s.displayName,
111
- locationId: (c == null ? void 0 : c._id) ?? null,
112
- locationName: (c == null ? void 0 : c.name) ?? null
113
- };
114
- });
115
- }
116
- async function t() {
117
- var s;
118
- const n = new URLSearchParams(window.location.search), o = n.get("code"), x = n.get("state");
119
- if (!o || !x) {
120
- f.value = a("connect.review.noToken");
121
- return;
122
- }
123
- g.value = !0;
124
- try {
125
- const c = await C.getSource(), R = ((s = c == null ? void 0 : c.google) == null ? void 0 : s.locations) ?? [], M = window.location.pathname.replace(/\/review(?:\/.*)?$/, ""), G = `${window.location.origin}${M}/review/google/callback`, $ = await C.connectGoogle(o, G, x);
126
- i.value = r(($ == null ? void 0 : $.locations) ?? [], R), i.value.length === 0 && (f.value = a("connect.review.google.noLocations"));
127
- } catch (c) {
128
- f.value = l(c, a("connect.review.google.failed"));
129
- } finally {
130
- g.value = !1;
131
- }
132
- }
133
- async function _() {
134
- const n = i.value.map((o) => ({
135
- googleLocationName: o.googleLocationName,
136
- displayName: o.displayName,
137
- locationId: o.locationId
138
- }));
139
- if (n.length === 0) {
140
- f.value = a("connect.review.noMappings");
141
- return;
142
- }
143
- h.value = !0;
144
- try {
145
- await C.updateGoogleLocations(n), L.value = !0, setTimeout(b, 2e3);
146
- } catch (o) {
147
- f.value = l(o, a("connect.review.google.failed"));
148
- } finally {
149
- h.value = !1;
150
- }
151
- }
152
- return T(t), (n, o) => {
153
- const x = U("FmPageHead");
154
- return d(), p(F, null, [
155
- u(x, {
156
- title: e(a)("connect.navigation.review")
157
- }, null, 8, ["title"]),
158
- m("div", Y, [
159
- e(g) ? (d(), p("div", Z, [
160
- u(e(v).FmIcon, {
161
- name: "sync",
162
- size: "xl",
163
- class: "animate-spin text-fm-color-neutral-gray-400"
164
- }),
165
- m("p", ee, y(e(a)("connect.review.google.fetching")), 1)
166
- ])) : e(L) ? (d(), p("div", oe, [
167
- u(e(v).FmIcon, {
168
- name: "check_circle",
169
- size: "xl",
170
- class: "text-fm-color-typo-success"
171
- }),
172
- m("p", te, y(e(a)("connect.review.google.success")), 1),
173
- m("p", ne, y(e(a)("connect.review.redirecting")), 1)
174
- ])) : e(f) ? (d(), p("div", ae, [
175
- u(e(v).FmIcon, {
176
- name: "error",
177
- size: "xl",
178
- class: "text-fm-color-system-error-500"
179
- }),
180
- m("p", le, y(e(a)("connect.review.errorTitle")), 1),
181
- m("p", se, y(e(f)), 1),
182
- u(e(v).FmButton, {
183
- label: e(a)("connect.review.goBack"),
184
- onClick: o[0] || (o[0] = (s) => b())
185
- }, null, 8, ["label"])
186
- ])) : e(i).length > 0 ? (d(), p(F, { key: 3 }, [
187
- m("p", ce, y(e(a)("connect.review.google.selectLocation")), 1),
188
- u(X, {
189
- locations: e(i),
190
- "onUpdate:locations": o[1] || (o[1] = (s) => V(i) ? i.value = s : null)
191
- }, null, 8, ["locations"]),
192
- m("div", ie, [
193
- u(e(v).FmButton, {
194
- variant: "outlined",
195
- label: e(a)("connect.review.cancel"),
196
- onClick: o[2] || (o[2] = (s) => b())
197
- }, null, 8, ["label"]),
198
- u(e(v).FmButton, {
199
- label: e(a)("connect.review.connect"),
200
- disabled: !e(I),
201
- loading: e(h),
202
- onClick: _
203
- }, null, 8, ["label", "disabled", "loading"])
204
- ])
205
- ], 64)) : S("", !0)
206
- ])
207
- ], 64);
208
- };
209
- }
210
- });
211
- export {
212
- ve as default
213
- };