signer-test-sdk-react 0.0.12 → 0.0.13

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.
Files changed (75) hide show
  1. package/dist/src/AbstraxnProvider.d.ts +2 -5
  2. package/dist/src/AbstraxnProvider.js +189 -18
  3. package/dist/src/AbstraxnProvider.js.map +1 -1
  4. package/dist/src/WalletModal.css +547 -21
  5. package/dist/src/WalletModal.js +98 -164
  6. package/dist/src/WalletModal.js.map +1 -1
  7. package/dist/src/components/OnboardingUI/OnboardingUIWeb.d.ts +7 -0
  8. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js +169 -20
  9. package/dist/src/components/OnboardingUI/OnboardingUIWeb.js.map +1 -1
  10. package/dist/src/components/WalletModal/components/ChainSelector.css +180 -0
  11. package/dist/src/components/WalletModal/components/ChainSelector.d.ts +10 -0
  12. package/dist/src/components/WalletModal/components/ChainSelector.js +34 -0
  13. package/dist/src/components/WalletModal/components/ChainSelector.js.map +1 -0
  14. package/dist/src/components/WalletModal/components/ExportKeyModal.css +133 -0
  15. package/dist/src/components/WalletModal/components/ExportKeyModal.d.ts +9 -0
  16. package/dist/src/components/WalletModal/components/ExportKeyModal.js +31 -0
  17. package/dist/src/components/WalletModal/components/ExportKeyModal.js.map +1 -0
  18. package/dist/src/components/WalletModal/components/ExportWarningModal.css +2 -0
  19. package/dist/src/components/WalletModal/components/ExportWarningModal.d.ts +11 -0
  20. package/dist/src/components/WalletModal/components/ExportWarningModal.js +18 -0
  21. package/dist/src/components/WalletModal/components/ExportWarningModal.js.map +1 -0
  22. package/dist/src/components/WalletModal/components/ManageWalletModal.css +160 -0
  23. package/dist/src/components/WalletModal/components/ManageWalletModal.d.ts +12 -0
  24. package/dist/src/components/WalletModal/components/ManageWalletModal.js +21 -0
  25. package/dist/src/components/WalletModal/components/ManageWalletModal.js.map +1 -0
  26. package/dist/src/components/WalletModal/components/PreviewTransactionModal.css +128 -0
  27. package/dist/src/components/WalletModal/components/PreviewTransactionModal.d.ts +17 -0
  28. package/dist/src/components/WalletModal/components/PreviewTransactionModal.js +10 -0
  29. package/dist/src/components/WalletModal/components/PreviewTransactionModal.js.map +1 -0
  30. package/dist/src/components/WalletModal/components/ReceiveModal.css +101 -0
  31. package/dist/src/components/WalletModal/components/ReceiveModal.d.ts +8 -0
  32. package/dist/src/components/WalletModal/components/ReceiveModal.js +22 -0
  33. package/dist/src/components/WalletModal/components/ReceiveModal.js.map +1 -0
  34. package/dist/src/components/WalletModal/components/SendModal.css +234 -0
  35. package/dist/src/components/WalletModal/components/SendModal.d.ts +18 -0
  36. package/dist/src/components/WalletModal/components/SendModal.js +127 -0
  37. package/dist/src/components/WalletModal/components/SendModal.js.map +1 -0
  38. package/dist/src/components/WalletModal/components/SuccessModal.css +86 -0
  39. package/dist/src/components/WalletModal/components/SuccessModal.d.ts +13 -0
  40. package/dist/src/components/WalletModal/components/SuccessModal.js +8 -0
  41. package/dist/src/components/WalletModal/components/SuccessModal.js.map +1 -0
  42. package/dist/src/components/WalletModal/components/UserAvatar.d.ts +9 -0
  43. package/dist/src/components/WalletModal/components/UserAvatar.js +31 -0
  44. package/dist/src/components/WalletModal/components/UserAvatar.js.map +1 -0
  45. package/dist/src/components/WalletModal/components/index.d.ts +21 -0
  46. package/dist/src/components/WalletModal/components/index.js +13 -0
  47. package/dist/src/components/WalletModal/components/index.js.map +1 -0
  48. package/dist/src/components/WalletModal/hooks/index.d.ts +6 -0
  49. package/dist/src/components/WalletModal/hooks/index.js +7 -0
  50. package/dist/src/components/WalletModal/hooks/index.js.map +1 -0
  51. package/dist/src/components/WalletModal/hooks/useAddressValidation.d.ts +4 -0
  52. package/dist/src/components/WalletModal/hooks/useAddressValidation.js +17 -0
  53. package/dist/src/components/WalletModal/hooks/useAddressValidation.js.map +1 -0
  54. package/dist/src/components/WalletModal/hooks/useAmountValidation.d.ts +4 -0
  55. package/dist/src/components/WalletModal/hooks/useAmountValidation.js +29 -0
  56. package/dist/src/components/WalletModal/hooks/useAmountValidation.js.map +1 -0
  57. package/dist/src/components/WalletModal/hooks/useSendTransaction.d.ts +20 -0
  58. package/dist/src/components/WalletModal/hooks/useSendTransaction.js +55 -0
  59. package/dist/src/components/WalletModal/hooks/useSendTransaction.js.map +1 -0
  60. package/dist/src/components/WalletModal/index.d.ts +5 -0
  61. package/dist/src/components/WalletModal/index.js +7 -0
  62. package/dist/src/components/WalletModal/index.js.map +1 -0
  63. package/dist/src/components/WalletModal/utils/addressUtils.d.ts +19 -0
  64. package/dist/src/components/WalletModal/utils/addressUtils.js +62 -0
  65. package/dist/src/components/WalletModal/utils/addressUtils.js.map +1 -0
  66. package/dist/src/components/WalletModal/utils/formatUtils.d.ts +20 -0
  67. package/dist/src/components/WalletModal/utils/formatUtils.js +47 -0
  68. package/dist/src/components/WalletModal/utils/formatUtils.js.map +1 -0
  69. package/dist/src/components/WalletModal/utils/index.d.ts +5 -0
  70. package/dist/src/components/WalletModal/utils/index.js +6 -0
  71. package/dist/src/components/WalletModal/utils/index.js.map +1 -0
  72. package/dist/src/wagmiConfig.js +6 -2
  73. package/dist/src/wagmiConfig.js.map +1 -1
  74. package/dist/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +2 -3
@@ -590,6 +590,46 @@ const ONBOARDING_UI_STYLES = `
590
590
  width: 100%;
591
591
  }
592
592
 
593
+ /* Hide social buttons when OTP screen is visible - using class for better browser support */
594
+ .onboarding-card.onboarding-otp-active .onboarding-button-google,
595
+ .onboarding-card.onboarding-otp-active .onboarding-button-social,
596
+ .onboarding-card.onboarding-otp-active .onboarding-social-grid,
597
+ .onboarding-card.onboarding-otp-active .onboarding-divider:not(.onboarding-otp-divider),
598
+ .onboarding-card.onboarding-otp-active .onboarding-button-passkey,
599
+ .onboarding-card.onboarding-otp-active .onboarding-passkey-signup-link,
600
+ .onboarding-card.onboarding-otp-active .onboarding-passkey-divider,
601
+ .onboarding-card.onboarding-otp-active .onboarding-form:not(.onboarding-otp-form),
602
+ .onboarding-card.onboarding-otp-active .onboarding-input-group:not(.onboarding-otp-inputs-container) {
603
+ display: none !important;
604
+ visibility: hidden !important;
605
+ opacity: 0 !important;
606
+ height: 0 !important;
607
+ margin: 0 !important;
608
+ padding: 0 !important;
609
+ overflow: hidden !important;
610
+ pointer-events: none !important;
611
+ }
612
+
613
+ /* Fallback using :has() for modern browsers */
614
+ @supports selector(:has(*)) {
615
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-button-google,
616
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-button-social,
617
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-social-grid,
618
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-divider:not(.onboarding-otp-divider),
619
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-button-passkey,
620
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-passkey-signup-link,
621
+ .onboarding-card:has(.onboarding-otp-verification) .onboarding-passkey-divider {
622
+ display: none !important;
623
+ visibility: hidden !important;
624
+ opacity: 0 !important;
625
+ height: 0 !important;
626
+ margin: 0 !important;
627
+ padding: 0 !important;
628
+ overflow: hidden !important;
629
+ pointer-events: none !important;
630
+ }
631
+ }
632
+
593
633
  .onboarding-social-icon {
594
634
  width: 20px;
595
635
  height: 20px;
@@ -856,13 +896,17 @@ const ONBOARDING_UI_STYLES = `
856
896
  color: #b91c1c;
857
897
  }
858
898
 
859
- .onboarding-otp-resend-link:disabled {
899
+ .onboarding-otp-resend-link:disabled,
900
+ .onboarding-otp-resend-link-disabled {
860
901
  color: #9ca3af;
861
902
  cursor: not-allowed;
862
903
  text-decoration: none;
904
+ pointer-events: none;
905
+ opacity: 0.6;
863
906
  }
864
907
 
865
- .onboarding-theme-dark .onboarding-otp-resend-link:disabled {
908
+ .onboarding-theme-dark .onboarding-otp-resend-link:disabled,
909
+ .onboarding-theme-dark .onboarding-otp-resend-link-disabled {
866
910
  color: #6b7280;
867
911
  }
868
912
 
@@ -972,6 +1016,7 @@ export class OnboardingUIWeb {
972
1016
  loading = false;
973
1017
  activeButton = null;
974
1018
  resendCooldown = 0;
1019
+ resendCooldownTimer = null;
975
1020
  externalWalletsEnabled = false;
976
1021
  constructor(config, externalWalletsEnabled = false) {
977
1022
  this.externalWalletsEnabled = externalWalletsEnabled;
@@ -2478,12 +2523,11 @@ export class OnboardingUIWeb {
2478
2523
  }
2479
2524
  }
2480
2525
  /**
2481
- * Show OTP verification screen
2526
+ * Hide all login-related elements (social buttons, passkey, etc.)
2527
+ * This ensures they stay hidden on the OTP screen
2528
+ * Made public so it can be called from AbstraxnProvider
2482
2529
  */
2483
- showOtpInput() {
2484
- if (!this.rootElement)
2485
- return;
2486
- // Hide the email form and all login-related elements
2530
+ hideLoginElements() {
2487
2531
  if (this.emailForm) {
2488
2532
  this.emailForm.style.display = 'none';
2489
2533
  }
@@ -2526,6 +2570,15 @@ export class OnboardingUIWeb {
2526
2570
  if (this.footer) {
2527
2571
  this.footer.style.display = 'none';
2528
2572
  }
2573
+ }
2574
+ /**
2575
+ * Show OTP verification screen
2576
+ */
2577
+ showOtpInput() {
2578
+ if (!this.rootElement)
2579
+ return;
2580
+ // Hide the email form and all login-related elements
2581
+ this.hideLoginElements();
2529
2582
  // Create OTP verification screen
2530
2583
  this.createOtpVerificationScreen();
2531
2584
  }
@@ -2544,6 +2597,8 @@ export class OnboardingUIWeb {
2544
2597
  const card = this.rootElement.querySelector('.onboarding-card');
2545
2598
  if (!card)
2546
2599
  return;
2600
+ // Add class to card to indicate OTP screen is active (for CSS targeting)
2601
+ card.classList.add('onboarding-otp-active');
2547
2602
  // Create OTP verification container
2548
2603
  this.otpVerificationScreen = this.createElement('div', {
2549
2604
  className: 'onboarding-otp-verification',
@@ -2629,7 +2684,15 @@ export class OnboardingUIWeb {
2629
2684
  const resendLink = resendSection.querySelector('#otp-resend-link');
2630
2685
  if (resendLink) {
2631
2686
  this.resendButton = resendLink;
2632
- resendLink.addEventListener('click', () => this.handleResendOtp());
2687
+ resendLink.addEventListener('click', (e) => {
2688
+ e.preventDefault();
2689
+ e.stopPropagation();
2690
+ // Prevent click if cooldown is active
2691
+ if (this.resendCooldown > 0) {
2692
+ return;
2693
+ }
2694
+ this.handleResendOtp();
2695
+ });
2633
2696
  }
2634
2697
  // Footer (add to OTP screen as well)
2635
2698
  if (this.config.showFooter) {
@@ -2687,11 +2750,24 @@ export class OnboardingUIWeb {
2687
2750
  }
2688
2751
  // Append to card
2689
2752
  card.appendChild(this.otpVerificationScreen);
2753
+ // Ensure login elements are hidden when OTP screen is created
2754
+ // This is critical to prevent social buttons from showing
2755
+ this.hideLoginElements();
2756
+ // Also ensure they stay hidden after DOM updates
2757
+ setTimeout(() => {
2758
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
2759
+ this.hideLoginElements();
2760
+ }
2761
+ }, 0);
2690
2762
  // Focus first input
2691
2763
  setTimeout(() => {
2692
2764
  if (this.otpInputs[0]) {
2693
2765
  this.otpInputs[0].focus();
2694
2766
  }
2767
+ // Final check to ensure social buttons are hidden
2768
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
2769
+ this.hideLoginElements();
2770
+ }
2695
2771
  }, 100);
2696
2772
  // Start resend cooldown
2697
2773
  this.startResendCooldown();
@@ -2839,6 +2915,24 @@ export class OnboardingUIWeb {
2839
2915
  this.config.onLoginError?.(err instanceof Error ? err : new Error(errorMessage));
2840
2916
  // Disable auto-submit after failed attempt
2841
2917
  this.autoSubmitEnabled = false;
2918
+ // Ensure social buttons and login elements remain hidden on OTP screen when error occurs
2919
+ // This prevents them from appearing when an OTP error is shown
2920
+ if (this.otpVerificationScreen) {
2921
+ // Immediately hide login elements
2922
+ this.hideLoginElements();
2923
+ // Also use setTimeout to ensure they stay hidden after any potential re-renders
2924
+ setTimeout(() => {
2925
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
2926
+ this.hideLoginElements();
2927
+ }
2928
+ }, 0);
2929
+ // Additional check after a short delay to catch any late re-renders
2930
+ setTimeout(() => {
2931
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
2932
+ this.hideLoginElements();
2933
+ }
2934
+ }, 100);
2935
+ }
2842
2936
  // Clear OTP inputs on error
2843
2937
  this.otpInputs.forEach(input => {
2844
2938
  input.value = '';
@@ -2905,20 +2999,42 @@ export class OnboardingUIWeb {
2905
2999
  * Start resend cooldown timer
2906
3000
  */
2907
3001
  startResendCooldown() {
3002
+ // Clear any existing cooldown timer
3003
+ if (this.resendCooldownTimer) {
3004
+ clearInterval(this.resendCooldownTimer);
3005
+ }
2908
3006
  this.resendCooldown = 60; // 60 seconds cooldown
2909
- const updateCooldown = () => {
2910
- if (this.resendCooldown > 0 && this.resendButton) {
2911
- this.resendButton.textContent = `Resend (${this.resendCooldown}s)`;
2912
- this.resendButton.setAttribute('disabled', 'true');
3007
+ // Update UI immediately
3008
+ if (this.resendButton) {
3009
+ this.resendButton.textContent = `Resend (${this.resendCooldown}s)`;
3010
+ this.resendButton.classList.add('onboarding-otp-resend-link-disabled');
3011
+ this.resendButton.style.pointerEvents = 'none';
3012
+ this.resendButton.style.cursor = 'not-allowed';
3013
+ this.resendButton.style.opacity = '0.6';
3014
+ }
3015
+ // Start countdown timer
3016
+ this.resendCooldownTimer = setInterval(() => {
3017
+ if (this.resendCooldown > 0) {
2913
3018
  this.resendCooldown--;
2914
- setTimeout(updateCooldown, 1000);
3019
+ if (this.resendButton) {
3020
+ this.resendButton.textContent = `Resend (${this.resendCooldown}s)`;
3021
+ }
2915
3022
  }
2916
- else if (this.resendButton) {
2917
- this.resendButton.textContent = 'Resend';
2918
- this.resendButton.removeAttribute('disabled');
3023
+ else {
3024
+ // Cooldown complete, enable resend
3025
+ if (this.resendCooldownTimer) {
3026
+ clearInterval(this.resendCooldownTimer);
3027
+ this.resendCooldownTimer = null;
3028
+ }
3029
+ if (this.resendButton) {
3030
+ this.resendButton.textContent = 'Resend';
3031
+ this.resendButton.classList.remove('onboarding-otp-resend-link-disabled');
3032
+ this.resendButton.style.pointerEvents = 'auto';
3033
+ this.resendButton.style.cursor = 'pointer';
3034
+ this.resendButton.style.opacity = '1';
3035
+ }
2919
3036
  }
2920
- };
2921
- updateCooldown();
3037
+ }, 1000);
2922
3038
  }
2923
3039
  /**
2924
3040
  * Set error message
@@ -2935,6 +3051,24 @@ export class OnboardingUIWeb {
2935
3051
  else {
2936
3052
  otpErrorElement.style.display = 'none';
2937
3053
  }
3054
+ // Ensure social buttons remain hidden when showing error on OTP screen
3055
+ // Call immediately and also with delays to catch any re-renders
3056
+ this.hideLoginElements();
3057
+ setTimeout(() => {
3058
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
3059
+ this.hideLoginElements();
3060
+ }
3061
+ }, 0);
3062
+ setTimeout(() => {
3063
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
3064
+ this.hideLoginElements();
3065
+ }
3066
+ }, 50);
3067
+ setTimeout(() => {
3068
+ if (this.otpVerificationScreen && this.otpVerificationScreen.parentElement) {
3069
+ this.hideLoginElements();
3070
+ }
3071
+ }, 150);
2938
3072
  return;
2939
3073
  }
2940
3074
  }
@@ -3090,16 +3224,23 @@ export class OnboardingUIWeb {
3090
3224
  * Reset OTP screen and show initial login form
3091
3225
  */
3092
3226
  resetToLoginForm() {
3227
+ // Clear resend cooldown timer
3228
+ if (this.resendCooldownTimer) {
3229
+ clearInterval(this.resendCooldownTimer);
3230
+ this.resendCooldownTimer = null;
3231
+ }
3232
+ this.resendCooldown = 0;
3093
3233
  // Clear OTP verification screen
3094
3234
  if (this.otpVerificationScreen) {
3095
3235
  this.otpVerificationScreen.remove();
3096
3236
  this.otpVerificationScreen = null;
3097
3237
  }
3098
- // Remove loading/error mode classes
3238
+ // Remove loading/error mode classes and OTP active class
3099
3239
  const card = this.rootElement?.querySelector('.onboarding-card');
3100
3240
  if (card) {
3101
3241
  card.classList.remove('onboarding-mode-loading');
3102
3242
  card.classList.remove('onboarding-mode-error');
3243
+ card.classList.remove('onboarding-otp-active');
3103
3244
  }
3104
3245
  // Hide loading modal if exists (for inline components)
3105
3246
  this.hideLoadingModal();
@@ -3118,10 +3259,18 @@ export class OnboardingUIWeb {
3118
3259
  this.otpSent = false;
3119
3260
  this.loading = false;
3120
3261
  // Clear timer
3262
+ // Clear resend cooldown timer
3263
+ if (this.resendCooldownTimer) {
3264
+ clearInterval(this.resendCooldownTimer);
3265
+ this.resendCooldownTimer = null;
3266
+ }
3121
3267
  this.resendCooldown = 0;
3122
3268
  if (this.resendButton) {
3123
3269
  this.resendButton.textContent = 'Resend';
3124
- this.resendButton.removeAttribute('disabled');
3270
+ this.resendButton.classList.remove('onboarding-otp-resend-link-disabled');
3271
+ this.resendButton.style.pointerEvents = 'auto';
3272
+ this.resendButton.style.cursor = 'pointer';
3273
+ this.resendButton.style.opacity = '1';
3125
3274
  }
3126
3275
  // Get auth methods
3127
3276
  const authMethods = this.config.authMethods || ['otp', 'google'];