@windrun-huaiin/third-ui 7.2.2 → 7.3.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.
Files changed (28) 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 +49 -19
  4. package/dist/clerk/fingerprint/fingerprint-provider.mjs +51 -21
  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/fingerprint/types.d.ts +12 -0
  11. package/dist/clerk/fingerprint/use-fingerprint.js +5 -0
  12. package/dist/clerk/fingerprint/use-fingerprint.mjs +5 -0
  13. package/dist/clerk/signin-with-fingerprint-client.d.ts +0 -1
  14. package/dist/clerk/signin-with-fingerprint-client.js +0 -3
  15. package/dist/clerk/signin-with-fingerprint-client.mjs +1 -1
  16. package/dist/clerk/signup-with-fingerprint-client.d.ts +0 -1
  17. package/dist/clerk/signup-with-fingerprint-client.js +0 -3
  18. package/dist/clerk/signup-with-fingerprint-client.mjs +1 -1
  19. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.mjs +1 -1
  20. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.mjs +1 -1
  21. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.mjs +1 -1
  22. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.mjs +1 -1
  23. package/package.json +3 -3
  24. package/src/clerk/fingerprint/fingerprint-provider.tsx +15 -2
  25. package/src/clerk/fingerprint/types.ts +13 -0
  26. package/src/clerk/fingerprint/use-fingerprint.ts +6 -0
  27. package/src/clerk/signin-with-fingerprint-client.tsx +0 -1
  28. 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() {
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] }))] }));
47
+ function FingerprintStatus() {
48
+ const { fingerprintId, anonymousUser, credits, subscription, isLoading, isInitialized, error } = useFingerprintContext();
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 || '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", {})] }))] })] }))] }));
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() {
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] }))] }));
45
+ function FingerprintStatus() {
46
+ const { fingerprintId, anonymousUser, credits, subscription, isLoading, isInitialized, error } = useFingerprintContext();
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 || '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", {})] }))] })] }))] }));
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';
@@ -15,6 +15,17 @@ export interface Credits {
15
15
  balancePaid: number;
16
16
  totalBalance: number;
17
17
  }
18
+ export interface Subscription {
19
+ id: bigint;
20
+ userId: string;
21
+ paySubscriptionId: string | null;
22
+ priceId: string | null;
23
+ priceName: string | null;
24
+ status: string;
25
+ creditsAllocated: number;
26
+ subPeriodStart: string;
27
+ subPeriodEnd: string;
28
+ }
18
29
  export interface FingerprintConfig {
19
30
  /** API endpoint for anonymous user initialization */
20
31
  apiEndpoint: string;
@@ -27,6 +38,7 @@ export interface UseFingerprintResult {
27
38
  fingerprintId: string | null;
28
39
  anonymousUser: AnonymousUser | null;
29
40
  credits: Credits | null;
41
+ subscription: Subscription | null;
30
42
  isLoading: boolean;
31
43
  isInitialized: boolean;
32
44
  error: string | null;
@@ -13,6 +13,7 @@ function useFingerprint(config) {
13
13
  const [fingerprintId, setFingerprintIdState] = React.useState(null);
14
14
  const [anonymousUser, setAnonymousUser] = React.useState(null);
15
15
  const [credits, setCredits] = React.useState(null);
16
+ const [subscription, setSubscription] = React.useState(null);
16
17
  const [isLoading, setIsLoading] = React.useState(true);
17
18
  const [isInitialized, setIsInitialized] = React.useState(false);
18
19
  const [error, setError] = React.useState(null);
@@ -61,6 +62,7 @@ function useFingerprint(config) {
61
62
  if (data.success) {
62
63
  setAnonymousUser(data.user);
63
64
  setCredits(data.credits);
65
+ setSubscription(data.subscription);
64
66
  setIsInitialized(true);
65
67
  // 确保fingerprint ID同步
66
68
  if (data.user.fingerprintId !== fingerprintId) {
@@ -105,6 +107,7 @@ function useFingerprint(config) {
105
107
  if (data.success) {
106
108
  setAnonymousUser(data.user);
107
109
  setCredits(data.credits);
110
+ setSubscription(data.subscription);
108
111
  }
109
112
  }
110
113
  catch (err) {
@@ -129,6 +132,7 @@ function useFingerprint(config) {
129
132
  if (data.success) {
130
133
  setAnonymousUser(data.user);
131
134
  setCredits(data.credits);
135
+ setSubscription(data.subscription);
132
136
  setIsInitialized(true);
133
137
  }
134
138
  }
@@ -165,6 +169,7 @@ function useFingerprint(config) {
165
169
  fingerprintId,
166
170
  anonymousUser,
167
171
  credits,
172
+ subscription,
168
173
  isLoading,
169
174
  isInitialized,
170
175
  error,
@@ -11,6 +11,7 @@ function useFingerprint(config) {
11
11
  const [fingerprintId, setFingerprintIdState] = useState(null);
12
12
  const [anonymousUser, setAnonymousUser] = useState(null);
13
13
  const [credits, setCredits] = useState(null);
14
+ const [subscription, setSubscription] = useState(null);
14
15
  const [isLoading, setIsLoading] = useState(true);
15
16
  const [isInitialized, setIsInitialized] = useState(false);
16
17
  const [error, setError] = useState(null);
@@ -59,6 +60,7 @@ function useFingerprint(config) {
59
60
  if (data.success) {
60
61
  setAnonymousUser(data.user);
61
62
  setCredits(data.credits);
63
+ setSubscription(data.subscription);
62
64
  setIsInitialized(true);
63
65
  // 确保fingerprint ID同步
64
66
  if (data.user.fingerprintId !== fingerprintId) {
@@ -103,6 +105,7 @@ function useFingerprint(config) {
103
105
  if (data.success) {
104
106
  setAnonymousUser(data.user);
105
107
  setCredits(data.credits);
108
+ setSubscription(data.subscription);
106
109
  }
107
110
  }
108
111
  catch (err) {
@@ -127,6 +130,7 @@ function useFingerprint(config) {
127
130
  if (data.success) {
128
131
  setAnonymousUser(data.user);
129
132
  setCredits(data.credits);
133
+ setSubscription(data.subscription);
130
134
  setIsInitialized(true);
131
135
  }
132
136
  }
@@ -163,6 +167,7 @@ function useFingerprint(config) {
163
167
  fingerprintId,
164
168
  anonymousUser,
165
169
  credits,
170
+ subscription,
166
171
  isLoading,
167
172
  isInitialized,
168
173
  error,
@@ -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,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@1.0.2/node_modules/layout-base/layout-base.mjs';
3
3
 
4
4
  var coseBase = coseBase$1.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@2.0.1/node_modules/layout-base/layout-base.mjs';
3
3
 
4
4
  var coseBase = coseBase$1.exports;
@@ -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,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.2",
3
+ "version": "7.3.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/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",
@@ -71,6 +71,7 @@ export function FingerprintStatus() {
71
71
  fingerprintId,
72
72
  anonymousUser,
73
73
  credits,
74
+ subscription,
74
75
  isLoading,
75
76
  isInitialized,
76
77
  error
@@ -148,8 +149,8 @@ export function FingerprintStatus() {
148
149
  {anonymousUser && (
149
150
  <div>
150
151
  <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 */}
152
+ <strong>clerk_user_id:</strong> {anonymousUser.clerkUserId || 'None'} <br/>
153
+ <strong>email:</strong> {anonymousUser.email || 'None'} <br/>
153
154
  </div>
154
155
  )}
155
156
  {credits && (
@@ -157,6 +158,18 @@ export function FingerprintStatus() {
157
158
  <strong>Credits:</strong> {credits.balanceFree} Free + {credits.balancePaid} Paid = {credits.totalBalance} Total
158
159
  </div>
159
160
  )}
161
+ {subscription && (
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/>
171
+ </div>
172
+ )}
160
173
  </div>
161
174
  </>
162
175
  )}
@@ -18,6 +18,18 @@ export interface Credits {
18
18
  totalBalance: number;
19
19
  }
20
20
 
21
+ export interface Subscription {
22
+ id: bigint
23
+ userId: string
24
+ paySubscriptionId: string | null
25
+ priceId: string | null
26
+ priceName: string | null
27
+ status: string
28
+ creditsAllocated: number
29
+ subPeriodStart: string
30
+ subPeriodEnd: string
31
+ }
32
+
21
33
  export interface FingerprintConfig {
22
34
  /** API endpoint for anonymous user initialization */
23
35
  apiEndpoint: string;
@@ -31,6 +43,7 @@ export interface UseFingerprintResult {
31
43
  fingerprintId: string | null;
32
44
  anonymousUser: AnonymousUser | null;
33
45
  credits: Credits | null;
46
+ subscription: Subscription | null;
34
47
  isLoading: boolean;
35
48
  isInitialized: boolean;
36
49
  error: string | null;
@@ -9,6 +9,7 @@ import {
9
9
  import type {
10
10
  AnonymousUser,
11
11
  Credits,
12
+ Subscription,
12
13
  UseFingerprintResult,
13
14
  FingerprintConfig
14
15
  } from './types';
@@ -21,6 +22,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
21
22
  const [fingerprintId, setFingerprintIdState] = useState<string | null>(null);
22
23
  const [anonymousUser, setAnonymousUser] = useState<AnonymousUser | null>(null);
23
24
  const [credits, setCredits] = useState<Credits | null>(null);
25
+ const [subscription, setSubscription] = useState<Subscription | null>(null);
24
26
  const [isLoading, setIsLoading] = useState(true);
25
27
  const [isInitialized, setIsInitialized] = useState(false);
26
28
  const [error, setError] = useState<string | null>(null);
@@ -78,6 +80,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
78
80
  if (data.success) {
79
81
  setAnonymousUser(data.user);
80
82
  setCredits(data.credits);
83
+ setSubscription(data.subscription);
81
84
  setIsInitialized(true);
82
85
 
83
86
  // 确保fingerprint ID同步
@@ -125,6 +128,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
125
128
  if (data.success) {
126
129
  setAnonymousUser(data.user);
127
130
  setCredits(data.credits);
131
+ setSubscription(data.subscription);
128
132
  }
129
133
  } catch (err) {
130
134
  console.error('Failed to refresh user data:', err);
@@ -150,6 +154,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
150
154
  if (data.success) {
151
155
  setAnonymousUser(data.user);
152
156
  setCredits(data.credits);
157
+ setSubscription(data.subscription);
153
158
  setIsInitialized(true);
154
159
  }
155
160
  }
@@ -189,6 +194,7 @@ export function useFingerprint(config: FingerprintConfig): UseFingerprintResult
189
194
  fingerprintId,
190
195
  anonymousUser,
191
196
  credits,
197
+ subscription,
192
198
  isLoading,
193
199
  isInitialized,
194
200
  error,
@@ -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;