@turnkey/react-wallet-kit 2.5.1 → 2.5.3

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 (58) hide show
  1. package/dist/components/auth/Action.js +3 -3
  2. package/dist/components/auth/Action.js.map +1 -1
  3. package/dist/components/auth/Action.mjs +3 -4
  4. package/dist/components/auth/Action.mjs.map +1 -1
  5. package/dist/components/auth/OTP.d.ts.map +1 -1
  6. package/dist/components/auth/OTP.js +2 -3
  7. package/dist/components/auth/OTP.js.map +1 -1
  8. package/dist/components/auth/OTP.mjs +2 -3
  9. package/dist/components/auth/OTP.mjs.map +1 -1
  10. package/dist/components/auth/TurnstileWidget.d.ts.map +1 -1
  11. package/dist/components/auth/TurnstileWidget.js +2 -1
  12. package/dist/components/auth/TurnstileWidget.js.map +1 -1
  13. package/dist/components/auth/TurnstileWidget.mjs +2 -1
  14. package/dist/components/auth/TurnstileWidget.mjs.map +1 -1
  15. package/dist/components/user/UpdateEmail.d.ts.map +1 -1
  16. package/dist/components/user/UpdateEmail.js +16 -3
  17. package/dist/components/user/UpdateEmail.js.map +1 -1
  18. package/dist/components/user/UpdateEmail.mjs +33 -16
  19. package/dist/components/user/UpdateEmail.mjs.map +1 -1
  20. package/dist/components/user/UpdatePhoneNumber.d.ts.map +1 -1
  21. package/dist/components/user/UpdatePhoneNumber.js +16 -3
  22. package/dist/components/user/UpdatePhoneNumber.js.map +1 -1
  23. package/dist/components/user/UpdatePhoneNumber.mjs +32 -15
  24. package/dist/components/user/UpdatePhoneNumber.mjs.map +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +8 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +1 -1
  30. package/dist/providers/WalletConnectProvider.d.ts.map +1 -1
  31. package/dist/providers/WalletConnectProvider.js +2 -3
  32. package/dist/providers/WalletConnectProvider.js.map +1 -1
  33. package/dist/providers/WalletConnectProvider.mjs +2 -3
  34. package/dist/providers/WalletConnectProvider.mjs.map +1 -1
  35. package/dist/providers/client/Provider.d.ts.map +1 -1
  36. package/dist/providers/client/Provider.js +16 -6
  37. package/dist/providers/client/Provider.js.map +1 -1
  38. package/dist/providers/client/Provider.mjs +23 -7
  39. package/dist/providers/client/Provider.mjs.map +1 -1
  40. package/dist/providers/client/Types.d.ts +2 -0
  41. package/dist/providers/client/Types.d.ts.map +1 -1
  42. package/dist/providers/client/Types.js.map +1 -1
  43. package/dist/providers/client/Types.mjs.map +1 -1
  44. package/dist/tests/send-transaction-test.d.ts +3 -0
  45. package/dist/tests/send-transaction-test.d.ts.map +1 -0
  46. package/dist/utils/captcha.d.ts +2 -2
  47. package/dist/utils/captcha.d.ts.map +1 -1
  48. package/dist/utils/captcha.js +3 -2
  49. package/dist/utils/captcha.js.map +1 -1
  50. package/dist/utils/captcha.mjs +16 -6
  51. package/dist/utils/captcha.mjs.map +1 -1
  52. package/dist/utils/utils.d.ts +2 -1
  53. package/dist/utils/utils.d.ts.map +1 -1
  54. package/dist/utils/utils.js +7 -0
  55. package/dist/utils/utils.js.map +1 -1
  56. package/dist/utils/utils.mjs +23 -12
  57. package/dist/utils/utils.mjs.map +1 -1
  58. package/package.json +3 -3
@@ -9,7 +9,7 @@ import { isExpectedOAuthRedirectUrl, parseOAuthResponse, openOAuthPopup, buildOA
9
9
  import { completeOAuthPopup, completeOAuthFlow, completePKCEFlow } from '../../utils/oauth/completion.mjs';
10
10
  import { generateChallengePair, exchangeFacebookCodeForToken } from '../../utils/oauth/pkce.mjs';
11
11
  import { capitalizeProviderName, getProviderIcon } from '../../utils/oauth/helpers.mjs';
12
- import { useWalletProviderState, useDebouncedCallback, isValidSession, withTurnkeyErrorHandling, SESSION_WARNING_THRESHOLD_MS, mergeWalletsWithoutDuplicates } from '../../utils/utils.mjs';
12
+ import { useWalletProviderState, useDebouncedCallback, isValidSession, withTurnkeyErrorHandling, resolveRefreshStamper, SESSION_WARNING_THRESHOLD_MS, mergeWalletsWithoutDuplicates } from '../../utils/utils.mjs';
13
13
  import { clearKeys, clearAll, setCappedTimeoutInMap, clearKey, setTimeoutInMap } from '../../utils/timers.mjs';
14
14
  import { resetPasskeyScope, DEFAULT_SESSION_EXPIRATION_IN_SECONDS, OtpType, applyPasskeyScope, TurnkeyClient, Chain, WalletInterfaceType, getAuthProxyConfig, getClientParams, WalletSource, buildSecondaryOauthProviders, buildSecondaryOidcClaims } from '@turnkey/core';
15
15
  import { useState, useRef, useCallback, useEffect } from 'react';
@@ -1584,11 +1584,12 @@ var ClientProvider = function ClientProvider(_ref) {
1584
1584
  *
1585
1585
  * @param params.organizationId - organization ID to specify the sub-organization (defaults to the current session's organizationId).
1586
1586
  * @param params.userId - user ID to fetch specific user details (defaults to the current session's userId).
1587
- * @param params.stampWith - parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
1587
+ * @param params.stampWith - fallback stamper, only used when there is no valid session.
1588
1588
  * @returns A promise that resolves when the user is refreshed, or does nothing if auto-refresh is disabled
1589
1589
  */
1590
1590
  var maybeRefreshUser = useCallback(/*#__PURE__*/function () {
1591
1591
  var _ref31 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26(params) {
1592
+ var activeSession, stampWith;
1592
1593
  return _regenerator().w(function (_context26) {
1593
1594
  while (1) switch (_context26.n) {
1594
1595
  case 0:
@@ -1598,14 +1599,21 @@ var ClientProvider = function ClientProvider(_ref) {
1598
1599
  }
1599
1600
  return _context26.a(2, undefined);
1600
1601
  case 1:
1601
- return _context26.a(2, refreshUser(params));
1602
+ _context26.n = 2;
1603
+ return getSession();
1604
+ case 2:
1605
+ activeSession = _context26.v;
1606
+ stampWith = resolveRefreshStamper(activeSession, params === null || params === void 0 ? void 0 : params.stampWith);
1607
+ return _context26.a(2, refreshUser(_objectSpread2(_objectSpread2({}, params), {}, {
1608
+ stampWith: stampWith
1609
+ })));
1602
1610
  }
1603
1611
  }, _callee26);
1604
1612
  }));
1605
1613
  return function (_x20) {
1606
1614
  return _ref31.apply(this, arguments);
1607
1615
  };
1608
- }(), [masterConfig, refreshUser]);
1616
+ }(), [masterConfig, refreshUser, getSession]);
1609
1617
  var refreshWallets = useCallback(/*#__PURE__*/function () {
1610
1618
  var _ref32 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(params) {
1611
1619
  var _ref33, stampWith, organizationId, userId, walletProviders, wallets;
@@ -1657,11 +1665,12 @@ var ClientProvider = function ClientProvider(_ref) {
1657
1665
  *
1658
1666
  * @param params.organizationId - organization ID to specify the sub-organization (defaults to the current session's organizationId).
1659
1667
  * @param params.userId - user ID to fetch specific user details (defaults to the current session's userId).
1660
- * @param params.stampWith - parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
1668
+ * @param params.stampWith - fallback stamper, only used when there is no valid session.
1661
1669
  * @returns A promise that resolves to an array of wallets, or an empty array if auto-refresh is disabled
1662
1670
  */
1663
1671
  var maybeRefreshWallets = useCallback(/*#__PURE__*/function () {
1664
1672
  var _ref34 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(params) {
1673
+ var activeSession, stampWith;
1665
1674
  return _regenerator().w(function (_context28) {
1666
1675
  while (1) switch (_context28.n) {
1667
1676
  case 0:
@@ -1671,14 +1680,21 @@ var ClientProvider = function ClientProvider(_ref) {
1671
1680
  }
1672
1681
  return _context28.a(2, []);
1673
1682
  case 1:
1674
- return _context28.a(2, refreshWallets(params));
1683
+ _context28.n = 2;
1684
+ return getSession();
1685
+ case 2:
1686
+ activeSession = _context28.v;
1687
+ stampWith = resolveRefreshStamper(activeSession, params === null || params === void 0 ? void 0 : params.stampWith);
1688
+ return _context28.a(2, refreshWallets(_objectSpread2(_objectSpread2({}, params), {}, {
1689
+ stampWith: stampWith
1690
+ })));
1675
1691
  }
1676
1692
  }, _callee28);
1677
1693
  }));
1678
1694
  return function (_x22) {
1679
1695
  return _ref34.apply(this, arguments);
1680
1696
  };
1681
- }(), [masterConfig, refreshWallets]);
1697
+ }(), [masterConfig, refreshWallets, getSession]);
1682
1698
  var clearSession = useCallback(/*#__PURE__*/function () {
1683
1699
  var _ref35 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30(params) {
1684
1700
  var _params$sessionKey;