@machinemetrics/mm-react-embeddable 2.0.3-1 → 2.0.3-3
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import D, { createContext as Ie, useContext as te, useState as F, useRef as d, useCallback as h, useEffect as g, useMemo as Me } from "react";
|
|
2
|
+
import w from "prop-types";
|
|
3
|
+
import ge from "styled-components";
|
|
4
|
+
const ae = Ie(null), ue = Ie({
|
|
5
5
|
pending: [],
|
|
6
6
|
authorize: () => {
|
|
7
7
|
},
|
|
@@ -16,317 +16,317 @@ const se = fe(null), te = fe({
|
|
|
16
16
|
unsupported: {},
|
|
17
17
|
setDelivered: () => {
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
kind:
|
|
21
|
-
accessToken:
|
|
22
|
-
expiresAt:
|
|
23
|
-
} : null : null,
|
|
19
|
+
}), Ce = "access_token", Ee = (e) => e ? e.kind ? e : e.accessToken ? {
|
|
20
|
+
kind: Ce,
|
|
21
|
+
accessToken: e.accessToken,
|
|
22
|
+
expiresAt: e.expiresAt || null
|
|
23
|
+
} : null : null, ve = 60, Se = 120, Ue = 3e4, xe = /* @__PURE__ */ new Set([
|
|
24
24
|
"host_not_allowed",
|
|
25
25
|
"unbound_host_bound_guest",
|
|
26
26
|
"invalid_token",
|
|
27
27
|
"provider_unavailable"
|
|
28
|
-
]),
|
|
28
|
+
]), oe = (e) => {
|
|
29
29
|
try {
|
|
30
|
-
return new URL(
|
|
30
|
+
return new URL(e).origin;
|
|
31
31
|
} catch {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
-
},
|
|
34
|
+
}, Re = (e, s) => {
|
|
35
35
|
const u = s == null ? void 0 : s.origin;
|
|
36
|
-
return !u ||
|
|
37
|
-
},
|
|
38
|
-
if (!
|
|
39
|
-
return
|
|
40
|
-
const s =
|
|
41
|
-
return s.length <= 2 ?
|
|
42
|
-
},
|
|
36
|
+
return !u || oe(e == null ? void 0 : e.authUrl) !== u ? null : u;
|
|
37
|
+
}, we = (e) => {
|
|
38
|
+
if (!e || /^\d{1,3}(?:\.\d{1,3}){3}$/.test(e) || e.includes(":"))
|
|
39
|
+
return e;
|
|
40
|
+
const s = e.split(".");
|
|
41
|
+
return s.length <= 2 ? e : s.slice(-2).join(".");
|
|
42
|
+
}, ke = (e, s) => {
|
|
43
43
|
try {
|
|
44
|
-
const u = new URL(
|
|
45
|
-
return u.protocol !==
|
|
44
|
+
const u = new URL(e), m = new URL(s);
|
|
45
|
+
return u.protocol !== m.protocol ? !0 : we(u.hostname) !== we(m.hostname);
|
|
46
46
|
} catch {
|
|
47
47
|
return !0;
|
|
48
48
|
}
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
|
|
49
|
+
}, Oe = (e, { onBlocked: s, onClosed: u }) => {
|
|
50
|
+
const m = window.open(
|
|
51
|
+
e.authUrl,
|
|
52
52
|
"mm-embed-auth",
|
|
53
53
|
"popup,width=600,height=700"
|
|
54
54
|
);
|
|
55
|
-
if (!
|
|
55
|
+
if (!m)
|
|
56
56
|
return s(), () => {
|
|
57
57
|
};
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const E = setInterval(() => {
|
|
59
|
+
m.closed && (clearInterval(E), u());
|
|
60
60
|
}, 1e3);
|
|
61
|
-
return () => clearInterval(
|
|
62
|
-
},
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
!
|
|
71
|
-
}, []),
|
|
72
|
-
const n =
|
|
61
|
+
return () => clearInterval(E);
|
|
62
|
+
}, _e = ({ children: e, launcher: s, broker: u, ready: m }) => {
|
|
63
|
+
const E = te(ae), [I, A] = F({}), [q, J] = F({}), [Z, L] = F({}), [U, y] = F({}), R = d(Z);
|
|
64
|
+
R.current = Z;
|
|
65
|
+
const j = d(I);
|
|
66
|
+
j.current = I;
|
|
67
|
+
const P = d(null), b = d({}), Y = d({}), Q = d(u);
|
|
68
|
+
Q.current = u;
|
|
69
|
+
const v = d({}), K = d({}), N = h((r, n, t) => {
|
|
70
|
+
!r || !n || (v.current[r] || (v.current[r] = /* @__PURE__ */ new Set()), t ? v.current[r].add(n) : v.current[r].delete(n));
|
|
71
|
+
}, []), x = h((r) => {
|
|
72
|
+
const n = b.current[r];
|
|
73
73
|
if (!n)
|
|
74
74
|
return;
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
}, []), i =
|
|
78
|
-
(
|
|
79
|
-
|
|
80
|
-
...
|
|
81
|
-
[
|
|
82
|
-
origin:
|
|
75
|
+
const t = (o) => !o[r] || o[r].clientId ? o : { ...o, [r]: { ...o[r], clientId: n } };
|
|
76
|
+
A(t), y(t);
|
|
77
|
+
}, []), i = h(
|
|
78
|
+
(r, n) => {
|
|
79
|
+
r && (y((t) => t[r] ? t : {
|
|
80
|
+
...t,
|
|
81
|
+
[r]: {
|
|
82
|
+
origin: r,
|
|
83
83
|
reason: n,
|
|
84
|
-
clientId:
|
|
84
|
+
clientId: b.current[r] || null
|
|
85
85
|
}
|
|
86
|
-
}),
|
|
86
|
+
}), x(r));
|
|
87
87
|
},
|
|
88
|
-
[
|
|
89
|
-
), a =
|
|
90
|
-
(
|
|
91
|
-
var
|
|
92
|
-
if (
|
|
93
|
-
if (n &&
|
|
94
|
-
if (!((
|
|
88
|
+
[x]
|
|
89
|
+
), a = h(
|
|
90
|
+
(r, { v2: n = !1, origin: t = null } = {}) => {
|
|
91
|
+
var o;
|
|
92
|
+
if (t) {
|
|
93
|
+
if (n && R.current[t]) {
|
|
94
|
+
if (!((o = v.current[t]) != null && o.has(r.instanceId)))
|
|
95
95
|
return;
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
96
|
+
const p = Date.now();
|
|
97
|
+
if (p - (K.current[t] || 0) < Ue)
|
|
98
98
|
return;
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
delete
|
|
99
|
+
K.current[t] = p, v.current[t].clear();
|
|
100
|
+
const C = { ...R.current };
|
|
101
|
+
delete C[t], R.current = C, L(C);
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
...
|
|
105
|
-
[
|
|
106
|
-
origin:
|
|
107
|
-
authUrl:
|
|
108
|
-
status: n &&
|
|
103
|
+
A((p) => p[t] ? p : {
|
|
104
|
+
...p,
|
|
105
|
+
[t]: {
|
|
106
|
+
origin: t,
|
|
107
|
+
authUrl: r.authUrl,
|
|
108
|
+
status: n && Q.current ? "broker" : "interactive",
|
|
109
109
|
v2: n,
|
|
110
|
-
scope:
|
|
111
|
-
acceptsCredentials:
|
|
110
|
+
scope: r.scope || null,
|
|
111
|
+
acceptsCredentials: Y.current[t] || null,
|
|
112
112
|
consent: null,
|
|
113
113
|
error: null,
|
|
114
|
-
clientId:
|
|
114
|
+
clientId: r.clientId || b.current[t] || null,
|
|
115
115
|
popupBlocked: !1
|
|
116
116
|
}
|
|
117
|
-
}),
|
|
117
|
+
}), x(t);
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
-
[
|
|
121
|
-
),
|
|
122
|
-
|
|
123
|
-
}, []), l =
|
|
124
|
-
(
|
|
125
|
-
|
|
126
|
-
if (!n[
|
|
120
|
+
[x]
|
|
121
|
+
), c = d({}), f = h((r) => {
|
|
122
|
+
c.current[r] && (clearTimeout(c.current[r]), delete c.current[r]);
|
|
123
|
+
}, []), l = h(
|
|
124
|
+
(r) => {
|
|
125
|
+
f(r), A((n) => {
|
|
126
|
+
if (!n[r])
|
|
127
127
|
return n;
|
|
128
|
-
const
|
|
129
|
-
return delete r
|
|
128
|
+
const t = { ...n };
|
|
129
|
+
return delete t[r], t;
|
|
130
130
|
});
|
|
131
131
|
},
|
|
132
|
-
[
|
|
133
|
-
),
|
|
134
|
-
(
|
|
135
|
-
|
|
132
|
+
[f]
|
|
133
|
+
), k = h(
|
|
134
|
+
(r) => {
|
|
135
|
+
r && (l(r), J((n) => ({
|
|
136
136
|
...n,
|
|
137
|
-
[
|
|
137
|
+
[r]: (n[r] || 0) + 1
|
|
138
138
|
})));
|
|
139
139
|
},
|
|
140
140
|
[l]
|
|
141
|
-
),
|
|
142
|
-
(
|
|
143
|
-
l(
|
|
141
|
+
), B = h(
|
|
142
|
+
(r) => {
|
|
143
|
+
l(r.origin);
|
|
144
144
|
},
|
|
145
145
|
[l]
|
|
146
|
-
),
|
|
147
|
-
(
|
|
148
|
-
const
|
|
149
|
-
if (
|
|
150
|
-
if (
|
|
151
|
-
i(
|
|
146
|
+
), O = h(
|
|
147
|
+
(r, n) => {
|
|
148
|
+
const t = Re(r, n);
|
|
149
|
+
if (t) {
|
|
150
|
+
if (ke(t, window.location.origin)) {
|
|
151
|
+
i(t, "cross-site-legacy");
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
a(
|
|
154
|
+
a(r, { origin: t });
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
[a, i]
|
|
158
158
|
);
|
|
159
|
-
|
|
160
|
-
if (!
|
|
159
|
+
g(() => {
|
|
160
|
+
if (!E)
|
|
161
161
|
return;
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
const r = [
|
|
163
|
+
E.addListener("*", "init", (n, t) => {
|
|
164
|
+
t != null && t.origin && (n != null && n.clientId) && (b.current[t.origin] = n.clientId, x(t.origin)), t != null && t.origin && Array.isArray(n == null ? void 0 : n.acceptsCredentials) ? Y.current[t.origin] = n.acceptsCredentials : t != null && t.origin && ke(t.origin, window.location.origin) && i(t.origin, "cross-site-legacy");
|
|
165
165
|
}),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
166
|
+
E.addListener("*", "authorize", O),
|
|
167
|
+
E.addListener("*", "login", O),
|
|
168
|
+
E.addListener(
|
|
169
169
|
"*",
|
|
170
170
|
"credential-request",
|
|
171
|
-
(n,
|
|
171
|
+
(n, t) => a(n, { v2: !0, origin: Re(n, t) })
|
|
172
172
|
)
|
|
173
173
|
];
|
|
174
|
-
return () =>
|
|
175
|
-
}, [
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
if (!
|
|
174
|
+
return () => r.forEach((n) => n());
|
|
175
|
+
}, [E, O, a, x, i]), g(() => {
|
|
176
|
+
const r = (n) => {
|
|
177
|
+
const t = n == null ? void 0 : n.data;
|
|
178
|
+
if (!t || t.type !== "authorized")
|
|
179
179
|
return;
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
180
|
+
const o = oe(t.authUrl);
|
|
181
|
+
if (!o || n.origin !== o)
|
|
182
182
|
return;
|
|
183
|
-
const
|
|
184
|
-
if (!(!
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
...
|
|
188
|
-
[
|
|
189
|
-
})), l(
|
|
183
|
+
const p = j.current[o];
|
|
184
|
+
if (!(!p || p.status !== "interactive")) {
|
|
185
|
+
if (t.accessToken) {
|
|
186
|
+
L((C) => ({
|
|
187
|
+
...C,
|
|
188
|
+
[o]: Ee({ accessToken: t.accessToken })
|
|
189
|
+
})), l(o);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
k(o);
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
|
-
return window.addEventListener("message",
|
|
196
|
-
}, [l,
|
|
197
|
-
const
|
|
198
|
-
(
|
|
199
|
-
const
|
|
200
|
-
!
|
|
195
|
+
return window.addEventListener("message", r), () => window.removeEventListener("message", r);
|
|
196
|
+
}, [l, k]);
|
|
197
|
+
const $ = h(
|
|
198
|
+
(r, n) => {
|
|
199
|
+
const t = r == null ? void 0 : r.origin, o = Ee(n);
|
|
200
|
+
!t || !o || (L((p) => ({ ...p, [t]: o })), l(t));
|
|
201
201
|
},
|
|
202
202
|
[l]
|
|
203
|
-
),
|
|
204
|
-
|
|
205
|
-
}, []),
|
|
206
|
-
async (
|
|
207
|
-
const
|
|
208
|
-
let
|
|
203
|
+
), T = h((r, n) => {
|
|
204
|
+
A((t) => t[r] ? { ...t, [r]: { ...t[r], ...n } } : t);
|
|
205
|
+
}, []), M = d({}), z = h(
|
|
206
|
+
async (r, { approve: n } = {}) => {
|
|
207
|
+
const t = Q.current, { origin: o } = r;
|
|
208
|
+
let p;
|
|
209
209
|
try {
|
|
210
|
-
|
|
210
|
+
p = await t(
|
|
211
211
|
{
|
|
212
|
-
origin:
|
|
213
|
-
clientId:
|
|
214
|
-
scope:
|
|
215
|
-
authUrl:
|
|
212
|
+
origin: o,
|
|
213
|
+
clientId: r.clientId,
|
|
214
|
+
scope: r.scope,
|
|
215
|
+
authUrl: r.authUrl
|
|
216
216
|
},
|
|
217
217
|
{ approve: n }
|
|
218
218
|
);
|
|
219
219
|
} catch {
|
|
220
|
-
n ?
|
|
220
|
+
n ? T(o, { error: { reason: "broker_unavailable" } }) : T(o, { status: "interactive" });
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
223
|
+
const C = p == null ? void 0 : p.status, S = (p == null ? void 0 : p.body) || {};
|
|
224
|
+
if (C === 200 && S.credential) {
|
|
225
|
+
$(r, S.credential);
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
if (
|
|
229
|
-
|
|
228
|
+
if (C === 409 && S.consentRequired) {
|
|
229
|
+
T(o, {
|
|
230
230
|
status: "interactive",
|
|
231
231
|
consent: {
|
|
232
|
-
client:
|
|
233
|
-
stepUp: !!
|
|
234
|
-
scope:
|
|
232
|
+
client: S.client || null,
|
|
233
|
+
stepUp: !!S.stepUp,
|
|
234
|
+
scope: S.scope || r.scope
|
|
235
235
|
},
|
|
236
236
|
error: null
|
|
237
237
|
});
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
if (!n &&
|
|
242
|
-
|
|
240
|
+
const G = S.error || "broker_error";
|
|
241
|
+
if (!n && xe.has(G)) {
|
|
242
|
+
T(o, { status: "interactive" });
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
if (n &&
|
|
246
|
-
|
|
245
|
+
if (n && G === "consent_denied") {
|
|
246
|
+
T(o, { error: null });
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
Number(
|
|
252
|
-
|
|
253
|
-
),
|
|
254
|
-
|
|
255
|
-
delete
|
|
256
|
-
delete
|
|
249
|
+
if (G === "rate_limited" && !r.rateLimitRetried) {
|
|
250
|
+
const H = Math.min(
|
|
251
|
+
Number(S.retryAfter) > 0 ? Number(S.retryAfter) : ve,
|
|
252
|
+
Se
|
|
253
|
+
), ne = { ...r, rateLimitRetried: !0 };
|
|
254
|
+
f(o), c.current[o] = setTimeout(() => {
|
|
255
|
+
delete c.current[o], M.current[o] = !0, ee.current(ne, { approve: n }).finally(() => {
|
|
256
|
+
delete M.current[o];
|
|
257
257
|
});
|
|
258
|
-
},
|
|
258
|
+
}, H * 1e3), T(o, { rateLimitRetried: !0 });
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
l(
|
|
262
|
-
...
|
|
263
|
-
[
|
|
264
|
-
origin:
|
|
265
|
-
reason: `broker:${
|
|
266
|
-
detail: { status:
|
|
267
|
-
clientId:
|
|
261
|
+
l(o), y((H) => ({
|
|
262
|
+
...H,
|
|
263
|
+
[o]: {
|
|
264
|
+
origin: o,
|
|
265
|
+
reason: `broker:${G}`,
|
|
266
|
+
detail: { status: C != null ? C : null, reason: G },
|
|
267
|
+
clientId: r.clientId || b.current[o] || null
|
|
268
268
|
}
|
|
269
269
|
}));
|
|
270
270
|
},
|
|
271
|
-
[
|
|
272
|
-
),
|
|
273
|
-
|
|
274
|
-
Object.values(I).forEach((
|
|
275
|
-
|
|
276
|
-
delete
|
|
271
|
+
[$, T, l, f]
|
|
272
|
+
), ee = d(z);
|
|
273
|
+
ee.current = z, g(() => {
|
|
274
|
+
Object.values(I).forEach((r) => {
|
|
275
|
+
r.status !== "broker" || M.current[r.origin] || c.current[r.origin] || (M.current[r.origin] = !0, z(r).finally(() => {
|
|
276
|
+
delete M.current[r.origin];
|
|
277
277
|
}));
|
|
278
278
|
});
|
|
279
|
-
}, [I,
|
|
280
|
-
const
|
|
281
|
-
(
|
|
282
|
-
delete
|
|
279
|
+
}, [I, z]);
|
|
280
|
+
const W = h(
|
|
281
|
+
(r) => !Q.current || !(r != null && r.consent) || M.current[r.origin] ? Promise.resolve() : (M.current[r.origin] = !0, z(r, { approve: !0 }).finally(() => {
|
|
282
|
+
delete M.current[r.origin];
|
|
283
283
|
})),
|
|
284
|
-
[
|
|
284
|
+
[z]
|
|
285
285
|
);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}, []),
|
|
289
|
-
|
|
290
|
-
}, [
|
|
291
|
-
const
|
|
292
|
-
(
|
|
293
|
-
|
|
294
|
-
const n = s ||
|
|
295
|
-
|
|
286
|
+
g(() => () => {
|
|
287
|
+
P.current && P.current(), Object.values(c.current).forEach(clearTimeout);
|
|
288
|
+
}, []), g(() => {
|
|
289
|
+
m === !1 && (Object.values(c.current).forEach(clearTimeout), c.current = {}, M.current = {}, b.current = {}, Y.current = {}, v.current = {}, K.current = {}, R.current = {}, L({}), A({}), y({}));
|
|
290
|
+
}, [m]);
|
|
291
|
+
const X = h(
|
|
292
|
+
(r) => {
|
|
293
|
+
P.current && (P.current(), P.current = null);
|
|
294
|
+
const n = s || Oe;
|
|
295
|
+
P.current = n(r, {
|
|
296
296
|
onBlocked: () => {
|
|
297
|
-
|
|
298
|
-
...
|
|
299
|
-
[
|
|
300
|
-
} :
|
|
297
|
+
A((t) => t[r.origin] ? {
|
|
298
|
+
...t,
|
|
299
|
+
[r.origin]: { ...t[r.origin], popupBlocked: !0 }
|
|
300
|
+
} : t);
|
|
301
301
|
},
|
|
302
302
|
// A completed login already removed the entry. A v2 entry stays pending so the prompt remains;
|
|
303
303
|
// a legacy guest is remounted because it only learns of a login by reloading.
|
|
304
304
|
onClosed: () => {
|
|
305
|
-
const
|
|
306
|
-
!
|
|
305
|
+
const t = j.current[r.origin];
|
|
306
|
+
!t || t.v2 || k(r.origin);
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
},
|
|
310
|
-
[s,
|
|
311
|
-
),
|
|
310
|
+
[s, k]
|
|
311
|
+
), re = {
|
|
312
312
|
pending: Object.values(I).filter(
|
|
313
|
-
(
|
|
313
|
+
(r) => r.status === "interactive"
|
|
314
314
|
),
|
|
315
|
-
authorize:
|
|
316
|
-
approve:
|
|
317
|
-
complete:
|
|
318
|
-
dismiss:
|
|
319
|
-
originEpochs:
|
|
320
|
-
credentials:
|
|
321
|
-
unsupported:
|
|
322
|
-
setDelivered:
|
|
315
|
+
authorize: X,
|
|
316
|
+
approve: W,
|
|
317
|
+
complete: $,
|
|
318
|
+
dismiss: B,
|
|
319
|
+
originEpochs: q,
|
|
320
|
+
credentials: Z,
|
|
321
|
+
unsupported: U,
|
|
322
|
+
setDelivered: N
|
|
323
323
|
};
|
|
324
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ D.createElement(ue.Provider, { value: re }, e);
|
|
325
325
|
};
|
|
326
|
-
|
|
327
|
-
children:
|
|
328
|
-
launcher:
|
|
329
|
-
ready:
|
|
326
|
+
_e.propTypes = {
|
|
327
|
+
children: w.node,
|
|
328
|
+
launcher: w.func,
|
|
329
|
+
ready: w.bool,
|
|
330
330
|
/**
|
|
331
331
|
* `async (request, { approve }) => result` where request =
|
|
332
332
|
* `{ origin, clientId, scope, authUrl }` (origin is the zone-attested frame origin) and result
|
|
@@ -335,181 +335,181 @@ pe.propTypes = {
|
|
|
335
335
|
* on 200, `{ consentRequired: true, client: { name, hostname }, stepUp }` on 409, `{ error,
|
|
336
336
|
* … }` otherwise. Provided only by hosts that are themselves first-party clients.
|
|
337
337
|
*/
|
|
338
|
-
broker:
|
|
338
|
+
broker: w.func
|
|
339
339
|
};
|
|
340
|
-
const
|
|
341
|
-
const { originEpochs: s } =
|
|
340
|
+
const $e = () => te(ue), ze = (e) => {
|
|
341
|
+
const { originEpochs: s } = te(ue), u = oe(e);
|
|
342
342
|
return u && s[u] || 0;
|
|
343
|
-
},
|
|
344
|
-
const { credentials: s } =
|
|
343
|
+
}, Fe = (e) => {
|
|
344
|
+
const { credentials: s } = te(ue), u = oe(e);
|
|
345
345
|
return u && s[u] || null;
|
|
346
|
-
},
|
|
347
|
-
const { unsupported: s } =
|
|
346
|
+
}, De = (e) => {
|
|
347
|
+
const { unsupported: s } = te(ue), u = oe(e);
|
|
348
348
|
return u && s[u] || null;
|
|
349
|
-
},
|
|
350
|
-
children:
|
|
349
|
+
}, Te = "MMEmbeddableZoneProvider requires a boolean `ready` prop (true once the host holds the bearer its credentialBroker needs). Embedded apps will not load until it is provided.", Pe = ({
|
|
350
|
+
children: e,
|
|
351
351
|
authorizationLauncher: s,
|
|
352
352
|
credentialBroker: u,
|
|
353
|
-
ready:
|
|
353
|
+
ready: m
|
|
354
354
|
}) => {
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}, [
|
|
359
|
-
const [
|
|
360
|
-
var
|
|
361
|
-
return !!((
|
|
362
|
-
}, []),
|
|
363
|
-
|
|
364
|
-
}, []),
|
|
365
|
-
|
|
366
|
-
const
|
|
367
|
-
return delete
|
|
368
|
-
}),
|
|
369
|
-
const
|
|
370
|
-
return delete
|
|
371
|
-
}), delete
|
|
372
|
-
|
|
355
|
+
const E = m === !0, I = d(!1);
|
|
356
|
+
g(() => {
|
|
357
|
+
m !== void 0 || I.current || (I.current = !0, console.error(Te), typeof window != "undefined" && typeof window.alert == "function" && window.alert(Te));
|
|
358
|
+
}, [m]);
|
|
359
|
+
const [A, q] = F({}), [J, Z] = F({}), L = d({}), U = d({}), y = d({}), R = h((i, a) => {
|
|
360
|
+
var c;
|
|
361
|
+
return !!((c = y.current[i]) != null && c.has(a));
|
|
362
|
+
}, []), j = h((i, a, c) => {
|
|
363
|
+
q((f) => ({ ...f, [i]: { origin: a, frameRef: c } }));
|
|
364
|
+
}, []), P = h((i) => {
|
|
365
|
+
q((a) => {
|
|
366
|
+
const c = { ...a };
|
|
367
|
+
return delete c[i], c;
|
|
368
|
+
}), Z((a) => {
|
|
369
|
+
const c = { ...a };
|
|
370
|
+
return delete c[i], c;
|
|
371
|
+
}), delete y.current[i], Object.keys(U.current).forEach((a) => {
|
|
372
|
+
U.current[a].instanceId === i && delete U.current[a];
|
|
373
373
|
});
|
|
374
374
|
}, []);
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}, []),
|
|
378
|
-
const i = (
|
|
379
|
-
|
|
380
|
-
}, a = (
|
|
381
|
-
var
|
|
382
|
-
if (!((
|
|
375
|
+
g(() => () => {
|
|
376
|
+
U.current = {};
|
|
377
|
+
}, []), g(() => {
|
|
378
|
+
const i = (c = [], f, l) => {
|
|
379
|
+
c.forEach((k) => k(f, l));
|
|
380
|
+
}, a = (c) => {
|
|
381
|
+
var T, M, z, ee, W, X, re;
|
|
382
|
+
if (!((T = c == null ? void 0 : c.data) != null && T.instanceId))
|
|
383
383
|
return;
|
|
384
|
-
const { instanceId:
|
|
385
|
-
if (
|
|
384
|
+
const { instanceId: f, type: l } = c.data, k = A[f], B = (z = (M = k == null ? void 0 : k.frameRef) == null ? void 0 : M.current) == null ? void 0 : z.contentWindow;
|
|
385
|
+
if (!B || c.source !== B || c.origin !== k.origin)
|
|
386
386
|
return;
|
|
387
|
-
const
|
|
387
|
+
const O = { origin: c.origin }, $ = L.current;
|
|
388
388
|
if (l === "response") {
|
|
389
|
-
const { callbackId:
|
|
390
|
-
|
|
389
|
+
const { callbackId: r, response: n, error: t } = c.data, o = U.current[r];
|
|
390
|
+
o && o.instanceId === f && (o.callback(n, t), delete U.current[r]);
|
|
391
391
|
return;
|
|
392
392
|
}
|
|
393
393
|
if (l === "mark-registered") {
|
|
394
|
-
const { requestType:
|
|
395
|
-
|
|
394
|
+
const { requestType: r } = c.data;
|
|
395
|
+
y.current[f] || (y.current[f] = /* @__PURE__ */ new Set()), y.current[f].add(r);
|
|
396
396
|
return;
|
|
397
397
|
}
|
|
398
|
-
l === "ready" &&
|
|
398
|
+
l === "ready" && Z((r) => ({ ...r, [f]: !0 })), i((ee = $[f]) == null ? void 0 : ee[l], c.data, O), i((W = $["*"]) == null ? void 0 : W[l], c.data, O), i((X = $[f]) == null ? void 0 : X["*"], c.data, O), i((re = $["*"]) == null ? void 0 : re["*"], c.data, O);
|
|
399
399
|
};
|
|
400
400
|
return window.addEventListener("message", a), () => {
|
|
401
401
|
window.removeEventListener("message", a);
|
|
402
402
|
};
|
|
403
|
-
}, [
|
|
404
|
-
const
|
|
405
|
-
(i, a,
|
|
406
|
-
var
|
|
407
|
-
const l =
|
|
403
|
+
}, [A]);
|
|
404
|
+
const b = h(
|
|
405
|
+
(i, a, c, f) => {
|
|
406
|
+
var k, B;
|
|
407
|
+
const l = A[i];
|
|
408
408
|
if (!l) {
|
|
409
409
|
console.warn(`Origin not set for id: ${i}. Unable to send message.`);
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
|
-
(
|
|
413
|
-
{ type: a, ...
|
|
414
|
-
|
|
412
|
+
(B = (k = l == null ? void 0 : l.frameRef) == null ? void 0 : k.current) != null && B.contentWindow && l.frameRef.current.contentWindow.postMessage(
|
|
413
|
+
{ type: a, ...c, instanceId: i },
|
|
414
|
+
f || l.origin
|
|
415
415
|
);
|
|
416
416
|
},
|
|
417
|
-
[
|
|
418
|
-
),
|
|
419
|
-
async (i, a,
|
|
420
|
-
const
|
|
421
|
-
delete
|
|
417
|
+
[A]
|
|
418
|
+
), Y = d(0), Q = h(() => `${Date.now()}-${++Y.current}`, []), v = h(
|
|
419
|
+
async (i, a, c = {}) => new Promise((f, l) => {
|
|
420
|
+
const k = Q(), B = (O, $) => {
|
|
421
|
+
delete U.current[k], $ ? l($) : f(O);
|
|
422
422
|
};
|
|
423
|
-
|
|
423
|
+
U.current[k] = { instanceId: i, callback: B }, b(i, "request", { callbackId: k, requestType: a, data: c });
|
|
424
424
|
}),
|
|
425
|
-
[
|
|
426
|
-
),
|
|
425
|
+
[b]
|
|
426
|
+
), K = h(
|
|
427
427
|
(i, a) => {
|
|
428
|
-
|
|
428
|
+
b(i, "load-options", a);
|
|
429
429
|
},
|
|
430
|
-
[
|
|
431
|
-
),
|
|
430
|
+
[b]
|
|
431
|
+
), N = h(
|
|
432
432
|
(i, a) => {
|
|
433
|
-
|
|
433
|
+
b(i, "validate", a);
|
|
434
434
|
},
|
|
435
|
-
[
|
|
436
|
-
),
|
|
435
|
+
[b]
|
|
436
|
+
), x = Me(
|
|
437
437
|
() => ({
|
|
438
|
-
registerFrame:
|
|
439
|
-
unregisterFrame:
|
|
440
|
-
sendMessage:
|
|
441
|
-
sendRequest:
|
|
442
|
-
loadOptions:
|
|
443
|
-
validate:
|
|
444
|
-
hasHandler:
|
|
445
|
-
readyFrames:
|
|
446
|
-
ready:
|
|
447
|
-
addListener: (i, a,
|
|
448
|
-
|
|
438
|
+
registerFrame: j,
|
|
439
|
+
unregisterFrame: P,
|
|
440
|
+
sendMessage: b,
|
|
441
|
+
sendRequest: v,
|
|
442
|
+
loadOptions: K,
|
|
443
|
+
validate: N,
|
|
444
|
+
hasHandler: R,
|
|
445
|
+
readyFrames: J,
|
|
446
|
+
ready: E,
|
|
447
|
+
addListener: (i, a, c) => (L.current[i] || (L.current[i] = {}), L.current[i][a] || (L.current[i][a] = []), L.current[i][a].push(c), () => {
|
|
448
|
+
L.current[i][a] = L.current[i][a].filter((f) => f !== c);
|
|
449
449
|
})
|
|
450
450
|
}),
|
|
451
451
|
[
|
|
452
|
-
|
|
453
|
-
O,
|
|
454
|
-
M,
|
|
455
|
-
U,
|
|
456
|
-
D,
|
|
452
|
+
j,
|
|
457
453
|
P,
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
454
|
+
b,
|
|
455
|
+
v,
|
|
456
|
+
K,
|
|
457
|
+
N,
|
|
458
|
+
R,
|
|
459
|
+
J,
|
|
460
|
+
E
|
|
461
461
|
]
|
|
462
462
|
);
|
|
463
|
-
return /* @__PURE__ */
|
|
464
|
-
|
|
463
|
+
return /* @__PURE__ */ D.createElement(ae.Provider, { value: x }, /* @__PURE__ */ D.createElement(
|
|
464
|
+
_e,
|
|
465
465
|
{
|
|
466
466
|
launcher: s,
|
|
467
467
|
broker: u,
|
|
468
|
-
ready:
|
|
468
|
+
ready: E
|
|
469
469
|
},
|
|
470
|
-
|
|
470
|
+
e
|
|
471
471
|
));
|
|
472
|
-
},
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
472
|
+
}, se = (e, s, u) => {
|
|
473
|
+
const m = te(ae);
|
|
474
|
+
if (m === null)
|
|
475
475
|
throw new Error(
|
|
476
476
|
"useEmbeddedEffect must be used within a MMEmbeddableZoneProvider"
|
|
477
477
|
);
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}, [u]),
|
|
482
|
-
if (!(!
|
|
478
|
+
const E = d(u);
|
|
479
|
+
g(() => {
|
|
480
|
+
E.current = u;
|
|
481
|
+
}, [u]), g(() => {
|
|
482
|
+
if (!(!e || !s)) {
|
|
483
483
|
if (s.startsWith("key:")) {
|
|
484
484
|
const I = s.substring(4);
|
|
485
|
-
return
|
|
486
|
-
|
|
485
|
+
return m.readyFrames[e] && m.sendMessage(e, "subscribe-key", { keyChord: I }), m.addListener(
|
|
486
|
+
e,
|
|
487
487
|
`key-pressed:${I}`,
|
|
488
|
-
(...
|
|
488
|
+
(...q) => E.current(...q)
|
|
489
489
|
);
|
|
490
490
|
}
|
|
491
|
-
return
|
|
492
|
-
|
|
491
|
+
return m.addListener(
|
|
492
|
+
e,
|
|
493
493
|
s,
|
|
494
|
-
(...I) =>
|
|
494
|
+
(...I) => E.current(...I)
|
|
495
495
|
);
|
|
496
496
|
}
|
|
497
|
-
}, [
|
|
497
|
+
}, [m, e, s]);
|
|
498
498
|
};
|
|
499
|
-
|
|
500
|
-
children:
|
|
499
|
+
Pe.propTypes = {
|
|
500
|
+
children: w.node.isRequired,
|
|
501
501
|
/**
|
|
502
502
|
* Required. True once the host holds its bearer; zones mount no iframe until then. Missing =
|
|
503
503
|
* not ready, plus a one-time alert.
|
|
504
504
|
*/
|
|
505
|
-
ready:
|
|
505
|
+
ready: w.bool.isRequired,
|
|
506
506
|
/**
|
|
507
507
|
* Optional interactive-step launcher for embedded authorizations,
|
|
508
508
|
* `(entry, { onBlocked, onClosed }) => cleanup`. Defaults to a top-level
|
|
509
509
|
* popup. Hosts that cannot open windows (Android WebView shells) drive
|
|
510
510
|
* their own UI from useEmbeddedAuthorizations() instead.
|
|
511
511
|
*/
|
|
512
|
-
authorizationLauncher:
|
|
512
|
+
authorizationLauncher: w.func,
|
|
513
513
|
/**
|
|
514
514
|
* Optional credential broker for hosts that are first-party MachineMetrics clients
|
|
515
515
|
* (`async (request, { approve }) => result`, see EmbeddedAuthorizationManager). When present,
|
|
@@ -517,16 +517,36 @@ Ce.propTypes = {
|
|
|
517
517
|
* from the broker's `client` identity; a broker answer the host may not act on falls back to the
|
|
518
518
|
* interactive entry and its popup.
|
|
519
519
|
*/
|
|
520
|
-
credentialBroker:
|
|
520
|
+
credentialBroker: w.func
|
|
521
521
|
};
|
|
522
|
-
const
|
|
522
|
+
const pe = ge.default || ge, Be = 1e4, We = 6e3, qe = 5e3, je = 2e4, He = 3e3, Ae = () => typeof document != "undefined" && document.visibilityState === "hidden", ce = (e, s, u) => {
|
|
523
|
+
if (e.current && clearTimeout(e.current.handle), Ae()) {
|
|
524
|
+
e.current = { ms: s, fn: u, suspended: !0 };
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const m = Date.now(), E = setTimeout(() => {
|
|
528
|
+
if (Date.now() - m - s > He) {
|
|
529
|
+
ce(e, s, u);
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
e.current = void 0, u();
|
|
533
|
+
}, s);
|
|
534
|
+
e.current = { handle: E, ms: s, fn: u };
|
|
535
|
+
}, V = (e) => {
|
|
536
|
+
e.current && clearTimeout(e.current.handle), e.current = void 0;
|
|
537
|
+
}, de = (e) => {
|
|
538
|
+
e.current && !e.current.suspended && (clearTimeout(e.current.handle), e.current = { ms: e.current.ms, fn: e.current.fn, suspended: !0 });
|
|
539
|
+
}, fe = (e) => {
|
|
540
|
+
e.current && e.current.suspended && ce(e, e.current.ms, e.current.fn);
|
|
541
|
+
}, Ze = "credentials", Ke = (e, s) => `${e}/mm-embedded-interop?id=${encodeURIComponent(s)}&origin=${encodeURIComponent(
|
|
523
542
|
window.location.origin
|
|
524
|
-
)}&caps=${
|
|
543
|
+
)}&caps=${Ze}`, Ge = pe.iframe`
|
|
525
544
|
width: 100%;
|
|
526
545
|
height: 100%;
|
|
527
546
|
border: none;
|
|
528
|
-
visibility: ${(
|
|
529
|
-
|
|
547
|
+
visibility: ${(e) => e.$isReady ? "visible" : "hidden"};
|
|
548
|
+
${(e) => e.$collapsed ? "position: absolute; width: 1px; height: 1px; overflow: hidden;" : ""}
|
|
549
|
+
`, Ve = pe.div`
|
|
530
550
|
width: 100%;
|
|
531
551
|
height: 100%;
|
|
532
552
|
display: flex;
|
|
@@ -539,8 +559,8 @@ const oe = ce.default || ce, Le = 1e4, Ae = 2e3, Ue = "credentials", ve = (t, s)
|
|
|
539
559
|
text-align: center;
|
|
540
560
|
color: #555;
|
|
541
561
|
font-size: 14px;
|
|
542
|
-
`,
|
|
543
|
-
const s =
|
|
562
|
+
`, Ye = (e) => {
|
|
563
|
+
const s = e && e.origin || "This app", u = e && e.reason || "";
|
|
544
564
|
switch (u) {
|
|
545
565
|
case "broker:scope_above_ceiling":
|
|
546
566
|
return {
|
|
@@ -567,176 +587,206 @@ const oe = ce.default || ce, Le = 1e4, Ae = 2e3, Ue = "credentials", ve = (t, s)
|
|
|
567
587
|
detail: "It needs an update to support embedding from a different domain."
|
|
568
588
|
};
|
|
569
589
|
}
|
|
570
|
-
},
|
|
571
|
-
const s =
|
|
572
|
-
return /* @__PURE__ */
|
|
590
|
+
}, Le = ({ entry: e }) => {
|
|
591
|
+
const s = Ye(e);
|
|
592
|
+
return /* @__PURE__ */ D.createElement(Ve, { "data-reason": e && e.reason || void 0 }, /* @__PURE__ */ D.createElement("div", { style: { fontWeight: 600 } }, s.title), /* @__PURE__ */ D.createElement("div", { style: { fontSize: 12, color: "#888" } }, s.detail));
|
|
573
593
|
};
|
|
574
|
-
|
|
575
|
-
entry:
|
|
576
|
-
origin:
|
|
577
|
-
name:
|
|
578
|
-
reason:
|
|
579
|
-
detail:
|
|
594
|
+
Le.propTypes = {
|
|
595
|
+
entry: w.shape({
|
|
596
|
+
origin: w.string,
|
|
597
|
+
name: w.string,
|
|
598
|
+
reason: w.string,
|
|
599
|
+
detail: w.object
|
|
580
600
|
})
|
|
581
601
|
};
|
|
582
|
-
const
|
|
602
|
+
const Qe = pe.div`
|
|
583
603
|
height: 100%;
|
|
584
604
|
display: flex;
|
|
585
605
|
flex: 1;
|
|
586
606
|
align-items: center;
|
|
587
607
|
justify-content: center;
|
|
588
|
-
`,
|
|
589
|
-
id:
|
|
608
|
+
`, Xe = () => /* @__PURE__ */ D.createElement(Qe, null, /* @__PURE__ */ D.createElement("div", { style: { textAlign: "center" } }, "This app couldn’t be loaded as an embeddable widget.")), Je = ({
|
|
609
|
+
id: e,
|
|
590
610
|
src: s,
|
|
591
611
|
path: u,
|
|
592
|
-
onInit:
|
|
612
|
+
onInit: m = () => {
|
|
593
613
|
},
|
|
594
|
-
onTimeout:
|
|
595
|
-
|
|
596
|
-
|
|
614
|
+
onTimeout: E,
|
|
615
|
+
onRemount: I,
|
|
616
|
+
onStall: A,
|
|
617
|
+
context: q = {},
|
|
618
|
+
params: J = {},
|
|
597
619
|
renderUnsupported: Z,
|
|
598
|
-
renderTimeout:
|
|
599
|
-
...
|
|
620
|
+
renderTimeout: L,
|
|
621
|
+
...U
|
|
600
622
|
}) => {
|
|
601
|
-
if ("isConfiguring" in
|
|
623
|
+
if ("isConfiguring" in U)
|
|
602
624
|
return console.error(
|
|
603
625
|
"isConfiguring must be passed via the params prop to MMEmbeddableZone"
|
|
604
626
|
), null;
|
|
605
|
-
if ("colorMode" in
|
|
627
|
+
if ("colorMode" in q)
|
|
606
628
|
return console.error(
|
|
607
629
|
"colorMode must be passed via the params prop to MMEmbeddableZone"
|
|
608
630
|
), null;
|
|
609
|
-
if ("isFullScreen" in
|
|
631
|
+
if ("isFullScreen" in q)
|
|
610
632
|
return console.error(
|
|
611
633
|
"isFullScreen must be passed via the params prop to MMEmbeddableZone"
|
|
612
634
|
), null;
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
), [
|
|
616
|
-
|
|
617
|
-
}, [
|
|
618
|
-
|
|
619
|
-
(
|
|
620
|
-
}, [
|
|
621
|
-
|
|
622
|
-
}, [
|
|
623
|
-
|
|
624
|
-
}, [
|
|
625
|
-
|
|
626
|
-
|
|
635
|
+
const y = d(), R = oe(s), [j, P] = F(), [b, Y] = F(0), [Q, v] = F(!1), [K, N] = F(!1), x = ze(s), i = Fe(s), a = De(s), { setDelivered: c } = $e(), [f, l] = F(0), [k, B] = F(null), { registerFrame: O, unregisterFrame: $, sendMessage: T, ready: M } = te(
|
|
636
|
+
ae
|
|
637
|
+
), [z, ee] = F(), W = d(), X = d(E), re = d(m), r = d(I), n = d(A), t = d(!1), o = d(), p = d(), C = d(!1), S = d(!1), G = d(null), H = h(() => {
|
|
638
|
+
t.current = !1, C.current = !1, S.current = !1, G.current = null, V(W), V(o), V(p), Y(0), v(!1), N(!1), B(null), c(R, e, !1);
|
|
639
|
+
}, [c, R, e]);
|
|
640
|
+
g(() => {
|
|
641
|
+
(x > 0 || f > 0) && H();
|
|
642
|
+
}, [x, f, H]), g(() => {
|
|
643
|
+
X.current = E;
|
|
644
|
+
}, [E]), g(() => {
|
|
645
|
+
re.current = m;
|
|
646
|
+
}, [m]), g(() => {
|
|
647
|
+
r.current = I;
|
|
648
|
+
}, [I]), g(() => {
|
|
649
|
+
n.current = A;
|
|
650
|
+
}, [A]), g(() => {
|
|
651
|
+
const _ = () => {
|
|
652
|
+
if (Ae()) {
|
|
653
|
+
de(W), de(o), de(p);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
fe(W), fe(p), C.current && fe(o);
|
|
657
|
+
};
|
|
658
|
+
return document.addEventListener("visibilitychange", _), () => document.removeEventListener("visibilitychange", _);
|
|
659
|
+
}, []), g(() => {
|
|
660
|
+
b && T(
|
|
661
|
+
e,
|
|
627
662
|
"set-context",
|
|
628
663
|
{
|
|
629
664
|
context: {
|
|
630
|
-
...
|
|
665
|
+
...q
|
|
631
666
|
}
|
|
632
667
|
},
|
|
633
|
-
|
|
668
|
+
R
|
|
634
669
|
);
|
|
635
|
-
}, [
|
|
636
|
-
|
|
637
|
-
}, [
|
|
638
|
-
u !== void 0 &&
|
|
639
|
-
}, [u]),
|
|
640
|
-
|
|
641
|
-
}, [
|
|
642
|
-
if (!s || !
|
|
670
|
+
}, [q, e, b, R]), g(() => {
|
|
671
|
+
b && T(e, "set-params", { params: J }, R);
|
|
672
|
+
}, [J, e, b, R]), g(() => {
|
|
673
|
+
u !== void 0 && ee((u == null ? void 0 : u.indexOf("/")) === 0 ? u : `/${u}`);
|
|
674
|
+
}, [u]), g(() => {
|
|
675
|
+
z === void 0 || !b || T(e, "navigate", { path: z }, R);
|
|
676
|
+
}, [z, b, e, T, R]), g(() => {
|
|
677
|
+
if (!s || !e || !y)
|
|
643
678
|
return;
|
|
644
|
-
if (!
|
|
645
|
-
|
|
679
|
+
if (!M) {
|
|
680
|
+
H(), P(void 0);
|
|
646
681
|
return;
|
|
647
682
|
}
|
|
648
|
-
|
|
649
|
-
const
|
|
650
|
-
return
|
|
651
|
-
|
|
683
|
+
H();
|
|
684
|
+
const _ = new URL(s);
|
|
685
|
+
return O(e, _.origin, y), re.current(), P(Ke(_.origin, e)), () => {
|
|
686
|
+
$(e);
|
|
652
687
|
};
|
|
653
|
-
}, [s,
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
K(!0), G.current && G.current();
|
|
657
|
-
}, Le), () => clearTimeout(B.current);
|
|
658
|
-
}, [A, s, D, a]);
|
|
659
|
-
const c = m(() => {
|
|
660
|
-
V.current = !0, clearTimeout(B.current), K(!1);
|
|
688
|
+
}, [s, e, M, O, y, H]);
|
|
689
|
+
const ne = h(() => {
|
|
690
|
+
v(!0), X.current && X.current();
|
|
661
691
|
}, []);
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
692
|
+
g(() => {
|
|
693
|
+
if (!(!j || t.current))
|
|
694
|
+
return ce(W, Be, ne), () => V(W);
|
|
695
|
+
}, [j, s, x, f, ne]);
|
|
696
|
+
const ie = h(() => {
|
|
697
|
+
t.current = !0, V(W), v(!1);
|
|
698
|
+
}, []), le = h(() => {
|
|
699
|
+
if (!S.current) {
|
|
700
|
+
S.current = !0, T(e, "credential", G.current, R), n.current && n.current("redelivered"), ce(p, je, le);
|
|
668
701
|
return;
|
|
669
|
-
|
|
670
|
-
|
|
702
|
+
}
|
|
703
|
+
n.current && n.current("ready"), ne();
|
|
704
|
+
}, [e, T, R, ne]);
|
|
705
|
+
se(e, "init", (_) => {
|
|
706
|
+
ie(), Array.isArray(_ == null ? void 0 : _.acceptsCredentials) && B(_.acceptsCredentials);
|
|
707
|
+
}), se(e, "authorize", ie), se(e, "login", ie), se(e, "credential-request", () => {
|
|
708
|
+
ie(), N(!0);
|
|
709
|
+
}), g(() => {
|
|
710
|
+
if (!K || !i)
|
|
671
711
|
return;
|
|
672
|
-
const
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
712
|
+
const _ = k;
|
|
713
|
+
if (Array.isArray(_) && !_.includes(i.kind))
|
|
714
|
+
return;
|
|
715
|
+
const be = { ...i.kind === "access_token" ? { accessToken: i.accessToken } : {}, credential: i };
|
|
716
|
+
G.current = be, S.current = !1, T(e, "credential", be, R), c(R, e, !0), ce(p, qe, le);
|
|
676
717
|
}, [
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
t,
|
|
718
|
+
le,
|
|
719
|
+
K,
|
|
720
|
+
i,
|
|
681
721
|
k,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
c
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
722
|
+
e,
|
|
723
|
+
T,
|
|
724
|
+
R,
|
|
725
|
+
c
|
|
726
|
+
]), se(e, "ready", () => {
|
|
727
|
+
ie(), V(p), Y((_) => _ + 1);
|
|
728
|
+
});
|
|
729
|
+
const ye = h(() => {
|
|
730
|
+
r.current && r.current("heartbeat"), l((_) => _ + 1);
|
|
731
|
+
}, []);
|
|
732
|
+
if (se(e, "heartbeat", () => {
|
|
733
|
+
C.current = !0, ce(o, We, ye);
|
|
734
|
+
}), g(() => () => {
|
|
735
|
+
V(o), V(p), V(W);
|
|
736
|
+
}, []), a)
|
|
737
|
+
return Z ? Z(a) : /* @__PURE__ */ D.createElement(Le, { entry: a });
|
|
738
|
+
const he = !!(Q && !b), me = { ...U };
|
|
739
|
+
return delete me.skipManifestCheck, /* @__PURE__ */ D.createElement(D.Fragment, null, he && (L ? L() : /* @__PURE__ */ D.createElement(Xe, null)), /* @__PURE__ */ D.createElement(
|
|
740
|
+
Ge,
|
|
699
741
|
{
|
|
700
|
-
key: `auth-epoch-${
|
|
701
|
-
$isReady:
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
742
|
+
key: `auth-epoch-${x}-frame-${f}`,
|
|
743
|
+
$isReady: b,
|
|
744
|
+
$collapsed: he,
|
|
745
|
+
ref: y,
|
|
746
|
+
src: j,
|
|
747
|
+
...me
|
|
705
748
|
}
|
|
706
|
-
);
|
|
749
|
+
));
|
|
707
750
|
};
|
|
708
|
-
|
|
709
|
-
id:
|
|
710
|
-
src:
|
|
711
|
-
path:
|
|
712
|
-
onInit:
|
|
713
|
-
onTimeout:
|
|
751
|
+
Je.propTypes = {
|
|
752
|
+
id: w.string,
|
|
753
|
+
src: w.string.isRequired,
|
|
754
|
+
path: w.string,
|
|
755
|
+
onInit: w.func,
|
|
756
|
+
onTimeout: w.func,
|
|
757
|
+
/** Called with the reason ('heartbeat') just before the frame is re-keyed. */
|
|
758
|
+
onRemount: w.func,
|
|
759
|
+
/**
|
|
760
|
+
* Called when a frame that said init has not said ready: 'redelivered' when the held credential is
|
|
761
|
+
* sent once more, 'ready' when the failure message is shown instead.
|
|
762
|
+
*/
|
|
763
|
+
onStall: w.func,
|
|
714
764
|
/**
|
|
715
765
|
* Optional host-styled renderer for the structurally-unsupported embed
|
|
716
766
|
* state (legacy app on a cross-site origin), `(entry) => ReactNode`. Falls
|
|
717
767
|
* back to a minimal built-in placeholder.
|
|
718
768
|
*/
|
|
719
|
-
renderUnsupported:
|
|
769
|
+
renderUnsupported: w.func,
|
|
720
770
|
/**
|
|
721
771
|
* Optional host-styled renderer for the handshake-timeout failure state
|
|
722
772
|
* (the app is not embeddable / could not load), `() => ReactNode`. Falls
|
|
723
773
|
* back to a minimal centered message.
|
|
724
774
|
*/
|
|
725
|
-
renderTimeout:
|
|
775
|
+
renderTimeout: w.func
|
|
726
776
|
};
|
|
727
777
|
export {
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
778
|
+
Ce as CREDENTIAL_KIND_ACCESS_TOKEN,
|
|
779
|
+
ue as EmbeddedAuthorizationContext,
|
|
780
|
+
Je as MMEmbeddableZone,
|
|
781
|
+
ae as MMEmbeddableZoneContext,
|
|
782
|
+
Pe as MMEmbeddableZoneProvider,
|
|
783
|
+
ke as isCrossSite,
|
|
784
|
+
Ee as normalizeCredential,
|
|
785
|
+
Oe as popupAuthorizationLauncher,
|
|
786
|
+
Ye as unsupportedCopy,
|
|
787
|
+
$e as useEmbeddedAuthorizations,
|
|
788
|
+
Fe as useEmbeddedCredential,
|
|
789
|
+
se as useEmbeddedEffect,
|
|
790
|
+
ze as useEmbeddedOriginEpoch,
|
|
791
|
+
De as useEmbeddedUnsupported
|
|
742
792
|
};
|