@pelican-identity/react 2.0.9 → 2.0.10

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState, useRef, useCallback } from 'react';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { PelicanAuthentication } from '@pelican-identity/auth-core';
4
4
 
5
5
  // src/components/PelicanAuth.tsx
@@ -253,134 +253,469 @@ var PelicanAuth = (config) => {
253
253
  start();
254
254
  }
255
255
  }, [config.continuousMode]);
256
- return /* @__PURE__ */ jsxs("section", { children: [
257
- /* @__PURE__ */ jsx(
258
- "div",
259
- {
260
- style: {
261
- maxWidth: "275px",
262
- justifyContent: "space-between",
263
- alignItems: "center",
264
- width: "100%"
265
- },
266
- children: !config.continuousMode && /* @__PURE__ */ jsxs(
267
- "div",
268
- {
269
- style: {
270
- width: "100%",
271
- display: "flex",
272
- justifyContent: "space-between",
273
- alignItems: "center"
274
- },
275
- children: [
276
- /* @__PURE__ */ jsx(
277
- "button",
278
- {
279
- type: "button",
280
- style: {
281
- border: "none",
282
- background: "transparent",
283
- cursor: "pointer"
284
- },
285
- onClick: () => {
286
- start();
287
- },
288
- disabled: config.continuousMode,
289
- children: config.buttonComponent ? config.buttonComponent : /* @__PURE__ */ jsx(
290
- PelicanButton_default,
291
- {
292
- authType: config.authType,
293
- text: config.buttonText
294
- }
295
- )
296
- }
297
- ),
298
- state !== "idle" && /* @__PURE__ */ jsx(
299
- "button",
300
- {
301
- onClick: () => {
302
- stop();
303
- config.onClose?.();
304
- },
305
- className: "close-button",
306
- "aria-label": "Close",
307
- type: "button",
308
- children: /* @__PURE__ */ jsx(
309
- "svg",
310
- {
311
- className: "close-icon",
312
- fill: "#fff",
313
- stroke: "#fff",
314
- viewBox: "0 0 24 24",
315
- role: "img",
316
- "aria-label": "close icon",
317
- children: /* @__PURE__ */ jsx(
318
- "path",
319
- {
320
- strokeLinecap: "round",
321
- strokeLinejoin: "round",
322
- strokeWidth: 4,
323
- d: "M6 18L18 6M6 6l12 12"
324
- }
325
- )
326
- }
327
- )
328
- }
329
- )
330
- ]
331
- }
332
- )
333
- }
334
- ),
335
- state !== "idle" && /* @__PURE__ */ jsxs("div", { className: "auth-container", children: [
336
- successMessage && /* @__PURE__ */ jsxs("div", { className: "success-message", style: { textAlign: "center" }, children: [
337
- successMessage,
338
- config.continuousMode && /* @__PURE__ */ jsx(
339
- "p",
340
- {
341
- style: {
342
- fontSize: "0.8rem",
343
- marginTop: "0.5rem",
344
- color: "#f3f3f3",
345
- textAlign: "center"
346
- },
347
- children: "Preparing next session..."
348
- }
349
- )
350
- ] }),
351
- error && state === "error" && /* @__PURE__ */ jsx("div", { className: "error-wrapper", children: /* @__PURE__ */ jsx("p", { className: "error-message", children: error.message }) }),
352
- isProcessing ? /* @__PURE__ */ jsxs("div", { className: "content-wrapper", children: [
353
- /* @__PURE__ */ jsx("h2", { className: "main-heading", children: "one sec..." }),
354
- /* @__PURE__ */ jsx(
355
- "span",
356
- {
357
- className: "loader",
358
- style: { margin: "1rem auto", width: "252px" }
359
- }
360
- )
361
- ] }) : /* @__PURE__ */ jsx("div", { className: "content-wrapper", children: state === "awaiting-pair" && !successMessage && /* @__PURE__ */ jsxs("div", { className: "unpaired-container", children: [
362
- !deeplink && !config.forceQRCode && /* @__PURE__ */ jsx("h2", { className: "main-heading", children: "Open Pelican Vault" }),
363
- !config.forceQRCode && deeplink ? /* @__PURE__ */ jsxs("div", { className: "mobile-auth-container", children: [
364
- /* @__PURE__ */ jsx("div", { className: "logo-container", children: /* @__PURE__ */ jsx(
365
- "img",
256
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
257
+ /* @__PURE__ */ jsx("style", { children: `@keyframes fadeUp {
258
+ from {
259
+ opacity: 0;
260
+ transform: translateY(20px);
261
+ }
262
+ to {
263
+ opacity: 1;
264
+ transform: translateY(0);
265
+ }
266
+ }
267
+
268
+ @keyframes spin {
269
+ to {
270
+ transform: rotate(360deg);
271
+ }
272
+ }
273
+
274
+ @keyframes successPulse {
275
+ 0%,
276
+ 100% {
277
+ transform: scale(1);
278
+ opacity: 1;
279
+ }
280
+ 50% {
281
+ transform: scale(1.05);
282
+ opacity: 0.9;
283
+ }
284
+ }
285
+
286
+ .auth-container {
287
+ width: 300px;
288
+ max-width: fit-content;
289
+ padding: 1rem;
290
+ margin-top: 0.3rem;
291
+ position: relative;
292
+ animation: fadeUp 0.5s ease-out;
293
+ background-color: #fcfcfc;
294
+ border-radius: 2.5rem;
295
+ display: flex;
296
+ flex-direction: column;
297
+ justify-content: space-between;
298
+ align-items: center;
299
+ gap: 1rem;
300
+ min-height: 320px;
301
+ }
302
+ .js-auth-container {
303
+ width: 300px;
304
+ max-width: fit-content;
305
+ padding: 1rem;
306
+ margin-top: 0.3rem;
307
+ position: relative;
308
+ background-color: #fcfcfc;
309
+ border-radius: 2.5rem;
310
+ display: flex;
311
+ flex-direction: column;
312
+ justify-content: space-between;
313
+ align-items: center;
314
+ gap: 1rem;
315
+ min-height: 320px;
316
+ }
317
+
318
+ .close-button {
319
+ background-color: #2b2b2bff;
320
+ border: none;
321
+ cursor: pointer;
322
+ transition: opacity 0.2s;
323
+ height: 1.5rem;
324
+ width: 1.5rem;
325
+ display: flex;
326
+ align-items: center;
327
+ justify-content: center;
328
+ border-radius: 50%;
329
+ }
330
+
331
+ .close-button:hover {
332
+ opacity: 0.6;
333
+ }
334
+
335
+ .close-icon {
336
+ width: 1.5rem;
337
+ height: 1.5rem;
338
+ fill: #000000;
339
+ }
340
+
341
+ .retry-container {
342
+ text-align: center;
343
+ padding: 3rem 0;
344
+ }
345
+
346
+ .retry-container > div:first-child {
347
+ margin-bottom: 1rem;
348
+ }
349
+
350
+ .retry-text {
351
+ font-size: 1.125rem;
352
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
353
+ }
354
+
355
+ .content-wrapper {
356
+ display: flex;
357
+ flex-direction: column;
358
+ justify-content: center;
359
+ align-items: center;
360
+ gap: 2rem;
361
+ }
362
+
363
+ .unpaired-container {
364
+ text-align: center;
365
+ display: flex;
366
+ flex-direction: column;
367
+ }
368
+
369
+ .main-heading {
370
+ font-size: 0.75rem;
371
+ font-weight: 600;
372
+ color: #585858;
373
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
374
+ }
375
+
376
+ @media (min-width: 768px) {
377
+ .main-heading {
378
+ font-size: 1rem;
379
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
380
+ }
381
+ }
382
+
383
+ @media (min-width: 1024px) {
384
+ .main-heading {
385
+ font-size: 1rem;
386
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
387
+ }
388
+ }
389
+
390
+ .mobile-auth-container {
391
+ display: flex;
392
+ flex-direction: column;
393
+ gap: 0.7rem;
394
+ width: 253px;
395
+ }
396
+
397
+ .logo-container {
398
+ display: flex;
399
+ justify-content: center;
400
+ padding: 2rem 0;
401
+ }
402
+
403
+ .open-app-link {
404
+ display: inline-block;
405
+ padding: 0.75rem 2rem;
406
+ background-color: #2b2b2bff;
407
+ width: fit-content;
408
+ align-self: center;
409
+
410
+ border-radius: 18px;
411
+ color: #fff;
412
+ font-weight: 600;
413
+ font-size: 1rem;
414
+ text-decoration: none;
415
+ transition: background-color 0.2s;
416
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
417
+ }
418
+
419
+ .open-app-link:hover {
420
+ background-color: rgba(217, 235, 27, 0.9);
421
+ color: #000;
422
+ }
423
+
424
+ .helper-text {
425
+ font-size: 0.75rem;
426
+ color: #6b7280;
427
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
428
+ }
429
+
430
+ .qr-container {
431
+ display: flex;
432
+ justify-content: center;
433
+ }
434
+
435
+ .qr-wrapper {
436
+ display: flex;
437
+ justify-content: center;
438
+ align-items: center;
439
+ overflow: hidden;
440
+ border-radius: 2rem;
441
+ background-color: #fff;
442
+ padding: 0.2rem;
443
+ height: 244px;
444
+ width: 244px;
445
+ }
446
+
447
+ .qr-image {
448
+ height: 90%;
449
+ width: 90%;
450
+ }
451
+
452
+ .loader-container {
453
+ display: flex;
454
+ justify-content: center;
455
+ }
456
+
457
+ .instruction-text {
458
+ font-size: 0.875rem;
459
+ color: #9ca3af;
460
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
461
+ }
462
+
463
+ .paired-container {
464
+ text-align: center;
465
+ display: flex;
466
+ flex-direction: column;
467
+ gap: 1rem;
468
+ max-width: 250px;
469
+ }
470
+
471
+ .paired-heading {
472
+ font-size: 1rem;
473
+ font-weight: 800;
474
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
475
+ }
476
+
477
+ @media (min-width: 768px) {
478
+ .paired-heading {
479
+ font-size: 1rem;
480
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
481
+ }
482
+ }
483
+
484
+ .success-message {
485
+ background-color: #121212;
486
+ color: #d9eb1b;
487
+ padding: 0.5rem 1rem;
488
+ border-radius: 1.3rem;
489
+ font-weight: 700;
490
+ font-size: 1rem;
491
+ animation: successPulse 0.2s ease-in-out;
492
+ margin: 0.5rem 0;
493
+ font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
494
+ width: 300px;
495
+ max-width: fit-content;
496
+ }
497
+
498
+ .auto-renew-badge {
499
+ display: inline-block;
500
+ background-color: rgba(217, 235, 27, 0.2);
501
+ border: 1px solid #d9eb1b;
502
+ color: #d9eb1b;
503
+ padding: 0.25rem 0.75rem;
504
+ border-radius: 9999px;
505
+ font-size: 0.75rem;
506
+ font-weight: 600;
507
+ margin-top: 0.5rem;
508
+ }
509
+
510
+ .error-wrapper {
511
+ display: flex;
512
+ justify-content: center;
513
+ align-items: center;
514
+ text-align: center;
515
+ border-radius: 1.5rem;
516
+ border: 1px solid rgb(255, 236, 236);
517
+ background-color: rgb(255, 255, 255);
518
+ width: 250px;
519
+ height: 80px;
520
+ }
521
+
522
+ .error-message {
523
+ font-size: 0.75rem;
524
+ font-weight: 400;
525
+ color: rgb(255, 139, 139);
526
+ font-family: Onest, system-ui, Avenir, Helvetica, Arial, sans-serif;
527
+ max-width: 70%;
528
+ }
529
+
530
+ .loader {
531
+ width: 48px;
532
+ height: 48px;
533
+ position: relative;
534
+ }
535
+ .loader::before,
536
+ .loader::after {
537
+ content: "";
538
+ position: absolute;
539
+ left: 50%;
540
+ top: 50%;
541
+ transform: translate(-50%, -50%);
542
+ width: 48em;
543
+ height: 48em;
544
+ background-image: radial-gradient(circle 10px, #585858 100%, transparent 0),
545
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
546
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
547
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
548
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
549
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
550
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
551
+ radial-gradient(circle 10px, #585858 100%, transparent 0),
552
+ radial-gradient(circle 10px, #585858 100%, transparent 0);
553
+ background-position: 0em -18em, 0em 18em, 18em 0em, -18em 0em, 13em -13em,
554
+ -13em -13em, 13em 13em, -13em 13em;
555
+ background-repeat: no-repeat;
556
+ font-size: 0.5px;
557
+ border-radius: 50%;
558
+ animation: blast 1s ease-in infinite;
559
+ }
560
+ .loader::after {
561
+ font-size: 1px;
562
+ background: #585858;
563
+ animation: bounce 1s ease-in infinite;
564
+ }
565
+
566
+ @keyframes bounce {
567
+ 0%,
568
+ 100% {
569
+ font-size: 0.75px;
570
+ }
571
+ 50% {
572
+ font-size: 1.5px;
573
+ }
574
+ }
575
+ @keyframes blast {
576
+ 0%,
577
+ 40% {
578
+ font-size: 0.5px;
579
+ }
580
+ 70% {
581
+ opacity: 1;
582
+ font-size: 4px;
583
+ }
584
+ 100% {
585
+ font-size: 6px;
586
+ opacity: 0;
587
+ }
588
+ }
589
+ ` }),
590
+ /* @__PURE__ */ jsxs("section", { children: [
591
+ /* @__PURE__ */ jsx(
592
+ "div",
593
+ {
594
+ style: {
595
+ maxWidth: "275px",
596
+ justifyContent: "space-between",
597
+ alignItems: "center",
598
+ width: "100%"
599
+ },
600
+ children: !config.continuousMode && /* @__PURE__ */ jsxs(
601
+ "div",
602
+ {
603
+ style: {
604
+ width: "100%",
605
+ display: "flex",
606
+ justifyContent: "space-between",
607
+ alignItems: "center"
608
+ },
609
+ children: [
610
+ /* @__PURE__ */ jsx(
611
+ "button",
612
+ {
613
+ type: "button",
614
+ style: {
615
+ border: "none",
616
+ background: "transparent",
617
+ cursor: "pointer"
618
+ },
619
+ onClick: () => {
620
+ start();
621
+ },
622
+ disabled: config.continuousMode,
623
+ children: config.buttonComponent ? config.buttonComponent : /* @__PURE__ */ jsx(
624
+ PelicanButton_default,
625
+ {
626
+ authType: config.authType,
627
+ text: config.buttonText
628
+ }
629
+ )
630
+ }
631
+ ),
632
+ state !== "idle" && /* @__PURE__ */ jsx(
633
+ "button",
634
+ {
635
+ onClick: () => {
636
+ stop();
637
+ config.onClose?.();
638
+ },
639
+ className: "close-button",
640
+ "aria-label": "Close",
641
+ type: "button",
642
+ children: /* @__PURE__ */ jsx(
643
+ "svg",
644
+ {
645
+ className: "close-icon",
646
+ fill: "#fff",
647
+ stroke: "#fff",
648
+ viewBox: "0 0 24 24",
649
+ role: "img",
650
+ "aria-label": "close icon",
651
+ children: /* @__PURE__ */ jsx(
652
+ "path",
653
+ {
654
+ strokeLinecap: "round",
655
+ strokeLinejoin: "round",
656
+ strokeWidth: 4,
657
+ d: "M6 18L18 6M6 6l12 12"
658
+ }
659
+ )
660
+ }
661
+ )
662
+ }
663
+ )
664
+ ]
665
+ }
666
+ )
667
+ }
668
+ ),
669
+ state !== "idle" && /* @__PURE__ */ jsxs("div", { className: "auth-container", children: [
670
+ successMessage && /* @__PURE__ */ jsxs("div", { className: "success-message", style: { textAlign: "center" }, children: [
671
+ successMessage,
672
+ config.continuousMode && /* @__PURE__ */ jsx(
673
+ "p",
366
674
  {
367
- src: "https://res.cloudinary.com/de0jr8mcm/image/upload/v1765904735/pelican/pelican_icon_r9ghqw.png ",
368
- alt: "Pelican Logo",
369
- style: { width: "80px", height: "80px" }
675
+ style: {
676
+ fontSize: "0.8rem",
677
+ marginTop: "0.5rem",
678
+ color: "#f3f3f3",
679
+ textAlign: "center"
680
+ },
681
+ children: "Preparing next session..."
370
682
  }
371
- ) }),
372
- /* @__PURE__ */ jsx("a", { href: deeplink, className: "open-app-link", children: "Open Pelican Vault" }),
373
- /* @__PURE__ */ jsxs("p", { className: "helper-text", children: [
374
- "Open the app to",
375
- " ",
376
- config.authType === "login" ? "login" : config.authType === "signup" ? "signup" : config.authType === "id-verification" ? "verify identity" : "authenticate"
377
- ] })
378
- ] }) : config.forceQRCode && qr && state === "awaiting-pair" || !config.forceQRCode && qr && state === "awaiting-pair" ? /* @__PURE__ */ jsx("div", { className: "qr-container", children: /* @__PURE__ */ jsxs("div", { className: "qr-wrapper", children: [
379
- qr && /* @__PURE__ */ jsx("img", { src: qr, alt: "QR Code", className: "qr-image" }),
380
- !qr && /* @__PURE__ */ jsx("span", { className: "loader" })
381
- ] }) }) : /* @__PURE__ */ jsx("div", { className: "loader-container", children: /* @__PURE__ */ jsx("span", { className: "loader" }) })
382
- ] }) }),
383
- /* @__PURE__ */ jsx(StoreIcons_default, {})
683
+ )
684
+ ] }),
685
+ error && state === "error" && /* @__PURE__ */ jsx("div", { className: "error-wrapper", children: /* @__PURE__ */ jsx("p", { className: "error-message", children: error.message }) }),
686
+ isProcessing ? /* @__PURE__ */ jsxs("div", { className: "content-wrapper", children: [
687
+ /* @__PURE__ */ jsx("h2", { className: "main-heading", children: "one sec..." }),
688
+ /* @__PURE__ */ jsx(
689
+ "span",
690
+ {
691
+ className: "loader",
692
+ style: { margin: "1rem auto", width: "252px" }
693
+ }
694
+ )
695
+ ] }) : /* @__PURE__ */ jsx("div", { className: "content-wrapper", children: state === "awaiting-pair" && !successMessage && /* @__PURE__ */ jsxs("div", { className: "unpaired-container", children: [
696
+ !deeplink && !config.forceQRCode && /* @__PURE__ */ jsx("h2", { className: "main-heading", children: "Open Pelican Vault" }),
697
+ !config.forceQRCode && deeplink ? /* @__PURE__ */ jsxs("div", { className: "mobile-auth-container", children: [
698
+ /* @__PURE__ */ jsx("div", { className: "logo-container", children: /* @__PURE__ */ jsx(
699
+ "img",
700
+ {
701
+ src: "https://res.cloudinary.com/de0jr8mcm/image/upload/v1765904735/pelican/pelican_icon_r9ghqw.png ",
702
+ alt: "Pelican Logo",
703
+ style: { width: "80px", height: "80px" }
704
+ }
705
+ ) }),
706
+ /* @__PURE__ */ jsx("a", { href: deeplink, className: "open-app-link", children: "Open Pelican Vault" }),
707
+ /* @__PURE__ */ jsxs("p", { className: "helper-text", children: [
708
+ "Open the app to",
709
+ " ",
710
+ config.authType === "login" ? "login" : config.authType === "signup" ? "signup" : config.authType === "id-verification" ? "verify identity" : "authenticate"
711
+ ] })
712
+ ] }) : config.forceQRCode && qr && state === "awaiting-pair" || !config.forceQRCode && qr && state === "awaiting-pair" ? /* @__PURE__ */ jsx("div", { className: "qr-container", children: /* @__PURE__ */ jsxs("div", { className: "qr-wrapper", children: [
713
+ qr && /* @__PURE__ */ jsx("img", { src: qr, alt: "QR Code", className: "qr-image" }),
714
+ !qr && /* @__PURE__ */ jsx("span", { className: "loader" })
715
+ ] }) }) : /* @__PURE__ */ jsx("div", { className: "loader-container", children: /* @__PURE__ */ jsx("span", { className: "loader" }) })
716
+ ] }) }),
717
+ /* @__PURE__ */ jsx(StoreIcons_default, {})
718
+ ] })
384
719
  ] })
385
720
  ] });
386
721
  };