@seaverse/payment-sdk 0.9.3 → 0.9.5
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/README.md +35 -3
- package/dist/index.browser.js +239 -221
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +239 -221
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -11
- package/dist/index.js +239 -221
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -2843,6 +2843,64 @@ class DropinPaymentModal {
|
|
|
2843
2843
|
}
|
|
2844
2844
|
}
|
|
2845
2845
|
|
|
2846
|
+
/**
|
|
2847
|
+
* 共享配置文件
|
|
2848
|
+
* Shared configuration for CreditPackageModal and GenericPackageModal
|
|
2849
|
+
*/
|
|
2850
|
+
/**
|
|
2851
|
+
* 环境配置映射表
|
|
2852
|
+
* SDK 根据 environment 参数自动选择对应的配置
|
|
2853
|
+
*/
|
|
2854
|
+
const ENVIRONMENT_CONFIGS = {
|
|
2855
|
+
development: {
|
|
2856
|
+
scriptUrl: 'https://seaart-publish.sc-api-release.saconsole.com/payment-component/client.js',
|
|
2857
|
+
clientId: 'XF49NOfyZ54O16GujB0ptio2',
|
|
2858
|
+
orderApiUrl: 'https://payment.sg.seaverse.dev',
|
|
2859
|
+
walletApiUrl: 'https://wallet.sg.seaverse.dev',
|
|
2860
|
+
cssUrl: 'https://seaart-publish.sc-api-release.saconsole.com/payment-component/public/style.css',
|
|
2861
|
+
},
|
|
2862
|
+
production: {
|
|
2863
|
+
scriptUrl: 'https://seaart-publish.sc-api.saconsole.com/payment-component/client.js',
|
|
2864
|
+
clientId: 'XF11ik3u5AJ16IyDI3hebq5',
|
|
2865
|
+
orderApiUrl: 'https://payment.seaverse.com',
|
|
2866
|
+
walletApiUrl: 'https://wallet.seaverse.com',
|
|
2867
|
+
cssUrl: 'https://seaart-publish.sc-api.saconsole.com/payment-component/public/style.css',
|
|
2868
|
+
},
|
|
2869
|
+
};
|
|
2870
|
+
/**
|
|
2871
|
+
* 响应式断点配置
|
|
2872
|
+
* Responsive breakpoints for grid layout
|
|
2873
|
+
*/
|
|
2874
|
+
const RESPONSIVE_BREAKPOINTS = {
|
|
2875
|
+
mobile: 768,
|
|
2876
|
+
tablet: 1200,
|
|
2877
|
+
laptop: 1400,
|
|
2878
|
+
desktop: Infinity,
|
|
2879
|
+
};
|
|
2880
|
+
/**
|
|
2881
|
+
* 网格列数配置
|
|
2882
|
+
* Grid columns for different screen sizes
|
|
2883
|
+
*/
|
|
2884
|
+
const GRID_COLUMNS = {
|
|
2885
|
+
mobile: 1,
|
|
2886
|
+
tablet: 2,
|
|
2887
|
+
laptop: 2,
|
|
2888
|
+
desktop: 4,
|
|
2889
|
+
};
|
|
2890
|
+
/**
|
|
2891
|
+
* SDK 初始化配置
|
|
2892
|
+
*/
|
|
2893
|
+
const SDK_CONFIG = {
|
|
2894
|
+
/** 默认脚本加载超时 (毫秒) */
|
|
2895
|
+
DEFAULT_SCRIPT_TIMEOUT: 10000,
|
|
2896
|
+
/** 默认 SDK 初始化超时 (毫秒) */
|
|
2897
|
+
DEFAULT_INIT_TIMEOUT: 30000,
|
|
2898
|
+
/** 默认最大重试次数 */
|
|
2899
|
+
DEFAULT_MAX_RETRIES: 1,
|
|
2900
|
+
/** 默认业务类型 (1=一次性购买, 2=订阅) */
|
|
2901
|
+
DEFAULT_BUSINESS_TYPE: 1,
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2846
2904
|
/**
|
|
2847
2905
|
* SeaartPaymentSDK
|
|
2848
2906
|
* 基于 SeaartPaymentComponent 的支付 SDK 封装
|
|
@@ -2879,22 +2937,22 @@ class SeaartPaymentSDK {
|
|
|
2879
2937
|
return;
|
|
2880
2938
|
}
|
|
2881
2939
|
console.log('[SeaartPaymentSDK] Initializing...', {
|
|
2882
|
-
scriptUrl: config.scriptUrl,
|
|
2883
|
-
clientId: config.clientId,
|
|
2940
|
+
scriptUrl: ENVIRONMENT_CONFIGS[config.environment].scriptUrl,
|
|
2941
|
+
clientId: ENVIRONMENT_CONFIGS[config.environment].clientId,
|
|
2884
2942
|
language: config.language,
|
|
2885
|
-
cssUrl: config.cssUrl,
|
|
2943
|
+
cssUrl: ENVIRONMENT_CONFIGS[config.environment].cssUrl,
|
|
2886
2944
|
});
|
|
2887
2945
|
try {
|
|
2888
2946
|
// 1. 并行加载 CSS 和 JavaScript
|
|
2889
2947
|
const loadTasks = [
|
|
2890
2948
|
ScriptLoader.loadSeaartPaymentComponent({
|
|
2891
|
-
scriptUrl: config.scriptUrl,
|
|
2949
|
+
scriptUrl: ENVIRONMENT_CONFIGS[config.environment].scriptUrl,
|
|
2892
2950
|
timeout: config.scriptTimeout || 10000,
|
|
2893
2951
|
}),
|
|
2894
2952
|
];
|
|
2895
2953
|
// 2. 如果提供了 CSS URL,则加载样式表
|
|
2896
|
-
if (config.cssUrl) {
|
|
2897
|
-
loadTasks.push(StylesheetLoader.loadPaymentStylesheet(config.cssUrl));
|
|
2954
|
+
if (ENVIRONMENT_CONFIGS[config.environment].cssUrl) {
|
|
2955
|
+
loadTasks.push(StylesheetLoader.loadPaymentStylesheet(ENVIRONMENT_CONFIGS[config.environment].cssUrl));
|
|
2898
2956
|
}
|
|
2899
2957
|
// 3. 等待所有资源加载完成
|
|
2900
2958
|
await Promise.all(loadTasks);
|
|
@@ -2910,7 +2968,7 @@ class SeaartPaymentSDK {
|
|
|
2910
2968
|
}
|
|
2911
2969
|
// 4. 初始化 SDK
|
|
2912
2970
|
await window.SeaartPaymentComponent.init({
|
|
2913
|
-
client_id: config.clientId,
|
|
2971
|
+
client_id: ENVIRONMENT_CONFIGS[config.environment].clientId,
|
|
2914
2972
|
language: language,
|
|
2915
2973
|
});
|
|
2916
2974
|
// 5. 保存配置并标记已初始化
|
|
@@ -3285,64 +3343,6 @@ async function getCreditDetail(apiHost, authToken) {
|
|
|
3285
3343
|
}
|
|
3286
3344
|
}
|
|
3287
3345
|
|
|
3288
|
-
/**
|
|
3289
|
-
* 共享配置文件
|
|
3290
|
-
* Shared configuration for CreditPackageModal and GenericPackageModal
|
|
3291
|
-
*/
|
|
3292
|
-
/**
|
|
3293
|
-
* 环境配置映射表
|
|
3294
|
-
* SDK 根据 environment 参数自动选择对应的配置
|
|
3295
|
-
*/
|
|
3296
|
-
const ENVIRONMENT_CONFIGS = {
|
|
3297
|
-
development: {
|
|
3298
|
-
scriptUrl: 'https://seaart-publish.sc-api-release.saconsole.com/payment-component/client.js',
|
|
3299
|
-
clientId: 'XF49NOfyZ54O16GujB0ptio2',
|
|
3300
|
-
orderApiUrl: 'https://payment.sg.seaverse.dev',
|
|
3301
|
-
walletApiUrl: 'https://wallet.sg.seaverse.dev',
|
|
3302
|
-
cssUrl: 'https://seaart-publish.sc-api-release.saconsole.com/payment-component/public/style.css',
|
|
3303
|
-
},
|
|
3304
|
-
production: {
|
|
3305
|
-
scriptUrl: 'https://seaart-publish.sc-api.saconsole.com/payment-component/client.js',
|
|
3306
|
-
clientId: 'prod_client_id',
|
|
3307
|
-
orderApiUrl: 'https://payment.seaverse.com',
|
|
3308
|
-
walletApiUrl: 'https://wallet.seaverse.com',
|
|
3309
|
-
cssUrl: 'https://seaart-publish.sc-api.saconsole.com/payment-component/public/style.css',
|
|
3310
|
-
},
|
|
3311
|
-
};
|
|
3312
|
-
/**
|
|
3313
|
-
* 响应式断点配置
|
|
3314
|
-
* Responsive breakpoints for grid layout
|
|
3315
|
-
*/
|
|
3316
|
-
const RESPONSIVE_BREAKPOINTS = {
|
|
3317
|
-
mobile: 768,
|
|
3318
|
-
tablet: 1200,
|
|
3319
|
-
laptop: 1400,
|
|
3320
|
-
desktop: Infinity,
|
|
3321
|
-
};
|
|
3322
|
-
/**
|
|
3323
|
-
* 网格列数配置
|
|
3324
|
-
* Grid columns for different screen sizes
|
|
3325
|
-
*/
|
|
3326
|
-
const GRID_COLUMNS = {
|
|
3327
|
-
mobile: 1,
|
|
3328
|
-
tablet: 2,
|
|
3329
|
-
laptop: 2,
|
|
3330
|
-
desktop: 4,
|
|
3331
|
-
};
|
|
3332
|
-
/**
|
|
3333
|
-
* SDK 初始化配置
|
|
3334
|
-
*/
|
|
3335
|
-
const SDK_CONFIG = {
|
|
3336
|
-
/** 默认脚本加载超时 (毫秒) */
|
|
3337
|
-
DEFAULT_SCRIPT_TIMEOUT: 10000,
|
|
3338
|
-
/** 默认 SDK 初始化超时 (毫秒) */
|
|
3339
|
-
DEFAULT_INIT_TIMEOUT: 30000,
|
|
3340
|
-
/** 默认最大重试次数 */
|
|
3341
|
-
DEFAULT_MAX_RETRIES: 1,
|
|
3342
|
-
/** 默认业务类型 (1=一次性购买, 2=订阅) */
|
|
3343
|
-
DEFAULT_BUSINESS_TYPE: 1,
|
|
3344
|
-
};
|
|
3345
|
-
|
|
3346
3346
|
/**
|
|
3347
3347
|
* 共享类型定义
|
|
3348
3348
|
* Shared types for CreditPackageModal and GenericPackageModal
|
|
@@ -4178,6 +4178,7 @@ class BasePackageModal {
|
|
|
4178
4178
|
console.log(`[${this.constructor.name}] Using environment:`, config.environment);
|
|
4179
4179
|
// 3. Initialize SeaartPaymentSDK
|
|
4180
4180
|
await SeaartPaymentSDK.getInstance().init({
|
|
4181
|
+
environment: config.environment,
|
|
4181
4182
|
scriptUrl: finalConfig.scriptUrl,
|
|
4182
4183
|
clientId: finalConfig.clientId,
|
|
4183
4184
|
language: this.language,
|
|
@@ -4488,34 +4489,33 @@ async function fetchAvailablePackages(apiHost, token) {
|
|
|
4488
4489
|
* - 悬停微交互和平滑过渡
|
|
4489
4490
|
*/
|
|
4490
4491
|
/**
|
|
4491
|
-
* 设计系统常量 -
|
|
4492
|
+
* 设计系统常量 - 一比一还原参考图
|
|
4492
4493
|
*/
|
|
4493
4494
|
const DESIGN_TOKENS = {
|
|
4494
|
-
//
|
|
4495
|
+
// 卡片尺寸(紧凑布局,4卡并排)
|
|
4495
4496
|
card: {
|
|
4496
|
-
width: '
|
|
4497
|
-
height: '
|
|
4497
|
+
width: '228px',
|
|
4498
|
+
height: 'auto',
|
|
4498
4499
|
borderRadius: '16px',
|
|
4499
|
-
padding: '20px',
|
|
4500
|
+
padding: '28px 20px 16px',
|
|
4500
4501
|
},
|
|
4501
4502
|
// 颜色系统
|
|
4502
4503
|
colors: {
|
|
4503
4504
|
text: {
|
|
4504
4505
|
primary: '#ffffff',
|
|
4505
|
-
|
|
4506
|
-
bonus: '#00e699',
|
|
4506
|
+
bonus: '#00E699',
|
|
4507
4507
|
},
|
|
4508
4508
|
background: {
|
|
4509
|
-
card: 'rgba(255, 255, 255, 0.
|
|
4510
|
-
cardHighlight: 'linear-gradient(
|
|
4511
|
-
bonus: 'rgba(0,
|
|
4512
|
-
button: 'rgba(255, 255, 255, 0.
|
|
4513
|
-
buttonHighlight: 'linear-gradient(
|
|
4509
|
+
card: 'rgba(255, 255, 255, 0.04)',
|
|
4510
|
+
cardHighlight: 'linear-gradient(180deg, rgba(0, 230, 153, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%)',
|
|
4511
|
+
bonus: 'rgba(0, 230, 153, 0.1)',
|
|
4512
|
+
button: 'rgba(255, 255, 255, 0.06)',
|
|
4513
|
+
buttonHighlight: 'linear-gradient(90deg, #00E699 0%, #00D4AA 100%)',
|
|
4514
4514
|
},
|
|
4515
4515
|
border: {
|
|
4516
|
-
default: 'rgba(255, 255, 255, 0.
|
|
4517
|
-
highlighted: 'rgba(0,
|
|
4518
|
-
button: 'rgba(255, 255, 255, 0.
|
|
4516
|
+
default: 'rgba(255, 255, 255, 0.08)',
|
|
4517
|
+
highlighted: 'rgba(0, 230, 153, 0.3)',
|
|
4518
|
+
button: 'rgba(255, 255, 255, 0.1)',
|
|
4519
4519
|
},
|
|
4520
4520
|
glow: '#00E699',
|
|
4521
4521
|
badge: {
|
|
@@ -4532,7 +4532,7 @@ const DESIGN_TOKENS = {
|
|
|
4532
4532
|
},
|
|
4533
4533
|
// 徽章
|
|
4534
4534
|
badge: {
|
|
4535
|
-
size: '
|
|
4535
|
+
size: '72px',
|
|
4536
4536
|
},
|
|
4537
4537
|
};
|
|
4538
4538
|
/**
|
|
@@ -4590,7 +4590,6 @@ class CreditPackCard {
|
|
|
4590
4590
|
display: flex;
|
|
4591
4591
|
flex-direction: column;
|
|
4592
4592
|
align-items: center;
|
|
4593
|
-
justify-content: space-between;
|
|
4594
4593
|
width: ${DESIGN_TOKENS.card.width};
|
|
4595
4594
|
height: ${DESIGN_TOKENS.card.height};
|
|
4596
4595
|
padding: ${DESIGN_TOKENS.card.padding};
|
|
@@ -4599,6 +4598,7 @@ class CreditPackCard {
|
|
|
4599
4598
|
overflow: hidden;
|
|
4600
4599
|
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
4601
4600
|
cursor: pointer;
|
|
4601
|
+
box-sizing: border-box;
|
|
4602
4602
|
`;
|
|
4603
4603
|
// 边框层
|
|
4604
4604
|
const border = document.createElement('div');
|
|
@@ -4618,11 +4618,11 @@ class CreditPackCard {
|
|
|
4618
4618
|
const glowContainer = document.createElement('div');
|
|
4619
4619
|
glowContainer.style.cssText = `
|
|
4620
4620
|
position: absolute;
|
|
4621
|
-
top: -
|
|
4621
|
+
top: -60px;
|
|
4622
4622
|
left: 50%;
|
|
4623
4623
|
transform: translateX(-50%);
|
|
4624
|
-
width:
|
|
4625
|
-
height:
|
|
4624
|
+
width: 160px;
|
|
4625
|
+
height: 120px;
|
|
4626
4626
|
pointer-events: none;
|
|
4627
4627
|
overflow: visible;
|
|
4628
4628
|
`;
|
|
@@ -4636,73 +4636,61 @@ class CreditPackCard {
|
|
|
4636
4636
|
`;
|
|
4637
4637
|
const glow = document.createElement('div');
|
|
4638
4638
|
glow.style.cssText = `
|
|
4639
|
-
width:
|
|
4640
|
-
height:
|
|
4639
|
+
width: 160px;
|
|
4640
|
+
height: 120px;
|
|
4641
4641
|
background: ${DESIGN_TOKENS.colors.glow};
|
|
4642
|
-
opacity: 0.
|
|
4643
|
-
filter: blur(
|
|
4642
|
+
opacity: 0.18;
|
|
4643
|
+
filter: blur(50px);
|
|
4644
4644
|
border-radius: 50%;
|
|
4645
4645
|
`;
|
|
4646
4646
|
glowInner.appendChild(glow);
|
|
4647
4647
|
glowContainer.appendChild(glowInner);
|
|
4648
4648
|
card.appendChild(glowContainer);
|
|
4649
4649
|
}
|
|
4650
|
-
// 悬停效果
|
|
4651
|
-
let hoverAnimationId = null;
|
|
4652
4650
|
card.addEventListener('mouseenter', () => {
|
|
4653
4651
|
card.style.transform = 'translateY(-4px) scale(1.02)';
|
|
4654
4652
|
border.style.borderColor = isHighlighted
|
|
4655
|
-
? 'rgba(0,
|
|
4656
|
-
: 'rgba(255, 255, 255, 0.
|
|
4657
|
-
// 暂停呼吸动画
|
|
4658
|
-
if (hoverAnimationId) {
|
|
4659
|
-
card.style.animationPlayState = 'paused';
|
|
4660
|
-
}
|
|
4653
|
+
? 'rgba(0, 230, 153, 0.5)'
|
|
4654
|
+
: 'rgba(255, 255, 255, 0.15)';
|
|
4661
4655
|
});
|
|
4662
4656
|
card.addEventListener('mouseleave', () => {
|
|
4663
4657
|
card.style.transform = 'translateY(0) scale(1)';
|
|
4664
4658
|
border.style.borderColor = isHighlighted
|
|
4665
4659
|
? DESIGN_TOKENS.colors.border.highlighted
|
|
4666
4660
|
: DESIGN_TOKENS.colors.border.default;
|
|
4667
|
-
// 恢复呼吸动画
|
|
4668
|
-
if (hoverAnimationId) {
|
|
4669
|
-
card.style.animationPlayState = 'running';
|
|
4670
|
-
}
|
|
4671
4661
|
});
|
|
4672
4662
|
// 添加呼吸动画(仅高亮卡片)
|
|
4673
|
-
if (isHighlighted) {
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
@keyframes ${animationId} {
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
}
|
|
4688
|
-
.credit-pack-card[data-package-id="${this.options.id}"] {
|
|
4689
|
-
|
|
4690
|
-
}
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
}
|
|
4663
|
+
// if (isHighlighted) {
|
|
4664
|
+
// const animationId = `pulse-${this.options.id}`;
|
|
4665
|
+
// hoverAnimationId = animationId;
|
|
4666
|
+
// const style = document.createElement('style');
|
|
4667
|
+
// style.textContent = `
|
|
4668
|
+
// @keyframes ${animationId} {
|
|
4669
|
+
// 0%, 100% {
|
|
4670
|
+
// transform: translateY(0) scale(1);
|
|
4671
|
+
// box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3);
|
|
4672
|
+
// }
|
|
4673
|
+
// 50% {
|
|
4674
|
+
// transform: translateY(-2px) scale(1.02);
|
|
4675
|
+
// box-shadow: 0 12px 40px rgba(0, 255, 136, 0.4);
|
|
4676
|
+
// }
|
|
4677
|
+
// }
|
|
4678
|
+
// .credit-pack-card[data-package-id="${this.options.id}"] {
|
|
4679
|
+
// animation: ${animationId} 2s ease-in-out infinite;
|
|
4680
|
+
// }
|
|
4681
|
+
// `;
|
|
4682
|
+
// document.head.appendChild(style);
|
|
4683
|
+
// }
|
|
4694
4684
|
// 内容容器
|
|
4695
4685
|
const contentContainer = document.createElement('div');
|
|
4696
4686
|
contentContainer.style.cssText = `
|
|
4697
4687
|
display: flex;
|
|
4698
4688
|
flex-direction: column;
|
|
4699
4689
|
align-items: center;
|
|
4700
|
-
justify-content:
|
|
4701
|
-
gap:
|
|
4702
|
-
margin-top: 16px;
|
|
4690
|
+
justify-content: flex-start;
|
|
4691
|
+
gap: 0;
|
|
4703
4692
|
z-index: 10;
|
|
4704
4693
|
width: 100%;
|
|
4705
|
-
flex: 1;
|
|
4706
4694
|
`;
|
|
4707
4695
|
// 金额(大数字)
|
|
4708
4696
|
const amountWrapper = document.createElement('div');
|
|
@@ -4710,15 +4698,17 @@ class CreditPackCard {
|
|
|
4710
4698
|
display: flex;
|
|
4711
4699
|
flex-direction: column;
|
|
4712
4700
|
align-items: center;
|
|
4701
|
+
margin-bottom: 2px;
|
|
4713
4702
|
`;
|
|
4714
4703
|
const amount = document.createElement('span');
|
|
4715
4704
|
amount.style.cssText = `
|
|
4716
|
-
font-size:
|
|
4717
|
-
font-weight:
|
|
4718
|
-
line-height:
|
|
4705
|
+
font-size: 32px;
|
|
4706
|
+
font-weight: 600;
|
|
4707
|
+
line-height: 1.1;
|
|
4719
4708
|
font-style: italic;
|
|
4720
4709
|
color: ${DESIGN_TOKENS.colors.text.primary};
|
|
4721
|
-
font-family: -apple-system, BlinkMacSystemFont,
|
|
4710
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
4711
|
+
letter-spacing: -0.02em;
|
|
4722
4712
|
`;
|
|
4723
4713
|
amount.textContent = this.options.totalCredits.toLocaleString();
|
|
4724
4714
|
amountWrapper.appendChild(amount);
|
|
@@ -4726,8 +4716,8 @@ class CreditPackCard {
|
|
|
4726
4716
|
// 积分文本
|
|
4727
4717
|
const creditsWrapper = document.createElement('div');
|
|
4728
4718
|
creditsWrapper.style.cssText = `
|
|
4729
|
-
|
|
4730
|
-
|
|
4719
|
+
margin-bottom: 12px;
|
|
4720
|
+
margin-top: 12px;
|
|
4731
4721
|
display: flex;
|
|
4732
4722
|
align-items: center;
|
|
4733
4723
|
justify-content: center;
|
|
@@ -4735,9 +4725,9 @@ class CreditPackCard {
|
|
|
4735
4725
|
const creditsText = document.createElement('span');
|
|
4736
4726
|
creditsText.style.cssText = `
|
|
4737
4727
|
font-size: 16px;
|
|
4738
|
-
font-weight:
|
|
4739
|
-
|
|
4740
|
-
|
|
4728
|
+
font-weight: 400;
|
|
4729
|
+
color: rgba(255, 255, 255, 0.45);
|
|
4730
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
4741
4731
|
`;
|
|
4742
4732
|
creditsText.textContent = `${this.options.baseCredits.toLocaleString()} ${texts.credits}`;
|
|
4743
4733
|
creditsWrapper.appendChild(creditsText);
|
|
@@ -4747,27 +4737,26 @@ class CreditPackCard {
|
|
|
4747
4737
|
const bonusWrapper = document.createElement('div');
|
|
4748
4738
|
bonusWrapper.style.cssText = `
|
|
4749
4739
|
background: ${DESIGN_TOKENS.colors.background.bonus};
|
|
4750
|
-
padding:
|
|
4751
|
-
border-radius:
|
|
4752
|
-
display: flex;
|
|
4740
|
+
padding: 4px 6px;
|
|
4741
|
+
border-radius: 6px;
|
|
4753
4742
|
align-items: center;
|
|
4754
4743
|
justify-content: center;
|
|
4744
|
+
margin-bottom: 0;
|
|
4755
4745
|
`;
|
|
4756
4746
|
const bonusText = document.createElement('span');
|
|
4757
4747
|
bonusText.style.cssText = `
|
|
4758
|
-
font-size:
|
|
4759
|
-
font-weight:
|
|
4760
|
-
line-height: 24px;
|
|
4748
|
+
font-size: 16px;
|
|
4749
|
+
font-weight: 700;
|
|
4761
4750
|
color: ${DESIGN_TOKENS.colors.text.bonus};
|
|
4751
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
4762
4752
|
`;
|
|
4763
4753
|
bonusText.textContent = `+${this.options.bonusCredits.toLocaleString()} ${texts.bonus}`;
|
|
4764
4754
|
bonusWrapper.appendChild(bonusText);
|
|
4765
4755
|
contentContainer.appendChild(bonusWrapper);
|
|
4766
4756
|
}
|
|
4767
4757
|
else {
|
|
4768
|
-
// 占位以保持高度一致
|
|
4769
4758
|
const spacer = document.createElement('div');
|
|
4770
|
-
spacer.style.cssText = 'height:
|
|
4759
|
+
spacer.style.cssText = 'height: 24px; margin-bottom: 0;';
|
|
4771
4760
|
contentContainer.appendChild(spacer);
|
|
4772
4761
|
}
|
|
4773
4762
|
card.appendChild(contentContainer);
|
|
@@ -4783,9 +4772,9 @@ class CreditPackCard {
|
|
|
4783
4772
|
border: ${isHighlighted ? 'none' : `1px solid ${DESIGN_TOKENS.colors.border.button}`};
|
|
4784
4773
|
background: ${isHighlighted ? DESIGN_TOKENS.colors.background.buttonHighlight : DESIGN_TOKENS.colors.background.button};
|
|
4785
4774
|
color: ${isHighlighted ? '#0a0a0f' : DESIGN_TOKENS.colors.text.primary};
|
|
4786
|
-
font-size:
|
|
4787
|
-
font-weight:
|
|
4788
|
-
line-height:
|
|
4775
|
+
font-size: 18px;
|
|
4776
|
+
font-weight: 700;
|
|
4777
|
+
line-height: 1;
|
|
4789
4778
|
cursor: pointer;
|
|
4790
4779
|
display: flex;
|
|
4791
4780
|
align-items: center;
|
|
@@ -4793,8 +4782,9 @@ class CreditPackCard {
|
|
|
4793
4782
|
overflow: hidden;
|
|
4794
4783
|
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
4795
4784
|
z-index: 10;
|
|
4796
|
-
margin-top:
|
|
4797
|
-
|
|
4785
|
+
margin-top: 16px;
|
|
4786
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
4787
|
+
box-shadow: ${isHighlighted ? '0 4px 16px rgba(0, 230, 153, 0.35)' : 'none'};
|
|
4798
4788
|
`;
|
|
4799
4789
|
// 按钮内边框(仅非高亮)
|
|
4800
4790
|
if (!isHighlighted) {
|
|
@@ -4815,16 +4805,17 @@ class CreditPackCard {
|
|
|
4815
4805
|
// 按钮悬停效果
|
|
4816
4806
|
button.addEventListener('mouseenter', () => {
|
|
4817
4807
|
if (isHighlighted) {
|
|
4818
|
-
button.style.boxShadow = '0 6px 20px rgba(0,
|
|
4808
|
+
button.style.boxShadow = '0 6px 20px rgba(0, 230, 153, 0.45)';
|
|
4809
|
+
button.style.transform = 'translateY(-1px)';
|
|
4819
4810
|
}
|
|
4820
4811
|
else {
|
|
4821
|
-
button.style.background = 'rgba(255, 255, 255, 0.
|
|
4812
|
+
button.style.background = 'rgba(255, 255, 255, 0.1)';
|
|
4813
|
+
button.style.transform = 'translateY(-1px)';
|
|
4822
4814
|
}
|
|
4823
|
-
button.style.transform = 'translateY(-2px)';
|
|
4824
4815
|
});
|
|
4825
4816
|
button.addEventListener('mouseleave', () => {
|
|
4826
4817
|
if (isHighlighted) {
|
|
4827
|
-
button.style.boxShadow = '0 4px 16px rgba(0,
|
|
4818
|
+
button.style.boxShadow = '0 4px 16px rgba(0, 230, 153, 0.35)';
|
|
4828
4819
|
}
|
|
4829
4820
|
else {
|
|
4830
4821
|
button.style.background = DESIGN_TOKENS.colors.background.button;
|
|
@@ -4851,18 +4842,19 @@ class CreditPackCard {
|
|
|
4851
4842
|
const badge = document.createElement('div');
|
|
4852
4843
|
badge.style.cssText = `
|
|
4853
4844
|
position: absolute;
|
|
4854
|
-
top: -
|
|
4855
|
-
right: -
|
|
4845
|
+
top: -16px;
|
|
4846
|
+
right: -12px;
|
|
4856
4847
|
width: ${DESIGN_TOKENS.badge.size};
|
|
4857
4848
|
height: ${DESIGN_TOKENS.badge.size};
|
|
4858
4849
|
z-index: 30;
|
|
4859
4850
|
pointer-events: none;
|
|
4851
|
+
transform: rotate(12deg);
|
|
4860
4852
|
`;
|
|
4861
4853
|
// SVG 内容
|
|
4862
4854
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
4863
4855
|
const svg = document.createElementNS(svgNS, 'svg');
|
|
4864
|
-
svg.setAttribute('width', '
|
|
4865
|
-
svg.setAttribute('height', '
|
|
4856
|
+
svg.setAttribute('width', '72');
|
|
4857
|
+
svg.setAttribute('height', '72');
|
|
4866
4858
|
svg.setAttribute('viewBox', '0 0 86 86');
|
|
4867
4859
|
svg.setAttribute('fill', 'none');
|
|
4868
4860
|
svg.style.cssText = 'width: 100%; height: 100%;';
|
|
@@ -4878,47 +4870,25 @@ class CreditPackCard {
|
|
|
4878
4870
|
starStroke.setAttribute('stroke-opacity', '0.08');
|
|
4879
4871
|
svg.appendChild(starStroke);
|
|
4880
4872
|
// 文字(中文或英文)
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
svg.appendChild(text2);
|
|
4901
|
-
}
|
|
4902
|
-
else {
|
|
4903
|
-
const text1 = document.createElementNS(svgNS, 'text');
|
|
4904
|
-
text1.setAttribute('x', '43');
|
|
4905
|
-
text1.setAttribute('y', '35');
|
|
4906
|
-
text1.setAttribute('text-anchor', 'middle');
|
|
4907
|
-
text1.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
|
|
4908
|
-
text1.setAttribute('font-size', '10');
|
|
4909
|
-
text1.setAttribute('font-weight', '700');
|
|
4910
|
-
text1.textContent = 'On 1st';
|
|
4911
|
-
svg.appendChild(text1);
|
|
4912
|
-
const text2 = document.createElementNS(svgNS, 'text');
|
|
4913
|
-
text2.setAttribute('x', '43');
|
|
4914
|
-
text2.setAttribute('y', '51');
|
|
4915
|
-
text2.setAttribute('text-anchor', 'middle');
|
|
4916
|
-
text2.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
|
|
4917
|
-
text2.setAttribute('font-size', '12');
|
|
4918
|
-
text2.setAttribute('font-weight', '700');
|
|
4919
|
-
text2.textContent = 'Double';
|
|
4920
|
-
svg.appendChild(text2);
|
|
4921
|
-
}
|
|
4873
|
+
const text1 = document.createElementNS(svgNS, 'text');
|
|
4874
|
+
text1.setAttribute('x', '43');
|
|
4875
|
+
text1.setAttribute('y', '38');
|
|
4876
|
+
text1.setAttribute('text-anchor', 'middle');
|
|
4877
|
+
text1.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
|
|
4878
|
+
text1.setAttribute('font-size', '14');
|
|
4879
|
+
text1.setAttribute('font-weight', '800');
|
|
4880
|
+
text1.setAttribute('font-style', 'italic');
|
|
4881
|
+
text1.textContent = 'Double';
|
|
4882
|
+
svg.appendChild(text1);
|
|
4883
|
+
const text2 = document.createElementNS(svgNS, 'text');
|
|
4884
|
+
text2.setAttribute('x', '43');
|
|
4885
|
+
text2.setAttribute('y', '53');
|
|
4886
|
+
text2.setAttribute('text-anchor', 'middle');
|
|
4887
|
+
text2.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
|
|
4888
|
+
text2.setAttribute('font-size', '10');
|
|
4889
|
+
text2.setAttribute('font-weight', '700');
|
|
4890
|
+
text2.textContent = 'ON 1ST';
|
|
4891
|
+
svg.appendChild(text2);
|
|
4922
4892
|
// 渐变定义
|
|
4923
4893
|
const defs = document.createElementNS(svgNS, 'defs');
|
|
4924
4894
|
const gradient = document.createElementNS(svgNS, 'linearGradient');
|
|
@@ -8377,16 +8347,6 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8377
8347
|
this.isFetchingPackages = false;
|
|
8378
8348
|
}
|
|
8379
8349
|
}
|
|
8380
|
-
/**
|
|
8381
|
-
* Parse purchase limit string to day_limit number
|
|
8382
|
-
* Example: "Daily limit: 1" => 1
|
|
8383
|
-
*/
|
|
8384
|
-
parsePurchaseLimit(limit) {
|
|
8385
|
-
if (!limit)
|
|
8386
|
-
return 0;
|
|
8387
|
-
const match = limit.match(/\d+/);
|
|
8388
|
-
return match ? parseInt(match[0]) : 0;
|
|
8389
|
-
}
|
|
8390
8350
|
/**
|
|
8391
8351
|
* 覆盖 BasePackageModal 的 handlePaymentFlow 方法
|
|
8392
8352
|
* 使用 PaymentCheckoutModal 替代旧的 DropinPaymentModal
|
|
@@ -8521,6 +8481,7 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8521
8481
|
if (modalElement) {
|
|
8522
8482
|
modalElement.style.background = '#0a0a0f';
|
|
8523
8483
|
modalElement.style.border = '1px solid rgba(255, 255, 255, 0.1)';
|
|
8484
|
+
modalElement.style.borderRadius = '24px';
|
|
8524
8485
|
}
|
|
8525
8486
|
// Modify title style
|
|
8526
8487
|
const titleElement = document.querySelector('.payment-modal-title');
|
|
@@ -8531,6 +8492,33 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8531
8492
|
titleElement.style.padding = '32px 32px 0 32px';
|
|
8532
8493
|
titleElement.style.marginBottom = '16px';
|
|
8533
8494
|
titleElement.style.letterSpacing = '-0.01em';
|
|
8495
|
+
titleElement.style.display = 'none'; // Hide default title, we use custom header in renderContent
|
|
8496
|
+
}
|
|
8497
|
+
// Add responsive styles for cards
|
|
8498
|
+
if (!document.getElementById('credit-package-responsive-styles')) {
|
|
8499
|
+
const style = document.createElement('style');
|
|
8500
|
+
style.id = 'credit-package-responsive-styles';
|
|
8501
|
+
style.textContent = `
|
|
8502
|
+
@media (max-width: 768px) {
|
|
8503
|
+
.credit-pack-card-container {
|
|
8504
|
+
width: 100% !important;
|
|
8505
|
+
max-width: 320px;
|
|
8506
|
+
margin: 0 auto;
|
|
8507
|
+
}
|
|
8508
|
+
.credit-pack-card {
|
|
8509
|
+
width: 100% !important;
|
|
8510
|
+
height: 300px !important;
|
|
8511
|
+
padding: 28px 20px 20px !important;
|
|
8512
|
+
border-radius: 20px !important;
|
|
8513
|
+
}
|
|
8514
|
+
.payment-modal {
|
|
8515
|
+
width: 95vw !important;
|
|
8516
|
+
max-height: 90vh !important;
|
|
8517
|
+
overflow-y: auto !important;
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
`;
|
|
8521
|
+
document.head.appendChild(style);
|
|
8534
8522
|
}
|
|
8535
8523
|
// Modify close button color and add hover animation
|
|
8536
8524
|
const closeButton = document.querySelector('.payment-modal-close');
|
|
@@ -8563,7 +8551,8 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8563
8551
|
if (!container) {
|
|
8564
8552
|
throw new Error('Modal content container not found');
|
|
8565
8553
|
}
|
|
8566
|
-
const
|
|
8554
|
+
const lang = this.language ?? 'en';
|
|
8555
|
+
const isZh = lang === 'zh' || lang === 'zh-TW';
|
|
8567
8556
|
const styles = this.getResponsiveStyles();
|
|
8568
8557
|
container.innerHTML = `
|
|
8569
8558
|
<div style="
|
|
@@ -8573,10 +8562,10 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8573
8562
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
8574
8563
|
">
|
|
8575
8564
|
<!-- Credit Packs - credit package purchase title -->
|
|
8576
|
-
<div style="margin: 0 auto ${
|
|
8565
|
+
<div style="margin: 0 auto ${styles.headerMargin}; max-width: 80rem; text-align: center;">
|
|
8577
8566
|
<h3 style="
|
|
8578
8567
|
margin-bottom: ${this.SPACING.xs};
|
|
8579
|
-
font-size:
|
|
8568
|
+
font-size: ${styles.titleFontSize};
|
|
8580
8569
|
font-weight: 700;
|
|
8581
8570
|
color: ${this.COLORS.text.primary};
|
|
8582
8571
|
letter-spacing: -0.02em;
|
|
@@ -8584,7 +8573,7 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8584
8573
|
${isZh ? '需要更多积分?' : 'Need More Credits?'}
|
|
8585
8574
|
</h3>
|
|
8586
8575
|
<p style="
|
|
8587
|
-
font-size:
|
|
8576
|
+
font-size: ${styles.subtitleFontSize};
|
|
8588
8577
|
color: ${this.COLORS.text.secondary};
|
|
8589
8578
|
line-height: 1.6;
|
|
8590
8579
|
">
|
|
@@ -8596,7 +8585,8 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8596
8585
|
<div style="
|
|
8597
8586
|
display: grid;
|
|
8598
8587
|
grid-template-columns: ${styles.packGridColumns};
|
|
8599
|
-
gap:
|
|
8588
|
+
gap: ${styles.gridGap};
|
|
8589
|
+
justify-items: center;
|
|
8600
8590
|
">
|
|
8601
8591
|
${this.getPackages().map((pkg, index) => this.renderPackageCard(pkg, index)).join('')}
|
|
8602
8592
|
</div>
|
|
@@ -8611,30 +8601,55 @@ class CreditPackageModal extends BasePackageModal {
|
|
|
8611
8601
|
*/
|
|
8612
8602
|
getResponsiveStyles() {
|
|
8613
8603
|
const isMobile = window.matchMedia('(max-width: 768px)').matches;
|
|
8614
|
-
const isTablet = window.matchMedia('(max-width:
|
|
8604
|
+
const isTablet = window.matchMedia('(max-width: 1024px)').matches;
|
|
8615
8605
|
const isLaptop = window.matchMedia('(max-width: 1400px)').matches;
|
|
8616
8606
|
let computeColumns = 5;
|
|
8617
8607
|
let packColumns = 4;
|
|
8618
8608
|
let padding = '0 60px 60px';
|
|
8609
|
+
let titleSize = '32px';
|
|
8610
|
+
let subtitleSize = '16px';
|
|
8611
|
+
let headerMargin = this.SPACING.lg;
|
|
8612
|
+
let gridGap = '24px';
|
|
8619
8613
|
if (isMobile) {
|
|
8620
8614
|
computeColumns = 1;
|
|
8621
8615
|
packColumns = 1;
|
|
8622
|
-
padding = '0
|
|
8616
|
+
padding = '0 16px 32px';
|
|
8617
|
+
titleSize = '24px';
|
|
8618
|
+
subtitleSize = '14px';
|
|
8619
|
+
headerMargin = this.SPACING.md;
|
|
8620
|
+
gridGap = '16px';
|
|
8623
8621
|
}
|
|
8624
8622
|
else if (isTablet) {
|
|
8625
8623
|
computeColumns = 2;
|
|
8626
8624
|
packColumns = 2;
|
|
8627
|
-
padding = '0
|
|
8625
|
+
padding = '0 32px 48px';
|
|
8626
|
+
titleSize = '28px';
|
|
8627
|
+
subtitleSize = '15px';
|
|
8628
|
+
headerMargin = this.SPACING.md;
|
|
8629
|
+
gridGap = '20px';
|
|
8628
8630
|
}
|
|
8629
8631
|
else if (isLaptop) {
|
|
8630
8632
|
computeColumns = 3;
|
|
8631
|
-
packColumns =
|
|
8632
|
-
padding = '0
|
|
8633
|
+
packColumns = 3;
|
|
8634
|
+
padding = '0 48px 60px';
|
|
8635
|
+
titleSize = '32px';
|
|
8636
|
+
subtitleSize = '16px';
|
|
8637
|
+
headerMargin = this.SPACING.lg;
|
|
8638
|
+
gridGap = '24px';
|
|
8639
|
+
}
|
|
8640
|
+
// Adjust columns based on package count if small
|
|
8641
|
+
const packageCount = this.getPackages().length;
|
|
8642
|
+
if (!isMobile && packageCount < packColumns) {
|
|
8643
|
+
packColumns = packageCount;
|
|
8633
8644
|
}
|
|
8634
8645
|
return {
|
|
8635
8646
|
containerPadding: padding,
|
|
8636
8647
|
computeGridColumns: `repeat(${computeColumns}, 1fr)`,
|
|
8637
8648
|
packGridColumns: `repeat(${packColumns}, 1fr)`,
|
|
8649
|
+
titleFontSize: titleSize,
|
|
8650
|
+
subtitleFontSize: subtitleSize,
|
|
8651
|
+
headerMargin: headerMargin,
|
|
8652
|
+
gridGap: gridGap,
|
|
8638
8653
|
};
|
|
8639
8654
|
}
|
|
8640
8655
|
/**
|
|
@@ -8758,20 +8773,23 @@ class GenericPackageModal extends BasePackageModal {
|
|
|
8758
8773
|
* Apply modal styling (hook method override)
|
|
8759
8774
|
*/
|
|
8760
8775
|
applyModalStyling() {
|
|
8761
|
-
// Modify modal style - make card fully fill
|
|
8776
|
+
// Modify modal style - make card fully fill, remove white background
|
|
8762
8777
|
const modalElement = document.querySelector('.payment-modal');
|
|
8763
8778
|
if (modalElement) {
|
|
8764
8779
|
modalElement.style.background = 'transparent';
|
|
8780
|
+
modalElement.style.backgroundColor = 'transparent';
|
|
8765
8781
|
modalElement.style.border = 'none';
|
|
8766
8782
|
modalElement.style.padding = '0';
|
|
8767
|
-
modalElement.style.borderRadius = '
|
|
8768
|
-
modalElement.style.overflow = '
|
|
8783
|
+
modalElement.style.borderRadius = '0';
|
|
8784
|
+
modalElement.style.overflow = 'visible';
|
|
8785
|
+
modalElement.style.boxShadow = 'none';
|
|
8769
8786
|
}
|
|
8770
8787
|
// Modify content container style - remove padding
|
|
8771
8788
|
const contentElement = document.querySelector('.payment-modal-content');
|
|
8772
8789
|
if (contentElement) {
|
|
8773
8790
|
contentElement.style.padding = '0';
|
|
8774
8791
|
contentElement.style.margin = '0';
|
|
8792
|
+
contentElement.style.background = 'transparent';
|
|
8775
8793
|
}
|
|
8776
8794
|
// Listen for close button event from card
|
|
8777
8795
|
const container = this.getContentContainer();
|
|
@@ -9166,7 +9184,7 @@ class GenericPackageModal extends BasePackageModal {
|
|
|
9166
9184
|
/**
|
|
9167
9185
|
* SDK version
|
|
9168
9186
|
*/
|
|
9169
|
-
const VERSION$2 = '0.9.
|
|
9187
|
+
const VERSION$2 = '0.9.5';
|
|
9170
9188
|
|
|
9171
9189
|
var __defProp = Object.defineProperty;
|
|
9172
9190
|
var __defProps = Object.defineProperties;
|