web3bio-profile-kit 0.1.4 → 0.1.5
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/dist/hooks/useBaseQuery.cjs +4 -7
- package/dist/hooks/useBaseQuery.js +5 -8
- package/dist/index.cjs +7 -52
- package/dist/index.d.ts +1 -3
- package/dist/index.js +7 -11
- package/dist/types/hook.d.ts +2 -2
- package/dist/types/index.d.ts +5 -5
- package/dist/types/source.cjs +0 -1
- package/dist/types/source.d.ts +0 -1
- package/dist/types/source.js +0 -1
- package/dist/utils/helpers.cjs +129 -19
- package/dist/utils/helpers.d.ts +39 -1
- package/dist/utils/helpers.js +124 -19
- package/dist/utils/index.cjs +11 -9
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +2 -2
- package/dist/utils/platform.cjs +0 -10
- package/dist/utils/platform.d.ts +0 -7
- package/dist/utils/platform.js +1 -10
- package/dist/utils/regex.cjs +0 -1
- package/dist/utils/regex.d.ts +0 -1
- package/dist/utils/regex.js +0 -1
- package/dist/utils/source.cjs +0 -4
- package/dist/utils/source.d.ts +1 -1
- package/dist/utils/source.js +0 -4
- package/package.json +20 -4
|
@@ -7,9 +7,6 @@ require('../types/source.cjs');
|
|
|
7
7
|
require('../types/cointype.cjs');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var helpers = require('../utils/helpers.cjs');
|
|
10
|
-
require('../utils/network.cjs');
|
|
11
|
-
require('../utils/platform.cjs');
|
|
12
|
-
require('../utils/source.cjs');
|
|
13
10
|
|
|
14
11
|
/**
|
|
15
12
|
* Constructs the API URL based on query parameters
|
|
@@ -17,11 +14,11 @@ require('../utils/source.cjs');
|
|
|
17
14
|
const buildApiUrl = (identity, endpoint, universal) => {
|
|
18
15
|
// Handle batch requests
|
|
19
16
|
if (Array.isArray(identity)) {
|
|
20
|
-
return `${helpers.
|
|
17
|
+
return `${helpers.PROD_API_ENDPOINT}/${endpoint}/batch/${encodeURIComponent(JSON.stringify(identity))}`;
|
|
21
18
|
}
|
|
22
19
|
// Handle universal queries
|
|
23
20
|
if (universal) {
|
|
24
|
-
return `${helpers.
|
|
21
|
+
return `${helpers.PROD_API_ENDPOINT}/${endpoint}/${identity}`;
|
|
25
22
|
}
|
|
26
23
|
// Handle platform-specific queries
|
|
27
24
|
const resolvedId = helpers.resolveIdentity(identity);
|
|
@@ -29,11 +26,11 @@ const buildApiUrl = (identity, endpoint, universal) => {
|
|
|
29
26
|
return null;
|
|
30
27
|
// Domain endpoint uses resolved ID directly
|
|
31
28
|
if (endpoint === hook.QueryEndpoint.DOMAIN) {
|
|
32
|
-
return `${helpers.
|
|
29
|
+
return `${helpers.PROD_API_ENDPOINT}/${endpoint}/${resolvedId}`;
|
|
33
30
|
}
|
|
34
31
|
// Other endpoints need platform/handle split
|
|
35
32
|
const [platform, handle] = resolvedId.split(",");
|
|
36
|
-
return `${helpers.
|
|
33
|
+
return `${helpers.PROD_API_ENDPOINT}/${endpoint}/${platform}/${handle}`;
|
|
37
34
|
};
|
|
38
35
|
// Generate a stable cache key for this request
|
|
39
36
|
const getCacheKey = (identity, endpoint, universal) => {
|
|
@@ -4,10 +4,7 @@ import { ErrorMessages, QueryEndpoint } from '../types/hook.js';
|
|
|
4
4
|
import '../types/source.js';
|
|
5
5
|
import '../types/cointype.js';
|
|
6
6
|
import { useState, useRef, useEffect } from 'react';
|
|
7
|
-
import { getApiKey,
|
|
8
|
-
import '../utils/network.js';
|
|
9
|
-
import '../utils/platform.js';
|
|
10
|
-
import '../utils/source.js';
|
|
7
|
+
import { getApiKey, PROD_API_ENDPOINT, resolveIdentity } from '../utils/helpers.js';
|
|
11
8
|
|
|
12
9
|
/**
|
|
13
10
|
* Constructs the API URL based on query parameters
|
|
@@ -15,11 +12,11 @@ import '../utils/source.js';
|
|
|
15
12
|
const buildApiUrl = (identity, endpoint, universal) => {
|
|
16
13
|
// Handle batch requests
|
|
17
14
|
if (Array.isArray(identity)) {
|
|
18
|
-
return `${
|
|
15
|
+
return `${PROD_API_ENDPOINT}/${endpoint}/batch/${encodeURIComponent(JSON.stringify(identity))}`;
|
|
19
16
|
}
|
|
20
17
|
// Handle universal queries
|
|
21
18
|
if (universal) {
|
|
22
|
-
return `${
|
|
19
|
+
return `${PROD_API_ENDPOINT}/${endpoint}/${identity}`;
|
|
23
20
|
}
|
|
24
21
|
// Handle platform-specific queries
|
|
25
22
|
const resolvedId = resolveIdentity(identity);
|
|
@@ -27,11 +24,11 @@ const buildApiUrl = (identity, endpoint, universal) => {
|
|
|
27
24
|
return null;
|
|
28
25
|
// Domain endpoint uses resolved ID directly
|
|
29
26
|
if (endpoint === QueryEndpoint.DOMAIN) {
|
|
30
|
-
return `${
|
|
27
|
+
return `${PROD_API_ENDPOINT}/${endpoint}/${resolvedId}`;
|
|
31
28
|
}
|
|
32
29
|
// Other endpoints need platform/handle split
|
|
33
30
|
const [platform, handle] = resolvedId.split(",");
|
|
34
|
-
return `${
|
|
31
|
+
return `${PROD_API_ENDPOINT}/${endpoint}/${platform}/${handle}`;
|
|
35
32
|
};
|
|
36
33
|
// Generate a stable cache key for this request
|
|
37
34
|
const getCacheKey = (identity, endpoint, universal) => {
|
package/dist/index.cjs
CHANGED
|
@@ -7,17 +7,13 @@ var useUniversalNS = require('./hooks/useUniversalNS.cjs');
|
|
|
7
7
|
var useBatchProfile = require('./hooks/useBatchProfile.cjs');
|
|
8
8
|
var useBatchNS = require('./hooks/useBatchNS.cjs');
|
|
9
9
|
var useDomain = require('./hooks/useDomain.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var platform$1 = require('./types/platform.cjs');
|
|
18
|
-
var network$1 = require('./types/network.cjs');
|
|
19
|
-
var hook = require('./types/hook.cjs');
|
|
20
|
-
var source$1 = require('./types/source.cjs');
|
|
10
|
+
require('./types/platform.cjs');
|
|
11
|
+
require('./types/network.cjs');
|
|
12
|
+
require('./types/hook.cjs');
|
|
13
|
+
require('./types/source.cjs');
|
|
14
|
+
require('./types/cointype.cjs');
|
|
15
|
+
require('react');
|
|
16
|
+
require('./utils/helpers.cjs');
|
|
21
17
|
|
|
22
18
|
|
|
23
19
|
|
|
@@ -28,44 +24,3 @@ exports.useUniversalNS = useUniversalNS.useUniversalNS;
|
|
|
28
24
|
exports.useBatchProfile = useBatchProfile.useBatchProfile;
|
|
29
25
|
exports.useBatchNS = useBatchNS.useBatchNS;
|
|
30
26
|
exports.useDomain = useDomain.useDomain;
|
|
31
|
-
exports.useBaseQuery = useBaseQuery.useBaseQuery;
|
|
32
|
-
Object.defineProperty(exports, 'CoinType', {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () { return cointype.CoinType; }
|
|
35
|
-
});
|
|
36
|
-
exports.REGEX = regex.REGEX;
|
|
37
|
-
exports.API_ENDPOINT = helpers.API_ENDPOINT;
|
|
38
|
-
exports.detectPlatform = helpers.detectPlatform;
|
|
39
|
-
exports.getApiKey = helpers.getApiKey;
|
|
40
|
-
exports.isSupportedPlatform = helpers.isSupportedPlatform;
|
|
41
|
-
exports.prettify = helpers.prettify;
|
|
42
|
-
exports.resolveIdentity = helpers.resolveIdentity;
|
|
43
|
-
exports.NETWORK_DATA = network.NETWORK_DATA;
|
|
44
|
-
exports.DEFAULT_PLATFORM = platform.DEFAULT_PLATFORM;
|
|
45
|
-
exports.PLATFORM_DATA = platform.PLATFORM_DATA;
|
|
46
|
-
exports.getPlatformData = platform.getPlatformData;
|
|
47
|
-
exports.SOURCE_DATA = source.SOURCE_DATA;
|
|
48
|
-
Object.defineProperty(exports, 'Platform', {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function () { return platform$1.Platform; }
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, 'PlatformSystem', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () { return platform$1.PlatformSystem; }
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(exports, 'Network', {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
get: function () { return network$1.Network; }
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, 'ErrorMessages', {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () { return hook.ErrorMessages; }
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(exports, 'QueryEndpoint', {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
get: function () { return hook.QueryEndpoint; }
|
|
67
|
-
});
|
|
68
|
-
Object.defineProperty(exports, 'Source', {
|
|
69
|
-
enumerable: true,
|
|
70
|
-
get: function () { return source$1.Source; }
|
|
71
|
-
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5,14 +5,10 @@ export { useUniversalNS } from './hooks/useUniversalNS.js';
|
|
|
5
5
|
export { useBatchProfile } from './hooks/useBatchProfile.js';
|
|
6
6
|
export { useBatchNS } from './hooks/useBatchNS.js';
|
|
7
7
|
export { useDomain } from './hooks/useDomain.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export { Platform, PlatformSystem } from './types/platform.js';
|
|
16
|
-
export { Network } from './types/network.js';
|
|
17
|
-
export { ErrorMessages, QueryEndpoint } from './types/hook.js';
|
|
18
|
-
export { Source } from './types/source.js';
|
|
8
|
+
import './types/platform.js';
|
|
9
|
+
import './types/network.js';
|
|
10
|
+
import './types/hook.js';
|
|
11
|
+
import './types/source.js';
|
|
12
|
+
import './types/cointype.js';
|
|
13
|
+
import 'react';
|
|
14
|
+
import './utils/helpers.js';
|
package/dist/types/hook.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type AddressRecord = {
|
|
|
43
43
|
/** The blockchain address */
|
|
44
44
|
address: string;
|
|
45
45
|
/** Network identifier */
|
|
46
|
-
network:
|
|
46
|
+
network: Network;
|
|
47
47
|
/** Type identifier */
|
|
48
48
|
__typename: "Address";
|
|
49
49
|
};
|
|
@@ -114,7 +114,7 @@ export interface NSResponse {
|
|
|
114
114
|
/** Profile description */
|
|
115
115
|
description: string | null;
|
|
116
116
|
/** Platform identifier */
|
|
117
|
-
platform:
|
|
117
|
+
platform: Platform;
|
|
118
118
|
/** Human-readable display name */
|
|
119
119
|
displayName: string | null;
|
|
120
120
|
/** Alternative identities */
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export { Platform, PlatformSystem, type PlatformType } from "./platform";
|
|
2
|
+
export { Network, type NetworkType } from "./network";
|
|
3
|
+
export { ErrorMessages, QueryEndpoint, type AddressRecord, type SocialLinksItem, type SocialLinks, type SocialRecord, type ProfileResponse, type NSResponse, type DomainResponse, type QueryOptions, type IdentityString, type QueryResult, type ProfileResult, type NSResult, type ProfileBatchResult, type NSBatchResult, type ProfileUniversalResult, type NSUniversalResult, type DomainResult } from "./hook";
|
|
4
|
+
export { Source, type SourceType } from "./source";
|
|
5
|
+
export { CoinType } from "./cointype";
|
package/dist/types/source.cjs
CHANGED
package/dist/types/source.d.ts
CHANGED
package/dist/types/source.js
CHANGED
package/dist/utils/helpers.cjs
CHANGED
|
@@ -7,7 +7,7 @@ require('../types/source.cjs');
|
|
|
7
7
|
require('../types/cointype.cjs');
|
|
8
8
|
var regex = require('./regex.cjs');
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const PROD_API_ENDPOINT = "https://api.web3.bio";
|
|
11
11
|
/**
|
|
12
12
|
* Resolves an identity string to a platform and identifier
|
|
13
13
|
* @param input The identity to resolve
|
|
@@ -62,36 +62,85 @@ const prettify = (input) => {
|
|
|
62
62
|
}
|
|
63
63
|
return input;
|
|
64
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Fufill and standardize identity format
|
|
67
|
+
*/
|
|
68
|
+
const uglify = (input, platform$1) => {
|
|
69
|
+
if (!input)
|
|
70
|
+
return "";
|
|
71
|
+
switch (platform$1) {
|
|
72
|
+
case platform.Platform.farcaster:
|
|
73
|
+
return input.endsWith(".farcaster") ||
|
|
74
|
+
input.endsWith(".fcast.id") ||
|
|
75
|
+
input.endsWith(".farcaster.eth")
|
|
76
|
+
? input
|
|
77
|
+
: `${input}.farcaster`;
|
|
78
|
+
case platform.Platform.lens:
|
|
79
|
+
return input.endsWith(".lens") ? input : `${input}.lens`;
|
|
80
|
+
case platform.Platform.basenames:
|
|
81
|
+
return input.endsWith(".base.eth")
|
|
82
|
+
? input
|
|
83
|
+
: input.endsWith(".base")
|
|
84
|
+
? `${input}.eth`
|
|
85
|
+
: `${input}.base.eth`;
|
|
86
|
+
case platform.Platform.linea:
|
|
87
|
+
return input.endsWith(".linea.eth")
|
|
88
|
+
? input
|
|
89
|
+
: input.endsWith(".linea")
|
|
90
|
+
? `${input}.eth`
|
|
91
|
+
: `${input}.linea.eth`;
|
|
92
|
+
default:
|
|
93
|
+
return input;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
65
96
|
/**
|
|
66
97
|
* Check if the platform is supported for API queries
|
|
67
98
|
*/
|
|
68
99
|
const isSupportedPlatform = (platform$1) => {
|
|
69
100
|
if (!platform$1)
|
|
70
101
|
return false;
|
|
71
|
-
return
|
|
102
|
+
return [
|
|
103
|
+
platform.Platform.ens,
|
|
104
|
+
platform.Platform.basenames,
|
|
105
|
+
platform.Platform.linea,
|
|
106
|
+
platform.Platform.ethereum,
|
|
107
|
+
platform.Platform.twitter,
|
|
108
|
+
platform.Platform.github,
|
|
109
|
+
platform.Platform.farcaster,
|
|
110
|
+
platform.Platform.lens,
|
|
111
|
+
platform.Platform.unstoppableDomains,
|
|
112
|
+
platform.Platform.nextid,
|
|
113
|
+
platform.Platform.dotbit,
|
|
114
|
+
platform.Platform.solana,
|
|
115
|
+
platform.Platform.sns,
|
|
116
|
+
].includes(platform$1);
|
|
72
117
|
};
|
|
118
|
+
const platformMap = new Map([
|
|
119
|
+
[regex.REGEX.BASENAMES, platform.Platform.basenames],
|
|
120
|
+
[regex.REGEX.LINEA, platform.Platform.linea],
|
|
121
|
+
[regex.REGEX.ENS, platform.Platform.ens],
|
|
122
|
+
[regex.REGEX.ETH_ADDRESS, platform.Platform.ethereum],
|
|
123
|
+
[regex.REGEX.LENS, platform.Platform.lens],
|
|
124
|
+
[regex.REGEX.UNSTOPPABLE_DOMAINS, platform.Platform.unstoppableDomains],
|
|
125
|
+
[regex.REGEX.SPACE_ID, platform.Platform.space_id],
|
|
126
|
+
[regex.REGEX.GRAVITY, platform.Platform.gravity],
|
|
127
|
+
[regex.REGEX.DOTBIT, platform.Platform.dotbit],
|
|
128
|
+
[regex.REGEX.SNS, platform.Platform.sns],
|
|
129
|
+
[regex.REGEX.GENOME, platform.Platform.genome],
|
|
130
|
+
[regex.REGEX.BTC_ADDRESS, platform.Platform.bitcoin],
|
|
131
|
+
[regex.REGEX.SOLANA_ADDRESS, platform.Platform.solana],
|
|
132
|
+
[regex.REGEX.FARCASTER, platform.Platform.farcaster],
|
|
133
|
+
[regex.REGEX.CLUSTER, platform.Platform.clusters],
|
|
134
|
+
[regex.REGEX.NEXT_ID, platform.Platform.nextid],
|
|
135
|
+
[regex.REGEX.NOSTR, platform.Platform.nostr],
|
|
136
|
+
[regex.REGEX.TWITTER, platform.Platform.twitter],
|
|
137
|
+
]);
|
|
73
138
|
/**
|
|
74
139
|
* Detect platform from identity string based on regex patterns
|
|
75
140
|
*/
|
|
76
141
|
const detectPlatform = (term) => {
|
|
77
142
|
if (term.endsWith(".farcaster.eth"))
|
|
78
143
|
return platform.Platform.farcaster;
|
|
79
|
-
const platformMap = [
|
|
80
|
-
[regex.REGEX.BASENAMES, platform.Platform.basenames],
|
|
81
|
-
[regex.REGEX.LINEA, platform.Platform.linea],
|
|
82
|
-
[regex.REGEX.ENS, platform.Platform.ens],
|
|
83
|
-
[regex.REGEX.ETH_ADDRESS, platform.Platform.ethereum],
|
|
84
|
-
[regex.REGEX.LENS, platform.Platform.lens],
|
|
85
|
-
[regex.REGEX.UNSTOPPABLE_DOMAINS, platform.Platform.unstoppableDomains],
|
|
86
|
-
[regex.REGEX.SPACE_ID, platform.Platform.space_id],
|
|
87
|
-
[regex.REGEX.DOTBIT, platform.Platform.dotbit],
|
|
88
|
-
[regex.REGEX.SNS, platform.Platform.sns],
|
|
89
|
-
[regex.REGEX.BTC_ADDRESS, platform.Platform.bitcoin],
|
|
90
|
-
[regex.REGEX.SOLANA_ADDRESS, platform.Platform.solana],
|
|
91
|
-
[regex.REGEX.FARCASTER, platform.Platform.farcaster],
|
|
92
|
-
[regex.REGEX.TWITTER, platform.Platform.twitter],
|
|
93
|
-
[regex.REGEX.NEXT_ID, platform.Platform.nextid],
|
|
94
|
-
];
|
|
95
144
|
for (const [regex, Platform] of platformMap) {
|
|
96
145
|
if (regex.test(term)) {
|
|
97
146
|
return Platform;
|
|
@@ -110,10 +159,71 @@ const getApiKey = (userProvidedKey) => {
|
|
|
110
159
|
process.env.NEXT_PUBLIC_WEB3BIO_API_KEY ||
|
|
111
160
|
process.env.VITE_WEB3BIO_API_KEY);
|
|
112
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* Compare two addresses for equality in a case-insensitive manner
|
|
164
|
+
* Used for blockchain address comparison where case doesn't affect validity
|
|
165
|
+
*
|
|
166
|
+
* @param address The first address to compare
|
|
167
|
+
* @param otherAddress The second address to compare
|
|
168
|
+
* @returns True if addresses match (ignoring case), false otherwise
|
|
169
|
+
*/
|
|
170
|
+
const isSameAddress = (address, otherAddress) => {
|
|
171
|
+
if (!address || !otherAddress)
|
|
172
|
+
return false;
|
|
173
|
+
return address.toLowerCase() === otherAddress.toLowerCase();
|
|
174
|
+
};
|
|
175
|
+
const web3AddressRegexes = [
|
|
176
|
+
regex.REGEX.ETH_ADDRESS,
|
|
177
|
+
regex.REGEX.BTC_ADDRESS,
|
|
178
|
+
regex.REGEX.SOLANA_ADDRESS,
|
|
179
|
+
regex.REGEX.NEXT_ID,
|
|
180
|
+
regex.REGEX.NOSTR,
|
|
181
|
+
];
|
|
182
|
+
/**
|
|
183
|
+
* Determines if a string is a valid Web3 address
|
|
184
|
+
* Checks against multiple blockchain address formats
|
|
185
|
+
*
|
|
186
|
+
* @param address The string to check
|
|
187
|
+
* @returns True if the string matches any supported Web3 address format, false otherwise
|
|
188
|
+
*/
|
|
189
|
+
const isWeb3Address = (address) => {
|
|
190
|
+
if (!address)
|
|
191
|
+
return false;
|
|
192
|
+
return web3AddressRegexes.some((regex) => regex.test(address));
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Validates if a string is a valid Ethereum address
|
|
196
|
+
* Checks both the address format and excludes common burn/empty addresses
|
|
197
|
+
*
|
|
198
|
+
* @param address - The string to validate as an Ethereum address
|
|
199
|
+
* @returns True if the address is valid and not a burn/empty address, false otherwise
|
|
200
|
+
*/
|
|
201
|
+
const isValidEthereumAddress = (address) => {
|
|
202
|
+
if (!regex.REGEX.ETH_ADDRESS.test(address))
|
|
203
|
+
return false; // invalid ethereum address
|
|
204
|
+
if (address.match(/^0x0*.$|0x[123468abef]*$|0x0*dead$/i))
|
|
205
|
+
return false; // empty & burn address
|
|
206
|
+
return true;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Validates if a string is a valid Solana address
|
|
210
|
+
* Checks if the string matches the Solana address format
|
|
211
|
+
*
|
|
212
|
+
* @param address - The string to validate as a Solana address
|
|
213
|
+
* @returns True if the string is a valid Solana address, false otherwise
|
|
214
|
+
*/
|
|
215
|
+
const isValidSolanaAddress = (address) => {
|
|
216
|
+
return regex.REGEX.SOLANA_ADDRESS.test(address);
|
|
217
|
+
};
|
|
113
218
|
|
|
114
|
-
exports.
|
|
219
|
+
exports.PROD_API_ENDPOINT = PROD_API_ENDPOINT;
|
|
115
220
|
exports.detectPlatform = detectPlatform;
|
|
116
221
|
exports.getApiKey = getApiKey;
|
|
222
|
+
exports.isSameAddress = isSameAddress;
|
|
117
223
|
exports.isSupportedPlatform = isSupportedPlatform;
|
|
224
|
+
exports.isValidEthereumAddress = isValidEthereumAddress;
|
|
225
|
+
exports.isValidSolanaAddress = isValidSolanaAddress;
|
|
226
|
+
exports.isWeb3Address = isWeb3Address;
|
|
118
227
|
exports.prettify = prettify;
|
|
119
228
|
exports.resolveIdentity = resolveIdentity;
|
|
229
|
+
exports.uglify = uglify;
|
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Platform } from "../types";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const PROD_API_ENDPOINT = "https://api.web3.bio";
|
|
3
|
+
export declare const STAGING_API_ENDPOINT = "https://api-staging.web3.bio";
|
|
3
4
|
/**
|
|
4
5
|
* Resolves an identity string to a platform and identifier
|
|
5
6
|
* @param input The identity to resolve
|
|
@@ -10,6 +11,10 @@ export declare const resolveIdentity: (input: string) => string | null;
|
|
|
10
11
|
* Clean up and standardize identity format
|
|
11
12
|
*/
|
|
12
13
|
export declare const prettify: (input: string) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Fufill and standardize identity format
|
|
16
|
+
*/
|
|
17
|
+
export declare const uglify: (input: string, platform: Platform) => string;
|
|
13
18
|
/**
|
|
14
19
|
* Check if the platform is supported for API queries
|
|
15
20
|
*/
|
|
@@ -22,3 +27,36 @@ export declare const detectPlatform: (term: string) => Platform;
|
|
|
22
27
|
* Get API key from various environment sources or user provided value
|
|
23
28
|
*/
|
|
24
29
|
export declare const getApiKey: (userProvidedKey?: string) => string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Compare two addresses for equality in a case-insensitive manner
|
|
32
|
+
* Used for blockchain address comparison where case doesn't affect validity
|
|
33
|
+
*
|
|
34
|
+
* @param address The first address to compare
|
|
35
|
+
* @param otherAddress The second address to compare
|
|
36
|
+
* @returns True if addresses match (ignoring case), false otherwise
|
|
37
|
+
*/
|
|
38
|
+
export declare const isSameAddress: (address?: string | undefined, otherAddress?: string | undefined) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Determines if a string is a valid Web3 address
|
|
41
|
+
* Checks against multiple blockchain address formats
|
|
42
|
+
*
|
|
43
|
+
* @param address The string to check
|
|
44
|
+
* @returns True if the string matches any supported Web3 address format, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
export declare const isWeb3Address: (address: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Validates if a string is a valid Ethereum address
|
|
49
|
+
* Checks both the address format and excludes common burn/empty addresses
|
|
50
|
+
*
|
|
51
|
+
* @param address - The string to validate as an Ethereum address
|
|
52
|
+
* @returns True if the address is valid and not a burn/empty address, false otherwise
|
|
53
|
+
*/
|
|
54
|
+
export declare const isValidEthereumAddress: (address: string) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Validates if a string is a valid Solana address
|
|
57
|
+
* Checks if the string matches the Solana address format
|
|
58
|
+
*
|
|
59
|
+
* @param address - The string to validate as a Solana address
|
|
60
|
+
* @returns True if the string is a valid Solana address, false otherwise
|
|
61
|
+
*/
|
|
62
|
+
export declare const isValidSolanaAddress: (address: string) => boolean;
|
package/dist/utils/helpers.js
CHANGED
|
@@ -5,7 +5,7 @@ import '../types/source.js';
|
|
|
5
5
|
import '../types/cointype.js';
|
|
6
6
|
import { REGEX } from './regex.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const PROD_API_ENDPOINT = "https://api.web3.bio";
|
|
9
9
|
/**
|
|
10
10
|
* Resolves an identity string to a platform and identifier
|
|
11
11
|
* @param input The identity to resolve
|
|
@@ -60,36 +60,85 @@ const prettify = (input) => {
|
|
|
60
60
|
}
|
|
61
61
|
return input;
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Fufill and standardize identity format
|
|
65
|
+
*/
|
|
66
|
+
const uglify = (input, platform) => {
|
|
67
|
+
if (!input)
|
|
68
|
+
return "";
|
|
69
|
+
switch (platform) {
|
|
70
|
+
case Platform.farcaster:
|
|
71
|
+
return input.endsWith(".farcaster") ||
|
|
72
|
+
input.endsWith(".fcast.id") ||
|
|
73
|
+
input.endsWith(".farcaster.eth")
|
|
74
|
+
? input
|
|
75
|
+
: `${input}.farcaster`;
|
|
76
|
+
case Platform.lens:
|
|
77
|
+
return input.endsWith(".lens") ? input : `${input}.lens`;
|
|
78
|
+
case Platform.basenames:
|
|
79
|
+
return input.endsWith(".base.eth")
|
|
80
|
+
? input
|
|
81
|
+
: input.endsWith(".base")
|
|
82
|
+
? `${input}.eth`
|
|
83
|
+
: `${input}.base.eth`;
|
|
84
|
+
case Platform.linea:
|
|
85
|
+
return input.endsWith(".linea.eth")
|
|
86
|
+
? input
|
|
87
|
+
: input.endsWith(".linea")
|
|
88
|
+
? `${input}.eth`
|
|
89
|
+
: `${input}.linea.eth`;
|
|
90
|
+
default:
|
|
91
|
+
return input;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
63
94
|
/**
|
|
64
95
|
* Check if the platform is supported for API queries
|
|
65
96
|
*/
|
|
66
97
|
const isSupportedPlatform = (platform) => {
|
|
67
98
|
if (!platform)
|
|
68
99
|
return false;
|
|
69
|
-
return
|
|
100
|
+
return [
|
|
101
|
+
Platform.ens,
|
|
102
|
+
Platform.basenames,
|
|
103
|
+
Platform.linea,
|
|
104
|
+
Platform.ethereum,
|
|
105
|
+
Platform.twitter,
|
|
106
|
+
Platform.github,
|
|
107
|
+
Platform.farcaster,
|
|
108
|
+
Platform.lens,
|
|
109
|
+
Platform.unstoppableDomains,
|
|
110
|
+
Platform.nextid,
|
|
111
|
+
Platform.dotbit,
|
|
112
|
+
Platform.solana,
|
|
113
|
+
Platform.sns,
|
|
114
|
+
].includes(platform);
|
|
70
115
|
};
|
|
116
|
+
const platformMap = new Map([
|
|
117
|
+
[REGEX.BASENAMES, Platform.basenames],
|
|
118
|
+
[REGEX.LINEA, Platform.linea],
|
|
119
|
+
[REGEX.ENS, Platform.ens],
|
|
120
|
+
[REGEX.ETH_ADDRESS, Platform.ethereum],
|
|
121
|
+
[REGEX.LENS, Platform.lens],
|
|
122
|
+
[REGEX.UNSTOPPABLE_DOMAINS, Platform.unstoppableDomains],
|
|
123
|
+
[REGEX.SPACE_ID, Platform.space_id],
|
|
124
|
+
[REGEX.GRAVITY, Platform.gravity],
|
|
125
|
+
[REGEX.DOTBIT, Platform.dotbit],
|
|
126
|
+
[REGEX.SNS, Platform.sns],
|
|
127
|
+
[REGEX.GENOME, Platform.genome],
|
|
128
|
+
[REGEX.BTC_ADDRESS, Platform.bitcoin],
|
|
129
|
+
[REGEX.SOLANA_ADDRESS, Platform.solana],
|
|
130
|
+
[REGEX.FARCASTER, Platform.farcaster],
|
|
131
|
+
[REGEX.CLUSTER, Platform.clusters],
|
|
132
|
+
[REGEX.NEXT_ID, Platform.nextid],
|
|
133
|
+
[REGEX.NOSTR, Platform.nostr],
|
|
134
|
+
[REGEX.TWITTER, Platform.twitter],
|
|
135
|
+
]);
|
|
71
136
|
/**
|
|
72
137
|
* Detect platform from identity string based on regex patterns
|
|
73
138
|
*/
|
|
74
139
|
const detectPlatform = (term) => {
|
|
75
140
|
if (term.endsWith(".farcaster.eth"))
|
|
76
141
|
return Platform.farcaster;
|
|
77
|
-
const platformMap = [
|
|
78
|
-
[REGEX.BASENAMES, Platform.basenames],
|
|
79
|
-
[REGEX.LINEA, Platform.linea],
|
|
80
|
-
[REGEX.ENS, Platform.ens],
|
|
81
|
-
[REGEX.ETH_ADDRESS, Platform.ethereum],
|
|
82
|
-
[REGEX.LENS, Platform.lens],
|
|
83
|
-
[REGEX.UNSTOPPABLE_DOMAINS, Platform.unstoppableDomains],
|
|
84
|
-
[REGEX.SPACE_ID, Platform.space_id],
|
|
85
|
-
[REGEX.DOTBIT, Platform.dotbit],
|
|
86
|
-
[REGEX.SNS, Platform.sns],
|
|
87
|
-
[REGEX.BTC_ADDRESS, Platform.bitcoin],
|
|
88
|
-
[REGEX.SOLANA_ADDRESS, Platform.solana],
|
|
89
|
-
[REGEX.FARCASTER, Platform.farcaster],
|
|
90
|
-
[REGEX.TWITTER, Platform.twitter],
|
|
91
|
-
[REGEX.NEXT_ID, Platform.nextid],
|
|
92
|
-
];
|
|
93
142
|
for (const [regex, Platform] of platformMap) {
|
|
94
143
|
if (regex.test(term)) {
|
|
95
144
|
return Platform;
|
|
@@ -108,5 +157,61 @@ const getApiKey = (userProvidedKey) => {
|
|
|
108
157
|
process.env.NEXT_PUBLIC_WEB3BIO_API_KEY ||
|
|
109
158
|
process.env.VITE_WEB3BIO_API_KEY);
|
|
110
159
|
};
|
|
160
|
+
/**
|
|
161
|
+
* Compare two addresses for equality in a case-insensitive manner
|
|
162
|
+
* Used for blockchain address comparison where case doesn't affect validity
|
|
163
|
+
*
|
|
164
|
+
* @param address The first address to compare
|
|
165
|
+
* @param otherAddress The second address to compare
|
|
166
|
+
* @returns True if addresses match (ignoring case), false otherwise
|
|
167
|
+
*/
|
|
168
|
+
const isSameAddress = (address, otherAddress) => {
|
|
169
|
+
if (!address || !otherAddress)
|
|
170
|
+
return false;
|
|
171
|
+
return address.toLowerCase() === otherAddress.toLowerCase();
|
|
172
|
+
};
|
|
173
|
+
const web3AddressRegexes = [
|
|
174
|
+
REGEX.ETH_ADDRESS,
|
|
175
|
+
REGEX.BTC_ADDRESS,
|
|
176
|
+
REGEX.SOLANA_ADDRESS,
|
|
177
|
+
REGEX.NEXT_ID,
|
|
178
|
+
REGEX.NOSTR,
|
|
179
|
+
];
|
|
180
|
+
/**
|
|
181
|
+
* Determines if a string is a valid Web3 address
|
|
182
|
+
* Checks against multiple blockchain address formats
|
|
183
|
+
*
|
|
184
|
+
* @param address The string to check
|
|
185
|
+
* @returns True if the string matches any supported Web3 address format, false otherwise
|
|
186
|
+
*/
|
|
187
|
+
const isWeb3Address = (address) => {
|
|
188
|
+
if (!address)
|
|
189
|
+
return false;
|
|
190
|
+
return web3AddressRegexes.some((regex) => regex.test(address));
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Validates if a string is a valid Ethereum address
|
|
194
|
+
* Checks both the address format and excludes common burn/empty addresses
|
|
195
|
+
*
|
|
196
|
+
* @param address - The string to validate as an Ethereum address
|
|
197
|
+
* @returns True if the address is valid and not a burn/empty address, false otherwise
|
|
198
|
+
*/
|
|
199
|
+
const isValidEthereumAddress = (address) => {
|
|
200
|
+
if (!REGEX.ETH_ADDRESS.test(address))
|
|
201
|
+
return false; // invalid ethereum address
|
|
202
|
+
if (address.match(/^0x0*.$|0x[123468abef]*$|0x0*dead$/i))
|
|
203
|
+
return false; // empty & burn address
|
|
204
|
+
return true;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Validates if a string is a valid Solana address
|
|
208
|
+
* Checks if the string matches the Solana address format
|
|
209
|
+
*
|
|
210
|
+
* @param address - The string to validate as a Solana address
|
|
211
|
+
* @returns True if the string is a valid Solana address, false otherwise
|
|
212
|
+
*/
|
|
213
|
+
const isValidSolanaAddress = (address) => {
|
|
214
|
+
return REGEX.SOLANA_ADDRESS.test(address);
|
|
215
|
+
};
|
|
111
216
|
|
|
112
|
-
export {
|
|
217
|
+
export { PROD_API_ENDPOINT, detectPlatform, getApiKey, isSameAddress, isSupportedPlatform, isValidEthereumAddress, isValidSolanaAddress, isWeb3Address, prettify, resolveIdentity, uglify };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var cointype = require('../types/cointype.cjs');
|
|
4
4
|
var regex = require('./regex.cjs');
|
|
5
|
-
var helpers = require('./helpers.cjs');
|
|
6
|
-
var network = require('./network.cjs');
|
|
7
5
|
var platform = require('./platform.cjs');
|
|
6
|
+
var network = require('./network.cjs');
|
|
8
7
|
var source = require('./source.cjs');
|
|
8
|
+
var helpers = require('./helpers.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -14,14 +14,16 @@ Object.defineProperty(exports, 'CoinType', {
|
|
|
14
14
|
get: function () { return cointype.CoinType; }
|
|
15
15
|
});
|
|
16
16
|
exports.REGEX = regex.REGEX;
|
|
17
|
-
exports.
|
|
17
|
+
exports.DEFAULT_PLATFORM = platform.DEFAULT_PLATFORM;
|
|
18
|
+
exports.PLATFORM_DATA = platform.PLATFORM_DATA;
|
|
19
|
+
exports.NETWORK_DATA = network.NETWORK_DATA;
|
|
20
|
+
exports.SOURCE_DATA = source.SOURCE_DATA;
|
|
18
21
|
exports.detectPlatform = helpers.detectPlatform;
|
|
19
|
-
exports.
|
|
22
|
+
exports.isSameAddress = helpers.isSameAddress;
|
|
20
23
|
exports.isSupportedPlatform = helpers.isSupportedPlatform;
|
|
24
|
+
exports.isValidEthereumAddress = helpers.isValidEthereumAddress;
|
|
25
|
+
exports.isValidSolanaAddress = helpers.isValidSolanaAddress;
|
|
26
|
+
exports.isWeb3Address = helpers.isWeb3Address;
|
|
21
27
|
exports.prettify = helpers.prettify;
|
|
22
28
|
exports.resolveIdentity = helpers.resolveIdentity;
|
|
23
|
-
exports.
|
|
24
|
-
exports.DEFAULT_PLATFORM = platform.DEFAULT_PLATFORM;
|
|
25
|
-
exports.PLATFORM_DATA = platform.PLATFORM_DATA;
|
|
26
|
-
exports.getPlatformData = platform.getPlatformData;
|
|
27
|
-
exports.SOURCE_DATA = source.SOURCE_DATA;
|
|
29
|
+
exports.uglify = helpers.uglify;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "../types/cointype";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
2
|
+
export { REGEX } from "./regex";
|
|
3
|
+
export { DEFAULT_PLATFORM, PLATFORM_DATA } from "./platform";
|
|
4
|
+
export { NETWORK_DATA } from "./network";
|
|
5
|
+
export { SOURCE_DATA } from "./source";
|
|
6
|
+
export { resolveIdentity, prettify, uglify, isSupportedPlatform, detectPlatform, isSameAddress, isWeb3Address, isValidEthereumAddress, isValidSolanaAddress, } from "./helpers";
|
package/dist/utils/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CoinType } from '../types/cointype.js';
|
|
2
2
|
export { REGEX } from './regex.js';
|
|
3
|
-
export {
|
|
3
|
+
export { DEFAULT_PLATFORM, PLATFORM_DATA } from './platform.js';
|
|
4
4
|
export { NETWORK_DATA } from './network.js';
|
|
5
|
-
export { DEFAULT_PLATFORM, PLATFORM_DATA, getPlatformData } from './platform.js';
|
|
6
5
|
export { SOURCE_DATA } from './source.js';
|
|
6
|
+
export { detectPlatform, isSameAddress, isSupportedPlatform, isValidEthereumAddress, isValidSolanaAddress, isWeb3Address, prettify, resolveIdentity, uglify } from './helpers.js';
|
package/dist/utils/platform.cjs
CHANGED
|
@@ -968,16 +968,6 @@ const PLATFORM_DATA = new Map([
|
|
|
968
968
|
},
|
|
969
969
|
],
|
|
970
970
|
]);
|
|
971
|
-
/**
|
|
972
|
-
* Get Platform data by key
|
|
973
|
-
* @param platform - Platform
|
|
974
|
-
* @returns Platform data or default
|
|
975
|
-
* @public
|
|
976
|
-
*/
|
|
977
|
-
function getPlatformData(platform) {
|
|
978
|
-
return PLATFORM_DATA.get(platform) || DEFAULT_PLATFORM;
|
|
979
|
-
}
|
|
980
971
|
|
|
981
972
|
exports.DEFAULT_PLATFORM = DEFAULT_PLATFORM;
|
|
982
973
|
exports.PLATFORM_DATA = PLATFORM_DATA;
|
|
983
|
-
exports.getPlatformData = getPlatformData;
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -9,10 +9,3 @@ export declare const DEFAULT_PLATFORM: Readonly<PlatformType>;
|
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
export declare const PLATFORM_DATA: ReadonlyMap<Platform, Readonly<PlatformType>>;
|
|
12
|
-
/**
|
|
13
|
-
* Get Platform data by key
|
|
14
|
-
* @param platform - Platform
|
|
15
|
-
* @returns Platform data or default
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export declare function getPlatformData(platform: Platform): Readonly<PlatformType>;
|
package/dist/utils/platform.js
CHANGED
|
@@ -966,14 +966,5 @@ const PLATFORM_DATA = new Map([
|
|
|
966
966
|
},
|
|
967
967
|
],
|
|
968
968
|
]);
|
|
969
|
-
/**
|
|
970
|
-
* Get Platform data by key
|
|
971
|
-
* @param platform - Platform
|
|
972
|
-
* @returns Platform data or default
|
|
973
|
-
* @public
|
|
974
|
-
*/
|
|
975
|
-
function getPlatformData(platform) {
|
|
976
|
-
return PLATFORM_DATA.get(platform) || DEFAULT_PLATFORM;
|
|
977
|
-
}
|
|
978
969
|
|
|
979
|
-
export { DEFAULT_PLATFORM, PLATFORM_DATA
|
|
970
|
+
export { DEFAULT_PLATFORM, PLATFORM_DATA };
|
package/dist/utils/regex.cjs
CHANGED
|
@@ -15,7 +15,6 @@ const REGEX = {
|
|
|
15
15
|
GRAVITY: /^.+\.g$/,
|
|
16
16
|
GENOME: /^.+\.gno$/i,
|
|
17
17
|
UNSTOPPABLE_DOMAINS: /^.+\.(?:crypto|888|nft|blockchain|bitcoin|dao|x|klever|hi|zil|kresus|polygon|wallet|binanceus|anime|go|manga|eth)$/i,
|
|
18
|
-
CROSSBELL: /^.+\.csb$/i,
|
|
19
18
|
DOTBIT: /^.+\.bit$/i,
|
|
20
19
|
SNS: /^.+\.sol$/i,
|
|
21
20
|
ETH_ADDRESS: /^0x[a-fA-F0-9]{40}$/i,
|
package/dist/utils/regex.d.ts
CHANGED
package/dist/utils/regex.js
CHANGED
|
@@ -13,7 +13,6 @@ const REGEX = {
|
|
|
13
13
|
GRAVITY: /^.+\.g$/,
|
|
14
14
|
GENOME: /^.+\.gno$/i,
|
|
15
15
|
UNSTOPPABLE_DOMAINS: /^.+\.(?:crypto|888|nft|blockchain|bitcoin|dao|x|klever|hi|zil|kresus|polygon|wallet|binanceus|anime|go|manga|eth)$/i,
|
|
16
|
-
CROSSBELL: /^.+\.csb$/i,
|
|
17
16
|
DOTBIT: /^.+\.bit$/i,
|
|
18
17
|
SNS: /^.+\.sol$/i,
|
|
19
18
|
ETH_ADDRESS: /^0x[a-fA-F0-9]{40}$/i,
|
package/dist/utils/source.cjs
CHANGED
|
@@ -51,10 +51,6 @@ const SOURCE_DATA = {
|
|
|
51
51
|
name: "Gravity",
|
|
52
52
|
description: "Gravity alpha mainnet name service",
|
|
53
53
|
},
|
|
54
|
-
[source.Source.crossbell]: {
|
|
55
|
-
name: "Crossbell",
|
|
56
|
-
description: "Decentralized publishing protocol",
|
|
57
|
-
},
|
|
58
54
|
[source.Source.clusters]: {
|
|
59
55
|
name: "Clusters",
|
|
60
56
|
description: "On-chain social protocol",
|
package/dist/utils/source.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Source, type SourceType } from "../types/source";
|
|
2
2
|
export declare const SOURCE_DATA: Readonly<Record<Source, SourceType>>;
|
package/dist/utils/source.js
CHANGED
|
@@ -49,10 +49,6 @@ const SOURCE_DATA = {
|
|
|
49
49
|
name: "Gravity",
|
|
50
50
|
description: "Gravity alpha mainnet name service",
|
|
51
51
|
},
|
|
52
|
-
[Source.crossbell]: {
|
|
53
|
-
name: "Crossbell",
|
|
54
|
-
description: "Decentralized publishing protocol",
|
|
55
|
-
},
|
|
56
52
|
[Source.clusters]: {
|
|
57
53
|
name: "Clusters",
|
|
58
54
|
description: "On-chain social protocol",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web3bio-profile-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "React hooks for querying ENS, Farcaster, Lens and Web3 universal profiles",
|
|
5
5
|
"author": "web3bio",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,15 +17,31 @@
|
|
|
17
17
|
},
|
|
18
18
|
"./hooks": {
|
|
19
19
|
"types": "./dist/hooks/index.d.ts",
|
|
20
|
-
"
|
|
20
|
+
"import": "./dist/hooks/index.js",
|
|
21
|
+
"require": "./dist/hooks/index.cjs"
|
|
21
22
|
},
|
|
22
23
|
"./types": {
|
|
23
24
|
"types": "./dist/types/index.d.ts",
|
|
24
|
-
"
|
|
25
|
+
"import": "./dist/types/index.js",
|
|
26
|
+
"require": "./dist/types/index.cjs"
|
|
25
27
|
},
|
|
26
28
|
"./utils": {
|
|
27
29
|
"types": "./dist/utils/index.d.ts",
|
|
28
|
-
"
|
|
30
|
+
"import": "./dist/utils/index.js",
|
|
31
|
+
"require": "./dist/utils/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"typesVersions": {
|
|
35
|
+
"*": {
|
|
36
|
+
"types": [
|
|
37
|
+
"./dist/types/index.d.ts"
|
|
38
|
+
],
|
|
39
|
+
"hooks": [
|
|
40
|
+
"./dist/hooks/index.d.ts"
|
|
41
|
+
],
|
|
42
|
+
"utils": [
|
|
43
|
+
"./dist/utils/index.d.ts"
|
|
44
|
+
]
|
|
29
45
|
}
|
|
30
46
|
},
|
|
31
47
|
"files": [
|