@dynamic-labs/utils 3.0.0-alpha.6 → 3.0.0-alpha.60

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 (60) hide show
  1. package/CHANGELOG.md +585 -0
  2. package/_virtual/_tslib.cjs +15 -0
  3. package/_virtual/_tslib.js +14 -1
  4. package/package.json +4 -4
  5. package/src/errors/MfaInvalidOtpError.cjs +1 -1
  6. package/src/errors/MfaInvalidOtpError.js +1 -1
  7. package/src/errors/MfaRateLimitedError.cjs +14 -0
  8. package/src/errors/MfaRateLimitedError.d.ts +4 -0
  9. package/src/errors/MfaRateLimitedError.js +10 -0
  10. package/src/errors/NoAccessError.cjs +3 -1
  11. package/src/errors/NoAccessError.d.ts +5 -1
  12. package/src/errors/NoAccessError.js +3 -1
  13. package/src/errors/SandboxMaximumThresholdReachedError.cjs +15 -0
  14. package/src/errors/SandboxMaximumThresholdReachedError.d.ts +5 -0
  15. package/src/errors/SandboxMaximumThresholdReachedError.js +11 -0
  16. package/src/errors/UserRejectedRequestError.cjs +14 -0
  17. package/src/errors/UserRejectedRequestError.d.ts +4 -0
  18. package/src/errors/UserRejectedRequestError.js +10 -0
  19. package/src/errors/WalletAddressMismatchError.cjs +17 -0
  20. package/src/errors/WalletAddressMismatchError.d.ts +11 -0
  21. package/src/errors/WalletAddressMismatchError.js +13 -0
  22. package/src/errors/index.d.ts +4 -0
  23. package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +0 -6
  24. package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +0 -6
  25. package/src/index.cjs +15 -0
  26. package/src/index.d.ts +2 -0
  27. package/src/index.js +8 -1
  28. package/src/isMobile.cjs +11 -0
  29. package/src/isMobile.d.ts +1 -0
  30. package/src/isMobile.js +11 -1
  31. package/src/nativeMobileOauthStateParam.cjs +13 -0
  32. package/src/nativeMobileOauthStateParam.d.ts +14 -0
  33. package/src/nativeMobileOauthStateParam.js +9 -0
  34. package/src/retryableFn.cjs +1 -5
  35. package/src/retryableFn.js +1 -5
  36. package/src/services/FetchService/FetchService.cjs +10 -5
  37. package/src/services/FetchService/FetchService.d.ts +2 -2
  38. package/src/services/FetchService/FetchService.js +10 -5
  39. package/src/services/Oauth2Service/Oauth2Service.cjs +38 -0
  40. package/src/services/Oauth2Service/Oauth2Service.d.ts +41 -0
  41. package/src/services/Oauth2Service/Oauth2Service.js +34 -0
  42. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs +176 -0
  43. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.d.ts +2 -0
  44. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js +172 -0
  45. package/src/services/Oauth2Service/createWindowOauth2Service/index.d.ts +1 -0
  46. package/src/services/Oauth2Service/index.d.ts +2 -0
  47. package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.cjs +26 -0
  48. package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.d.ts +7 -0
  49. package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.js +22 -0
  50. package/src/services/Oauth2Service/utils/connectWithAppleId/index.d.ts +1 -0
  51. package/src/services/Oauth2Service/utils/loadAppleId/index.d.ts +1 -0
  52. package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.cjs +34 -0
  53. package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.d.ts +1 -0
  54. package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.js +30 -0
  55. package/src/services/PlatformService/PlatformService.cjs +38 -13
  56. package/src/services/PlatformService/PlatformService.d.ts +25 -3
  57. package/src/services/PlatformService/PlatformService.js +40 -15
  58. package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +1 -3
  59. package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +1 -3
  60. package/src/services/PlatformService/types.d.ts +5 -4
@@ -24,9 +24,22 @@ function __awaiter(thisArg, _arguments, P, generator) {
24
24
  });
25
25
  }
26
26
 
27
+ function __classPrivateFieldGet(receiver, state, kind, f) {
28
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
+ }
32
+
33
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
34
+ if (kind === "m") throw new TypeError("Private method is not writable");
35
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
36
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
37
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
38
+ }
39
+
27
40
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
28
41
  var e = new Error(message);
29
42
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30
43
  };
31
44
 
32
- export { __awaiter };
45
+ export { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "3.0.0-alpha.6",
3
+ "version": "3.0.0-alpha.60",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -26,10 +26,10 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@dynamic-labs/sdk-api-core": "0.0.470",
29
+ "@dynamic-labs/sdk-api-core": "0.0.526",
30
30
  "tldts": "6.0.16",
31
- "@dynamic-labs/logger": "3.0.0-alpha.6",
32
- "@dynamic-labs/types": "3.0.0-alpha.6",
31
+ "@dynamic-labs/logger": "3.0.0-alpha.60",
32
+ "@dynamic-labs/types": "3.0.0-alpha.60",
33
33
  "buffer": "6.0.3",
34
34
  "stream": "0.0.2"
35
35
  },
@@ -7,7 +7,7 @@ var DynamicError = require('./DynamicError.cjs');
7
7
 
8
8
  class MfaInvalidOtpError extends DynamicError.DynamicError {
9
9
  constructor() {
10
- super('Invalid MFA OTP');
10
+ super('Invalid code');
11
11
  }
12
12
  }
13
13
 
@@ -3,7 +3,7 @@ import { DynamicError } from './DynamicError.js';
3
3
 
4
4
  class MfaInvalidOtpError extends DynamicError {
5
5
  constructor() {
6
- super('Invalid MFA OTP');
6
+ super('Invalid code');
7
7
  }
8
8
  }
9
9
 
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class MfaRateLimitedError extends DynamicError.DynamicError {
9
+ constructor() {
10
+ super('Rate limit reached');
11
+ }
12
+ }
13
+
14
+ exports.MfaRateLimitedError = MfaRateLimitedError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class MfaRateLimitedError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class MfaRateLimitedError extends DynamicError {
5
+ constructor() {
6
+ super('Rate limit reached');
7
+ }
8
+ }
9
+
10
+ export { MfaRateLimitedError };
@@ -6,11 +6,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var DynamicError = require('./DynamicError.cjs');
7
7
 
8
8
  class NoAccessError extends DynamicError.DynamicError {
9
- constructor({ walletPublicKey, email, phoneNumber, }) {
9
+ constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }) {
10
10
  super('User does not have access');
11
11
  this.email = email;
12
12
  this.walletPublicKey = walletPublicKey;
13
13
  this.phoneNumber = phoneNumber;
14
+ this.socialProvider = socialProvider;
15
+ this.socialUsername = socialUsername;
14
16
  }
15
17
  }
16
18
 
@@ -3,9 +3,13 @@ export declare class NoAccessError extends DynamicError {
3
3
  walletPublicKey?: string;
4
4
  email?: string;
5
5
  phoneNumber?: string;
6
- constructor({ walletPublicKey, email, phoneNumber, }: {
6
+ socialProvider?: string;
7
+ socialUsername?: string;
8
+ constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }: {
7
9
  email?: string;
8
10
  walletPublicKey?: string;
9
11
  phoneNumber?: string;
12
+ socialProvider?: string;
13
+ socialUsername?: string;
10
14
  });
11
15
  }
@@ -2,11 +2,13 @@
2
2
  import { DynamicError } from './DynamicError.js';
3
3
 
4
4
  class NoAccessError extends DynamicError {
5
- constructor({ walletPublicKey, email, phoneNumber, }) {
5
+ constructor({ walletPublicKey, email, phoneNumber, socialProvider, socialUsername, }) {
6
6
  super('User does not have access');
7
7
  this.email = email;
8
8
  this.walletPublicKey = walletPublicKey;
9
9
  this.phoneNumber = phoneNumber;
10
+ this.socialProvider = socialProvider;
11
+ this.socialUsername = socialUsername;
10
12
  }
11
13
  }
12
14
 
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class SandboxMaximumThresholdReachedError extends DynamicError.DynamicError {
9
+ constructor(errorMessage) {
10
+ super(errorMessage);
11
+ this.errorMessage = errorMessage;
12
+ }
13
+ }
14
+
15
+ exports.SandboxMaximumThresholdReachedError = SandboxMaximumThresholdReachedError;
@@ -0,0 +1,5 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class SandboxMaximumThresholdReachedError extends DynamicError {
3
+ errorMessage: string;
4
+ constructor(errorMessage: string);
5
+ }
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class SandboxMaximumThresholdReachedError extends DynamicError {
5
+ constructor(errorMessage) {
6
+ super(errorMessage);
7
+ this.errorMessage = errorMessage;
8
+ }
9
+ }
10
+
11
+ export { SandboxMaximumThresholdReachedError };
@@ -0,0 +1,14 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class UserRejectedRequestError extends DynamicError.DynamicError {
9
+ constructor() {
10
+ super('User rejected request', 'user_rejected_request');
11
+ }
12
+ }
13
+
14
+ exports.UserRejectedRequestError = UserRejectedRequestError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class UserRejectedRequestError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class UserRejectedRequestError extends DynamicError {
5
+ constructor() {
6
+ super('User rejected request', 'user_rejected_request');
7
+ }
8
+ }
9
+
10
+ export { UserRejectedRequestError };
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var DynamicError = require('./DynamicError.cjs');
7
+
8
+ class WalletAddressMismatchError extends DynamicError.DynamicError {
9
+ constructor(message, { activeAddress, expectedAddress, walletName, }) {
10
+ super(message, 'wallet_address_mismatch_error');
11
+ this.expectedAddress = expectedAddress;
12
+ this.activeAddress = activeAddress;
13
+ this.walletName = walletName;
14
+ }
15
+ }
16
+
17
+ exports.WalletAddressMismatchError = WalletAddressMismatchError;
@@ -0,0 +1,11 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class WalletAddressMismatchError extends DynamicError {
3
+ expectedAddress: string | undefined;
4
+ activeAddress: string | undefined;
5
+ walletName: string | undefined;
6
+ constructor(message: string, { activeAddress, expectedAddress, walletName, }: {
7
+ activeAddress?: string;
8
+ expectedAddress?: string;
9
+ walletName?: string;
10
+ });
11
+ }
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ import { DynamicError } from './DynamicError.js';
3
+
4
+ class WalletAddressMismatchError extends DynamicError {
5
+ constructor(message, { activeAddress, expectedAddress, walletName, }) {
6
+ super(message, 'wallet_address_mismatch_error');
7
+ this.expectedAddress = expectedAddress;
8
+ this.activeAddress = activeAddress;
9
+ this.walletName = walletName;
10
+ }
11
+ }
12
+
13
+ export { WalletAddressMismatchError };
@@ -1,5 +1,6 @@
1
1
  export * from './AccountExistsError';
2
2
  export * from './ChainalysisError';
3
+ export * from './SandboxMaximumThresholdReachedError';
3
4
  export * from './CustomError';
4
5
  export * from './DynamicError';
5
6
  export * from './EmailAlreadyExistsError';
@@ -29,4 +30,7 @@ export * from './CookieInvalidError';
29
30
  export * from './AccessBlockedError';
30
31
  export * from './EmbeddedWalletException';
31
32
  export * from './MfaInvalidOtpError';
33
+ export * from './MfaRateLimitedError';
32
34
  export * from './ExternalAuthError';
35
+ export * from './WalletAddressMismatchError';
36
+ export * from './UserRejectedRequestError';
@@ -3,13 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- require('../errors/InsufficientFundsError.cjs');
7
- require('../errors/TransactionGasCannotBeSponsoredError.cjs');
8
- require('../logger/logger.cjs');
9
6
  var isMobile = require('../isMobile.cjs');
10
- require('../../_virtual/_tslib.cjs');
11
- require('../bufferPolyfill.cjs');
12
- require('tldts');
13
7
 
14
8
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
15
9
  const url = encodeURIComponent(window.location.toString());
@@ -1,11 +1,5 @@
1
1
  'use client'
2
- import '../errors/InsufficientFundsError.js';
3
- import '../errors/TransactionGasCannotBeSponsoredError.js';
4
- import '../logger/logger.js';
5
2
  import { isSamsungBrowser } from '../isMobile.js';
6
- import '../../_virtual/_tslib.js';
7
- import '../bufferPolyfill.js';
8
- import 'tldts';
9
3
 
10
4
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
11
5
  const url = encodeURIComponent(window.location.toString());
package/src/index.cjs CHANGED
@@ -7,6 +7,7 @@ var parseChainId = require('./parseChainId.cjs');
7
7
  var parseEvmNetworks = require('./parseEvmNetworks.cjs');
8
8
  var AccountExistsError = require('./errors/AccountExistsError.cjs');
9
9
  var ChainalysisError = require('./errors/ChainalysisError.cjs');
10
+ var SandboxMaximumThresholdReachedError = require('./errors/SandboxMaximumThresholdReachedError.cjs');
10
11
  var CustomError = require('./errors/CustomError.cjs');
11
12
  var DynamicError = require('./errors/DynamicError.cjs');
12
13
  var EmailAlreadyExistsError = require('./errors/EmailAlreadyExistsError.cjs');
@@ -35,7 +36,10 @@ var CookieInvalidError = require('./errors/CookieInvalidError.cjs');
35
36
  var AccessBlockedError = require('./errors/AccessBlockedError.cjs');
36
37
  var EmbeddedWalletException = require('./errors/EmbeddedWalletException.cjs');
37
38
  var MfaInvalidOtpError = require('./errors/MfaInvalidOtpError.cjs');
39
+ var MfaRateLimitedError = require('./errors/MfaRateLimitedError.cjs');
38
40
  var ExternalAuthError = require('./errors/ExternalAuthError.cjs');
41
+ var WalletAddressMismatchError = require('./errors/WalletAddressMismatchError.cjs');
42
+ var UserRejectedRequestError = require('./errors/UserRejectedRequestError.cjs');
39
43
  var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
40
44
  var isFunction = require('./isFunction/isFunction.cjs');
41
45
  var isMobile = require('./isMobile.cjs');
@@ -55,11 +59,14 @@ var formatNumberText = require('./formatNumberText/formatNumberText.cjs');
55
59
  var ceil = require('./ceil/ceil.cjs');
56
60
  var trimEnd = require('./trimEnd/trimEnd.cjs');
57
61
  var isLedgerAddressViaVerifiedCredentials = require('./isLedgerAddressViaVerifiedCredentials.cjs');
62
+ var nativeMobileOauthStateParam = require('./nativeMobileOauthStateParam.cjs');
58
63
  var eip6963Provider = require('./eip6963/eip6963Provider.cjs');
59
64
  var runSafe = require('./runSafe/runSafe.cjs');
60
65
  var PlatformService = require('./services/PlatformService/PlatformService.cjs');
61
66
  var createBrowserPlatformService = require('./services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs');
62
67
  var FetchService = require('./services/FetchService/FetchService.cjs');
68
+ var Oauth2Service = require('./services/Oauth2Service/Oauth2Service.cjs');
69
+ var createWindowOauth2Service = require('./services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs');
63
70
  var template = require('./template/template.cjs');
64
71
  var get = require('./get/get.cjs');
65
72
  var hexToString = require('./hexToString/hexToString.cjs');
@@ -71,6 +78,7 @@ exports.parseChainId = parseChainId.parseChainId;
71
78
  exports.parseEvmNetworks = parseEvmNetworks.parseEvmNetworks;
72
79
  exports.AccountExistsError = AccountExistsError.AccountExistsError;
73
80
  exports.ChainalysisError = ChainalysisError.ChainalysisError;
81
+ exports.SandboxMaximumThresholdReachedError = SandboxMaximumThresholdReachedError.SandboxMaximumThresholdReachedError;
74
82
  exports.CustomError = CustomError.CustomError;
75
83
  exports.DynamicError = DynamicError.DynamicError;
76
84
  exports.EmailAlreadyExistsError = EmailAlreadyExistsError.EmailAlreadyExistsError;
@@ -99,7 +107,10 @@ exports.CookieInvalidError = CookieInvalidError.CookieInvalidError;
99
107
  exports.AccessBlockedError = AccessBlockedError.AccessBlockedError;
100
108
  exports.EmbeddedWalletException = EmbeddedWalletException.EmbeddedWalletException;
101
109
  exports.MfaInvalidOtpError = MfaInvalidOtpError.MfaInvalidOtpError;
110
+ exports.MfaRateLimitedError = MfaRateLimitedError.MfaRateLimitedError;
102
111
  exports.ExternalAuthError = ExternalAuthError.ExternalAuthError;
112
+ exports.WalletAddressMismatchError = WalletAddressMismatchError.WalletAddressMismatchError;
113
+ exports.UserRejectedRequestError = UserRejectedRequestError.UserRejectedRequestError;
103
114
  exports.CancellablePromise = CancellablePromise.CancellablePromise;
104
115
  exports.isFunction = isFunction.isFunction;
105
116
  exports.getAndroidVersion = isMobile.getAndroidVersion;
@@ -110,6 +121,7 @@ exports.isIPhone = isMobile.isIPhone;
110
121
  exports.isIPhone8OrEarlier = isMobile.isIPhone8OrEarlier;
111
122
  exports.isLegacySafari = isMobile.isLegacySafari;
112
123
  exports.isMobile = isMobile.isMobile;
124
+ exports.isSafariBrowser = isMobile.isSafariBrowser;
113
125
  exports.isSamsungBrowser = isMobile.isSamsungBrowser;
114
126
  exports.isWindows = isMobile.isWindows;
115
127
  exports.getItemAsync = localStorageAsync.getItemAsync;
@@ -131,12 +143,15 @@ exports.formatNumberText = formatNumberText.formatNumberText;
131
143
  exports.ceil = ceil.ceil;
132
144
  exports.trimEnd = trimEnd.trimEnd;
133
145
  exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
146
+ exports.nativeMobileOauthStateParam = nativeMobileOauthStateParam.nativeMobileOauthStateParam;
134
147
  exports.Eip6963Provider = eip6963Provider.Eip6963Provider;
135
148
  exports.Eip6963ProviderSingleton = eip6963Provider.Eip6963ProviderSingleton;
136
149
  exports.runSafe = runSafe.runSafe;
137
150
  exports.PlatformService = PlatformService.PlatformService;
138
151
  exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
139
152
  exports.FetchService = FetchService.FetchService;
153
+ exports.Oauth2Service = Oauth2Service.Oauth2Service;
154
+ exports.createWindowOauth2Service = createWindowOauth2Service.createWindowOauth2Service;
140
155
  exports.template = template.template;
141
156
  exports.get = get.get;
142
157
  exports.hexToString = hexToString.hexToString;
package/src/index.d.ts CHANGED
@@ -20,10 +20,12 @@ export * from './formatNumberText';
20
20
  export * from './ceil';
21
21
  export * from './trimEnd';
22
22
  export * from './isLedgerAddressViaVerifiedCredentials';
23
+ export * from './nativeMobileOauthStateParam';
23
24
  export * from './eip6963';
24
25
  export { runSafe } from './runSafe';
25
26
  export { PlatformService, createBrowserPlatformService, type IPlatformService, } from './services/PlatformService';
26
27
  export { FetchService } from './services/FetchService';
28
+ export { Oauth2Service, type GetOauthCodeError, type GetOauthCodeProps, type IOauth2Service, createWindowOauth2Service, } from './services/Oauth2Service';
27
29
  export { template } from './template';
28
30
  export { get } from './get';
29
31
  export { hexToString } from './hexToString';
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ export { parseChainId } from './parseChainId.js';
3
3
  export { parseEvmNetworks } from './parseEvmNetworks.js';
4
4
  export { AccountExistsError } from './errors/AccountExistsError.js';
5
5
  export { ChainalysisError } from './errors/ChainalysisError.js';
6
+ export { SandboxMaximumThresholdReachedError } from './errors/SandboxMaximumThresholdReachedError.js';
6
7
  export { CustomError } from './errors/CustomError.js';
7
8
  export { DynamicError } from './errors/DynamicError.js';
8
9
  export { EmailAlreadyExistsError } from './errors/EmailAlreadyExistsError.js';
@@ -31,10 +32,13 @@ export { CookieInvalidError } from './errors/CookieInvalidError.js';
31
32
  export { AccessBlockedError } from './errors/AccessBlockedError.js';
32
33
  export { EmbeddedWalletException } from './errors/EmbeddedWalletException.js';
33
34
  export { MfaInvalidOtpError } from './errors/MfaInvalidOtpError.js';
35
+ export { MfaRateLimitedError } from './errors/MfaRateLimitedError.js';
34
36
  export { ExternalAuthError } from './errors/ExternalAuthError.js';
37
+ export { WalletAddressMismatchError } from './errors/WalletAddressMismatchError.js';
38
+ export { UserRejectedRequestError } from './errors/UserRejectedRequestError.js';
35
39
  export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
36
40
  export { isFunction } from './isFunction/isFunction.js';
37
- export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
41
+ export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSafariBrowser, isSamsungBrowser, isWindows } from './isMobile.js';
38
42
  export { getItemAsync, removeItemAsync, setItemAsync } from './localStorageAsync.js';
39
43
  export { bufferToBase64 } from './bufferToBase64.js';
40
44
  export { last } from './last.js';
@@ -51,11 +55,14 @@ export { formatNumberText } from './formatNumberText/formatNumberText.js';
51
55
  export { ceil } from './ceil/ceil.js';
52
56
  export { trimEnd } from './trimEnd/trimEnd.js';
53
57
  export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js';
58
+ export { nativeMobileOauthStateParam } from './nativeMobileOauthStateParam.js';
54
59
  export { Eip6963Provider, Eip6963ProviderSingleton } from './eip6963/eip6963Provider.js';
55
60
  export { runSafe } from './runSafe/runSafe.js';
56
61
  export { PlatformService } from './services/PlatformService/PlatformService.js';
57
62
  export { createBrowserPlatformService } from './services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js';
58
63
  export { FetchService } from './services/FetchService/FetchService.js';
64
+ export { Oauth2Service } from './services/Oauth2Service/Oauth2Service.js';
65
+ export { createWindowOauth2Service } from './services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js';
59
66
  export { template } from './template/template.js';
60
67
  export { get } from './get/get.js';
61
68
  export { hexToString } from './hexToString/hexToString.js';
package/src/isMobile.cjs CHANGED
@@ -65,6 +65,16 @@ const isSamsungBrowser = () => {
65
65
  }
66
66
  return navigator.userAgent.includes('SamsungBrowser');
67
67
  };
68
+ const isSafariBrowser = () => {
69
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
70
+ return false;
71
+ }
72
+ const { userAgent } = navigator;
73
+ const isSafari = userAgent.includes('Safari') &&
74
+ !userAgent.includes('Chrome') &&
75
+ !userAgent.includes('Chromium');
76
+ return isSafari;
77
+ };
68
78
  const isWindows = () => {
69
79
  if (typeof window === 'undefined' || typeof navigator === 'undefined') {
70
80
  return false;
@@ -142,5 +152,6 @@ exports.isIPhone = isIPhone;
142
152
  exports.isIPhone8OrEarlier = isIPhone8OrEarlier;
143
153
  exports.isLegacySafari = isLegacySafari;
144
154
  exports.isMobile = isMobile;
155
+ exports.isSafariBrowser = isSafariBrowser;
145
156
  exports.isSamsungBrowser = isSamsungBrowser;
146
157
  exports.isWindows = isWindows;
package/src/isMobile.d.ts CHANGED
@@ -14,5 +14,6 @@ export declare const isIOS: (maxTouchPointsOverride?: number) => boolean;
14
14
  export declare const isAndroid: () => boolean;
15
15
  export declare const isLegacySafari: () => boolean;
16
16
  export declare const isSamsungBrowser: () => boolean;
17
+ export declare const isSafariBrowser: () => boolean;
17
18
  export declare const isWindows: () => boolean;
18
19
  export declare const getAndroidVersion: () => number | undefined;
package/src/isMobile.js CHANGED
@@ -61,6 +61,16 @@ const isSamsungBrowser = () => {
61
61
  }
62
62
  return navigator.userAgent.includes('SamsungBrowser');
63
63
  };
64
+ const isSafariBrowser = () => {
65
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
66
+ return false;
67
+ }
68
+ const { userAgent } = navigator;
69
+ const isSafari = userAgent.includes('Safari') &&
70
+ !userAgent.includes('Chrome') &&
71
+ !userAgent.includes('Chromium');
72
+ return isSafari;
73
+ };
64
74
  const isWindows = () => {
65
75
  if (typeof window === 'undefined' || typeof navigator === 'undefined') {
66
76
  return false;
@@ -130,4 +140,4 @@ const getAndroidVersion = () => {
130
140
  return androidVersion;
131
141
  };
132
142
 
133
- export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows };
143
+ export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSafariBrowser, isSamsungBrowser, isWindows };
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Represents the value that separates the random string from the
8
+ * mobile deeplink URL in the state param from the oauth messages
9
+ * emitted from native mobile apps.
10
+ */
11
+ const nativeMobileOauthStateParam = '_client-redirect:';
12
+
13
+ exports.nativeMobileOauthStateParam = nativeMobileOauthStateParam;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Represents the value that separates the random string from the
3
+ * mobile deeplink URL in the state param from the oauth messages
4
+ * emitted from native mobile apps.
5
+ */
6
+ export declare const nativeMobileOauthStateParam = "_client-redirect:";
7
+ /**
8
+ * Represents the format of the state variable exchanged in oauth2 messages
9
+ * by native mobile devices.
10
+ *
11
+ * It has a random state string followed byt the client redirect URL as configured
12
+ * in the Client.
13
+ */
14
+ export type NativeMobileOauthState = `${string}${typeof nativeMobileOauthStateParam}${string}`;
@@ -0,0 +1,9 @@
1
+ 'use client'
2
+ /**
3
+ * Represents the value that separates the random string from the
4
+ * mobile deeplink URL in the state param from the oauth messages
5
+ * emitted from native mobile apps.
6
+ */
7
+ const nativeMobileOauthStateParam = '_client-redirect:';
8
+
9
+ export { nativeMobileOauthStateParam };
@@ -4,12 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../_virtual/_tslib.cjs');
7
- require('./errors/InsufficientFundsError.cjs');
8
- require('./errors/TransactionGasCannotBeSponsoredError.cjs');
9
- require('./logger/logger.cjs');
10
- require('./bufferPolyfill.cjs');
11
7
  var sleep = require('./sleep/sleep.cjs');
12
- require('tldts');
13
8
 
14
9
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
15
10
  const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
@@ -67,6 +62,7 @@ const retryableFn = (fn_1, ...args_1) => _tslib.__awaiter(void 0, [fn_1, ...args
67
62
  fallbackValue,
68
63
  logger,
69
64
  maxRetries,
65
+ retryIntervalMs,
70
66
  retryStrategy,
71
67
  timeoutMs,
72
68
  });
@@ -1,11 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../_virtual/_tslib.js';
3
- import './errors/InsufficientFundsError.js';
4
- import './errors/TransactionGasCannotBeSponsoredError.js';
5
- import './logger/logger.js';
6
- import './bufferPolyfill.js';
7
3
  import { sleep } from './sleep/sleep.js';
8
- import 'tldts';
9
4
 
10
5
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
11
6
  const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], void 0, function* (fn, options = {}) {
@@ -63,6 +58,7 @@ const retryableFn = (fn_1, ...args_1) => __awaiter(void 0, [fn_1, ...args_1], vo
63
58
  fallbackValue,
64
59
  logger,
65
60
  maxRetries,
61
+ retryIntervalMs,
66
62
  retryStrategy,
67
63
  timeoutMs,
68
64
  });
@@ -3,22 +3,27 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var _tslib = require('../../../_virtual/_tslib.cjs');
7
+
8
+ var _a, _FetchService_implementation;
6
9
  /**
7
10
  * Class implementing the fetch service with a configurable fetch implementation.
8
11
  */
9
12
  class FetchService {
10
13
  static get implementation() {
11
- if (!FetchService._implementation) {
14
+ if (!_tslib.__classPrivateFieldGet(_a, _a, "f", _FetchService_implementation)) {
12
15
  return { fetch: window.fetch.bind(window) };
13
16
  }
14
- return FetchService._implementation;
17
+ return _tslib.__classPrivateFieldGet(_a, _a, "f", _FetchService_implementation);
15
18
  }
16
- static setImplementation(implementation) {
17
- FetchService._implementation = implementation;
19
+ static set implementation(implementation) {
20
+ _tslib.__classPrivateFieldSet(_a, _a, implementation, "f", _FetchService_implementation);
18
21
  }
19
22
  static get fetch() {
20
- return FetchService.implementation.fetch;
23
+ return _a.implementation.fetch;
21
24
  }
22
25
  }
26
+ _a = FetchService;
27
+ _FetchService_implementation = { value: void 0 };
23
28
 
24
29
  exports.FetchService = FetchService;
@@ -3,8 +3,8 @@ import { IFetchService } from './types';
3
3
  * Class implementing the fetch service with a configurable fetch implementation.
4
4
  */
5
5
  export declare class FetchService {
6
- static _implementation: IFetchService;
6
+ #private;
7
7
  static get implementation(): IFetchService;
8
- static setImplementation(implementation: IFetchService): void;
8
+ static set implementation(implementation: IFetchService);
9
9
  static get fetch(): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
10
10
  }