@windrun-huaiin/third-ui 7.2.1 → 7.3.0

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.
Files changed (24) hide show
  1. package/README.md +12 -0
  2. package/dist/clerk/fingerprint/fingerprint-provider.d.ts +1 -1
  3. package/dist/clerk/fingerprint/fingerprint-provider.js +48 -18
  4. package/dist/clerk/fingerprint/fingerprint-provider.mjs +50 -20
  5. package/dist/clerk/fingerprint/fingerprint-shared.d.ts +6 -6
  6. package/dist/clerk/fingerprint/fingerprint-shared.js +3 -3
  7. package/dist/clerk/fingerprint/fingerprint-shared.mjs +3 -3
  8. package/dist/clerk/fingerprint/index.js +1 -1
  9. package/dist/clerk/fingerprint/index.mjs +1 -1
  10. package/dist/clerk/signin-with-fingerprint-client.d.ts +0 -1
  11. package/dist/clerk/signin-with-fingerprint-client.js +0 -3
  12. package/dist/clerk/signin-with-fingerprint-client.mjs +1 -1
  13. package/dist/clerk/signup-with-fingerprint-client.d.ts +0 -1
  14. package/dist/clerk/signup-with-fingerprint-client.js +0 -3
  15. package/dist/clerk/signup-with-fingerprint-client.mjs +1 -1
  16. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
  17. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.mjs +1 -1
  18. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
  19. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.mjs +1 -1
  20. package/package.json +3 -3
  21. package/src/clerk/fingerprint/fingerprint-provider.tsx +84 -33
  22. package/src/clerk/fingerprint/fingerprint-shared.ts +3 -3
  23. package/src/clerk/signin-with-fingerprint-client.tsx +0 -1
  24. package/src/clerk/signup-with-fingerprint-client.tsx +0 -1
package/README.md CHANGED
@@ -208,3 +208,15 @@ In MDX file:
208
208
  ```
209
209
 
210
210
  All configuration parameters will be automatically obtained from the global configuration, and no need to specify them in each use.
211
+
212
+
213
+ ## Showcase
214
+
215
+ - [Free Trivia Game](https://freetrivia.info/)
216
+ - [Music Poster](https://musicposter.org/en)
217
+ - [Image Narration](https://imagenarration.com/en)
218
+ - [Describe Yourself](https://describeyourself.org/en)
219
+ - [Newspaper Template](https://newspaper-template.org/en)
220
+ - [breathing exercise](https://breathingexercise.net/en)
221
+ - [ai directory list](https://aidirectorylist.com/en)
222
+ - [reve image directory](https://reveimage.directory/en)
@@ -22,4 +22,4 @@ export declare function withFingerprint<P extends object>(Component: React.Compo
22
22
  /**
23
23
  * 组件:显示用户状态和积分信息(用于调试)
24
24
  */
25
- export declare function FingerprintDebugInfo(): import("react/jsx-runtime").JSX.Element | null;
25
+ export declare function FingerprintStatus(): import("react/jsx-runtime").JSX.Element;
@@ -44,28 +44,58 @@ function withFingerprint(Component, config) {
44
44
  /**
45
45
  * 组件:显示用户状态和积分信息(用于调试)
46
46
  */
47
- function FingerprintDebugInfo() {
47
+ function FingerprintStatus() {
48
48
  const { fingerprintId, anonymousUser, credits, isLoading, isInitialized, error } = useFingerprintContext();
49
- if (!process.env.NODE_ENV || process.env.NODE_ENV === 'production') {
50
- return null;
51
- }
52
- return (jsxRuntime.jsxs("div", { style: {
53
- position: 'fixed',
54
- bottom: '10px',
55
- right: '10px',
56
- background: '#f0f0f0',
57
- padding: '10px',
58
- borderRadius: '5px',
59
- fontSize: '12px',
60
- fontFamily: 'monospace',
61
- maxWidth: '300px',
62
- zIndex: 9999,
63
- border: '1px solid #ccc'
64
- }, children: [jsxRuntime.jsx("h4", { style: { margin: '0 0 5px 0' }, children: "Fingerprint Debug" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "FP ID:" }), " ", fingerprintId || 'None'] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Loading:" }), " ", isLoading ? 'Yes' : 'No'] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Initialized:" }), " ", isInitialized ? 'Yes' : 'No'] }), error && jsxRuntime.jsxs("div", { style: { color: 'red' }, children: [jsxRuntime.jsx("strong", { children: "Error:" }), " ", error] }), anonymousUser && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "User ID:" }), " ", anonymousUser.userId.slice(0, 8), "..."] })), credits && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Credits:" }), " ", credits.balanceFree, "F + ", credits.balancePaid, "P = ", credits.totalBalance] }))] }));
49
+ const [isOpen, setIsOpen] = React.useState(false);
50
+ const handleToggle = () => {
51
+ setIsOpen(!isOpen);
52
+ };
53
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { onClick: handleToggle, style: {
54
+ position: 'fixed',
55
+ top: '10px',
56
+ left: '10px',
57
+ width: '50px',
58
+ height: '50px',
59
+ background: 'linear-gradient(135deg, #9b59b6, #e74c3c)',
60
+ borderRadius: '50%',
61
+ border: 'none',
62
+ cursor: 'pointer',
63
+ zIndex: 10000,
64
+ display: 'flex',
65
+ alignItems: 'center',
66
+ justifyContent: 'center',
67
+ boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
68
+ }, children: jsxRuntime.jsx("span", { style: {
69
+ fontSize: '24px',
70
+ color: 'white',
71
+ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
72
+ transition: 'transform 0.3s ease',
73
+ }, children: "\u25BC" }) }), isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { style: {
74
+ position: 'fixed',
75
+ top: 0,
76
+ left: 0,
77
+ width: '100%',
78
+ height: '100%',
79
+ background: 'rgba(0, 0, 0, 0.5)',
80
+ zIndex: 9998,
81
+ } }), jsxRuntime.jsxs("div", { style: {
82
+ position: 'fixed',
83
+ top: '70px',
84
+ left: '10px',
85
+ background: '#f0f0f0',
86
+ padding: '15px',
87
+ borderRadius: '5px',
88
+ fontSize: '12px',
89
+ fontFamily: 'monospace',
90
+ maxWidth: '300px',
91
+ zIndex: 9999,
92
+ border: '1px solid #ccc',
93
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.2)',
94
+ }, children: [jsxRuntime.jsx("h4", { style: { margin: '0 0 5px 0' }, children: "Fingerprint Debug" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "FP_ID:" }), " ", fingerprintId || 'None'] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Loading:" }), " ", isLoading ? 'Yes' : 'No'] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Initialized:" }), " ", isInitialized ? 'Yes' : 'No'] }), error && jsxRuntime.jsxs("div", { style: { color: 'red' }, children: [jsxRuntime.jsx("strong", { children: "Error:" }), " ", error] }), anonymousUser && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "user_id:" }), " ", anonymousUser.userId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "clerk_user_id:" }), " ", anonymousUser.clerkUserId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "email:" }), " ", anonymousUser.email || 'None', " ", jsxRuntime.jsx("br", {}), " "] })), credits && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Credits:" }), " ", credits.balanceFree, " Free + ", credits.balancePaid, " Paid = ", credits.totalBalance, " Total"] }))] })] }))] }));
65
95
  }
66
96
 
67
- exports.FingerprintDebugInfo = FingerprintDebugInfo;
68
97
  exports.FingerprintProvider = FingerprintProvider;
98
+ exports.FingerprintStatus = FingerprintStatus;
69
99
  exports.useFingerprintContext = useFingerprintContext;
70
100
  exports.useFingerprintContextSafe = useFingerprintContextSafe;
71
101
  exports.withFingerprint = withFingerprint;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { createContext, useContext } from 'react';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { createContext, useContext, useState } from 'react';
4
4
  import { useFingerprint } from './use-fingerprint.mjs';
5
5
 
6
6
  const FingerprintContext = createContext(undefined);
@@ -42,24 +42,54 @@ function withFingerprint(Component, config) {
42
42
  /**
43
43
  * 组件:显示用户状态和积分信息(用于调试)
44
44
  */
45
- function FingerprintDebugInfo() {
45
+ function FingerprintStatus() {
46
46
  const { fingerprintId, anonymousUser, credits, isLoading, isInitialized, error } = useFingerprintContext();
47
- if (!process.env.NODE_ENV || process.env.NODE_ENV === 'production') {
48
- return null;
49
- }
50
- return (jsxs("div", { style: {
51
- position: 'fixed',
52
- bottom: '10px',
53
- right: '10px',
54
- background: '#f0f0f0',
55
- padding: '10px',
56
- borderRadius: '5px',
57
- fontSize: '12px',
58
- fontFamily: 'monospace',
59
- maxWidth: '300px',
60
- zIndex: 9999,
61
- border: '1px solid #ccc'
62
- }, children: [jsx("h4", { style: { margin: '0 0 5px 0' }, children: "Fingerprint Debug" }), jsxs("div", { children: [jsx("strong", { children: "FP ID:" }), " ", fingerprintId || 'None'] }), jsxs("div", { children: [jsx("strong", { children: "Loading:" }), " ", isLoading ? 'Yes' : 'No'] }), jsxs("div", { children: [jsx("strong", { children: "Initialized:" }), " ", isInitialized ? 'Yes' : 'No'] }), error && jsxs("div", { style: { color: 'red' }, children: [jsx("strong", { children: "Error:" }), " ", error] }), anonymousUser && (jsxs("div", { children: [jsx("strong", { children: "User ID:" }), " ", anonymousUser.userId.slice(0, 8), "..."] })), credits && (jsxs("div", { children: [jsx("strong", { children: "Credits:" }), " ", credits.balanceFree, "F + ", credits.balancePaid, "P = ", credits.totalBalance] }))] }));
47
+ const [isOpen, setIsOpen] = useState(false);
48
+ const handleToggle = () => {
49
+ setIsOpen(!isOpen);
50
+ };
51
+ return (jsxs(Fragment, { children: [jsx("button", { onClick: handleToggle, style: {
52
+ position: 'fixed',
53
+ top: '10px',
54
+ left: '10px',
55
+ width: '50px',
56
+ height: '50px',
57
+ background: 'linear-gradient(135deg, #9b59b6, #e74c3c)',
58
+ borderRadius: '50%',
59
+ border: 'none',
60
+ cursor: 'pointer',
61
+ zIndex: 10000,
62
+ display: 'flex',
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
66
+ }, children: jsx("span", { style: {
67
+ fontSize: '24px',
68
+ color: 'white',
69
+ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
70
+ transition: 'transform 0.3s ease',
71
+ }, children: "\u25BC" }) }), isOpen && (jsxs(Fragment, { children: [jsx("div", { style: {
72
+ position: 'fixed',
73
+ top: 0,
74
+ left: 0,
75
+ width: '100%',
76
+ height: '100%',
77
+ background: 'rgba(0, 0, 0, 0.5)',
78
+ zIndex: 9998,
79
+ } }), jsxs("div", { style: {
80
+ position: 'fixed',
81
+ top: '70px',
82
+ left: '10px',
83
+ background: '#f0f0f0',
84
+ padding: '15px',
85
+ borderRadius: '5px',
86
+ fontSize: '12px',
87
+ fontFamily: 'monospace',
88
+ maxWidth: '300px',
89
+ zIndex: 9999,
90
+ border: '1px solid #ccc',
91
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.2)',
92
+ }, children: [jsx("h4", { style: { margin: '0 0 5px 0' }, children: "Fingerprint Debug" }), jsxs("div", { children: [jsx("strong", { children: "FP_ID:" }), " ", fingerprintId || 'None'] }), jsxs("div", { children: [jsx("strong", { children: "Loading:" }), " ", isLoading ? 'Yes' : 'No'] }), jsxs("div", { children: [jsx("strong", { children: "Initialized:" }), " ", isInitialized ? 'Yes' : 'No'] }), error && jsxs("div", { style: { color: 'red' }, children: [jsx("strong", { children: "Error:" }), " ", error] }), anonymousUser && (jsxs("div", { children: [jsx("strong", { children: "user_id:" }), " ", anonymousUser.userId, " ", jsx("br", {}), jsx("strong", { children: "clerk_user_id:" }), " ", anonymousUser.clerkUserId, " ", jsx("br", {}), jsx("strong", { children: "email:" }), " ", anonymousUser.email || 'None', " ", jsx("br", {}), " "] })), credits && (jsxs("div", { children: [jsx("strong", { children: "Credits:" }), " ", credits.balanceFree, " Free + ", credits.balancePaid, " Paid = ", credits.totalBalance, " Total"] }))] })] }))] }));
63
93
  }
64
94
 
65
- export { FingerprintDebugInfo, FingerprintProvider, useFingerprintContext, useFingerprintContextSafe, withFingerprint };
95
+ export { FingerprintProvider, FingerprintStatus, useFingerprintContext, useFingerprintContextSafe, withFingerprint };
@@ -2,16 +2,16 @@
2
2
  * Fingerprint Shared Utilities
3
3
  * 客户端和服务端共享的常量、类型和验证逻辑
4
4
  */
5
- export declare const FINGERPRINT_STORAGE_KEY = "x_fingerprint_id";
6
- export declare const FINGERPRINT_HEADER_NAME = "x-fingerprint-id";
7
- export declare const FINGERPRINT_COOKIE_NAME = "fingerprint_id";
5
+ export declare const FINGERPRINT_STORAGE_KEY = "__x_fingerprint_id";
6
+ export declare const FINGERPRINT_HEADER_NAME = "x-fingerprint-id-v8";
7
+ export declare const FINGERPRINT_COOKIE_NAME = "__x_fingerprint_id";
8
8
  /**
9
9
  * 验证fingerprint ID格式
10
10
  * 可以在客户端和服务端使用
11
11
  */
12
12
  export declare function isValidFingerprintId(fingerprintId: string): boolean;
13
13
  export declare const FINGERPRINT_CONSTANTS: {
14
- readonly STORAGE_KEY: "x_fingerprint_id";
15
- readonly HEADER_NAME: "x-fingerprint-id";
16
- readonly COOKIE_NAME: "fingerprint_id";
14
+ readonly STORAGE_KEY: "__x_fingerprint_id";
15
+ readonly HEADER_NAME: "x-fingerprint-id-v8";
16
+ readonly COOKIE_NAME: "__x_fingerprint_id";
17
17
  };
@@ -5,9 +5,9 @@
5
5
  * 客户端和服务端共享的常量、类型和验证逻辑
6
6
  */
7
7
  // Fingerprint ID的存储键和header名
8
- const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
9
- const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
10
- const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
8
+ const FINGERPRINT_STORAGE_KEY = '__x_fingerprint_id';
9
+ const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id-v8';
10
+ const FINGERPRINT_COOKIE_NAME = '__x_fingerprint_id';
11
11
  /**
12
12
  * 验证fingerprint ID格式
13
13
  * 可以在客户端和服务端使用
@@ -3,9 +3,9 @@
3
3
  * 客户端和服务端共享的常量、类型和验证逻辑
4
4
  */
5
5
  // Fingerprint ID的存储键和header名
6
- const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
7
- const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
8
- const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
6
+ const FINGERPRINT_STORAGE_KEY = '__x_fingerprint_id';
7
+ const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id-v8';
8
+ const FINGERPRINT_COOKIE_NAME = '__x_fingerprint_id';
9
9
  /**
10
10
  * 验证fingerprint ID格式
11
11
  * 可以在客户端和服务端使用
@@ -22,8 +22,8 @@ exports.getOrGenerateFingerprintId = fingerprintClient.getOrGenerateFingerprintI
22
22
  exports.setFingerprintId = fingerprintClient.setFingerprintId;
23
23
  exports.useFingerprintHeaders = fingerprintClient.useFingerprintHeaders;
24
24
  exports.useFingerprint = useFingerprint.useFingerprint;
25
- exports.FingerprintDebugInfo = fingerprintProvider.FingerprintDebugInfo;
26
25
  exports.FingerprintProvider = fingerprintProvider.FingerprintProvider;
26
+ exports.FingerprintStatus = fingerprintProvider.FingerprintStatus;
27
27
  exports.useFingerprintContext = fingerprintProvider.useFingerprintContext;
28
28
  exports.useFingerprintContextSafe = fingerprintProvider.useFingerprintContextSafe;
29
29
  exports.withFingerprint = fingerprintProvider.withFingerprint;
@@ -2,4 +2,4 @@
2
2
  export { FINGERPRINT_CONSTANTS, FINGERPRINT_COOKIE_NAME, FINGERPRINT_HEADER_NAME, FINGERPRINT_STORAGE_KEY, isValidFingerprintId } from './fingerprint-shared.mjs';
3
3
  export { clearFingerprintId, createFingerprintFetch, createFingerprintHeaders, generateFingerprintId, getFingerprintId, getOrGenerateFingerprintId, setFingerprintId, useFingerprintHeaders } from './fingerprint-client.mjs';
4
4
  export { useFingerprint } from './use-fingerprint.mjs';
5
- export { FingerprintDebugInfo, FingerprintProvider, useFingerprintContext, useFingerprintContextSafe, withFingerprint } from './fingerprint-provider.mjs';
5
+ export { FingerprintProvider, FingerprintStatus, useFingerprintContext, useFingerprintContextSafe, withFingerprint } from './fingerprint-provider.mjs';
@@ -4,4 +4,3 @@
4
4
  * 如果有FingerprintProvider,会处理fingerprint相关逻辑
5
5
  */
6
6
  export declare function SignInWithFingerprint(): import("react/jsx-runtime").JSX.Element;
7
- export default SignInWithFingerprint;
@@ -1,8 +1,6 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
4
  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');
7
5
  var jsxRuntime = require('react/jsx-runtime');
8
6
  var nextjs = require('@clerk/nextjs');
@@ -49,4 +47,3 @@ function SignInWithFingerprint() {
49
47
  }
50
48
 
51
49
  exports.SignInWithFingerprint = SignInWithFingerprint;
52
- exports.default = SignInWithFingerprint;
@@ -44,4 +44,4 @@ function SignInWithFingerprint() {
44
44
  return jsx(SignIn, { unsafeMetadata: unsafeMetadata });
45
45
  }
46
46
 
47
- export { SignInWithFingerprint, SignInWithFingerprint as default };
47
+ export { SignInWithFingerprint };
@@ -4,4 +4,3 @@
4
4
  * 如果有FingerprintProvider,会处理fingerprint相关逻辑
5
5
  */
6
6
  export declare function SignUpWithFingerprint(): import("react/jsx-runtime").JSX.Element;
7
- export default SignUpWithFingerprint;
@@ -1,8 +1,6 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
4
  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');
7
5
  var jsxRuntime = require('react/jsx-runtime');
8
6
  var nextjs = require('@clerk/nextjs');
@@ -49,4 +47,3 @@ function SignUpWithFingerprint() {
49
47
  }
50
48
 
51
49
  exports.SignUpWithFingerprint = SignUpWithFingerprint;
52
- exports.default = SignUpWithFingerprint;
@@ -44,4 +44,4 @@ function SignUpWithFingerprint() {
44
44
  return jsx(SignUp, { unsafeMetadata: unsafeMetadata });
45
45
  }
46
46
 
47
- export { SignUpWithFingerprint, SignUpWithFingerprint as default };
47
+ export { SignUpWithFingerprint };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var layoutBase$1 = require('../../../../../_virtual/layout-base.js');
3
+ var layoutBase$1 = require('../../../../../_virtual/layout-base2.js');
4
4
 
5
5
  var layoutBase = layoutBase$1.__module.exports;
6
6
 
@@ -1,4 +1,4 @@
1
- import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base.mjs';
1
+ import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base2.mjs';
2
2
 
3
3
  var layoutBase = layoutBase$1.exports;
4
4
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var layoutBase$1 = require('../../../../../_virtual/layout-base2.js');
3
+ var layoutBase$1 = require('../../../../../_virtual/layout-base.js');
4
4
 
5
5
  var layoutBase = layoutBase$1.__module.exports;
6
6
 
@@ -1,4 +1,4 @@
1
- import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base2.mjs';
1
+ import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base.mjs';
2
2
 
3
3
  var layoutBase = layoutBase$1.exports;
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "7.2.1",
3
+ "version": "7.3.0",
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/lib": "^7.1.1",
79
- "@windrun-huaiin/base-ui": "^8.1.1"
78
+ "@windrun-huaiin/lib": "^7.1.2",
79
+ "@windrun-huaiin/base-ui": "^8.1.2"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "react": "19.1.0",
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- import React, { createContext, useContext } from 'react';
3
+ import React, { createContext, useContext, useState } from 'react';
4
4
  import { useFingerprint } from './use-fingerprint';
5
5
  import type {
6
6
  FingerprintContextType,
@@ -66,7 +66,7 @@ export function withFingerprint<P extends object>(
66
66
  /**
67
67
  * 组件:显示用户状态和积分信息(用于调试)
68
68
  */
69
- export function FingerprintDebugInfo() {
69
+ export function FingerprintStatus() {
70
70
  const {
71
71
  fingerprintId,
72
72
  anonymousUser,
@@ -76,39 +76,90 @@ export function FingerprintDebugInfo() {
76
76
  error
77
77
  } = useFingerprintContext();
78
78
 
79
- if (!process.env.NODE_ENV || process.env.NODE_ENV === 'production') {
80
- return null;
81
- }
79
+ const [isOpen, setIsOpen] = useState(false);
80
+
81
+ const handleToggle = () => {
82
+ setIsOpen(!isOpen);
83
+ };
82
84
 
83
85
  return (
84
- <div style={{
85
- position: 'fixed',
86
- bottom: '10px',
87
- right: '10px',
88
- background: '#f0f0f0',
89
- padding: '10px',
90
- borderRadius: '5px',
91
- fontSize: '12px',
92
- fontFamily: 'monospace',
93
- maxWidth: '300px',
94
- zIndex: 9999,
95
- border: '1px solid #ccc'
96
- }}>
97
- <h4 style={{ margin: '0 0 5px 0' }}>Fingerprint Debug</h4>
98
- <div><strong>FP ID:</strong> {fingerprintId || 'None'}</div>
99
- <div><strong>Loading:</strong> {isLoading ? 'Yes' : 'No'}</div>
100
- <div><strong>Initialized:</strong> {isInitialized ? 'Yes' : 'No'}</div>
101
- {error && <div style={{ color: 'red' }}><strong>Error:</strong> {error}</div>}
102
- {anonymousUser && (
103
- <div>
104
- <strong>User ID:</strong> {anonymousUser.userId.slice(0, 8)}...
105
- </div>
106
- )}
107
- {credits && (
108
- <div>
109
- <strong>Credits:</strong> {credits.balanceFree}F + {credits.balancePaid}P = {credits.totalBalance}
110
- </div>
86
+ <>
87
+ <button
88
+ onClick={handleToggle}
89
+ style={{
90
+ position: 'fixed',
91
+ top: '10px',
92
+ left: '10px',
93
+ width: '50px',
94
+ height: '50px',
95
+ background: 'linear-gradient(135deg, #9b59b6, #e74c3c)',
96
+ borderRadius: '50%',
97
+ border: 'none',
98
+ cursor: 'pointer',
99
+ zIndex: 10000,
100
+ display: 'flex',
101
+ alignItems: 'center',
102
+ justifyContent: 'center',
103
+ boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
104
+ }}
105
+ >
106
+ <span style={{
107
+ fontSize: '24px',
108
+ color: 'white',
109
+ transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
110
+ transition: 'transform 0.3s ease',
111
+ }}>▼</span>
112
+ </button>
113
+
114
+ {isOpen && (
115
+ <>
116
+ <div
117
+ style={{
118
+ position: 'fixed',
119
+ top: 0,
120
+ left: 0,
121
+ width: '100%',
122
+ height: '100%',
123
+ background: 'rgba(0, 0, 0, 0.5)',
124
+ zIndex: 9998,
125
+ }}
126
+ />
127
+ <div
128
+ style={{
129
+ position: 'fixed',
130
+ top: '70px',
131
+ left: '10px',
132
+ background: '#f0f0f0',
133
+ padding: '15px',
134
+ borderRadius: '5px',
135
+ fontSize: '12px',
136
+ fontFamily: 'monospace',
137
+ maxWidth: '300px',
138
+ zIndex: 9999,
139
+ border: '1px solid #ccc',
140
+ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.2)',
141
+ }}
142
+ >
143
+ <h4 style={{ margin: '0 0 5px 0' }}>Fingerprint Debug</h4>
144
+ <div><strong>FP_ID:</strong> {fingerprintId || 'None'}</div>
145
+ <div><strong>Loading:</strong> {isLoading ? 'Yes' : 'No'}</div>
146
+ <div><strong>Initialized:</strong> {isInitialized ? 'Yes' : 'No'}</div>
147
+ {error && <div style={{ color: 'red' }}><strong>Error:</strong> {error}</div>}
148
+ {anonymousUser && (
149
+ <div>
150
+ <strong>user_id:</strong> {anonymousUser.userId} <br/>
151
+ <strong>clerk_user_id:</strong> {anonymousUser.clerkUserId} <br/>
152
+ <strong>email:</strong> {anonymousUser.email || 'None'} <br/> {/* Fixed email field */}
153
+ </div>
154
+ )}
155
+ {credits && (
156
+ <div>
157
+ <strong>Credits:</strong> {credits.balanceFree} Free + {credits.balancePaid} Paid = {credits.totalBalance} Total
158
+ </div>
159
+ )}
160
+ </div>
161
+ </>
111
162
  )}
112
- </div>
163
+ </>
113
164
  );
114
165
  }
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  // Fingerprint ID的存储键和header名
7
- export const FINGERPRINT_STORAGE_KEY = 'x_fingerprint_id';
8
- export const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id';
9
- export const FINGERPRINT_COOKIE_NAME = 'fingerprint_id';
7
+ export const FINGERPRINT_STORAGE_KEY = '__x_fingerprint_id';
8
+ export const FINGERPRINT_HEADER_NAME = 'x-fingerprint-id-v8';
9
+ export const FINGERPRINT_COOKIE_NAME = '__x_fingerprint_id';
10
10
 
11
11
  /**
12
12
  * 验证fingerprint ID格式
@@ -54,4 +54,3 @@ export function SignInWithFingerprint() {
54
54
  return <SignIn unsafeMetadata={unsafeMetadata} />;
55
55
  }
56
56
 
57
- export default SignInWithFingerprint;
@@ -54,4 +54,3 @@ export function SignUpWithFingerprint() {
54
54
  return <SignUp unsafeMetadata={unsafeMetadata} />;
55
55
  }
56
56
 
57
- export default SignUpWithFingerprint;