@dynamic-labs/utils 3.0.0-alpha.14 → 3.0.0-alpha.16
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 +28 -0
- package/_virtual/_tslib.cjs +15 -0
- package/_virtual/_tslib.js +14 -1
- package/package.json +3 -3
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +2 -0
- package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +2 -0
- package/src/index.cjs +2 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/nativeMobileOauthStateParam.cjs +13 -0
- package/src/nativeMobileOauthStateParam.d.ts +14 -0
- package/src/nativeMobileOauthStateParam.js +9 -0
- package/src/retryableFn.cjs +2 -0
- package/src/retryableFn.js +2 -0
- 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 +9 -5
- package/src/services/Oauth2Service/Oauth2Service.d.ts +2 -2
- package/src/services/Oauth2Service/Oauth2Service.js +9 -5
- package/src/services/PlatformService/PlatformService.cjs +13 -12
- package/src/services/PlatformService/PlatformService.d.ts +2 -3
- package/src/services/PlatformService/PlatformService.js +13 -12
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +0 -3
- package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +0 -3
- package/src/services/PlatformService/types.d.ts +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.0.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.15...v3.0.0-alpha.16) (2024-07-11)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### ⚠ BREAKING CHANGES
|
|
6
|
+
|
|
7
|
+
* remove isConnected prop from wallets and have it as a method instead (#6265)
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add bundlerRpc and paymasterRpc parameters to zerodev ([#6304](https://github.com/dynamic-labs/DynamicAuth/issues/6304)) ([156469b](https://github.com/dynamic-labs/DynamicAuth/commit/156469bf703f0c7fa455a24b8e4e328d3a0c58fc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* headless embedded wallet export session refresh ([#6307](https://github.com/dynamic-labs/DynamicAuth/issues/6307)) ([5423cc1](https://github.com/dynamic-labs/DynamicAuth/commit/5423cc14c370968acf718b7deff6ea8df9228189))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
* remove isConnected prop from wallets and have it as a method instead ([#6265](https://github.com/dynamic-labs/DynamicAuth/issues/6265)) ([652dcc2](https://github.com/dynamic-labs/DynamicAuth/commit/652dcc2d34c9a9719238606c67f600e40621183b))
|
|
20
|
+
|
|
21
|
+
## [3.0.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.14...v3.0.0-alpha.15) (2024-07-11)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* catch third party wallet construction errors ([#6268](https://github.com/dynamic-labs/DynamicAuth/issues/6268)) ([badef39](https://github.com/dynamic-labs/DynamicAuth/commit/badef39d753c7d29925c6c8680053027bd99b69b))
|
|
27
|
+
* decode all solana transactions ([#6294](https://github.com/dynamic-labs/DynamicAuth/issues/6294)) ([5220ab2](https://github.com/dynamic-labs/DynamicAuth/commit/5220ab29381f3a7f1afc7043332b5a018b47eb0a))
|
|
28
|
+
* passkey cta ([#6255](https://github.com/dynamic-labs/DynamicAuth/issues/6255)) ([1b1b152](https://github.com/dynamic-labs/DynamicAuth/commit/1b1b152a24b409c5d941a9c92a003daf0bbe48a1))
|
|
29
|
+
|
|
2
30
|
## [3.0.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.13...v3.0.0-alpha.14) (2024-07-09)
|
|
3
31
|
|
|
4
32
|
|
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-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.16",
|
|
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.470",
|
|
30
30
|
"tldts": "6.0.16",
|
|
31
|
-
"@dynamic-labs/logger": "3.0.0-alpha.
|
|
32
|
-
"@dynamic-labs/types": "3.0.0-alpha.
|
|
31
|
+
"@dynamic-labs/logger": "3.0.0-alpha.16",
|
|
32
|
+
"@dynamic-labs/types": "3.0.0-alpha.16",
|
|
33
33
|
"buffer": "6.0.3",
|
|
34
34
|
"stream": "0.0.2"
|
|
35
35
|
},
|
|
@@ -9,7 +9,9 @@ require('../logger/logger.cjs');
|
|
|
9
9
|
var isMobile = require('../isMobile.cjs');
|
|
10
10
|
require('../../_virtual/_tslib.cjs');
|
|
11
11
|
require('../bufferPolyfill.cjs');
|
|
12
|
+
require('../services/PlatformService/PlatformService.cjs');
|
|
12
13
|
require('tldts');
|
|
14
|
+
require('../services/FetchService/FetchService.cjs');
|
|
13
15
|
require('../services/Oauth2Service/Oauth2Service.cjs');
|
|
14
16
|
require('@dynamic-labs/types');
|
|
15
17
|
require('@dynamic-labs/sdk-api-core');
|
|
@@ -5,7 +5,9 @@ import '../logger/logger.js';
|
|
|
5
5
|
import { isSamsungBrowser } from '../isMobile.js';
|
|
6
6
|
import '../../_virtual/_tslib.js';
|
|
7
7
|
import '../bufferPolyfill.js';
|
|
8
|
+
import '../services/PlatformService/PlatformService.js';
|
|
8
9
|
import 'tldts';
|
|
10
|
+
import '../services/FetchService/FetchService.js';
|
|
9
11
|
import '../services/Oauth2Service/Oauth2Service.js';
|
|
10
12
|
import '@dynamic-labs/types';
|
|
11
13
|
import '@dynamic-labs/sdk-api-core';
|
package/src/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ var formatNumberText = require('./formatNumberText/formatNumberText.cjs');
|
|
|
56
56
|
var ceil = require('./ceil/ceil.cjs');
|
|
57
57
|
var trimEnd = require('./trimEnd/trimEnd.cjs');
|
|
58
58
|
var isLedgerAddressViaVerifiedCredentials = require('./isLedgerAddressViaVerifiedCredentials.cjs');
|
|
59
|
+
var nativeMobileOauthStateParam = require('./nativeMobileOauthStateParam.cjs');
|
|
59
60
|
var eip6963Provider = require('./eip6963/eip6963Provider.cjs');
|
|
60
61
|
var runSafe = require('./runSafe/runSafe.cjs');
|
|
61
62
|
var PlatformService = require('./services/PlatformService/PlatformService.cjs');
|
|
@@ -135,6 +136,7 @@ exports.formatNumberText = formatNumberText.formatNumberText;
|
|
|
135
136
|
exports.ceil = ceil.ceil;
|
|
136
137
|
exports.trimEnd = trimEnd.trimEnd;
|
|
137
138
|
exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials.isLedgerAddressViaVerifiedCredentials;
|
|
139
|
+
exports.nativeMobileOauthStateParam = nativeMobileOauthStateParam.nativeMobileOauthStateParam;
|
|
138
140
|
exports.Eip6963Provider = eip6963Provider.Eip6963Provider;
|
|
139
141
|
exports.Eip6963ProviderSingleton = eip6963Provider.Eip6963ProviderSingleton;
|
|
140
142
|
exports.runSafe = runSafe.runSafe;
|
package/src/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ 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';
|
package/src/index.js
CHANGED
|
@@ -52,6 +52,7 @@ export { formatNumberText } from './formatNumberText/formatNumberText.js';
|
|
|
52
52
|
export { ceil } from './ceil/ceil.js';
|
|
53
53
|
export { trimEnd } from './trimEnd/trimEnd.js';
|
|
54
54
|
export { isLedgerAddressViaVerifiedCredentials } from './isLedgerAddressViaVerifiedCredentials.js';
|
|
55
|
+
export { nativeMobileOauthStateParam } from './nativeMobileOauthStateParam.js';
|
|
55
56
|
export { Eip6963Provider, Eip6963ProviderSingleton } from './eip6963/eip6963Provider.js';
|
|
56
57
|
export { runSafe } from './runSafe/runSafe.js';
|
|
57
58
|
export { PlatformService } from './services/PlatformService/PlatformService.js';
|
|
@@ -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 };
|
package/src/retryableFn.cjs
CHANGED
|
@@ -9,7 +9,9 @@ require('./errors/TransactionGasCannotBeSponsoredError.cjs');
|
|
|
9
9
|
require('./logger/logger.cjs');
|
|
10
10
|
require('./bufferPolyfill.cjs');
|
|
11
11
|
var sleep = require('./sleep/sleep.cjs');
|
|
12
|
+
require('./services/PlatformService/PlatformService.cjs');
|
|
12
13
|
require('tldts');
|
|
14
|
+
require('./services/FetchService/FetchService.cjs');
|
|
13
15
|
require('./services/Oauth2Service/Oauth2Service.cjs');
|
|
14
16
|
require('@dynamic-labs/types');
|
|
15
17
|
require('@dynamic-labs/sdk-api-core');
|
package/src/retryableFn.js
CHANGED
|
@@ -5,7 +5,9 @@ import './errors/TransactionGasCannotBeSponsoredError.js';
|
|
|
5
5
|
import './logger/logger.js';
|
|
6
6
|
import './bufferPolyfill.js';
|
|
7
7
|
import { sleep } from './sleep/sleep.js';
|
|
8
|
+
import './services/PlatformService/PlatformService.js';
|
|
8
9
|
import 'tldts';
|
|
10
|
+
import './services/FetchService/FetchService.js';
|
|
9
11
|
import './services/Oauth2Service/Oauth2Service.js';
|
|
10
12
|
import '@dynamic-labs/types';
|
|
11
13
|
import '@dynamic-labs/sdk-api-core';
|
|
@@ -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 (!
|
|
14
|
+
if (!_tslib.__classPrivateFieldGet(_a, _a, "f", _FetchService_implementation)) {
|
|
12
15
|
return { fetch: window.fetch.bind(window) };
|
|
13
16
|
}
|
|
14
|
-
return
|
|
17
|
+
return _tslib.__classPrivateFieldGet(_a, _a, "f", _FetchService_implementation);
|
|
15
18
|
}
|
|
16
|
-
static
|
|
17
|
-
|
|
19
|
+
static set implementation(implementation) {
|
|
20
|
+
_tslib.__classPrivateFieldSet(_a, _a, implementation, "f", _FetchService_implementation);
|
|
18
21
|
}
|
|
19
22
|
static get fetch() {
|
|
20
|
-
return
|
|
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
|
-
|
|
6
|
+
#private;
|
|
7
7
|
static get implementation(): IFetchService;
|
|
8
|
-
static
|
|
8
|
+
static set implementation(implementation: IFetchService);
|
|
9
9
|
static get fetch(): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
|
|
10
10
|
}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../_virtual/_tslib.js';
|
|
3
|
+
|
|
4
|
+
var _a, _FetchService_implementation;
|
|
2
5
|
/**
|
|
3
6
|
* Class implementing the fetch service with a configurable fetch implementation.
|
|
4
7
|
*/
|
|
5
8
|
class FetchService {
|
|
6
9
|
static get implementation() {
|
|
7
|
-
if (!
|
|
10
|
+
if (!__classPrivateFieldGet(_a, _a, "f", _FetchService_implementation)) {
|
|
8
11
|
return { fetch: window.fetch.bind(window) };
|
|
9
12
|
}
|
|
10
|
-
return
|
|
13
|
+
return __classPrivateFieldGet(_a, _a, "f", _FetchService_implementation);
|
|
11
14
|
}
|
|
12
|
-
static
|
|
13
|
-
|
|
15
|
+
static set implementation(implementation) {
|
|
16
|
+
__classPrivateFieldSet(_a, _a, implementation, "f", _FetchService_implementation);
|
|
14
17
|
}
|
|
15
18
|
static get fetch() {
|
|
16
|
-
return
|
|
19
|
+
return _a.implementation.fetch;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
22
|
+
_a = FetchService;
|
|
23
|
+
_FetchService_implementation = { value: void 0 };
|
|
19
24
|
|
|
20
25
|
export { FetchService };
|
|
@@ -3,26 +3,30 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
6
7
|
var types = require('@dynamic-labs/types');
|
|
7
8
|
var createWindowOauth2Service = require('./createWindowOauth2Service/createWindowOauth2Service.cjs');
|
|
8
9
|
|
|
10
|
+
var _a, _Oauth2Service_implementation;
|
|
9
11
|
/**
|
|
10
12
|
* Class implementing the fetch service with a configurable fetch implementation.
|
|
11
13
|
*/
|
|
12
14
|
class Oauth2Service {
|
|
13
15
|
static get implementation() {
|
|
14
|
-
if (!
|
|
16
|
+
if (!_tslib.__classPrivateFieldGet(_a, _a, "f", _Oauth2Service_implementation)) {
|
|
15
17
|
return createWindowOauth2Service.createWindowOauth2Service();
|
|
16
18
|
}
|
|
17
|
-
return
|
|
19
|
+
return _tslib.__classPrivateFieldGet(_a, _a, "f", _Oauth2Service_implementation);
|
|
18
20
|
}
|
|
19
|
-
static
|
|
20
|
-
|
|
21
|
+
static set implementation(implementation) {
|
|
22
|
+
_tslib.__classPrivateFieldSet(_a, _a, implementation, "f", _Oauth2Service_implementation);
|
|
21
23
|
}
|
|
22
24
|
static get getOauthCode() {
|
|
23
|
-
return
|
|
25
|
+
return _a.implementation.getOauthCode;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
28
|
+
_a = Oauth2Service;
|
|
29
|
+
_Oauth2Service_implementation = { value: void 0 };
|
|
26
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
31
|
Oauth2Service.isGetOauthCodeError = (error) => error === 'user-cancelled' ||
|
|
28
32
|
(typeof error === 'object' &&
|
|
@@ -22,9 +22,9 @@ export type GetOauthCodeError = 'user-cancelled' | {
|
|
|
22
22
|
* Class implementing the fetch service with a configurable fetch implementation.
|
|
23
23
|
*/
|
|
24
24
|
export declare class Oauth2Service {
|
|
25
|
-
|
|
25
|
+
#private;
|
|
26
26
|
static get implementation(): IOauth2Service;
|
|
27
|
-
static
|
|
27
|
+
static set implementation(implementation: IOauth2Service);
|
|
28
28
|
static get getOauthCode(): (props: GetOauthCodeProps) => Promise<string>;
|
|
29
29
|
static isGetOauthCodeError: (error: any) => error is GetOauthCodeError;
|
|
30
30
|
}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from '../../../_virtual/_tslib.js';
|
|
2
3
|
import { SocialOAuthErrorCode } from '@dynamic-labs/types';
|
|
3
4
|
import { createWindowOauth2Service } from './createWindowOauth2Service/createWindowOauth2Service.js';
|
|
4
5
|
|
|
6
|
+
var _a, _Oauth2Service_implementation;
|
|
5
7
|
/**
|
|
6
8
|
* Class implementing the fetch service with a configurable fetch implementation.
|
|
7
9
|
*/
|
|
8
10
|
class Oauth2Service {
|
|
9
11
|
static get implementation() {
|
|
10
|
-
if (!
|
|
12
|
+
if (!__classPrivateFieldGet(_a, _a, "f", _Oauth2Service_implementation)) {
|
|
11
13
|
return createWindowOauth2Service();
|
|
12
14
|
}
|
|
13
|
-
return
|
|
15
|
+
return __classPrivateFieldGet(_a, _a, "f", _Oauth2Service_implementation);
|
|
14
16
|
}
|
|
15
|
-
static
|
|
16
|
-
|
|
17
|
+
static set implementation(implementation) {
|
|
18
|
+
__classPrivateFieldSet(_a, _a, implementation, "f", _Oauth2Service_implementation);
|
|
17
19
|
}
|
|
18
20
|
static get getOauthCode() {
|
|
19
|
-
return
|
|
21
|
+
return _a.implementation.getOauthCode;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
24
|
+
_a = Oauth2Service;
|
|
25
|
+
_Oauth2Service_implementation = { value: void 0 };
|
|
22
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
27
|
Oauth2Service.isGetOauthCodeError = (error) => error === 'user-cancelled' ||
|
|
24
28
|
(typeof error === 'object' &&
|
|
@@ -3,37 +3,38 @@
|
|
|
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
|
}
|
|
18
20
|
static get getOrigin() {
|
|
19
|
-
return
|
|
21
|
+
return _a.implementation.getOrigin;
|
|
20
22
|
}
|
|
21
23
|
static get getHost() {
|
|
22
|
-
return
|
|
24
|
+
return _a.implementation.getHost;
|
|
23
25
|
}
|
|
24
26
|
static get getHostname() {
|
|
25
|
-
return
|
|
27
|
+
return _a.implementation.getHostname;
|
|
26
28
|
}
|
|
27
29
|
static get getTLD() {
|
|
28
|
-
return
|
|
30
|
+
return _a.implementation.getTLD;
|
|
29
31
|
}
|
|
30
32
|
// Deeplink handling
|
|
31
33
|
static get openURL() {
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
static get openNewWindow() {
|
|
35
|
-
return PlatformService.implementation.openNewWindow;
|
|
34
|
+
return _a.implementation.openURL;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
37
|
+
_a = PlatformService;
|
|
38
|
+
_PlatformService_implementation = { value: void 0 };
|
|
38
39
|
|
|
39
40
|
exports.PlatformService = PlatformService;
|
|
@@ -1,12 +1,11 @@
|
|
|
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
6
|
static get getOrigin(): () => string;
|
|
7
7
|
static get getHost(): () => string;
|
|
8
8
|
static get getHostname(): () => string;
|
|
9
9
|
static get getTLD(): () => string | undefined;
|
|
10
10
|
static get openURL(): (url: string) => Promise<void>;
|
|
11
|
-
static get openNewWindow(): (url: string) => Promise<void>;
|
|
12
11
|
}
|
|
@@ -1,35 +1,36 @@
|
|
|
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
|
|
11
|
+
return __classPrivateFieldGet(_a, _a, "f", _PlatformService_implementation);
|
|
10
12
|
}
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
+
static set implementation(implementation) {
|
|
14
|
+
__classPrivateFieldSet(_a, _a, implementation, "f", _PlatformService_implementation);
|
|
13
15
|
}
|
|
14
16
|
static get getOrigin() {
|
|
15
|
-
return
|
|
17
|
+
return _a.implementation.getOrigin;
|
|
16
18
|
}
|
|
17
19
|
static get getHost() {
|
|
18
|
-
return
|
|
20
|
+
return _a.implementation.getHost;
|
|
19
21
|
}
|
|
20
22
|
static get getHostname() {
|
|
21
|
-
return
|
|
23
|
+
return _a.implementation.getHostname;
|
|
22
24
|
}
|
|
23
25
|
static get getTLD() {
|
|
24
|
-
return
|
|
26
|
+
return _a.implementation.getTLD;
|
|
25
27
|
}
|
|
26
28
|
// Deeplink handling
|
|
27
29
|
static get openURL() {
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
static get openNewWindow() {
|
|
31
|
-
return PlatformService.implementation.openNewWindow;
|
|
30
|
+
return _a.implementation.openURL;
|
|
32
31
|
}
|
|
33
32
|
}
|
|
33
|
+
_a = PlatformService;
|
|
34
|
+
_PlatformService_implementation = { value: void 0 };
|
|
34
35
|
|
|
35
36
|
export { PlatformService };
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs
CHANGED
|
@@ -22,9 +22,6 @@ const createBrowserPlatformService = (window) => ({
|
|
|
22
22
|
});
|
|
23
23
|
return data.domain || undefined;
|
|
24
24
|
},
|
|
25
|
-
openNewWindow: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
window.open(url);
|
|
27
|
-
}),
|
|
28
25
|
openURL: (url) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
29
26
|
window.location.assign(url);
|
|
30
27
|
}),
|
package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js
CHANGED
|
@@ -18,9 +18,6 @@ const createBrowserPlatformService = (window) => ({
|
|
|
18
18
|
});
|
|
19
19
|
return data.domain || undefined;
|
|
20
20
|
},
|
|
21
|
-
openNewWindow: (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
window.open(url);
|
|
23
|
-
}),
|
|
24
21
|
openURL: (url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
22
|
window.location.assign(url);
|
|
26
23
|
}),
|