web3bio-profile-kit 0.2.4 → 0.2.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.
@@ -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";
@@ -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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web3bio-profile-kit",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "React hooks for querying ENS, Farcaster, Lens and Web3 universal profiles",
5
5
  "author": "web3bio",
6
6
  "license": "MIT",