@windrun-huaiin/third-ui 7.2.1 → 7.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "7.2.1",
3
+ "version": "7.2.2",
4
4
  "description": "Third-party integrated UI components for windrun-huaiin projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -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格式