@dynamic-labs/utils 2.1.0-alpha.26 → 2.1.0-alpha.28
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 +19 -0
- package/package.json +3 -3
- package/src/services/FetchService/FetchService.cjs +1 -1
- package/src/services/FetchService/FetchService.js +1 -1
- package/src/services/PlatformService/PlatformService.cjs +7 -0
- package/src/services/PlatformService/PlatformService.d.ts +2 -0
- package/src/services/PlatformService/PlatformService.js +7 -0
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +2 -0
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +2 -0
- package/src/services/PlatformService/types.d.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.28](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.27...v2.1.0-alpha.28) (2024-05-29)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* adds solana standard wallet connector ([#5752](https://github.com/dynamic-labs/DynamicAuth/issues/5752)) ([0040940](https://github.com/dynamic-labs/DynamicAuth/commit/0040940fd1adb37ab3106bb0e4dfe79403bc41f2))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* farcaster fetch url fix ([#5767](https://github.com/dynamic-labs/DynamicAuth/issues/5767)) ([1408ba9](https://github.com/dynamic-labs/DynamicAuth/commit/1408ba92680363b9db7820a63d5e3d15dc26ad22))
|
|
13
|
+
|
|
14
|
+
## [2.1.0-alpha.27](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.26...v2.1.0-alpha.27) (2024-05-29)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* coinbase connection ([#5764](https://github.com/dynamic-labs/DynamicAuth/issues/5764)) ([aeacd1c](https://github.com/dynamic-labs/DynamicAuth/commit/aeacd1c55dc471fbf8c14eb05ab356b0a90aa239))
|
|
20
|
+
|
|
2
21
|
## [2.1.0-alpha.26](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.25...v2.1.0-alpha.26) (2024-05-29)
|
|
3
22
|
|
|
4
23
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/utils",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@dynamic-labs/sdk-api-core": "0.0.453",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "2.1.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "2.1.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "2.1.0-alpha.28",
|
|
32
|
+
"@dynamic-labs/types": "2.1.0-alpha.28",
|
|
33
33
|
"buffer": "6.0.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
class FetchService {
|
|
10
10
|
static get implementation() {
|
|
11
11
|
if (!FetchService._implementation) {
|
|
12
|
-
return { fetch: window.fetch };
|
|
12
|
+
return { fetch: window.fetch.bind(window) };
|
|
13
13
|
}
|
|
14
14
|
return FetchService._implementation;
|
|
15
15
|
}
|
|
@@ -15,12 +15,19 @@ class PlatformService {
|
|
|
15
15
|
static setImplementation(implementation) {
|
|
16
16
|
PlatformService._implementation = implementation;
|
|
17
17
|
}
|
|
18
|
+
static get getOrigin() {
|
|
19
|
+
return PlatformService.implementation.getOrigin;
|
|
20
|
+
}
|
|
21
|
+
static get getHost() {
|
|
22
|
+
return PlatformService.implementation.getHost;
|
|
23
|
+
}
|
|
18
24
|
static get getHostname() {
|
|
19
25
|
return PlatformService.implementation.getHostname;
|
|
20
26
|
}
|
|
21
27
|
static get getTLD() {
|
|
22
28
|
return PlatformService.implementation.getTLD;
|
|
23
29
|
}
|
|
30
|
+
// Deeplink handling
|
|
24
31
|
static get openURL() {
|
|
25
32
|
return PlatformService.implementation.openURL;
|
|
26
33
|
}
|
|
@@ -3,6 +3,8 @@ export declare class PlatformService {
|
|
|
3
3
|
static _implementation: IPlatformService;
|
|
4
4
|
static get implementation(): IPlatformService;
|
|
5
5
|
static setImplementation(implementation: IPlatformService): void;
|
|
6
|
+
static get getOrigin(): () => string;
|
|
7
|
+
static get getHost(): () => string;
|
|
6
8
|
static get getHostname(): () => string;
|
|
7
9
|
static get getTLD(): () => string | undefined;
|
|
8
10
|
static get openURL(): (url: string) => Promise<void>;
|
|
@@ -11,12 +11,19 @@ class PlatformService {
|
|
|
11
11
|
static setImplementation(implementation) {
|
|
12
12
|
PlatformService._implementation = implementation;
|
|
13
13
|
}
|
|
14
|
+
static get getOrigin() {
|
|
15
|
+
return PlatformService.implementation.getOrigin;
|
|
16
|
+
}
|
|
17
|
+
static get getHost() {
|
|
18
|
+
return PlatformService.implementation.getHost;
|
|
19
|
+
}
|
|
14
20
|
static get getHostname() {
|
|
15
21
|
return PlatformService.implementation.getHostname;
|
|
16
22
|
}
|
|
17
23
|
static get getTLD() {
|
|
18
24
|
return PlatformService.implementation.getTLD;
|
|
19
25
|
}
|
|
26
|
+
// Deeplink handling
|
|
20
27
|
static get openURL() {
|
|
21
28
|
return PlatformService.implementation.openURL;
|
|
22
29
|
}
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs
CHANGED
|
@@ -7,7 +7,9 @@ var _tslib = require('../../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
var tldts = require('tldts');
|
|
8
8
|
|
|
9
9
|
const createBrowserPlatformService = (window) => ({
|
|
10
|
+
getHost: () => window.location.host,
|
|
10
11
|
getHostname: () => window.location.hostname,
|
|
12
|
+
getOrigin: () => window.location.origin,
|
|
11
13
|
getTLD: () => {
|
|
12
14
|
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
13
15
|
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js
CHANGED
|
@@ -3,7 +3,9 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { parse } from 'tldts';
|
|
4
4
|
|
|
5
5
|
const createBrowserPlatformService = (window) => ({
|
|
6
|
+
getHost: () => window.location.host,
|
|
6
7
|
getHostname: () => window.location.hostname,
|
|
8
|
+
getOrigin: () => window.location.origin,
|
|
7
9
|
getTLD: () => {
|
|
8
10
|
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
9
11
|
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
|
@@ -5,6 +5,18 @@ export interface IPlatformService {
|
|
|
5
5
|
* @example window.location.hostname
|
|
6
6
|
*/
|
|
7
7
|
getHostname(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Gets the host of the current location.
|
|
10
|
+
*
|
|
11
|
+
* @example window.location.host
|
|
12
|
+
*/
|
|
13
|
+
getHost(): string;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the origin of the current location.
|
|
16
|
+
*
|
|
17
|
+
* @example window.location.origin
|
|
18
|
+
*/
|
|
19
|
+
getOrigin(): string;
|
|
8
20
|
getTLD(): string | undefined;
|
|
9
21
|
/**
|
|
10
22
|
* Opens a URL. If possible, should avoid new windows.
|