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