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