@dynamic-labs/wallet-book 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.
- package/CHANGELOG.md +3746 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/_virtual/_tslib.cjs +49 -0
- package/_virtual/_tslib.js +44 -0
- package/package.json +38 -0
- package/src/build/index.d.ts +76 -0
- package/src/build/sources/firstParty/index.d.ts +2 -0
- package/src/build/sources/index.d.ts +4 -0
- package/src/build/sources/walletConnect/index.d.ts +128 -0
- package/src/build/sources/walletConnect/preprocessors.d.ts +14 -0
- package/src/build/sources/walletConnectOverrides/index.d.ts +197 -0
- package/src/build/sources/walletGroups/index.d.ts +2 -0
- package/src/components/BrandIcon.cjs +27 -0
- package/src/components/BrandIcon.d.ts +8 -0
- package/src/components/BrandIcon.js +23 -0
- package/src/components/WalletBookContext.cjs +14 -0
- package/src/components/WalletBookContext.d.ts +9 -0
- package/src/components/WalletBookContext.js +9 -0
- package/src/components/WalletIcon.cjs +34 -0
- package/src/components/WalletIcon.d.ts +8 -0
- package/src/components/WalletIcon.js +30 -0
- package/src/components/index.d.ts +3 -0
- package/src/helpers/findWalletBookWallet.cjs +18 -0
- package/src/helpers/findWalletBookWallet.d.ts +70 -0
- package/src/helpers/findWalletBookWallet.js +14 -0
- package/src/helpers/findWalletGroup.cjs +19 -0
- package/src/helpers/findWalletGroup.d.ts +18 -0
- package/src/helpers/findWalletGroup.js +15 -0
- package/src/helpers/findWalletGroupOverride.cjs +14 -0
- package/src/helpers/findWalletGroupOverride.d.ts +3 -0
- package/src/helpers/findWalletGroupOverride.js +10 -0
- package/src/helpers/getBrandIconUrl.cjs +15 -0
- package/src/helpers/getBrandIconUrl.d.ts +2 -0
- package/src/helpers/getBrandIconUrl.js +11 -0
- package/src/helpers/getWalletBookCdnUrl.cjs +14 -0
- package/src/helpers/getWalletBookCdnUrl.d.ts +1 -0
- package/src/helpers/getWalletBookCdnUrl.js +10 -0
- package/src/helpers/getWalletBookWallet.cjs +17 -0
- package/src/helpers/getWalletBookWallet.d.ts +2 -0
- package/src/helpers/getWalletBookWallet.js +13 -0
- package/src/helpers/getWalletGroup.cjs +13 -0
- package/src/helpers/getWalletGroup.d.ts +3 -0
- package/src/helpers/getWalletGroup.js +9 -0
- package/src/helpers/getWalletIconUrl.cjs +34 -0
- package/src/helpers/getWalletIconUrl.d.ts +3 -0
- package/src/helpers/getWalletIconUrl.js +29 -0
- package/src/helpers/getWalletLinks.cjs +34 -0
- package/src/helpers/getWalletLinks.d.ts +10 -0
- package/src/helpers/getWalletLinks.js +30 -0
- package/src/helpers/getWalletPrimaryColor.cjs +14 -0
- package/src/helpers/getWalletPrimaryColor.d.ts +2 -0
- package/src/helpers/getWalletPrimaryColor.js +10 -0
- package/src/helpers/index.d.ts +14 -0
- package/src/helpers/isWalletEventSupported.cjs +8 -0
- package/src/helpers/isWalletEventSupported.d.ts +2 -0
- package/src/helpers/isWalletEventSupported.js +4 -0
- package/src/helpers/isWalletMethodSupported.cjs +8 -0
- package/src/helpers/isWalletMethodSupported.d.ts +2 -0
- package/src/helpers/isWalletMethodSupported.js +4 -0
- package/src/helpers/logger.cjs +10 -0
- package/src/helpers/logger.d.ts +2 -0
- package/src/helpers/logger.js +6 -0
- package/src/helpers/renderTemplate.cjs +23 -0
- package/src/helpers/renderTemplate.d.ts +12 -0
- package/src/helpers/renderTemplate.js +19 -0
- package/src/hooks/index.d.ts +2 -0
- package/src/hooks/useWalletBookCdn.cjs +51 -0
- package/src/hooks/useWalletBookCdn.d.ts +88 -0
- package/src/hooks/useWalletBookCdn.js +47 -0
- package/src/hooks/useWalletBookContext.cjs +24 -0
- package/src/hooks/useWalletBookContext.d.ts +1 -0
- package/src/hooks/useWalletBookContext.js +20 -0
- package/src/index.cjs +44 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +20 -0
- package/src/schemas/index.d.ts +3 -0
- package/src/schemas/utils/filterEmptyObject.cjs +13 -0
- package/src/schemas/utils/filterEmptyObject.d.ts +6 -0
- package/src/schemas/utils/filterEmptyObject.js +9 -0
- package/src/schemas/utils/nonEmptyString.cjs +13 -0
- package/src/schemas/utils/nonEmptyString.d.ts +5 -0
- package/src/schemas/utils/nonEmptyString.js +9 -0
- package/src/schemas/utils/nonEmptyStringArray.cjs +13 -0
- package/src/schemas/utils/nonEmptyStringArray.d.ts +5 -0
- package/src/schemas/utils/nonEmptyStringArray.js +9 -0
- package/src/schemas/utils/processWalletConnectNativeUrl.d.ts +1 -0
- package/src/schemas/utils/sortKeys.d.ts +5 -0
- package/src/schemas/utils/transformAndroidId.cjs +24 -0
- package/src/schemas/utils/transformAndroidId.d.ts +1 -0
- package/src/schemas/utils/transformAndroidId.js +20 -0
- package/src/schemas/utils/transformChromeExtensionId.cjs +21 -0
- package/src/schemas/utils/transformChromeExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformChromeExtensionId.js +17 -0
- package/src/schemas/utils/transformEdgeExtensionId.cjs +21 -0
- package/src/schemas/utils/transformEdgeExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformEdgeExtensionId.js +17 -0
- package/src/schemas/utils/transformFirefoxExtensionId.cjs +21 -0
- package/src/schemas/utils/transformFirefoxExtensionId.d.ts +1 -0
- package/src/schemas/utils/transformFirefoxExtensionId.js +17 -0
- package/src/schemas/utils/transformIosId.cjs +28 -0
- package/src/schemas/utils/transformIosId.d.ts +1 -0
- package/src/schemas/utils/transformIosId.js +24 -0
- package/src/schemas/walletBookSchema.cjs +17 -0
- package/src/schemas/walletBookSchema.d.ts +1369 -0
- package/src/schemas/walletBookSchema.js +13 -0
- package/src/schemas/walletConnectSourceSchema.cjs +78 -0
- package/src/schemas/walletConnectSourceSchema.d.ts +516 -0
- package/src/schemas/walletConnectSourceSchema.js +74 -0
- package/src/schemas/walletGroup.cjs +27 -0
- package/src/schemas/walletGroup.d.ts +113 -0
- package/src/schemas/walletGroup.js +23 -0
- package/src/schemas/walletSchema.cjs +141 -0
- package/src/schemas/walletSchema.d.ts +614 -0
- package/src/schemas/walletSchema.js +136 -0
- package/wallet-book-fallbacks.cjs +1082 -0
- package/wallet-book-fallbacks.js +1076 -0
package/src/index.cjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var getWalletIconUrl = require('./helpers/getWalletIconUrl.cjs');
|
|
7
|
+
var getWalletBookWallet = require('./helpers/getWalletBookWallet.cjs');
|
|
8
|
+
var getWalletLinks = require('./helpers/getWalletLinks.cjs');
|
|
9
|
+
var getWalletPrimaryColor = require('./helpers/getWalletPrimaryColor.cjs');
|
|
10
|
+
require('./helpers/renderTemplate.cjs');
|
|
11
|
+
var findWalletBookWallet = require('./helpers/findWalletBookWallet.cjs');
|
|
12
|
+
require('./helpers/logger.cjs');
|
|
13
|
+
var getWalletGroup = require('./helpers/getWalletGroup.cjs');
|
|
14
|
+
var findWalletGroup = require('./helpers/findWalletGroup.cjs');
|
|
15
|
+
var getWalletBookCdnUrl = require('./helpers/getWalletBookCdnUrl.cjs');
|
|
16
|
+
var getBrandIconUrl = require('./helpers/getBrandIconUrl.cjs');
|
|
17
|
+
var findWalletGroupOverride = require('./helpers/findWalletGroupOverride.cjs');
|
|
18
|
+
var isWalletMethodSupported = require('./helpers/isWalletMethodSupported.cjs');
|
|
19
|
+
var isWalletEventSupported = require('./helpers/isWalletEventSupported.cjs');
|
|
20
|
+
var useWalletBookCdn = require('./hooks/useWalletBookCdn.cjs');
|
|
21
|
+
var useWalletBookContext = require('./hooks/useWalletBookContext.cjs');
|
|
22
|
+
var WalletIcon = require('./components/WalletIcon.cjs');
|
|
23
|
+
var WalletBookContext = require('./components/WalletBookContext.cjs');
|
|
24
|
+
var BrandIcon = require('./components/BrandIcon.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
exports.getWalletIconUrl = getWalletIconUrl.getWalletIconUrl;
|
|
29
|
+
exports.getWalletBookWallet = getWalletBookWallet.getWalletBookWallet;
|
|
30
|
+
exports.getWalletLinks = getWalletLinks.getWalletLinks;
|
|
31
|
+
exports.getWalletPrimaryColor = getWalletPrimaryColor.getWalletPrimaryColor;
|
|
32
|
+
exports.findWalletBookWallet = findWalletBookWallet.findWalletBookWallet;
|
|
33
|
+
exports.getWalletGroup = getWalletGroup.getWalletGroup;
|
|
34
|
+
exports.findWalletGroup = findWalletGroup.findWalletGroup;
|
|
35
|
+
exports.getWalletBookCdnUrl = getWalletBookCdnUrl.getWalletBookCdnUrl;
|
|
36
|
+
exports.getBrandIconUrl = getBrandIconUrl.getBrandIconUrl;
|
|
37
|
+
exports.findWalletGroupOverride = findWalletGroupOverride.findWalletGroupOverride;
|
|
38
|
+
exports.isWalletMethodSupported = isWalletMethodSupported.isWalletMethodSupported;
|
|
39
|
+
exports.isWalletEventSupported = isWalletEventSupported.isWalletEventSupported;
|
|
40
|
+
exports.useWalletBookCdn = useWalletBookCdn.useWalletBookCdn;
|
|
41
|
+
exports.useWalletBookContext = useWalletBookContext.useWalletBookContext;
|
|
42
|
+
exports.WalletIcon = WalletIcon.WalletIcon;
|
|
43
|
+
exports.WalletBookContextProvider = WalletBookContext.WalletBookContextProvider;
|
|
44
|
+
exports.BrandIcon = BrandIcon.BrandIcon;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TYPES
|
|
3
|
+
*/
|
|
4
|
+
export type { WalletBookSchema, WalletRecordsSchema, } from './schemas/walletBookSchema';
|
|
5
|
+
export type { WalletSchema } from './schemas/walletSchema';
|
|
6
|
+
export type { WalletLinks } from './helpers';
|
|
7
|
+
/**
|
|
8
|
+
* HELPERS
|
|
9
|
+
*/
|
|
10
|
+
export { getWalletBookWallet, getWalletIconUrl, getWalletLinks, getWalletPrimaryColor, getWalletGroup, getWalletBookCdnUrl, findWalletBookWallet, findWalletGroup, getBrandIconUrl, findWalletGroupOverride, isWalletMethodSupported, isWalletEventSupported, } from './helpers';
|
|
11
|
+
/**
|
|
12
|
+
* HOOKS
|
|
13
|
+
*/
|
|
14
|
+
export { useWalletBookCdn, useWalletBookContext } from './hooks';
|
|
15
|
+
/**
|
|
16
|
+
* COMPONENTS
|
|
17
|
+
*/
|
|
18
|
+
export { WalletIcon, WalletBookContextProvider, BrandIcon } from './components';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
export { getWalletIconUrl } from './helpers/getWalletIconUrl.js';
|
|
3
|
+
export { getWalletBookWallet } from './helpers/getWalletBookWallet.js';
|
|
4
|
+
export { getWalletLinks } from './helpers/getWalletLinks.js';
|
|
5
|
+
export { getWalletPrimaryColor } from './helpers/getWalletPrimaryColor.js';
|
|
6
|
+
import './helpers/renderTemplate.js';
|
|
7
|
+
export { findWalletBookWallet } from './helpers/findWalletBookWallet.js';
|
|
8
|
+
import './helpers/logger.js';
|
|
9
|
+
export { getWalletGroup } from './helpers/getWalletGroup.js';
|
|
10
|
+
export { findWalletGroup } from './helpers/findWalletGroup.js';
|
|
11
|
+
export { getWalletBookCdnUrl } from './helpers/getWalletBookCdnUrl.js';
|
|
12
|
+
export { getBrandIconUrl } from './helpers/getBrandIconUrl.js';
|
|
13
|
+
export { findWalletGroupOverride } from './helpers/findWalletGroupOverride.js';
|
|
14
|
+
export { isWalletMethodSupported } from './helpers/isWalletMethodSupported.js';
|
|
15
|
+
export { isWalletEventSupported } from './helpers/isWalletEventSupported.js';
|
|
16
|
+
export { useWalletBookCdn } from './hooks/useWalletBookCdn.js';
|
|
17
|
+
export { useWalletBookContext } from './hooks/useWalletBookContext.js';
|
|
18
|
+
export { WalletIcon } from './components/WalletIcon.js';
|
|
19
|
+
export { WalletBookContextProvider } from './components/WalletBookContext.js';
|
|
20
|
+
export { BrandIcon } from './components/BrandIcon.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns undefined if an object values are all nullish
|
|
8
|
+
* @param val object
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const filterEmptyObject = (val) => val && Object.values(val).some((x) => Boolean(x)) ? val : undefined;
|
|
12
|
+
|
|
13
|
+
exports.filterEmptyObject = filterEmptyObject;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var zod = require('zod');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A zod type to ensure a string is not empty
|
|
10
|
+
*/
|
|
11
|
+
const nonEmptyString = zod.z.preprocess((val) => (val ? val : undefined), zod.z.string().optional());
|
|
12
|
+
|
|
13
|
+
exports.nonEmptyString = nonEmptyString;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var zod = require('zod');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A zod type to ensure an array is not empty
|
|
10
|
+
*/
|
|
11
|
+
const nonEmptyStringArray = zod.z.preprocess((val) => (Array.isArray(val) && val.length > 0 ? val : undefined), zod.z.array(zod.z.string()).optional());
|
|
12
|
+
|
|
13
|
+
exports.nonEmptyStringArray = nonEmptyStringArray;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A zod type to ensure an array is not empty
|
|
6
|
+
*/
|
|
7
|
+
const nonEmptyStringArray = z.preprocess((val) => (Array.isArray(val) && val.length > 0 ? val : undefined), z.array(z.string()).optional());
|
|
8
|
+
|
|
9
|
+
export { nonEmptyStringArray };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const processWalletConnectNativeUrl: (url: string) => string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const transformAndroidId = (url) => {
|
|
7
|
+
if (!(url === null || url === void 0 ? void 0 : url.match(/^https?:\/\//)))
|
|
8
|
+
return url;
|
|
9
|
+
if (!url)
|
|
10
|
+
return;
|
|
11
|
+
try {
|
|
12
|
+
const urlObject = new URL(url);
|
|
13
|
+
const id = urlObject.searchParams.get('id');
|
|
14
|
+
if (id) {
|
|
15
|
+
return id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (_a) {
|
|
19
|
+
// ignore
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.transformAndroidId = transformAndroidId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformAndroidId: (url: string | undefined) => string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const transformAndroidId = (url) => {
|
|
3
|
+
if (!(url === null || url === void 0 ? void 0 : url.match(/^https?:\/\//)))
|
|
4
|
+
return url;
|
|
5
|
+
if (!url)
|
|
6
|
+
return;
|
|
7
|
+
try {
|
|
8
|
+
const urlObject = new URL(url);
|
|
9
|
+
const id = urlObject.searchParams.get('id');
|
|
10
|
+
if (id) {
|
|
11
|
+
return id;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
return;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { transformAndroidId };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const transformChromeExtensionId = (url) => {
|
|
7
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^[a-z]{32}$/))
|
|
8
|
+
return url;
|
|
9
|
+
if (url === null || url === void 0 ? void 0 : url.includes('chrome.google.com/webstore/detail/')) {
|
|
10
|
+
try {
|
|
11
|
+
const urlObject = new URL(url);
|
|
12
|
+
return urlObject.pathname.split('/').at(-1);
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.transformChromeExtensionId = transformChromeExtensionId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformChromeExtensionId: (url: string | undefined) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const transformChromeExtensionId = (url) => {
|
|
3
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^[a-z]{32}$/))
|
|
4
|
+
return url;
|
|
5
|
+
if (url === null || url === void 0 ? void 0 : url.includes('chrome.google.com/webstore/detail/')) {
|
|
6
|
+
try {
|
|
7
|
+
const urlObject = new URL(url);
|
|
8
|
+
return urlObject.pathname.split('/').at(-1);
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
// ignore
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { transformChromeExtensionId };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const transformEdgeExtensionId = (url) => {
|
|
7
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^[a-z]{32}$/))
|
|
8
|
+
return url;
|
|
9
|
+
if (url === null || url === void 0 ? void 0 : url.includes('microsoftedge.microsoft.com/addons/detail/')) {
|
|
10
|
+
try {
|
|
11
|
+
const urlObject = new URL(url);
|
|
12
|
+
return urlObject.pathname.split('/').at(-1);
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.transformEdgeExtensionId = transformEdgeExtensionId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformEdgeExtensionId: (url: string | undefined) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const transformEdgeExtensionId = (url) => {
|
|
3
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^[a-z]{32}$/))
|
|
4
|
+
return url;
|
|
5
|
+
if (url === null || url === void 0 ? void 0 : url.includes('microsoftedge.microsoft.com/addons/detail/')) {
|
|
6
|
+
try {
|
|
7
|
+
const urlObject = new URL(url);
|
|
8
|
+
return urlObject.pathname.split('/').at(-1);
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
// ignore
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { transformEdgeExtensionId };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const transformFirefoxExtensionId = (url) => {
|
|
7
|
+
if (!(url === null || url === void 0 ? void 0 : url.match(/^https?:\/\//)))
|
|
8
|
+
return url;
|
|
9
|
+
if (url === null || url === void 0 ? void 0 : url.includes('addons.mozilla.org')) {
|
|
10
|
+
try {
|
|
11
|
+
const urlObject = new URL(url);
|
|
12
|
+
return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
|
|
13
|
+
}
|
|
14
|
+
catch (_a) {
|
|
15
|
+
// ignore
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.transformFirefoxExtensionId = transformFirefoxExtensionId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformFirefoxExtensionId: (url: string | undefined) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const transformFirefoxExtensionId = (url) => {
|
|
3
|
+
if (!(url === null || url === void 0 ? void 0 : url.match(/^https?:\/\//)))
|
|
4
|
+
return url;
|
|
5
|
+
if (url === null || url === void 0 ? void 0 : url.includes('addons.mozilla.org')) {
|
|
6
|
+
try {
|
|
7
|
+
const urlObject = new URL(url);
|
|
8
|
+
return urlObject.pathname.replace(/\/$/, '').split('/').at(-1);
|
|
9
|
+
}
|
|
10
|
+
catch (_a) {
|
|
11
|
+
// ignore
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { transformFirefoxExtensionId };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const idRegex = /^id[0-9]{1,36}$/;
|
|
7
|
+
const transformIosId = (url) => {
|
|
8
|
+
if (url === null || url === void 0 ? void 0 : url.match(idRegex))
|
|
9
|
+
return url;
|
|
10
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
|
|
11
|
+
try {
|
|
12
|
+
const urlObject = new URL(url);
|
|
13
|
+
const expectedId = urlObject.pathname
|
|
14
|
+
.replace(/\/$/, '')
|
|
15
|
+
.split('/')
|
|
16
|
+
.at(-1);
|
|
17
|
+
if (expectedId === null || expectedId === void 0 ? void 0 : expectedId.match(idRegex)) {
|
|
18
|
+
return expectedId;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch (_a) {
|
|
22
|
+
// ignore
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.transformIosId = transformIosId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transformIosId: (url: string | undefined) => string | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const idRegex = /^id[0-9]{1,36}$/;
|
|
3
|
+
const transformIosId = (url) => {
|
|
4
|
+
if (url === null || url === void 0 ? void 0 : url.match(idRegex))
|
|
5
|
+
return url;
|
|
6
|
+
if (url === null || url === void 0 ? void 0 : url.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/)) {
|
|
7
|
+
try {
|
|
8
|
+
const urlObject = new URL(url);
|
|
9
|
+
const expectedId = urlObject.pathname
|
|
10
|
+
.replace(/\/$/, '')
|
|
11
|
+
.split('/')
|
|
12
|
+
.at(-1);
|
|
13
|
+
if (expectedId === null || expectedId === void 0 ? void 0 : expectedId.match(idRegex)) {
|
|
14
|
+
return expectedId;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
// ignore
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { transformIosId };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var zod = require('zod');
|
|
7
|
+
var walletSchema = require('./walletSchema.cjs');
|
|
8
|
+
var walletGroup = require('./walletGroup.cjs');
|
|
9
|
+
|
|
10
|
+
zod.z.record(zod.z.string(), walletSchema.walletSchema);
|
|
11
|
+
const walletBookSchema = zod.z.preprocess((val) => val, zod.z.object({
|
|
12
|
+
groups: zod.z.record(zod.z.string(), walletGroup.walletGroupSchema),
|
|
13
|
+
wallets: zod.z.record(zod.z.string(), walletSchema.walletSchema),
|
|
14
|
+
}));
|
|
15
|
+
zod.z.record(zod.z.string(), walletGroup.walletGroupSchema);
|
|
16
|
+
|
|
17
|
+
exports.walletBookSchema = walletBookSchema;
|