@dynamic-labs/utils 2.1.0-alpha.18 → 2.1.0-alpha.19
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 +16 -0
- package/package.json +4 -4
- package/src/errors/CustomFieldNotUniqueError.cjs +14 -0
- package/src/errors/CustomFieldNotUniqueError.d.ts +4 -0
- package/src/errors/CustomFieldNotUniqueError.js +10 -0
- package/src/errors/index.d.ts +1 -0
- package/src/getTLD/getTLD.cjs +2 -13
- package/src/getTLD/getTLD.js +2 -13
- package/src/index.cjs +4 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +2 -0
- package/src/services/FetchService/FetchService.cjs +24 -0
- package/src/services/FetchService/FetchService.d.ts +10 -0
- package/src/services/FetchService/FetchService.js +20 -0
- package/src/services/FetchService/index.d.ts +2 -0
- package/src/services/FetchService/types.d.ts +3 -0
- package/src/services/LocationService/LocationService.cjs +5 -2
- package/src/services/LocationService/LocationService.d.ts +2 -1
- package/src/services/LocationService/LocationService.js +5 -2
- package/src/services/LocationService/types.d.ts +1 -0
- package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.cjs +1 -0
- package/src/services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.js +1 -0
- package/src/services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.cjs +14 -0
- package/src/services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.1.0-alpha.19](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.18...v2.1.0-alpha.19) (2024-05-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add createUserProfileFromSDKUser ([#5596](https://github.com/dynamic-labs/DynamicAuth/issues/5596)) ([d37a1b4](https://github.com/dynamic-labs/DynamicAuth/commit/d37a1b4119f5ff4fff1e987d157f6d5abf105a8b))
|
|
8
|
+
* add headless social sign-in ([#5439](https://github.com/dynamic-labs/DynamicAuth/issues/5439)) ([e32fdf8](https://github.com/dynamic-labs/DynamicAuth/commit/e32fdf863718d661b90b592c8df734e92386ddf3))
|
|
9
|
+
* fetch custom fields in profile and update user ([#5627](https://github.com/dynamic-labs/DynamicAuth/issues/5627)) ([3940c25](https://github.com/dynamic-labs/DynamicAuth/commit/3940c2542bb330f3ed9a8eb98eed9d05c8fcb03a))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* include applinks details to AASA ([#5635](https://github.com/dynamic-labs/DynamicAuth/issues/5635)) ([ce94fec](https://github.com/dynamic-labs/DynamicAuth/commit/ce94fec80adbb3eb4efcb79d1aa2cc6eb35eab6f))
|
|
15
|
+
* include the appOrigin to every api call to create correct passkey ([#5636](https://github.com/dynamic-labs/DynamicAuth/issues/5636)) ([ee64df3](https://github.com/dynamic-labs/DynamicAuth/commit/ee64df3b90037bd29cca161e601973ef202c58f0))
|
|
16
|
+
* use PromptModal when using the DynamicMultiWalletPromptsWidget for pending connection views ([#5594](https://github.com/dynamic-labs/DynamicAuth/issues/5594)) ([c095b6e](https://github.com/dynamic-labs/DynamicAuth/commit/c095b6e4c974f02cfe632963be92d16bb201dfa5))
|
|
17
|
+
|
|
2
18
|
## [2.1.0-alpha.18](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.17...v2.1.0-alpha.18) (2024-05-15)
|
|
3
19
|
|
|
4
20
|
## [2.1.0-alpha.17](https://github.com/dynamic-labs/DynamicAuth/compare/v2.1.0-alpha.16...v2.1.0-alpha.17) (2024-05-15)
|
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.19",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/dynamic-labs/DynamicAuth.git",
|
|
@@ -26,10 +26,10 @@
|
|
|
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.444",
|
|
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.19",
|
|
32
|
+
"@dynamic-labs/types": "2.1.0-alpha.19",
|
|
33
33
|
"buffer": "6.0.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
@@ -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 CustomFieldNotUniqueError extends DynamicError.DynamicError {
|
|
9
|
+
constructor() {
|
|
10
|
+
super('Custom Field for user must be unique within the environment', 'custom_field_data_not_unique');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
exports.CustomFieldNotUniqueError = CustomFieldNotUniqueError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { DynamicError } from './DynamicError.js';
|
|
3
|
+
|
|
4
|
+
class CustomFieldNotUniqueError extends DynamicError {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Custom Field for user must be unique within the environment', 'custom_field_data_not_unique');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { CustomFieldNotUniqueError };
|
package/src/errors/index.d.ts
CHANGED
package/src/getTLD/getTLD.cjs
CHANGED
|
@@ -3,20 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var tldts = require('tldts');
|
|
7
6
|
var LocationService = require('../services/LocationService/LocationService.cjs');
|
|
7
|
+
require('tldts');
|
|
8
8
|
|
|
9
|
-
const getTLD = () =>
|
|
10
|
-
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
11
|
-
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
|
12
|
-
// full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
|
|
13
|
-
// separated by ICANN DOMAINS and PRIVATE DOMAINS
|
|
14
|
-
// so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
|
|
15
|
-
// whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
|
|
16
|
-
const data = tldts.parse(LocationService.LocationService.getHostname(), {
|
|
17
|
-
allowPrivateDomains: true,
|
|
18
|
-
});
|
|
19
|
-
return data.domain || undefined;
|
|
20
|
-
};
|
|
9
|
+
const getTLD = () => LocationService.LocationService.getTLD();
|
|
21
10
|
|
|
22
11
|
exports.getTLD = getTLD;
|
package/src/getTLD/getTLD.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { parse } from 'tldts';
|
|
3
2
|
import { LocationService } from '../services/LocationService/LocationService.js';
|
|
3
|
+
import 'tldts';
|
|
4
4
|
|
|
5
|
-
const getTLD = () =>
|
|
6
|
-
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
7
|
-
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
|
8
|
-
// full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
|
|
9
|
-
// separated by ICANN DOMAINS and PRIVATE DOMAINS
|
|
10
|
-
// so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
|
|
11
|
-
// whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
|
|
12
|
-
const data = parse(LocationService.getHostname(), {
|
|
13
|
-
allowPrivateDomains: true,
|
|
14
|
-
});
|
|
15
|
-
return data.domain || undefined;
|
|
16
|
-
};
|
|
5
|
+
const getTLD = () => LocationService.getTLD();
|
|
17
6
|
|
|
18
7
|
export { getTLD };
|
package/src/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ var TooManyEmailVerificationsError = require('./errors/TooManyEmailVerifications
|
|
|
30
30
|
var VerificationDataCollectionError = require('./errors/VerificationDataCollectionError.cjs');
|
|
31
31
|
var InvalidPhoneNumberError = require('./errors/InvalidPhoneNumberError.cjs');
|
|
32
32
|
var MergeAccountsConfirmationError = require('./errors/MergeAccountsConfirmationError.cjs');
|
|
33
|
+
var CustomFieldNotUniqueError = require('./errors/CustomFieldNotUniqueError.cjs');
|
|
33
34
|
var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
|
|
34
35
|
var isFunction = require('./isFunction/isFunction.cjs');
|
|
35
36
|
var isMobile = require('./isMobile.cjs');
|
|
@@ -54,6 +55,7 @@ var runSafe = require('./runSafe/runSafe.cjs');
|
|
|
54
55
|
var LocationService = require('./services/LocationService/LocationService.cjs');
|
|
55
56
|
var createLocationFromWindow = require('./services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.cjs');
|
|
56
57
|
var createLocationFromOrigin = require('./services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.cjs');
|
|
58
|
+
var FetchService = require('./services/FetchService/FetchService.cjs');
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
|
|
@@ -84,6 +86,7 @@ exports.TooManyEmailVerificationsError = TooManyEmailVerificationsError.TooManyE
|
|
|
84
86
|
exports.VerificationDataCollectionError = VerificationDataCollectionError.VerificationDataCollectionError;
|
|
85
87
|
exports.InvalidPhoneNumberError = InvalidPhoneNumberError.InvalidPhoneNumberError;
|
|
86
88
|
exports.MergeAccountsConfirmationError = MergeAccountsConfirmationError.MergeAccountsConfirmationError;
|
|
89
|
+
exports.CustomFieldNotUniqueError = CustomFieldNotUniqueError.CustomFieldNotUniqueError;
|
|
87
90
|
exports.CancellablePromise = CancellablePromise.CancellablePromise;
|
|
88
91
|
exports.isFunction = isFunction.isFunction;
|
|
89
92
|
exports.getAndroidVersion = isMobile.getAndroidVersion;
|
|
@@ -122,3 +125,4 @@ exports.runSafe = runSafe.runSafe;
|
|
|
122
125
|
exports.LocationService = LocationService.LocationService;
|
|
123
126
|
exports.createLocationFromWindow = createLocationFromWindow.createLocationFromWindow;
|
|
124
127
|
exports.createLocationFromOrigin = createLocationFromOrigin.createLocationFromOrigin;
|
|
128
|
+
exports.FetchService = FetchService.FetchService;
|
package/src/index.d.ts
CHANGED
|
@@ -23,3 +23,4 @@ export * from './trimEnd';
|
|
|
23
23
|
export * from './isLedgerAddressViaVerifiedCredentials';
|
|
24
24
|
export { runSafe } from './runSafe';
|
|
25
25
|
export { LocationService, createLocationFromOrigin, createLocationFromWindow, } from './services/LocationService';
|
|
26
|
+
export { FetchService } from './services/FetchService';
|
package/src/index.js
CHANGED
|
@@ -26,6 +26,7 @@ export { TooManyEmailVerificationsError } from './errors/TooManyEmailVerificatio
|
|
|
26
26
|
export { VerificationDataCollectionError } from './errors/VerificationDataCollectionError.js';
|
|
27
27
|
export { InvalidPhoneNumberError } from './errors/InvalidPhoneNumberError.js';
|
|
28
28
|
export { MergeAccountsConfirmationError } from './errors/MergeAccountsConfirmationError.js';
|
|
29
|
+
export { CustomFieldNotUniqueError } from './errors/CustomFieldNotUniqueError.js';
|
|
29
30
|
export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
|
|
30
31
|
export { isFunction } from './isFunction/isFunction.js';
|
|
31
32
|
export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows } from './isMobile.js';
|
|
@@ -50,3 +51,4 @@ export { runSafe } from './runSafe/runSafe.js';
|
|
|
50
51
|
export { LocationService } from './services/LocationService/LocationService.js';
|
|
51
52
|
export { createLocationFromWindow } from './services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.js';
|
|
52
53
|
export { createLocationFromOrigin } from './services/LocationService/utils/createLocationFromOrigin/createLocationFromOrigin.js';
|
|
54
|
+
export { FetchService } from './services/FetchService/FetchService.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Class implementing the fetch service with a configurable fetch implementation.
|
|
8
|
+
*/
|
|
9
|
+
class FetchService {
|
|
10
|
+
static get implementation() {
|
|
11
|
+
if (!FetchService._implementation) {
|
|
12
|
+
return { fetch: window.fetch };
|
|
13
|
+
}
|
|
14
|
+
return FetchService._implementation;
|
|
15
|
+
}
|
|
16
|
+
static setImplementation(implementation) {
|
|
17
|
+
FetchService._implementation = implementation;
|
|
18
|
+
}
|
|
19
|
+
static get fetch() {
|
|
20
|
+
return FetchService.implementation.fetch;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
exports.FetchService = FetchService;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IFetchService } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Class implementing the fetch service with a configurable fetch implementation.
|
|
4
|
+
*/
|
|
5
|
+
export declare class FetchService {
|
|
6
|
+
static _implementation: IFetchService;
|
|
7
|
+
static get implementation(): IFetchService;
|
|
8
|
+
static setImplementation(implementation: IFetchService): void;
|
|
9
|
+
static get fetch(): (input: RequestInfo, init?: RequestInit | undefined) => Promise<Response>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* Class implementing the fetch service with a configurable fetch implementation.
|
|
4
|
+
*/
|
|
5
|
+
class FetchService {
|
|
6
|
+
static get implementation() {
|
|
7
|
+
if (!FetchService._implementation) {
|
|
8
|
+
return { fetch: window.fetch };
|
|
9
|
+
}
|
|
10
|
+
return FetchService._implementation;
|
|
11
|
+
}
|
|
12
|
+
static setImplementation(implementation) {
|
|
13
|
+
FetchService._implementation = implementation;
|
|
14
|
+
}
|
|
15
|
+
static get fetch() {
|
|
16
|
+
return FetchService.implementation.fetch;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { FetchService };
|
|
@@ -15,8 +15,11 @@ class LocationService {
|
|
|
15
15
|
static setImplementation(implementation) {
|
|
16
16
|
LocationService._implementation = implementation;
|
|
17
17
|
}
|
|
18
|
-
static getHostname() {
|
|
19
|
-
return LocationService.implementation.getHostname
|
|
18
|
+
static get getHostname() {
|
|
19
|
+
return LocationService.implementation.getHostname;
|
|
20
|
+
}
|
|
21
|
+
static get getTLD() {
|
|
22
|
+
return LocationService.implementation.getTLD;
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
@@ -3,5 +3,6 @@ export declare class LocationService {
|
|
|
3
3
|
static _implementation: ILocation;
|
|
4
4
|
static get implementation(): ILocation;
|
|
5
5
|
static setImplementation(implementation: ILocation): void;
|
|
6
|
-
static getHostname(): string;
|
|
6
|
+
static get getHostname(): () => string;
|
|
7
|
+
static get getTLD(): () => string | undefined;
|
|
7
8
|
}
|
|
@@ -11,8 +11,11 @@ class LocationService {
|
|
|
11
11
|
static setImplementation(implementation) {
|
|
12
12
|
LocationService._implementation = implementation;
|
|
13
13
|
}
|
|
14
|
-
static getHostname() {
|
|
15
|
-
return LocationService.implementation.getHostname
|
|
14
|
+
static get getHostname() {
|
|
15
|
+
return LocationService.implementation.getHostname;
|
|
16
|
+
}
|
|
17
|
+
static get getTLD() {
|
|
18
|
+
return LocationService.implementation.getTLD;
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
|
package/src/services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.cjs
CHANGED
|
@@ -3,8 +3,22 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var tldts = require('tldts');
|
|
7
|
+
|
|
6
8
|
const createLocationFromWindow = (window) => ({
|
|
7
9
|
getHostname: () => window.location.hostname,
|
|
10
|
+
getTLD: () => {
|
|
11
|
+
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
12
|
+
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
|
13
|
+
// full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
|
|
14
|
+
// separated by ICANN DOMAINS and PRIVATE DOMAINS
|
|
15
|
+
// so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
|
|
16
|
+
// whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
|
|
17
|
+
const data = tldts.parse(window.location.hostname, {
|
|
18
|
+
allowPrivateDomains: true,
|
|
19
|
+
});
|
|
20
|
+
return data.domain || undefined;
|
|
21
|
+
},
|
|
8
22
|
});
|
|
9
23
|
|
|
10
24
|
exports.createLocationFromWindow = createLocationFromWindow;
|
package/src/services/LocationService/utils/createLocationFromWindow/createLocationFromWindow.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { parse } from 'tldts';
|
|
3
|
+
|
|
2
4
|
const createLocationFromWindow = (window) => ({
|
|
3
5
|
getHostname: () => window.location.hostname,
|
|
6
|
+
getTLD: () => {
|
|
7
|
+
// Passing the allowPrivateDomains option prevents returning the actual TLD
|
|
8
|
+
// for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
|
|
9
|
+
// full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
|
|
10
|
+
// separated by ICANN DOMAINS and PRIVATE DOMAINS
|
|
11
|
+
// so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
|
|
12
|
+
// whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
|
|
13
|
+
const data = parse(window.location.hostname, {
|
|
14
|
+
allowPrivateDomains: true,
|
|
15
|
+
});
|
|
16
|
+
return data.domain || undefined;
|
|
17
|
+
},
|
|
4
18
|
});
|
|
5
19
|
|
|
6
20
|
export { createLocationFromWindow };
|