@windrun-huaiin/third-ui 7.2.0 → 7.2.1
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/clerk/fingerprint/fingerprint-client.js +3 -9
- package/dist/clerk/fingerprint/fingerprint-client.mjs +3 -9
- package/dist/clerk/fingerprint/fingerprint-shared.d.ts +2 -2
- package/dist/clerk/fingerprint/fingerprint-shared.js +1 -1
- package/dist/clerk/fingerprint/fingerprint-shared.mjs +1 -1
- package/dist/clerk/fingerprint/types.d.ts +2 -0
- package/dist/clerk/fingerprint/use-fingerprint.js +1 -7
- package/dist/clerk/fingerprint/use-fingerprint.mjs +2 -8
- package/dist/node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js +0 -33
- package/dist/node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.mjs +1 -32
- package/package.json +3 -3
- package/src/clerk/fingerprint/fingerprint-client.ts +2 -10
- package/src/clerk/fingerprint/fingerprint-shared.ts +1 -1
- package/src/clerk/fingerprint/types.ts +2 -0
- package/src/clerk/fingerprint/use-fingerprint.ts +1 -9
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib_es6 = require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.js');
|
|
4
4
|
var fingerprintShared = require('./fingerprint-shared.js');
|
|
5
|
+
var fp_esm = require('../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js');
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Fingerprint Client Utilities
|
|
8
9
|
* 客户端专用的指纹生成和管理逻辑
|
|
9
10
|
* 只能在浏览器环境中使用
|
|
10
11
|
*/
|
|
11
|
-
// Dynamic import to avoid SSR issues
|
|
12
|
-
let FingerprintJS = null;
|
|
13
12
|
/**
|
|
14
13
|
* 生成基于真实浏览器特征的fingerprint ID
|
|
15
14
|
* 使用FingerprintJS收集浏览器特征并生成唯一标识
|
|
@@ -33,13 +32,8 @@ function generateFingerprintId() {
|
|
|
33
32
|
return cookieId;
|
|
34
33
|
}
|
|
35
34
|
try {
|
|
36
|
-
// 等待FingerprintJS加载完成
|
|
37
|
-
if (!FingerprintJS) {
|
|
38
|
-
const module = yield Promise.resolve().then(function () { return require('../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js'); });
|
|
39
|
-
FingerprintJS = module.default;
|
|
40
|
-
}
|
|
41
35
|
// 使用FingerprintJS生成基于浏览器特征的指纹
|
|
42
|
-
const fp = yield
|
|
36
|
+
const fp = yield fp_esm.default.load();
|
|
43
37
|
const result = yield fp.get();
|
|
44
38
|
const fingerprintId = `fp_${result.visitorId}`;
|
|
45
39
|
// 存储到localStorage和cookie
|
|
@@ -123,7 +117,7 @@ function createFingerprintHeaders() {
|
|
|
123
117
|
return tslib_es6.__awaiter(this, void 0, void 0, function* () {
|
|
124
118
|
const fingerprintId = yield getOrGenerateFingerprintId();
|
|
125
119
|
return {
|
|
126
|
-
|
|
120
|
+
FINGERPRINT_HEADER_NAME: fingerprintId,
|
|
127
121
|
};
|
|
128
122
|
});
|
|
129
123
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { __awaiter } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.mjs';
|
|
2
2
|
import { FINGERPRINT_STORAGE_KEY, isValidFingerprintId, FINGERPRINT_COOKIE_NAME } from './fingerprint-shared.mjs';
|
|
3
|
+
import index from '../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.mjs';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Fingerprint Client Utilities
|
|
6
7
|
* 客户端专用的指纹生成和管理逻辑
|
|
7
8
|
* 只能在浏览器环境中使用
|
|
8
9
|
*/
|
|
9
|
-
// Dynamic import to avoid SSR issues
|
|
10
|
-
let FingerprintJS = null;
|
|
11
10
|
/**
|
|
12
11
|
* 生成基于真实浏览器特征的fingerprint ID
|
|
13
12
|
* 使用FingerprintJS收集浏览器特征并生成唯一标识
|
|
@@ -31,13 +30,8 @@ function generateFingerprintId() {
|
|
|
31
30
|
return cookieId;
|
|
32
31
|
}
|
|
33
32
|
try {
|
|
34
|
-
// 等待FingerprintJS加载完成
|
|
35
|
-
if (!FingerprintJS) {
|
|
36
|
-
const module = yield import('../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.mjs');
|
|
37
|
-
FingerprintJS = module.default;
|
|
38
|
-
}
|
|
39
33
|
// 使用FingerprintJS生成基于浏览器特征的指纹
|
|
40
|
-
const fp = yield
|
|
34
|
+
const fp = yield index.load();
|
|
41
35
|
const result = yield fp.get();
|
|
42
36
|
const fingerprintId = `fp_${result.visitorId}`;
|
|
43
37
|
// 存储到localStorage和cookie
|
|
@@ -121,7 +115,7 @@ function createFingerprintHeaders() {
|
|
|
121
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
116
|
const fingerprintId = yield getOrGenerateFingerprintId();
|
|
123
117
|
return {
|
|
124
|
-
|
|
118
|
+
FINGERPRINT_HEADER_NAME: fingerprintId,
|
|
125
119
|
};
|
|
126
120
|
});
|
|
127
121
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Fingerprint Shared Utilities
|
|
3
3
|
* 客户端和服务端共享的常量、类型和验证逻辑
|
|
4
4
|
*/
|
|
5
|
-
export declare const FINGERPRINT_STORAGE_KEY = "
|
|
5
|
+
export declare const FINGERPRINT_STORAGE_KEY = "x_fingerprint_id";
|
|
6
6
|
export declare const FINGERPRINT_HEADER_NAME = "x-fingerprint-id";
|
|
7
7
|
export declare const FINGERPRINT_COOKIE_NAME = "fingerprint_id";
|
|
8
8
|
/**
|
|
@@ -11,7 +11,7 @@ export declare const FINGERPRINT_COOKIE_NAME = "fingerprint_id";
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function isValidFingerprintId(fingerprintId: string): boolean;
|
|
13
13
|
export declare const FINGERPRINT_CONSTANTS: {
|
|
14
|
-
readonly STORAGE_KEY: "
|
|
14
|
+
readonly STORAGE_KEY: "x_fingerprint_id";
|
|
15
15
|
readonly HEADER_NAME: "x-fingerprint-id";
|
|
16
16
|
readonly COOKIE_NAME: "fingerprint_id";
|
|
17
17
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 客户端和服务端共享的常量、类型和验证逻辑
|
|
6
6
|
*/
|
|
7
7
|
// Fingerprint ID的存储键和header名
|
|
8
|
-
const FINGERPRINT_STORAGE_KEY = '
|
|
8
|
+
const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
|
|
9
9
|
const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
|
|
10
10
|
const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
|
|
11
11
|
/**
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* 客户端和服务端共享的常量、类型和验证逻辑
|
|
4
4
|
*/
|
|
5
5
|
// Fingerprint ID的存储键和header名
|
|
6
|
-
const FINGERPRINT_STORAGE_KEY = '
|
|
6
|
+
const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
|
|
7
7
|
const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
|
|
8
8
|
const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
|
|
9
9
|
/**
|
|
@@ -23,13 +23,7 @@ function useFingerprint(config) {
|
|
|
23
23
|
if (typeof window === 'undefined')
|
|
24
24
|
return null;
|
|
25
25
|
try {
|
|
26
|
-
// 优先检查现有ID
|
|
27
|
-
const existingId = fingerprintClient.getFingerprintId();
|
|
28
|
-
if (existingId) {
|
|
29
|
-
setFingerprintIdState(existingId);
|
|
30
|
-
return existingId;
|
|
31
|
-
}
|
|
32
|
-
// 生成新的fingerprint ID
|
|
26
|
+
// 优先检查现有ID, 没有就生成新的fingerprint ID
|
|
33
27
|
const currentFingerprintId = yield fingerprintClient.getOrGenerateFingerprintId();
|
|
34
28
|
setFingerprintIdState(currentFingerprintId);
|
|
35
29
|
return currentFingerprintId;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { __awaiter } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.mjs';
|
|
3
3
|
import { useState, useCallback, useEffect } from 'react';
|
|
4
|
-
import { createFingerprintHeaders, setFingerprintId,
|
|
4
|
+
import { createFingerprintHeaders, setFingerprintId, getOrGenerateFingerprintId } from './fingerprint-client.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Hook for managing fingerprint ID and anonymous user data
|
|
@@ -21,13 +21,7 @@ function useFingerprint(config) {
|
|
|
21
21
|
if (typeof window === 'undefined')
|
|
22
22
|
return null;
|
|
23
23
|
try {
|
|
24
|
-
// 优先检查现有ID
|
|
25
|
-
const existingId = getFingerprintId();
|
|
26
|
-
if (existingId) {
|
|
27
|
-
setFingerprintIdState(existingId);
|
|
28
|
-
return existingId;
|
|
29
|
-
}
|
|
30
|
-
// 生成新的fingerprint ID
|
|
24
|
+
// 优先检查现有ID, 没有就生成新的fingerprint ID
|
|
31
25
|
const currentFingerprintId = yield getOrGenerateFingerprintId();
|
|
32
26
|
setFingerprintIdState(currentFingerprintId);
|
|
33
27
|
return currentFingerprintId;
|
|
@@ -613,34 +613,6 @@ function loadSources(sources, sourceOptions, excludeSources, loopReleaseInterval
|
|
|
613
613
|
});
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
/**
|
|
617
|
-
* Modifies an entropy source by transforming its returned value with the given function.
|
|
618
|
-
* Keeps the source properties: sync/async, 1/2 stages.
|
|
619
|
-
*
|
|
620
|
-
* Warning for package users:
|
|
621
|
-
* This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.
|
|
622
|
-
*/
|
|
623
|
-
function transformSource(source, transformValue) {
|
|
624
|
-
var transformLoadResult = function (loadResult) {
|
|
625
|
-
if (isFinalResultLoaded(loadResult)) {
|
|
626
|
-
return transformValue(loadResult);
|
|
627
|
-
}
|
|
628
|
-
return function () {
|
|
629
|
-
var getResult = loadResult();
|
|
630
|
-
if (isPromise(getResult)) {
|
|
631
|
-
return getResult.then(transformValue);
|
|
632
|
-
}
|
|
633
|
-
return transformValue(getResult);
|
|
634
|
-
};
|
|
635
|
-
};
|
|
636
|
-
return function (options) {
|
|
637
|
-
var loadResult = source(options);
|
|
638
|
-
if (isPromise(loadResult)) {
|
|
639
|
-
return loadResult.then(transformLoadResult);
|
|
640
|
-
}
|
|
641
|
-
return transformLoadResult(loadResult);
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
616
|
|
|
645
617
|
/*
|
|
646
618
|
* Functions to help with features that vary through browsers
|
|
@@ -3215,9 +3187,6 @@ function load(options) {
|
|
|
3215
3187
|
// The default export is a syntax sugar (`import * as FP from '...' → import FP from '...'`).
|
|
3216
3188
|
// It should contain all the public exported values.
|
|
3217
3189
|
var index = { load: load, hashComponents: hashComponents, componentsToDebugString: componentsToDebugString };
|
|
3218
|
-
// The exports below are for private usage. They may change unexpectedly. Use them at your own risk.
|
|
3219
|
-
/** Not documented, out of Semantic Versioning, usage is at your own risk */
|
|
3220
|
-
var murmurX64Hash128 = x64hash128;
|
|
3221
3190
|
|
|
3222
3191
|
exports.componentsToDebugString = componentsToDebugString;
|
|
3223
3192
|
exports.default = index;
|
|
@@ -3238,8 +3207,6 @@ exports.isTrident = isTrident;
|
|
|
3238
3207
|
exports.isWebKit = isWebKit;
|
|
3239
3208
|
exports.load = load;
|
|
3240
3209
|
exports.loadSources = loadSources;
|
|
3241
|
-
exports.murmurX64Hash128 = murmurX64Hash128;
|
|
3242
3210
|
exports.prepareForSources = prepareForSources;
|
|
3243
3211
|
exports.sources = sources;
|
|
3244
|
-
exports.transformSource = transformSource;
|
|
3245
3212
|
exports.withIframe = withIframe;
|
|
@@ -609,34 +609,6 @@ function loadSources(sources, sourceOptions, excludeSources, loopReleaseInterval
|
|
|
609
609
|
});
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
/**
|
|
613
|
-
* Modifies an entropy source by transforming its returned value with the given function.
|
|
614
|
-
* Keeps the source properties: sync/async, 1/2 stages.
|
|
615
|
-
*
|
|
616
|
-
* Warning for package users:
|
|
617
|
-
* This function is out of Semantic Versioning, i.e. can change unexpectedly. Usage is at your own risk.
|
|
618
|
-
*/
|
|
619
|
-
function transformSource(source, transformValue) {
|
|
620
|
-
var transformLoadResult = function (loadResult) {
|
|
621
|
-
if (isFinalResultLoaded(loadResult)) {
|
|
622
|
-
return transformValue(loadResult);
|
|
623
|
-
}
|
|
624
|
-
return function () {
|
|
625
|
-
var getResult = loadResult();
|
|
626
|
-
if (isPromise(getResult)) {
|
|
627
|
-
return getResult.then(transformValue);
|
|
628
|
-
}
|
|
629
|
-
return transformValue(getResult);
|
|
630
|
-
};
|
|
631
|
-
};
|
|
632
|
-
return function (options) {
|
|
633
|
-
var loadResult = source(options);
|
|
634
|
-
if (isPromise(loadResult)) {
|
|
635
|
-
return loadResult.then(transformLoadResult);
|
|
636
|
-
}
|
|
637
|
-
return transformLoadResult(loadResult);
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
612
|
|
|
641
613
|
/*
|
|
642
614
|
* Functions to help with features that vary through browsers
|
|
@@ -3211,8 +3183,5 @@ function load(options) {
|
|
|
3211
3183
|
// The default export is a syntax sugar (`import * as FP from '...' → import FP from '...'`).
|
|
3212
3184
|
// It should contain all the public exported values.
|
|
3213
3185
|
var index = { load: load, hashComponents: hashComponents, componentsToDebugString: componentsToDebugString };
|
|
3214
|
-
// The exports below are for private usage. They may change unexpectedly. Use them at your own risk.
|
|
3215
|
-
/** Not documented, out of Semantic Versioning, usage is at your own risk */
|
|
3216
|
-
var murmurX64Hash128 = x64hash128;
|
|
3217
3186
|
|
|
3218
|
-
export { componentsToDebugString, index as default, getFullscreenElement, getUnstableAudioFingerprint, getUnstableCanvasFingerprint, getUnstableScreenFrame, getUnstableScreenResolution, getWebGLContext, hashComponents, isAndroid, isChromium, isDesktopWebKit, isEdgeHTML, isGecko, isSamsungInternet, isTrident, isWebKit, load, loadSources,
|
|
3187
|
+
export { componentsToDebugString, index as default, getFullscreenElement, getUnstableAudioFingerprint, getUnstableCanvasFingerprint, getUnstableScreenFrame, getUnstableScreenResolution, getWebGLContext, hashComponents, isAndroid, isChromium, isDesktopWebKit, isEdgeHTML, isGecko, isSamsungInternet, isTrident, isWebKit, load, loadSources, prepareForSources, sources, withIframe };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@windrun-huaiin/third-ui",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Third-party integrated UI components for windrun-huaiin projects",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"mermaid": "^11.6.0",
|
|
76
76
|
"react-medium-image-zoom": "^5.2.14",
|
|
77
77
|
"zod": "^3.22.4",
|
|
78
|
-
"@windrun-huaiin/
|
|
79
|
-
"@windrun-huaiin/
|
|
78
|
+
"@windrun-huaiin/lib": "^7.1.1",
|
|
79
|
+
"@windrun-huaiin/base-ui": "^8.1.1"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"react": "19.1.0",
|
|
@@ -9,9 +9,7 @@ import {
|
|
|
9
9
|
FINGERPRINT_COOKIE_NAME,
|
|
10
10
|
isValidFingerprintId
|
|
11
11
|
} from './fingerprint-shared';
|
|
12
|
-
|
|
13
|
-
// Dynamic import to avoid SSR issues
|
|
14
|
-
let FingerprintJS: any = null;
|
|
12
|
+
import FingerprintJS from '@fingerprintjs/fingerprintjs';
|
|
15
13
|
|
|
16
14
|
/**
|
|
17
15
|
* 生成基于真实浏览器特征的fingerprint ID
|
|
@@ -38,12 +36,6 @@ export async function generateFingerprintId(): Promise<string> {
|
|
|
38
36
|
}
|
|
39
37
|
|
|
40
38
|
try {
|
|
41
|
-
// 等待FingerprintJS加载完成
|
|
42
|
-
if (!FingerprintJS) {
|
|
43
|
-
const module = await import('@fingerprintjs/fingerprintjs');
|
|
44
|
-
FingerprintJS = module.default;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
39
|
// 使用FingerprintJS生成基于浏览器特征的指纹
|
|
48
40
|
const fp = await FingerprintJS.load();
|
|
49
41
|
const result = await fp.get();
|
|
@@ -138,7 +130,7 @@ export async function getOrGenerateFingerprintId(): Promise<string> {
|
|
|
138
130
|
export async function createFingerprintHeaders(): Promise<Record<string, string>> {
|
|
139
131
|
const fingerprintId = await getOrGenerateFingerprintId();
|
|
140
132
|
return {
|
|
141
|
-
|
|
133
|
+
FINGERPRINT_HEADER_NAME : fingerprintId,
|
|
142
134
|
};
|
|
143
135
|
}
|
|
144
136
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Fingerprint ID的存储键和header名
|
|
7
|
-
export const FINGERPRINT_STORAGE_KEY = '
|
|
7
|
+
export const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
|
|
8
8
|
export const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
|
|
9
9
|
export const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
|
|
10
10
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import {
|
|
5
5
|
getOrGenerateFingerprintId,
|
|
6
|
-
getFingerprintId,
|
|
7
6
|
setFingerprintId,
|
|
8
7
|
createFingerprintHeaders
|
|
9
8
|
} from './fingerprint-client';
|
|
@@ -33,14 +32,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
|
|
|
33
32
|
if (typeof window === 'undefined') return null;
|
|
34
33
|
|
|
35
34
|
try {
|
|
36
|
-
// 优先检查现有ID
|
|
37
|
-
const existingId = getFingerprintId();
|
|
38
|
-
if (existingId) {
|
|
39
|
-
setFingerprintIdState(existingId);
|
|
40
|
-
return existingId;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// 生成新的fingerprint ID
|
|
35
|
+
// 优先检查现有ID, 没有就生成新的fingerprint ID
|
|
44
36
|
const currentFingerprintId = await getOrGenerateFingerprintId();
|
|
45
37
|
setFingerprintIdState(currentFingerprintId);
|
|
46
38
|
return currentFingerprintId;
|