@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.
- package/CHANGELOG.md +585 -0
- package/_virtual/_tslib.cjs +15 -0
- package/_virtual/_tslib.js +14 -1
- package/package.json +4 -4
- 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 +15 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +8 -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 +38 -13
- package/src/services/PlatformService/PlatformService.d.ts +25 -3
- package/src/services/PlatformService/PlatformService.js +40 -15
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +1 -3
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +1 -3
- package/src/services/PlatformService/types.d.ts +5 -4
|
@@ -3,37 +3,62 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
6
7
|
var createBrowserPlatformService = require('./createBrowserPlatformService/createBrowserPlatformService.cjs');
|
|
7
8
|
|
|
9
|
+
var _a, _PlatformService_implementation;
|
|
8
10
|
class PlatformService {
|
|
9
11
|
static get implementation() {
|
|
10
|
-
if (!
|
|
12
|
+
if (!_tslib.__classPrivateFieldGet(_a, _a, "f", _PlatformService_implementation)) {
|
|
11
13
|
return createBrowserPlatformService.createBrowserPlatformService(window);
|
|
12
14
|
}
|
|
13
|
-
return
|
|
15
|
+
return _tslib.__classPrivateFieldGet(_a, _a, "f", _PlatformService_implementation);
|
|
14
16
|
}
|
|
15
|
-
static
|
|
16
|
-
|
|
17
|
+
static set implementation(implementation) {
|
|
18
|
+
_tslib.__classPrivateFieldSet(_a, _a, implementation, "f", _PlatformService_implementation);
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Indicates if the current platform is a native mobile app
|
|
22
|
+
* like react-native or flutter.
|
|
23
|
+
*/
|
|
24
|
+
static get isNativeMobile() {
|
|
25
|
+
return _a.implementation.isNativeMobile;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the origin of the current location.
|
|
29
|
+
*
|
|
30
|
+
* @example window.location.origin
|
|
31
|
+
*/
|
|
18
32
|
static get getOrigin() {
|
|
19
|
-
return
|
|
33
|
+
return _a.implementation.getOrigin;
|
|
20
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the host of the current location.
|
|
37
|
+
*
|
|
38
|
+
* @example window.location.host
|
|
39
|
+
*/
|
|
21
40
|
static get getHost() {
|
|
22
|
-
return
|
|
41
|
+
return _a.implementation.getHost;
|
|
23
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the hostname of the current location.
|
|
45
|
+
*
|
|
46
|
+
* @example window.location.hostname
|
|
47
|
+
*/
|
|
24
48
|
static get getHostname() {
|
|
25
|
-
return
|
|
49
|
+
return _a.implementation.getHostname;
|
|
26
50
|
}
|
|
27
51
|
static get getTLD() {
|
|
28
|
-
return
|
|
52
|
+
return _a.implementation.getTLD;
|
|
29
53
|
}
|
|
30
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Opens a URL. If possible, should avoid new windows.
|
|
56
|
+
*/
|
|
31
57
|
static get openURL() {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
static get openNewWindow() {
|
|
35
|
-
return PlatformService.implementation.openNewWindow;
|
|
58
|
+
return _a.implementation.openURL;
|
|
36
59
|
}
|
|
37
60
|
}
|
|
61
|
+
_a = PlatformService;
|
|
62
|
+
_PlatformService_implementation = { value: void 0 };
|
|
38
63
|
|
|
39
64
|
exports.PlatformService = PlatformService;
|
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
import { IPlatformService } from './types';
|
|
2
2
|
export declare class PlatformService {
|
|
3
|
-
|
|
3
|
+
#private;
|
|
4
4
|
static get implementation(): IPlatformService;
|
|
5
|
-
static
|
|
5
|
+
static set implementation(implementation: IPlatformService);
|
|
6
|
+
/**
|
|
7
|
+
* Indicates if the current platform is a native mobile app
|
|
8
|
+
* like react-native or flutter.
|
|
9
|
+
*/
|
|
10
|
+
static get isNativeMobile(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the origin of the current location.
|
|
13
|
+
*
|
|
14
|
+
* @example window.location.origin
|
|
15
|
+
*/
|
|
6
16
|
static get getOrigin(): () => string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the host of the current location.
|
|
19
|
+
*
|
|
20
|
+
* @example window.location.host
|
|
21
|
+
*/
|
|
7
22
|
static get getHost(): () => string;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the hostname of the current location.
|
|
25
|
+
*
|
|
26
|
+
* @example window.location.hostname
|
|
27
|
+
*/
|
|
8
28
|
static get getHostname(): () => string;
|
|
9
29
|
static get getTLD(): () => string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Opens a URL. If possible, should avoid new windows.
|
|
32
|
+
*/
|
|
10
33
|
static get openURL(): (url: string) => Promise<void>;
|
|
11
|
-
static get openNewWindow(): (url: string) => Promise<void>;
|
|
12
34
|
}
|
|
@@ -1,35 +1,60 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../_virtual/_tslib.js';
|
|
2
3
|
import { createBrowserPlatformService } from './createBrowserPlatformService/createBrowserPlatformService.js';
|
|
3
4
|
|
|
5
|
+
var _a, _PlatformService_implementation;
|
|
4
6
|
class PlatformService {
|
|
5
7
|
static get implementation() {
|
|
6
|
-
if (!
|
|
8
|
+
if (!__classPrivateFieldGet(_a, _a, "f", _PlatformService_implementation)) {
|
|
7
9
|
return createBrowserPlatformService(window);
|
|
8
10
|
}
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
-
}
|
|
11
|
+
return __classPrivateFieldGet(_a, _a, "f", _PlatformService_implementation);
|
|
12
|
+
}
|
|
13
|
+
static set implementation(implementation) {
|
|
14
|
+
__classPrivateFieldSet(_a, _a, implementation, "f", _PlatformService_implementation);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Indicates if the current platform is a native mobile app
|
|
18
|
+
* like react-native or flutter.
|
|
19
|
+
*/
|
|
20
|
+
static get isNativeMobile() {
|
|
21
|
+
return _a.implementation.isNativeMobile;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Gets the origin of the current location.
|
|
25
|
+
*
|
|
26
|
+
* @example window.location.origin
|
|
27
|
+
*/
|
|
14
28
|
static get getOrigin() {
|
|
15
|
-
return
|
|
29
|
+
return _a.implementation.getOrigin;
|
|
16
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Gets the host of the current location.
|
|
33
|
+
*
|
|
34
|
+
* @example window.location.host
|
|
35
|
+
*/
|
|
17
36
|
static get getHost() {
|
|
18
|
-
return
|
|
37
|
+
return _a.implementation.getHost;
|
|
19
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the hostname of the current location.
|
|
41
|
+
*
|
|
42
|
+
* @example window.location.hostname
|
|
43
|
+
*/
|
|
20
44
|
static get getHostname() {
|
|
21
|
-
return
|
|
45
|
+
return _a.implementation.getHostname;
|
|
22
46
|
}
|
|
23
47
|
static get getTLD() {
|
|
24
|
-
return
|
|
48
|
+
return _a.implementation.getTLD;
|
|
25
49
|
}
|
|
26
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Opens a URL. If possible, should avoid new windows.
|
|
52
|
+
*/
|
|
27
53
|
static get openURL() {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
static get openNewWindow() {
|
|
31
|
-
return PlatformService.implementation.openNewWindow;
|
|
54
|
+
return _a.implementation.openURL;
|
|
32
55
|
}
|
|
33
56
|
}
|
|
57
|
+
_a = PlatformService;
|
|
58
|
+
_PlatformService_implementation = { value: void 0 };
|
|
34
59
|
|
|
35
60
|
export { PlatformService };
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs
CHANGED
|
@@ -22,9 +22,7 @@ const createBrowserPlatformService = (window) => ({
|
|
|
22
22
|
});
|
|
23
23
|
return data.domain || undefined;
|
|
24
24
|
},
|
|
25
|
-
|
|
26
|
-
window.open(url);
|
|
27
|
-
}),
|
|
25
|
+
isNativeMobile: false,
|
|
28
26
|
openURL: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
27
|
window.location.assign(url);
|
|
30
28
|
}),
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js
CHANGED
|
@@ -18,9 +18,7 @@ const createBrowserPlatformService = (window) => ({
|
|
|
18
18
|
});
|
|
19
19
|
return data.domain || undefined;
|
|
20
20
|
},
|
|
21
|
-
|
|
22
|
-
window.open(url);
|
|
23
|
-
}),
|
|
21
|
+
isNativeMobile: false,
|
|
24
22
|
openURL: (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
23
|
window.location.assign(url);
|
|
26
24
|
}),
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export interface IPlatformService {
|
|
2
|
+
/**
|
|
3
|
+
* Indicates if the current platform is a native mobile app
|
|
4
|
+
* like react-native or flutter.
|
|
5
|
+
*/
|
|
6
|
+
isNativeMobile: boolean;
|
|
2
7
|
/**
|
|
3
8
|
* Gets the hostname of the current location.
|
|
4
9
|
*
|
|
@@ -22,8 +27,4 @@ export interface IPlatformService {
|
|
|
22
27
|
* Opens a URL. If possible, should avoid new windows.
|
|
23
28
|
*/
|
|
24
29
|
openURL(url: string): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Opens a given URL in a new window.
|
|
27
|
-
*/
|
|
28
|
-
openNewWindow(url: string): Promise<void>;
|
|
29
30
|
}
|