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