@windrun-huaiin/third-ui 7.3.11 → 7.3.13

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 (54) hide show
  1. package/dist/_virtual/cytoscape-cose-bilkent.js +1 -1
  2. package/dist/_virtual/cytoscape-cose-bilkent.mjs +1 -1
  3. package/dist/_virtual/cytoscape-fcose.js +1 -1
  4. package/dist/_virtual/cytoscape-fcose.mjs +1 -1
  5. package/dist/lib/clerk-intl.d.ts +3 -4566
  6. package/dist/main/faq.js +0 -1
  7. package/dist/main/faq.mjs +0 -1
  8. package/dist/main/gallery.js +0 -1
  9. package/dist/main/gallery.mjs +0 -1
  10. package/dist/main/money-price/money-price-button.js +36 -15
  11. package/dist/main/money-price/money-price-button.mjs +36 -15
  12. package/dist/main/money-price/money-price-interactive.js +15 -9
  13. package/dist/main/money-price/money-price-interactive.mjs +16 -10
  14. package/dist/main/money-price/money-price.js +1 -14
  15. package/dist/main/money-price/money-price.mjs +1 -14
  16. package/dist/main/price-plan.js +0 -1
  17. package/dist/main/price-plan.mjs +0 -1
  18. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
  19. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
  20. package/dist/node_modules/.pnpm/{cytoscape@3.33.0 → cytoscape@3.33.1}/node_modules/cytoscape/dist/cytoscape.esm.js +19 -2
  21. package/dist/node_modules/.pnpm/{cytoscape@3.33.0 → cytoscape@3.33.1}/node_modules/cytoscape/dist/cytoscape.esm.mjs +19 -2
  22. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
  23. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
  24. package/dist/node_modules/.pnpm/mermaid@11.9.0/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-SUXI7LT5.js +1 -1
  25. package/dist/node_modules/.pnpm/mermaid@11.9.0/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-SUXI7LT5.mjs +1 -1
  26. package/dist/node_modules/.pnpm/mermaid@11.9.0/node_modules/mermaid/dist/chunks/mermaid.core/mindmap-definition-6CBA2TL7.js +1 -1
  27. package/dist/node_modules/.pnpm/mermaid@11.9.0/node_modules/mermaid/dist/chunks/mermaid.core/mindmap-definition-6CBA2TL7.mjs +1 -1
  28. package/package.json +1 -1
  29. package/src/main/money-price/money-price-button.tsx +48 -24
  30. package/src/main/money-price/money-price-interactive.tsx +38 -21
  31. package/src/main/money-price/money-price.tsx +6 -8
  32. package/dist/clerk/client-page-generator.d.ts +0 -10
  33. package/dist/clerk/client-page-generator.js +0 -28
  34. package/dist/clerk/client-page-generator.mjs +0 -25
  35. package/dist/clerk/context/FingerprintProvider.d.ts +0 -25
  36. package/dist/clerk/context/FingerprintProvider.js +0 -71
  37. package/dist/clerk/context/FingerprintProvider.mjs +0 -65
  38. package/dist/clerk/fingerprint/fingerprint.d.ts +0 -55
  39. package/dist/clerk/fingerprint/fingerprint.js +0 -17
  40. package/dist/clerk/fingerprint/fingerprint.mjs +0 -15
  41. package/dist/clerk/fingerprint.d.ts +0 -55
  42. package/dist/clerk/fingerprint.js +0 -237
  43. package/dist/clerk/fingerprint.mjs +0 -225
  44. package/dist/clerk/hooks/useFingerprint.d.ts +0 -6
  45. package/dist/clerk/hooks/useFingerprint.js +0 -182
  46. package/dist/clerk/hooks/useFingerprint.mjs +0 -180
  47. package/dist/clerk/types.d.ts +0 -42
  48. package/dist/main/money-price/money-price-config.d.ts +0 -8
  49. package/dist/main/money-price/money-price-config.js +0 -223
  50. package/dist/main/money-price/money-price-config.mjs +0 -219
  51. /package/dist/node_modules/.pnpm/{cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.0 → cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1}/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.js +0 -0
  52. /package/dist/node_modules/.pnpm/{cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.0 → cytoscape-cose-bilkent@4.1.0_cytoscape@3.33.1}/node_modules/cytoscape-cose-bilkent/cytoscape-cose-bilkent.mjs +0 -0
  53. /package/dist/node_modules/.pnpm/{cytoscape-fcose@2.2.0_cytoscape@3.33.0 → cytoscape-fcose@2.2.0_cytoscape@3.33.1}/node_modules/cytoscape-fcose/cytoscape-fcose.js +0 -0
  54. /package/dist/node_modules/.pnpm/{cytoscape-fcose@2.2.0_cytoscape@3.33.0 → cytoscape-fcose@2.2.0_cytoscape@3.33.1}/node_modules/cytoscape-fcose/cytoscape-fcose.mjs +0 -0
@@ -4,7 +4,7 @@ var chunkQESNASVV = require('./chunk-QESNASVV.js');
4
4
  var chunk55PJQP7W = require('./chunk-55PJQP7W.js');
5
5
  var chunkP3VETL53 = require('./chunk-P3VETL53.js');
6
6
  var chunk3XYRH5AP = require('./chunk-3XYRH5AP.js');
7
- var cytoscape_esm = require('../../../../../../cytoscape@3.33.0/node_modules/cytoscape/dist/cytoscape.esm.js');
7
+ var cytoscape_esm = require('../../../../../../cytoscape@3.33.1/node_modules/cytoscape/dist/cytoscape.esm.js');
8
8
  var cytoscapeCoseBilkent = require('../../../../../../../../_virtual/cytoscape-cose-bilkent.js');
9
9
  require('../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js');
10
10
  require('../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js');
@@ -2,7 +2,7 @@ import { createText } from './chunk-QESNASVV.mjs';
2
2
  import { parseFontSize } from './chunk-55PJQP7W.mjs';
3
3
  import { selectSvgElement } from './chunk-P3VETL53.mjs';
4
4
  import { __name, log, getConfig2, setupGraphViewbox, defaultConfig_default, sanitizeText } from './chunk-3XYRH5AP.mjs';
5
- import cytoscape from '../../../../../../cytoscape@3.33.0/node_modules/cytoscape/dist/cytoscape.esm.mjs';
5
+ import cytoscape from '../../../../../../cytoscape@3.33.1/node_modules/cytoscape/dist/cytoscape.esm.mjs';
6
6
  import coseBilkent from '../../../../../../../../_virtual/cytoscape-cose-bilkent.mjs';
7
7
  import '../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.mjs';
8
8
  import '../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/third-ui",
3
- "version": "7.3.11",
3
+ "version": "7.3.13",
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,8 +1,8 @@
1
1
  'use client';
2
2
 
3
- import { GradientButton } from '@windrun-huaiin/third-ui/fuma/mdx';
4
- import { globalLucideIcons as icons } from '@windrun-huaiin/base-ui/components/server';
3
+ import { cn } from '@windrun-huaiin/lib/utils';
5
4
  import { UserState, type MoneyPriceButtonProps } from './money-price-types';
5
+ import React, { useState } from 'react';
6
6
 
7
7
  function capitalize(str: string): string {
8
8
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -18,6 +18,7 @@ export function MoneyPriceButton({
18
18
  isProcessing = false
19
19
  }: MoneyPriceButtonProps) {
20
20
  const { isAuthenticated, subscriptionStatus } = userContext;
21
+ const [isLoading, setIsLoading] = useState(false);
21
22
 
22
23
  // 决定按钮显示和行为
23
24
  const getButtonConfig = () => {
@@ -28,8 +29,7 @@ export function MoneyPriceButton({
28
29
  text: texts[textKey as keyof typeof texts] || texts.getStarted,
29
30
  onClick: onLogin,
30
31
  disabled: false,
31
- hidden: false,
32
- icon: <icons.ArrowRight />
32
+ hidden: false
33
33
  };
34
34
  }
35
35
 
@@ -40,8 +40,7 @@ export function MoneyPriceButton({
40
40
  return {
41
41
  text: texts.currentPlan,
42
42
  disabled: true,
43
- hidden: false,
44
- icon: <icons.GlobeLock />
43
+ hidden: false
45
44
  };
46
45
  }
47
46
  const getFreeUserText = planKey === 'pro' ? texts.getPro : texts.getUltra;
@@ -49,8 +48,7 @@ export function MoneyPriceButton({
49
48
  text: getFreeUserText,
50
49
  onClick: () => onUpgrade(planKey, billingType),
51
50
  disabled: false,
52
- hidden: false,
53
- icon: <icons.ArrowRight />
51
+ hidden: false
54
52
  };
55
53
 
56
54
  case UserState.ProUser:
@@ -59,16 +57,14 @@ export function MoneyPriceButton({
59
57
  return {
60
58
  text: texts.currentPlan,
61
59
  disabled: true,
62
- hidden: false,
63
- icon: <icons.GlobeLock />
60
+ hidden: false
64
61
  };
65
62
  }
66
63
  return {
67
64
  text: texts.upgrade,
68
65
  onClick: () => onUpgrade('ultra', billingType),
69
66
  disabled: false,
70
- hidden: false,
71
- icon: <icons.ArrowRight />
67
+ hidden: false
72
68
  };
73
69
 
74
70
  case UserState.UltraUser:
@@ -76,8 +72,7 @@ export function MoneyPriceButton({
76
72
  return {
77
73
  text: texts.currentPlan,
78
74
  disabled: true,
79
- hidden: false,
80
- icon: <icons.GlobeLock />
75
+ hidden: false
81
76
  };
82
77
 
83
78
  default:
@@ -88,17 +83,46 @@ export function MoneyPriceButton({
88
83
  const config = getButtonConfig();
89
84
 
90
85
  if (config.hidden) return null;
86
+
87
+ const handleClick = async (e: React.MouseEvent) => {
88
+ if (config.disabled || isLoading || isProcessing) {
89
+ e.preventDefault();
90
+ return;
91
+ }
92
+
93
+ if (config.onClick) {
94
+ e.preventDefault();
95
+ setIsLoading(true);
96
+
97
+ try {
98
+ const result = config.onClick();
99
+ // Handle both sync and async functions
100
+ await Promise.resolve(result);
101
+ } catch (error) {
102
+ console.error('MoneyPriceButton onClick error:', error);
103
+ } finally {
104
+ setIsLoading(false);
105
+ }
106
+ }
107
+ };
108
+
109
+ const isDisabled = config.disabled || isLoading || isProcessing;
110
+ const displayText = isLoading ? 'Processing...' : config.text;
91
111
 
92
112
  return (
93
- <GradientButton
94
- title={config.text}
95
- icon={config.icon}
96
- onClick={config.onClick}
97
- disabled={config.disabled || isProcessing}
98
- align="center"
99
- className="w-full"
100
- preventDoubleClick={true}
101
- loadingText="Processing..."
102
- />
113
+ <button
114
+ className={cn(
115
+ 'w-full py-2 mt-auto text-white text-base font-bold shadow-lg hover:shadow-xl transition-all duration-300 rounded-full',
116
+ isDisabled
117
+ ? 'bg-gray-400 cursor-not-allowed'
118
+ : 'bg-gradient-to-r from-purple-400 to-pink-500 hover:from-purple-500 hover:to-pink-600 dark:from-purple-500 dark:to-pink-600 dark:hover:from-purple-600 dark:hover:to-pink-700'
119
+ )}
120
+ disabled={isDisabled}
121
+ onClick={handleClick}
122
+ type="button"
123
+ data-plan-button={planKey}
124
+ >
125
+ {displayText}
126
+ </button>
103
127
  );
104
128
  }
@@ -191,6 +191,9 @@ export function MoneyPriceInteractive({
191
191
  }
192
192
  }, []);
193
193
 
194
+ // State for button portals
195
+ const [buttonPortals, setButtonPortals] = useState<React.ReactElement[]>([]);
196
+
194
197
  // 处理月付/年付切换和 tooltip 功能
195
198
  useEffect(() => {
196
199
  const monthlyButton = document.querySelector('[data-billing-button="monthly"]') as HTMLButtonElement;
@@ -257,26 +260,6 @@ export function MoneyPriceInteractive({
257
260
  }
258
261
  });
259
262
  });
260
-
261
- // Inject buttons into placeholders using createPortal
262
- data.plans.forEach((plan: any) => {
263
- const placeholder = document.querySelector(`[data-button-placeholder="${plan.key}"]`) as HTMLElement;
264
- if (placeholder) {
265
- console.log('MoneyPriceButton', `[data-button-placeholder="${plan.key}"]`)
266
- createPortal(
267
- <MoneyPriceButton
268
- planKey={plan.key}
269
- userContext={userContext}
270
- billingType={billingType}
271
- onLogin={handleLogin}
272
- onUpgrade={handleUpgrade}
273
- texts={data.buttonTexts}
274
- isProcessing={isProcessing}
275
- />,
276
- placeholder
277
- );
278
- }
279
- });
280
263
 
281
264
  // Initial updates
282
265
  updatePriceDisplay(billingType);
@@ -299,6 +282,35 @@ export function MoneyPriceInteractive({
299
282
  };
300
283
  }, [data, billingType, updatePriceDisplay, updateButtonStyles, updateDiscountInfo, userContext, handleLogin, handleUpgrade, isProcessing]);
301
284
 
285
+ // Create button portals after component mounts
286
+ useEffect(() => {
287
+ const portals: React.ReactElement[] = [];
288
+
289
+ data.plans.forEach((plan: any) => {
290
+ const placeholder = document.querySelector(`[data-button-placeholder="${plan.key}"]`) as HTMLElement;
291
+ if (placeholder) {
292
+ console.log('Creating portal for', `[data-button-placeholder="${plan.key}"]`);
293
+ portals.push(
294
+ createPortal(
295
+ <MoneyPriceButton
296
+ key={plan.key}
297
+ planKey={plan.key}
298
+ userContext={userContext}
299
+ billingType={billingType}
300
+ onLogin={handleLogin}
301
+ onUpgrade={handleUpgrade}
302
+ texts={data.buttonTexts}
303
+ isProcessing={isProcessing}
304
+ />,
305
+ placeholder
306
+ )
307
+ );
308
+ }
309
+ });
310
+
311
+ setButtonPortals(portals);
312
+ }, [data.plans, userContext, billingType, handleLogin, handleUpgrade, data.buttonTexts, isProcessing]);
313
+
302
314
  // Tooltip 组件
303
315
  const Tooltip = ({ show, content, x, y }: typeof tooltip) => {
304
316
  if (!show) return null;
@@ -322,5 +334,10 @@ export function MoneyPriceInteractive({
322
334
  );
323
335
  };
324
336
 
325
- return <Tooltip {...tooltip} />;
337
+ return (
338
+ <>
339
+ <Tooltip {...tooltip} />
340
+ {buttonPortals}
341
+ </>
342
+ );
326
343
  }
@@ -4,7 +4,6 @@ import { getTranslations } from 'next-intl/server';
4
4
  import { getActiveProviderConfig } from './money-price-config-util';
5
5
  import { MoneyPriceInteractive } from './money-price-interactive';
6
6
  import type { MoneyPriceProps, MoneyPriceData } from './money-price-types';
7
- import { GradientButton } from '@third-ui/fuma/mdx';
8
7
 
9
8
  export async function MoneyPrice({
10
9
  locale,
@@ -140,6 +139,7 @@ export async function MoneyPrice({
140
139
  {data.subtitle}
141
140
  </p>
142
141
 
142
+ {/* billing switch button */}
143
143
  <div className="flex flex-col items-center">
144
144
  <div className="flex items-center relative mb-3">
145
145
  <div className="flex bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-full p-1" data-billing-switch>
@@ -170,6 +170,7 @@ export async function MoneyPrice({
170
170
  </div>
171
171
  </div>
172
172
 
173
+ {/* Discount info - static for default billing */}
173
174
  <div className="h-8 flex items-center justify-center mb-3" data-discount-info>
174
175
  {(() => {
175
176
  const opt = data.billingSwitch.options.find((opt: any) => opt.key === data.billingSwitch.defaultKey);
@@ -200,13 +201,15 @@ export async function MoneyPrice({
200
201
  </div>
201
202
  </div>
202
203
 
204
+ {/* price card area */}
205
+
203
206
  <div className="grid grid-cols-1 md:grid-cols-3 gap-8">
204
207
  {data.plans.map((plan: any, _idx: number) => (
205
208
  <div
206
209
  key={plan.key}
207
210
  data-price-plan={plan.key}
208
211
  className={cn(
209
- 'flex flex-col bg-white dark:bg-gray-800/60 rounded-2xl border border-gray-300 dark:border-[#7c3aed40] transition p-8 w-full h-full shadow-sm dark:shadow-none', // 添加 w-full
212
+ 'flex flex-col bg-white dark:bg-gray-800/60 rounded-2xl border border-gray-300 dark:border-[#7c3aed40] transition p-8 h-full shadow-sm dark:shadow-none',
210
213
  'hover:border-2 hover:border-purple-500',
211
214
  'focus-within:border-2 focus-within:border-purple-500'
212
215
  )}
@@ -264,12 +267,7 @@ export async function MoneyPrice({
264
267
  <div className="flex-1" />
265
268
 
266
269
  <div data-button-placeholder={plan.key}>
267
- <GradientButton
268
- title={data.buttonTexts.getStarted}
269
- disabled={true}
270
- align="center"
271
- className="w-full"
272
- />
270
+ {/* Button will be injected by client-side component */}
273
271
  </div>
274
272
  </div>
275
273
  ))}
@@ -1,10 +0,0 @@
1
- /**
2
- * Create a SignUp page with fingerprint support
3
- * Note: This must be used within a FingerprintProvider
4
- */
5
- export declare function createSignUpPageWithFingerprint(): () => import("react/jsx-runtime").JSX.Element;
6
- /**
7
- * Create a SignIn page with fingerprint support
8
- * Note: This must be used within a FingerprintProvider
9
- */
10
- export declare function createSignInPageWithFingerprint(): () => import("react/jsx-runtime").JSX.Element;
@@ -1,28 +0,0 @@
1
- "use client";
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var signupWithFingerprintClient = require('./signup-with-fingerprint-client.js');
6
- var signinWithFingerprintClient = require('./signin-with-fingerprint-client.js');
7
-
8
- /**
9
- * Create a SignUp page with fingerprint support
10
- * Note: This must be used within a FingerprintProvider
11
- */
12
- function createSignUpPageWithFingerprint() {
13
- return function SignUpPage() {
14
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center mt-0 mb-32", children: jsxRuntime.jsx(signupWithFingerprintClient.SignUpWithFingerprint, {}) }));
15
- };
16
- }
17
- /**
18
- * Create a SignIn page with fingerprint support
19
- * Note: This must be used within a FingerprintProvider
20
- */
21
- function createSignInPageWithFingerprint() {
22
- return function SignInPage() {
23
- return (jsxRuntime.jsx("div", { className: "flex-1 flex justify-center mb-64", children: jsxRuntime.jsx(signinWithFingerprintClient.SignInWithFingerprint, {}) }));
24
- };
25
- }
26
-
27
- exports.createSignInPageWithFingerprint = createSignInPageWithFingerprint;
28
- exports.createSignUpPageWithFingerprint = createSignUpPageWithFingerprint;
@@ -1,25 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import { SignUpWithFingerprint } from './signup-with-fingerprint-client.mjs';
4
- import { SignInWithFingerprint } from './signin-with-fingerprint-client.mjs';
5
-
6
- /**
7
- * Create a SignUp page with fingerprint support
8
- * Note: This must be used within a FingerprintProvider
9
- */
10
- function createSignUpPageWithFingerprint() {
11
- return function SignUpPage() {
12
- return (jsx("div", { className: "flex-1 flex justify-center mt-0 mb-32", children: jsx(SignUpWithFingerprint, {}) }));
13
- };
14
- }
15
- /**
16
- * Create a SignIn page with fingerprint support
17
- * Note: This must be used within a FingerprintProvider
18
- */
19
- function createSignInPageWithFingerprint() {
20
- return function SignInPage() {
21
- return (jsx("div", { className: "flex-1 flex justify-center mb-64", children: jsx(SignInWithFingerprint, {}) }));
22
- };
23
- }
24
-
25
- export { createSignInPageWithFingerprint, createSignUpPageWithFingerprint };
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import type { FingerprintContextType, FingerprintProviderProps } from '../types';
3
- /**
4
- * Fingerprint Provider Component
5
- * 为应用提供fingerprint和匿名用户管理功能
6
- */
7
- export declare function FingerprintProvider({ children, config }: FingerprintProviderProps): import("react/jsx-runtime").JSX.Element;
8
- /**
9
- * Hook to use fingerprint context
10
- */
11
- export declare function useFingerprintContext(): FingerprintContextType;
12
- /**
13
- * Safe hook to use fingerprint context - returns null if no provider
14
- * 安全版本的fingerprint context hook - 如果没有Provider则返回null
15
- */
16
- export declare function useFingerprintContextSafe(): FingerprintContextType | null;
17
- /**
18
- * HOC for components that need fingerprint functionality
19
- * Note: This HOC now requires config to be passed externally
20
- */
21
- export declare function withFingerprint<P extends object>(Component: React.ComponentType<P>, config: FingerprintProviderProps['config']): (props: P) => import("react/jsx-runtime").JSX.Element;
22
- /**
23
- * 组件:显示用户状态和积分信息(用于调试)
24
- */
25
- export declare function FingerprintDebugInfo(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,71 +0,0 @@
1
- "use client";
2
- 'use strict';
3
-
4
- var jsxRuntime = require('react/jsx-runtime');
5
- var React = require('react');
6
- var useFingerprint = require('../hooks/useFingerprint.js');
7
-
8
- const FingerprintContext = React.createContext(undefined);
9
- /**
10
- * Fingerprint Provider Component
11
- * 为应用提供fingerprint和匿名用户管理功能
12
- */
13
- function FingerprintProvider({ children, config }) {
14
- const fingerprintData = useFingerprint.useFingerprint(config);
15
- return (jsxRuntime.jsx(FingerprintContext.Provider, { value: fingerprintData, children: children }));
16
- }
17
- /**
18
- * Hook to use fingerprint context
19
- */
20
- function useFingerprintContext() {
21
- const context = React.useContext(FingerprintContext);
22
- if (context === undefined) {
23
- throw new Error('useFingerprintContext must be used within a FingerprintProvider');
24
- }
25
- return context;
26
- }
27
- /**
28
- * Safe hook to use fingerprint context - returns null if no provider
29
- * 安全版本的fingerprint context hook - 如果没有Provider则返回null
30
- */
31
- function useFingerprintContextSafe() {
32
- const context = React.useContext(FingerprintContext);
33
- return context || null;
34
- }
35
- /**
36
- * HOC for components that need fingerprint functionality
37
- * Note: This HOC now requires config to be passed externally
38
- */
39
- function withFingerprint(Component, config) {
40
- return function FingerprintWrappedComponent(props) {
41
- return (jsxRuntime.jsx(FingerprintProvider, { config: config, children: jsxRuntime.jsx(Component, Object.assign({}, props)) }));
42
- };
43
- }
44
- /**
45
- * 组件:显示用户状态和积分信息(用于调试)
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] }))] }));
65
- }
66
-
67
- exports.FingerprintDebugInfo = FingerprintDebugInfo;
68
- exports.FingerprintProvider = FingerprintProvider;
69
- exports.useFingerprintContext = useFingerprintContext;
70
- exports.useFingerprintContextSafe = useFingerprintContextSafe;
71
- exports.withFingerprint = withFingerprint;
@@ -1,65 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { createContext, useContext } from 'react';
4
- import { useFingerprint } from '../hooks/useFingerprint.mjs';
5
-
6
- const FingerprintContext = createContext(undefined);
7
- /**
8
- * Fingerprint Provider Component
9
- * 为应用提供fingerprint和匿名用户管理功能
10
- */
11
- function FingerprintProvider({ children, config }) {
12
- const fingerprintData = useFingerprint(config);
13
- return (jsx(FingerprintContext.Provider, { value: fingerprintData, children: children }));
14
- }
15
- /**
16
- * Hook to use fingerprint context
17
- */
18
- function useFingerprintContext() {
19
- const context = useContext(FingerprintContext);
20
- if (context === undefined) {
21
- throw new Error('useFingerprintContext must be used within a FingerprintProvider');
22
- }
23
- return context;
24
- }
25
- /**
26
- * Safe hook to use fingerprint context - returns null if no provider
27
- * 安全版本的fingerprint context hook - 如果没有Provider则返回null
28
- */
29
- function useFingerprintContextSafe() {
30
- const context = useContext(FingerprintContext);
31
- return context || null;
32
- }
33
- /**
34
- * HOC for components that need fingerprint functionality
35
- * Note: This HOC now requires config to be passed externally
36
- */
37
- function withFingerprint(Component, config) {
38
- return function FingerprintWrappedComponent(props) {
39
- return (jsx(FingerprintProvider, { config: config, children: jsx(Component, Object.assign({}, props)) }));
40
- };
41
- }
42
- /**
43
- * 组件:显示用户状态和积分信息(用于调试)
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] }))] }));
63
- }
64
-
65
- export { FingerprintDebugInfo, FingerprintProvider, useFingerprintContext, useFingerprintContextSafe, withFingerprint };
@@ -1,55 +0,0 @@
1
- /**
2
- * Fingerprint Core Utilities
3
- * 基于浏览器特征生成唯一的设备指纹ID,用于匿名用户识别
4
- * Core fingerprint generation logic - completely generic
5
- *
6
- * NOTE: This module should only be used on the client-side
7
- */
8
- /**
9
- * 生成基于真实浏览器特征的fingerprint ID
10
- * 使用FingerprintJS收集浏览器特征并生成唯一标识
11
- */
12
- export declare function generateFingerprintId(): Promise<string>;
13
- /**
14
- * 获取当前的fingerprint ID
15
- */
16
- export declare function getFingerprintId(): string | null;
17
- /**
18
- * 设置fingerprint ID到存储
19
- */
20
- export declare function setFingerprintId(fingerprintId: string): void;
21
- /**
22
- * 清除fingerprint ID
23
- */
24
- export declare function clearFingerprintId(): void;
25
- /**
26
- * 获取或生成fingerprint ID
27
- * 如果不存在则自动生成新的
28
- */
29
- export declare function getOrGenerateFingerprintId(): Promise<string>;
30
- /**
31
- * 验证fingerprint ID格式
32
- */
33
- export declare function isValidFingerprintId(fingerprintId: string): boolean;
34
- /**
35
- * 创建包含fingerprint ID的fetch headers
36
- */
37
- export declare function createFingerprintHeaders(): Promise<Record<string, string>>;
38
- /**
39
- * Hook for generating fingerprint headers
40
- */
41
- export declare function useFingerprintHeaders(): () => Promise<Record<string, string>>;
42
- /**
43
- * Create a fetch wrapper that automatically includes fingerprint headers
44
- */
45
- export declare function createFingerprintFetch(): (url: string | URL | Request, init?: RequestInit) => Promise<Response>;
46
- /**
47
- * 从请求中提取fingerprint ID
48
- * 优先级:header > cookie > query参数
49
- */
50
- export declare function extractFingerprintId(headers: Headers | Record<string, string>, cookies?: Record<string, string>, query?: Record<string, string | undefined>): string | null;
51
- export declare const FINGERPRINT_CONSTANTS: {
52
- readonly STORAGE_KEY: "diaomao_fingerprint_id";
53
- readonly HEADER_NAME: "x-fingerprint-id";
54
- readonly COOKIE_NAME: "fingerprint_id";
55
- };
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- require('../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.js');
4
-
5
- /**
6
- * Fingerprint Core Utilities
7
- * 基于浏览器特征生成唯一的设备指纹ID,用于匿名用户识别
8
- * Core fingerprint generation logic - completely generic
9
- *
10
- * NOTE: This module should only be used on the client-side
11
- */
12
- // Only import in browser environment
13
- if (typeof window !== 'undefined') {
14
- Promise.resolve().then(function () { return require('../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.js'); }).then((module) => {
15
- module.default;
16
- });
17
- }
@@ -1,15 +0,0 @@
1
- import '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.4_rollup@4.46.2_tslib@2.8.1_typescript@5.9.2/node_modules/tslib/tslib.es6.mjs';
2
-
3
- /**
4
- * Fingerprint Core Utilities
5
- * 基于浏览器特征生成唯一的设备指纹ID,用于匿名用户识别
6
- * Core fingerprint generation logic - completely generic
7
- *
8
- * NOTE: This module should only be used on the client-side
9
- */
10
- // Only import in browser environment
11
- if (typeof window !== 'undefined') {
12
- import('../../node_modules/.pnpm/@fingerprintjs_fingerprintjs@4.6.2/node_modules/@fingerprintjs/fingerprintjs/dist/fp.esm.mjs').then((module) => {
13
- module.default;
14
- });
15
- }