@pelican-identity/react 2.0.34 → 2.0.35
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/components/PelicanAuth.d.ts.map +1 -0
- package/dist/components/PelicanAuth.js +456 -0
- package/dist/components/PelicanAuth.js.map +1 -0
- package/dist/components/PelicanButton.d.ts.map +1 -0
- package/dist/components/StoreIcons.js +1 -1
- package/dist/components/StoreIcons.js.map +1 -1
- package/dist/hooks/usePelicanAuth.d.ts +16 -0
- package/dist/hooks/usePelicanAuth.d.ts.map +1 -0
- package/dist/hooks/usePelicanAuth.js +64 -0
- package/dist/hooks/usePelicanAuth.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PelicanAuth.d.ts","sourceRoot":"","sources":["../../src/components/PelicanAuth.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,QAAA,MAAM,WAAW,GAAI,QAAQ,mBAAmB,4CAmoB/C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import PelicanButton from "./PelicanButton";
|
|
4
|
+
import { usePelicanAuth } from "../hooks/usePelicanAuth";
|
|
5
|
+
import StoreIcons from "./StoreIcons";
|
|
6
|
+
const PelicanAuth = (config) => {
|
|
7
|
+
const { start, qr, state, deeplink, isProcessing, stop, error, successMessage, useQrInstead, useWebAuth, } = usePelicanAuth({
|
|
8
|
+
projectId: config.projectId,
|
|
9
|
+
publicKey: config.publicKey,
|
|
10
|
+
authType: config.authType,
|
|
11
|
+
onClose: config.onClose,
|
|
12
|
+
continuousMode: config.continuousMode,
|
|
13
|
+
forceQRCode: config.forceQRCode,
|
|
14
|
+
onSuccess: (identity) => {
|
|
15
|
+
config.onSuccess(identity);
|
|
16
|
+
},
|
|
17
|
+
onError: (error) => {
|
|
18
|
+
config.onError?.(error);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (config.continuousMode) {
|
|
23
|
+
start();
|
|
24
|
+
}
|
|
25
|
+
}, [config.continuousMode]);
|
|
26
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `@keyframes fadeUp {
|
|
27
|
+
from {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
transform: translateY(20px);
|
|
30
|
+
}
|
|
31
|
+
to {
|
|
32
|
+
opacity: 1;
|
|
33
|
+
transform: translateY(0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes spin {
|
|
38
|
+
to {
|
|
39
|
+
transform: rotate(360deg);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@keyframes successPulse {
|
|
44
|
+
0%,
|
|
45
|
+
100% {
|
|
46
|
+
transform: scale(1);
|
|
47
|
+
opacity: 1;
|
|
48
|
+
}
|
|
49
|
+
50% {
|
|
50
|
+
transform: scale(1.05);
|
|
51
|
+
opacity: 0.9;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.auth-container {
|
|
56
|
+
width: 300px;
|
|
57
|
+
max-width: fit-content;
|
|
58
|
+
padding: 1rem;
|
|
59
|
+
margin-top: 0.3rem;
|
|
60
|
+
position: relative;
|
|
61
|
+
animation: fadeUp 0.5s ease-out;
|
|
62
|
+
background-color: #f9fafb;
|
|
63
|
+
border-radius: 2.5rem;
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 1rem;
|
|
69
|
+
min-height: 320px;
|
|
70
|
+
}
|
|
71
|
+
.js-auth-container {
|
|
72
|
+
width: 300px;
|
|
73
|
+
max-width: fit-content;
|
|
74
|
+
padding: 1rem;
|
|
75
|
+
margin-top: 0.3rem;
|
|
76
|
+
position: relative;
|
|
77
|
+
background-color: #f9fafb;
|
|
78
|
+
border-radius: 2.5rem;
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
justify-content: space-between;
|
|
82
|
+
align-items: center;
|
|
83
|
+
gap: 1rem;
|
|
84
|
+
min-height: 320px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.pelican-modal-close-btn {
|
|
88
|
+
all: unset; /* Reset all inherited styles */
|
|
89
|
+
background-color: #2b2b2b !important;
|
|
90
|
+
border: none !important;
|
|
91
|
+
padding: 0.3rem !important;
|
|
92
|
+
cursor: pointer !important;
|
|
93
|
+
transition: opacity 0.2s !important;
|
|
94
|
+
height: 1.5rem !important;
|
|
95
|
+
width: 1.5rem !important;
|
|
96
|
+
display: flex !important;
|
|
97
|
+
align-items: center !important;
|
|
98
|
+
justify-content: center !important;
|
|
99
|
+
border-radius: 50% !important;
|
|
100
|
+
box-sizing: border-box !important;
|
|
101
|
+
margin: 0 1rem !important;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.pelican-modal-close-btn:hover {
|
|
105
|
+
opacity: 0.6 !important;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.pelican-modal-close-btn svg {
|
|
109
|
+
display: block !important;
|
|
110
|
+
width: 100% !important;
|
|
111
|
+
height: 100% !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.retry-container {
|
|
115
|
+
text-align: center;
|
|
116
|
+
padding: 3rem 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.retry-container > div:first-child {
|
|
120
|
+
margin-bottom: 1rem;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.retry-text {
|
|
124
|
+
font-size: 1.125rem;
|
|
125
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.content-wrapper {
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 2rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.unpaired-container {
|
|
137
|
+
text-align: center;
|
|
138
|
+
display: flex;
|
|
139
|
+
flex-direction: column;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.main-heading {
|
|
143
|
+
font-size: 0.75rem;
|
|
144
|
+
font-weight: 600;
|
|
145
|
+
color: #585858;
|
|
146
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (min-width: 768px) {
|
|
150
|
+
.main-heading {
|
|
151
|
+
font-size: 0.8rem;
|
|
152
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@media (min-width: 1024px) {
|
|
157
|
+
.main-heading {
|
|
158
|
+
font-size: 0.8rem;
|
|
159
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.mobile-auth-container {
|
|
164
|
+
display: flex;
|
|
165
|
+
flex-direction: column;
|
|
166
|
+
gap: 0.7rem;
|
|
167
|
+
width: 253px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.logo-container {
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
padding: 2rem 0;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.open-app-link {
|
|
177
|
+
display: inline-block;
|
|
178
|
+
padding: 0.7rem 1.25rem;
|
|
179
|
+
background-color: #101010ff;
|
|
180
|
+
width: fit-content;
|
|
181
|
+
align-self: center;
|
|
182
|
+
|
|
183
|
+
border-radius: 28px;
|
|
184
|
+
color: #fff;
|
|
185
|
+
font-weight: 500;
|
|
186
|
+
font-size: 1rem;
|
|
187
|
+
text-decoration: none;
|
|
188
|
+
transition: background-color 0.2s;
|
|
189
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.open-app-link:hover {
|
|
193
|
+
opacity: 0.8;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.helper-text {
|
|
197
|
+
font-size: 0.75rem;
|
|
198
|
+
color: #6b7280;
|
|
199
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.qr-container {
|
|
203
|
+
display: flex;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.qr-wrapper {
|
|
208
|
+
display: flex;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
align-items: center;
|
|
211
|
+
overflow: hidden;
|
|
212
|
+
border-radius: 2rem;
|
|
213
|
+
background-color: #fff;
|
|
214
|
+
padding: 0.2rem;
|
|
215
|
+
height: 244px;
|
|
216
|
+
width: 244px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.qr-image {
|
|
220
|
+
height: 90%;
|
|
221
|
+
width: 90%;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.loader-container {
|
|
225
|
+
display: flex;
|
|
226
|
+
justify-content: center;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.instruction-text {
|
|
230
|
+
font-size: 0.875rem;
|
|
231
|
+
color: #9ca3af;
|
|
232
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.paired-container {
|
|
236
|
+
text-align: center;
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: 1rem;
|
|
240
|
+
max-width: 250px;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.web-auth-btn {
|
|
244
|
+
all: unset; /* Reset all inherited styles */
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
margin-top: 1rem;
|
|
247
|
+
display: inline-block;
|
|
248
|
+
padding: 0.7rem 1.25rem;
|
|
249
|
+
background-color: #101010ff;
|
|
250
|
+
width: fit-content;
|
|
251
|
+
align-self: center;
|
|
252
|
+
|
|
253
|
+
border-radius: 28px;
|
|
254
|
+
color: #fff;
|
|
255
|
+
font-weight: 500;
|
|
256
|
+
font-size: 0.8rem;
|
|
257
|
+
text-decoration: none;
|
|
258
|
+
transition: background-color 0.2s;
|
|
259
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.web-auth-btn:hover {
|
|
263
|
+
opacity: 0.9;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.paired-heading {
|
|
267
|
+
font-size: 1rem;
|
|
268
|
+
font-weight: 800;
|
|
269
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
@media (min-width: 768px) {
|
|
273
|
+
.paired-heading {
|
|
274
|
+
font-size: 1rem;
|
|
275
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.success-message {
|
|
280
|
+
background-color: #121212;
|
|
281
|
+
color: #d9eb1b;
|
|
282
|
+
padding: 0.5rem 1rem;
|
|
283
|
+
border-radius: 1.3rem;
|
|
284
|
+
font-weight: 700;
|
|
285
|
+
font-size: 1rem;
|
|
286
|
+
animation: successPulse 0.2s ease-in-out;
|
|
287
|
+
margin: 0.5rem 0;
|
|
288
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
289
|
+
width: 300px;
|
|
290
|
+
max-width: fit-content;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.auto-renew-badge {
|
|
294
|
+
display: inline-block;
|
|
295
|
+
background-color: rgba(217, 235, 27, 0.2);
|
|
296
|
+
border: 1px solid #d9eb1b;
|
|
297
|
+
color: #d9eb1b;
|
|
298
|
+
padding: 0.25rem 0.75rem;
|
|
299
|
+
border-radius: 9999px;
|
|
300
|
+
font-size: 0.75rem;
|
|
301
|
+
font-weight: 600;
|
|
302
|
+
margin-top: 0.5rem;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.scan-btn {
|
|
306
|
+
all: unset;
|
|
307
|
+
font-size: 0.8rem;
|
|
308
|
+
color: #626262ff;
|
|
309
|
+
font-weight: 600;
|
|
310
|
+
cursor: pointer;
|
|
311
|
+
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
312
|
+
}
|
|
313
|
+
.error-wrapper {
|
|
314
|
+
display: flex;
|
|
315
|
+
justify-content: center;
|
|
316
|
+
align-items: center;
|
|
317
|
+
text-align: center;
|
|
318
|
+
border-radius: 1.5rem;
|
|
319
|
+
border: 1px solid rgb(255, 236, 236);
|
|
320
|
+
background-color: rgb(255, 255, 255);
|
|
321
|
+
width: 250px;
|
|
322
|
+
height: 80px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.error-message {
|
|
326
|
+
font-size: 0.75rem;
|
|
327
|
+
font-weight: 400;
|
|
328
|
+
color: rgb(255, 139, 139);
|
|
329
|
+
font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
330
|
+
max-width: 70%;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.loader {
|
|
334
|
+
width: 48px;
|
|
335
|
+
height: 48px;
|
|
336
|
+
position: relative;
|
|
337
|
+
}
|
|
338
|
+
.loader::before,
|
|
339
|
+
.loader::after {
|
|
340
|
+
content: "";
|
|
341
|
+
position: absolute;
|
|
342
|
+
left: 50%;
|
|
343
|
+
top: 50%;
|
|
344
|
+
transform: translate(-50%, -50%);
|
|
345
|
+
width: 48em;
|
|
346
|
+
height: 48em;
|
|
347
|
+
background-image: radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
348
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
349
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
350
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
351
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
352
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
353
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
354
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0),
|
|
355
|
+
radial-gradient(circle 10px, #585858 100%, transparent 0);
|
|
356
|
+
background-position: 0em -18em, 0em 18em, 18em 0em, -18em 0em, 13em -13em,
|
|
357
|
+
-13em -13em, 13em 13em, -13em 13em;
|
|
358
|
+
background-repeat: no-repeat;
|
|
359
|
+
font-size: 0.5px;
|
|
360
|
+
border-radius: 50%;
|
|
361
|
+
animation: blast 1s ease-in infinite;
|
|
362
|
+
}
|
|
363
|
+
.loader::after {
|
|
364
|
+
font-size: 1px;
|
|
365
|
+
background: #585858;
|
|
366
|
+
animation: bounce 1s ease-in infinite;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
@keyframes bounce {
|
|
370
|
+
0%,
|
|
371
|
+
100% {
|
|
372
|
+
font-size: 0.75px;
|
|
373
|
+
}
|
|
374
|
+
50% {
|
|
375
|
+
font-size: 1.5px;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
@keyframes blast {
|
|
379
|
+
0%,
|
|
380
|
+
40% {
|
|
381
|
+
font-size: 0.5px;
|
|
382
|
+
}
|
|
383
|
+
70% {
|
|
384
|
+
opacity: 1;
|
|
385
|
+
font-size: 4px;
|
|
386
|
+
}
|
|
387
|
+
100% {
|
|
388
|
+
font-size: 6px;
|
|
389
|
+
opacity: 0;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
` }), _jsxs("section", { children: [_jsx("div", { style: {
|
|
393
|
+
width: "100%",
|
|
394
|
+
justifyContent: "space-between",
|
|
395
|
+
alignItems: "center",
|
|
396
|
+
maxWidth: "520px",
|
|
397
|
+
}, children: !config.continuousMode && (_jsxs("div", { style: {
|
|
398
|
+
width: "100%",
|
|
399
|
+
display: "flex",
|
|
400
|
+
justifyContent: "space-between",
|
|
401
|
+
alignItems: "center",
|
|
402
|
+
}, children: [_jsx("button", { type: "button", style: {
|
|
403
|
+
border: "none",
|
|
404
|
+
background: "transparent",
|
|
405
|
+
cursor: "pointer",
|
|
406
|
+
}, onClick: () => {
|
|
407
|
+
start();
|
|
408
|
+
}, disabled: config.continuousMode, children: config.buttonComponent ? (config.buttonComponent) : (_jsx(PelicanButton, { authType: config.authType, text: config.buttonText })) }), state !== "idle" && (_jsx("button", { onClick: () => {
|
|
409
|
+
stop();
|
|
410
|
+
config.onClose?.();
|
|
411
|
+
}, className: "pelican-modal-close-btn", "aria-label": "Close", type: "button", style: {
|
|
412
|
+
border: "none !important",
|
|
413
|
+
padding: "0.3rem !important",
|
|
414
|
+
cursor: "pointer !important",
|
|
415
|
+
}, children: _jsx("svg", { fill: "#fff", stroke: "#fff", viewBox: "0 0 24 24", role: "img", "aria-label": "close icon", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 3, d: "M6 18L18 6M6 6l12 12", height: "24", width: "24", fill: "#fff", stroke: "#fff", color: "#fff" }) }) }))] })) }), _jsx("div", { style: {
|
|
416
|
+
width: "100%",
|
|
417
|
+
display: "flex",
|
|
418
|
+
justifyContent: "center",
|
|
419
|
+
alignItems: "center",
|
|
420
|
+
maxWidth: "520px",
|
|
421
|
+
}, children: state !== "idle" && (_jsxs("div", { className: "auth-container", children: [successMessage && (_jsxs("div", { className: "success-message", style: { textAlign: "center" }, children: [successMessage, config.continuousMode && (_jsx("p", { style: {
|
|
422
|
+
fontSize: "0.8rem",
|
|
423
|
+
marginTop: "0.5rem",
|
|
424
|
+
color: "#f3f3f3",
|
|
425
|
+
textAlign: "center",
|
|
426
|
+
}, children: "Preparing next session..." }))] })), error && state === "error" && (_jsx("div", { className: "error-wrapper", children: _jsx("p", { className: "error-message", children: error.message }) })), isProcessing ? (_jsxs("div", { className: "content-wrapper", children: [_jsx("h2", { className: "main-heading", children: "one sec..." }), _jsx("span", { className: "loader", style: { margin: "1rem auto", width: "252px" } })] })) : (_jsx("div", { className: "content-wrapper", children: state === "awaiting-pair" && !successMessage && (_jsxs("div", { className: "unpaired-container", children: [!deeplink && !config.forceQRCode && (_jsxs("h2", { className: "main-heading", children: [" ", "Open Pelican Vault mobile app"] })), !config.forceQRCode && deeplink ? (_jsxs("div", { className: "mobile-auth-container", children: [_jsx("div", { className: "logo-container", children: _jsx("img", { src: "https://res.cloudinary.com/de0jr8mcm/image/upload/v1765904735/pelican/pelican_icon_r9ghqw.png ", alt: "Pelican Logo", style: { width: "54px", height: "54px" } }) }), _jsx("a", { href: deeplink, className: "open-app-link", children: "Open Pelican Vault" }), _jsxs("p", { className: "helper-text", children: ["Open the app to", " ", config.authType === "login"
|
|
427
|
+
? "login"
|
|
428
|
+
: config.authType === "signup"
|
|
429
|
+
? "signup"
|
|
430
|
+
: config.authType === "id-verification"
|
|
431
|
+
? "verify identity"
|
|
432
|
+
: "authenticate"] }), _jsxs("div", { style: {
|
|
433
|
+
display: "flex",
|
|
434
|
+
alignItems: "center",
|
|
435
|
+
gap: "0.5rem",
|
|
436
|
+
}, children: [_jsx("div", { style: {
|
|
437
|
+
width: "100%",
|
|
438
|
+
height: "1px",
|
|
439
|
+
backgroundColor: "#e2e2e2ff",
|
|
440
|
+
} }), _jsx("p", { style: {
|
|
441
|
+
fontSize: "0.8rem",
|
|
442
|
+
fontFamily: "system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
443
|
+
color: "#a8a8a8ff",
|
|
444
|
+
}, children: "Or" }), _jsx("div", { style: {
|
|
445
|
+
width: "100%",
|
|
446
|
+
height: "1px",
|
|
447
|
+
backgroundColor: "#e2e2e2ff",
|
|
448
|
+
} })] }), _jsx("button", { type: "button", className: "scan-btn", onClick: useQrInstead, children: "Use QR Code" })] })) : (config.forceQRCode &&
|
|
449
|
+
qr &&
|
|
450
|
+
state === "awaiting-pair") ||
|
|
451
|
+
(!config.forceQRCode &&
|
|
452
|
+
qr &&
|
|
453
|
+
state === "awaiting-pair") ? (_jsx("div", { className: "qr-container", children: _jsxs("div", { className: "qr-wrapper", children: [qr && (_jsx("img", { src: qr, alt: "QR Code", className: "qr-image" })), !qr && _jsx("span", { className: "loader" })] }) })) : (_jsx("div", { className: "loader-container", children: _jsx("span", { className: "loader" }) })), state === "awaiting-pair" && (_jsx("button", { type: "button", className: "web-auth-btn", onClick: useWebAuth, children: "Use browser vault instead" }))] })) })), _jsx(StoreIcons, {})] })) })] })] }));
|
|
454
|
+
};
|
|
455
|
+
export default PelicanAuth;
|
|
456
|
+
//# sourceMappingURL=PelicanAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PelicanAuth.js","sourceRoot":"","sources":["../../src/components/PelicanAuth.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC,MAAM,WAAW,GAAG,CAAC,MAA2B,EAAE,EAAE;IAClD,MAAM,EACJ,KAAK,EACL,EAAE,EACF,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,cAAc,EACd,YAAY,EACZ,UAAU,GACX,GAAG,cAAc,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,Q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C3B,eAAK,SAAS,EAAC,YAAY,aACxB,EAAE,IAAI,CACL,cACE,GAAG,EAAE,EAAE,EACP,GAAG,EAAC,SAAS,EACb,SAAS,EAAC,UAAU,GACpB,CACH,EACA,CAAC,EAAE,IAAI,eAAM,SAAS,EAAC,QAAQ,GAAQ,IACpC,GACF,CACP,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,kBAAkB,YAC/B,eAAM,SAAS,EAAC,QAAQ,GAAQ,GAC5B,CACP,EAEA,KAAK,KAAK,eAAe,IAAI,CAC5B,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,cAAc,EACxB,OAAO,EAAE,UAAU,0CAGZ,CACV,IACG,CACP,GACG,CACP,EACD,KAAC,UAAU,KAAG,IACV,CACP,GACG,IACE,IACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PelicanButton.d.ts","sourceRoot":"","sources":["../../src/components/PelicanButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,QAAA,MAAM,aAAa,GAAI,qBAGpB;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,4CA+EA,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -17,7 +17,7 @@ const StoreIcons = () => {
|
|
|
17
17
|
fontWeight: "500",
|
|
18
18
|
color: "#585858",
|
|
19
19
|
fontFamily: "Onest, system-ui, Avenir, Helvetica, Arial, sans-serif",
|
|
20
|
-
}, children: "Get
|
|
20
|
+
}, children: "Get vault mobile app \u2192" }) }), _jsx("a", { href: "https://apps.apple.com/us/app/pelican-vault/id6755097751", target: "_blank", rel: "noopener noreferrer", children: _jsx("div", { style: {
|
|
21
21
|
display: "flex",
|
|
22
22
|
alignItems: "center",
|
|
23
23
|
justifyContent: "center",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoreIcons.js","sourceRoot":"","sources":["../../src/components/StoreIcons.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,OAAO,CACL,cACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;SACrB,YAED,eACE,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,cAAc,EAAE,QAAQ;gBACxB,UAAU,EAAE,QAAQ;gBAEpB,YAAY,EAAE,QAAQ;gBACtB,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,aAAa;gBACtB,MAAM,EAAE,QAAQ;aACjB,aAED,wBACE,YACE,KAAK,EAAE;4BACL,QAAQ,EAAE,MAAM;4BAChB,UAAU,EAAE,KAAK;4BACjB,KAAK,EAAE,SAAS;4BAChB,UAAU,EACR,wDAAwD;yBAC3D,
|
|
1
|
+
{"version":3,"file":"StoreIcons.js","sourceRoot":"","sources":["../../src/components/StoreIcons.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,GAAG,GAAG,EAAE;IACtB,OAAO,CACL,cACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;SACrB,YAED,eACE,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,cAAc,EAAE,QAAQ;gBACxB,UAAU,EAAE,QAAQ;gBAEpB,YAAY,EAAE,QAAQ;gBACtB,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,aAAa;gBACtB,MAAM,EAAE,QAAQ;aACjB,aAED,wBACE,YACE,KAAK,EAAE;4BACL,QAAQ,EAAE,MAAM;4BAChB,UAAU,EAAE,KAAK;4BACjB,KAAK,EAAE,SAAS;4BAChB,UAAU,EACR,wDAAwD;yBAC3D,4CAGC,GACA,EACN,YACE,IAAI,EAAC,0DAA0D,EAC/D,MAAM,E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,KAAG,GACT,GACJ,IACA,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,GAAG,EAAE;IACjB,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,KAAK,gBACC,YAAY,aAEvB,YAAG,QAAQ,EAAC,wBAAwB,YAClC,eACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,4uBAA4uB,EAC9uB,IAAI,EAAC,SAAS,GACd,GACA,EACJ,yBACE,mBAAU,EAAE,EAAC,kBAAkB,YAC7B,eAAM,KAAK,EAAC,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,IAAI,EAAC,SAAS,GAAG,GAC/C,GACN,IACH,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,KAAK,gBACC,WAAW,YAEtB,eACE,CAAC,EAAC,01BAA01B,EAC51B,IAAI,EAAC,SAAS,GACd,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PelicanAuthState, PelicanWebAuthProps } from "@pelican-identity/auth-core";
|
|
2
|
+
export declare const usePelicanAuth: (config: PelicanWebAuthProps) => {
|
|
3
|
+
start: () => void;
|
|
4
|
+
stop: () => void;
|
|
5
|
+
qr: string | null;
|
|
6
|
+
deeplink: string | null;
|
|
7
|
+
state: PelicanAuthState;
|
|
8
|
+
isProcessing: boolean;
|
|
9
|
+
isDone: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
successMessage: string | null;
|
|
12
|
+
useQrInstead: () => void | undefined;
|
|
13
|
+
useDeepLinkInstead: () => void | undefined;
|
|
14
|
+
useWebAuth: () => void | undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=usePelicanAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePelicanAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/usePelicanAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,6BAA6B,CAAC;AAGrC,eAAO,MAAM,cAAc,GAAI,QAAQ,mBAAmB;;;;;;;;;;;;;CAmEzD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { PelicanAuthentication, } from "@pelican-identity/auth-core";
|
|
2
|
+
import { useState, useRef, useEffect, useCallback } from "react";
|
|
3
|
+
export const usePelicanAuth = (config) => {
|
|
4
|
+
const [qr, setQr] = useState(null);
|
|
5
|
+
const [deeplink, setDeeplink] = useState(null);
|
|
6
|
+
const [err, seterr] = useState(null);
|
|
7
|
+
const [state, setState] = useState("idle");
|
|
8
|
+
const [successMessage, setSuccessMessage] = useState(null);
|
|
9
|
+
const pelicanRef = useRef(null);
|
|
10
|
+
const success = config.authType === "login"
|
|
11
|
+
? "login"
|
|
12
|
+
: config.authType === "signup"
|
|
13
|
+
? "signup"
|
|
14
|
+
: config.authType === "id-verification"
|
|
15
|
+
? "verification"
|
|
16
|
+
: "authentication";
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const pelican = new PelicanAuthentication(config);
|
|
19
|
+
pelicanRef.current = pelican;
|
|
20
|
+
const unsub = [
|
|
21
|
+
pelican.on("qr", setQr),
|
|
22
|
+
pelican.on("deeplink", setDeeplink),
|
|
23
|
+
pelican.on("success", (identity) => {
|
|
24
|
+
config.onSuccess(identity);
|
|
25
|
+
if (config.continuousMode) {
|
|
26
|
+
setSuccessMessage(`${success} complete!`);
|
|
27
|
+
setTimeout(() => {
|
|
28
|
+
setSuccessMessage(null);
|
|
29
|
+
}, 2000);
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
pelican.on("error", (error) => {
|
|
33
|
+
seterr(error);
|
|
34
|
+
config.onError?.(error);
|
|
35
|
+
}),
|
|
36
|
+
pelican.on("state", setState),
|
|
37
|
+
];
|
|
38
|
+
return () => {
|
|
39
|
+
unsub.forEach((fn) => fn());
|
|
40
|
+
pelican.destroy();
|
|
41
|
+
};
|
|
42
|
+
}, [config.publicKey, config.projectId, config.authType]);
|
|
43
|
+
const start = useCallback(() => {
|
|
44
|
+
pelicanRef.current?.start();
|
|
45
|
+
}, []);
|
|
46
|
+
const stop = useCallback(() => {
|
|
47
|
+
pelicanRef.current?.stop();
|
|
48
|
+
}, []);
|
|
49
|
+
return {
|
|
50
|
+
start,
|
|
51
|
+
stop,
|
|
52
|
+
qr,
|
|
53
|
+
deeplink,
|
|
54
|
+
state,
|
|
55
|
+
isProcessing: ["initializing", "paired", "awaiting-auth"].includes(state),
|
|
56
|
+
isDone: state === "confirmed" || state === "authenticated",
|
|
57
|
+
error: err,
|
|
58
|
+
successMessage,
|
|
59
|
+
useQrInstead: () => pelicanRef.current?.useQrInstead(),
|
|
60
|
+
useDeepLinkInstead: () => pelicanRef.current?.useDeepLinkInstead(),
|
|
61
|
+
useWebAuth: () => pelicanRef.current?.openWebAuth(),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=usePelicanAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePelicanAuth.js","sourceRoot":"","sources":["../../src/hooks/usePelicanAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEjE,MAAM,CAAC,M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