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.
- package/dist/types/platform.cjs +0 -1
- package/dist/types/platform.d.ts +0 -1
- package/dist/types/platform.js +0 -1
- package/dist/utils/helpers.cjs +1 -14
- package/dist/utils/helpers.js +2 -15
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/platform.cjs +42 -9
- package/dist/utils/platform.d.ts +10 -0
- package/dist/utils/platform.js +41 -10
- package/package.json +1 -1
package/dist/types/platform.cjs
CHANGED
|
@@ -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";
|
package/dist/types/platform.d.ts
CHANGED
package/dist/types/platform.js
CHANGED
|
@@ -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";
|
package/dist/utils/helpers.cjs
CHANGED
|
@@ -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 (
|
|
66
|
+
if (platform$1.isWeb2Platform(suffix)) {
|
|
80
67
|
return input.slice(0, lastDotIndex);
|
|
81
68
|
}
|
|
82
69
|
}
|
package/dist/utils/helpers.js
CHANGED
|
@@ -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 (
|
|
64
|
+
if (isWeb2Platform(suffix)) {
|
|
78
65
|
return input.slice(0, lastDotIndex);
|
|
79
66
|
}
|
|
80
67
|
}
|
package/dist/utils/index.cjs
CHANGED
|
@@ -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;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -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";
|
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 { 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';
|
package/dist/utils/platform.cjs
CHANGED
|
@@ -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;
|
package/dist/utils/platform.d.ts
CHANGED
|
@@ -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
|
package/dist/utils/platform.js
CHANGED
|
@@ -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 };
|