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