@pelican-identity/react 2.0.45 → 2.0.47

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pelican-identity/react",
3
- "version": "2.0.45",
3
+ "version": "2.0.47",
4
4
  "description": "React components for Pelican Identity authentication",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -21,7 +21,7 @@
21
21
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
22
22
  },
23
23
  "dependencies": {
24
- "@pelican-identity/auth-core": "1.2.42"
24
+ "@pelican-identity/auth-core": "1.2.44"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "^19.0.4",
@@ -1,462 +0,0 @@
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, openDeepLink, } = 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
- border-radius: 10px;
62
- animation: fadeUp 0.5s ease-out;
63
- background-color: #f9fafb;
64
- display: flex;
65
- flex-direction: column;
66
- justify-content: space-between;
67
- align-items: center;
68
- gap: 1rem;
69
- min-height: 300px;
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: 300px;
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
- background-color: #ffffff;
169
- border-radius: 10px;
170
- padding: 0 0 1rem 0;
171
- }
172
-
173
- .logo-container {
174
- display: flex;
175
- justify-content: center;
176
- padding: 2rem 0;
177
- }
178
-
179
- .open-app-link {
180
- display: inline-block;
181
- padding: 0.7rem 1.25rem;
182
- background-color: #101010ff;
183
- width: 70%;
184
- align-self: center;
185
-
186
- border-radius: 18px;
187
- color: #fff;
188
- font-weight: 500;
189
- font-size: 0.8rem;
190
- text-decoration: none;
191
- transition: background-color 0.2s;
192
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
193
- }
194
-
195
- .open-app-link:hover {
196
- opacity: 0.8;
197
- }
198
-
199
- .helper-text {
200
- font-size: 0.75rem;
201
- color: #6b7280;
202
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
203
- }
204
-
205
- .qr-container {
206
- display: flex;
207
- justify-content: center;
208
- }
209
-
210
- .qr-wrapper {
211
- display: flex;
212
- justify-content: center;
213
- align-items: center;
214
- overflow: hidden;
215
- border-radius: 10px;
216
- background-color: #fff;
217
- padding: 0.2rem;
218
- height: 244px;
219
- width: 244px;
220
- }
221
-
222
- .qr-image {
223
- height: 90%;
224
- width: 90%;
225
- }
226
-
227
- .loader-container {
228
- display: flex;
229
- justify-content: center;
230
- }
231
-
232
- .instruction-text {
233
- font-size: 0.875rem;
234
- color: #9ca3af;
235
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
236
- }
237
-
238
- .paired-container {
239
- text-align: center;
240
- display: flex;
241
- flex-direction: column;
242
- gap: 1rem;
243
- max-width: 250px;
244
- }
245
-
246
- .web-auth-btn {
247
- all: unset; /* Reset all inherited styles */
248
- cursor: pointer;
249
- margin-top: 1rem;
250
- display: inline-block;
251
- padding: 0.7rem 2rem;
252
- background-color: #ffffff;
253
- width: fit-content;
254
- align-self: center;
255
- border: 1px solid #e2e2e2ff;
256
- border-radius: 28px;
257
- color: #101010ff;
258
- font-weight: 500;
259
- font-size: 0.7rem;
260
- text-decoration: none;
261
- transition: background-color 0.2s;
262
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
263
- }
264
-
265
- .web-auth-btn:hover {
266
- opacity: 0.9;
267
- }
268
-
269
- .paired-heading {
270
- font-size: 1rem;
271
- font-weight: 800;
272
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
273
- }
274
-
275
- @media (min-width: 768px) {
276
- .paired-heading {
277
- font-size: 1rem;
278
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
279
- }
280
- }
281
-
282
- .success-message {
283
- background-color: #121212;
284
- color: #d9eb1b;
285
- padding: 0.5rem 1rem;
286
- border-radius: 1.3rem;
287
- font-weight: 700;
288
- font-size: 1rem;
289
- animation: successPulse 0.2s ease-in-out;
290
- margin: 0.5rem 0;
291
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
292
- width: 300px;
293
- max-width: fit-content;
294
- }
295
-
296
- .auto-renew-badge {
297
- display: inline-block;
298
- background-color: rgba(217, 235, 27, 0.2);
299
- border: 1px solid #d9eb1b;
300
- color: #d9eb1b;
301
- padding: 0.25rem 0.75rem;
302
- border-radius: 9999px;
303
- font-size: 0.75rem;
304
- font-weight: 600;
305
- margin-top: 0.5rem;
306
- }
307
-
308
- .scan-btn {
309
- all: unset;
310
- font-size: 0.7rem;
311
- color: #626262ff;
312
- background-color: #fafafaff;
313
- padding: 0.5rem 1.5rem;
314
- border-radius: 1.3rem;
315
- font-weight: 500;
316
- cursor: pointer;
317
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
318
- width: fit-content;
319
- align-self: center;
320
- }
321
- .error-wrapper {
322
- display: flex;
323
- justify-content: center;
324
- align-items: center;
325
- text-align: center;
326
- border-radius: 1.5rem;
327
- border: 1px solid rgb(255, 236, 236);
328
- background-color: rgb(255, 255, 255);
329
- width: 250px;
330
- height: 80px;
331
- }
332
-
333
- .error-message {
334
- font-size: 0.75rem;
335
- font-weight: 400;
336
- color: rgb(255, 139, 139);
337
- font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
338
- max-width: 70%;
339
- }
340
-
341
- .loader {
342
- width: 48px;
343
- height: 48px;
344
- position: relative;
345
- }
346
- .loader::before,
347
- .loader::after {
348
- content: "";
349
- position: absolute;
350
- left: 50%;
351
- top: 50%;
352
- transform: translate(-50%, -50%);
353
- width: 48em;
354
- height: 48em;
355
- background-image: radial-gradient(circle 10px, #585858 100%, transparent 0),
356
- radial-gradient(circle 10px, #585858 100%, transparent 0),
357
- radial-gradient(circle 10px, #585858 100%, transparent 0),
358
- radial-gradient(circle 10px, #585858 100%, transparent 0),
359
- radial-gradient(circle 10px, #585858 100%, transparent 0),
360
- radial-gradient(circle 10px, #585858 100%, transparent 0),
361
- radial-gradient(circle 10px, #585858 100%, transparent 0),
362
- radial-gradient(circle 10px, #585858 100%, transparent 0),
363
- radial-gradient(circle 10px, #585858 100%, transparent 0);
364
- background-position: 0em -18em, 0em 18em, 18em 0em, -18em 0em, 13em -13em,
365
- -13em -13em, 13em 13em, -13em 13em;
366
- background-repeat: no-repeat;
367
- font-size: 0.5px;
368
- border-radius: 50%;
369
- animation: blast 1s ease-in infinite;
370
- }
371
- .loader::after {
372
- font-size: 1px;
373
- background: #585858;
374
- animation: bounce 1s ease-in infinite;
375
- }
376
-
377
- @keyframes bounce {
378
- 0%,
379
- 100% {
380
- font-size: 0.75px;
381
- }
382
- 50% {
383
- font-size: 1.5px;
384
- }
385
- }
386
- @keyframes blast {
387
- 0%,
388
- 40% {
389
- font-size: 0.5px;
390
- }
391
- 70% {
392
- opacity: 1;
393
- font-size: 4px;
394
- }
395
- 100% {
396
- font-size: 6px;
397
- opacity: 0;
398
- }
399
- }
400
- ` }), _jsxs("section", { children: [_jsx("div", { style: {
401
- width: "100%",
402
- justifyContent: "space-between",
403
- alignItems: "center",
404
- maxWidth: "300px",
405
- }, children: !config.continuousMode && (_jsx("div", { style: {
406
- width: "100%",
407
- display: "flex",
408
- justifyContent: "space-between",
409
- alignItems: "center",
410
- }, children: state === "idle" && (_jsx("button", { type: "button", style: {
411
- border: "none",
412
- background: "transparent",
413
- cursor: "pointer",
414
- width: "100%",
415
- alignSelf: "center",
416
- }, onClick: () => {
417
- if (state !== "idle") {
418
- stop();
419
- config.onClose?.();
420
- }
421
- else {
422
- start();
423
- }
424
- }, children: config.buttonComponent ? (config.buttonComponent) : (_jsx(PelicanButton, { authType: config.authType, text: config.buttonText, type: "idle" })) })) })) }), _jsx("div", { style: {
425
- width: "100%",
426
- display: "flex",
427
- justifyContent: "center",
428
- alignItems: "center",
429
- maxWidth: "300px",
430
- }, 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: {
431
- fontSize: "0.8rem",
432
- marginTop: "0.5rem",
433
- color: "#f3f3f3",
434
- textAlign: "center",
435
- }, 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("button", { onClick: () => openDeepLink(), className: "open-app-link", type: "button", children: "Launch Pelican Vault" }), _jsxs("p", { className: "helper-text", children: ["open app to", " ", config.authType === "login"
436
- ? "login"
437
- : config.authType === "signup"
438
- ? "signup"
439
- : config.authType === "id-verification"
440
- ? "verify identity"
441
- : "authenticate"] }), _jsx("button", { type: "button", className: "scan-btn", onClick: useQrInstead, children: "or scan QR code" })] })) : (config.forceQRCode &&
442
- qr &&
443
- state === "awaiting-pair") ||
444
- (!config.forceQRCode &&
445
- qr &&
446
- 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" }) }))] })) })), _jsx(StoreIcons, {}), state === "awaiting-pair" && (_jsx("button", { type: "button", className: "web-auth-btn", onClick: useWebAuth, children: "Use web vault" }))] })) }), state !== "idle" && (_jsx("div", { style: {
447
- width: "300px",
448
- display: "flex",
449
- justifyContent: "center",
450
- alignItems: "center",
451
- }, children: _jsx("button", { type: "button", style: {
452
- border: "none",
453
- background: "transparent",
454
- cursor: "pointer",
455
- alignSelf: "center",
456
- }, onClick: () => {
457
- stop();
458
- config.onClose?.();
459
- }, children: _jsx(PelicanButton, { authType: config.authType, text: `Cancel`, type: "cancel" }) }) }))] })] }));
460
- };
461
- export default PelicanAuth;
462
- //# sourceMappingURL=PelicanAuth.js.map
@@ -1 +0,0 @@
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,EACV,YAAY,GACb,GAAG,cAAc,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,SAAS,EAAE,CAAC,QAAQ,EAAE,EAAE;YACtB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;KACF,CAAC,CAAC;IACH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;YAC1B,KAAK,EAAE,CAAC;QACV,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAC5B,OAAO,CACL,8BACE,0BACG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,SAAS,EAAC,QAAQ,GAAQ,IACpC,GACF,CACP,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,kBAAkB,YAC/B,eAAM,SAAS,EAAC,QAAQ,GAAQ,GAC5B,CACP,IACG,CACP,GACG,CACP,EACD,KAAC,UAAU,KAAG,EACb,KAAK,KAAK,eAAe,IAAI,CAC5B,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,cAAc,EACxB,OAAO,EAAE,UAAU,8BAGZ,CACV,IACG,CACP,GACG,EAEL,KAAK,KAAK,MAAM,IAAI,CACnB,cACE,KAAK,EAAE;4BACL,KAAK,EAAE,OAAO;4BACd,OAAO,EAAE,MAAM;4BACf,cAAc,EAAE,QAAQ;4BACxB,UAAU,EAAE,QAAQ;yBACrB,YAED,iBACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;gCACL,MAAM,EAAE,MAAM;gCACd,UAAU,EAAE,aAAa;gCACzB,MAAM,EAAE,SAAS;gCAEjB,SAAS,EAAE,QAAQ;6BACpB,EACD,OAAO,EAAE,GAAG,EAAE;gCACZ,IAAI,EAAE,CAAC;gCACP,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;4BACrB,CAAC,YAED,KAAC,aAAa,IACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,QAAQ,GACd,GACK,GACL,CACP,IACO,IACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,17 +0,0 @@
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
- openDeepLink: () => void | undefined;
16
- };
17
- //# sourceMappingURL=usePelicanAuth.d.ts.map
@@ -1,65 +0,0 @@
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
- openDeepLink: () => pelicanRef.current?.openDeepLink(),
63
- };
64
- };
65
- //# sourceMappingURL=usePelicanAuth.js.map
@@ -1 +0,0 @@
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,MAAM,cAAc,GAAG,CAAC,MAA2B,EAAE,EAAE;IAC5D,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAClD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC9D,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmB,MAAM,CAAC,CAAC;IAC7D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAC;IAC9D,MAAM,OAAO,GACX,MAAM,CAAC,QAAQ,KAAK,OAAO;QACzB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ;YAC5B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,iBAAiB;gBACrC,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,gBAAgB,CAAC;IAE3B,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;QAClD,UAAU,CAAC,O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