@windrun-huaiin/third-ui 7.3.1 → 7.3.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.
Files changed (23) hide show
  1. package/dist/clerk/fingerprint/fingerprint-provider.js +2 -2
  2. package/dist/clerk/fingerprint/fingerprint-provider.mjs +2 -2
  3. package/dist/clerk/fingerprint/types.d.ts +6 -6
  4. package/dist/clerk/fingerprint/use-fingerprint.js +15 -15
  5. package/dist/clerk/fingerprint/use-fingerprint.mjs +15 -15
  6. package/dist/clerk/signin-with-fingerprint-client.js +6 -6
  7. package/dist/clerk/signin-with-fingerprint-client.mjs +6 -6
  8. package/dist/clerk/signup-with-fingerprint-client.js +6 -6
  9. package/dist/clerk/signup-with-fingerprint-client.mjs +6 -6
  10. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
  11. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.mjs +1 -1
  12. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
  13. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.mjs +1 -1
  14. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
  15. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.mjs +1 -1
  16. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
  17. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.mjs +1 -1
  18. package/package.json +1 -1
  19. package/src/clerk/fingerprint/fingerprint-provider.tsx +18 -18
  20. package/src/clerk/fingerprint/types.ts +6 -6
  21. package/src/clerk/fingerprint/use-fingerprint.ts +18 -18
  22. package/src/clerk/signin-with-fingerprint-client.tsx +6 -6
  23. package/src/clerk/signup-with-fingerprint-client.tsx +6 -6
@@ -45,7 +45,7 @@ function withFingerprint(Component, config) {
45
45
  * 组件:显示用户状态和积分信息(用于调试)
46
46
  */
47
47
  function FingerprintStatus() {
48
- const { fingerprintId, anonymousUser, credits, subscription, isLoading, isInitialized, error } = useFingerprintContext();
48
+ const { fingerprintId, xUser, xCredit, xSubscription, isLoading, isInitialized, error } = useFingerprintContext();
49
49
  const [isOpen, setIsOpen] = React.useState(false);
50
50
  const handleToggle = () => {
51
51
  setIsOpen(!isOpen);
@@ -91,7 +91,7 @@ function FingerprintStatus() {
91
91
  zIndex: 9999,
92
92
  border: '1px solid #ccc',
93
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 || 'None', " ", 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"] })), subscription && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "user_id:" }), " ", subscription.userId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "pay_subscription_id:" }), " ", subscription.paySubscriptionId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "price_id:" }), " ", subscription.priceId || 'None', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "price_name:" }), " ", subscription.priceName || 'None', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "status:" }), " ", subscription.status || 'Free', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "credits_allocated:" }), " ", subscription.creditsAllocated || '', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "sub_period_start:" }), " ", subscription.subPeriodStart || '', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "sub_period_end:" }), " ", subscription.subPeriodEnd || '', " ", jsxRuntime.jsx("br", {})] }))] })] }))] }));
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] }), xUser && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "user_id:" }), " ", xUser.userId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "clerk_user_id:" }), " ", xUser.clerkUserId || 'None', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "email:" }), " ", xUser.email || 'None', " ", jsxRuntime.jsx("br", {})] })), xCredit && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "Credits:" }), " ", xCredit.balanceFree, " Free + ", xCredit.balancePaid, " Paid = ", xCredit.totalBalance, " Total"] })), xSubscription && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("strong", { children: "user_id:" }), " ", xSubscription.userId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "pay_subscription_id:" }), " ", xSubscription.paySubscriptionId, " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "price_id:" }), " ", xSubscription.priceId || 'None', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "price_name:" }), " ", xSubscription.priceName || 'None', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "status:" }), " ", xSubscription.status || 'Free', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "credits_allocated:" }), " ", xSubscription.creditsAllocated || '', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "sub_period_start:" }), " ", xSubscription.subPeriodStart || '', " ", jsxRuntime.jsx("br", {}), jsxRuntime.jsx("strong", { children: "sub_period_end:" }), " ", xSubscription.subPeriodEnd || '', " ", jsxRuntime.jsx("br", {})] }))] })] }))] }));
95
95
  }
96
96
 
97
97
  exports.FingerprintProvider = FingerprintProvider;
@@ -43,7 +43,7 @@ function withFingerprint(Component, config) {
43
43
  * 组件:显示用户状态和积分信息(用于调试)
44
44
  */
45
45
  function FingerprintStatus() {
46
- const { fingerprintId, anonymousUser, credits, subscription, isLoading, isInitialized, error } = useFingerprintContext();
46
+ const { fingerprintId, xUser, xCredit, xSubscription, isLoading, isInitialized, error } = useFingerprintContext();
47
47
  const [isOpen, setIsOpen] = useState(false);
48
48
  const handleToggle = () => {
49
49
  setIsOpen(!isOpen);
@@ -89,7 +89,7 @@ function FingerprintStatus() {
89
89
  zIndex: 9999,
90
90
  border: '1px solid #ccc',
91
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 || 'None', " ", 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"] })), subscription && (jsxs("div", { children: [jsx("strong", { children: "user_id:" }), " ", subscription.userId, " ", jsx("br", {}), jsx("strong", { children: "pay_subscription_id:" }), " ", subscription.paySubscriptionId, " ", jsx("br", {}), jsx("strong", { children: "price_id:" }), " ", subscription.priceId || 'None', " ", jsx("br", {}), jsx("strong", { children: "price_name:" }), " ", subscription.priceName || 'None', " ", jsx("br", {}), jsx("strong", { children: "status:" }), " ", subscription.status || 'Free', " ", jsx("br", {}), jsx("strong", { children: "credits_allocated:" }), " ", subscription.creditsAllocated || '', " ", jsx("br", {}), jsx("strong", { children: "sub_period_start:" }), " ", subscription.subPeriodStart || '', " ", jsx("br", {}), jsx("strong", { children: "sub_period_end:" }), " ", subscription.subPeriodEnd || '', " ", jsx("br", {})] }))] })] }))] }));
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] }), xUser && (jsxs("div", { children: [jsx("strong", { children: "user_id:" }), " ", xUser.userId, " ", jsx("br", {}), jsx("strong", { children: "clerk_user_id:" }), " ", xUser.clerkUserId || 'None', " ", jsx("br", {}), jsx("strong", { children: "email:" }), " ", xUser.email || 'None', " ", jsx("br", {})] })), xCredit && (jsxs("div", { children: [jsx("strong", { children: "Credits:" }), " ", xCredit.balanceFree, " Free + ", xCredit.balancePaid, " Paid = ", xCredit.totalBalance, " Total"] })), xSubscription && (jsxs("div", { children: [jsx("strong", { children: "user_id:" }), " ", xSubscription.userId, " ", jsx("br", {}), jsx("strong", { children: "pay_subscription_id:" }), " ", xSubscription.paySubscriptionId, " ", jsx("br", {}), jsx("strong", { children: "price_id:" }), " ", xSubscription.priceId || 'None', " ", jsx("br", {}), jsx("strong", { children: "price_name:" }), " ", xSubscription.priceName || 'None', " ", jsx("br", {}), jsx("strong", { children: "status:" }), " ", xSubscription.status || 'Free', " ", jsx("br", {}), jsx("strong", { children: "credits_allocated:" }), " ", xSubscription.creditsAllocated || '', " ", jsx("br", {}), jsx("strong", { children: "sub_period_start:" }), " ", xSubscription.subPeriodStart || '', " ", jsx("br", {}), jsx("strong", { children: "sub_period_end:" }), " ", xSubscription.subPeriodEnd || '', " ", jsx("br", {})] }))] })] }))] }));
93
93
  }
94
94
 
95
95
  export { FingerprintProvider, FingerprintStatus, useFingerprintContext, useFingerprintContextSafe, withFingerprint };
@@ -2,7 +2,7 @@
2
2
  * Fingerprint System Types
3
3
  * 指纹识别系统的类型定义
4
4
  */
5
- export interface AnonymousUser {
5
+ export interface XUser {
6
6
  userId: string;
7
7
  fingerprintId: string;
8
8
  clerkUserId: string;
@@ -10,12 +10,12 @@ export interface AnonymousUser {
10
10
  status: string;
11
11
  createdAt: string;
12
12
  }
13
- export interface Credits {
13
+ export interface XCredit {
14
14
  balanceFree: number;
15
15
  balancePaid: number;
16
16
  totalBalance: number;
17
17
  }
18
- export interface Subscription {
18
+ export interface XSubscription {
19
19
  id: bigint;
20
20
  userId: string;
21
21
  paySubscriptionId: string | null;
@@ -36,9 +36,9 @@ export interface FingerprintConfig {
36
36
  }
37
37
  export interface UseFingerprintResult {
38
38
  fingerprintId: string | null;
39
- anonymousUser: AnonymousUser | null;
40
- credits: Credits | null;
41
- subscription: Subscription | null;
39
+ xUser: XUser | null;
40
+ xCredit: XCredit | null;
41
+ xSubscription: XSubscription | null;
42
42
  isLoading: boolean;
43
43
  isInitialized: boolean;
44
44
  error: string | null;
@@ -11,9 +11,9 @@ var fingerprintClient = require('./fingerprint-client.js');
11
11
  */
12
12
  function useFingerprint(config) {
13
13
  const [fingerprintId, setFingerprintIdState] = React.useState(null);
14
- const [anonymousUser, setAnonymousUser] = React.useState(null);
15
- const [credits, setCredits] = React.useState(null);
16
- const [subscription, setSubscription] = React.useState(null);
14
+ const [xUser, setXUser] = React.useState(null);
15
+ const [xCredit, setXCredit] = React.useState(null);
16
+ const [xSubscription, setXSubscription] = React.useState(null);
17
17
  const [isLoading, setIsLoading] = React.useState(true);
18
18
  const [isInitialized, setIsInitialized] = React.useState(false);
19
19
  const [error, setError] = React.useState(null);
@@ -60,9 +60,9 @@ function useFingerprint(config) {
60
60
  }
61
61
  const data = yield response.json();
62
62
  if (data.success) {
63
- setAnonymousUser(data.user);
64
- setCredits(data.credits);
65
- setSubscription(data.subscription);
63
+ setXUser(data.xUser);
64
+ setXCredit(data.xCredit);
65
+ setXSubscription(data.xSubscription);
66
66
  setIsInitialized(true);
67
67
  // 确保fingerprint ID同步
68
68
  if (data.user.fingerprintId !== fingerprintId) {
@@ -105,9 +105,9 @@ function useFingerprint(config) {
105
105
  }
106
106
  const data = yield response.json();
107
107
  if (data.success) {
108
- setAnonymousUser(data.user);
109
- setCredits(data.credits);
110
- setSubscription(data.subscription);
108
+ setXUser(data.xUser);
109
+ setXCredit(data.xCredit);
110
+ setXSubscription(data.xSubscription);
111
111
  }
112
112
  }
113
113
  catch (err) {
@@ -130,9 +130,9 @@ function useFingerprint(config) {
130
130
  if (response.ok) {
131
131
  const data = yield response.json();
132
132
  if (data.success) {
133
- setAnonymousUser(data.user);
134
- setCredits(data.credits);
135
- setSubscription(data.subscription);
133
+ setXUser(data.xUser);
134
+ setXCredit(data.xCredit);
135
+ setXSubscription(data.xSubscription);
136
136
  setIsInitialized(true);
137
137
  }
138
138
  }
@@ -167,9 +167,9 @@ function useFingerprint(config) {
167
167
  }, [fingerprintId, isInitialized, isLoading, error, initializeAnonymousUser, config.autoInitialize]);
168
168
  return {
169
169
  fingerprintId,
170
- anonymousUser,
171
- credits,
172
- subscription,
170
+ xUser,
171
+ xCredit,
172
+ xSubscription,
173
173
  isLoading,
174
174
  isInitialized,
175
175
  error,
@@ -9,9 +9,9 @@ import { createFingerprintHeaders, setFingerprintId, getOrGenerateFingerprintId
9
9
  */
10
10
  function useFingerprint(config) {
11
11
  const [fingerprintId, setFingerprintIdState] = useState(null);
12
- const [anonymousUser, setAnonymousUser] = useState(null);
13
- const [credits, setCredits] = useState(null);
14
- const [subscription, setSubscription] = useState(null);
12
+ const [xUser, setXUser] = useState(null);
13
+ const [xCredit, setXCredit] = useState(null);
14
+ const [xSubscription, setXSubscription] = useState(null);
15
15
  const [isLoading, setIsLoading] = useState(true);
16
16
  const [isInitialized, setIsInitialized] = useState(false);
17
17
  const [error, setError] = useState(null);
@@ -58,9 +58,9 @@ function useFingerprint(config) {
58
58
  }
59
59
  const data = yield response.json();
60
60
  if (data.success) {
61
- setAnonymousUser(data.user);
62
- setCredits(data.credits);
63
- setSubscription(data.subscription);
61
+ setXUser(data.xUser);
62
+ setXCredit(data.xCredit);
63
+ setXSubscription(data.xSubscription);
64
64
  setIsInitialized(true);
65
65
  // 确保fingerprint ID同步
66
66
  if (data.user.fingerprintId !== fingerprintId) {
@@ -103,9 +103,9 @@ function useFingerprint(config) {
103
103
  }
104
104
  const data = yield response.json();
105
105
  if (data.success) {
106
- setAnonymousUser(data.user);
107
- setCredits(data.credits);
108
- setSubscription(data.subscription);
106
+ setXUser(data.xUser);
107
+ setXCredit(data.xCredit);
108
+ setXSubscription(data.xSubscription);
109
109
  }
110
110
  }
111
111
  catch (err) {
@@ -128,9 +128,9 @@ function useFingerprint(config) {
128
128
  if (response.ok) {
129
129
  const data = yield response.json();
130
130
  if (data.success) {
131
- setAnonymousUser(data.user);
132
- setCredits(data.credits);
133
- setSubscription(data.subscription);
131
+ setXUser(data.xUser);
132
+ setXCredit(data.xCredit);
133
+ setXSubscription(data.xSubscription);
134
134
  setIsInitialized(true);
135
135
  }
136
136
  }
@@ -165,9 +165,9 @@ function useFingerprint(config) {
165
165
  }, [fingerprintId, isInitialized, isLoading, error, initializeAnonymousUser, config.autoInitialize]);
166
166
  return {
167
167
  fingerprintId,
168
- anonymousUser,
169
- credits,
170
- subscription,
168
+ xUser,
169
+ xCredit,
170
+ xSubscription,
171
171
  isLoading,
172
172
  isInitialized,
173
173
  error,
@@ -15,10 +15,10 @@ var fingerprintProvider = require('./fingerprint/fingerprint-provider.js');
15
15
  function SignInWithFingerprint() {
16
16
  const fingerprintContext = fingerprintProvider.useFingerprintContextSafe();
17
17
  // 如果没有fingerprint context,使用默认值
18
- const { fingerprintId = null, anonymousUser = null, isInitialized = false, initializeAnonymousUser = () => tslib_es6.__awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
18
+ const { fingerprintId = null, xUser = null, isInitialized = false, initializeAnonymousUser = () => tslib_es6.__awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
19
19
  // 准备传递给Clerk的metadata,包含匿名用户信息
20
20
  const unsafeMetadata = {
21
- user_id: (anonymousUser === null || anonymousUser === void 0 ? void 0 : anonymousUser.userId) || null, // 数据库中的user_id
21
+ user_id: (xUser === null || xUser === void 0 ? void 0 : xUser.userId) || null, // 数据库中的user_id
22
22
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
23
23
  };
24
24
  // 确保匿名用户已初始化
@@ -32,17 +32,17 @@ function SignInWithFingerprint() {
32
32
  console.log('SignInWithFingerprint Debug:', {
33
33
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
34
34
  fingerprintId: fingerprintId || 'Not generated',
35
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
35
+ xUser: xUser ? 'Initialized' : 'Not initialized',
36
36
  clerkMetadata: unsafeMetadata
37
37
  });
38
- if (anonymousUser && fingerprintId) {
38
+ if (xUser && fingerprintId) {
39
39
  console.log('User signed in with existing anonymous data:', {
40
- anonymousUserId: anonymousUser.userId,
40
+ userId: xUser.userId,
41
41
  fingerprintId,
42
42
  });
43
43
  // TODO: 实现数据合并逻辑
44
44
  }
45
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
45
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
46
46
  return jsxRuntime.jsx(nextjs.SignIn, { unsafeMetadata: unsafeMetadata });
47
47
  }
48
48
 
@@ -13,10 +13,10 @@ import { useFingerprintContextSafe } from './fingerprint/fingerprint-provider.mj
13
13
  function SignInWithFingerprint() {
14
14
  const fingerprintContext = useFingerprintContextSafe();
15
15
  // 如果没有fingerprint context,使用默认值
16
- const { fingerprintId = null, anonymousUser = null, isInitialized = false, initializeAnonymousUser = () => __awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
16
+ const { fingerprintId = null, xUser = null, isInitialized = false, initializeAnonymousUser = () => __awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
17
17
  // 准备传递给Clerk的metadata,包含匿名用户信息
18
18
  const unsafeMetadata = {
19
- user_id: (anonymousUser === null || anonymousUser === void 0 ? void 0 : anonymousUser.userId) || null, // 数据库中的user_id
19
+ user_id: (xUser === null || xUser === void 0 ? void 0 : xUser.userId) || null, // 数据库中的user_id
20
20
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
21
21
  };
22
22
  // 确保匿名用户已初始化
@@ -30,17 +30,17 @@ function SignInWithFingerprint() {
30
30
  console.log('SignInWithFingerprint Debug:', {
31
31
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
32
32
  fingerprintId: fingerprintId || 'Not generated',
33
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
33
+ xUser: xUser ? 'Initialized' : 'Not initialized',
34
34
  clerkMetadata: unsafeMetadata
35
35
  });
36
- if (anonymousUser && fingerprintId) {
36
+ if (xUser && fingerprintId) {
37
37
  console.log('User signed in with existing anonymous data:', {
38
- anonymousUserId: anonymousUser.userId,
38
+ userId: xUser.userId,
39
39
  fingerprintId,
40
40
  });
41
41
  // TODO: 实现数据合并逻辑
42
42
  }
43
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
43
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
44
44
  return jsx(SignIn, { unsafeMetadata: unsafeMetadata });
45
45
  }
46
46
 
@@ -15,10 +15,10 @@ var fingerprintProvider = require('./fingerprint/fingerprint-provider.js');
15
15
  function SignUpWithFingerprint() {
16
16
  const fingerprintContext = fingerprintProvider.useFingerprintContextSafe();
17
17
  // 如果没有fingerprint context,使用默认值
18
- const { fingerprintId = null, anonymousUser = null, isInitialized = false, initializeAnonymousUser = () => tslib_es6.__awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
18
+ const { fingerprintId = null, xUser = null, isInitialized = false, initializeAnonymousUser = () => tslib_es6.__awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
19
19
  // 准备传递给Clerk的metadata,包含匿名用户信息
20
20
  const unsafeMetadata = {
21
- user_id: (anonymousUser === null || anonymousUser === void 0 ? void 0 : anonymousUser.userId) || null, // 数据库中的user_id
21
+ user_id: (xUser === null || xUser === void 0 ? void 0 : xUser.userId) || null, // 数据库中的user_id
22
22
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
23
23
  };
24
24
  // 确保匿名用户已初始化
@@ -32,17 +32,17 @@ function SignUpWithFingerprint() {
32
32
  console.log('SignUpWithFingerprint Debug:', {
33
33
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
34
34
  fingerprintId: fingerprintId || 'Not generated',
35
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
35
+ xUser: xUser ? 'Initialized' : 'Not initialized',
36
36
  clerkMetadata: unsafeMetadata
37
37
  });
38
- if (anonymousUser && fingerprintId) {
38
+ if (xUser && fingerprintId) {
39
39
  console.log('User signed up with existing anonymous data:', {
40
- anonymousUserId: anonymousUser.userId,
40
+ userId: xUser.userId,
41
41
  fingerprintId,
42
42
  });
43
43
  // TODO: 实现数据迁移逻辑
44
44
  }
45
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
45
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
46
46
  return jsxRuntime.jsx(nextjs.SignUp, { unsafeMetadata: unsafeMetadata });
47
47
  }
48
48
 
@@ -13,10 +13,10 @@ import { useFingerprintContextSafe } from './fingerprint/fingerprint-provider.mj
13
13
  function SignUpWithFingerprint() {
14
14
  const fingerprintContext = useFingerprintContextSafe();
15
15
  // 如果没有fingerprint context,使用默认值
16
- const { fingerprintId = null, anonymousUser = null, isInitialized = false, initializeAnonymousUser = () => __awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
16
+ const { fingerprintId = null, xUser = null, isInitialized = false, initializeAnonymousUser = () => __awaiter(this, void 0, void 0, function* () { }) } = fingerprintContext || {};
17
17
  // 准备传递给Clerk的metadata,包含匿名用户信息
18
18
  const unsafeMetadata = {
19
- user_id: (anonymousUser === null || anonymousUser === void 0 ? void 0 : anonymousUser.userId) || null, // 数据库中的user_id
19
+ user_id: (xUser === null || xUser === void 0 ? void 0 : xUser.userId) || null, // 数据库中的user_id
20
20
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
21
21
  };
22
22
  // 确保匿名用户已初始化
@@ -30,17 +30,17 @@ function SignUpWithFingerprint() {
30
30
  console.log('SignUpWithFingerprint Debug:', {
31
31
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
32
32
  fingerprintId: fingerprintId || 'Not generated',
33
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
33
+ xUser: xUser ? 'Initialized' : 'Not initialized',
34
34
  clerkMetadata: unsafeMetadata
35
35
  });
36
- if (anonymousUser && fingerprintId) {
36
+ if (xUser && fingerprintId) {
37
37
  console.log('User signed up with existing anonymous data:', {
38
- anonymousUserId: anonymousUser.userId,
38
+ userId: xUser.userId,
39
39
  fingerprintId,
40
40
  });
41
41
  // TODO: 实现数据迁移逻辑
42
42
  }
43
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
43
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
44
44
  return jsx(SignUp, { unsafeMetadata: unsafeMetadata });
45
45
  }
46
46
 
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var coseBase$1 = require('../../../../../_virtual/cose-base.js');
3
+ var coseBase$1 = require('../../../../../_virtual/cose-base2.js');
4
4
  var layoutBase = require('../../../layout-base@1.0.2/node_modules/layout-base/layout-base.js');
5
5
 
6
6
  var coseBase = coseBase$1.__module.exports;
@@ -1,4 +1,4 @@
1
- import { __module as coseBase$1 } from '../../../../../_virtual/cose-base2.mjs';
1
+ import { __module as coseBase$1 } from '../../../../../_virtual/cose-base.mjs';
2
2
  import { __require as requireLayoutBase } from '../../../layout-base@1.0.2/node_modules/layout-base/layout-base.mjs';
3
3
 
4
4
  var coseBase = coseBase$1.exports;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var coseBase$1 = require('../../../../../_virtual/cose-base2.js');
3
+ var coseBase$1 = require('../../../../../_virtual/cose-base.js');
4
4
  var layoutBase = require('../../../layout-base@2.0.1/node_modules/layout-base/layout-base.js');
5
5
 
6
6
  var coseBase = coseBase$1.__module.exports;
@@ -1,4 +1,4 @@
1
- import { __module as coseBase$1 } from '../../../../../_virtual/cose-base.mjs';
1
+ import { __module as coseBase$1 } from '../../../../../_virtual/cose-base2.mjs';
2
2
  import { __require as requireLayoutBase } from '../../../layout-base@2.0.1/node_modules/layout-base/layout-base.mjs';
3
3
 
4
4
  var coseBase = coseBase$1.exports;
@@ -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-base2.mjs';
1
+ import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base.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-base.mjs';
1
+ import { __module as layoutBase$1 } from '../../../../../_virtual/layout-base2.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.3.1",
3
+ "version": "7.3.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",
@@ -69,9 +69,9 @@ export function withFingerprint<P extends object>(
69
69
  export function FingerprintStatus() {
70
70
  const {
71
71
  fingerprintId,
72
- anonymousUser,
73
- credits,
74
- subscription,
72
+ xUser,
73
+ xCredit,
74
+ xSubscription,
75
75
  isLoading,
76
76
  isInitialized,
77
77
  error
@@ -146,28 +146,28 @@ export function FingerprintStatus() {
146
146
  <div><strong>Loading:</strong> {isLoading ? 'Yes' : 'No'}</div>
147
147
  <div><strong>Initialized:</strong> {isInitialized ? 'Yes' : 'No'}</div>
148
148
  {error && <div style={{ color: 'red' }}><strong>Error:</strong> {error}</div>}
149
- {anonymousUser && (
149
+ {xUser && (
150
150
  <div>
151
- <strong>user_id:</strong> {anonymousUser.userId} <br/>
152
- <strong>clerk_user_id:</strong> {anonymousUser.clerkUserId || 'None'} <br/>
153
- <strong>email:</strong> {anonymousUser.email || 'None'} <br/>
151
+ <strong>user_id:</strong> {xUser.userId} <br/>
152
+ <strong>clerk_user_id:</strong> {xUser.clerkUserId || 'None'} <br/>
153
+ <strong>email:</strong> {xUser.email || 'None'} <br/>
154
154
  </div>
155
155
  )}
156
- {credits && (
156
+ {xCredit && (
157
157
  <div>
158
- <strong>Credits:</strong> {credits.balanceFree} Free + {credits.balancePaid} Paid = {credits.totalBalance} Total
158
+ <strong>Credits:</strong> {xCredit.balanceFree} Free + {xCredit.balancePaid} Paid = {xCredit.totalBalance} Total
159
159
  </div>
160
160
  )}
161
- {subscription && (
161
+ {xSubscription && (
162
162
  <div>
163
- <strong>user_id:</strong> {subscription.userId} <br/>
164
- <strong>pay_subscription_id:</strong> {subscription.paySubscriptionId} <br/>
165
- <strong>price_id:</strong> {subscription.priceId || 'None'} <br/>
166
- <strong>price_name:</strong> {subscription.priceName || 'None'} <br/>
167
- <strong>status:</strong> {subscription.status || 'Free'} <br/>
168
- <strong>credits_allocated:</strong> {subscription.creditsAllocated || ''} <br/>
169
- <strong>sub_period_start:</strong> {subscription.subPeriodStart || ''} <br/>
170
- <strong>sub_period_end:</strong> {subscription.subPeriodEnd || ''} <br/>
163
+ <strong>user_id:</strong> {xSubscription.userId} <br/>
164
+ <strong>pay_subscription_id:</strong> {xSubscription.paySubscriptionId} <br/>
165
+ <strong>price_id:</strong> {xSubscription.priceId || 'None'} <br/>
166
+ <strong>price_name:</strong> {xSubscription.priceName || 'None'} <br/>
167
+ <strong>status:</strong> {xSubscription.status || 'Free'} <br/>
168
+ <strong>credits_allocated:</strong> {xSubscription.creditsAllocated || ''} <br/>
169
+ <strong>sub_period_start:</strong> {xSubscription.subPeriodStart || ''} <br/>
170
+ <strong>sub_period_end:</strong> {xSubscription.subPeriodEnd || ''} <br/>
171
171
  </div>
172
172
  )}
173
173
  </div>
@@ -3,7 +3,7 @@
3
3
  * 指纹识别系统的类型定义
4
4
  */
5
5
 
6
- export interface AnonymousUser {
6
+ export interface XUser {
7
7
  userId: string;
8
8
  fingerprintId: string;
9
9
  clerkUserId: string,
@@ -12,13 +12,13 @@ export interface AnonymousUser {
12
12
  createdAt: string;
13
13
  }
14
14
 
15
- export interface Credits {
15
+ export interface XCredit {
16
16
  balanceFree: number;
17
17
  balancePaid: number;
18
18
  totalBalance: number;
19
19
  }
20
20
 
21
- export interface Subscription {
21
+ export interface XSubscription {
22
22
  id: bigint
23
23
  userId: string
24
24
  paySubscriptionId: string | null
@@ -41,9 +41,9 @@ export interface FingerprintConfig {
41
41
 
42
42
  export interface UseFingerprintResult {
43
43
  fingerprintId: string | null;
44
- anonymousUser: AnonymousUser | null;
45
- credits: Credits | null;
46
- subscription: Subscription | null;
44
+ xUser: XUser | null;
45
+ xCredit: XCredit | null;
46
+ xSubscription: XSubscription | null;
47
47
  isLoading: boolean;
48
48
  isInitialized: boolean;
49
49
  error: string | null;
@@ -7,9 +7,9 @@ import {
7
7
  createFingerprintHeaders
8
8
  } from './fingerprint-client';
9
9
  import type {
10
- AnonymousUser,
11
- Credits,
12
- Subscription,
10
+ XUser,
11
+ XCredit,
12
+ XSubscription,
13
13
  UseFingerprintResult,
14
14
  FingerprintConfig
15
15
  } from './types';
@@ -20,9 +20,9 @@ import type {
20
20
  */
21
21
  export function useFingerprint(config: FingerprintConfig): UseFingerprintResult {
22
22
  const [fingerprintId, setFingerprintIdState] = useState<string | null>(null);
23
- const [anonymousUser, setAnonymousUser] = useState<AnonymousUser | null>(null);
24
- const [credits, setCredits] = useState<Credits | null>(null);
25
- const [subscription, setSubscription] = useState<Subscription | null>(null);
23
+ const [xUser, setXUser] = useState<XUser | null>(null);
24
+ const [xCredit, setXCredit] = useState<XCredit | null>(null);
25
+ const [xSubscription, setXSubscription] = useState<XSubscription | null>(null);
26
26
  const [isLoading, setIsLoading] = useState(true);
27
27
  const [isInitialized, setIsInitialized] = useState(false);
28
28
  const [error, setError] = useState<string | null>(null);
@@ -78,9 +78,9 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
78
78
  const data = await response.json();
79
79
 
80
80
  if (data.success) {
81
- setAnonymousUser(data.user);
82
- setCredits(data.credits);
83
- setSubscription(data.subscription);
81
+ setXUser(data.xUser);
82
+ setXCredit(data.xCredit);
83
+ setXSubscription(data.xSubscription);
84
84
  setIsInitialized(true);
85
85
 
86
86
  // 确保fingerprint ID同步
@@ -126,9 +126,9 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
126
126
  const data = await response.json();
127
127
 
128
128
  if (data.success) {
129
- setAnonymousUser(data.user);
130
- setCredits(data.credits);
131
- setSubscription(data.subscription);
129
+ setXUser(data.xUser);
130
+ setXCredit(data.xCredit);
131
+ setXSubscription(data.xSubscription);
132
132
  }
133
133
  } catch (err) {
134
134
  console.error('Failed to refresh user data:', err);
@@ -152,9 +152,9 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
152
152
  if (response.ok) {
153
153
  const data = await response.json();
154
154
  if (data.success) {
155
- setAnonymousUser(data.user);
156
- setCredits(data.credits);
157
- setSubscription(data.subscription);
155
+ setXUser(data.xUser);
156
+ setXCredit(data.xCredit);
157
+ setXSubscription(data.xSubscription);
158
158
  setIsInitialized(true);
159
159
  }
160
160
  }
@@ -192,9 +192,9 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
192
192
 
193
193
  return {
194
194
  fingerprintId,
195
- anonymousUser,
196
- credits,
197
- subscription,
195
+ xUser,
196
+ xCredit,
197
+ xSubscription,
198
198
  isLoading,
199
199
  isInitialized,
200
200
  error,
@@ -15,14 +15,14 @@ export function SignInWithFingerprint() {
15
15
  // 如果没有fingerprint context,使用默认值
16
16
  const {
17
17
  fingerprintId = null,
18
- anonymousUser = null,
18
+ xUser = null,
19
19
  isInitialized = false,
20
20
  initializeAnonymousUser = async () => {}
21
21
  } = fingerprintContext || {};
22
22
 
23
23
  // 准备传递给Clerk的metadata,包含匿名用户信息
24
24
  const unsafeMetadata = {
25
- user_id: anonymousUser?.userId || null, // 数据库中的user_id
25
+ user_id: xUser?.userId || null, // 数据库中的user_id
26
26
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
27
27
  };
28
28
 
@@ -38,18 +38,18 @@ export function SignInWithFingerprint() {
38
38
  console.log('SignInWithFingerprint Debug:', {
39
39
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
40
40
  fingerprintId: fingerprintId || 'Not generated',
41
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
41
+ xUser: xUser ? 'Initialized' : 'Not initialized',
42
42
  clerkMetadata: unsafeMetadata
43
43
  });
44
44
 
45
- if (anonymousUser && fingerprintId) {
45
+ if (xUser && fingerprintId) {
46
46
  console.log('User signed in with existing anonymous data:', {
47
- anonymousUserId: anonymousUser.userId,
47
+ userId: xUser.userId,
48
48
  fingerprintId,
49
49
  });
50
50
  // TODO: 实现数据合并逻辑
51
51
  }
52
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
52
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
53
53
 
54
54
  return <SignIn unsafeMetadata={unsafeMetadata} />;
55
55
  }
@@ -15,14 +15,14 @@ export function SignUpWithFingerprint() {
15
15
  // 如果没有fingerprint context,使用默认值
16
16
  const {
17
17
  fingerprintId = null,
18
- anonymousUser = null,
18
+ xUser = null,
19
19
  isInitialized = false,
20
20
  initializeAnonymousUser = async () => {}
21
21
  } = fingerprintContext || {};
22
22
 
23
23
  // 准备传递给Clerk的metadata,包含匿名用户信息
24
24
  const unsafeMetadata = {
25
- user_id: anonymousUser?.userId || null, // 数据库中的user_id
25
+ user_id: xUser?.userId || null, // 数据库中的user_id
26
26
  fingerprint_id: fingerprintId || null, // 浏览器指纹ID
27
27
  };
28
28
 
@@ -38,18 +38,18 @@ export function SignUpWithFingerprint() {
38
38
  console.log('SignUpWithFingerprint Debug:', {
39
39
  fingerprintProvider: fingerprintContext ? 'Available' : 'Not found',
40
40
  fingerprintId: fingerprintId || 'Not generated',
41
- anonymousUser: anonymousUser ? 'Initialized' : 'Not initialized',
41
+ xUser: xUser ? 'Initialized' : 'Not initialized',
42
42
  clerkMetadata: unsafeMetadata
43
43
  });
44
44
 
45
- if (anonymousUser && fingerprintId) {
45
+ if (xUser && fingerprintId) {
46
46
  console.log('User signed up with existing anonymous data:', {
47
- anonymousUserId: anonymousUser.userId,
47
+ userId: xUser.userId,
48
48
  fingerprintId,
49
49
  });
50
50
  // TODO: 实现数据迁移逻辑
51
51
  }
52
- }, [anonymousUser, fingerprintId, fingerprintContext, unsafeMetadata]);
52
+ }, [xUser, fingerprintId, fingerprintContext, unsafeMetadata]);
53
53
 
54
54
  return <SignUp unsafeMetadata={unsafeMetadata} />;
55
55
  }