@rift-finance/react 0.1.2 → 0.2.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/README.md +87 -10
- package/dist/RiftAuth.d.ts +55 -0
- package/dist/RiftAuth.d.ts.map +1 -0
- package/dist/RiftProvider.d.ts +34 -0
- package/dist/RiftProvider.d.ts.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/rift-react.cjs +1 -1
- package/dist/rift-react.cjs.map +1 -1
- package/dist/rift-react.js +208 -186
- package/dist/rift-react.js.map +1 -1
- package/dist/silentRefresh.d.ts +29 -0
- package/dist/silentRefresh.d.ts.map +1 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useRift.d.ts +35 -0
- package/dist/useRift.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/rift-react.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as re, useMemo as
|
|
3
|
-
let
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { jsx as P, jsxs as te } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as re, useMemo as j, useState as w, useRef as G, useCallback as E, useEffect as y, useContext as ne } from "react";
|
|
3
|
+
let d = null, C = !1, M = [], T = null;
|
|
4
|
+
const u = /* @__PURE__ */ new Map();
|
|
5
|
+
function X() {
|
|
6
6
|
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 9)}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Q(e) {
|
|
9
9
|
if (typeof document > "u")
|
|
10
10
|
return Promise.reject(new Error("Cannot mount refresh iframe outside the browser"));
|
|
11
|
-
if (
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
const
|
|
11
|
+
if (d && C) return Promise.resolve();
|
|
12
|
+
if (T = new URL(e.widgetUrl).origin, !d) {
|
|
13
|
+
d = document.createElement("iframe"), d.setAttribute("aria-hidden", "true"), d.setAttribute("tabindex", "-1"), d.title = "Rift session refresh", d.style.cssText = "position:absolute;width:1px;height:1px;border:0;opacity:0;pointer-events:none;left:-9999px;top:-9999px;";
|
|
14
|
+
const i = new URLSearchParams({
|
|
15
15
|
key: e.apiKey,
|
|
16
16
|
headless: "1"
|
|
17
17
|
});
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
const t =
|
|
18
|
+
d.src = `${e.widgetUrl.replace(/\/$/, "")}/?${i.toString()}`, document.body.appendChild(d), window.addEventListener("message", (o) => {
|
|
19
|
+
if (o.origin !== T) return;
|
|
20
|
+
const t = o.data;
|
|
21
21
|
if (!(!t || typeof t != "object" || typeof t.type != "string") && t.type.startsWith("rift:")) {
|
|
22
22
|
if (t.type === "rift:ready") {
|
|
23
|
-
|
|
23
|
+
C = !0, M.forEach((n) => n()), M = [];
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (t.type === "rift:refresh-result") {
|
|
27
|
-
const n =
|
|
28
|
-
n && (
|
|
27
|
+
const n = u.get(t.requestId);
|
|
28
|
+
n && (u.delete(t.requestId), n.resolve({
|
|
29
29
|
accessToken: t.accessToken,
|
|
30
30
|
expiresAt: t.expiresAt,
|
|
31
31
|
expiresIn: t.expiresIn
|
|
@@ -33,62 +33,62 @@ function J(e) {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
if (t.type === "rift:refresh-error") {
|
|
36
|
-
const n =
|
|
37
|
-
n && (
|
|
36
|
+
const n = u.get(t.requestId);
|
|
37
|
+
n && (u.delete(t.requestId), n.reject(new Error(t.message || "Refresh failed")));
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
if (t.type === "rift:logout-result") {
|
|
41
|
-
const n =
|
|
42
|
-
n && (
|
|
41
|
+
const n = u.get(t.requestId);
|
|
42
|
+
n && (u.delete(t.requestId), n.resolve({ accessToken: "", expiresAt: "", expiresIn: 0 }));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
|
|
47
|
+
return C ? Promise.resolve() : new Promise((i) => {
|
|
48
|
+
M.push(i), setTimeout(() => {
|
|
49
|
+
if (!C) {
|
|
50
|
+
const o = M.shift();
|
|
51
|
+
o && o();
|
|
52
52
|
}
|
|
53
53
|
}, 8e3);
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
async function
|
|
57
|
-
if (await
|
|
56
|
+
async function J(e) {
|
|
57
|
+
if (await Q(e), !d?.contentWindow || !T)
|
|
58
58
|
throw new Error("Refresh iframe is not available");
|
|
59
|
-
const
|
|
60
|
-
return new Promise((
|
|
61
|
-
|
|
62
|
-
{ type: "rift:refresh-request", requestId:
|
|
63
|
-
|
|
59
|
+
const i = X();
|
|
60
|
+
return new Promise((o, t) => {
|
|
61
|
+
u.set(i, { resolve: o, reject: t }), d.contentWindow.postMessage(
|
|
62
|
+
{ type: "rift:refresh-request", requestId: i },
|
|
63
|
+
T
|
|
64
64
|
), setTimeout(() => {
|
|
65
|
-
const n =
|
|
66
|
-
n && (
|
|
65
|
+
const n = u.get(i);
|
|
66
|
+
n && (u.delete(i), n.reject(new Error("Refresh timed out")));
|
|
67
67
|
}, 1e4);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
async function se(e) {
|
|
71
71
|
try {
|
|
72
|
-
if (await
|
|
73
|
-
const
|
|
74
|
-
await new Promise((
|
|
75
|
-
|
|
76
|
-
resolve: () =>
|
|
77
|
-
reject: () =>
|
|
72
|
+
if (await Q(e), !d?.contentWindow || !T) return;
|
|
73
|
+
const i = X();
|
|
74
|
+
await new Promise((o) => {
|
|
75
|
+
u.set(i, {
|
|
76
|
+
resolve: () => o(),
|
|
77
|
+
reject: () => o()
|
|
78
78
|
// logout is idempotent — never reject
|
|
79
|
-
}),
|
|
80
|
-
{ type: "rift:logout-request", requestId:
|
|
81
|
-
|
|
79
|
+
}), d.contentWindow.postMessage(
|
|
80
|
+
{ type: "rift:logout-request", requestId: i },
|
|
81
|
+
T
|
|
82
82
|
), setTimeout(() => {
|
|
83
|
-
|
|
83
|
+
u.delete(i), o();
|
|
84
84
|
}, 5e3);
|
|
85
85
|
});
|
|
86
86
|
} catch {
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
const ie = "https://widget.riftfi.xyz",
|
|
90
|
-
function
|
|
91
|
-
const e = ne(
|
|
89
|
+
const ie = "https://widget.riftfi.xyz", $ = "rift:identity", oe = 60, V = re(null);
|
|
90
|
+
function Z() {
|
|
91
|
+
const e = ne(V);
|
|
92
92
|
if (!e)
|
|
93
93
|
throw new Error(
|
|
94
94
|
"[@rift/react] useRift() / <RiftAuth> must be used inside <RiftProvider>"
|
|
@@ -98,7 +98,7 @@ function Q() {
|
|
|
98
98
|
function ae() {
|
|
99
99
|
if (typeof window > "u") return null;
|
|
100
100
|
try {
|
|
101
|
-
const e = localStorage.getItem(
|
|
101
|
+
const e = localStorage.getItem($);
|
|
102
102
|
return e ? JSON.parse(e) : null;
|
|
103
103
|
} catch {
|
|
104
104
|
return null;
|
|
@@ -107,28 +107,28 @@ function ae() {
|
|
|
107
107
|
function ce(e) {
|
|
108
108
|
if (!(typeof window > "u"))
|
|
109
109
|
try {
|
|
110
|
-
e ? localStorage.setItem(
|
|
110
|
+
e ? localStorage.setItem($, JSON.stringify(e)) : localStorage.removeItem($);
|
|
111
111
|
} catch {
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function pe({
|
|
115
115
|
apiKey: e,
|
|
116
|
-
widgetUrl:
|
|
117
|
-
children:
|
|
116
|
+
widgetUrl: i,
|
|
117
|
+
children: o,
|
|
118
118
|
autoOpen: t = !1,
|
|
119
119
|
persist: n = !0
|
|
120
120
|
}) {
|
|
121
|
-
const
|
|
121
|
+
const a = i || ie, p = j(() => {
|
|
122
122
|
try {
|
|
123
|
-
return new URL(
|
|
123
|
+
return new URL(a).origin;
|
|
124
124
|
} catch {
|
|
125
|
-
return
|
|
125
|
+
return a;
|
|
126
126
|
}
|
|
127
|
-
}, [
|
|
128
|
-
|
|
129
|
-
const
|
|
127
|
+
}, [a]), [b, W] = w(null), [f, k] = w(!1), [A, q] = w("signin"), [x, I] = w(!1), [v, L] = w(null), [U, _] = w(540), [S, O] = w(0), R = G(null);
|
|
128
|
+
R.current = b;
|
|
129
|
+
const m = G(null), l = E(
|
|
130
130
|
(r) => {
|
|
131
|
-
|
|
131
|
+
W(r), n && ce(
|
|
132
132
|
r ? {
|
|
133
133
|
user: r.user,
|
|
134
134
|
address: r.address,
|
|
@@ -138,191 +138,211 @@ function fe({
|
|
|
138
138
|
},
|
|
139
139
|
[n]
|
|
140
140
|
);
|
|
141
|
-
|
|
141
|
+
y(() => {
|
|
142
142
|
if (!n) return;
|
|
143
143
|
const r = ae();
|
|
144
144
|
if (!r) return;
|
|
145
|
-
let
|
|
145
|
+
let c = !0;
|
|
146
146
|
return (async () => {
|
|
147
147
|
try {
|
|
148
|
-
const
|
|
148
|
+
const s = await J({
|
|
149
149
|
apiKey: e,
|
|
150
|
-
widgetUrl:
|
|
150
|
+
widgetUrl: a
|
|
151
151
|
});
|
|
152
|
-
if (!
|
|
153
|
-
|
|
152
|
+
if (!c) return;
|
|
153
|
+
l({
|
|
154
154
|
user: r.user,
|
|
155
155
|
address: r.address,
|
|
156
156
|
btcAddress: r.btcAddress,
|
|
157
|
-
accessToken:
|
|
158
|
-
expiresAt:
|
|
157
|
+
accessToken: s.accessToken,
|
|
158
|
+
expiresAt: s.expiresAt
|
|
159
159
|
});
|
|
160
160
|
} catch {
|
|
161
|
-
if (!
|
|
162
|
-
|
|
161
|
+
if (!c) return;
|
|
162
|
+
l(null);
|
|
163
163
|
}
|
|
164
164
|
})(), () => {
|
|
165
|
-
|
|
165
|
+
c = !1;
|
|
166
166
|
};
|
|
167
167
|
}, []);
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
}, []),
|
|
171
|
-
|
|
172
|
-
}, []),
|
|
173
|
-
await se({ apiKey: e, widgetUrl:
|
|
174
|
-
}, [e,
|
|
175
|
-
const r =
|
|
168
|
+
const F = E((r) => {
|
|
169
|
+
q(r?.mode || "signin"), L(null), I(!1), O((c) => c + 1), k(!0);
|
|
170
|
+
}, []), D = E(() => {
|
|
171
|
+
k(!1), I(!1);
|
|
172
|
+
}, []), H = E(async () => {
|
|
173
|
+
await se({ apiKey: e, widgetUrl: a }), l(null);
|
|
174
|
+
}, [e, a, l]), B = E(async () => {
|
|
175
|
+
const r = R.current;
|
|
176
176
|
if (!r) throw new Error("Not signed in");
|
|
177
|
-
const
|
|
178
|
-
return !(!
|
|
177
|
+
const c = r.expiresAt ? new Date(r.expiresAt).getTime() : null, s = Date.now();
|
|
178
|
+
return !(!c || c - s < oe * 1e3) && r.accessToken ? r.accessToken : (m.current || (m.current = (async () => {
|
|
179
179
|
try {
|
|
180
|
-
const
|
|
180
|
+
const h = await J({
|
|
181
181
|
apiKey: e,
|
|
182
|
-
widgetUrl:
|
|
183
|
-
}),
|
|
184
|
-
if (!
|
|
182
|
+
widgetUrl: a
|
|
183
|
+
}), Y = R.current;
|
|
184
|
+
if (!Y) throw new Error("Signed out during refresh");
|
|
185
185
|
const ee = {
|
|
186
|
-
...
|
|
187
|
-
accessToken:
|
|
188
|
-
expiresAt:
|
|
186
|
+
...Y,
|
|
187
|
+
accessToken: h.accessToken,
|
|
188
|
+
expiresAt: h.expiresAt
|
|
189
189
|
};
|
|
190
|
-
return
|
|
191
|
-
} catch (
|
|
192
|
-
throw
|
|
190
|
+
return l(ee), h.accessToken;
|
|
191
|
+
} catch (h) {
|
|
192
|
+
throw l(null), h instanceof Error ? h : new Error(String(h));
|
|
193
193
|
} finally {
|
|
194
|
-
|
|
194
|
+
m.current = null;
|
|
195
195
|
}
|
|
196
|
-
})()),
|
|
197
|
-
}, [e,
|
|
198
|
-
|
|
196
|
+
})()), m.current);
|
|
197
|
+
}, [e, a, l]);
|
|
198
|
+
y(() => {
|
|
199
199
|
if (typeof window > "u") return;
|
|
200
|
-
const r = (
|
|
201
|
-
if (
|
|
202
|
-
const
|
|
203
|
-
if (!(!
|
|
204
|
-
switch (
|
|
200
|
+
const r = (c) => {
|
|
201
|
+
if (c.origin !== p) return;
|
|
202
|
+
const s = c.data;
|
|
203
|
+
if (!(!s || typeof s != "object" || typeof s.type != "string") && s.type.startsWith("rift:"))
|
|
204
|
+
switch (s.type) {
|
|
205
205
|
case "rift:ready":
|
|
206
|
-
|
|
206
|
+
f && I(!0);
|
|
207
207
|
break;
|
|
208
208
|
case "rift:close":
|
|
209
|
-
|
|
209
|
+
D();
|
|
210
210
|
break;
|
|
211
211
|
case "rift:resize":
|
|
212
|
-
|
|
212
|
+
_(Math.max(360, Math.min(820, s.height + 8)));
|
|
213
213
|
break;
|
|
214
214
|
case "rift:signin-success": {
|
|
215
|
-
const
|
|
216
|
-
user:
|
|
217
|
-
address:
|
|
218
|
-
btcAddress:
|
|
219
|
-
accessToken:
|
|
220
|
-
expiresAt:
|
|
215
|
+
const g = {
|
|
216
|
+
user: s.user,
|
|
217
|
+
address: s.address,
|
|
218
|
+
btcAddress: s.btcAddress,
|
|
219
|
+
accessToken: s.accessToken,
|
|
220
|
+
expiresAt: s.expiresAt
|
|
221
221
|
};
|
|
222
|
-
|
|
222
|
+
l(g), k(!1);
|
|
223
223
|
break;
|
|
224
224
|
}
|
|
225
225
|
case "rift:signin-error":
|
|
226
|
-
|
|
226
|
+
L(s.message);
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
return window.addEventListener("message", r), () => window.removeEventListener("message", r);
|
|
231
|
-
}, [
|
|
232
|
-
if (!(typeof document > "u") &&
|
|
231
|
+
}, [p, D, l, f]), y(() => {
|
|
232
|
+
if (!(typeof document > "u") && f) {
|
|
233
233
|
const r = document.documentElement.style.overflow;
|
|
234
234
|
return document.documentElement.style.overflow = "hidden", () => {
|
|
235
235
|
document.documentElement.style.overflow = r;
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
}, [
|
|
239
|
-
t && !
|
|
238
|
+
}, [f]), y(() => {
|
|
239
|
+
t && !b && F();
|
|
240
240
|
}, []);
|
|
241
|
-
const
|
|
241
|
+
const N = j(() => {
|
|
242
242
|
const r = new URLSearchParams({
|
|
243
243
|
key: e,
|
|
244
|
-
mode:
|
|
244
|
+
mode: A,
|
|
245
245
|
origin: typeof window < "u" ? window.location.origin : "",
|
|
246
|
-
t: String(
|
|
246
|
+
t: String(S)
|
|
247
247
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
if (typeof document < "u") {
|
|
249
|
+
const c = document.documentElement, s = c.getAttribute("data-theme");
|
|
250
|
+
let g = null;
|
|
251
|
+
s === "dark" || s === "light" ? g = s : (c.classList.contains("dark") || document.body?.classList.contains("dark") || window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) && (g = "dark"), g && r.set("theme", g);
|
|
252
|
+
}
|
|
253
|
+
return `${a.replace(/\/$/, "")}/?${r.toString()}`;
|
|
254
|
+
}, [e, A, S, a]), z = E(() => {
|
|
255
|
+
}, []), K = j(
|
|
251
256
|
() => ({
|
|
252
257
|
apiKey: e,
|
|
253
|
-
widgetUrl:
|
|
254
|
-
user:
|
|
255
|
-
isOpen:
|
|
256
|
-
isReady:
|
|
257
|
-
error:
|
|
258
|
-
open:
|
|
259
|
-
close:
|
|
260
|
-
signOut:
|
|
261
|
-
getAccessToken:
|
|
262
|
-
_iframeSrc:
|
|
263
|
-
_iframeHeight:
|
|
264
|
-
_onIframeLoad:
|
|
258
|
+
widgetUrl: a,
|
|
259
|
+
user: b,
|
|
260
|
+
isOpen: f,
|
|
261
|
+
isReady: x,
|
|
262
|
+
error: v,
|
|
263
|
+
open: F,
|
|
264
|
+
close: D,
|
|
265
|
+
signOut: H,
|
|
266
|
+
getAccessToken: B,
|
|
267
|
+
_iframeSrc: N,
|
|
268
|
+
_iframeHeight: U,
|
|
269
|
+
_onIframeLoad: z
|
|
265
270
|
}),
|
|
266
271
|
[
|
|
267
272
|
e,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
A,
|
|
275
|
-
M,
|
|
276
|
-
$,
|
|
273
|
+
a,
|
|
274
|
+
b,
|
|
275
|
+
f,
|
|
276
|
+
x,
|
|
277
|
+
v,
|
|
278
|
+
F,
|
|
277
279
|
D,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
+
H,
|
|
281
|
+
B,
|
|
282
|
+
N,
|
|
283
|
+
U,
|
|
284
|
+
z
|
|
280
285
|
]
|
|
281
286
|
);
|
|
282
|
-
return /* @__PURE__ */
|
|
287
|
+
return /* @__PURE__ */ P(V.Provider, { value: K, children: o });
|
|
283
288
|
}
|
|
284
|
-
|
|
289
|
+
const de = "rgba(15,15,20,0.55)", ue = 6, fe = 480, le = 18;
|
|
290
|
+
function he({
|
|
291
|
+
onSuccess: e,
|
|
292
|
+
onError: i,
|
|
293
|
+
onClose: o,
|
|
294
|
+
maxHeight: t,
|
|
295
|
+
maxWidth: n = fe,
|
|
296
|
+
radius: a = le,
|
|
297
|
+
backdrop: p,
|
|
298
|
+
backdropStyle: b,
|
|
299
|
+
iframeStyle: W
|
|
300
|
+
}) {
|
|
285
301
|
const {
|
|
286
|
-
isOpen:
|
|
287
|
-
isReady:
|
|
288
|
-
error:
|
|
289
|
-
close:
|
|
290
|
-
user:
|
|
291
|
-
_iframeSrc:
|
|
292
|
-
_iframeHeight:
|
|
293
|
-
_onIframeLoad:
|
|
294
|
-
} =
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}, [
|
|
298
|
-
|
|
299
|
-
}, [
|
|
300
|
-
!
|
|
301
|
-
}, [
|
|
302
|
+
isOpen: f,
|
|
303
|
+
isReady: k,
|
|
304
|
+
error: A,
|
|
305
|
+
close: q,
|
|
306
|
+
user: x,
|
|
307
|
+
_iframeSrc: I,
|
|
308
|
+
_iframeHeight: v,
|
|
309
|
+
_onIframeLoad: L
|
|
310
|
+
} = Z();
|
|
311
|
+
if (y(() => {
|
|
312
|
+
x && e && e(x);
|
|
313
|
+
}, [x, e]), y(() => {
|
|
314
|
+
A && i && i(A);
|
|
315
|
+
}, [A, i]), y(() => {
|
|
316
|
+
!f && o && o();
|
|
317
|
+
}, [f]), !f) return null;
|
|
318
|
+
const U = p?.color ?? de, _ = p?.blur ?? ue, S = _ > 0 ? `blur(${_}px)` : void 0;
|
|
319
|
+
let O = v, R;
|
|
320
|
+
return typeof t == "number" ? O = Math.min(v, t) : typeof t == "string" && (R = t), /* @__PURE__ */ te(
|
|
302
321
|
"div",
|
|
303
322
|
{
|
|
304
323
|
role: "dialog",
|
|
305
324
|
"aria-modal": "true",
|
|
306
325
|
"aria-label": "Sign in",
|
|
307
|
-
onClick: (
|
|
308
|
-
|
|
326
|
+
onClick: (m) => {
|
|
327
|
+
m.target === m.currentTarget && q();
|
|
309
328
|
},
|
|
310
329
|
style: {
|
|
311
330
|
position: "fixed",
|
|
312
331
|
inset: 0,
|
|
313
332
|
zIndex: 2147483646,
|
|
314
|
-
background:
|
|
315
|
-
backdropFilter:
|
|
316
|
-
WebkitBackdropFilter:
|
|
333
|
+
background: U,
|
|
334
|
+
backdropFilter: S,
|
|
335
|
+
WebkitBackdropFilter: S,
|
|
317
336
|
display: "flex",
|
|
318
337
|
alignItems: "center",
|
|
319
338
|
justifyContent: "center",
|
|
320
339
|
padding: 16,
|
|
321
|
-
animation: "rift-fade 180ms ease-out"
|
|
340
|
+
animation: "rift-fade 180ms ease-out",
|
|
341
|
+
...b
|
|
322
342
|
},
|
|
323
343
|
children: [
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
!
|
|
344
|
+
/* @__PURE__ */ P("style", { children: "@keyframes rift-fade { from { opacity: 0 } to { opacity: 1 } }" }),
|
|
345
|
+
!k && /* @__PURE__ */ P(
|
|
326
346
|
"div",
|
|
327
347
|
{
|
|
328
348
|
"aria-hidden": !0,
|
|
@@ -335,11 +355,11 @@ function le({ onSuccess: e, onError: s, onClose: i }) {
|
|
|
335
355
|
children: "Loading sign-in…"
|
|
336
356
|
}
|
|
337
357
|
),
|
|
338
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ P(
|
|
339
359
|
"iframe",
|
|
340
360
|
{
|
|
341
|
-
src:
|
|
342
|
-
onLoad:
|
|
361
|
+
src: I,
|
|
362
|
+
onLoad: L,
|
|
343
363
|
title: "Rift sign-in",
|
|
344
364
|
allow: "publickey-credentials-get; identity-credentials-get",
|
|
345
365
|
style: {
|
|
@@ -347,35 +367,37 @@ function le({ onSuccess: e, onError: s, onClose: i }) {
|
|
|
347
367
|
background: "transparent",
|
|
348
368
|
colorScheme: "light",
|
|
349
369
|
width: "100%",
|
|
350
|
-
maxWidth:
|
|
351
|
-
height:
|
|
352
|
-
|
|
370
|
+
maxWidth: n,
|
|
371
|
+
height: O,
|
|
372
|
+
maxHeight: R,
|
|
373
|
+
borderRadius: a,
|
|
353
374
|
boxShadow: "0 24px 60px -12px rgba(0,0,0,0.35)",
|
|
354
375
|
transition: "height 200ms ease",
|
|
355
|
-
opacity:
|
|
376
|
+
opacity: k ? 1 : 0,
|
|
377
|
+
...W
|
|
356
378
|
}
|
|
357
379
|
}
|
|
358
380
|
)
|
|
359
381
|
]
|
|
360
382
|
}
|
|
361
|
-
)
|
|
383
|
+
);
|
|
362
384
|
}
|
|
363
|
-
function
|
|
364
|
-
const { user: e, isOpen:
|
|
385
|
+
function we() {
|
|
386
|
+
const { user: e, isOpen: i, open: o, close: t, signOut: n, getAccessToken: a, error: p } = Z();
|
|
365
387
|
return {
|
|
366
388
|
user: e,
|
|
367
389
|
isAuthenticated: !!e,
|
|
368
|
-
isOpen:
|
|
369
|
-
open:
|
|
390
|
+
isOpen: i,
|
|
391
|
+
open: o,
|
|
370
392
|
close: t,
|
|
371
393
|
signOut: n,
|
|
372
|
-
getAccessToken:
|
|
373
|
-
error:
|
|
394
|
+
getAccessToken: a,
|
|
395
|
+
error: p
|
|
374
396
|
};
|
|
375
397
|
}
|
|
376
398
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
399
|
+
he as RiftAuth,
|
|
400
|
+
pe as RiftProvider,
|
|
401
|
+
we as useRift
|
|
380
402
|
};
|
|
381
403
|
//# sourceMappingURL=rift-react.js.map
|