@dynamic-labs/utils 3.0.0-alpha.8 → 3.0.0
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/CHANGELOG.md +622 -0
- package/_virtual/_tslib.cjs +15 -0
- package/_virtual/_tslib.js +14 -1
- package/package.json +5 -4
- package/src/cloneObjectWithOverrides/cloneObjectWithOverrides.cjs +37 -0
- package/src/cloneObjectWithOverrides/cloneObjectWithOverrides.d.ts +11 -0
- package/src/cloneObjectWithOverrides/cloneObjectWithOverrides.js +33 -0
- package/src/cloneObjectWithOverrides/index.d.ts +1 -0
- package/src/errors/MfaInvalidOtpError.cjs +1 -1
- package/src/errors/MfaInvalidOtpError.js +1 -1
- package/src/errors/MfaRateLimitedError.cjs +14 -0
- package/src/errors/MfaRateLimitedError.d.ts +4 -0
- package/src/errors/MfaRateLimitedError.js +10 -0
- package/src/errors/NoAccessError.cjs +3 -1
- package/src/errors/NoAccessError.d.ts +5 -1
- package/src/errors/NoAccessError.js +3 -1
- package/src/errors/SandboxMaximumThresholdReachedError.cjs +15 -0
- package/src/errors/SandboxMaximumThresholdReachedError.d.ts +5 -0
- package/src/errors/SandboxMaximumThresholdReachedError.js +11 -0
- package/src/errors/UserRejectedRequestError.cjs +14 -0
- package/src/errors/UserRejectedRequestError.d.ts +4 -0
- package/src/errors/UserRejectedRequestError.js +10 -0
- package/src/errors/WalletAddressMismatchError.cjs +17 -0
- package/src/errors/WalletAddressMismatchError.d.ts +11 -0
- package/src/errors/WalletAddressMismatchError.js +13 -0
- package/src/errors/index.d.ts +4 -0
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +0 -6
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +0 -6
- package/src/index.cjs +21 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +11 -1
- package/src/isMobile.cjs +11 -0
- package/src/isMobile.d.ts +1 -0
- package/src/isMobile.js +11 -1
- package/src/nativeMobileOauthStateParam.cjs +13 -0
- package/src/nativeMobileOauthStateParam.d.ts +14 -0
- package/src/nativeMobileOauthStateParam.js +9 -0
- package/src/retryableFn.cjs +1 -5
- package/src/retryableFn.js +1 -5
- package/src/services/FetchService/FetchService.cjs +10 -5
- package/src/services/FetchService/FetchService.d.ts +2 -2
- package/src/services/FetchService/FetchService.js +10 -5
- package/src/services/Oauth2Service/Oauth2Service.cjs +38 -0
- package/src/services/Oauth2Service/Oauth2Service.d.ts +41 -0
- package/src/services/Oauth2Service/Oauth2Service.js +34 -0
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs +176 -0
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.d.ts +2 -0
- package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js +172 -0
- package/src/services/Oauth2Service/createWindowOauth2Service/index.d.ts +1 -0
- package/src/services/Oauth2Service/index.d.ts +2 -0
- package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.cjs +26 -0
- package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.d.ts +7 -0
- package/src/services/Oauth2Service/utils/connectWithAppleId/connectWithAppleId.js +22 -0
- package/src/services/Oauth2Service/utils/connectWithAppleId/index.d.ts +1 -0
- package/src/services/Oauth2Service/utils/loadAppleId/index.d.ts +1 -0
- package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.cjs +34 -0
- package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.d.ts +1 -0
- package/src/services/Oauth2Service/utils/loadAppleId/loadAppleId.js +30 -0
- package/src/services/PlatformService/PlatformService.cjs +46 -13
- package/src/services/PlatformService/PlatformService.d.ts +31 -3
- package/src/services/PlatformService/PlatformService.js +46 -13
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +2 -3
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +2 -3
- package/src/services/PlatformService/types.d.ts +11 -4
- package/src/services/StorageService/StorageService.cjs +59 -0
- package/src/services/StorageService/StorageService.d.ts +30 -0
- package/src/services/StorageService/StorageService.js +51 -0
- package/src/services/StorageService/createStorageService/createStorageService.cjs +46 -0
- package/src/services/StorageService/createStorageService/createStorageService.d.ts +7 -0
- package/src/services/StorageService/createStorageService/createStorageService.js +42 -0
- package/src/services/StorageService/createStorageService/index.d.ts +1 -0
- package/src/services/StorageService/index.d.ts +3 -0
- package/src/services/StorageService/types.d.ts +6 -0
package/_virtual/_tslib.cjs
CHANGED
|
@@ -28,9 +28,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
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");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
38
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
39
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
40
|
+
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");
|
|
41
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
42
|
+
}
|
|
43
|
+
|
|
31
44
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
32
45
|
var e = new Error(message);
|
|
33
46
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
34
47
|
};
|
|
35
48
|
|
|
36
49
|
exports.__awaiter = __awaiter;
|
|
50
|
+
exports.__classPrivateFieldGet = __classPrivateFieldGet;
|
|
51
|
+
exports.__classPrivateFieldSet = __classPrivateFieldSet;
|
package/_virtual/_tslib.js
CHANGED
|
@@ -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
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
29
|
+
"@dynamic-labs/sdk-api-core": "0.0.529",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "3.0.0
|
|
32
|
-
"@dynamic-labs/types": "3.0.0
|
|
31
|
+
"@dynamic-labs/logger": "3.0.0",
|
|
32
|
+
"@dynamic-labs/types": "3.0.0",
|
|
33
33
|
"buffer": "6.0.3",
|
|
34
|
+
"eventemitter3": "5.0.1",
|
|
34
35
|
"stream": "0.0.2"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Clones an object and includes properties with `enumerable: false`, unlike the spread
|
|
8
|
+
* operator which will leave these properties out.
|
|
9
|
+
*
|
|
10
|
+
* Optionally pass in overrides to apply to the cloned object.
|
|
11
|
+
*
|
|
12
|
+
* @param original The object to clone
|
|
13
|
+
* @param overrides An object containing properties to override on the cloned object
|
|
14
|
+
* @returns A new object that is a clone of the original object with the specified overrides
|
|
15
|
+
*/
|
|
16
|
+
const cloneObjectWithOverrides = (original, overrides = {}) => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
// Get the property descriptors from the original object
|
|
19
|
+
const descriptors = Object.getOwnPropertyDescriptors(original);
|
|
20
|
+
// Create a new object using the same prototype as the original
|
|
21
|
+
const clone = Object.create(Object.getPrototypeOf(original), descriptors);
|
|
22
|
+
// // Loop through the overrides to redefine any read-only methods
|
|
23
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
24
|
+
// Redefine the method even if it was read-only on the original object
|
|
25
|
+
Object.defineProperty(clone, key, {
|
|
26
|
+
// Make it writable if necessary
|
|
27
|
+
configurable: true,
|
|
28
|
+
// Allow future modifications
|
|
29
|
+
enumerable: (_b = (_a = descriptors[key]) === null || _a === void 0 ? void 0 : _a.enumerable) !== null && _b !== void 0 ? _b : true,
|
|
30
|
+
value: value,
|
|
31
|
+
writable: true, // Preserve enumerability
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return clone;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.cloneObjectWithOverrides = cloneObjectWithOverrides;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clones an object and includes properties with `enumerable: false`, unlike the spread
|
|
3
|
+
* operator which will leave these properties out.
|
|
4
|
+
*
|
|
5
|
+
* Optionally pass in overrides to apply to the cloned object.
|
|
6
|
+
*
|
|
7
|
+
* @param original The object to clone
|
|
8
|
+
* @param overrides An object containing properties to override on the cloned object
|
|
9
|
+
* @returns A new object that is a clone of the original object with the specified overrides
|
|
10
|
+
*/
|
|
11
|
+
export declare const cloneObjectWithOverrides: (original: object, overrides?: {}) => any;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Clones an object and includes properties with `enumerable: false`, unlike the spread
|
|
4
|
+
* operator which will leave these properties out.
|
|
5
|
+
*
|
|
6
|
+
* Optionally pass in overrides to apply to the cloned object.
|
|
7
|
+
*
|
|
8
|
+
* @param original The object to clone
|
|
9
|
+
* @param overrides An object containing properties to override on the cloned object
|
|
10
|
+
* @returns A new object that is a clone of the original object with the specified overrides
|
|
11
|
+
*/
|
|
12
|
+
const cloneObjectWithOverrides = (original, overrides = {}) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
// Get the property descriptors from the original object
|
|
15
|
+
const descriptors = Object.getOwnPropertyDescriptors(original);
|
|
16
|
+
// Create a new object using the same prototype as the original
|
|
17
|
+
const clone = Object.create(Object.getPrototypeOf(original), descriptors);
|
|
18
|
+
// // Loop through the overrides to redefine any read-only methods
|
|
19
|
+
for (const [key, value] of Object.entries(overrides)) {
|
|
20
|
+
// Redefine the method even if it was read-only on the original object
|
|
21
|
+
Object.defineProperty(clone, key, {
|
|
22
|
+
// Make it writable if necessary
|
|
23
|
+
configurable: true,
|
|
24
|
+
// Allow future modifications
|
|
25
|
+
enumerable: (_b = (_a = descriptors[key]) === null || _a === void 0 ? void 0 : _a.enumerable) !== null && _b !== void 0 ? _b : true,
|
|
26
|
+
value: value,
|
|
27
|
+
writable: true, // Preserve enumerability
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return clone;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { cloneObjectWithOverrides };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cloneObjectWithOverrides';
|
|
@@ -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;
|
|
@@ -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
|
-
|
|
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,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,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 };
|
package/src/errors/index.d.ts
CHANGED
|
@@ -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,15 +59,21 @@ 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');
|
|
66
73
|
var isHex = require('./isHex/isHex.cjs');
|
|
74
|
+
var StorageService = require('./services/StorageService/StorageService.cjs');
|
|
75
|
+
var createStorageService = require('./services/StorageService/createStorageService/createStorageService.cjs');
|
|
76
|
+
var cloneObjectWithOverrides = require('./cloneObjectWithOverrides/cloneObjectWithOverrides.cjs');
|
|
67
77
|
|
|
68
78
|
|
|
69
79
|
|
|
@@ -71,6 +81,7 @@ exports.parseChainId = parseChainId.parseChainId;
|
|
|
71
81
|
exports.parseEvmNetworks = parseEvmNetworks.parseEvmNetworks;
|
|
72
82
|
exports.AccountExistsError = AccountExistsError.AccountExistsError;
|
|
73
83
|
exports.ChainalysisError = ChainalysisError.ChainalysisError;
|
|
84
|
+
exports.SandboxMaximumThresholdReachedError = SandboxMaximumThresholdReachedError.SandboxMaximumThresholdReachedError;
|
|
74
85
|
exports.CustomError = CustomError.CustomError;
|
|
75
86
|
exports.DynamicError = DynamicError.DynamicError;
|
|
76
87
|
exports.EmailAlreadyExistsError = EmailAlreadyExistsError.EmailAlreadyExistsError;
|
|
@@ -99,7 +110,10 @@ exports.CookieInvalidError = CookieInvalidError.CookieInvalidError;
|
|
|
99
110
|
exports.AccessBlockedError = AccessBlockedError.AccessBlockedError;
|
|
100
111
|
exports.EmbeddedWalletException = EmbeddedWalletException.EmbeddedWalletException;
|
|
101
112
|
exports.MfaInvalidOtpError = MfaInvalidOtpError.MfaInvalidOtpError;
|
|
113
|
+
exports.MfaRateLimitedError = MfaRateLimitedError.MfaRateLimitedError;
|
|
102
114
|
exports.ExternalAuthError = ExternalAuthError.ExternalAuthError;
|
|
115
|
+
exports.WalletAddressMismatchError = WalletAddressMismatchError.WalletAddressMismatchError;
|
|
116
|
+
exports.UserRejectedRequestError = UserRejectedRequestError.UserRejectedRequestError;
|
|
103
117
|
exports.CancellablePromise = CancellablePromise.CancellablePromise;
|
|
104
118
|
exports.isFunction = isFunction.isFunction;
|
|
105
119
|
exports.getAndroidVersion = isMobile.getAndroidVersion;
|
|
@@ -110,6 +124,7 @@ exports.isIPhone = isMobile.isIPhone;
|
|
|
110
124
|
exports.isIPhone8OrEarlier = isMobile.isIPhone8OrEarlier;
|
|
111
125
|
exports.isLegacySafari = isMobile.isLegacySafari;
|
|
112
126
|
exports.isMobile = isMobile.isMobile;
|
|
127
|
+
exports.isSafariBrowser = isMobile.isSafariBrowser;
|
|
113
128
|
exports.isSamsungBrowser = isMobile.isSamsungBrowser;
|
|
114
129
|
exports.isWindows = isMobile.isWindows;
|
|
115
130
|
exports.getItemAsync = localStorageAsync.getItemAsync;
|
|
@@ -131,13 +146,19 @@ exports.formatNumberText = formatNumberText.formatNumberText;
|
|
|
131
146
|
exports.ceil = ceil.ceil;
|
|
132
147
|
exports.trimEnd = trimEnd.trimEnd;
|
|
133
148
|
exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
|
|
149
|
+
exports.nativeMobileOauthStateParam = nativeMobileOauthStateParam.nativeMobileOauthStateParam;
|
|
134
150
|
exports.Eip6963Provider = eip6963Provider.Eip6963Provider;
|
|
135
151
|
exports.Eip6963ProviderSingleton = eip6963Provider.Eip6963ProviderSingleton;
|
|
136
152
|
exports.runSafe = runSafe.runSafe;
|
|
137
153
|
exports.PlatformService = PlatformService.PlatformService;
|
|
138
154
|
exports.createBrowserPlatformService = createBrowserPlatformService.createBrowserPlatformService;
|
|
139
155
|
exports.FetchService = FetchService.FetchService;
|
|
156
|
+
exports.Oauth2Service = Oauth2Service.Oauth2Service;
|
|
157
|
+
exports.createWindowOauth2Service = createWindowOauth2Service.createWindowOauth2Service;
|
|
140
158
|
exports.template = template.template;
|
|
141
159
|
exports.get = get.get;
|
|
142
160
|
exports.hexToString = hexToString.hexToString;
|
|
143
161
|
exports.isHex = isHex.isHex;
|
|
162
|
+
exports.StorageService = StorageService.StorageService;
|
|
163
|
+
exports.createStorageService = createStorageService.createStorageService;
|
|
164
|
+
exports.cloneObjectWithOverrides = cloneObjectWithOverrides.cloneObjectWithOverrides;
|
package/src/index.d.ts
CHANGED
|
@@ -20,11 +20,15 @@ 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';
|
|
30
32
|
export { isHex } from './isHex';
|
|
33
|
+
export { type IStorageService, type StorageOptions, StorageService, createStorageService, } from './services/StorageService';
|
|
34
|
+
export { cloneObjectWithOverrides } from './cloneObjectWithOverrides';
|
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,12 +55,18 @@ 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';
|
|
62
69
|
export { isHex } from './isHex/isHex.js';
|
|
70
|
+
export { StorageService } from './services/StorageService/StorageService.js';
|
|
71
|
+
export { createStorageService } from './services/StorageService/createStorageService/createStorageService.js';
|
|
72
|
+
export { cloneObjectWithOverrides } from './cloneObjectWithOverrides/cloneObjectWithOverrides.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;
|