@wexio/messenger-widget-react 1.2.4 → 1.3.0
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/CHANGELOG.md +51 -1
- package/README.md +15 -1
- package/dist/{widget-react-DubCiNev.js → widget-react--IUy5lNt.js} +21 -20
- package/dist/{widget-react-CIy9jXND.js → widget-react-B7es3n1-.js} +1 -1
- package/dist/{widget-react-2tTH7-bO.js → widget-react-BAUpSGhZ.js} +1 -1
- package/dist/{widget-react-CtvdaJvy.js → widget-react-BXf2Ty8d.js} +4 -4
- package/dist/{widget-react-AwEaD0v2.js → widget-react-BZ-SHa2o.js} +169 -273
- package/dist/{widget-react-faSyVXFQ.js → widget-react-BgALABDe.js} +1 -1
- package/dist/{widget-react-DXP6EOCM.js → widget-react-BkXA6ytR.js} +1 -1
- package/dist/{widget-react-DV3UnggB.js → widget-react-CHSNuztJ.js} +137 -226
- package/dist/widget-react-CN_FIvMD.js +834 -0
- package/dist/widget-react-CuphoFsN.js +229 -0
- package/dist/{widget-react-DNFROpaS.js → widget-react-D8Z8cGhJ.js} +40 -48
- package/dist/{widget-react-B9X7Tn7t.js → widget-react-DSUX0aJn.js} +42 -50
- package/dist/{widget-react-CAsPo1rw.js → widget-react-DWgRcZF7.js} +127 -127
- package/dist/{widget-react-B9XrHKqv.js → widget-react-DbOJZl9F.js} +1238 -2052
- package/dist/{widget-react-BlTmXnei.js → widget-react-DgIxSjv7.js} +1 -1
- package/dist/widget-react-Ds5J9FbQ.js +27 -0
- package/dist/{widget-react-CK8xTxwO.js → widget-react-Dtx_fW3V.js} +4895 -4454
- package/dist/{widget-react-B8rXZyxg.js → widget-react-SI7deQTE.js} +1 -1
- package/dist/{widget-react-yTVzOzaU.js → widget-react-l5oryxYk.js} +87 -87
- package/dist/{widget-react-DDEFbIbU.js → widget-react-vXfa9GKf.js} +95 -117
- package/dist/widget-react-wSc9gIfG.js +198 -0
- package/dist/widget-react.d.ts +2 -2
- package/dist/widget-react.js +9370 -4672
- package/package.json +1 -1
|
@@ -11,9 +11,10 @@ import "react";
|
|
|
11
11
|
import "react-dom";
|
|
12
12
|
import "react/jsx-runtime";
|
|
13
13
|
import "react-dom/client";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { i as
|
|
14
|
+
import { t as e } from "./widget-react-DbOJZl9F.js";
|
|
15
|
+
import { Ct as t, D as n, L as r, O as i, P as a, R as o, T as s, a as c, i as l, n as u, t as d } from "./widget-react-Dtx_fW3V.js";
|
|
16
|
+
import { i as f, n as p } from "./widget-react-krPPnv02.js";
|
|
17
|
+
import { n as m } from "./widget-react-wSc9gIfG.js";
|
|
17
18
|
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
18
19
|
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
19
20
|
//#region lib/detect-html.ts
|
|
@@ -41,8 +42,8 @@ function T(e, t) {
|
|
|
41
42
|
var E = ["en", "uk"];
|
|
42
43
|
async function D(e) {
|
|
43
44
|
switch (e) {
|
|
44
|
-
case "uk": return (await import("./widget-react-
|
|
45
|
-
default: return (await import("./widget-react-
|
|
45
|
+
case "uk": return (await import("./widget-react-DSUX0aJn.js")).default;
|
|
46
|
+
default: return (await import("./widget-react-D8Z8cGhJ.js")).default;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
function O(e) {
|
|
@@ -70,23 +71,23 @@ var A = (/* @__PURE__ */ "prose max-w-none text-sm leading-relaxed text-wx-fg,[&
|
|
|
70
71
|
//#endregion
|
|
71
72
|
//#region components/widget/article-body.tsx
|
|
72
73
|
function j({ content: e, isHtml: t, markdownMarginClass: n }) {
|
|
73
|
-
return t ? /* @__PURE__ */ b(
|
|
74
|
+
return t ? /* @__PURE__ */ b(u, {
|
|
74
75
|
html: e,
|
|
75
76
|
className: `mt-0 ${A}`
|
|
76
77
|
}) : /* @__PURE__ */ b("div", {
|
|
77
78
|
className: `${n} ${A}`,
|
|
78
|
-
children: /* @__PURE__ */ b(
|
|
79
|
-
remarkPlugins: [
|
|
79
|
+
children: /* @__PURE__ */ b(c, {
|
|
80
|
+
remarkPlugins: [l],
|
|
80
81
|
children: e
|
|
81
82
|
})
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
//#endregion
|
|
85
86
|
//#region components/widget/language-selector/index.tsx
|
|
86
|
-
function M({ currentLocale:
|
|
87
|
-
let l =
|
|
87
|
+
function M({ currentLocale: t, locales: r, allowedLocales: a, onSelect: o, className: c }) {
|
|
88
|
+
let l = f("languageSelector"), [u, h] = y(!1), _ = v(null);
|
|
88
89
|
g(() => {
|
|
89
|
-
if (!
|
|
90
|
+
if (!u) return;
|
|
90
91
|
let e = (e) => {
|
|
91
92
|
_.current && !_.current.contains(e.target) && h(!1);
|
|
92
93
|
}, t = (e) => {
|
|
@@ -95,13 +96,13 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
95
96
|
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
96
97
|
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
97
98
|
};
|
|
98
|
-
}, [
|
|
99
|
-
let S =
|
|
99
|
+
}, [u]);
|
|
100
|
+
let S = a && a.length > 0 ? new Set(a.map((e) => e.split("-")[0].toLowerCase())) : null, C = Array.from(new Set(r.filter(Boolean))).filter((e) => !S || S.has(e.split("-")[0].toLowerCase()));
|
|
100
101
|
if (C.length <= 1) return null;
|
|
101
|
-
let w =
|
|
102
|
+
let w = t.split("-")[0].toLowerCase();
|
|
102
103
|
return /* @__PURE__ */ x("div", {
|
|
103
104
|
ref: _,
|
|
104
|
-
className:
|
|
105
|
+
className: p("relative", c),
|
|
105
106
|
children: [
|
|
106
107
|
/* @__PURE__ */ b("p", {
|
|
107
108
|
className: "mb-1.5 text-xs font-semibold tracking-wide text-wx-fg-muted uppercase",
|
|
@@ -111,25 +112,25 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
111
112
|
type: "button",
|
|
112
113
|
onClick: () => h((e) => !e),
|
|
113
114
|
"aria-haspopup": "listbox",
|
|
114
|
-
"aria-expanded":
|
|
115
|
+
"aria-expanded": u,
|
|
115
116
|
"aria-label": l("ariaLabel"),
|
|
116
|
-
className:
|
|
117
|
+
className: p("flex w-full items-center gap-2 rounded-wx-sm border border-wx-border bg-wx-bg px-3 py-2", "text-sm font-medium text-wx-fg transition-colors hover:bg-wx-bg-elevated", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary"),
|
|
117
118
|
children: [
|
|
118
|
-
/* @__PURE__ */ b(
|
|
119
|
+
/* @__PURE__ */ b(s, {
|
|
119
120
|
size: 15,
|
|
120
121
|
className: "shrink-0 text-wx-fg-muted"
|
|
121
122
|
}),
|
|
122
123
|
/* @__PURE__ */ b("span", {
|
|
123
124
|
className: "min-w-0 flex-1 truncate text-left",
|
|
124
|
-
children:
|
|
125
|
+
children: d(t)
|
|
125
126
|
}),
|
|
126
|
-
/* @__PURE__ */ b(
|
|
127
|
+
/* @__PURE__ */ b(n, {
|
|
127
128
|
size: 15,
|
|
128
|
-
className:
|
|
129
|
+
className: p("shrink-0 text-wx-fg-subtle transition-transform", u && "rotate-180")
|
|
129
130
|
})
|
|
130
131
|
]
|
|
131
132
|
}),
|
|
132
|
-
/* @__PURE__ */ b(
|
|
133
|
+
/* @__PURE__ */ b(m, { children: u && /* @__PURE__ */ b(e.ul, {
|
|
133
134
|
initial: {
|
|
134
135
|
opacity: 0,
|
|
135
136
|
y: 4
|
|
@@ -143,7 +144,7 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
143
144
|
y: 4
|
|
144
145
|
},
|
|
145
146
|
transition: { duration: .14 },
|
|
146
|
-
className:
|
|
147
|
+
className: p("absolute bottom-full left-0 z-20 mb-1 max-h-56 w-full overflow-auto", "rounded-wx-sm border border-wx-border bg-wx-bg py-1 shadow-[0_12px_32px_rgba(0,0,0,0.16)]"),
|
|
147
148
|
role: "listbox",
|
|
148
149
|
children: C.map((e) => {
|
|
149
150
|
let t = e.split("-")[0].toLowerCase() === w;
|
|
@@ -152,13 +153,13 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
152
153
|
role: "option",
|
|
153
154
|
"aria-selected": t,
|
|
154
155
|
onClick: () => {
|
|
155
|
-
|
|
156
|
+
o(e), h(!1);
|
|
156
157
|
},
|
|
157
|
-
className:
|
|
158
|
+
className: p("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors", t ? "font-semibold text-wx-primary" : "text-wx-fg hover:bg-wx-bg-elevated"),
|
|
158
159
|
children: [/* @__PURE__ */ b("span", {
|
|
159
160
|
className: "min-w-0 flex-1 truncate",
|
|
160
|
-
children:
|
|
161
|
-
}), t && /* @__PURE__ */ b(
|
|
161
|
+
children: d(e)
|
|
162
|
+
}), t && /* @__PURE__ */ b(i, {
|
|
162
163
|
size: 15,
|
|
163
164
|
className: "shrink-0 text-wx-primary"
|
|
164
165
|
})]
|
|
@@ -169,43 +170,8 @@ function M({ currentLocale: i, locales: a, allowedLocales: o, onSelect: s, class
|
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
172
|
//#endregion
|
|
172
|
-
//#region lib/graphql/queries/generated/reactions.generated.tsx
|
|
173
|
-
var N = {}, P = l`
|
|
174
|
-
query VisitorReactionSet($surface: ReactionSurface!) {
|
|
175
|
-
visitorReactionSet(surface: $surface) {
|
|
176
|
-
_id
|
|
177
|
-
surface
|
|
178
|
-
enabled
|
|
179
|
-
slots {
|
|
180
|
-
slotIndex
|
|
181
|
-
emoji
|
|
182
|
-
sentiment
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
`;
|
|
187
|
-
function F(e) {
|
|
188
|
-
return a(P, {
|
|
189
|
-
...N,
|
|
190
|
-
...e
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
var I = l`
|
|
194
|
-
mutation SubmitVisitorReaction($input: VisitorReactionInput!) {
|
|
195
|
-
submitVisitorReaction(input: $input) {
|
|
196
|
-
ok
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
`;
|
|
200
|
-
function L(e) {
|
|
201
|
-
return s(I, {
|
|
202
|
-
...N,
|
|
203
|
-
...e
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
//#endregion
|
|
207
173
|
//#region components/widget/reaction-bar.tsx
|
|
208
|
-
var
|
|
174
|
+
var N = (e, t) => `wexio:reaction:${e}:${t}`, P = [
|
|
209
175
|
{
|
|
210
176
|
slotIndex: 0,
|
|
211
177
|
emoji: "🎉"
|
|
@@ -218,84 +184,96 @@ var R = (e, t) => `wexio:reaction:${e}:${t}`, z = [
|
|
|
218
184
|
slotIndex: 2,
|
|
219
185
|
emoji: "👍"
|
|
220
186
|
}
|
|
221
|
-
],
|
|
187
|
+
], F = {
|
|
222
188
|
[w.NEWS]: "NewsPost",
|
|
223
189
|
[w.HELP]: "HelpArticle"
|
|
224
190
|
};
|
|
225
|
-
function
|
|
226
|
-
let
|
|
227
|
-
variables: { surface:
|
|
191
|
+
function I({ surface: n, itemId: i, reactionCounts: s, viewerReaction: c, groupItemIds: l, readonly: u = !1, showCounts: d = !0, isDummy: m = !1, className: v }) {
|
|
192
|
+
let S = f("reactions"), C = t(), { data: w, loading: T } = o({
|
|
193
|
+
variables: { surface: n },
|
|
228
194
|
fetchPolicy: "cache-first",
|
|
229
|
-
skip:
|
|
230
|
-
}), [
|
|
195
|
+
skip: m
|
|
196
|
+
}), [E, { loading: D }] = r(), O = a(), k = _(() => m ? P : w?.visitorReactionSet?.slots ?? [], [m, w]), A = m ? !0 : w?.visitorReactionSet?.enabled ?? !0, j = N(n, i), [M, I] = y(null);
|
|
231
197
|
g(() => {
|
|
232
|
-
if (!
|
|
233
|
-
|
|
198
|
+
if (!m) {
|
|
199
|
+
I(c ?? null);
|
|
234
200
|
return;
|
|
235
201
|
}
|
|
236
202
|
if (typeof window > "u") return;
|
|
237
|
-
let e = window.localStorage.getItem(
|
|
238
|
-
|
|
203
|
+
let e = window.localStorage.getItem(j);
|
|
204
|
+
I(e === null ? null : Number(e));
|
|
239
205
|
}, [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
206
|
+
m,
|
|
207
|
+
j,
|
|
208
|
+
c
|
|
243
209
|
]);
|
|
244
|
-
let [
|
|
245
|
-
let
|
|
246
|
-
for (let
|
|
247
|
-
let
|
|
248
|
-
__typename:
|
|
249
|
-
_id:
|
|
210
|
+
let [L, R] = y({}), z = (e) => (s?.[String(e)] ?? 0) + (m ? L[e] ?? 0 : 0), B = h((e, t) => {
|
|
211
|
+
let r = F[n], a = l?.length ? l : [i];
|
|
212
|
+
for (let n of a) {
|
|
213
|
+
let i = C.cache.identify({
|
|
214
|
+
__typename: r,
|
|
215
|
+
_id: n
|
|
250
216
|
});
|
|
251
|
-
|
|
252
|
-
id:
|
|
217
|
+
i && C.cache.modify({
|
|
218
|
+
id: i,
|
|
253
219
|
fields: {
|
|
254
|
-
viewerReaction: () =>
|
|
255
|
-
reactionCounts: (
|
|
256
|
-
let
|
|
257
|
-
return
|
|
220
|
+
viewerReaction: () => t,
|
|
221
|
+
reactionCounts: (n) => {
|
|
222
|
+
let r = { ...n ?? {} };
|
|
223
|
+
return t !== null && (r[t] = (r[t] ?? 0) + 1), e !== null && (r[e] = Math.max(0, (r[e] ?? 0) - 1)), r;
|
|
258
224
|
}
|
|
259
225
|
}
|
|
260
226
|
});
|
|
261
227
|
}
|
|
262
228
|
}, [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
]),
|
|
268
|
-
if (
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
271
|
-
typeof window < "u" && window.localStorage.setItem(
|
|
272
|
-
...
|
|
273
|
-
[e]: (
|
|
274
|
-
...
|
|
229
|
+
C,
|
|
230
|
+
n,
|
|
231
|
+
l,
|
|
232
|
+
i
|
|
233
|
+
]), V = async (e) => {
|
|
234
|
+
if (u || D || M === e) return;
|
|
235
|
+
let t = M;
|
|
236
|
+
if (I(e), m) {
|
|
237
|
+
typeof window < "u" && window.localStorage.setItem(j, String(e)), R((n) => ({
|
|
238
|
+
...n,
|
|
239
|
+
[e]: (n[e] ?? 0) + 1,
|
|
240
|
+
...t === null ? {} : { [t]: (n[t] ?? 0) - 1 }
|
|
275
241
|
}));
|
|
276
242
|
return;
|
|
277
243
|
}
|
|
278
|
-
|
|
244
|
+
if (B(t, e), O) {
|
|
245
|
+
O.enqueue({
|
|
246
|
+
op: "reaction",
|
|
247
|
+
semantics: "convergence",
|
|
248
|
+
convergenceKey: `reaction:${n}:${i}`,
|
|
249
|
+
payload: {
|
|
250
|
+
surface: n,
|
|
251
|
+
itemId: i,
|
|
252
|
+
slotIndex: e
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
279
257
|
try {
|
|
280
|
-
await
|
|
281
|
-
surface:
|
|
282
|
-
itemId:
|
|
258
|
+
await E({ variables: { input: {
|
|
259
|
+
surface: n,
|
|
260
|
+
itemId: i,
|
|
283
261
|
slotIndex: e
|
|
284
262
|
} } });
|
|
285
263
|
} catch {
|
|
286
|
-
|
|
264
|
+
B(e, t), I(t);
|
|
287
265
|
}
|
|
288
266
|
};
|
|
289
|
-
return
|
|
290
|
-
className:
|
|
267
|
+
return T || !A || k.length === 0 ? null : /* @__PURE__ */ b("div", {
|
|
268
|
+
className: p("flex flex-wrap items-center justify-center gap-2", v),
|
|
291
269
|
role: "group",
|
|
292
|
-
"aria-label":
|
|
293
|
-
children:
|
|
294
|
-
let n =
|
|
270
|
+
"aria-label": S("ariaLabel"),
|
|
271
|
+
children: k.map((t) => {
|
|
272
|
+
let n = M === t.slotIndex, r = z(t.slotIndex);
|
|
295
273
|
return /* @__PURE__ */ x(e.button, {
|
|
296
274
|
type: "button",
|
|
297
|
-
disabled:
|
|
298
|
-
onClick: () => void
|
|
275
|
+
disabled: u || D,
|
|
276
|
+
onClick: () => void V(t.slotIndex),
|
|
299
277
|
whileTap: { scale: .9 },
|
|
300
278
|
whileHover: { scale: 1.06 },
|
|
301
279
|
transition: {
|
|
@@ -303,13 +281,13 @@ function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupI
|
|
|
303
281
|
stiffness: 400,
|
|
304
282
|
damping: 18
|
|
305
283
|
},
|
|
306
|
-
className:
|
|
284
|
+
className: p("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-2xl leading-none transition-colors", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-wx-primary", n ? "bg-wx-primary/10 ring-1 ring-wx-primary/40" : "hover:bg-wx-bg-elevated", u && "cursor-default opacity-70"),
|
|
307
285
|
"aria-pressed": n,
|
|
308
|
-
"aria-label":
|
|
286
|
+
"aria-label": S("tapAria", { emoji: t.emoji }),
|
|
309
287
|
children: [/* @__PURE__ */ b("span", {
|
|
310
288
|
"aria-hidden": "true",
|
|
311
289
|
children: t.emoji
|
|
312
|
-
}),
|
|
290
|
+
}), d && r > 0 && /* @__PURE__ */ b("span", {
|
|
313
291
|
className: "text-xs font-medium text-wx-fg-muted",
|
|
314
292
|
children: r
|
|
315
293
|
})]
|
|
@@ -318,6 +296,6 @@ function V({ surface: t, itemId: n, reactionCounts: r, viewerReaction: i, groupI
|
|
|
318
296
|
});
|
|
319
297
|
}
|
|
320
298
|
//#endregion
|
|
321
|
-
export { k as a, w as c, E as i, S as l, M as n, T as o, j as r, C as s,
|
|
299
|
+
export { k as a, w as c, E as i, S as l, M as n, T as o, j as r, C as s, I as t };
|
|
322
300
|
|
|
323
|
-
//# sourceMappingURL=widget-react-
|
|
301
|
+
//# sourceMappingURL=widget-react-vXfa9GKf.js.map
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
globalThis.process === void 0 && (globalThis.process = {
|
|
2
|
+
env: {},
|
|
3
|
+
nextTick: function(e) {
|
|
4
|
+
setTimeout(e, 0);
|
|
5
|
+
},
|
|
6
|
+
emit: function() {
|
|
7
|
+
return !1;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
import "react";
|
|
11
|
+
import "react-dom";
|
|
12
|
+
import "react/jsx-runtime";
|
|
13
|
+
import "react-dom/client";
|
|
14
|
+
import { c as e, d as t, i as n, l as r, n as i, r as a, u as o } from "./widget-react-DbOJZl9F.js";
|
|
15
|
+
import { t as s } from "./widget-react-krPPnv02.js";
|
|
16
|
+
import * as c from "react";
|
|
17
|
+
import { Children as l, isValidElement as u, useContext as d, useId as f, useInsertionEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
18
|
+
import { Fragment as _, jsx as v } from "react/jsx-runtime";
|
|
19
|
+
//#region node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs
|
|
20
|
+
function y(e, t) {
|
|
21
|
+
if (typeof e == "function") return e(t);
|
|
22
|
+
e != null && (e.current = t);
|
|
23
|
+
}
|
|
24
|
+
function b(...e) {
|
|
25
|
+
return (t) => {
|
|
26
|
+
let n = !1, r = e.map((e) => {
|
|
27
|
+
let r = y(e, t);
|
|
28
|
+
return !n && typeof r == "function" && (n = !0), r;
|
|
29
|
+
});
|
|
30
|
+
if (n) return () => {
|
|
31
|
+
for (let t = 0; t < r.length; t++) {
|
|
32
|
+
let n = r[t];
|
|
33
|
+
typeof n == "function" ? n() : y(e[t], null);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function x(...e) {
|
|
39
|
+
return c.useCallback(b(...e), e);
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs
|
|
43
|
+
var S = class extends c.Component {
|
|
44
|
+
getSnapshotBeforeUpdate(e) {
|
|
45
|
+
let t = this.props.childRef.current;
|
|
46
|
+
if (n(t) && e.isPresent && !this.props.isPresent && this.props.pop !== !1) {
|
|
47
|
+
let e = t.offsetParent, r = n(e) && e.offsetWidth || 0, i = n(e) && e.offsetHeight || 0, a = getComputedStyle(t), o = this.props.sizeRef.current;
|
|
48
|
+
o.height = parseFloat(a.height), o.width = parseFloat(a.width), o.top = t.offsetTop, o.left = t.offsetLeft, o.right = r - o.width - o.left, o.bottom = i - o.height - o.top;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
componentDidUpdate() {}
|
|
53
|
+
render() {
|
|
54
|
+
return this.props.children;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function C({ children: e, isPresent: t, anchorX: n, anchorY: r, root: i, pop: o }) {
|
|
58
|
+
let s = f(), l = h(null), u = h({
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 0,
|
|
61
|
+
top: 0,
|
|
62
|
+
left: 0,
|
|
63
|
+
right: 0,
|
|
64
|
+
bottom: 0
|
|
65
|
+
}), { nonce: m } = d(a), g = x(l, e.props?.ref ?? e?.ref);
|
|
66
|
+
return p(() => {
|
|
67
|
+
let { width: e, height: a, top: c, left: d, right: f, bottom: p } = u.current;
|
|
68
|
+
if (t || o === !1 || !l.current || !e || !a) return;
|
|
69
|
+
let h = n === "left" ? `left: ${d}` : `right: ${f}`, g = r === "bottom" ? `bottom: ${p}` : `top: ${c}`;
|
|
70
|
+
l.current.dataset.motionPopId = s;
|
|
71
|
+
let _ = document.createElement("style");
|
|
72
|
+
m && (_.nonce = m);
|
|
73
|
+
let v = i ?? document.head;
|
|
74
|
+
return v.appendChild(_), _.sheet && _.sheet.insertRule(`
|
|
75
|
+
[data-motion-pop-id="${s}"] {
|
|
76
|
+
position: absolute !important;
|
|
77
|
+
width: ${e}px !important;
|
|
78
|
+
height: ${a}px !important;
|
|
79
|
+
${h}px !important;
|
|
80
|
+
${g}px !important;
|
|
81
|
+
}
|
|
82
|
+
`), () => {
|
|
83
|
+
l.current?.removeAttribute("data-motion-pop-id"), v.contains(_) && v.removeChild(_);
|
|
84
|
+
};
|
|
85
|
+
}, [t]), v(S, {
|
|
86
|
+
isPresent: t,
|
|
87
|
+
childRef: l,
|
|
88
|
+
sizeRef: u,
|
|
89
|
+
pop: o,
|
|
90
|
+
children: o === !1 ? e : c.cloneElement(e, { ref: g })
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
|
|
95
|
+
var w = ({ children: t, initial: n, isPresent: r, onExitComplete: i, custom: a, presenceAffectsLayout: s, mode: l, anchorX: u, anchorY: d, root: p }) => {
|
|
96
|
+
let h = o(T), g = f(), _ = !0, y = m(() => (_ = !1, {
|
|
97
|
+
id: g,
|
|
98
|
+
initial: n,
|
|
99
|
+
isPresent: r,
|
|
100
|
+
custom: a,
|
|
101
|
+
onExitComplete: (e) => {
|
|
102
|
+
h.set(e, !0);
|
|
103
|
+
for (let e of h.values()) if (!e) return;
|
|
104
|
+
i && i();
|
|
105
|
+
},
|
|
106
|
+
register: (e) => (h.set(e, !1), () => h.delete(e))
|
|
107
|
+
}), [
|
|
108
|
+
r,
|
|
109
|
+
h,
|
|
110
|
+
i
|
|
111
|
+
]);
|
|
112
|
+
return s && _ && (y = { ...y }), m(() => {
|
|
113
|
+
h.forEach((e, t) => h.set(t, !1));
|
|
114
|
+
}, [r]), c.useEffect(() => {
|
|
115
|
+
!r && !h.size && i && i();
|
|
116
|
+
}, [r]), t = v(C, {
|
|
117
|
+
pop: l === "popLayout",
|
|
118
|
+
isPresent: r,
|
|
119
|
+
anchorX: u,
|
|
120
|
+
anchorY: d,
|
|
121
|
+
root: p,
|
|
122
|
+
children: t
|
|
123
|
+
}), v(e.Provider, {
|
|
124
|
+
value: y,
|
|
125
|
+
children: t
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
function T() {
|
|
129
|
+
return /* @__PURE__ */ new Map();
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs
|
|
133
|
+
var E = (e) => e.key || "";
|
|
134
|
+
function D(e) {
|
|
135
|
+
let t = [];
|
|
136
|
+
return l.forEach(e, (e) => {
|
|
137
|
+
u(e) && t.push(e);
|
|
138
|
+
}), t;
|
|
139
|
+
}
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
|
|
142
|
+
var O = ({ children: e, custom: n, initial: a = !0, onExitComplete: s, presenceAffectsLayout: c = !0, mode: l = "sync", propagate: u = !1, anchorX: f = "left", anchorY: p = "top", root: y }) => {
|
|
143
|
+
let [b, x] = i(u), S = m(() => D(e), [e]), C = u && !b ? [] : S.map(E), T = h(!0), O = h(S), k = o(() => /* @__PURE__ */ new Map()), A = h(/* @__PURE__ */ new Set()), [j, M] = g(S), [N, P] = g(S);
|
|
144
|
+
r(() => {
|
|
145
|
+
T.current = !1, O.current = S;
|
|
146
|
+
for (let e = 0; e < N.length; e++) {
|
|
147
|
+
let t = E(N[e]);
|
|
148
|
+
C.includes(t) ? (k.delete(t), A.current.delete(t)) : k.get(t) !== !0 && k.set(t, !1);
|
|
149
|
+
}
|
|
150
|
+
}, [
|
|
151
|
+
N,
|
|
152
|
+
C.length,
|
|
153
|
+
C.join("-")
|
|
154
|
+
]);
|
|
155
|
+
let F = [];
|
|
156
|
+
if (S !== j) {
|
|
157
|
+
let e = [...S];
|
|
158
|
+
for (let t = 0; t < N.length; t++) {
|
|
159
|
+
let n = N[t], r = E(n);
|
|
160
|
+
C.includes(r) || (e.splice(t, 0, n), F.push(n));
|
|
161
|
+
}
|
|
162
|
+
return l === "wait" && F.length && (e = F), P(D(e)), M(S), null;
|
|
163
|
+
}
|
|
164
|
+
let { forceRender: I } = d(t);
|
|
165
|
+
return v(_, { children: N.map((e) => {
|
|
166
|
+
let t = E(e), r = u && !b ? !1 : S === N || C.includes(t);
|
|
167
|
+
return v(w, {
|
|
168
|
+
isPresent: r,
|
|
169
|
+
initial: !T.current || a ? void 0 : !1,
|
|
170
|
+
custom: n,
|
|
171
|
+
presenceAffectsLayout: c,
|
|
172
|
+
mode: l,
|
|
173
|
+
root: y,
|
|
174
|
+
onExitComplete: r ? void 0 : () => {
|
|
175
|
+
if (A.current.has(t)) return;
|
|
176
|
+
if (k.has(t)) A.current.add(t), k.set(t, !0);
|
|
177
|
+
else return;
|
|
178
|
+
let e = !0;
|
|
179
|
+
k.forEach((t) => {
|
|
180
|
+
t || (e = !1);
|
|
181
|
+
}), e && (I?.(), P(O.current), u && x?.(), s && s());
|
|
182
|
+
},
|
|
183
|
+
anchorX: f,
|
|
184
|
+
anchorY: p,
|
|
185
|
+
children: e
|
|
186
|
+
}, t);
|
|
187
|
+
}) });
|
|
188
|
+
}, k = s("x", [["path", {
|
|
189
|
+
d: "M18 6 6 18",
|
|
190
|
+
key: "1bl5f8"
|
|
191
|
+
}], ["path", {
|
|
192
|
+
d: "m6 6 12 12",
|
|
193
|
+
key: "d8bk6v"
|
|
194
|
+
}]]);
|
|
195
|
+
//#endregion
|
|
196
|
+
export { O as n, k as t };
|
|
197
|
+
|
|
198
|
+
//# sourceMappingURL=widget-react-wSc9gIfG.js.map
|
package/dist/widget-react.d.ts
CHANGED
|
@@ -241,8 +241,8 @@ export interface VisitorIdentity {
|
|
|
241
241
|
export interface WexioWidgetProps {
|
|
242
242
|
publicKey?: string;
|
|
243
243
|
/**
|
|
244
|
-
* Log a known user into the widget (
|
|
245
|
-
*
|
|
244
|
+
* Log a known user into the widget (a known-user login / boot).
|
|
245
|
+
* Provide ONE proof:
|
|
246
246
|
* `googleIdToken`, `jwt`, or the legacy `userId` + `userHash` pair.
|
|
247
247
|
* `name` / `email` / `phone` populate the People profile;
|
|
248
248
|
* `attributes` is an open bag of extra fields.
|