@feedmepos/mf-connect 0.1.98-beta.15 → 0.1.98-beta.16
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.
- package/dist/App-DNXDhULP.js +4782 -0
- package/dist/AuditLogs-BNS27IJT.js +2013 -0
- package/dist/Bin-Dkjyrbz-.js +166 -0
- package/dist/Broadcast-B-fpjVzY.js +266 -0
- package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-qBcG-vPM.js +120 -0
- package/dist/Card-BvVHO8kN.js +910 -0
- package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
- package/dist/Collections-BLxPSOJl.js +540 -0
- package/dist/Credit-DU-stilH.js +260 -0
- package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
- package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bqnb00zk.js +3377 -0
- package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CTSfEq5N.js +351 -0
- package/dist/Experience-C3tB8hTp.js +259 -0
- package/dist/FileSaver.min-EIworvUf.js +74 -0
- package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
- package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
- package/dist/Game-Dq1ms2fA.js +330 -0
- package/dist/Grab-DnSO2oLx.js +300 -0
- package/dist/ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js +145 -0
- package/dist/Index-BFIHgW9W.js +259 -0
- package/dist/JsonViewer-v8_C7l5N.js +87 -0
- package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js +48 -0
- package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-vpJmHgKM.js +18737 -0
- package/dist/LoyaltyDashboard-CcBogXzl.js +1082 -0
- package/dist/MainLayout-CPNiL_et.js +41 -0
- package/dist/Marketing-Bzb1VaVA.js +235 -0
- package/dist/MarketingMaterialEdit-8UQNx3mV.js +1035 -0
- package/dist/Member-Drb_NVrb.js +280 -0
- package/dist/MemberList-wa3JxCVr.js +1601 -0
- package/dist/MemberOverview-wL_ailso.js +58 -0
- package/dist/MemberTransactions-8qlm-T67.js +45 -0
- package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BHicaUXs.js +60802 -0
- package/dist/Mission-DmWbQmOv.js +334 -0
- package/dist/Overview-COEFtf12.js +1079 -0
- package/dist/Overview-D7ki-aBA.js +969 -0
- package/dist/Point-B0W-BcPA.js +262 -0
- package/dist/Promotion-CY16SjmK.js +397 -0
- package/dist/Queue-hMur40Xc.js +260 -0
- package/dist/Record-Bj7GQP1r.js +342 -0
- package/dist/Review-Z1XD6bJK.js +45 -0
- package/dist/ReviewFacebookCallback-DirGtKLX.js +248 -0
- package/dist/ReviewGoogleCallback-CVC6741e.js +213 -0
- package/dist/Reward-DDB5Usau.js +442 -0
- package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B-OnKAbx.js +149 -0
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DDHM8NLi.js +1911 -0
- package/dist/Segment-Bl0k9fvJ.js +1014 -0
- package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C33DPiN6.js +181 -0
- package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-YMpQ-IiW.js +188 -0
- package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang--Rtf3gRa.js +226 -0
- package/dist/Setting-CpD98E2N.js +2047 -0
- package/dist/SettingAdvertisements-BZFQu_HI.js +264 -0
- package/dist/Settings-CRqlKNsc.js +228 -0
- package/dist/Store-CDG2_iqc.js +1996 -0
- package/dist/StoreRewards-DIU5hPXv.js +540 -0
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B82RH_ZC.js +1133 -0
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js +7007 -0
- package/dist/Tier-BXgIdYDa.js +969 -0
- package/dist/Title-DgHxyV8p.js +566 -0
- package/dist/Transaction-iDacnm6Y.js +39 -0
- package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-RUbR6pdK.js +130 -0
- package/dist/Voucher-C-I8JK4F.js +421 -0
- package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BUpYZxij.js +421 -0
- package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-LhG5jJq3.js +56 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/app-CyNzTZOx.js +59950 -0
- package/dist/app-wDQR6dpb.js +39 -0
- package/dist/app.js +7 -0
- package/dist/business-o_sAO_33.js +82 -0
- package/dist/campaign--IUcyI8h.js +219 -0
- package/dist/campaign-CpzFl8Vr.js +4 -0
- package/dist/campaign-zLKyql03.js +277 -0
- package/dist/campaign.enum-CEbNgaGZ.js +26 -0
- package/dist/campaign.fn-BVT0m6Uy.js +776 -0
- package/dist/collectible.enum-2y8KIQLL.js +19 -0
- package/dist/duplicateCampaign-DIzdQf0e.js +51 -0
- package/dist/effect-B6gKaH4T.js +89 -0
- package/dist/email-addresses-CO9GNnUN.js +705 -0
- package/dist/export-DdDpRFVg.js +97 -0
- package/dist/feedme.ico +0 -0
- package/dist/google-BQK68wbe.js +5 -0
- package/dist/helper-DqypCsTm.js +86 -0
- package/dist/index-BK0OmX3R.js +85 -0
- package/dist/index-Bc7JXl59.js +54 -0
- package/dist/index-BgiIGrLb.js +32 -0
- package/dist/index-C-TiT9bf.js +1157 -0
- package/dist/index-COXmoOd1.js +3678 -0
- package/dist/index-CT6uJJ9y.js +151 -0
- package/dist/index-Ci2gFCfD.js +61 -0
- package/dist/index-CtJ0MQQ1.js +3 -0
- package/dist/index-CuvNtC_M.js +61 -0
- package/dist/index-D41Xq5qY.js +8910 -0
- package/dist/index-DBD_e_yR.js +31 -0
- package/dist/index-DDpz9LmI.js +67 -0
- package/dist/index-Dh2apeby.js +2819 -0
- package/dist/index-DiDmMG_M.js +28900 -0
- package/dist/index-pjXQwa0j.js +30289 -0
- package/dist/index-vh86FiIQ.js +10 -0
- package/dist/index.esm2017-Cd4FhecE.js +3069 -0
- package/dist/loading-D-RglDMV.js +72 -0
- package/dist/lodash-cggYhL9V.js +3678 -0
- package/dist/membership-DTfMyKwP.js +255 -0
- package/dist/moment-D7p2TMB-.js +2583 -0
- package/dist/money-fGZfbdgV.js +15 -0
- package/dist/number-BOalh3ZH.js +12 -0
- package/dist/object-BYyQ0PZp.js +18 -0
- package/dist/objectId-dwaoBfJX.js +7 -0
- package/dist/objectid-zPJFVngY.js +145 -0
- package/dist/plugins-CbpvMMOJ.js +1788 -0
- package/dist/reward-DkVAHEq2.js +36 -0
- package/dist/rule-EzWg2u8d.js +1969 -0
- package/dist/string-Gcy5IM_H.js +32 -0
- package/dist/style.css +4 -0
- package/dist/template-BfVFq4on.js +188 -0
- package/dist/tier-BJDhpH6X.js +4 -0
- package/dist/tiers/tier=1.png +0 -0
- package/dist/tiers/tier=2.png +0 -0
- package/dist/tiers/tier=3.png +0 -0
- package/dist/tiers/tier=4.png +0 -0
- package/dist/titles/type=diamond.png +0 -0
- package/dist/titles/type=drinks.png +0 -0
- package/dist/titles/type=food.png +0 -0
- package/dist/titles/type=heart.png +0 -0
- package/dist/titles/type=medal.png +0 -0
- package/dist/titles/type=spend.png +0 -0
- package/dist/titles/type=thank-you.png +0 -0
- package/dist/titles/type=thumbs-up.png +0 -0
- package/dist/titles/type=years.png +0 -0
- package/dist/trigger-es-_uiSg.js +213 -0
- package/dist/tslib.es6-BCqqvLQ_.js +44 -0
- package/dist/type_drinks-D6jnpvwV.js +4 -0
- package/dist/useMarketingMaterialActions-CpiIKMmG.js +107 -0
- package/dist/usePagination-SYsXgU6x.js +220 -0
- package/dist/user-DUe40u3g.js +55 -0
- package/dist/vue-i18n-Dn9zxRuv.js +2365 -0
- package/dist/xlsx-DugGi7dB.js +15491 -0
- package/dist/zod-Dw8_B6RC.js +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,248 @@
|
|
|
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-Dn9zxRuv.js";
|
|
3
|
+
import { components as w } from "@feedmepos/ui-library";
|
|
4
|
+
import { r as L } from "./index-Ci2gFCfD.js";
|
|
5
|
+
import { u as A } from "./business-o_sAO_33.js";
|
|
6
|
+
import { _ as H } from "./LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js";
|
|
7
|
+
import { R as D } from "./app-CyNzTZOx.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
|
+
};
|
|
@@ -0,0 +1,213 @@
|
|
|
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-Dn9zxRuv.js";
|
|
3
|
+
import { components as v } from "@feedmepos/ui-library";
|
|
4
|
+
import { r as C } from "./index-Ci2gFCfD.js";
|
|
5
|
+
import { u as H } from "./business-o_sAO_33.js";
|
|
6
|
+
import { _ as D } from "./LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js";
|
|
7
|
+
import { R as O } from "./app-CyNzTZOx.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
|
+
};
|