@dynamic-labs/utils 0.0.0-exp20240808.0

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 (238) hide show
  1. package/CHANGELOG.md +3746 -0
  2. package/LICENSE +21 -0
  3. package/README.md +0 -0
  4. package/_virtual/_tslib.cjs +51 -0
  5. package/_virtual/_tslib.js +45 -0
  6. package/package.json +37 -0
  7. package/src/CancellablePromise/CancellablePromise.cjs +136 -0
  8. package/src/CancellablePromise/CancellablePromise.d.ts +54 -0
  9. package/src/CancellablePromise/CancellablePromise.js +132 -0
  10. package/src/CancellablePromise/index.d.ts +1 -0
  11. package/src/DeferredPromise/DeferredPromise.cjs +22 -0
  12. package/src/DeferredPromise/DeferredPromise.d.ts +13 -0
  13. package/src/DeferredPromise/DeferredPromise.js +18 -0
  14. package/src/DeferredPromise/index.d.ts +1 -0
  15. package/src/bufferPolyfill.cjs +15 -0
  16. package/src/bufferPolyfill.d.ts +1 -0
  17. package/src/bufferPolyfill.js +13 -0
  18. package/src/bufferToBase64.cjs +15 -0
  19. package/src/bufferToBase64.d.ts +2 -0
  20. package/src/bufferToBase64.js +11 -0
  21. package/src/ceil/ceil.cjs +11 -0
  22. package/src/ceil/ceil.d.ts +1 -0
  23. package/src/ceil/ceil.js +7 -0
  24. package/src/ceil/index.d.ts +1 -0
  25. package/src/eip6963/eip6963Provider.cjs +40 -0
  26. package/src/eip6963/eip6963Provider.d.ts +34 -0
  27. package/src/eip6963/eip6963Provider.js +35 -0
  28. package/src/eip6963/index.d.ts +1 -0
  29. package/src/errors/AccessBlockedError.cjs +11 -0
  30. package/src/errors/AccessBlockedError.d.ts +3 -0
  31. package/src/errors/AccessBlockedError.js +7 -0
  32. package/src/errors/AccountExistsError.cjs +16 -0
  33. package/src/errors/AccountExistsError.d.ts +14 -0
  34. package/src/errors/AccountExistsError.js +12 -0
  35. package/src/errors/ChainalysisError.cjs +15 -0
  36. package/src/errors/ChainalysisError.d.ts +5 -0
  37. package/src/errors/ChainalysisError.js +11 -0
  38. package/src/errors/CookieInvalidError.cjs +14 -0
  39. package/src/errors/CookieInvalidError.d.ts +4 -0
  40. package/src/errors/CookieInvalidError.js +10 -0
  41. package/src/errors/CustomError.cjs +24 -0
  42. package/src/errors/CustomError.d.ts +11 -0
  43. package/src/errors/CustomError.js +20 -0
  44. package/src/errors/CustomFieldNotUniqueError.cjs +14 -0
  45. package/src/errors/CustomFieldNotUniqueError.d.ts +4 -0
  46. package/src/errors/CustomFieldNotUniqueError.js +10 -0
  47. package/src/errors/DynamicError.cjs +11 -0
  48. package/src/errors/DynamicError.d.ts +3 -0
  49. package/src/errors/DynamicError.js +7 -0
  50. package/src/errors/EmailAlreadyExistsError.cjs +14 -0
  51. package/src/errors/EmailAlreadyExistsError.d.ts +4 -0
  52. package/src/errors/EmailAlreadyExistsError.js +10 -0
  53. package/src/errors/EmailProviderError.cjs +14 -0
  54. package/src/errors/EmailProviderError.d.ts +4 -0
  55. package/src/errors/EmailProviderError.js +10 -0
  56. package/src/errors/EmailVerificationError.cjs +14 -0
  57. package/src/errors/EmailVerificationError.d.ts +4 -0
  58. package/src/errors/EmailVerificationError.js +10 -0
  59. package/src/errors/EmbeddedWalletException.cjs +14 -0
  60. package/src/errors/EmbeddedWalletException.d.ts +4 -0
  61. package/src/errors/EmbeddedWalletException.js +10 -0
  62. package/src/errors/ExternalAuthError.cjs +14 -0
  63. package/src/errors/ExternalAuthError.d.ts +4 -0
  64. package/src/errors/ExternalAuthError.js +10 -0
  65. package/src/errors/GateBlockedError.cjs +15 -0
  66. package/src/errors/GateBlockedError.d.ts +5 -0
  67. package/src/errors/GateBlockedError.js +11 -0
  68. package/src/errors/InsufficientFundsError.cjs +25 -0
  69. package/src/errors/InsufficientFundsError.d.ts +9 -0
  70. package/src/errors/InsufficientFundsError.js +21 -0
  71. package/src/errors/InvalidPhoneNumberError.cjs +14 -0
  72. package/src/errors/InvalidPhoneNumberError.d.ts +4 -0
  73. package/src/errors/InvalidPhoneNumberError.js +10 -0
  74. package/src/errors/MergeAccountsConfirmationError.cjs +16 -0
  75. package/src/errors/MergeAccountsConfirmationError.d.ts +12 -0
  76. package/src/errors/MergeAccountsConfirmationError.js +12 -0
  77. package/src/errors/MfaInvalidOtpError.cjs +14 -0
  78. package/src/errors/MfaInvalidOtpError.d.ts +4 -0
  79. package/src/errors/MfaInvalidOtpError.js +10 -0
  80. package/src/errors/MissingEnvironmentIdError.cjs +14 -0
  81. package/src/errors/MissingEnvironmentIdError.d.ts +4 -0
  82. package/src/errors/MissingEnvironmentIdError.js +10 -0
  83. package/src/errors/MissingPublicAddressError.cjs +14 -0
  84. package/src/errors/MissingPublicAddressError.d.ts +4 -0
  85. package/src/errors/MissingPublicAddressError.js +10 -0
  86. package/src/errors/NoAccessError.cjs +19 -0
  87. package/src/errors/NoAccessError.d.ts +15 -0
  88. package/src/errors/NoAccessError.js +15 -0
  89. package/src/errors/NotSupportedError.cjs +11 -0
  90. package/src/errors/NotSupportedError.d.ts +3 -0
  91. package/src/errors/NotSupportedError.js +7 -0
  92. package/src/errors/PasskeyError.d.ts +8 -0
  93. package/src/errors/SmsVerificationError.cjs +11 -0
  94. package/src/errors/SmsVerificationError.d.ts +3 -0
  95. package/src/errors/SmsVerificationError.js +7 -0
  96. package/src/errors/SocialAccountAlreadyExistsError.cjs +14 -0
  97. package/src/errors/SocialAccountAlreadyExistsError.d.ts +4 -0
  98. package/src/errors/SocialAccountAlreadyExistsError.js +10 -0
  99. package/src/errors/TooManyEmailVerificationsError.cjs +14 -0
  100. package/src/errors/TooManyEmailVerificationsError.d.ts +4 -0
  101. package/src/errors/TooManyEmailVerificationsError.js +10 -0
  102. package/src/errors/TransactionGasCannotBeSponsoredError.cjs +25 -0
  103. package/src/errors/TransactionGasCannotBeSponsoredError.d.ts +9 -0
  104. package/src/errors/TransactionGasCannotBeSponsoredError.js +21 -0
  105. package/src/errors/UserHasAccountWithEmailError.cjs +15 -0
  106. package/src/errors/UserHasAccountWithEmailError.d.ts +5 -0
  107. package/src/errors/UserHasAccountWithEmailError.js +11 -0
  108. package/src/errors/UserRejectedTransactionError.cjs +14 -0
  109. package/src/errors/UserRejectedTransactionError.d.ts +4 -0
  110. package/src/errors/UserRejectedTransactionError.js +10 -0
  111. package/src/errors/UsernameAlreadyExistsError.cjs +14 -0
  112. package/src/errors/UsernameAlreadyExistsError.d.ts +4 -0
  113. package/src/errors/UsernameAlreadyExistsError.js +10 -0
  114. package/src/errors/VerificationDataCollectionError.cjs +15 -0
  115. package/src/errors/VerificationDataCollectionError.d.ts +5 -0
  116. package/src/errors/VerificationDataCollectionError.js +11 -0
  117. package/src/errors/WalletAddressMismatchError.cjs +17 -0
  118. package/src/errors/WalletAddressMismatchError.d.ts +11 -0
  119. package/src/errors/WalletAddressMismatchError.js +13 -0
  120. package/src/errors/WalletNotDeployedError.cjs +14 -0
  121. package/src/errors/WalletNotDeployedError.d.ts +4 -0
  122. package/src/errors/WalletNotDeployedError.js +10 -0
  123. package/src/errors/WalletUsedError.cjs +14 -0
  124. package/src/errors/WalletUsedError.d.ts +4 -0
  125. package/src/errors/WalletUsedError.js +10 -0
  126. package/src/errors/index.d.ts +33 -0
  127. package/src/formatNumberText/formatNumberText.cjs +20 -0
  128. package/src/formatNumberText/formatNumberText.d.ts +5 -0
  129. package/src/formatNumberText/formatNumberText.js +16 -0
  130. package/src/formatNumberText/index.d.ts +1 -0
  131. package/src/get/get.cjs +24 -0
  132. package/src/get/get.d.ts +7 -0
  133. package/src/get/get.js +20 -0
  134. package/src/get/index.d.ts +1 -0
  135. package/src/getProvidersFromWindow.cjs +39 -0
  136. package/src/getProvidersFromWindow.d.ts +7 -0
  137. package/src/getProvidersFromWindow.js +35 -0
  138. package/src/getTLD/getTLD.cjs +12 -0
  139. package/src/getTLD/getTLD.d.ts +1 -0
  140. package/src/getTLD/getTLD.js +8 -0
  141. package/src/getTLD/index.d.ts +1 -0
  142. package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.cjs +20 -0
  143. package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.d.ts +4 -0
  144. package/src/handleMobileWalletRedirect/handleMobileWalletRedirect.js +16 -0
  145. package/src/handleMobileWalletRedirect/index.d.ts +1 -0
  146. package/src/hexToString/hexToString.cjs +32 -0
  147. package/src/hexToString/hexToString.d.ts +12 -0
  148. package/src/hexToString/hexToString.js +28 -0
  149. package/src/hexToString/index.d.ts +1 -0
  150. package/src/index.cjs +151 -0
  151. package/src/index.d.ts +32 -0
  152. package/src/index.js +66 -0
  153. package/src/isFunction/index.d.ts +1 -0
  154. package/src/isFunction/isFunction.cjs +9 -0
  155. package/src/isFunction/isFunction.d.ts +1 -0
  156. package/src/isFunction/isFunction.js +5 -0
  157. package/src/isHex/index.d.ts +1 -0
  158. package/src/isHex/isHex.cjs +20 -0
  159. package/src/isHex/isHex.d.ts +6 -0
  160. package/src/isHex/isHex.js +16 -0
  161. package/src/isLedgerAddressViaVerifiedCredentials.cjs +13 -0
  162. package/src/isLedgerAddressViaVerifiedCredentials.d.ts +2 -0
  163. package/src/isLedgerAddressViaVerifiedCredentials.js +9 -0
  164. package/src/isMobile.cjs +146 -0
  165. package/src/isMobile.d.ts +18 -0
  166. package/src/isMobile.js +133 -0
  167. package/src/last.cjs +22 -0
  168. package/src/last.d.ts +15 -0
  169. package/src/last.js +18 -0
  170. package/src/localStorageAsync.cjs +38 -0
  171. package/src/localStorageAsync.d.ts +3 -0
  172. package/src/localStorageAsync.js +32 -0
  173. package/src/logger/index.d.ts +1 -0
  174. package/src/logger/logger.cjs +10 -0
  175. package/src/logger/logger.d.ts +2 -0
  176. package/src/logger/logger.js +6 -0
  177. package/src/nativeMobileOauthStateParam.cjs +13 -0
  178. package/src/nativeMobileOauthStateParam.d.ts +14 -0
  179. package/src/nativeMobileOauthStateParam.js +9 -0
  180. package/src/parseChainId.cjs +8 -0
  181. package/src/parseChainId.d.ts +1 -0
  182. package/src/parseChainId.js +4 -0
  183. package/src/parseEvmNetworks.cjs +17 -0
  184. package/src/parseEvmNetworks.d.ts +2 -0
  185. package/src/parseEvmNetworks.js +13 -0
  186. package/src/pipe/index.d.ts +1 -0
  187. package/src/pipe/pipe.cjs +40 -0
  188. package/src/pipe/pipe.d.ts +27 -0
  189. package/src/pipe/pipe.js +36 -0
  190. package/src/retryableFn.cjs +73 -0
  191. package/src/retryableFn.d.ts +19 -0
  192. package/src/retryableFn.js +68 -0
  193. package/src/runSafe/index.d.ts +1 -0
  194. package/src/runSafe/runSafe.cjs +25 -0
  195. package/src/runSafe/runSafe.d.ts +8 -0
  196. package/src/runSafe/runSafe.js +21 -0
  197. package/src/services/FetchService/FetchService.cjs +29 -0
  198. package/src/services/FetchService/FetchService.d.ts +10 -0
  199. package/src/services/FetchService/FetchService.js +25 -0
  200. package/src/services/FetchService/index.d.ts +2 -0
  201. package/src/services/FetchService/types.d.ts +3 -0
  202. package/src/services/Oauth2Service/Oauth2Service.cjs +38 -0
  203. package/src/services/Oauth2Service/Oauth2Service.d.ts +34 -0
  204. package/src/services/Oauth2Service/Oauth2Service.js +34 -0
  205. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.cjs +192 -0
  206. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.d.ts +2 -0
  207. package/src/services/Oauth2Service/createWindowOauth2Service/createWindowOauth2Service.js +188 -0
  208. package/src/services/Oauth2Service/createWindowOauth2Service/index.d.ts +1 -0
  209. package/src/services/Oauth2Service/index.d.ts +2 -0
  210. package/src/services/PlatformService/PlatformService.cjs +40 -0
  211. package/src/services/PlatformService/PlatformService.d.ts +11 -0
  212. package/src/services/PlatformService/PlatformService.js +36 -0
  213. package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.cjs +30 -0
  214. package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.d.ts +2 -0
  215. package/src/services/PlatformService/createBrowserPlatformService/createBrowserPlatformService.js +26 -0
  216. package/src/services/PlatformService/createBrowserPlatformService/index.d.ts +1 -0
  217. package/src/services/PlatformService/index.d.ts +3 -0
  218. package/src/services/PlatformService/types.d.ts +25 -0
  219. package/src/sleep/index.d.ts +1 -0
  220. package/src/sleep/sleep.cjs +13 -0
  221. package/src/sleep/sleep.d.ts +11 -0
  222. package/src/sleep/sleep.js +9 -0
  223. package/src/template/index.d.ts +1 -0
  224. package/src/template/template.cjs +25 -0
  225. package/src/template/template.d.ts +18 -0
  226. package/src/template/template.js +21 -0
  227. package/src/trimEnd/index.d.ts +1 -0
  228. package/src/trimEnd/trimEnd.cjs +14 -0
  229. package/src/trimEnd/trimEnd.d.ts +1 -0
  230. package/src/trimEnd/trimEnd.js +10 -0
  231. package/src/uniq/index.d.ts +1 -0
  232. package/src/uniq/uniq.cjs +33 -0
  233. package/src/uniq/uniq.d.ts +17 -0
  234. package/src/uniq/uniq.js +29 -0
  235. package/src/wrapMethodWithCallback/index.d.ts +1 -0
  236. package/src/wrapMethodWithCallback/wrapMethodWithCallback.cjs +47 -0
  237. package/src/wrapMethodWithCallback/wrapMethodWithCallback.d.ts +36 -0
  238. package/src/wrapMethodWithCallback/wrapMethodWithCallback.js +43 -0
@@ -0,0 +1 @@
1
+ export { isFunction } from './isFunction';
@@ -0,0 +1,9 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ // eslint-disable-next-line @typescript-eslint/ban-types
7
+ const isFunction = (value) => typeof value === 'function';
8
+
9
+ exports.isFunction = isFunction;
@@ -0,0 +1 @@
1
+ export declare const isFunction: (value: Function | unknown) => value is Function;
@@ -0,0 +1,5 @@
1
+ 'use client'
2
+ // eslint-disable-next-line @typescript-eslint/ban-types
3
+ const isFunction = (value) => typeof value === 'function';
4
+
5
+ export { isFunction };
@@ -0,0 +1 @@
1
+ export { isHex } from './isHex';
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Checks if the provided string is a valid hexadecimal string.
8
+ * @param str The string to check.
9
+ * @returns `true` if the string is a valid hexadecimal string, `false` otherwise.
10
+ */
11
+ const isHex = (str) => {
12
+ if (typeof str !== 'string') {
13
+ throw new Error('Input must be a string');
14
+ }
15
+ const normalizedStr = str.startsWith('0x') ? str.substring(2) : str;
16
+ const regex = /^[0-9a-fA-F]+$/;
17
+ return regex.test(normalizedStr);
18
+ };
19
+
20
+ exports.isHex = isHex;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if the provided string is a valid hexadecimal string.
3
+ * @param str The string to check.
4
+ * @returns `true` if the string is a valid hexadecimal string, `false` otherwise.
5
+ */
6
+ export declare const isHex: (str: string) => boolean;
@@ -0,0 +1,16 @@
1
+ 'use client'
2
+ /**
3
+ * Checks if the provided string is a valid hexadecimal string.
4
+ * @param str The string to check.
5
+ * @returns `true` if the string is a valid hexadecimal string, `false` otherwise.
6
+ */
7
+ const isHex = (str) => {
8
+ if (typeof str !== 'string') {
9
+ throw new Error('Input must be a string');
10
+ }
11
+ const normalizedStr = str.startsWith('0x') ? str.substring(2) : str;
12
+ const regex = /^[0-9a-fA-F]+$/;
13
+ return regex.test(normalizedStr);
14
+ };
15
+
16
+ export { isHex };
@@ -0,0 +1,13 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const isLedgerAddressViaVerifiedCredentials = (address, verifiedCredentials) => {
7
+ const ledgerWallets = verifiedCredentials
8
+ .filter((v) => { var _a; return ((_a = v.walletProperties) === null || _a === void 0 ? void 0 : _a.hardwareWallet) === 'ledger'; })
9
+ .map((v) => v.address);
10
+ return ledgerWallets.includes(address);
11
+ };
12
+
13
+ exports.isLedgerAddressViaVerifiedCredentials = isLedgerAddressViaVerifiedCredentials;
@@ -0,0 +1,2 @@
1
+ import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
2
+ export declare const isLedgerAddressViaVerifiedCredentials: (address: string, verifiedCredentials: JwtVerifiedCredential[]) => boolean;
@@ -0,0 +1,9 @@
1
+ 'use client'
2
+ const isLedgerAddressViaVerifiedCredentials = (address, verifiedCredentials) => {
3
+ const ledgerWallets = verifiedCredentials
4
+ .filter((v) => { var _a; return ((_a = v.walletProperties) === null || _a === void 0 ? void 0 : _a.hardwareWallet) === 'ledger'; })
5
+ .map((v) => v.address);
6
+ return ledgerWallets.includes(address);
7
+ };
8
+
9
+ export { isLedgerAddressViaVerifiedCredentials };
@@ -0,0 +1,146 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Sourced from http://detectmobilebrowsers.com/
8
+ */
9
+ /* eslint-disable max-len, no-useless-escape */
10
+ 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;
11
+ 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;
12
+ // This is a regex that covers both iphone, android and any other mobile device.
13
+ const isMobile = (maxTouchPointsOverride) => {
14
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
15
+ return false;
16
+ }
17
+ return (userAgentRegex1.test(navigator.userAgent) ||
18
+ userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
19
+ isIPad(maxTouchPointsOverride) ||
20
+ isIPhone());
21
+ };
22
+ const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
23
+ ? false
24
+ : /iPhone/.test(navigator.userAgent);
25
+ const isIPhone8OrEarlier = () => typeof window === 'undefined' || typeof navigator === 'undefined'
26
+ ? false
27
+ : iPhoneLegacyRegex.some(({ regex }) => regex.test(navigator.userAgent));
28
+ /**
29
+ * @param [optional] maxTouchPointsOverride - this is used for testing since
30
+ * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
31
+ * to mock it
32
+ */
33
+ const isIPad = (maxTouchPointsOverride) => {
34
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
35
+ return false;
36
+ }
37
+ const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
38
+ return (/iPad/.test(navigator.userAgent) ||
39
+ (/Mac/.test(navigator.userAgent) && maxTouchPoints === 5));
40
+ };
41
+ const isIOS = (maxTouchPointsOverride) => {
42
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
43
+ return false;
44
+ }
45
+ return isIPhone() || isIPad(maxTouchPointsOverride);
46
+ };
47
+ const isAndroid = () => isMobile() && !isIOS();
48
+ const isLegacySafari = () => {
49
+ // We need to check if window.CSS exists and if it has supports function.
50
+ // We can use it only in browsers. This prevents customer tests from failing because of that.
51
+ if (typeof window === 'undefined' ||
52
+ !window.CSS ||
53
+ typeof window.CSS.supports !== 'function') {
54
+ return false;
55
+ }
56
+ // Older versions of Safari <15 are not supporting aspect-ratio css property.
57
+ // We can use that to check if user is on older browser.
58
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
59
+ const cssValue = 'aspect-ratio: 1 / 1';
60
+ return !CSS.supports(cssValue);
61
+ };
62
+ const isSamsungBrowser = () => {
63
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
64
+ return false;
65
+ }
66
+ return navigator.userAgent.includes('SamsungBrowser');
67
+ };
68
+ const isWindows = () => {
69
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
70
+ return false;
71
+ }
72
+ return navigator.userAgent.indexOf('Windows') !== -1;
73
+ };
74
+ // regex from: https://github.com/matomo-org/device-detector/blob/master/regexes/device/mobiles.yml
75
+ const iPhoneLegacyRegex = [
76
+ {
77
+ model: 'iPhone 5',
78
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]12|5)$/,
79
+ },
80
+ {
81
+ model: 'iPhone 5C',
82
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]34)$/,
83
+ },
84
+ {
85
+ model: 'iPhone 5S',
86
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?6[C,_]12|5S)$/,
87
+ },
88
+ {
89
+ model: 'iPhone 6 Plus',
90
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]1|1C2%257enohPi|6PLUS)$/,
91
+ },
92
+ {
93
+ model: 'iPhone 6',
94
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]2|6)$/,
95
+ },
96
+ {
97
+ model: 'iPhone 6s Plus',
98
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]2|6SPLUS)$/,
99
+ },
100
+ {
101
+ model: 'iPhone 6s',
102
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]1|iPhone[ /]6s|6S)$/,
103
+ },
104
+ {
105
+ model: 'iPhone SE',
106
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]4|SE)$/,
107
+ },
108
+ {
109
+ model: 'iPhone 7',
110
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]13|iphone7|7)$/,
111
+ },
112
+ {
113
+ model: 'iPhone 7 Plus',
114
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]24|7PLUS)$/,
115
+ },
116
+ {
117
+ model: 'iPhone 8',
118
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]14|8)$/,
119
+ },
120
+ {
121
+ model: 'iPhone 8 Plus',
122
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]25|8PLUS)$/,
123
+ },
124
+ ];
125
+ const getAndroidVersion = () => {
126
+ if (typeof navigator === 'undefined') {
127
+ return;
128
+ }
129
+ const androidVersionMatch = navigator.userAgent.match(/Android (\d+(\.\d+)?)/);
130
+ if (!androidVersionMatch) {
131
+ return;
132
+ }
133
+ const androidVersion = parseFloat(androidVersionMatch[1]);
134
+ return androidVersion;
135
+ };
136
+
137
+ exports.getAndroidVersion = getAndroidVersion;
138
+ exports.isAndroid = isAndroid;
139
+ exports.isIOS = isIOS;
140
+ exports.isIPad = isIPad;
141
+ exports.isIPhone = isIPhone;
142
+ exports.isIPhone8OrEarlier = isIPhone8OrEarlier;
143
+ exports.isLegacySafari = isLegacySafari;
144
+ exports.isMobile = isMobile;
145
+ exports.isSamsungBrowser = isSamsungBrowser;
146
+ exports.isWindows = isWindows;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Sourced from http://detectmobilebrowsers.com/
3
+ */
4
+ export declare const isMobile: (maxTouchPointsOverride?: number) => boolean;
5
+ export declare const isIPhone: () => boolean;
6
+ export declare const isIPhone8OrEarlier: () => boolean;
7
+ /**
8
+ * @param [optional] maxTouchPointsOverride - this is used for testing since
9
+ * it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
10
+ * to mock it
11
+ */
12
+ export declare const isIPad: (maxTouchPointsOverride?: number) => boolean;
13
+ export declare const isIOS: (maxTouchPointsOverride?: number) => boolean;
14
+ export declare const isAndroid: () => boolean;
15
+ export declare const isLegacySafari: () => boolean;
16
+ export declare const isSamsungBrowser: () => boolean;
17
+ export declare const isWindows: () => boolean;
18
+ export declare const getAndroidVersion: () => number | undefined;
@@ -0,0 +1,133 @@
1
+ 'use client'
2
+ /**
3
+ * Sourced from http://detectmobilebrowsers.com/
4
+ */
5
+ /* eslint-disable max-len, no-useless-escape */
6
+ 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;
7
+ 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;
8
+ // This is a regex that covers both iphone, android and any other mobile device.
9
+ const isMobile = (maxTouchPointsOverride) => {
10
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
11
+ return false;
12
+ }
13
+ return (userAgentRegex1.test(navigator.userAgent) ||
14
+ userAgentRegex2.test(navigator.userAgent.substring(0, 4)) ||
15
+ isIPad(maxTouchPointsOverride) ||
16
+ isIPhone());
17
+ };
18
+ const isIPhone = () => typeof window === 'undefined' || typeof navigator === 'undefined'
19
+ ? false
20
+ : /iPhone/.test(navigator.userAgent);
21
+ const isIPhone8OrEarlier = () => typeof window === 'undefined' || typeof navigator === 'undefined'
22
+ ? false
23
+ : iPhoneLegacyRegex.some(({ regex }) => regex.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 isAndroid = () => isMobile() && !isIOS();
44
+ const isLegacySafari = () => {
45
+ // We need to check if window.CSS exists and if it has supports function.
46
+ // We can use it only in browsers. This prevents customer tests from failing because of that.
47
+ if (typeof window === 'undefined' ||
48
+ !window.CSS ||
49
+ typeof window.CSS.supports !== 'function') {
50
+ return false;
51
+ }
52
+ // Older versions of Safari <15 are not supporting aspect-ratio css property.
53
+ // We can use that to check if user is on older browser.
54
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/aspect-ratio
55
+ const cssValue = 'aspect-ratio: 1 / 1';
56
+ return !CSS.supports(cssValue);
57
+ };
58
+ const isSamsungBrowser = () => {
59
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
60
+ return false;
61
+ }
62
+ return navigator.userAgent.includes('SamsungBrowser');
63
+ };
64
+ const isWindows = () => {
65
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') {
66
+ return false;
67
+ }
68
+ return navigator.userAgent.indexOf('Windows') !== -1;
69
+ };
70
+ // regex from: https://github.com/matomo-org/device-detector/blob/master/regexes/device/mobiles.yml
71
+ const iPhoneLegacyRegex = [
72
+ {
73
+ model: 'iPhone 5',
74
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]12|5)$/,
75
+ },
76
+ {
77
+ model: 'iPhone 5C',
78
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?5[C,_]34)$/,
79
+ },
80
+ {
81
+ model: 'iPhone 5S',
82
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?6[C,_]12|5S)$/,
83
+ },
84
+ {
85
+ model: 'iPhone 6 Plus',
86
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]1|1C2%257enohPi|6PLUS)$/,
87
+ },
88
+ {
89
+ model: 'iPhone 6',
90
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?7[C,_]2|6)$/,
91
+ },
92
+ {
93
+ model: 'iPhone 6s Plus',
94
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]2|6SPLUS)$/,
95
+ },
96
+ {
97
+ model: 'iPhone 6s',
98
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]1|iPhone[ /]6s|6S)$/,
99
+ },
100
+ {
101
+ model: 'iPhone SE',
102
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?8[C,_]4|SE)$/,
103
+ },
104
+ {
105
+ model: 'iPhone 7',
106
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]13|iphone7|7)$/,
107
+ },
108
+ {
109
+ model: 'iPhone 7 Plus',
110
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?9[C,_]24|7PLUS)$/,
111
+ },
112
+ {
113
+ model: 'iPhone 8',
114
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]14|8)$/,
115
+ },
116
+ {
117
+ model: 'iPhone 8 Plus',
118
+ regex: /(?:MDCR_|ICRU_|Apple-)?(?:iPh(?:one)?10[C,_]25|8PLUS)$/,
119
+ },
120
+ ];
121
+ const getAndroidVersion = () => {
122
+ if (typeof navigator === 'undefined') {
123
+ return;
124
+ }
125
+ const androidVersionMatch = navigator.userAgent.match(/Android (\d+(\.\d+)?)/);
126
+ if (!androidVersionMatch) {
127
+ return;
128
+ }
129
+ const androidVersion = parseFloat(androidVersionMatch[1]);
130
+ return androidVersion;
131
+ };
132
+
133
+ export { getAndroidVersion, isAndroid, isIOS, isIPad, isIPhone, isIPhone8OrEarlier, isLegacySafari, isMobile, isSamsungBrowser, isWindows };
package/src/last.cjs ADDED
@@ -0,0 +1,22 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Retrieves the last item from an array.
8
+ *
9
+ * @template T - The type of the items in the array.
10
+ * @param {T[]} arr - The array from which to retrieve the last item.
11
+ * @returns {T | undefined} The last item in the array, or undefined if the array is empty.
12
+ *
13
+ * @example
14
+ * const numbers = [1, 2, 3, 4, 5];
15
+ * console.log(last(numbers)); // Outputs: 5
16
+ *
17
+ * const emptyArray: number[] = [];
18
+ * console.log(last(emptyArray)); // Outputs: undefined
19
+ */
20
+ const last = (arr) => arr.length > 0 ? arr[arr.length - 1] : undefined;
21
+
22
+ exports.last = last;
package/src/last.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Retrieves the last item from an array.
3
+ *
4
+ * @template T - The type of the items in the array.
5
+ * @param {T[]} arr - The array from which to retrieve the last item.
6
+ * @returns {T | undefined} The last item in the array, or undefined if the array is empty.
7
+ *
8
+ * @example
9
+ * const numbers = [1, 2, 3, 4, 5];
10
+ * console.log(last(numbers)); // Outputs: 5
11
+ *
12
+ * const emptyArray: number[] = [];
13
+ * console.log(last(emptyArray)); // Outputs: undefined
14
+ */
15
+ export declare const last: <T>(arr: T[]) => T | undefined;
package/src/last.js ADDED
@@ -0,0 +1,18 @@
1
+ 'use client'
2
+ /**
3
+ * Retrieves the last item from an array.
4
+ *
5
+ * @template T - The type of the items in the array.
6
+ * @param {T[]} arr - The array from which to retrieve the last item.
7
+ * @returns {T | undefined} The last item in the array, or undefined if the array is empty.
8
+ *
9
+ * @example
10
+ * const numbers = [1, 2, 3, 4, 5];
11
+ * console.log(last(numbers)); // Outputs: 5
12
+ *
13
+ * const emptyArray: number[] = [];
14
+ * console.log(last(emptyArray)); // Outputs: undefined
15
+ */
16
+ const last = (arr) => arr.length > 0 ? arr[arr.length - 1] : undefined;
17
+
18
+ export { last };
@@ -0,0 +1,38 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../_virtual/_tslib.cjs');
7
+
8
+ const getItemAsync = (key) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
+ if (typeof window === 'undefined') {
10
+ return undefined;
11
+ }
12
+ const value = window.localStorage.getItem(key);
13
+ if (!value) {
14
+ return undefined;
15
+ }
16
+ try {
17
+ return JSON.parse(value);
18
+ }
19
+ catch (error) {
20
+ return value;
21
+ }
22
+ });
23
+ const setItemAsync = (key, value) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
24
+ if (typeof window === 'undefined') {
25
+ return undefined;
26
+ }
27
+ window.localStorage.setItem(key, JSON.stringify(value));
28
+ });
29
+ const removeItemAsync = (key) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
30
+ if (typeof window === 'undefined') {
31
+ return undefined;
32
+ }
33
+ return localStorage.removeItem(key);
34
+ });
35
+
36
+ exports.getItemAsync = getItemAsync;
37
+ exports.removeItemAsync = removeItemAsync;
38
+ exports.setItemAsync = setItemAsync;
@@ -0,0 +1,3 @@
1
+ export declare const getItemAsync: <T = string>(key: string) => Promise<T | undefined>;
2
+ export declare const setItemAsync: <T = string>(key: string, value: T) => Promise<void>;
3
+ export declare const removeItemAsync: (key: string) => Promise<void>;
@@ -0,0 +1,32 @@
1
+ 'use client'
2
+ import { __awaiter } from '../_virtual/_tslib.js';
3
+
4
+ const getItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
5
+ if (typeof window === 'undefined') {
6
+ return undefined;
7
+ }
8
+ const value = window.localStorage.getItem(key);
9
+ if (!value) {
10
+ return undefined;
11
+ }
12
+ try {
13
+ return JSON.parse(value);
14
+ }
15
+ catch (error) {
16
+ return value;
17
+ }
18
+ });
19
+ const setItemAsync = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
20
+ if (typeof window === 'undefined') {
21
+ return undefined;
22
+ }
23
+ window.localStorage.setItem(key, JSON.stringify(value));
24
+ });
25
+ const removeItemAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
26
+ if (typeof window === 'undefined') {
27
+ return undefined;
28
+ }
29
+ return localStorage.removeItem(key);
30
+ });
31
+
32
+ export { getItemAsync, removeItemAsync, setItemAsync };
@@ -0,0 +1 @@
1
+ export * from './logger';
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var logger$1 = require('@dynamic-labs/logger');
7
+
8
+ const logger = new logger$1.Logger('utils');
9
+
10
+ exports.logger = logger;
@@ -0,0 +1,2 @@
1
+ import { Logger } from '@dynamic-labs/logger';
2
+ export declare const logger: Logger;
@@ -0,0 +1,6 @@
1
+ 'use client'
2
+ import { Logger } from '@dynamic-labs/logger';
3
+
4
+ const logger = new Logger('utils');
5
+
6
+ export { logger };
@@ -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 };
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const parseChainId = (chainId) => parseInt(chainId.toString());
7
+
8
+ exports.parseChainId = parseChainId;
@@ -0,0 +1 @@
1
+ export declare const parseChainId: (chainId: number | string) => number;
@@ -0,0 +1,4 @@
1
+ 'use client'
2
+ const parseChainId = (chainId) => parseInt(chainId.toString());
3
+
4
+ export { parseChainId };
@@ -0,0 +1,17 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var parseChainId = require('./parseChainId.cjs');
7
+
8
+ const parseEvmNetworks = (networks) => {
9
+ const clone = networks.slice();
10
+ return clone.map((network) => {
11
+ network.chainId = parseChainId.parseChainId(network.chainId);
12
+ network.networkId = parseChainId.parseChainId(network.networkId);
13
+ return network;
14
+ });
15
+ };
16
+
17
+ exports.parseEvmNetworks = parseEvmNetworks;
@@ -0,0 +1,2 @@
1
+ import { EvmNetwork, GenericNetwork } from '@dynamic-labs/types';
2
+ export declare const parseEvmNetworks: (networks: GenericNetwork[]) => EvmNetwork[];