@dynamic-labs/utils 1.1.0-alpha.21 → 1.1.0-alpha.23

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 CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [1.1.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.22...v1.1.0-alpha.23) (2024-02-01)
3
+
4
+
5
+ ### Features
6
+
7
+ * bitcoin signPsbt ([3c964de](https://github.com/dynamic-labs/DynamicAuth/commit/3c964dea8a55debaf184c5a94f0f5fabdda3c877))
8
+ * embedded wallet email auth flow ([#4353](https://github.com/dynamic-labs/DynamicAuth/issues/4353)) ([4875da3](https://github.com/dynamic-labs/DynamicAuth/commit/4875da32c47c27facef1b1cdbdc214566bbfd171))
9
+
10
+ ## [1.1.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.21...v1.1.0-alpha.22) (2024-02-01)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * onAuthFlowClose not being called ([#4563](https://github.com/dynamic-labs/DynamicAuth/issues/4563)) ([c4b2648](https://github.com/dynamic-labs/DynamicAuth/commit/c4b264885b7dba6e204ef49bf642d25c7d287b04))
16
+
2
17
  ## [1.1.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.20...v1.1.0-alpha.21) (2024-02-01)
3
18
 
4
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "1.1.0-alpha.21",
3
+ "version": "1.1.0-alpha.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -25,11 +25,12 @@
25
25
  },
26
26
  "./package.json": "./package.json"
27
27
  },
28
+ "dependencies": {
29
+ "tldts": "^6.0.16",
30
+ "@dynamic-labs/logger": "1.1.0-alpha.23",
31
+ "@dynamic-labs/types": "1.1.0-alpha.23"
32
+ },
28
33
  "peerDependencies": {
29
34
  "viem": "^1.19.13 || ^2.2.0"
30
- },
31
- "dependencies": {
32
- "@dynamic-labs/logger": "1.1.0-alpha.21",
33
- "@dynamic-labs/types": "1.1.0-alpha.21"
34
35
  }
35
36
  }
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tldts = require('tldts');
6
+
7
+ const getTLD = () => {
8
+ // Passing the allowPrivateDomains option prevents returning the actual TLD
9
+ // for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
10
+ // full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
11
+ // separated by ICANN DOMAINS and PRIVATE DOMAINS
12
+ // so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
13
+ // whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
14
+ const data = tldts.parse(window.location.hostname, { allowPrivateDomains: true });
15
+ return data.domain || undefined;
16
+ };
17
+
18
+ exports.getTLD = getTLD;
@@ -0,0 +1 @@
1
+ export declare const getTLD: () => string | undefined;
@@ -0,0 +1,14 @@
1
+ import { parse } from 'tldts';
2
+
3
+ const getTLD = () => {
4
+ // Passing the allowPrivateDomains option prevents returning the actual TLD
5
+ // for domains that have delegated subdomains like herokuapp.com or s3.amazonaws.com
6
+ // full list is contained here https://publicsuffix.org/list/effective_tld_names.dat
7
+ // separated by ICANN DOMAINS and PRIVATE DOMAINS
8
+ // so for instance parse('someapp.herokuapp.com') will return 'someapp.herokuapp.com' as the domain
9
+ // whereas parse('app.dynamic.xyz') will return 'dynamic.xyz'
10
+ const data = parse(window.location.hostname, { allowPrivateDomains: true });
11
+ return data.domain || undefined;
12
+ };
13
+
14
+ export { getTLD };
@@ -0,0 +1 @@
1
+ export { getTLD } from './getTLD';
@@ -8,6 +8,7 @@ require('../logger/logger.cjs');
8
8
  var isMobile = require('../isMobile.cjs');
9
9
  require('../../_virtual/_tslib.cjs');
10
10
  require('viem/chains');
11
+ require('tldts');
11
12
 
12
13
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
13
14
  const url = encodeURIComponent(window.location.toString());
@@ -4,6 +4,7 @@ import '../logger/logger.js';
4
4
  import { isSamsungBrowser } from '../isMobile.js';
5
5
  import '../../_virtual/_tslib.js';
6
6
  import 'viem/chains';
7
+ import 'tldts';
7
8
 
8
9
  const handleMobileWalletRedirect = ({ nativeLink, universalLink, }) => {
9
10
  const url = encodeURIComponent(window.location.toString());
package/src/index.cjs CHANGED
@@ -37,6 +37,7 @@ var wrapMethodWithCallback = require('./wrapMethodWithCallback/wrapMethodWithCal
37
37
  var DeferredPromise = require('./DeferredPromise/DeferredPromise.cjs');
38
38
  var handleMobileWalletRedirect = require('./handleMobileWalletRedirect/handleMobileWalletRedirect.cjs');
39
39
  var uniq = require('./uniq/uniq.cjs');
40
+ var getTLD = require('./getTLD/getTLD.cjs');
40
41
 
41
42
 
42
43
 
@@ -89,3 +90,4 @@ exports.wrapMethodWithCallback = wrapMethodWithCallback.wrapMethodWithCallback;
89
90
  exports.DeferredPromise = DeferredPromise.DeferredPromise;
90
91
  exports.handleMobileWalletRedirect = handleMobileWalletRedirect.handleMobileWalletRedirect;
91
92
  exports.uniq = uniq.uniq;
93
+ exports.getTLD = getTLD.getTLD;
package/src/index.d.ts CHANGED
@@ -15,3 +15,4 @@ export * from './wrapMethodWithCallback';
15
15
  export * from './DeferredPromise';
16
16
  export * from './handleMobileWalletRedirect';
17
17
  export * from './uniq';
18
+ export * from './getTLD';
package/src/index.js CHANGED
@@ -33,3 +33,4 @@ export { wrapMethodWithCallback } from './wrapMethodWithCallback/wrapMethodWithC
33
33
  export { DeferredPromise } from './DeferredPromise/DeferredPromise.js';
34
34
  export { handleMobileWalletRedirect } from './handleMobileWalletRedirect/handleMobileWalletRedirect.js';
35
35
  export { uniq } from './uniq/uniq.js';
36
+ export { getTLD } from './getTLD/getTLD.js';
@@ -8,6 +8,7 @@ require('./errors/InsufficientFundsError.cjs');
8
8
  require('./logger/logger.cjs');
9
9
  var sleep = require('./sleep/sleep.cjs');
10
10
  require('viem/chains');
11
+ require('tldts');
11
12
 
12
13
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
13
14
  const retryableFn = (fn, options = {}) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
@@ -4,6 +4,7 @@ import './errors/InsufficientFundsError.js';
4
4
  import './logger/logger.js';
5
5
  import { sleep } from './sleep/sleep.js';
6
6
  import 'viem/chains';
7
+ import 'tldts';
7
8
 
8
9
  const FALLBACK_UNDEFINED = 'FALLBACK_UNDEFINED';
9
10
  const retryableFn = (fn, options = {}) => __awaiter(void 0, void 0, void 0, function* () {