@windrun-huaiin/third-ui 7.3.2 → 7.3.4

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 (50) hide show
  1. package/dist/clerk/fingerprint/fingerprint-provider.js +26 -6
  2. package/dist/clerk/fingerprint/fingerprint-provider.mjs +27 -7
  3. package/dist/clerk/fingerprint/use-fingerprint.js +1 -1
  4. package/dist/clerk/fingerprint/use-fingerprint.mjs +1 -1
  5. package/dist/main/faq.js +11 -0
  6. package/dist/main/faq.mjs +11 -0
  7. package/dist/main/gallery.js +11 -0
  8. package/dist/main/gallery.mjs +11 -0
  9. package/dist/main/index.d.ts +2 -0
  10. package/dist/main/index.js +4 -0
  11. package/dist/main/index.mjs +2 -0
  12. package/dist/main/money-price/money-price-button.d.ts +2 -0
  13. package/dist/main/money-price/money-price-button.js +96 -0
  14. package/dist/main/money-price/money-price-button.mjs +94 -0
  15. package/dist/main/money-price/money-price-config-util.d.ts +7 -0
  16. package/dist/main/money-price/money-price-config-util.js +19 -0
  17. package/dist/main/money-price/money-price-config-util.mjs +16 -0
  18. package/dist/main/money-price/money-price-config.d.ts +8 -0
  19. package/dist/main/money-price/money-price-config.js +223 -0
  20. package/dist/main/money-price/money-price-config.mjs +219 -0
  21. package/dist/main/money-price/money-price-interactive.d.ts +2 -0
  22. package/dist/main/money-price/money-price-interactive.js +315 -0
  23. package/dist/main/money-price/money-price-interactive.mjs +313 -0
  24. package/dist/main/money-price/money-price-types.d.ts +116 -0
  25. package/dist/main/money-price/money-price-types.js +14 -0
  26. package/dist/main/money-price/money-price-types.mjs +14 -0
  27. package/dist/main/money-price/money-price.d.ts +2 -0
  28. package/dist/main/money-price/money-price.js +93 -0
  29. package/dist/main/money-price/money-price.mjs +91 -0
  30. package/dist/main/price-plan.js +12 -0
  31. package/dist/main/price-plan.mjs +12 -0
  32. package/dist/main/server.d.ts +4 -0
  33. package/dist/main/server.js +10 -0
  34. package/dist/main/server.mjs +3 -0
  35. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
  36. package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.mjs +1 -1
  37. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
  38. package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.mjs +1 -1
  39. package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
  40. package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
  41. package/package.json +1 -1
  42. package/src/clerk/fingerprint/fingerprint-provider.tsx +53 -20
  43. package/src/clerk/fingerprint/use-fingerprint.ts +1 -1
  44. package/src/main/index.ts +5 -1
  45. package/src/main/money-price/money-price-button.tsx +105 -0
  46. package/src/main/money-price/money-price-config-util.ts +23 -0
  47. package/src/main/money-price/money-price-interactive.tsx +381 -0
  48. package/src/main/money-price/money-price-types.ts +138 -0
  49. package/src/main/money-price/money-price.tsx +307 -0
  50. package/src/main/server.ts +24 -1
@@ -4,6 +4,7 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var useFingerprint = require('./use-fingerprint.js');
7
+ var server = require('@windrun-huaiin/base-ui/components/server');
7
8
 
8
9
  const FingerprintContext = React.createContext(undefined);
9
10
  /**
@@ -47,9 +48,29 @@ function withFingerprint(Component, config) {
47
48
  function FingerprintStatus() {
48
49
  const { fingerprintId, xUser, xCredit, xSubscription, isLoading, isInitialized, error } = useFingerprintContext();
49
50
  const [isOpen, setIsOpen] = React.useState(false);
51
+ const modalRef = React.useRef(null);
50
52
  const handleToggle = () => {
51
53
  setIsOpen(!isOpen);
52
54
  };
55
+ const handleBackdropClick = (e) => {
56
+ if (e.target === e.currentTarget) {
57
+ setIsOpen(false);
58
+ }
59
+ };
60
+ // ESC键关闭弹框
61
+ React.useEffect(() => {
62
+ const handleEscKey = (e) => {
63
+ if (e.key === 'Escape' && isOpen) {
64
+ setIsOpen(false);
65
+ }
66
+ };
67
+ if (isOpen) {
68
+ document.addEventListener('keydown', handleEscKey);
69
+ }
70
+ return () => {
71
+ document.removeEventListener('keydown', handleEscKey);
72
+ };
73
+ }, [isOpen]);
53
74
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { onClick: handleToggle, style: {
54
75
  position: 'fixed',
55
76
  top: '10px',
@@ -65,12 +86,11 @@ function FingerprintStatus() {
65
86
  alignItems: 'center',
66
87
  justifyContent: 'center',
67
88
  boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
68
- }, children: jsxRuntime.jsx("span", { style: {
69
- fontSize: '24px',
89
+ }, children: jsxRuntime.jsx(server.globalLucideIcons.BTC, { size: 24, style: {
70
90
  color: 'white',
71
91
  transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
72
92
  transition: 'transform 0.3s ease',
73
- }, children: "\u25BC" }) }), isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { style: {
93
+ } }) }), isOpen && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { onClick: handleBackdropClick, style: {
74
94
  position: 'fixed',
75
95
  top: 0,
76
96
  left: 0,
@@ -78,7 +98,7 @@ function FingerprintStatus() {
78
98
  height: '100%',
79
99
  background: 'rgba(0, 0, 0, 0.5)',
80
100
  zIndex: 9998,
81
- } }), jsxRuntime.jsxs("div", { style: {
101
+ } }), jsxRuntime.jsxs("div", { ref: modalRef, style: {
82
102
  position: 'fixed',
83
103
  top: '70px',
84
104
  left: '10px',
@@ -87,11 +107,11 @@ function FingerprintStatus() {
87
107
  borderRadius: '5px',
88
108
  fontSize: '12px',
89
109
  fontFamily: 'monospace',
90
- maxWidth: '300px',
110
+ maxWidth: '500px',
91
111
  zIndex: 9999,
92
112
  border: '1px solid #ccc',
93
113
  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] }), 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", {})] }))] })] }))] }));
114
+ }, 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"] })), jsxRuntime.jsx("div", { children: xSubscription ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { 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", {})] })) : (jsxRuntime.jsx("strong", { children: "No Subscription, Default as Hobby Plan" })) })] })] }))] }));
95
115
  }
96
116
 
97
117
  exports.FingerprintProvider = FingerprintProvider;
@@ -1,7 +1,8 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { createContext, useContext, useState } from 'react';
3
+ import { createContext, useContext, useState, useRef, useEffect } from 'react';
4
4
  import { useFingerprint } from './use-fingerprint.mjs';
5
+ import { globalLucideIcons } from '@windrun-huaiin/base-ui/components/server';
5
6
 
6
7
  const FingerprintContext = createContext(undefined);
7
8
  /**
@@ -45,9 +46,29 @@ function withFingerprint(Component, config) {
45
46
  function FingerprintStatus() {
46
47
  const { fingerprintId, xUser, xCredit, xSubscription, isLoading, isInitialized, error } = useFingerprintContext();
47
48
  const [isOpen, setIsOpen] = useState(false);
49
+ const modalRef = useRef(null);
48
50
  const handleToggle = () => {
49
51
  setIsOpen(!isOpen);
50
52
  };
53
+ const handleBackdropClick = (e) => {
54
+ if (e.target === e.currentTarget) {
55
+ setIsOpen(false);
56
+ }
57
+ };
58
+ // ESC键关闭弹框
59
+ useEffect(() => {
60
+ const handleEscKey = (e) => {
61
+ if (e.key === 'Escape' && isOpen) {
62
+ setIsOpen(false);
63
+ }
64
+ };
65
+ if (isOpen) {
66
+ document.addEventListener('keydown', handleEscKey);
67
+ }
68
+ return () => {
69
+ document.removeEventListener('keydown', handleEscKey);
70
+ };
71
+ }, [isOpen]);
51
72
  return (jsxs(Fragment, { children: [jsx("button", { onClick: handleToggle, style: {
52
73
  position: 'fixed',
53
74
  top: '10px',
@@ -63,12 +84,11 @@ function FingerprintStatus() {
63
84
  alignItems: 'center',
64
85
  justifyContent: 'center',
65
86
  boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)',
66
- }, children: jsx("span", { style: {
67
- fontSize: '24px',
87
+ }, children: jsx(globalLucideIcons.BTC, { size: 24, style: {
68
88
  color: 'white',
69
89
  transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
70
90
  transition: 'transform 0.3s ease',
71
- }, children: "\u25BC" }) }), isOpen && (jsxs(Fragment, { children: [jsx("div", { style: {
91
+ } }) }), isOpen && (jsxs(Fragment, { children: [jsx("div", { onClick: handleBackdropClick, style: {
72
92
  position: 'fixed',
73
93
  top: 0,
74
94
  left: 0,
@@ -76,7 +96,7 @@ function FingerprintStatus() {
76
96
  height: '100%',
77
97
  background: 'rgba(0, 0, 0, 0.5)',
78
98
  zIndex: 9998,
79
- } }), jsxs("div", { style: {
99
+ } }), jsxs("div", { ref: modalRef, style: {
80
100
  position: 'fixed',
81
101
  top: '70px',
82
102
  left: '10px',
@@ -85,11 +105,11 @@ function FingerprintStatus() {
85
105
  borderRadius: '5px',
86
106
  fontSize: '12px',
87
107
  fontFamily: 'monospace',
88
- maxWidth: '300px',
108
+ maxWidth: '500px',
89
109
  zIndex: 9999,
90
110
  border: '1px solid #ccc',
91
111
  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] }), 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", {})] }))] })] }))] }));
112
+ }, 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"] })), jsx("div", { children: xSubscription ? (jsxs(Fragment, { 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", {})] })) : (jsx("strong", { children: "No Subscription, Default as Hobby Plan" })) })] })] }))] }));
93
113
  }
94
114
 
95
115
  export { FingerprintProvider, FingerprintStatus, useFingerprintContext, useFingerprintContextSafe, withFingerprint };
@@ -81,7 +81,7 @@ function useFingerprint(config) {
81
81
  finally {
82
82
  setIsLoading(false);
83
83
  }
84
- }), [fingerprintId]);
84
+ }), [fingerprintId, config.apiEndpoint]);
85
85
  /**
86
86
  * 刷新用户数据
87
87
  */
@@ -79,7 +79,7 @@ function useFingerprint(config) {
79
79
  finally {
80
80
  setIsLoading(false);
81
81
  }
82
- }), [fingerprintId]);
82
+ }), [fingerprintId, config.apiEndpoint]);
83
83
  /**
84
84
  * 刷新用户数据
85
85
  */
package/dist/main/faq.js CHANGED
@@ -12,6 +12,17 @@ require('next/image');
12
12
  require('@windrun-huaiin/base-ui/ui');
13
13
  var faqInteractive = require('./faq-interactive.js');
14
14
  require('next/navigation');
15
+ require('@clerk/nextjs');
16
+ require('../clerk/fingerprint/fingerprint-provider.js');
17
+ require('react-dom/client');
18
+ require('next-themes');
19
+ require('fumadocs-core/framework');
20
+ require('next/link');
21
+ require('fumadocs-ui/utils/use-copy-button');
22
+ require('fumadocs-core/link');
23
+ require('fumadocs-ui/components/ui/collapsible');
24
+ require('../fuma/mdx/banner.js');
25
+ require('./money-price/money-price-types.js');
15
26
 
16
27
  function FAQ(_a) {
17
28
  return tslib_es6.__awaiter(this, arguments, void 0, function* ({ locale, sectionClassName }) {
package/dist/main/faq.mjs CHANGED
@@ -10,6 +10,17 @@ import 'next/image';
10
10
  import '@windrun-huaiin/base-ui/ui';
11
11
  import { FAQInteractive } from './faq-interactive.mjs';
12
12
  import 'next/navigation';
13
+ import '@clerk/nextjs';
14
+ import '../clerk/fingerprint/fingerprint-provider.mjs';
15
+ import 'react-dom/client';
16
+ import 'next-themes';
17
+ import 'fumadocs-core/framework';
18
+ import 'next/link';
19
+ import 'fumadocs-ui/utils/use-copy-button';
20
+ import 'fumadocs-core/link';
21
+ import 'fumadocs-ui/components/ui/collapsible';
22
+ import '../fuma/mdx/banner.mjs';
23
+ import './money-price/money-price-types.mjs';
13
24
 
14
25
  function FAQ(_a) {
15
26
  return __awaiter(this, arguments, void 0, function* ({ locale, sectionClassName }) {
@@ -12,6 +12,17 @@ require('@windrun-huaiin/base-ui/ui');
12
12
  require('./rich-text-expert.js');
13
13
  require('next/navigation');
14
14
  var galleryInteractive = require('./gallery-interactive.js');
15
+ require('@clerk/nextjs');
16
+ require('../clerk/fingerprint/fingerprint-provider.js');
17
+ require('react-dom/client');
18
+ require('next-themes');
19
+ require('fumadocs-core/framework');
20
+ require('next/link');
21
+ require('fumadocs-ui/utils/use-copy-button');
22
+ require('fumadocs-core/link');
23
+ require('fumadocs-ui/components/ui/collapsible');
24
+ require('../fuma/mdx/banner.js');
25
+ require('./money-price/money-price-types.js');
15
26
 
16
27
  function Gallery(_a) {
17
28
  return tslib_es6.__awaiter(this, arguments, void 0, function* ({ locale, sectionClassName, button }) {
@@ -10,6 +10,17 @@ import '@windrun-huaiin/base-ui/ui';
10
10
  import './rich-text-expert.mjs';
11
11
  import 'next/navigation';
12
12
  import { GalleryInteractive } from './gallery-interactive.mjs';
13
+ import '@clerk/nextjs';
14
+ import '../clerk/fingerprint/fingerprint-provider.mjs';
15
+ import 'react-dom/client';
16
+ import 'next-themes';
17
+ import 'fumadocs-core/framework';
18
+ import 'next/link';
19
+ import 'fumadocs-ui/utils/use-copy-button';
20
+ import 'fumadocs-core/link';
21
+ import 'fumadocs-ui/components/ui/collapsible';
22
+ import '../fuma/mdx/banner.mjs';
23
+ import './money-price/money-price-types.mjs';
13
24
 
14
25
  function Gallery(_a) {
15
26
  return __awaiter(this, arguments, void 0, function* ({ locale, sectionClassName, button }) {
@@ -8,3 +8,5 @@ export * from './rich-text-expert';
8
8
  export * from './faq-interactive';
9
9
  export * from './price-plan-interactive';
10
10
  export * from './gallery-interactive';
11
+ export { MoneyPriceInteractive } from './money-price/money-price-interactive';
12
+ export { MoneyPriceButton } from './money-price/money-price-button';
@@ -11,6 +11,8 @@ var richTextExpert = require('./rich-text-expert.js');
11
11
  var faqInteractive = require('./faq-interactive.js');
12
12
  var pricePlanInteractive = require('./price-plan-interactive.js');
13
13
  var galleryInteractive = require('./gallery-interactive.js');
14
+ var moneyPriceInteractive = require('./money-price/money-price-interactive.js');
15
+ var moneyPriceButton = require('./money-price/money-price-button.js');
14
16
 
15
17
 
16
18
 
@@ -25,3 +27,5 @@ exports.richText = richTextExpert.richText;
25
27
  exports.FAQInteractive = faqInteractive.FAQInteractive;
26
28
  exports.PricePlanInteractive = pricePlanInteractive.PricePlanInteractive;
27
29
  exports.GalleryInteractive = galleryInteractive.GalleryInteractive;
30
+ exports.MoneyPriceInteractive = moneyPriceInteractive.MoneyPriceInteractive;
31
+ exports.MoneyPriceButton = moneyPriceButton.MoneyPriceButton;
@@ -9,3 +9,5 @@ export { createRichTextRenderer, richText } from './rich-text-expert.mjs';
9
9
  export { FAQInteractive } from './faq-interactive.mjs';
10
10
  export { PricePlanInteractive } from './price-plan-interactive.mjs';
11
11
  export { GalleryInteractive } from './gallery-interactive.mjs';
12
+ export { MoneyPriceInteractive } from './money-price/money-price-interactive.mjs';
13
+ export { MoneyPriceButton } from './money-price/money-price-button.mjs';
@@ -0,0 +1,2 @@
1
+ import { type MoneyPriceButtonProps } from './money-price-types';
2
+ export declare function MoneyPriceButton({ planKey, userContext, billingType, onLogin, onUpgrade, texts, isProcessing }: MoneyPriceButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,96 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ 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');
6
+ var server = require('@windrun-huaiin/base-ui/components/server');
7
+ require('next-themes');
8
+ require('react');
9
+ require('fumadocs-core/framework');
10
+ require('@windrun-huaiin/lib/utils');
11
+ require('next/link');
12
+ var gradientButton = require('../../fuma/mdx/gradient-button.js');
13
+ require('next/navigation');
14
+ require('fumadocs-ui/utils/use-copy-button');
15
+ require('fumadocs-core/link');
16
+ require('@windrun-huaiin/base-ui/ui');
17
+ require('fumadocs-ui/components/ui/collapsible');
18
+ require('../../fuma/mdx/banner.js');
19
+ var moneyPriceTypes = require('./money-price-types.js');
20
+
21
+ function capitalize(str) {
22
+ return str.charAt(0).toUpperCase() + str.slice(1);
23
+ }
24
+ function MoneyPriceButton({ planKey, userContext, billingType, onLogin, onUpgrade, texts, isProcessing = false }) {
25
+ const { isAuthenticated, subscriptionStatus } = userContext;
26
+ // 决定按钮显示和行为
27
+ const getButtonConfig = () => {
28
+ // 匿名用户
29
+ if (!isAuthenticated) {
30
+ const textKey = planKey === 'free' ? 'getStarted' : `get${capitalize(planKey)}`;
31
+ return {
32
+ text: texts[textKey] || texts.getStarted,
33
+ onClick: onLogin,
34
+ disabled: false,
35
+ hidden: false,
36
+ icon: jsxRuntime.jsx(server.globalLucideIcons.ArrowRight, {})
37
+ };
38
+ }
39
+ // 已登录用户
40
+ switch (subscriptionStatus) {
41
+ case moneyPriceTypes.UserState.FreeUser:
42
+ if (planKey === 'free') {
43
+ return {
44
+ text: texts.currentPlan,
45
+ disabled: true,
46
+ hidden: false,
47
+ icon: jsxRuntime.jsx(server.globalLucideIcons.GlobeLock, {})
48
+ };
49
+ }
50
+ const getFreeUserText = planKey === 'pro' ? texts.getPro : texts.getUltra;
51
+ return {
52
+ text: getFreeUserText,
53
+ onClick: () => onUpgrade(planKey, billingType),
54
+ disabled: false,
55
+ hidden: false,
56
+ icon: jsxRuntime.jsx(server.globalLucideIcons.ArrowRight, {})
57
+ };
58
+ case moneyPriceTypes.UserState.ProUser:
59
+ if (planKey === 'free')
60
+ return { hidden: true };
61
+ if (planKey === 'pro') {
62
+ return {
63
+ text: texts.currentPlan,
64
+ disabled: true,
65
+ hidden: false,
66
+ icon: jsxRuntime.jsx(server.globalLucideIcons.GlobeLock, {})
67
+ };
68
+ }
69
+ return {
70
+ text: texts.upgrade,
71
+ onClick: () => onUpgrade('ultra', billingType),
72
+ disabled: false,
73
+ hidden: false,
74
+ icon: jsxRuntime.jsx(server.globalLucideIcons.ArrowRight, {})
75
+ };
76
+ case moneyPriceTypes.UserState.UltraUser:
77
+ if (planKey !== 'ultra')
78
+ return { hidden: true };
79
+ return {
80
+ text: texts.currentPlan,
81
+ disabled: true,
82
+ hidden: false,
83
+ icon: jsxRuntime.jsx(server.globalLucideIcons.GlobeLock, {})
84
+ };
85
+ default:
86
+ return { text: '', disabled: true, hidden: true };
87
+ }
88
+ };
89
+ const config = getButtonConfig();
90
+ if (config.hidden)
91
+ return null;
92
+ // 使用 GradientButton 组件
93
+ return (jsxRuntime.jsx(gradientButton.GradientButton, { title: config.text, icon: config.icon, onClick: config.onClick, disabled: config.disabled || isProcessing, align: "center", className: "w-full", preventDoubleClick: true, loadingText: "Processing..." }));
94
+ }
95
+
96
+ exports.MoneyPriceButton = MoneyPriceButton;
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ 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';
4
+ import { globalLucideIcons } from '@windrun-huaiin/base-ui/components/server';
5
+ import 'next-themes';
6
+ import 'react';
7
+ import 'fumadocs-core/framework';
8
+ import '@windrun-huaiin/lib/utils';
9
+ import 'next/link';
10
+ import { GradientButton } from '../../fuma/mdx/gradient-button.mjs';
11
+ import 'next/navigation';
12
+ import 'fumadocs-ui/utils/use-copy-button';
13
+ import 'fumadocs-core/link';
14
+ import '@windrun-huaiin/base-ui/ui';
15
+ import 'fumadocs-ui/components/ui/collapsible';
16
+ import '../../fuma/mdx/banner.mjs';
17
+ import { UserState } from './money-price-types.mjs';
18
+
19
+ function capitalize(str) {
20
+ return str.charAt(0).toUpperCase() + str.slice(1);
21
+ }
22
+ function MoneyPriceButton({ planKey, userContext, billingType, onLogin, onUpgrade, texts, isProcessing = false }) {
23
+ const { isAuthenticated, subscriptionStatus } = userContext;
24
+ // 决定按钮显示和行为
25
+ const getButtonConfig = () => {
26
+ // 匿名用户
27
+ if (!isAuthenticated) {
28
+ const textKey = planKey === 'free' ? 'getStarted' : `get${capitalize(planKey)}`;
29
+ return {
30
+ text: texts[textKey] || texts.getStarted,
31
+ onClick: onLogin,
32
+ disabled: false,
33
+ hidden: false,
34
+ icon: jsx(globalLucideIcons.ArrowRight, {})
35
+ };
36
+ }
37
+ // 已登录用户
38
+ switch (subscriptionStatus) {
39
+ case UserState.FreeUser:
40
+ if (planKey === 'free') {
41
+ return {
42
+ text: texts.currentPlan,
43
+ disabled: true,
44
+ hidden: false,
45
+ icon: jsx(globalLucideIcons.GlobeLock, {})
46
+ };
47
+ }
48
+ const getFreeUserText = planKey === 'pro' ? texts.getPro : texts.getUltra;
49
+ return {
50
+ text: getFreeUserText,
51
+ onClick: () => onUpgrade(planKey, billingType),
52
+ disabled: false,
53
+ hidden: false,
54
+ icon: jsx(globalLucideIcons.ArrowRight, {})
55
+ };
56
+ case UserState.ProUser:
57
+ if (planKey === 'free')
58
+ return { hidden: true };
59
+ if (planKey === 'pro') {
60
+ return {
61
+ text: texts.currentPlan,
62
+ disabled: true,
63
+ hidden: false,
64
+ icon: jsx(globalLucideIcons.GlobeLock, {})
65
+ };
66
+ }
67
+ return {
68
+ text: texts.upgrade,
69
+ onClick: () => onUpgrade('ultra', billingType),
70
+ disabled: false,
71
+ hidden: false,
72
+ icon: jsx(globalLucideIcons.ArrowRight, {})
73
+ };
74
+ case UserState.UltraUser:
75
+ if (planKey !== 'ultra')
76
+ return { hidden: true };
77
+ return {
78
+ text: texts.currentPlan,
79
+ disabled: true,
80
+ hidden: false,
81
+ icon: jsx(globalLucideIcons.GlobeLock, {})
82
+ };
83
+ default:
84
+ return { text: '', disabled: true, hidden: true };
85
+ }
86
+ };
87
+ const config = getButtonConfig();
88
+ if (config.hidden)
89
+ return null;
90
+ // 使用 GradientButton 组件
91
+ return (jsx(GradientButton, { title: config.text, icon: config.icon, onClick: config.onClick, disabled: config.disabled || isProcessing, align: "center", className: "w-full", preventDoubleClick: true, loadingText: "Processing..." }));
92
+ }
93
+
94
+ export { MoneyPriceButton };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Money Price Configuration
3
+ * 价格组件配置文件
4
+ */
5
+ import type { MoneyPriceConfig, PaymentProviderConfig, EnhancePricePlan } from './money-price-types';
6
+ export declare function getActiveProviderConfig(config: MoneyPriceConfig): PaymentProviderConfig;
7
+ export declare function getProductPricing(productKey: 'free' | 'pro' | 'ultra', billingType: 'monthly' | 'yearly', provider: string, config: MoneyPriceConfig): EnhancePricePlan;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Money Price Configuration
5
+ * 价格组件配置文件
6
+ */
7
+ // 辅助函数:获取当前激活的支付供应商配置
8
+ function getActiveProviderConfig(config) {
9
+ const provider = config.activeProvider;
10
+ return config.paymentProviders[provider];
11
+ }
12
+ // 辅助函数:获取特定产品的价格信息
13
+ function getProductPricing(productKey, billingType, provider, config) {
14
+ const providerConfig = config.paymentProviders[provider];
15
+ return providerConfig.products[productKey].plans[billingType];
16
+ }
17
+
18
+ exports.getActiveProviderConfig = getActiveProviderConfig;
19
+ exports.getProductPricing = getProductPricing;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Money Price Configuration
3
+ * 价格组件配置文件
4
+ */
5
+ // 辅助函数:获取当前激活的支付供应商配置
6
+ function getActiveProviderConfig(config) {
7
+ const provider = config.activeProvider;
8
+ return config.paymentProviders[provider];
9
+ }
10
+ // 辅助函数:获取特定产品的价格信息
11
+ function getProductPricing(productKey, billingType, provider, config) {
12
+ const providerConfig = config.paymentProviders[provider];
13
+ return providerConfig.products[productKey].plans[billingType];
14
+ }
15
+
16
+ export { getActiveProviderConfig, getProductPricing };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Money Price Configuration
3
+ * 价格组件配置文件
4
+ */
5
+ import type { MoneyPriceConfig, PaymentProviderConfig, EnhancePricePlan } from './money-price-types';
6
+ export declare const moneyPriceConfig: MoneyPriceConfig;
7
+ export declare function getActiveProviderConfig(config: MoneyPriceConfig): PaymentProviderConfig;
8
+ export declare function getProductPricing(productKey: 'free' | 'pro' | 'ultra', billingType: 'monthly' | 'yearly', provider: string, config: MoneyPriceConfig): EnhancePricePlan;