@windrun-huaiin/third-ui 7.3.2 → 7.3.3
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.
- package/dist/main/faq.js +12 -0
- package/dist/main/faq.mjs +12 -0
- package/dist/main/gallery.js +12 -0
- package/dist/main/gallery.mjs +12 -0
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.js +4 -0
- package/dist/main/index.mjs +2 -0
- package/dist/main/money-price/money-price-button.d.ts +2 -0
- package/dist/main/money-price/money-price-button.js +96 -0
- package/dist/main/money-price/money-price-button.mjs +94 -0
- package/dist/main/money-price/money-price-config.d.ts +8 -0
- package/dist/main/money-price/money-price-config.js +223 -0
- package/dist/main/money-price/money-price-config.mjs +219 -0
- package/dist/main/money-price/money-price-interactive.d.ts +2 -0
- package/dist/main/money-price/money-price-interactive.js +293 -0
- package/dist/main/money-price/money-price-interactive.mjs +291 -0
- package/dist/main/money-price/money-price-types.d.ts +116 -0
- package/dist/main/money-price/money-price-types.js +14 -0
- package/dist/main/money-price/money-price-types.mjs +14 -0
- package/dist/main/money-price/money-price.d.ts +2 -0
- package/dist/main/money-price/money-price.js +93 -0
- package/dist/main/money-price/money-price.mjs +91 -0
- package/dist/main/price-plan.js +13 -0
- package/dist/main/price-plan.mjs +13 -0
- package/dist/main/server.d.ts +4 -0
- package/dist/main/server.js +11 -0
- package/dist/main/server.mjs +3 -0
- package/dist/node_modules/.pnpm/cose-base@1.0.3/node_modules/cose-base/cose-base.js +1 -1
- package/dist/node_modules/.pnpm/cose-base@2.2.0/node_modules/cose-base/cose-base.js +1 -1
- package/dist/node_modules/.pnpm/layout-base@1.0.2/node_modules/layout-base/layout-base.js +1 -1
- package/dist/node_modules/.pnpm/layout-base@2.0.1/node_modules/layout-base/layout-base.js +1 -1
- package/package.json +1 -1
- package/src/main/index.ts +5 -1
- package/src/main/money-price/money-price-button.tsx +105 -0
- package/src/main/money-price/money-price-config.ts +229 -0
- package/src/main/money-price/money-price-interactive.tsx +356 -0
- package/src/main/money-price/money-price-types.ts +138 -0
- package/src/main/money-price/money-price.tsx +307 -0
- package/src/main/server.ts +25 -1
package/dist/main/faq.js
CHANGED
|
@@ -12,6 +12,18 @@ 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');
|
|
26
|
+
require('./money-price/money-price-config.js');
|
|
15
27
|
|
|
16
28
|
function FAQ(_a) {
|
|
17
29
|
return tslib_es6.__awaiter(this, arguments, void 0, function* ({ locale, sectionClassName }) {
|
package/dist/main/faq.mjs
CHANGED
|
@@ -10,6 +10,18 @@ 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';
|
|
24
|
+
import './money-price/money-price-config.mjs';
|
|
13
25
|
|
|
14
26
|
function FAQ(_a) {
|
|
15
27
|
return __awaiter(this, arguments, void 0, function* ({ locale, sectionClassName }) {
|
package/dist/main/gallery.js
CHANGED
|
@@ -12,6 +12,18 @@ 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');
|
|
26
|
+
require('./money-price/money-price-config.js');
|
|
15
27
|
|
|
16
28
|
function Gallery(_a) {
|
|
17
29
|
return tslib_es6.__awaiter(this, arguments, void 0, function* ({ locale, sectionClassName, button }) {
|
package/dist/main/gallery.mjs
CHANGED
|
@@ -10,6 +10,18 @@ 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';
|
|
24
|
+
import './money-price/money-price-config.mjs';
|
|
13
25
|
|
|
14
26
|
function Gallery(_a) {
|
|
15
27
|
return __awaiter(this, arguments, void 0, function* ({ locale, sectionClassName, button }) {
|
package/dist/main/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/main/index.js
CHANGED
|
@@ -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;
|
package/dist/main/index.mjs
CHANGED
|
@@ -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,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,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;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Money Price Configuration
|
|
5
|
+
* 价格组件配置文件
|
|
6
|
+
*/
|
|
7
|
+
// 示例配置
|
|
8
|
+
const moneyPriceConfig = {
|
|
9
|
+
paymentProviders: {
|
|
10
|
+
stripe: {
|
|
11
|
+
provider: 'stripe',
|
|
12
|
+
enabled: true,
|
|
13
|
+
products: {
|
|
14
|
+
free: {
|
|
15
|
+
key: 'free',
|
|
16
|
+
name: 'free', // Just a key, actual display name comes from translation
|
|
17
|
+
plans: {
|
|
18
|
+
monthly: {
|
|
19
|
+
priceId: 'free',
|
|
20
|
+
amount: 0,
|
|
21
|
+
currency: 'usd',
|
|
22
|
+
credits: 0
|
|
23
|
+
},
|
|
24
|
+
yearly: {
|
|
25
|
+
priceId: 'free',
|
|
26
|
+
amount: 0,
|
|
27
|
+
currency: 'usd',
|
|
28
|
+
credits: 0
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
pro: {
|
|
33
|
+
key: 'pro',
|
|
34
|
+
name: 'pro', // Just a key, actual display name comes from translation
|
|
35
|
+
plans: {
|
|
36
|
+
monthly: {
|
|
37
|
+
priceId: process.env.NEXT_PUBLIC_STRIPE_PRO_MONTHLY_PRICE_ID || 'price_pro_monthly',
|
|
38
|
+
amount: Number(process.env.NEXT_PUBLIC_STRIPE_PRO_MONTHLY_AMOUNT) || 10,
|
|
39
|
+
currency: process.env.NEXT_PUBLIC_STRIPE_PRO_MONTHLY_CURRENCY || 'usd',
|
|
40
|
+
credits: Number(process.env.NEXT_PUBLIC_STRIPE_PRO_MONTHLY_CREDITS) || 100
|
|
41
|
+
},
|
|
42
|
+
yearly: {
|
|
43
|
+
priceId: process.env.NEXT_PUBLIC_STRIPE_PRO_YEARLY_PRICE_ID || 'price_pro_yearly',
|
|
44
|
+
amount: Number(process.env.NEXT_PUBLIC_STRIPE_PRO_YEARLY_AMOUNT) || 96,
|
|
45
|
+
originalAmount: 120,
|
|
46
|
+
discountPercent: 20,
|
|
47
|
+
currency: process.env.NEXT_PUBLIC_STRIPE_PRO_YEARLY_CURRENCY || 'usd',
|
|
48
|
+
credits: Number(process.env.NEXT_PUBLIC_STRIPE_PRO_YEARLY_CREDITS) || 1200
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
ultra: {
|
|
53
|
+
key: 'ultra',
|
|
54
|
+
name: 'ultra', // Just a key, actual display name comes from translation
|
|
55
|
+
plans: {
|
|
56
|
+
monthly: {
|
|
57
|
+
priceId: process.env.NEXT_PUBLIC_STRIPE_ULTRA_MONTHLY_PRICE_ID || 'price_ultra_monthly',
|
|
58
|
+
amount: Number(process.env.NEXT_PUBLIC_STRIPE_ULTRA_MONTHLY_AMOUNT) || 20,
|
|
59
|
+
currency: process.env.NEXT_PUBLIC_STRIPE_ULTRA_MONTHLY_CURRENCY || 'usd',
|
|
60
|
+
credits: Number(process.env.NEXT_PUBLIC_STRIPE_ULTRA_MONTHLY_CREDITS) || 250
|
|
61
|
+
},
|
|
62
|
+
yearly: {
|
|
63
|
+
priceId: process.env.NEXT_PUBLIC_STRIPE_ULTRA_YEARLY_PRICE_ID || 'price_ultra_yearly',
|
|
64
|
+
amount: Number(process.env.NEXT_PUBLIC_STRIPE_ULTRA_YEARLY_AMOUNT) || 192,
|
|
65
|
+
originalAmount: 240,
|
|
66
|
+
discountPercent: 20,
|
|
67
|
+
currency: process.env.NEXT_PUBLIC_STRIPE_ULTRA_YEARLY_CURRENCY || 'usd',
|
|
68
|
+
credits: Number(process.env.NEXT_PUBLIC_STRIPE_ULTRA_YEARLY_CREDITS) || 3000
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
alipay: {
|
|
75
|
+
provider: 'alipay',
|
|
76
|
+
enabled: false,
|
|
77
|
+
products: {
|
|
78
|
+
free: {
|
|
79
|
+
key: 'free',
|
|
80
|
+
name: 'free',
|
|
81
|
+
plans: {
|
|
82
|
+
monthly: {
|
|
83
|
+
priceId: 'free',
|
|
84
|
+
amount: 0,
|
|
85
|
+
currency: 'cny',
|
|
86
|
+
credits: 0
|
|
87
|
+
},
|
|
88
|
+
yearly: {
|
|
89
|
+
priceId: 'free',
|
|
90
|
+
amount: 0,
|
|
91
|
+
currency: 'cny',
|
|
92
|
+
credits: 0
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
pro: {
|
|
97
|
+
key: 'pro',
|
|
98
|
+
name: 'pro',
|
|
99
|
+
plans: {
|
|
100
|
+
monthly: {
|
|
101
|
+
priceId: 'alipay_pro_monthly',
|
|
102
|
+
amount: 70,
|
|
103
|
+
currency: 'cny',
|
|
104
|
+
credits: 100
|
|
105
|
+
},
|
|
106
|
+
yearly: {
|
|
107
|
+
priceId: 'alipay_pro_yearly',
|
|
108
|
+
amount: 672,
|
|
109
|
+
originalAmount: 840,
|
|
110
|
+
discountPercent: 20,
|
|
111
|
+
currency: 'cny',
|
|
112
|
+
credits: 1200
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
ultra: {
|
|
117
|
+
key: 'ultra',
|
|
118
|
+
name: 'ultra',
|
|
119
|
+
plans: {
|
|
120
|
+
monthly: {
|
|
121
|
+
priceId: 'alipay_ultra_monthly',
|
|
122
|
+
amount: 140,
|
|
123
|
+
currency: 'cny',
|
|
124
|
+
credits: 250
|
|
125
|
+
},
|
|
126
|
+
yearly: {
|
|
127
|
+
priceId: 'alipay_ultra_yearly',
|
|
128
|
+
amount: 1344,
|
|
129
|
+
originalAmount: 1680,
|
|
130
|
+
discountPercent: 20,
|
|
131
|
+
currency: 'cny',
|
|
132
|
+
credits: 3000
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
wechat: {
|
|
139
|
+
provider: 'wechat',
|
|
140
|
+
enabled: false,
|
|
141
|
+
products: {
|
|
142
|
+
free: {
|
|
143
|
+
key: 'free',
|
|
144
|
+
name: 'free',
|
|
145
|
+
plans: {
|
|
146
|
+
monthly: {
|
|
147
|
+
priceId: 'free',
|
|
148
|
+
amount: 0,
|
|
149
|
+
currency: 'cny',
|
|
150
|
+
credits: 0
|
|
151
|
+
},
|
|
152
|
+
yearly: {
|
|
153
|
+
priceId: 'free',
|
|
154
|
+
amount: 0,
|
|
155
|
+
currency: 'cny',
|
|
156
|
+
credits: 0
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
pro: {
|
|
161
|
+
key: 'pro',
|
|
162
|
+
name: 'pro',
|
|
163
|
+
plans: {
|
|
164
|
+
monthly: {
|
|
165
|
+
priceId: 'wechat_pro_monthly',
|
|
166
|
+
amount: 70,
|
|
167
|
+
currency: 'cny',
|
|
168
|
+
credits: 100
|
|
169
|
+
},
|
|
170
|
+
yearly: {
|
|
171
|
+
priceId: 'wechat_pro_yearly',
|
|
172
|
+
amount: 672,
|
|
173
|
+
originalAmount: 840,
|
|
174
|
+
discountPercent: 20,
|
|
175
|
+
currency: 'cny',
|
|
176
|
+
credits: 1200
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
ultra: {
|
|
181
|
+
key: 'ultra',
|
|
182
|
+
name: 'ultra',
|
|
183
|
+
plans: {
|
|
184
|
+
monthly: {
|
|
185
|
+
priceId: 'wechat_ultra_monthly',
|
|
186
|
+
amount: 140,
|
|
187
|
+
currency: 'cny',
|
|
188
|
+
credits: 250
|
|
189
|
+
},
|
|
190
|
+
yearly: {
|
|
191
|
+
priceId: 'wechat_ultra_yearly',
|
|
192
|
+
amount: 1344,
|
|
193
|
+
originalAmount: 1680,
|
|
194
|
+
discountPercent: 20,
|
|
195
|
+
currency: 'cny',
|
|
196
|
+
credits: 3000
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
activeProvider: process.env.NEXT_PUBLIC_ACTIVE_PAYMENT_PROVIDER || 'stripe',
|
|
204
|
+
display: {
|
|
205
|
+
currency: '$',
|
|
206
|
+
locale: 'en',
|
|
207
|
+
minFeaturesCount: 4
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
// 辅助函数:获取当前激活的支付供应商配置
|
|
211
|
+
function getActiveProviderConfig(config) {
|
|
212
|
+
const provider = config.activeProvider;
|
|
213
|
+
return config.paymentProviders[provider];
|
|
214
|
+
}
|
|
215
|
+
// 辅助函数:获取特定产品的价格信息
|
|
216
|
+
function getProductPricing(productKey, billingType, provider, config) {
|
|
217
|
+
const providerConfig = config.paymentProviders[provider];
|
|
218
|
+
return providerConfig.products[productKey].plans[billingType];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
exports.getActiveProviderConfig = getActiveProviderConfig;
|
|
222
|
+
exports.getProductPricing = getProductPricing;
|
|
223
|
+
exports.moneyPriceConfig = moneyPriceConfig;
|