@windrun-huaiin/third-ui 26.0.0 → 28.0.0

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 (210) hide show
  1. package/dist/ai/ai-prompt-textarea.d.ts +72 -0
  2. package/dist/ai/ai-prompt-textarea.js +114 -0
  3. package/dist/ai/ai-prompt-textarea.mjs +112 -0
  4. package/dist/ai/index.d.ts +1 -0
  5. package/dist/ai/index.js +2 -0
  6. package/dist/ai/index.mjs +1 -0
  7. package/dist/clerk/clerk-provider-client.js +0 -1
  8. package/dist/clerk/clerk-provider-client.mjs +0 -1
  9. package/dist/clerk/fingerprint/fingerprint-client.js +0 -4
  10. package/dist/clerk/fingerprint/fingerprint-client.mjs +0 -4
  11. package/dist/clerk/fingerprint/use-fingerprint.js +0 -6
  12. package/dist/clerk/fingerprint/use-fingerprint.mjs +0 -6
  13. package/dist/clerk/signin-with-fingerprint-client.js +0 -9
  14. package/dist/clerk/signin-with-fingerprint-client.mjs +0 -9
  15. package/dist/clerk/signup-button-with-fingerprint-client.js +0 -16
  16. package/dist/clerk/signup-button-with-fingerprint-client.mjs +0 -16
  17. package/dist/clerk/signup-with-fingerprint-client.js +0 -9
  18. package/dist/clerk/signup-with-fingerprint-client.mjs +0 -9
  19. package/dist/fuma/base/custom-header.js +10 -8
  20. package/dist/fuma/base/custom-header.mjs +10 -8
  21. package/dist/fuma/base/custom-home-layout.d.ts +0 -4
  22. package/dist/fuma/base/docs-root-provider.d.ts +19 -0
  23. package/dist/fuma/base/docs-root-provider.js +17 -0
  24. package/dist/fuma/base/docs-root-provider.mjs +15 -0
  25. package/dist/fuma/base/index.d.ts +5 -0
  26. package/dist/fuma/base/index.js +16 -7
  27. package/dist/fuma/base/index.mjs +5 -1
  28. package/dist/fuma/base/nav-config.d.ts +10 -0
  29. package/dist/fuma/base/nav-config.js +32 -0
  30. package/dist/fuma/base/nav-config.mjs +28 -0
  31. package/dist/fuma/base/site-docs-layout.d.ts +11 -0
  32. package/dist/fuma/base/site-docs-layout.js +15 -0
  33. package/dist/fuma/base/site-docs-layout.mjs +13 -0
  34. package/dist/fuma/base/site-home-layout.d.ts +24 -0
  35. package/dist/fuma/base/site-home-layout.js +16 -0
  36. package/dist/fuma/base/site-home-layout.mjs +14 -0
  37. package/dist/fuma/base/site-layout-shared.d.ts +89 -0
  38. package/dist/fuma/base/site-layout-shared.js +48 -0
  39. package/dist/fuma/base/site-layout-shared.mjs +42 -0
  40. package/dist/fuma/base/site-layout.d.ts +4 -116
  41. package/dist/fuma/base/site-layout.js +2 -2
  42. package/dist/fuma/base/site-layout.mjs +2 -2
  43. package/dist/fuma/fuma-page-genarator.d.ts +1 -1
  44. package/dist/fuma/fuma-page-genarator.js +65 -10
  45. package/dist/fuma/fuma-page-genarator.mjs +61 -6
  46. package/dist/fuma/llm-copy-handler.js +0 -9
  47. package/dist/fuma/llm-copy-handler.mjs +0 -9
  48. package/dist/fuma/mdx/index.d.ts +0 -1
  49. package/dist/fuma/mdx/index.js +0 -2
  50. package/dist/fuma/mdx/index.mjs +0 -1
  51. package/dist/fuma/mdx/suno-embed.js +3 -1
  52. package/dist/fuma/mdx/suno-embed.mjs +3 -1
  53. package/dist/fuma/mdx/toc-base.js +0 -1
  54. package/dist/fuma/mdx/toc-base.mjs +0 -1
  55. package/dist/fuma/server/features/widgets.js +5 -1
  56. package/dist/fuma/server/features/widgets.mjs +5 -1
  57. package/dist/fuma/server/llm-copy-handler.d.ts +2 -0
  58. package/dist/fuma/server/llm-copy-handler.js +7 -0
  59. package/dist/fuma/server/llm-copy-handler.mjs +1 -0
  60. package/dist/fuma/server/page-generator.d.ts +2 -0
  61. package/dist/fuma/server/page-generator.js +7 -0
  62. package/dist/fuma/server/page-generator.mjs +1 -0
  63. package/dist/lib/seo-metadata.js +3 -3
  64. package/dist/lib/seo-metadata.mjs +1 -1
  65. package/dist/lib/seo-util.js +4 -4
  66. package/dist/lib/seo-util.mjs +1 -1
  67. package/dist/lib/site-docs-helper.d.ts +51 -0
  68. package/dist/lib/site-docs-helper.js +68 -0
  69. package/dist/lib/site-docs-helper.mjs +66 -0
  70. package/dist/main/alert-dialog/index.js +14 -0
  71. package/dist/main/alert-dialog/index.mjs +5 -0
  72. package/dist/main/buttons/gradient-button.d.ts +20 -0
  73. package/dist/main/buttons/gradient-button.js +88 -0
  74. package/dist/main/buttons/gradient-button.mjs +86 -0
  75. package/dist/main/buttons/index.d.ts +3 -0
  76. package/dist/main/buttons/index.js +12 -0
  77. package/dist/main/buttons/index.mjs +4 -0
  78. package/dist/main/buttons/x-button.d.ts +39 -0
  79. package/dist/main/buttons/x-button.js +92 -0
  80. package/dist/main/buttons/x-button.mjs +90 -0
  81. package/dist/main/buttons/x-toggle-button.d.ts +32 -0
  82. package/dist/main/buttons/x-toggle-button.js +95 -0
  83. package/dist/main/buttons/x-toggle-button.mjs +74 -0
  84. package/dist/main/credit/credit-nav-button.js +25 -1
  85. package/dist/main/credit/credit-nav-button.mjs +25 -1
  86. package/dist/main/credit/credit-overview-client.js +3 -2
  87. package/dist/main/credit/credit-overview-client.mjs +3 -2
  88. package/dist/main/credit/index.d.ts +4 -0
  89. package/dist/main/credit/index.js +10 -0
  90. package/dist/main/credit/index.mjs +3 -0
  91. package/dist/main/credit/server.d.ts +2 -0
  92. package/dist/main/credit/server.js +7 -0
  93. package/dist/main/credit/server.mjs +1 -0
  94. package/dist/main/cta.js +4 -2
  95. package/dist/main/cta.mjs +4 -2
  96. package/dist/main/footer.js +3 -3
  97. package/dist/main/footer.mjs +1 -1
  98. package/dist/main/hero/index.d.ts +2 -0
  99. package/dist/main/hero/index.js +10 -0
  100. package/dist/main/hero/index.mjs +3 -0
  101. package/dist/main/home/server.d.ts +7 -0
  102. package/dist/main/home/server.js +19 -0
  103. package/dist/main/home/server.mjs +7 -0
  104. package/dist/main/index.d.ts +0 -15
  105. package/dist/main/index.js +0 -43
  106. package/dist/main/index.mjs +0 -21
  107. package/dist/main/loading/index.d.ts +1 -0
  108. package/dist/main/loading/index.js +9 -0
  109. package/dist/main/loading/index.mjs +2 -0
  110. package/dist/main/loading-frame/index.d.ts +1 -0
  111. package/dist/main/loading-frame/index.js +9 -0
  112. package/dist/main/loading-frame/index.mjs +2 -0
  113. package/dist/main/money-price/index.d.ts +4 -0
  114. package/dist/main/money-price/index.js +15 -0
  115. package/dist/main/money-price/index.mjs +4 -0
  116. package/dist/main/money-price/money-price-button.d.ts +1 -1
  117. package/dist/main/money-price/money-price-button.js +12 -9
  118. package/dist/main/money-price/money-price-button.mjs +12 -9
  119. package/dist/main/money-price/money-price-interactive.d.ts +1 -1
  120. package/dist/main/money-price/money-price-interactive.js +22 -25
  121. package/dist/main/money-price/money-price-interactive.mjs +22 -25
  122. package/dist/main/money-price/money-price-types.d.ts +2 -0
  123. package/dist/main/money-price/server.d.ts +5 -0
  124. package/dist/main/money-price/server.js +18 -0
  125. package/dist/main/money-price/server.mjs +4 -0
  126. package/package.json +94 -4
  127. package/src/ai/index.ts +1 -0
  128. package/src/clerk/clerk-provider-client.tsx +1 -3
  129. package/src/clerk/fingerprint/fingerprint-client.ts +0 -4
  130. package/src/clerk/fingerprint/use-fingerprint.ts +0 -6
  131. package/src/clerk/signin-with-fingerprint-client.tsx +0 -10
  132. package/src/clerk/signup-button-with-fingerprint-client.tsx +0 -17
  133. package/src/clerk/signup-with-fingerprint-client.tsx +0 -10
  134. package/src/fuma/base/custom-header.tsx +12 -8
  135. package/src/fuma/base/custom-home-layout.tsx +3 -6
  136. package/src/fuma/base/docs-root-provider.tsx +58 -0
  137. package/src/fuma/base/index.ts +5 -0
  138. package/src/fuma/base/nav-config.ts +81 -0
  139. package/src/fuma/base/site-docs-layout.tsx +35 -0
  140. package/src/fuma/base/site-home-layout.tsx +78 -0
  141. package/src/fuma/base/site-layout-shared.tsx +190 -0
  142. package/src/fuma/base/site-layout.tsx +4 -289
  143. package/src/fuma/fuma-banner-suit.tsx +1 -1
  144. package/src/fuma/fuma-page-genarator.tsx +61 -8
  145. package/src/fuma/llm-copy-handler.ts +0 -11
  146. package/src/fuma/mdx/index.ts +0 -1
  147. package/src/fuma/mdx/suno-embed.tsx +1 -1
  148. package/src/fuma/mdx/toc-base.tsx +0 -1
  149. package/src/fuma/mdx/toc-footer-wrapper.tsx +2 -2
  150. package/src/fuma/server/features/widgets.tsx +1 -1
  151. package/src/fuma/server/llm-copy-handler.ts +2 -0
  152. package/src/fuma/server/page-generator.ts +2 -0
  153. package/src/lib/seo-metadata.ts +1 -1
  154. package/src/lib/seo-util.ts +2 -2
  155. package/src/lib/server.ts +1 -1
  156. package/src/{fuma/mdx → main/buttons}/gradient-button.tsx +10 -21
  157. package/src/main/buttons/index.ts +5 -0
  158. package/src/main/{x-button.tsx → buttons/x-button.tsx} +28 -42
  159. package/src/main/credit/credit-nav-button.tsx +36 -3
  160. package/src/main/credit/credit-overview-client.tsx +1 -1
  161. package/src/main/credit/index.ts +11 -0
  162. package/src/main/credit/server.ts +7 -0
  163. package/src/main/cta.tsx +1 -1
  164. package/src/main/footer.tsx +1 -2
  165. package/src/main/hero/index.ts +4 -0
  166. package/src/main/home/server.ts +7 -0
  167. package/src/main/index.ts +1 -20
  168. package/src/main/language-detector.tsx +0 -1
  169. package/src/main/loading/index.ts +3 -0
  170. package/src/main/loading-frame/index.ts +3 -0
  171. package/src/main/money-price/index.ts +18 -0
  172. package/src/main/money-price/money-price-button.tsx +17 -9
  173. package/src/main/money-price/money-price-interactive.tsx +30 -25
  174. package/src/main/money-price/money-price-types.ts +2 -0
  175. package/src/main/money-price/server.ts +22 -0
  176. package/dist/fuma/mdx/features.d.ts +0 -8
  177. package/dist/fuma/mdx/features.js +0 -92
  178. package/dist/fuma/mdx/features.mjs +0 -85
  179. package/dist/fuma/mdx/image-grid.d.ts +0 -6
  180. package/dist/fuma/mdx/image-grid.js +0 -17
  181. package/dist/fuma/mdx/image-grid.mjs +0 -15
  182. package/dist/fuma/mdx/image-zoom.d.ts +0 -22
  183. package/dist/fuma/mdx/image-zoom.js +0 -39
  184. package/dist/fuma/mdx/image-zoom.mjs +0 -37
  185. package/dist/fuma/mdx/markdown-component-map.d.ts +0 -3
  186. package/dist/fuma/mdx/markdown-component-map.js +0 -79
  187. package/dist/fuma/mdx/markdown-component-map.mjs +0 -77
  188. package/dist/fuma/mdx/math.d.ts +0 -17
  189. package/dist/fuma/mdx/math.js +0 -60
  190. package/dist/fuma/mdx/math.mjs +0 -57
  191. package/dist/fuma/mdx/mermaid.d.ts +0 -13
  192. package/dist/fuma/mdx/mermaid.js +0 -360
  193. package/dist/fuma/mdx/mermaid.mjs +0 -358
  194. package/dist/fuma/mdx/site-mdx-components.d.ts +0 -13
  195. package/dist/fuma/mdx/site-mdx-components.js +0 -19
  196. package/dist/fuma/mdx/site-mdx-components.mjs +0 -17
  197. package/dist/fuma/mdx/site-mdx-presets.d.ts +0 -13
  198. package/dist/fuma/mdx/site-mdx-presets.js +0 -49
  199. package/dist/fuma/mdx/site-mdx-presets.mjs +0 -45
  200. package/dist/fuma/server/optional-features.d.ts +0 -6
  201. package/dist/fuma/server/optional-features.js +0 -17
  202. package/dist/fuma/server/optional-features.mjs +0 -6
  203. package/dist/fuma/server/site-mdx-components.d.ts +0 -13
  204. package/dist/fuma/server/site-mdx-components.js +0 -18
  205. package/dist/fuma/server/site-mdx-components.mjs +0 -16
  206. package/dist/fuma/server/site-mdx-presets.d.ts +0 -195
  207. package/dist/fuma/server/site-mdx-presets.js +0 -55
  208. package/dist/fuma/server/site-mdx-presets.mjs +0 -52
  209. /package/src/{main → ai}/ai-prompt-textarea.tsx +0 -0
  210. /package/src/main/{x-toggle-button.tsx → buttons/x-toggle-button.tsx} +0 -0
@@ -1,21 +1,6 @@
1
1
  export * from './go-to-top';
2
2
  export * from './loading';
3
3
  export * from './nprogress-bar';
4
- export * from './alert-dialog';
5
- export * from './x-button';
6
- export * from './x-toggle-button';
7
- export * from './ai-prompt-textarea';
8
4
  export * from './rich-text-expert';
9
5
  export * from './faq-interactive';
10
- export * from './price-plan-interactive';
11
- export * from './gallery/gallery-interactive';
12
- export * from './delayed-img';
13
- export * from './snake-loading-frame';
14
- export * from './pill-select';
15
- export { MoneyPriceInteractive } from './money-price/money-price-interactive';
16
- export { MoneyPriceButton } from './money-price/money-price-button';
17
- export { CreditOverviewClient } from './credit/credit-overview-client';
18
- export { CreditNavButton } from './credit/credit-nav-button';
19
- export { HeroMedia } from './hero-media';
20
- export { HeroSection } from './hero-section';
21
6
  export { InfoTooltip } from './info-tooltip';
@@ -4,29 +4,8 @@
4
4
  var goToTop = require('./go-to-top.js');
5
5
  var loading = require('./loading.js');
6
6
  var nprogressBar = require('./nprogress-bar.js');
7
- var adsAlertDialog = require('./alert-dialog/ads-alert-dialog.js');
8
- var confirmDialog = require('./alert-dialog/confirm-dialog.js');
9
- var highPriorityConfirmDialog = require('./alert-dialog/high-priority-confirm-dialog.js');
10
- var infoDialog = require('./alert-dialog/info-dialog.js');
11
- var xButton = require('./x-button.js');
12
- var xToggleButton = require('./x-toggle-button.js');
13
- var aiPromptTextarea = require('./ai-prompt-textarea.js');
14
7
  var richTextExpert = require('./rich-text-expert.js');
15
8
  var faqInteractive = require('./faq-interactive.js');
16
- var pricePlanInteractive = require('./price-plan-interactive.js');
17
- var galleryInteractive = require('./gallery/gallery-interactive.js');
18
- var delayedImg = require('./delayed-img.js');
19
- var snakeLoadingFrame = require('./snake-loading-frame.js');
20
- var xPillSelect = require('./pill-select/x-pill-select.js');
21
- var xFilterPills = require('./pill-select/x-filter-pills.js');
22
- var xFormPills = require('./pill-select/x-form-pills.js');
23
- var xTokenInput = require('./pill-select/x-token-input.js');
24
- var moneyPriceInteractive = require('./money-price/money-price-interactive.js');
25
- var moneyPriceButton = require('./money-price/money-price-button.js');
26
- var creditOverviewClient = require('./credit/credit-overview-client.js');
27
- var creditNavButton = require('./credit/credit-nav-button.js');
28
- var heroMedia = require('./hero-media.js');
29
- var heroSection = require('./hero-section.js');
30
9
  var infoTooltip = require('./info-tooltip.js');
31
10
 
32
11
 
@@ -35,29 +14,7 @@ exports.GoToTop = goToTop.GoToTop;
35
14
  exports.Loading = loading.Loading;
36
15
  exports.getLoadingCycleDurationMs = loading.getLoadingCycleDurationMs;
37
16
  exports.NProgressBar = nprogressBar.NProgressBar;
38
- exports.AdsAlertDialog = adsAlertDialog.AdsAlertDialog;
39
- exports.ConfirmDialog = confirmDialog.ConfirmDialog;
40
- exports.HighPriorityConfirmDialog = highPriorityConfirmDialog.HighPriorityConfirmDialog;
41
- exports.InfoDialog = infoDialog.InfoDialog;
42
- exports.XButton = xButton.XButton;
43
- exports.XToggleButton = xToggleButton.XToggleButton;
44
- exports.AIPromptTextarea = aiPromptTextarea.AIPromptTextarea;
45
17
  exports.createRichTextRenderer = richTextExpert.createRichTextRenderer;
46
18
  exports.richText = richTextExpert.richText;
47
19
  exports.FAQInteractive = faqInteractive.FAQInteractive;
48
- exports.PricePlanInteractive = pricePlanInteractive.PricePlanInteractive;
49
- exports.GalleryInteractive = galleryInteractive.GalleryInteractive;
50
- exports.DelayedImg = delayedImg.DelayedImg;
51
- exports.SnakeLoadingFrame = snakeLoadingFrame.SnakeLoadingFrame;
52
- exports.SnakeLoadingPreview = snakeLoadingFrame.SnakeLoadingPreview;
53
- exports.XPillSelect = xPillSelect.XPillSelect;
54
- exports.XFilterPills = xFilterPills.XFilterPills;
55
- exports.XFormPills = xFormPills.XFormPills;
56
- exports.XTokenInput = xTokenInput.XTokenInput;
57
- exports.MoneyPriceInteractive = moneyPriceInteractive.MoneyPriceInteractive;
58
- exports.MoneyPriceButton = moneyPriceButton.MoneyPriceButton;
59
- exports.CreditOverviewClient = creditOverviewClient.CreditOverviewClient;
60
- exports.CreditNavButton = creditNavButton.CreditNavButton;
61
- exports.HeroMedia = heroMedia.HeroMedia;
62
- exports.HeroSection = heroSection.HeroSection;
63
20
  exports.InfoTooltip = infoTooltip.InfoTooltip;
@@ -2,27 +2,6 @@
2
2
  export { GoToTop } from './go-to-top.mjs';
3
3
  export { Loading, getLoadingCycleDurationMs } from './loading.mjs';
4
4
  export { NProgressBar } from './nprogress-bar.mjs';
5
- export { AdsAlertDialog } from './alert-dialog/ads-alert-dialog.mjs';
6
- export { ConfirmDialog } from './alert-dialog/confirm-dialog.mjs';
7
- export { HighPriorityConfirmDialog } from './alert-dialog/high-priority-confirm-dialog.mjs';
8
- export { InfoDialog } from './alert-dialog/info-dialog.mjs';
9
- export { XButton } from './x-button.mjs';
10
- export { XToggleButton } from './x-toggle-button.mjs';
11
- export { AIPromptTextarea } from './ai-prompt-textarea.mjs';
12
5
  export { createRichTextRenderer, richText } from './rich-text-expert.mjs';
13
6
  export { FAQInteractive } from './faq-interactive.mjs';
14
- export { PricePlanInteractive } from './price-plan-interactive.mjs';
15
- export { GalleryInteractive } from './gallery/gallery-interactive.mjs';
16
- export { DelayedImg } from './delayed-img.mjs';
17
- export { SnakeLoadingFrame, SnakeLoadingPreview } from './snake-loading-frame.mjs';
18
- export { XPillSelect } from './pill-select/x-pill-select.mjs';
19
- export { XFilterPills } from './pill-select/x-filter-pills.mjs';
20
- export { XFormPills } from './pill-select/x-form-pills.mjs';
21
- export { XTokenInput } from './pill-select/x-token-input.mjs';
22
- export { MoneyPriceInteractive } from './money-price/money-price-interactive.mjs';
23
- export { MoneyPriceButton } from './money-price/money-price-button.mjs';
24
- export { CreditOverviewClient } from './credit/credit-overview-client.mjs';
25
- export { CreditNavButton } from './credit/credit-nav-button.mjs';
26
- export { HeroMedia } from './hero-media.mjs';
27
- export { HeroSection } from './hero-section.mjs';
28
7
  export { InfoTooltip } from './info-tooltip.mjs';
@@ -0,0 +1 @@
1
+ export { Loading, getLoadingCycleDurationMs } from '../loading';
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var loading = require('../loading.js');
5
+
6
+
7
+
8
+ exports.Loading = loading.Loading;
9
+ exports.getLoadingCycleDurationMs = loading.getLoadingCycleDurationMs;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Loading, getLoadingCycleDurationMs } from '../loading.mjs';
@@ -0,0 +1 @@
1
+ export { SnakeLoadingFrame, SnakeLoadingPreview } from '../snake-loading-frame';
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var snakeLoadingFrame = require('../snake-loading-frame.js');
5
+
6
+
7
+
8
+ exports.SnakeLoadingFrame = snakeLoadingFrame.SnakeLoadingFrame;
9
+ exports.SnakeLoadingPreview = snakeLoadingFrame.SnakeLoadingPreview;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { SnakeLoadingFrame, SnakeLoadingPreview } from '../snake-loading-frame.mjs';
@@ -0,0 +1,4 @@
1
+ export { MoneyPriceInteractive } from './money-price-interactive';
2
+ export { MoneyPriceButton } from './money-price-button';
3
+ export type { MoneyPriceConfig, MoneyPriceData, InitUserContext, MoneyPriceInteractiveProps, MoneyPriceButtonProps, PaymentProvider, PaymentProviderConfig, EnhancePricePlan, SubscriptionProductConfig, CreditPackProductConfig, UserContext, } from './money-price-types';
4
+ export { UserState } from './money-price-types';
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var moneyPriceInteractive = require('./money-price-interactive.js');
5
+ var moneyPriceButton = require('./money-price-button.js');
6
+ var moneyPriceTypes = require('./money-price-types.js');
7
+
8
+
9
+
10
+ exports.MoneyPriceInteractive = moneyPriceInteractive.MoneyPriceInteractive;
11
+ exports.MoneyPriceButton = moneyPriceButton.MoneyPriceButton;
12
+ Object.defineProperty(exports, "UserState", {
13
+ enumerable: true,
14
+ get: function () { return moneyPriceTypes.UserState; }
15
+ });
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ export { MoneyPriceInteractive } from './money-price-interactive.mjs';
3
+ export { MoneyPriceButton } from './money-price-button.mjs';
4
+ export { UserState } from './money-price-types.mjs';
@@ -1,2 +1,2 @@
1
1
  import { type MoneyPriceButtonProps } from './money-price-types';
2
- export declare function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing, isInitLoading, enableSubscriptionUpgrade }: MoneyPriceButtonProps): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing, isAnyProcessing, isInitLoading, enableSubscriptionUpgrade }: MoneyPriceButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -8,12 +8,12 @@ var lib = require('@windrun-huaiin/base-ui/lib');
8
8
  var moneyPriceTypes = require('./money-price-types.js');
9
9
  var React = require('react');
10
10
 
11
- function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing = false, isInitLoading = false, enableSubscriptionUpgrade = true }) {
11
+ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing = false, isAnyProcessing = false, isInitLoading = false, enableSubscriptionUpgrade = true }) {
12
+ const [isLoading, setIsLoading] = React.useState(false);
12
13
  if (isInitLoading) {
13
- return (jsxRuntime.jsx("div", { className: "w-full h-11 md:h-12 mt-4 md:mt-auto rounded-full bg-transparent", "aria-hidden": "true", "data-plan-button-placeholder": planKey }));
14
+ return (jsxRuntime.jsx("div", { className: "relative w-full h-11 md:h-12 mt-4 md:mt-auto overflow-hidden rounded-full bg-gray-100/70 dark:bg-gray-800/40 animate-pulse transition-opacity duration-300 ease-out", "aria-hidden": "true", "data-plan-button-placeholder": planKey, children: jsxRuntime.jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/50 to-transparent dark:via-white/10" }) }));
14
15
  }
15
16
  const { isAuthenticated, subscriptionStatus } = userContext;
16
- const [isLoading, setIsLoading] = React.useState(false);
17
17
  const subscriptionBilling = userContext.subscriptionType;
18
18
  const planTier = planKey;
19
19
  const planBilling = billingType;
@@ -184,16 +184,19 @@ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction,
184
184
  const config = getButtonConfig();
185
185
  if (config.hidden)
186
186
  return null;
187
+ const hasActiveSubscription = subscriptionStatus === moneyPriceTypes.UserState.ProUser ||
188
+ subscriptionStatus === moneyPriceTypes.UserState.UltraUser;
187
189
  if (!enableSubscriptionUpgrade &&
188
190
  billingType !== 'onetime' &&
191
+ hasActiveSubscription &&
189
192
  config.text === texts.upgrade &&
190
193
  typeof config.onClick === 'function') {
191
194
  return null;
192
195
  }
193
- const isBusy = isLoading || isProcessing;
194
- const isDisabled = config.disabled || isBusy;
195
- const displayText = isBusy ? 'Processing...' : config.text;
196
- const isDisabledByConfigOnly = config.disabled && !isBusy;
196
+ const isCurrentButtonBusy = isLoading || isProcessing;
197
+ const isDisabled = config.disabled || isCurrentButtonBusy || isAnyProcessing;
198
+ const displayText = isCurrentButtonBusy ? 'Processing...' : config.text;
199
+ const isDisabledByConfigOnly = config.disabled && !isCurrentButtonBusy && !isAnyProcessing;
197
200
  const handleClick = (e) => tslib.__awaiter(this, void 0, void 0, function* () {
198
201
  if (isDisabled) {
199
202
  e.preventDefault();
@@ -217,8 +220,8 @@ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction,
217
220
  });
218
221
  const buttonClassName = utils.cn('w-full h-11 md:h-12 px-5 md:px-8 mt-4 md:mt-auto inline-flex items-center justify-center text-white text-sm md:text-base font-bold tracking-wide shadow-md hover:shadow-lg transition-all duration-300 rounded-full', isDisabledByConfigOnly
219
222
  ? 'bg-gray-400 cursor-not-allowed'
220
- : lib.themeButtonGradientClass, !isDisabledByConfigOnly && !isBusy &&
221
- lib.themeButtonGradientHoverClass, isBusy && !isDisabledByConfigOnly && 'opacity-70 cursor-not-allowed');
223
+ : lib.themeButtonGradientClass, !isDisabledByConfigOnly && !isCurrentButtonBusy && !isAnyProcessing &&
224
+ lib.themeButtonGradientHoverClass, (isCurrentButtonBusy || isAnyProcessing) && !isDisabledByConfigOnly && 'opacity-70 cursor-not-allowed');
222
225
  return (jsxRuntime.jsx("button", { className: buttonClassName, disabled: isDisabled, onClick: handleClick, type: "button", "data-plan-button": planKey, children: displayText }));
223
226
  }
224
227
 
@@ -6,12 +6,12 @@ import { themeButtonGradientClass, themeButtonGradientHoverClass } from '@windru
6
6
  import { UserState } from './money-price-types.mjs';
7
7
  import { useState } from 'react';
8
8
 
9
- function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing = false, isInitLoading = false, enableSubscriptionUpgrade = true }) {
9
+ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction, texts, isProcessing = false, isAnyProcessing = false, isInitLoading = false, enableSubscriptionUpgrade = true }) {
10
+ const [isLoading, setIsLoading] = useState(false);
10
11
  if (isInitLoading) {
11
- return (jsx("div", { className: "w-full h-11 md:h-12 mt-4 md:mt-auto rounded-full bg-transparent", "aria-hidden": "true", "data-plan-button-placeholder": planKey }));
12
+ return (jsx("div", { className: "relative w-full h-11 md:h-12 mt-4 md:mt-auto overflow-hidden rounded-full bg-gray-100/70 dark:bg-gray-800/40 animate-pulse transition-opacity duration-300 ease-out", "aria-hidden": "true", "data-plan-button-placeholder": planKey, children: jsx("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/50 to-transparent dark:via-white/10" }) }));
12
13
  }
13
14
  const { isAuthenticated, subscriptionStatus } = userContext;
14
- const [isLoading, setIsLoading] = useState(false);
15
15
  const subscriptionBilling = userContext.subscriptionType;
16
16
  const planTier = planKey;
17
17
  const planBilling = billingType;
@@ -182,16 +182,19 @@ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction,
182
182
  const config = getButtonConfig();
183
183
  if (config.hidden)
184
184
  return null;
185
+ const hasActiveSubscription = subscriptionStatus === UserState.ProUser ||
186
+ subscriptionStatus === UserState.UltraUser;
185
187
  if (!enableSubscriptionUpgrade &&
186
188
  billingType !== 'onetime' &&
189
+ hasActiveSubscription &&
187
190
  config.text === texts.upgrade &&
188
191
  typeof config.onClick === 'function') {
189
192
  return null;
190
193
  }
191
- const isBusy = isLoading || isProcessing;
192
- const isDisabled = config.disabled || isBusy;
193
- const displayText = isBusy ? 'Processing...' : config.text;
194
- const isDisabledByConfigOnly = config.disabled && !isBusy;
194
+ const isCurrentButtonBusy = isLoading || isProcessing;
195
+ const isDisabled = config.disabled || isCurrentButtonBusy || isAnyProcessing;
196
+ const displayText = isCurrentButtonBusy ? 'Processing...' : config.text;
197
+ const isDisabledByConfigOnly = config.disabled && !isCurrentButtonBusy && !isAnyProcessing;
195
198
  const handleClick = (e) => __awaiter(this, void 0, void 0, function* () {
196
199
  if (isDisabled) {
197
200
  e.preventDefault();
@@ -215,8 +218,8 @@ function MoneyPriceButton({ planKey, userContext, billingType, onAuth, onAction,
215
218
  });
216
219
  const buttonClassName = cn('w-full h-11 md:h-12 px-5 md:px-8 mt-4 md:mt-auto inline-flex items-center justify-center text-white text-sm md:text-base font-bold tracking-wide shadow-md hover:shadow-lg transition-all duration-300 rounded-full', isDisabledByConfigOnly
217
220
  ? 'bg-gray-400 cursor-not-allowed'
218
- : themeButtonGradientClass, !isDisabledByConfigOnly && !isBusy &&
219
- themeButtonGradientHoverClass, isBusy && !isDisabledByConfigOnly && 'opacity-70 cursor-not-allowed');
221
+ : themeButtonGradientClass, !isDisabledByConfigOnly && !isCurrentButtonBusy && !isAnyProcessing &&
222
+ themeButtonGradientHoverClass, (isCurrentButtonBusy || isAnyProcessing) && !isDisabledByConfigOnly && 'opacity-70 cursor-not-allowed');
220
223
  return (jsx("button", { className: buttonClassName, disabled: isDisabled, onClick: handleClick, type: "button", "data-plan-button": planKey, children: displayText }));
221
224
  }
222
225
 
@@ -1,2 +1,2 @@
1
1
  import { type MoneyPriceInteractiveProps } from './money-price-types';
2
- export declare function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal, enabledBillingTypes, enableSubscriptionUpgrade, initialBillingType, disableAutoDetectBilling, initUserContext, }: MoneyPriceInteractiveProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal, enabledBillingTypes, enableSubscriptionUpgrade, initialBillingType, disableAutoDetectBilling, initUserContext, isInitLoading, }: MoneyPriceInteractiveProps): import("react/jsx-runtime").JSX.Element;
@@ -14,8 +14,8 @@ var customerPortal = require('./customer-portal.js');
14
14
  var lib = require('@windrun-huaiin/base-ui/lib');
15
15
 
16
16
  const PLAN_KEYS = ['F1', 'P2', 'U3'];
17
- function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal = false, enabledBillingTypes, enableSubscriptionUpgrade = true, initialBillingType, disableAutoDetectBilling = false, initUserContext, }) {
18
- var _a, _b, _c, _d;
17
+ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal = false, enabledBillingTypes, enableSubscriptionUpgrade = true, initialBillingType, disableAutoDetectBilling = false, initUserContext, isInitLoading = false, }) {
18
+ var _a, _b, _c, _d, _e, _f;
19
19
  const { redirectToSignIn, redirectToSignUp, user: clerkUser, openSignUp } = nextjs.useClerk();
20
20
  const router = navigation.useRouter();
21
21
  const providerConfig = React.useMemo(() => moneyPriceConfigUtil.getActiveProviderConfigUtil(config), [config]);
@@ -103,21 +103,17 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
103
103
  subscriptionSnapshot === null || subscriptionSnapshot === void 0 ? void 0 : subscriptionSnapshot.priceId,
104
104
  priceIdsByCycle,
105
105
  ]);
106
- const initialBillingCandidate = React.useMemo(() => {
107
- if (initialBillingType) {
108
- return resolvedInitialBilling;
109
- }
110
- if (detectedBillingType) {
111
- return detectedBillingType;
106
+ const explicitInitialBilling = React.useMemo(() => {
107
+ if (initialBillingType &&
108
+ billingOptions.some(option => option.key === initialBillingType)) {
109
+ return initialBillingType;
112
110
  }
113
- return resolvedInitialBilling;
114
- }, [initialBillingType, resolvedInitialBilling, detectedBillingType]);
115
- const [billingType, setBillingType] = React.useState(initialBillingCandidate);
111
+ return null;
112
+ }, [initialBillingType, billingOptions]);
113
+ const [userSelectedBillingType, setUserSelectedBillingType] = React.useState(null);
114
+ const billingType = (_c = (_b = userSelectedBillingType !== null && userSelectedBillingType !== void 0 ? userSelectedBillingType : explicitInitialBilling) !== null && _b !== void 0 ? _b : detectedBillingType) !== null && _c !== void 0 ? _c : resolvedInitialBilling;
116
115
  const navigationLockRef = React.useRef(false);
117
- React.useEffect(() => {
118
- setBillingType(prev => (prev === initialBillingCandidate ? prev : initialBillingCandidate));
119
- }, [initialBillingCandidate]);
120
- const [isProcessing, setIsProcessing] = React.useState(false);
116
+ const [processingTarget, setProcessingTarget] = React.useState(null);
121
117
  const [isTouchDevice, setIsTouchDevice] = React.useState(false);
122
118
  React.useEffect(() => {
123
119
  setIsTouchDevice('ontouchstart' in window || navigator.maxTouchPoints > 0);
@@ -156,8 +152,8 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
156
152
  detectedBillingType,
157
153
  subscriptionSnapshot === null || subscriptionSnapshot === void 0 ? void 0 : subscriptionSnapshot.subPeriodEnd
158
154
  ]);
159
- const fingerprintId = (_b = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.fingerprintId) !== null && _b !== void 0 ? _b : null;
160
- const initUserId = (_d = (_c = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.xUser) === null || _c === void 0 ? void 0 : _c.userId) !== null && _d !== void 0 ? _d : null;
155
+ const fingerprintId = (_d = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.fingerprintId) !== null && _d !== void 0 ? _d : null;
156
+ const initUserId = (_f = (_e = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.xUser) === null || _e === void 0 ? void 0 : _e.userId) !== null && _f !== void 0 ? _f : null;
161
157
  const handleAuth = React.useCallback(() => {
162
158
  if (!enableClerkModal) {
163
159
  redirectToSignUp();
@@ -175,18 +171,18 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
175
171
  const handleAction = React.useCallback((plan, billing) => tslib.__awaiter(this, void 0, void 0, function* () {
176
172
  var _a;
177
173
  const isSubscriptionFlow = billing !== 'onetime';
178
- if (isSubscriptionFlow && !enableSubscriptionUpgrade) {
174
+ const hasActiveSubscription = userContext.isAuthenticated &&
175
+ (userContext.subscriptionStatus === moneyPriceTypes.UserState.ProUser ||
176
+ userContext.subscriptionStatus === moneyPriceTypes.UserState.UltraUser);
177
+ if (isSubscriptionFlow && hasActiveSubscription && !enableSubscriptionUpgrade) {
179
178
  return;
180
179
  }
181
180
  navigationLockRef.current = false;
182
- setIsProcessing(true);
181
+ setProcessingTarget({ plan, billing });
183
182
  const markNavigating = () => {
184
183
  navigationLockRef.current = true;
185
184
  };
186
185
  try {
187
- const hasActiveSubscription = userContext.isAuthenticated &&
188
- (userContext.subscriptionStatus === moneyPriceTypes.UserState.ProUser ||
189
- userContext.subscriptionStatus === moneyPriceTypes.UserState.UltraUser);
190
186
  const shouldUsePortal = isSubscriptionFlow && hasActiveSubscription;
191
187
  if (shouldUsePortal) {
192
188
  const handled = yield customerPortal.redirectToCustomerPortal({
@@ -255,7 +251,7 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
255
251
  }
256
252
  finally {
257
253
  if (!navigationLockRef.current) {
258
- setIsProcessing(false);
254
+ setProcessingTarget(null);
259
255
  }
260
256
  }
261
257
  }), [
@@ -317,7 +313,7 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
317
313
  ? utils.cn('text-white rounded-full shadow-sm', lib.themeButtonGradientClass, lib.themeButtonGradientHoverClass)
318
314
  : 'text-gray-800 dark:text-gray-200 hover:text-gray-900 dark:hover:text-gray-100 rounded-full';
319
315
  const showBadge = option.key === billingType && !!discountBadgeText;
320
- return (jsxRuntime.jsxs("div", { className: "relative flex items-center justify-center mx-1", children: [showBadge && (jsxRuntime.jsx("span", { className: "absolute z-10 left-1/2 -translate-x-1/2 -top-3 sm:-top-4 translate-y-[-50%] px-3 py-0.5 text-[0.625rem] sm:text-xs rounded-md bg-yellow-100 text-yellow-800 font-semibold shadow-sm whitespace-nowrap", children: discountBadgeText })), jsxRuntime.jsx("button", { className: utils.cn('text-sm md:text-base font-medium transition relative text-center z-10 px-2 sm:px-4 py-2 min-w-[100px] sm:min-w-[120px]', buttonClasses), type: "button", "data-billing-button": option.key, onClick: () => setBillingType(option.key), children: option.name })] }, option.key));
316
+ return (jsxRuntime.jsxs("div", { className: "relative flex items-center justify-center mx-1", children: [showBadge && (jsxRuntime.jsx("span", { className: "absolute z-10 left-1/2 -translate-x-1/2 -top-3 sm:-top-4 translate-y-[-50%] px-3 py-0.5 text-[0.625rem] sm:text-xs rounded-md bg-yellow-100 text-yellow-800 font-semibold shadow-sm whitespace-nowrap", children: discountBadgeText })), jsxRuntime.jsx("button", { className: utils.cn('text-sm md:text-base font-medium transition relative text-center z-10 px-2 sm:px-4 py-2 min-w-[100px] sm:min-w-[120px]', buttonClasses), type: "button", "data-billing-button": option.key, onClick: () => setUserSelectedBillingType(option.key), children: option.name })] }, option.key));
321
317
  }) }) }), jsxRuntime.jsx("div", { className: "w-full", children: jsxRuntime.jsx("div", { className: "flex flex-wrap justify-center gap-5 md:gap-6 xl:gap-8 w-full max-w-6xl mx-auto", children: currentPlans.map((plan) => {
322
318
  const planKey = plan.key;
323
319
  if (!PLAN_KEYS.includes(planKey)) {
@@ -332,7 +328,8 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
332
328
  // OneTime 模式下的特殊处理:普通文本 + 带样式的产品副标题
333
329
  jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [(selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) && (jsxRuntime.jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: selectedBillingOption.subTitle })), plan.subtitle && (jsxRuntime.jsxs("span", { className: "px-2 py-0.5 text-[11px] md:text-xs rounded bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200 font-semibold align-middle", children: ["+", plan.subtitle] }))] })) : (
334
330
  // 其他模式下保持原逻辑
335
- showBillingSubtitle && (jsxRuntime.jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: (selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) || '' }))) })] })] }), jsxRuntime.jsx("ul", { className: "flex-1 mb-6 mt-4 text-xs md:text-sm leading-5", children: getFeatureRows(plan).map((feature, i) => (jsxRuntime.jsxs("li", { className: "flex items-start gap-2 mb-2 min-h-[24px] md:min-h-[28px]", "data-feature-item": `${planKey}-${i}`, children: [feature ? (jsxRuntime.jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200 mr-1", children: feature.icon ? jsxRuntime.jsx("span", { children: feature.icon }) : jsxRuntime.jsx("span", { className: "font-bold", children: "\u2713" }) })) : (jsxRuntime.jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full mr-1", children: "\u00A0" })), feature && feature.tag && (jsxRuntime.jsx("span", { className: "px-1 py-0.5 text-[6px] rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 font-semibold align-middle", children: feature.tag })), feature ? (jsxRuntime.jsxs("div", { className: "flex-1 text-gray-800 dark:text-gray-200", children: [jsxRuntime.jsx("span", { children: feature.description }), feature.tooltip && (jsxRuntime.jsx("span", { className: "block text-[11px] text-gray-500 dark:text-gray-400 mt-1", children: feature.tooltip }))] })) : (jsxRuntime.jsx("span", { children: "\u00A0" }))] }, i))) }), jsxRuntime.jsx("div", { className: "flex-1" }), jsxRuntime.jsx(moneyPriceButton.MoneyPriceButton, { planKey: planKey, userContext: userContext, billingType: billingType, onAuth: handleAuth, onAction: handleAction, texts: data.buttonTexts, isProcessing: isProcessing, isInitLoading: false, enableSubscriptionUpgrade: enableSubscriptionUpgrade })] }, plan.key));
331
+ showBillingSubtitle && (jsxRuntime.jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: (selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) || '' }))) })] })] }), jsxRuntime.jsx("ul", { className: "flex-1 mb-6 mt-4 text-xs md:text-sm leading-5", children: getFeatureRows(plan).map((feature, i) => (jsxRuntime.jsxs("li", { className: "flex items-start gap-2 mb-2 min-h-[24px] md:min-h-[28px]", "data-feature-item": `${planKey}-${i}`, children: [feature ? (jsxRuntime.jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200 mr-1", children: feature.icon ? jsxRuntime.jsx("span", { children: feature.icon }) : jsxRuntime.jsx("span", { className: "font-bold", children: "\u2713" }) })) : (jsxRuntime.jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full mr-1", children: "\u00A0" })), feature && feature.tag && (jsxRuntime.jsx("span", { className: "px-1 py-0.5 text-[6px] rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 font-semibold align-middle", children: feature.tag })), feature ? (jsxRuntime.jsxs("div", { className: "flex-1 text-gray-800 dark:text-gray-200", children: [jsxRuntime.jsx("span", { children: feature.description }), feature.tooltip && (jsxRuntime.jsx("span", { className: "block text-[11px] text-gray-500 dark:text-gray-400 mt-1", children: feature.tooltip }))] })) : (jsxRuntime.jsx("span", { children: "\u00A0" }))] }, i))) }), jsxRuntime.jsx("div", { className: "flex-1" }), jsxRuntime.jsx(moneyPriceButton.MoneyPriceButton, { planKey: planKey, userContext: userContext, billingType: billingType, onAuth: handleAuth, onAction: handleAction, texts: data.buttonTexts, isProcessing: (processingTarget === null || processingTarget === void 0 ? void 0 : processingTarget.plan) === planKey &&
332
+ (processingTarget === null || processingTarget === void 0 ? void 0 : processingTarget.billing) === billingType, isAnyProcessing: !!processingTarget, isInitLoading: isInitLoading, enableSubscriptionUpgrade: enableSubscriptionUpgrade })] }, plan.key));
336
333
  }) }) })] }));
337
334
  }
338
335
 
@@ -12,8 +12,8 @@ import { redirectToCustomerPortal } from './customer-portal.mjs';
12
12
  import { themeButtonGradientClass, themeButtonGradientHoverClass, themeIconColor } from '@windrun-huaiin/base-ui/lib';
13
13
 
14
14
  const PLAN_KEYS = ['F1', 'P2', 'U3'];
15
- function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal = false, enabledBillingTypes, enableSubscriptionUpgrade = true, initialBillingType, disableAutoDetectBilling = false, initUserContext, }) {
16
- var _a, _b, _c, _d;
15
+ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPortalApiEndpoint, enableClerkModal = false, enabledBillingTypes, enableSubscriptionUpgrade = true, initialBillingType, disableAutoDetectBilling = false, initUserContext, isInitLoading = false, }) {
16
+ var _a, _b, _c, _d, _e, _f;
17
17
  const { redirectToSignIn, redirectToSignUp, user: clerkUser, openSignUp } = useClerk();
18
18
  const router = useRouter();
19
19
  const providerConfig = useMemo(() => getActiveProviderConfigUtil(config), [config]);
@@ -101,21 +101,17 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
101
101
  subscriptionSnapshot === null || subscriptionSnapshot === void 0 ? void 0 : subscriptionSnapshot.priceId,
102
102
  priceIdsByCycle,
103
103
  ]);
104
- const initialBillingCandidate = useMemo(() => {
105
- if (initialBillingType) {
106
- return resolvedInitialBilling;
107
- }
108
- if (detectedBillingType) {
109
- return detectedBillingType;
104
+ const explicitInitialBilling = useMemo(() => {
105
+ if (initialBillingType &&
106
+ billingOptions.some(option => option.key === initialBillingType)) {
107
+ return initialBillingType;
110
108
  }
111
- return resolvedInitialBilling;
112
- }, [initialBillingType, resolvedInitialBilling, detectedBillingType]);
113
- const [billingType, setBillingType] = useState(initialBillingCandidate);
109
+ return null;
110
+ }, [initialBillingType, billingOptions]);
111
+ const [userSelectedBillingType, setUserSelectedBillingType] = useState(null);
112
+ const billingType = (_c = (_b = userSelectedBillingType !== null && userSelectedBillingType !== void 0 ? userSelectedBillingType : explicitInitialBilling) !== null && _b !== void 0 ? _b : detectedBillingType) !== null && _c !== void 0 ? _c : resolvedInitialBilling;
114
113
  const navigationLockRef = useRef(false);
115
- useEffect(() => {
116
- setBillingType(prev => (prev === initialBillingCandidate ? prev : initialBillingCandidate));
117
- }, [initialBillingCandidate]);
118
- const [isProcessing, setIsProcessing] = useState(false);
114
+ const [processingTarget, setProcessingTarget] = useState(null);
119
115
  const [isTouchDevice, setIsTouchDevice] = useState(false);
120
116
  useEffect(() => {
121
117
  setIsTouchDevice('ontouchstart' in window || navigator.maxTouchPoints > 0);
@@ -154,8 +150,8 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
154
150
  detectedBillingType,
155
151
  subscriptionSnapshot === null || subscriptionSnapshot === void 0 ? void 0 : subscriptionSnapshot.subPeriodEnd
156
152
  ]);
157
- const fingerprintId = (_b = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.fingerprintId) !== null && _b !== void 0 ? _b : null;
158
- const initUserId = (_d = (_c = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.xUser) === null || _c === void 0 ? void 0 : _c.userId) !== null && _d !== void 0 ? _d : null;
153
+ const fingerprintId = (_d = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.fingerprintId) !== null && _d !== void 0 ? _d : null;
154
+ const initUserId = (_f = (_e = initUserContext === null || initUserContext === void 0 ? void 0 : initUserContext.xUser) === null || _e === void 0 ? void 0 : _e.userId) !== null && _f !== void 0 ? _f : null;
159
155
  const handleAuth = useCallback(() => {
160
156
  if (!enableClerkModal) {
161
157
  redirectToSignUp();
@@ -173,18 +169,18 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
173
169
  const handleAction = useCallback((plan, billing) => __awaiter(this, void 0, void 0, function* () {
174
170
  var _a;
175
171
  const isSubscriptionFlow = billing !== 'onetime';
176
- if (isSubscriptionFlow && !enableSubscriptionUpgrade) {
172
+ const hasActiveSubscription = userContext.isAuthenticated &&
173
+ (userContext.subscriptionStatus === UserState.ProUser ||
174
+ userContext.subscriptionStatus === UserState.UltraUser);
175
+ if (isSubscriptionFlow && hasActiveSubscription && !enableSubscriptionUpgrade) {
177
176
  return;
178
177
  }
179
178
  navigationLockRef.current = false;
180
- setIsProcessing(true);
179
+ setProcessingTarget({ plan, billing });
181
180
  const markNavigating = () => {
182
181
  navigationLockRef.current = true;
183
182
  };
184
183
  try {
185
- const hasActiveSubscription = userContext.isAuthenticated &&
186
- (userContext.subscriptionStatus === UserState.ProUser ||
187
- userContext.subscriptionStatus === UserState.UltraUser);
188
184
  const shouldUsePortal = isSubscriptionFlow && hasActiveSubscription;
189
185
  if (shouldUsePortal) {
190
186
  const handled = yield redirectToCustomerPortal({
@@ -253,7 +249,7 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
253
249
  }
254
250
  finally {
255
251
  if (!navigationLockRef.current) {
256
- setIsProcessing(false);
252
+ setProcessingTarget(null);
257
253
  }
258
254
  }
259
255
  }), [
@@ -315,7 +311,7 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
315
311
  ? cn('text-white rounded-full shadow-sm', themeButtonGradientClass, themeButtonGradientHoverClass)
316
312
  : 'text-gray-800 dark:text-gray-200 hover:text-gray-900 dark:hover:text-gray-100 rounded-full';
317
313
  const showBadge = option.key === billingType && !!discountBadgeText;
318
- return (jsxs("div", { className: "relative flex items-center justify-center mx-1", children: [showBadge && (jsx("span", { className: "absolute z-10 left-1/2 -translate-x-1/2 -top-3 sm:-top-4 translate-y-[-50%] px-3 py-0.5 text-[0.625rem] sm:text-xs rounded-md bg-yellow-100 text-yellow-800 font-semibold shadow-sm whitespace-nowrap", children: discountBadgeText })), jsx("button", { className: cn('text-sm md:text-base font-medium transition relative text-center z-10 px-2 sm:px-4 py-2 min-w-[100px] sm:min-w-[120px]', buttonClasses), type: "button", "data-billing-button": option.key, onClick: () => setBillingType(option.key), children: option.name })] }, option.key));
314
+ return (jsxs("div", { className: "relative flex items-center justify-center mx-1", children: [showBadge && (jsx("span", { className: "absolute z-10 left-1/2 -translate-x-1/2 -top-3 sm:-top-4 translate-y-[-50%] px-3 py-0.5 text-[0.625rem] sm:text-xs rounded-md bg-yellow-100 text-yellow-800 font-semibold shadow-sm whitespace-nowrap", children: discountBadgeText })), jsx("button", { className: cn('text-sm md:text-base font-medium transition relative text-center z-10 px-2 sm:px-4 py-2 min-w-[100px] sm:min-w-[120px]', buttonClasses), type: "button", "data-billing-button": option.key, onClick: () => setUserSelectedBillingType(option.key), children: option.name })] }, option.key));
319
315
  }) }) }), jsx("div", { className: "w-full", children: jsx("div", { className: "flex flex-wrap justify-center gap-5 md:gap-6 xl:gap-8 w-full max-w-6xl mx-auto", children: currentPlans.map((plan) => {
320
316
  const planKey = plan.key;
321
317
  if (!PLAN_KEYS.includes(planKey)) {
@@ -330,7 +326,8 @@ function MoneyPriceInteractive({ data, config, checkoutApiEndpoint, customerPort
330
326
  // OneTime 模式下的特殊处理:普通文本 + 带样式的产品副标题
331
327
  jsxs(Fragment, { children: [(selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) && (jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: selectedBillingOption.subTitle })), plan.subtitle && (jsxs("span", { className: "px-2 py-0.5 text-[11px] md:text-xs rounded bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200 font-semibold align-middle", children: ["+", plan.subtitle] }))] })) : (
332
328
  // 其他模式下保持原逻辑
333
- showBillingSubtitle && (jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: (selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) || '' }))) })] })] }), jsx("ul", { className: "flex-1 mb-6 mt-4 text-xs md:text-sm leading-5", children: getFeatureRows(plan).map((feature, i) => (jsxs("li", { className: "flex items-start gap-2 mb-2 min-h-[24px] md:min-h-[28px]", "data-feature-item": `${planKey}-${i}`, children: [feature ? (jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200 mr-1", children: feature.icon ? jsx("span", { children: feature.icon }) : jsx("span", { className: "font-bold", children: "\u2713" }) })) : (jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full mr-1", children: "\u00A0" })), feature && feature.tag && (jsx("span", { className: "px-1 py-0.5 text-[6px] rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 font-semibold align-middle", children: feature.tag })), feature ? (jsxs("div", { className: "flex-1 text-gray-800 dark:text-gray-200", children: [jsx("span", { children: feature.description }), feature.tooltip && (jsx("span", { className: "block text-[11px] text-gray-500 dark:text-gray-400 mt-1", children: feature.tooltip }))] })) : (jsx("span", { children: "\u00A0" }))] }, i))) }), jsx("div", { className: "flex-1" }), jsx(MoneyPriceButton, { planKey: planKey, userContext: userContext, billingType: billingType, onAuth: handleAuth, onAction: handleAction, texts: data.buttonTexts, isProcessing: isProcessing, isInitLoading: false, enableSubscriptionUpgrade: enableSubscriptionUpgrade })] }, plan.key));
329
+ showBillingSubtitle && (jsx("span", { className: "text-[11px] md:text-xs text-gray-700 dark:text-gray-300 font-medium", children: (selectedBillingOption === null || selectedBillingOption === void 0 ? void 0 : selectedBillingOption.subTitle) || '' }))) })] })] }), jsx("ul", { className: "flex-1 mb-6 mt-4 text-xs md:text-sm leading-5", children: getFeatureRows(plan).map((feature, i) => (jsxs("li", { className: "flex items-start gap-2 mb-2 min-h-[24px] md:min-h-[28px]", "data-feature-item": `${planKey}-${i}`, children: [feature ? (jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-200 mr-1", children: feature.icon ? jsx("span", { children: feature.icon }) : jsx("span", { className: "font-bold", children: "\u2713" }) })) : (jsx("span", { className: "inline-flex items-center justify-center w-5 h-5 rounded-full mr-1", children: "\u00A0" })), feature && feature.tag && (jsx("span", { className: "px-1 py-0.5 text-[6px] rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200 font-semibold align-middle", children: feature.tag })), feature ? (jsxs("div", { className: "flex-1 text-gray-800 dark:text-gray-200", children: [jsx("span", { children: feature.description }), feature.tooltip && (jsx("span", { className: "block text-[11px] text-gray-500 dark:text-gray-400 mt-1", children: feature.tooltip }))] })) : (jsx("span", { children: "\u00A0" }))] }, i))) }), jsx("div", { className: "flex-1" }), jsx(MoneyPriceButton, { planKey: planKey, userContext: userContext, billingType: billingType, onAuth: handleAuth, onAction: handleAction, texts: data.buttonTexts, isProcessing: (processingTarget === null || processingTarget === void 0 ? void 0 : processingTarget.plan) === planKey &&
330
+ (processingTarget === null || processingTarget === void 0 ? void 0 : processingTarget.billing) === billingType, isAnyProcessing: !!processingTarget, isInitLoading: isInitLoading, enableSubscriptionUpgrade: enableSubscriptionUpgrade })] }, plan.key));
334
331
  }) }) })] }));
335
332
  }
336
333
 
@@ -96,6 +96,7 @@ export interface MoneyPriceInteractiveProps {
96
96
  initialBillingType?: string;
97
97
  disableAutoDetectBilling?: boolean;
98
98
  initUserContext?: InitUserContext;
99
+ isInitLoading?: boolean;
99
100
  }
100
101
  export interface MoneyPriceButtonProps {
101
102
  planKey: 'F1' | 'P2' | 'U3';
@@ -112,6 +113,7 @@ export interface MoneyPriceButtonProps {
112
113
  upgrade: string;
113
114
  };
114
115
  isProcessing?: boolean;
116
+ isAnyProcessing?: boolean;
115
117
  isInitLoading: boolean;
116
118
  enableSubscriptionUpgrade?: boolean;
117
119
  }
@@ -0,0 +1,5 @@
1
+ export { MoneyPrice } from './money-price';
2
+ export { getActiveProviderConfigUtil, getCreditsFromPriceIdUtil, getPriceConfigUtil, } from './money-price-config-util';
3
+ export { buildMoneyPriceData } from './money-price-data';
4
+ export type { MoneyPriceConfig, MoneyPriceProps, MoneyPriceInteractiveProps, MoneyPriceButtonProps, MoneyPriceData, InitUserContext, PaymentProvider, PaymentProviderConfig, EnhancePricePlan, SubscriptionProductConfig, CreditPackProductConfig, UserContext, } from './money-price-types';
5
+ export { UserState } from './money-price-types';
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ var moneyPrice = require('./money-price.js');
4
+ var moneyPriceConfigUtil = require('./money-price-config-util.js');
5
+ var moneyPriceData = require('./money-price-data.js');
6
+ var moneyPriceTypes = require('./money-price-types.js');
7
+
8
+
9
+
10
+ exports.MoneyPrice = moneyPrice.MoneyPrice;
11
+ exports.getActiveProviderConfigUtil = moneyPriceConfigUtil.getActiveProviderConfigUtil;
12
+ exports.getCreditsFromPriceIdUtil = moneyPriceConfigUtil.getCreditsFromPriceIdUtil;
13
+ exports.getPriceConfigUtil = moneyPriceConfigUtil.getPriceConfigUtil;
14
+ exports.buildMoneyPriceData = moneyPriceData.buildMoneyPriceData;
15
+ Object.defineProperty(exports, "UserState", {
16
+ enumerable: true,
17
+ get: function () { return moneyPriceTypes.UserState; }
18
+ });
@@ -0,0 +1,4 @@
1
+ export { MoneyPrice } from './money-price.mjs';
2
+ export { getActiveProviderConfigUtil, getCreditsFromPriceIdUtil, getPriceConfigUtil } from './money-price-config-util.mjs';
3
+ export { buildMoneyPriceData } from './money-price-data.mjs';
4
+ export { UserState } from './money-price-types.mjs';