@dynamic-labs/utils 0.17.0-RC.7 → 0.17.0-RC.9

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/package.json +2 -2
  3. package/src/CancellablePromise/CancellablePromise.cjs +33 -0
  4. package/src/CancellablePromise/CancellablePromise.d.ts +9 -0
  5. package/src/CancellablePromise/CancellablePromise.js +29 -0
  6. package/src/CancellablePromise/index.d.ts +1 -0
  7. package/src/errors/ChainalysisError.cjs +14 -0
  8. package/src/errors/ChainalysisError.d.ts +5 -0
  9. package/src/errors/ChainalysisError.js +10 -0
  10. package/src/errors/CustomError.cjs +23 -0
  11. package/src/errors/CustomError.d.ts +11 -0
  12. package/src/errors/CustomError.js +19 -0
  13. package/src/errors/DynamicError.cjs +10 -0
  14. package/src/errors/DynamicError.d.ts +3 -0
  15. package/src/errors/DynamicError.js +6 -0
  16. package/src/errors/EmailAlreadyExistsError.cjs +13 -0
  17. package/src/errors/EmailAlreadyExistsError.d.ts +4 -0
  18. package/src/errors/EmailAlreadyExistsError.js +9 -0
  19. package/src/errors/EmailVerificationError.cjs +13 -0
  20. package/src/errors/EmailVerificationError.d.ts +4 -0
  21. package/src/errors/EmailVerificationError.js +9 -0
  22. package/src/errors/NoAccessError.cjs +15 -0
  23. package/src/errors/NoAccessError.d.ts +9 -0
  24. package/src/errors/NoAccessError.js +11 -0
  25. package/src/errors/NotSupportedError.cjs +10 -0
  26. package/src/errors/NotSupportedError.d.ts +3 -0
  27. package/src/errors/NotSupportedError.js +6 -0
  28. package/src/errors/UsernameAlreadyExistsError.cjs +13 -0
  29. package/src/errors/UsernameAlreadyExistsError.d.ts +4 -0
  30. package/src/errors/UsernameAlreadyExistsError.js +9 -0
  31. package/src/errors/WalletNotDeployedError.cjs +13 -0
  32. package/src/errors/WalletNotDeployedError.d.ts +4 -0
  33. package/src/errors/WalletNotDeployedError.js +9 -0
  34. package/src/errors/WalletUsedError.cjs +13 -0
  35. package/src/errors/WalletUsedError.d.ts +4 -0
  36. package/src/errors/WalletUsedError.js +9 -0
  37. package/src/errors/index.d.ts +10 -0
  38. package/src/index.cjs +30 -0
  39. package/src/index.d.ts +4 -0
  40. package/src/index.js +13 -0
  41. package/src/isFunction/index.d.ts +1 -0
  42. package/src/isFunction/isFunction.cjs +8 -0
  43. package/src/isFunction/isFunction.d.ts +1 -0
  44. package/src/isFunction/isFunction.js +4 -0
  45. package/src/isMobile.cjs +54 -0
  46. package/src/isMobile.d.ts +13 -0
  47. package/src/isMobile.js +46 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,41 @@
1
1
 
2
+ ## [0.17.0-RC.9](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.8...v0.17.0-RC.9) (2023-05-05)
3
+
4
+
5
+ ### Features
6
+
7
+ * **DYN-2231:** show in the user profile all existing fields ([#1988](https://github.com/dynamic-labs/DynamicAuth/issues/1988)) ([1f8cee2](https://github.com/dynamic-labs/DynamicAuth/commit/1f8cee22cf8338bd518961288c570c40e807cd52))
8
+ * **TransactionModal:** add insufficient funds warning ([#2031](https://github.com/dynamic-labs/DynamicAuth/issues/2031)) ([bf868e2](https://github.com/dynamic-labs/DynamicAuth/commit/bf868e239e74f4cd0ceda5e09b7538d97d4e431d))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **DYN-1820:** use missing_from_list error code ([#2040](https://github.com/dynamic-labs/DynamicAuth/issues/2040)) ([92c7ad5](https://github.com/dynamic-labs/DynamicAuth/commit/92c7ad565376573d963c65fa821c97a2102ec8d7))
14
+ * **MagicClientNetworkHandler:** save last used network id ([#2045](https://github.com/dynamic-labs/DynamicAuth/issues/2045)) ([6e1c571](https://github.com/dynamic-labs/DynamicAuth/commit/6e1c57127a824cd02d4b785fb8a387e4f221f044))
15
+ * **TransactionModal:** ensure alchemy will not fail when estimating for gas ([#2034](https://github.com/dynamic-labs/DynamicAuth/issues/2034)) ([86c0d7c](https://github.com/dynamic-labs/DynamicAuth/commit/86c0d7cc7b20ff12bc9fc2e33961e177d9decf2a))
16
+
17
+ ## [0.17.0-RC.8](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.7...v0.17.0-RC.8) (2023-05-03)
18
+
19
+
20
+ ### ⚠ BREAKING CHANGES
21
+
22
+ * Removes support for Fortmatic in favor of Magic
23
+
24
+ ### Features
25
+
26
+ * add selected address to qr code modal ([#2017](https://github.com/dynamic-labs/DynamicAuth/issues/2017)) ([58a5d69](https://github.com/dynamic-labs/DynamicAuth/commit/58a5d691f8a4045d92be1a2bcaf6092f44b91b73))
27
+ * **DYN-2228:** show network picker only when more than 1 network ([#2007](https://github.com/dynamic-labs/DynamicAuth/issues/2007)) ([8329737](https://github.com/dynamic-labs/DynamicAuth/commit/83297378cc5ed019f3f8297b48c16f56d7cfe9a7))
28
+
29
+
30
+ ### Bug Fixes
31
+
32
+ * disable kyc submit button when network is not supported ([#1952](https://github.com/dynamic-labs/DynamicAuth/issues/1952)) ([ec2f0eb](https://github.com/dynamic-labs/DynamicAuth/commit/ec2f0eb708ed2938dd68cbc7e8ee40f3bc856c2b))
33
+ * missing evm networks for connect-only ([#2006](https://github.com/dynamic-labs/DynamicAuth/issues/2006)) ([78561b3](https://github.com/dynamic-labs/DynamicAuth/commit/78561b3243ac38a348a383bb3c79ce58c8731538))
34
+ * wallet-connect menu on mobile ([#2025](https://github.com/dynamic-labs/DynamicAuth/issues/2025)) ([1f358a6](https://github.com/dynamic-labs/DynamicAuth/commit/1f358a66dda696e745db32f121fb4ef62379cb9a))
35
+
36
+
37
+ * remove Fortmatic ([#2010](https://github.com/dynamic-labs/DynamicAuth/issues/2010)) ([0ca95c1](https://github.com/dynamic-labs/DynamicAuth/commit/0ca95c175b5d8383433340832bd9ae7dab85f912))
38
+
2
39
  ## [0.17.0-RC.7](https://github.com/dynamic-labs/DynamicAuth/compare/v0.17.0-RC.6...v0.17.0-RC.7) (2023-04-28)
3
40
 
4
41
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "0.17.0-RC.7",
3
+ "version": "0.17.0-RC.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -26,7 +26,7 @@
26
26
  "./package.json": "./package.json"
27
27
  },
28
28
  "dependencies": {
29
- "@dynamic-labs/types": "0.17.0-RC.7"
29
+ "@dynamic-labs/types": "0.17.0-RC.9"
30
30
  },
31
31
  "peerDependencies": {}
32
32
  }
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ class CancellablePromise extends Promise {
6
+ constructor(executor) {
7
+ super((resolve, reject) => {
8
+ executor((val) => {
9
+ if (this.isCancelled)
10
+ return;
11
+ resolve(val);
12
+ }, (err) => {
13
+ if (this.isCancelled)
14
+ return;
15
+ reject(err);
16
+ });
17
+ });
18
+ this._controller = new AbortController();
19
+ }
20
+ get isCancelled() {
21
+ return this._controller.signal.aborted;
22
+ }
23
+ cancel() {
24
+ this._controller.abort();
25
+ }
26
+ static fromPromise(promise) {
27
+ return new CancellablePromise((resolve, reject) => {
28
+ promise.then(resolve).catch(reject);
29
+ });
30
+ }
31
+ }
32
+
33
+ exports.CancellablePromise = CancellablePromise;
@@ -0,0 +1,9 @@
1
+ type Executor<T> = (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void;
2
+ export declare class CancellablePromise<T> extends Promise<T> {
3
+ _controller: AbortController;
4
+ constructor(executor: Executor<T>);
5
+ get isCancelled(): boolean;
6
+ cancel(): void;
7
+ static fromPromise<T>(promise: Promise<T>): CancellablePromise<T>;
8
+ }
9
+ export {};
@@ -0,0 +1,29 @@
1
+ class CancellablePromise extends Promise {
2
+ constructor(executor) {
3
+ super((resolve, reject) => {
4
+ executor((val) => {
5
+ if (this.isCancelled)
6
+ return;
7
+ resolve(val);
8
+ }, (err) => {
9
+ if (this.isCancelled)
10
+ return;
11
+ reject(err);
12
+ });
13
+ });
14
+ this._controller = new AbortController();
15
+ }
16
+ get isCancelled() {
17
+ return this._controller.signal.aborted;
18
+ }
19
+ cancel() {
20
+ this._controller.abort();
21
+ }
22
+ static fromPromise(promise) {
23
+ return new CancellablePromise((resolve, reject) => {
24
+ promise.then(resolve).catch(reject);
25
+ });
26
+ }
27
+ }
28
+
29
+ export { CancellablePromise };
@@ -0,0 +1 @@
1
+ export { CancellablePromise } from './CancellablePromise';
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class ChainalysisError extends DynamicError.DynamicError {
8
+ constructor(walletPublicKey) {
9
+ super('This address is not approved for access');
10
+ this.walletPublicKey = walletPublicKey;
11
+ }
12
+ }
13
+
14
+ exports.ChainalysisError = ChainalysisError;
@@ -0,0 +1,5 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class ChainalysisError extends DynamicError {
3
+ walletPublicKey: string | undefined;
4
+ constructor(walletPublicKey: string);
5
+ }
@@ -0,0 +1,10 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class ChainalysisError extends DynamicError {
4
+ constructor(walletPublicKey) {
5
+ super('This address is not approved for access');
6
+ this.walletPublicKey = walletPublicKey;
7
+ }
8
+ }
9
+
10
+ export { ChainalysisError };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * Extend this class to allow usage of instanceof
7
+ */
8
+ class CustomError extends Error {
9
+ constructor(message, code) {
10
+ super(message);
11
+ this.code = undefined;
12
+ this.code = code;
13
+ Object.setPrototypeOf(this, this.constructor.prototype);
14
+ }
15
+ toJSON() {
16
+ return {
17
+ code: this.code,
18
+ error: this.message,
19
+ };
20
+ }
21
+ }
22
+
23
+ exports.CustomError = CustomError;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Extend this class to allow usage of instanceof
3
+ */
4
+ export declare class CustomError extends Error {
5
+ code: string | undefined;
6
+ constructor(message?: string | undefined, code?: string);
7
+ toJSON(): {
8
+ code: string | undefined;
9
+ error: string;
10
+ };
11
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Extend this class to allow usage of instanceof
3
+ */
4
+ class CustomError extends Error {
5
+ constructor(message, code) {
6
+ super(message);
7
+ this.code = undefined;
8
+ this.code = code;
9
+ Object.setPrototypeOf(this, this.constructor.prototype);
10
+ }
11
+ toJSON() {
12
+ return {
13
+ code: this.code,
14
+ error: this.message,
15
+ };
16
+ }
17
+ }
18
+
19
+ export { CustomError };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var CustomError = require('./CustomError.cjs');
6
+
7
+ class DynamicError extends CustomError.CustomError {
8
+ }
9
+
10
+ exports.DynamicError = DynamicError;
@@ -0,0 +1,3 @@
1
+ import { CustomError } from './CustomError';
2
+ export declare class DynamicError extends CustomError {
3
+ }
@@ -0,0 +1,6 @@
1
+ import { CustomError } from './CustomError.js';
2
+
3
+ class DynamicError extends CustomError {
4
+ }
5
+
6
+ export { DynamicError };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class EmailAlreadyExistsError extends DynamicError.DynamicError {
8
+ constructor() {
9
+ super('Email already exists');
10
+ }
11
+ }
12
+
13
+ exports.EmailAlreadyExistsError = EmailAlreadyExistsError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class EmailAlreadyExistsError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class EmailAlreadyExistsError extends DynamicError {
4
+ constructor() {
5
+ super('Email already exists');
6
+ }
7
+ }
8
+
9
+ export { EmailAlreadyExistsError };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class EmailVerificationError extends DynamicError.DynamicError {
8
+ constructor(code) {
9
+ super('EmailVerificationError', code);
10
+ }
11
+ }
12
+
13
+ exports.EmailVerificationError = EmailVerificationError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class EmailVerificationError extends DynamicError {
3
+ constructor(code: string);
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class EmailVerificationError extends DynamicError {
4
+ constructor(code) {
5
+ super('EmailVerificationError', code);
6
+ }
7
+ }
8
+
9
+ export { EmailVerificationError };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class NoAccessError extends DynamicError.DynamicError {
8
+ constructor({ walletPublicKey, email, }) {
9
+ super('User does not have access');
10
+ this.email = email;
11
+ this.walletPublicKey = walletPublicKey;
12
+ }
13
+ }
14
+
15
+ exports.NoAccessError = NoAccessError;
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class NoAccessError extends DynamicError {
3
+ walletPublicKey?: string;
4
+ email?: string;
5
+ constructor({ walletPublicKey, email, }: {
6
+ email?: string;
7
+ walletPublicKey?: string;
8
+ });
9
+ }
@@ -0,0 +1,11 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class NoAccessError extends DynamicError {
4
+ constructor({ walletPublicKey, email, }) {
5
+ super('User does not have access');
6
+ this.email = email;
7
+ this.walletPublicKey = walletPublicKey;
8
+ }
9
+ }
10
+
11
+ export { NoAccessError };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class NotSupportedError extends DynamicError.DynamicError {
8
+ }
9
+
10
+ exports.NotSupportedError = NotSupportedError;
@@ -0,0 +1,3 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class NotSupportedError extends DynamicError {
3
+ }
@@ -0,0 +1,6 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class NotSupportedError extends DynamicError {
4
+ }
5
+
6
+ export { NotSupportedError };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class UsernameAlreadyExistsError extends DynamicError.DynamicError {
8
+ constructor() {
9
+ super('Username already exists');
10
+ }
11
+ }
12
+
13
+ exports.UsernameAlreadyExistsError = UsernameAlreadyExistsError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class UsernameAlreadyExistsError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class UsernameAlreadyExistsError extends DynamicError {
4
+ constructor() {
5
+ super('Username already exists');
6
+ }
7
+ }
8
+
9
+ export { UsernameAlreadyExistsError };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class WalletNotDeployedError extends DynamicError.DynamicError {
8
+ constructor() {
9
+ super('Wallet has not been deployed', 'wallet_not_deployed');
10
+ }
11
+ }
12
+
13
+ exports.WalletNotDeployedError = WalletNotDeployedError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class WalletNotDeployedError extends DynamicError {
3
+ constructor();
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class WalletNotDeployedError extends DynamicError {
4
+ constructor() {
5
+ super('Wallet has not been deployed', 'wallet_not_deployed');
6
+ }
7
+ }
8
+
9
+ export { WalletNotDeployedError };
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var DynamicError = require('./DynamicError.cjs');
6
+
7
+ class WalletUsedError extends DynamicError.DynamicError {
8
+ constructor(code) {
9
+ super('WalletUsedError', code);
10
+ }
11
+ }
12
+
13
+ exports.WalletUsedError = WalletUsedError;
@@ -0,0 +1,4 @@
1
+ import { DynamicError } from './DynamicError';
2
+ export declare class WalletUsedError extends DynamicError {
3
+ constructor(code: string);
4
+ }
@@ -0,0 +1,9 @@
1
+ import { DynamicError } from './DynamicError.js';
2
+
3
+ class WalletUsedError extends DynamicError {
4
+ constructor(code) {
5
+ super('WalletUsedError', code);
6
+ }
7
+ }
8
+
9
+ export { WalletUsedError };
@@ -0,0 +1,10 @@
1
+ export * from './ChainalysisError';
2
+ export * from './CustomError';
3
+ export * from './DynamicError';
4
+ export * from './EmailAlreadyExistsError';
5
+ export * from './EmailVerificationError';
6
+ export * from './NoAccessError';
7
+ export * from './NotSupportedError';
8
+ export * from './UsernameAlreadyExistsError';
9
+ export * from './WalletNotDeployedError';
10
+ export * from './WalletUsedError';
package/src/index.cjs CHANGED
@@ -4,8 +4,38 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var parseChainId = require('./parseChainId.cjs');
6
6
  var parseEvmNetworks = require('./parseEvmNetworks.cjs');
7
+ var ChainalysisError = require('./errors/ChainalysisError.cjs');
8
+ var CustomError = require('./errors/CustomError.cjs');
9
+ var DynamicError = require('./errors/DynamicError.cjs');
10
+ var EmailAlreadyExistsError = require('./errors/EmailAlreadyExistsError.cjs');
11
+ var EmailVerificationError = require('./errors/EmailVerificationError.cjs');
12
+ var NoAccessError = require('./errors/NoAccessError.cjs');
13
+ var NotSupportedError = require('./errors/NotSupportedError.cjs');
14
+ var UsernameAlreadyExistsError = require('./errors/UsernameAlreadyExistsError.cjs');
15
+ var WalletNotDeployedError = require('./errors/WalletNotDeployedError.cjs');
16
+ var WalletUsedError = require('./errors/WalletUsedError.cjs');
17
+ var CancellablePromise = require('./CancellablePromise/CancellablePromise.cjs');
18
+ var isFunction = require('./isFunction/isFunction.cjs');
19
+ var isMobile = require('./isMobile.cjs');
7
20
 
8
21
 
9
22
 
10
23
  exports.parseChainId = parseChainId.parseChainId;
11
24
  exports.parseEvmNetworks = parseEvmNetworks.parseEvmNetworks;
25
+ exports.ChainalysisError = ChainalysisError.ChainalysisError;
26
+ exports.CustomError = CustomError.CustomError;
27
+ exports.DynamicError = DynamicError.DynamicError;
28
+ exports.EmailAlreadyExistsError = EmailAlreadyExistsError.EmailAlreadyExistsError;
29
+ exports.EmailVerificationError = EmailVerificationError.EmailVerificationError;
30
+ exports.NoAccessError = NoAccessError.NoAccessError;
31
+ exports.NotSupportedError = NotSupportedError.NotSupportedError;
32
+ exports.UsernameAlreadyExistsError = UsernameAlreadyExistsError.UsernameAlreadyExistsError;
33
+ exports.WalletNotDeployedError = WalletNotDeployedError.WalletNotDeployedError;
34
+ exports.WalletUsedError = WalletUsedError.WalletUsedError;
35
+ exports.CancellablePromise = CancellablePromise.CancellablePromise;
36
+ exports.isFunction = isFunction.isFunction;
37
+ exports.isIOS = isMobile.isIOS;
38
+ exports.isIPad = isMobile.isIPad;
39
+ exports.isIPhone = isMobile.isIPhone;
40
+ exports.isMobile = isMobile.isMobile;
41
+ exports.isSamsungBrowser = isMobile.isSamsungBrowser;
package/src/index.d.ts CHANGED
@@ -1,2 +1,6 @@
1
1
  export * from './parseChainId';
2
2
  export * from './parseEvmNetworks';
3
+ export * from './errors';
4
+ export * from './CancellablePromise';
5
+ export * from './isFunction';
6
+ export * from './isMobile';
package/src/index.js CHANGED
@@ -1,2 +1,15 @@
1
1
  export { parseChainId } from './parseChainId.js';
2
2
  export { parseEvmNetworks } from './parseEvmNetworks.js';
3
+ export { ChainalysisError } from './errors/ChainalysisError.js';
4
+ export { CustomError } from './errors/CustomError.js';
5
+ export { DynamicError } from './errors/DynamicError.js';
6
+ export { EmailAlreadyExistsError } from './errors/EmailAlreadyExistsError.js';
7
+ export { EmailVerificationError } from './errors/EmailVerificationError.js';
8
+ export { NoAccessError } from './errors/NoAccessError.js';
9
+ export { NotSupportedError } from './errors/NotSupportedError.js';
10
+ export { UsernameAlreadyExistsError } from './errors/UsernameAlreadyExistsError.js';
11
+ export { WalletNotDeployedError } from './errors/WalletNotDeployedError.js';
12
+ export { WalletUsedError } from './errors/WalletUsedError.js';
13
+ export { CancellablePromise } from './CancellablePromise/CancellablePromise.js';
14
+ export { isFunction } from './isFunction/isFunction.js';
15
+ export { isIOS, isIPad, isIPhone, isMobile, isSamsungBrowser } from './isMobile.js';
@@ -0,0 +1 @@
1
+ export { isFunction } from './isFunction';
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ // eslint-disable-next-line @typescript-eslint/ban-types
6
+ const isFunction = (value) => typeof value === 'function';
7
+
8
+ exports.isFunction = isFunction;
@@ -0,0 +1 @@
1
+ export declare const isFunction: (value: Function | unknown) => value is Function;
@@ -0,0 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-types
2
+ const isFunction = (value) => typeof value === 'function';
3
+
4
+ export { isFunction };
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * Sourced from http://detectmobilebrowsers.com/
7
+ */
8
+ /* eslint-disable max-len, no-useless-escape */
9
+ const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
10
+ const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
11
+ // This is a regex that covers both iphone, android and any other mobile device.
12
+ const isMobile = (maxTouchPointsOverride) => {
13
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
14
+ return false;
15
+ }
16
+ return (userAgentRegex1.test(navigator.userAgent) ||
17
+ userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
18
+ isIPad(maxTouchPointsOverride) ||
19
+ isIPhone());
20
+ };
21
+ const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
22
+ ? false
23
+ : /iPhone/.test(navigator.userAgent);
24
+ /**
25
+ * @param [optional] maxTouchPointsOverride - this is used for testing since
26
+ * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
27
+ * to mock it
28
+ */
29
+ const isIPad = (maxTouchPointsOverride) => {
30
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
31
+ return false;
32
+ }
33
+ const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
34
+ return (/iPad/.test(navigator.userAgent) ||
35
+ (/Mac/.test(navigator.userAgent) && maxTouchPoints === 5));
36
+ };
37
+ const isIOS = (maxTouchPointsOverride) => {
38
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
39
+ return false;
40
+ }
41
+ return isIPhone() || isIPad(maxTouchPointsOverride);
42
+ };
43
+ const isSamsungBrowser = () => {
44
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
45
+ return false;
46
+ }
47
+ return navigator.userAgent.includes('SamsungBrowser');
48
+ };
49
+
50
+ exports.isIOS = isIOS;
51
+ exports.isIPad = isIPad;
52
+ exports.isIPhone = isIPhone;
53
+ exports.isMobile = isMobile;
54
+ exports.isSamsungBrowser = isSamsungBrowser;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Sourced from http://detectmobilebrowsers.com/
3
+ */
4
+ export declare const isMobile: (maxTouchPointsOverride?: number) => boolean;
5
+ export declare const isIPhone: () => boolean;
6
+ /**
7
+ * @param [optional] maxTouchPointsOverride - this is used for testing since
8
+ * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
9
+ * to mock it
10
+ */
11
+ export declare const isIPad: (maxTouchPointsOverride?: number) => boolean;
12
+ export declare const isIOS: (maxTouchPointsOverride?: number) => boolean;
13
+ export declare const isSamsungBrowser: () => boolean;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Sourced from http://detectmobilebrowsers.com/
3
+ */
4
+ /* eslint-disable max-len, no-useless-escape */
5
+ const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i;
6
+ const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
7
+ // This is a regex that covers both iphone, android and any other mobile device.
8
+ const isMobile = (maxTouchPointsOverride) => {
9
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
10
+ return false;
11
+ }
12
+ return (userAgentRegex1.test(navigator.userAgent) ||
13
+ userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
14
+ isIPad(maxTouchPointsOverride) ||
15
+ isIPhone());
16
+ };
17
+ const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
18
+ ? false
19
+ : /iPhone/.test(navigator.userAgent);
20
+ /**
21
+ * @param [optional] maxTouchPointsOverride - this is used for testing since
22
+ * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
23
+ * to mock it
24
+ */
25
+ const isIPad = (maxTouchPointsOverride) => {
26
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
27
+ return false;
28
+ }
29
+ const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
30
+ return (/iPad/.test(navigator.userAgent) ||
31
+ (/Mac/.test(navigator.userAgent) && maxTouchPoints === 5));
32
+ };
33
+ const isIOS = (maxTouchPointsOverride) => {
34
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
35
+ return false;
36
+ }
37
+ return isIPhone() || isIPad(maxTouchPointsOverride);
38
+ };
39
+ const isSamsungBrowser = () => {
40
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
41
+ return false;
42
+ }
43
+ return navigator.userAgent.includes('SamsungBrowser');
44
+ };
45
+
46
+ export { isIOS, isIPad, isIPhone, isMobile, isSamsungBrowser };