web3bio-profile-kit 0.2.4 → 0.2.7

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.
@@ -49,7 +49,6 @@ exports.Platform = void 0;
49
49
  Platform["gravity"] = "gravity";
50
50
  Platform["guild"] = "guild";
51
51
  Platform["hackernews"] = "hackernews";
52
- Platform["hey"] = "hey";
53
52
  Platform["humanode"] = "humanode";
54
53
  Platform["humanpassport"] = "humanpassport";
55
54
  Platform["instagram"] = "instagram";
@@ -46,7 +46,6 @@ export declare enum Platform {
46
46
  gravity = "gravity",
47
47
  guild = "guild",
48
48
  hackernews = "hackernews",
49
- hey = "hey",
50
49
  humanode = "humanode",
51
50
  humanpassport = "humanpassport",
52
51
  instagram = "instagram",
@@ -47,7 +47,6 @@ var Platform;
47
47
  Platform["gravity"] = "gravity";
48
48
  Platform["guild"] = "guild";
49
49
  Platform["hackernews"] = "hackernews";
50
- Platform["hey"] = "hey";
51
50
  Platform["humanode"] = "humanode";
52
51
  Platform["humanpassport"] = "humanpassport";
53
52
  Platform["instagram"] = "instagram";
@@ -29,16 +29,19 @@ exports.Source = void 0;
29
29
  Source["keybase"] = "keybase";
30
30
  Source["lens"] = "lens";
31
31
  Source["linea"] = "linea";
32
+ Source["magiceden"] = "magiceden";
32
33
  Source["metopia"] = "metopia";
33
34
  Source["mirror"] = "mirror";
34
35
  Source["nextid"] = "nextid";
35
36
  Source["nftd"] = "nftd";
36
37
  Source["nostr"] = "nostr";
37
38
  Source["opensea"] = "opensea";
39
+ Source["opinion"] = "opinion";
38
40
  Source["paragraph"] = "paragraph";
39
41
  Source["particle"] = "particle";
40
42
  Source["polymarket"] = "polymarket";
41
43
  Source["ppl"] = "ppl";
44
+ Source["predictfun"] = "predictfun";
42
45
  Source["privy"] = "privy";
43
46
  Source["questn"] = "questn";
44
47
  Source["rarible"] = "rarible";
@@ -26,16 +26,19 @@ export declare enum Source {
26
26
  keybase = "keybase",
27
27
  lens = "lens",
28
28
  linea = "linea",
29
+ magiceden = "magiceden",
29
30
  metopia = "metopia",
30
31
  mirror = "mirror",
31
32
  nextid = "nextid",
32
33
  nftd = "nftd",
33
34
  nostr = "nostr",
34
35
  opensea = "opensea",
36
+ opinion = "opinion",
35
37
  paragraph = "paragraph",
36
38
  particle = "particle",
37
39
  polymarket = "polymarket",
38
40
  ppl = "ppl",
41
+ predictfun = "predictfun",
39
42
  privy = "privy",
40
43
  questn = "questn",
41
44
  rarible = "rarible",
@@ -27,16 +27,19 @@ var Source;
27
27
  Source["keybase"] = "keybase";
28
28
  Source["lens"] = "lens";
29
29
  Source["linea"] = "linea";
30
+ Source["magiceden"] = "magiceden";
30
31
  Source["metopia"] = "metopia";
31
32
  Source["mirror"] = "mirror";
32
33
  Source["nextid"] = "nextid";
33
34
  Source["nftd"] = "nftd";
34
35
  Source["nostr"] = "nostr";
35
36
  Source["opensea"] = "opensea";
37
+ Source["opinion"] = "opinion";
36
38
  Source["paragraph"] = "paragraph";
37
39
  Source["particle"] = "particle";
38
40
  Source["polymarket"] = "polymarket";
39
41
  Source["ppl"] = "ppl";
42
+ Source["predictfun"] = "predictfun";
40
43
  Source["privy"] = "privy";
41
44
  Source["questn"] = "questn";
42
45
  Source["rarible"] = "rarible";
@@ -10,19 +10,6 @@ var platform$1 = require('./platform.cjs');
10
10
  var regex = require('./regex.cjs');
11
11
 
12
12
  const PROFILE_API_ENDPOINT = "https://api.web3.bio";
13
- const WEB2_SUFFIXES = new Set([
14
- platform.Platform.twitter,
15
- platform.Platform.nextid,
16
- platform.Platform.keybase,
17
- platform.Platform.instagram,
18
- platform.Platform.github,
19
- platform.Platform.discord,
20
- platform.Platform.reddit,
21
- platform.Platform.linkedin,
22
- platform.Platform.nostr,
23
- platform.Platform.bluesky,
24
- platform.Platform.telegram,
25
- ]);
26
13
  /**
27
14
  * Resolves an identity string to a platform and identifier
28
15
  * @param input The identity to resolve
@@ -76,7 +63,7 @@ const prettify = (input) => {
76
63
  const lastDotIndex = input.lastIndexOf(".");
77
64
  if (lastDotIndex !== -1) {
78
65
  const suffix = input.slice(lastDotIndex + 1);
79
- if (WEB2_SUFFIXES.has(suffix)) {
66
+ if (platform$1.isWeb2Platform(suffix)) {
80
67
  return input.slice(0, lastDotIndex);
81
68
  }
82
69
  }
@@ -4,23 +4,10 @@ import '../types/hook.js';
4
4
  import '../types/source.js';
5
5
  import '../types/cointype.js';
6
6
  import '../types/credential.js';
7
- import { PLATFORM_DATA } from './platform.js';
7
+ import { isWeb2Platform, PLATFORM_DATA } from './platform.js';
8
8
  import { REGEX } from './regex.js';
9
9
 
10
10
  const PROFILE_API_ENDPOINT = "https://api.web3.bio";
11
- const WEB2_SUFFIXES = new Set([
12
- Platform.twitter,
13
- Platform.nextid,
14
- Platform.keybase,
15
- Platform.instagram,
16
- Platform.github,
17
- Platform.discord,
18
- Platform.reddit,
19
- Platform.linkedin,
20
- Platform.nostr,
21
- Platform.bluesky,
22
- Platform.telegram,
23
- ]);
24
11
  /**
25
12
  * Resolves an identity string to a platform and identifier
26
13
  * @param input The identity to resolve
@@ -74,7 +61,7 @@ const prettify = (input) => {
74
61
  const lastDotIndex = input.lastIndexOf(".");
75
62
  if (lastDotIndex !== -1) {
76
63
  const suffix = input.slice(lastDotIndex + 1);
77
- if (WEB2_SUFFIXES.has(suffix)) {
64
+ if (isWeb2Platform(suffix)) {
78
65
  return input.slice(0, lastDotIndex);
79
66
  }
80
67
  }
@@ -18,7 +18,9 @@ Object.defineProperty(exports, 'CoinType', {
18
18
  exports.REGEX = regex.REGEX;
19
19
  exports.DEFAULT_PLATFORM = platform.DEFAULT_PLATFORM;
20
20
  exports.PLATFORM_DATA = platform.PLATFORM_DATA;
21
+ exports.WEB2_PLATFORMS = platform.WEB2_PLATFORMS;
21
22
  exports.getPlatform = platform.getPlatform;
23
+ exports.isWeb2Platform = platform.isWeb2Platform;
22
24
  exports.NETWORK_DATA = network.NETWORK_DATA;
23
25
  exports.getNetwork = network.getNetwork;
24
26
  exports.SOURCE_DATA = source.SOURCE_DATA;
@@ -1,6 +1,6 @@
1
1
  export * from "../types/cointype";
2
2
  export { REGEX } from "./regex";
3
- export { DEFAULT_PLATFORM, PLATFORM_DATA, getPlatform } from "./platform";
3
+ export { DEFAULT_PLATFORM, PLATFORM_DATA, WEB2_PLATFORMS, getPlatform, isWeb2Platform, } from "./platform";
4
4
  export { NETWORK_DATA, getNetwork } from "./network";
5
5
  export { SOURCE_DATA, getSource } from "./source";
6
6
  export { resolveIdentity, idToJson, prettify, uglify, isSupportedPlatform, detectPlatform, isSameAddress, isWeb3Address, isValidEthereumAddress, isValidSolanaAddress, } from "./helpers";
@@ -1,6 +1,6 @@
1
1
  export { CoinType } from '../types/cointype.js';
2
2
  export { REGEX } from './regex.js';
3
- export { DEFAULT_PLATFORM, PLATFORM_DATA, getPlatform } from './platform.js';
3
+ export { DEFAULT_PLATFORM, PLATFORM_DATA, WEB2_PLATFORMS, getPlatform, isWeb2Platform } from './platform.js';
4
4
  export { NETWORK_DATA, getNetwork } from './network.js';
5
5
  export { SOURCE_DATA, getSource } from './source.js';
6
6
  export { detectPlatform, idToJson, isSameAddress, isSupportedPlatform, isValidEthereumAddress, isValidSolanaAddress, isWeb3Address, prettify, resolveIdentity, uglify } from './helpers.js';
@@ -2,6 +2,46 @@
2
2
 
3
3
  var platform = require('../types/platform.cjs');
4
4
 
5
+ /**
6
+ * Platforms classified as Web2 (traditional social / web profiles), used for identity formatting and related checks.
7
+ * @public
8
+ */
9
+ const WEB2_PLATFORMS = [
10
+ platform.Platform.bilibili,
11
+ platform.Platform.bluesky,
12
+ platform.Platform.calendly,
13
+ platform.Platform.discord,
14
+ platform.Platform.facebook,
15
+ platform.Platform.github,
16
+ platform.Platform.hackernews,
17
+ platform.Platform.instagram,
18
+ platform.Platform.keybase,
19
+ platform.Platform.linkedin,
20
+ platform.Platform.lobsters,
21
+ platform.Platform.minds,
22
+ platform.Platform.mstdnjp,
23
+ platform.Platform.nostr,
24
+ platform.Platform.reddit,
25
+ platform.Platform.substack,
26
+ platform.Platform.telegram,
27
+ platform.Platform.threads,
28
+ platform.Platform.tiktok,
29
+ platform.Platform.twitter,
30
+ platform.Platform.v2ex,
31
+ platform.Platform.weibo,
32
+ platform.Platform.whatsapp,
33
+ platform.Platform.youtube,
34
+ ];
35
+ const WEB2_PLATFORM_SET = new Set(WEB2_PLATFORMS);
36
+ /**
37
+ * Whether the given platform key is listed as a Web2 platform.
38
+ * @public
39
+ */
40
+ const isWeb2Platform = (platform) => {
41
+ if (!Boolean(platform))
42
+ return false;
43
+ return WEB2_PLATFORM_SET.has(platform);
44
+ };
5
45
  /**
6
46
  * Default data
7
47
  * @internal
@@ -416,15 +456,6 @@ const PLATFORM_DATA = new Map([
416
456
  urlPrefix: "https://news.ycombinator.com/user?id=",
417
457
  },
418
458
  ],
419
- [
420
- platform.Platform.hey,
421
- {
422
- color: "#E84F64",
423
- icon: "icons/icon-hey.svg",
424
- label: "Hey",
425
- urlPrefix: "https://hey.xyz/u/",
426
- },
427
- ],
428
459
  [
429
460
  platform.Platform.humanode,
430
461
  {
@@ -1041,4 +1072,6 @@ const getPlatform = (platform) => {
1041
1072
 
1042
1073
  exports.DEFAULT_PLATFORM = DEFAULT_PLATFORM;
1043
1074
  exports.PLATFORM_DATA = PLATFORM_DATA;
1075
+ exports.WEB2_PLATFORMS = WEB2_PLATFORMS;
1044
1076
  exports.getPlatform = getPlatform;
1077
+ exports.isWeb2Platform = isWeb2Platform;
@@ -1,4 +1,14 @@
1
1
  import { Platform, type PlatformType } from "../types/platform";
2
+ /**
3
+ * Platforms classified as Web2 (traditional social / web profiles), used for identity formatting and related checks.
4
+ * @public
5
+ */
6
+ export declare const WEB2_PLATFORMS: readonly Platform[];
7
+ /**
8
+ * Whether the given platform key is listed as a Web2 platform.
9
+ * @public
10
+ */
11
+ export declare const isWeb2Platform: (platform: Platform | string | null | undefined) => boolean;
2
12
  /**
3
13
  * Default data
4
14
  * @internal
@@ -1,5 +1,45 @@
1
1
  import { Platform } from '../types/platform.js';
2
2
 
3
+ /**
4
+ * Platforms classified as Web2 (traditional social / web profiles), used for identity formatting and related checks.
5
+ * @public
6
+ */
7
+ const WEB2_PLATFORMS = [
8
+ Platform.bilibili,
9
+ Platform.bluesky,
10
+ Platform.calendly,
11
+ Platform.discord,
12
+ Platform.facebook,
13
+ Platform.github,
14
+ Platform.hackernews,
15
+ Platform.instagram,
16
+ Platform.keybase,
17
+ Platform.linkedin,
18
+ Platform.lobsters,
19
+ Platform.minds,
20
+ Platform.mstdnjp,
21
+ Platform.nostr,
22
+ Platform.reddit,
23
+ Platform.substack,
24
+ Platform.telegram,
25
+ Platform.threads,
26
+ Platform.tiktok,
27
+ Platform.twitter,
28
+ Platform.v2ex,
29
+ Platform.weibo,
30
+ Platform.whatsapp,
31
+ Platform.youtube,
32
+ ];
33
+ const WEB2_PLATFORM_SET = new Set(WEB2_PLATFORMS);
34
+ /**
35
+ * Whether the given platform key is listed as a Web2 platform.
36
+ * @public
37
+ */
38
+ const isWeb2Platform = (platform) => {
39
+ if (!Boolean(platform))
40
+ return false;
41
+ return WEB2_PLATFORM_SET.has(platform);
42
+ };
3
43
  /**
4
44
  * Default data
5
45
  * @internal
@@ -414,15 +454,6 @@ const PLATFORM_DATA = new Map([
414
454
  urlPrefix: "https://news.ycombinator.com/user?id=",
415
455
  },
416
456
  ],
417
- [
418
- Platform.hey,
419
- {
420
- color: "#E84F64",
421
- icon: "icons/icon-hey.svg",
422
- label: "Hey",
423
- urlPrefix: "https://hey.xyz/u/",
424
- },
425
- ],
426
457
  [
427
458
  Platform.humanode,
428
459
  {
@@ -1037,4 +1068,4 @@ const getPlatform = (platform) => {
1037
1068
  return (PLATFORM_DATA.get(platform) || { ...DEFAULT_PLATFORM, label: platform });
1038
1069
  };
1039
1070
 
1040
- export { DEFAULT_PLATFORM, PLATFORM_DATA, getPlatform };
1071
+ export { DEFAULT_PLATFORM, PLATFORM_DATA, WEB2_PLATFORMS, getPlatform, isWeb2Platform };
@@ -114,6 +114,11 @@ const SOURCE_DATA = {
114
114
  description: "L2 based on ZK",
115
115
  icon: "icons/icon-linea.svg",
116
116
  },
117
+ [source.Source.magiceden]: {
118
+ name: "Magic Eden",
119
+ description: "Web3 NFT marketplace",
120
+ icon: "icons/icon-magiceden.svg",
121
+ },
117
122
  [source.Source.metopia]: {
118
123
  name: "Metopia",
119
124
  description: "Web3 identity & learning platform",
@@ -144,6 +149,11 @@ const SOURCE_DATA = {
144
149
  description: "NFT marketplace",
145
150
  icon: "icons/icon-opensea.svg",
146
151
  },
152
+ [source.Source.opinion]: {
153
+ name: "Opinion",
154
+ description: "High-performance prediction exchange",
155
+ icon: "icons/icon-opinion.svg",
156
+ },
147
157
  [source.Source.paragraph]: {
148
158
  name: "Paragraph",
149
159
  description: "Decentralized publishing protocol",
@@ -163,6 +173,10 @@ const SOURCE_DATA = {
163
173
  name: "0xPPL",
164
174
  description: "Web3 social platform",
165
175
  },
176
+ [source.Source.predictfun]: {
177
+ name: "Predict.fun",
178
+ description: "The BNB-native prediction market",
179
+ },
166
180
  [source.Source.privy]: {
167
181
  name: "Privy",
168
182
  description: "Wallet infrastructure",
@@ -112,6 +112,11 @@ const SOURCE_DATA = {
112
112
  description: "L2 based on ZK",
113
113
  icon: "icons/icon-linea.svg",
114
114
  },
115
+ [Source.magiceden]: {
116
+ name: "Magic Eden",
117
+ description: "Web3 NFT marketplace",
118
+ icon: "icons/icon-magiceden.svg",
119
+ },
115
120
  [Source.metopia]: {
116
121
  name: "Metopia",
117
122
  description: "Web3 identity & learning platform",
@@ -142,6 +147,11 @@ const SOURCE_DATA = {
142
147
  description: "NFT marketplace",
143
148
  icon: "icons/icon-opensea.svg",
144
149
  },
150
+ [Source.opinion]: {
151
+ name: "Opinion",
152
+ description: "High-performance prediction exchange",
153
+ icon: "icons/icon-opinion.svg",
154
+ },
145
155
  [Source.paragraph]: {
146
156
  name: "Paragraph",
147
157
  description: "Decentralized publishing protocol",
@@ -161,6 +171,10 @@ const SOURCE_DATA = {
161
171
  name: "0xPPL",
162
172
  description: "Web3 social platform",
163
173
  },
174
+ [Source.predictfun]: {
175
+ name: "Predict.fun",
176
+ description: "The BNB-native prediction market",
177
+ },
164
178
  [Source.privy]: {
165
179
  name: "Privy",
166
180
  description: "Wallet infrastructure",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "web3bio-profile-kit",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "React hooks for querying ENS, Farcaster, Lens and Web3 universal profiles",
5
5
  "author": "web3bio",
6
6
  "license": "MIT",
7
7
  "private": false,
8
8
  "type": "module",
9
- "main": "dist/index.js",
10
- "module": "dist/index.esm.js",
9
+ "main": "dist/index.cjs",
10
+ "module": "dist/index.js",
11
11
  "types": "dist/index.d.ts",
12
12
  "exports": {
13
13
  ".": {
@@ -68,7 +68,8 @@
68
68
  },
69
69
  "scripts": {
70
70
  "build": "rimraf dist && rollup -c",
71
- "test": "react-scripts test --watchAll=false",
71
+ "test": "vitest run",
72
+ "test:watch": "vitest",
72
73
  "prepublishOnly": "pnpm run build"
73
74
  },
74
75
  "peerDependencies": {
@@ -80,21 +81,19 @@
80
81
  "@rollup/plugin-commonjs": "^25.0.8",
81
82
  "@rollup/plugin-node-resolve": "^15.3.1",
82
83
  "@rollup/plugin-typescript": "^11.1.6",
83
- "@testing-library/dom": "^10.4.0",
84
- "@testing-library/jest-dom": "^6.6.3",
85
- "@testing-library/react": "^16.3.0",
86
- "@testing-library/user-event": "^13.5.0",
87
- "@types/node": "^22.15.24",
84
+ "@testing-library/jest-dom": "^6.9.1",
85
+ "@testing-library/react": "^16.3.2",
86
+ "@types/node": "^22.19.17",
88
87
  "@types/react": "^18.3.23",
89
- "dotenv": "^16.5.0",
88
+ "@types/react-dom": "^18.3.7",
89
+ "@tanstack/react-query": "^5.100.5",
90
+ "dotenv": "^16.6.1",
91
+ "jsdom": "^26.1.0",
90
92
  "react": "^18.3.1",
91
93
  "react-dom": "^18.3.1",
92
- "react-scripts": "5.0.1",
93
94
  "rimraf": "^5.0.10",
94
95
  "rollup": "^3.29.5",
95
- "rollup-plugin-dts": "^5.3.1",
96
- "rollup-plugin-peer-deps-external": "^2.2.4",
97
- "typescript": "^5.8.3",
98
- "@tanstack/react-query": "^5.79.2"
96
+ "typescript": "^5.9.3",
97
+ "vitest": "^3.2.4"
99
98
  }
100
99
  }