@seaverse/payment-sdk 0.9.4 → 0.9.6

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/index.cjs CHANGED
@@ -2970,7 +2970,7 @@ class SeaartPaymentSDK {
2970
2970
  }
2971
2971
  // 4. 初始化 SDK
2972
2972
  await window.SeaartPaymentComponent.init({
2973
- client_id: config.clientId,
2973
+ client_id: ENVIRONMENT_CONFIGS[config.environment].clientId,
2974
2974
  language: language,
2975
2975
  });
2976
2976
  // 5. 保存配置并标记已初始化
@@ -4467,7 +4467,6 @@ async function fetchAvailablePackages(apiHost, token) {
4467
4467
  throw new Error(`Failed to fetch available packages: ${response.status} ${response.statusText}`);
4468
4468
  }
4469
4469
  const result = await response.json();
4470
- console.log('%c =获取可用积分包列表==result===>>>>>>>>', 'color:orange;', result);
4471
4470
  if (result.code !== 0 || !result.data) {
4472
4471
  throw new Error(result.msg || 'Failed to fetch available packages');
4473
4472
  }
@@ -4491,34 +4490,33 @@ async function fetchAvailablePackages(apiHost, token) {
4491
4490
  * - 悬停微交互和平滑过渡
4492
4491
  */
4493
4492
  /**
4494
- * 设计系统常量 - 完全还原 Restore UI Design
4493
+ * 设计系统常量 - 一比一还原参考图
4495
4494
  */
4496
4495
  const DESIGN_TOKENS = {
4497
- // 卡片尺寸(固定 246x252px)
4496
+ // 卡片尺寸(紧凑布局,4卡并排)
4498
4497
  card: {
4499
- width: '246px',
4500
- height: '252px',
4498
+ width: '228px',
4499
+ height: 'auto',
4501
4500
  borderRadius: '16px',
4502
- padding: '20px',
4501
+ padding: '28px 20px 16px',
4503
4502
  },
4504
4503
  // 颜色系统
4505
4504
  colors: {
4506
4505
  text: {
4507
4506
  primary: '#ffffff',
4508
- secondary: '#aaaaaa',
4509
- bonus: '#00e699',
4507
+ bonus: '#00E699',
4510
4508
  },
4511
4509
  background: {
4512
- card: 'rgba(255, 255, 255, 0.05)',
4513
- cardHighlight: 'linear-gradient(to bottom, rgba(0, 255, 136, 0.1), rgba(255, 255, 255, 0.05))',
4514
- bonus: 'rgba(0, 204, 136, 0.12)',
4515
- button: 'rgba(255, 255, 255, 0.08)',
4516
- buttonHighlight: 'linear-gradient(to right, #00ff88, #00f2fe)',
4510
+ card: 'rgba(255, 255, 255, 0.04)',
4511
+ cardHighlight: 'linear-gradient(180deg, rgba(0, 230, 153, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%)',
4512
+ bonus: 'rgba(0, 230, 153, 0.1)',
4513
+ button: 'rgba(255, 255, 255, 0.06)',
4514
+ buttonHighlight: 'linear-gradient(90deg, #00E699 0%, #00D4AA 100%)',
4517
4515
  },
4518
4516
  border: {
4519
- default: 'rgba(255, 255, 255, 0.06)',
4520
- highlighted: 'rgba(0, 255, 136, 0.3)',
4521
- button: 'rgba(255, 255, 255, 0.12)',
4517
+ default: 'rgba(255, 255, 255, 0.08)',
4518
+ highlighted: 'rgba(0, 230, 153, 0.3)',
4519
+ button: 'rgba(255, 255, 255, 0.1)',
4522
4520
  },
4523
4521
  glow: '#00E699',
4524
4522
  badge: {
@@ -4535,7 +4533,7 @@ const DESIGN_TOKENS = {
4535
4533
  },
4536
4534
  // 徽章
4537
4535
  badge: {
4538
- size: '86px',
4536
+ size: '72px',
4539
4537
  },
4540
4538
  };
4541
4539
  /**
@@ -4593,7 +4591,6 @@ class CreditPackCard {
4593
4591
  display: flex;
4594
4592
  flex-direction: column;
4595
4593
  align-items: center;
4596
- justify-content: space-between;
4597
4594
  width: ${DESIGN_TOKENS.card.width};
4598
4595
  height: ${DESIGN_TOKENS.card.height};
4599
4596
  padding: ${DESIGN_TOKENS.card.padding};
@@ -4602,6 +4599,7 @@ class CreditPackCard {
4602
4599
  overflow: hidden;
4603
4600
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
4604
4601
  cursor: pointer;
4602
+ box-sizing: border-box;
4605
4603
  `;
4606
4604
  // 边框层
4607
4605
  const border = document.createElement('div');
@@ -4621,11 +4619,11 @@ class CreditPackCard {
4621
4619
  const glowContainer = document.createElement('div');
4622
4620
  glowContainer.style.cssText = `
4623
4621
  position: absolute;
4624
- top: -72px;
4622
+ top: -60px;
4625
4623
  left: 50%;
4626
4624
  transform: translateX(-50%);
4627
- width: 194px;
4628
- height: 144px;
4625
+ width: 160px;
4626
+ height: 120px;
4629
4627
  pointer-events: none;
4630
4628
  overflow: visible;
4631
4629
  `;
@@ -4639,73 +4637,61 @@ class CreditPackCard {
4639
4637
  `;
4640
4638
  const glow = document.createElement('div');
4641
4639
  glow.style.cssText = `
4642
- width: 194px;
4643
- height: 144px;
4640
+ width: 160px;
4641
+ height: 120px;
4644
4642
  background: ${DESIGN_TOKENS.colors.glow};
4645
- opacity: 0.2;
4646
- filter: blur(54px);
4643
+ opacity: 0.18;
4644
+ filter: blur(50px);
4647
4645
  border-radius: 50%;
4648
4646
  `;
4649
4647
  glowInner.appendChild(glow);
4650
4648
  glowContainer.appendChild(glowInner);
4651
4649
  card.appendChild(glowContainer);
4652
4650
  }
4653
- // 悬停效果
4654
- let hoverAnimationId = null;
4655
4651
  card.addEventListener('mouseenter', () => {
4656
4652
  card.style.transform = 'translateY(-4px) scale(1.02)';
4657
4653
  border.style.borderColor = isHighlighted
4658
- ? 'rgba(0, 255, 136, 0.5)'
4659
- : 'rgba(255, 255, 255, 0.12)';
4660
- // 暂停呼吸动画
4661
- if (hoverAnimationId) {
4662
- card.style.animationPlayState = 'paused';
4663
- }
4654
+ ? 'rgba(0, 230, 153, 0.5)'
4655
+ : 'rgba(255, 255, 255, 0.15)';
4664
4656
  });
4665
4657
  card.addEventListener('mouseleave', () => {
4666
4658
  card.style.transform = 'translateY(0) scale(1)';
4667
4659
  border.style.borderColor = isHighlighted
4668
4660
  ? DESIGN_TOKENS.colors.border.highlighted
4669
4661
  : DESIGN_TOKENS.colors.border.default;
4670
- // 恢复呼吸动画
4671
- if (hoverAnimationId) {
4672
- card.style.animationPlayState = 'running';
4673
- }
4674
4662
  });
4675
4663
  // 添加呼吸动画(仅高亮卡片)
4676
- if (isHighlighted) {
4677
- const animationId = `pulse-${this.options.id}`;
4678
- hoverAnimationId = animationId;
4679
- const style = document.createElement('style');
4680
- style.textContent = `
4681
- @keyframes ${animationId} {
4682
- 0%, 100% {
4683
- transform: translateY(0) scale(1);
4684
- box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3);
4685
- }
4686
- 50% {
4687
- transform: translateY(-2px) scale(1.02);
4688
- box-shadow: 0 12px 40px rgba(0, 255, 136, 0.4);
4689
- }
4690
- }
4691
- .credit-pack-card[data-package-id="${this.options.id}"] {
4692
- animation: ${animationId} 2s ease-in-out infinite;
4693
- }
4694
- `;
4695
- document.head.appendChild(style);
4696
- }
4664
+ // if (isHighlighted) {
4665
+ // const animationId = `pulse-${this.options.id}`;
4666
+ // hoverAnimationId = animationId;
4667
+ // const style = document.createElement('style');
4668
+ // style.textContent = `
4669
+ // @keyframes ${animationId} {
4670
+ // 0%, 100% {
4671
+ // transform: translateY(0) scale(1);
4672
+ // box-shadow: 0 8px 32px rgba(0, 255, 136, 0.3);
4673
+ // }
4674
+ // 50% {
4675
+ // transform: translateY(-2px) scale(1.02);
4676
+ // box-shadow: 0 12px 40px rgba(0, 255, 136, 0.4);
4677
+ // }
4678
+ // }
4679
+ // .credit-pack-card[data-package-id="${this.options.id}"] {
4680
+ // animation: ${animationId} 2s ease-in-out infinite;
4681
+ // }
4682
+ // `;
4683
+ // document.head.appendChild(style);
4684
+ // }
4697
4685
  // 内容容器
4698
4686
  const contentContainer = document.createElement('div');
4699
4687
  contentContainer.style.cssText = `
4700
4688
  display: flex;
4701
4689
  flex-direction: column;
4702
4690
  align-items: center;
4703
- justify-content: center;
4704
- gap: 12px;
4705
- margin-top: 16px;
4691
+ justify-content: flex-start;
4692
+ gap: 0;
4706
4693
  z-index: 10;
4707
4694
  width: 100%;
4708
- flex: 1;
4709
4695
  `;
4710
4696
  // 金额(大数字)
4711
4697
  const amountWrapper = document.createElement('div');
@@ -4713,15 +4699,17 @@ class CreditPackCard {
4713
4699
  display: flex;
4714
4700
  flex-direction: column;
4715
4701
  align-items: center;
4702
+ margin-bottom: 2px;
4716
4703
  `;
4717
4704
  const amount = document.createElement('span');
4718
4705
  amount.style.cssText = `
4719
- font-size: 36px;
4720
- font-weight: 700;
4721
- line-height: 36px;
4706
+ font-size: 32px;
4707
+ font-weight: 600;
4708
+ line-height: 1.1;
4722
4709
  font-style: italic;
4723
4710
  color: ${DESIGN_TOKENS.colors.text.primary};
4724
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
4711
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
4712
+ letter-spacing: -0.02em;
4725
4713
  `;
4726
4714
  amount.textContent = this.options.totalCredits.toLocaleString();
4727
4715
  amountWrapper.appendChild(amount);
@@ -4729,8 +4717,8 @@ class CreditPackCard {
4729
4717
  // 积分文本
4730
4718
  const creditsWrapper = document.createElement('div');
4731
4719
  creditsWrapper.style.cssText = `
4732
- padding: 2px 8px;
4733
- border-radius: 4px;
4720
+ margin-bottom: 12px;
4721
+ margin-top: 12px;
4734
4722
  display: flex;
4735
4723
  align-items: center;
4736
4724
  justify-content: center;
@@ -4738,9 +4726,9 @@ class CreditPackCard {
4738
4726
  const creditsText = document.createElement('span');
4739
4727
  creditsText.style.cssText = `
4740
4728
  font-size: 16px;
4741
- font-weight: 500;
4742
- line-height: 24px;
4743
- color: ${DESIGN_TOKENS.colors.text.secondary};
4729
+ font-weight: 400;
4730
+ color: rgba(255, 255, 255, 0.45);
4731
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
4744
4732
  `;
4745
4733
  creditsText.textContent = `${this.options.baseCredits.toLocaleString()} ${texts.credits}`;
4746
4734
  creditsWrapper.appendChild(creditsText);
@@ -4750,27 +4738,26 @@ class CreditPackCard {
4750
4738
  const bonusWrapper = document.createElement('div');
4751
4739
  bonusWrapper.style.cssText = `
4752
4740
  background: ${DESIGN_TOKENS.colors.background.bonus};
4753
- padding: 2px 8px;
4754
- border-radius: 4px;
4755
- display: flex;
4741
+ padding: 4px 6px;
4742
+ border-radius: 6px;
4756
4743
  align-items: center;
4757
4744
  justify-content: center;
4745
+ margin-bottom: 0;
4758
4746
  `;
4759
4747
  const bonusText = document.createElement('span');
4760
4748
  bonusText.style.cssText = `
4761
- font-size: 18px;
4762
- font-weight: 500;
4763
- line-height: 24px;
4749
+ font-size: 16px;
4750
+ font-weight: 700;
4764
4751
  color: ${DESIGN_TOKENS.colors.text.bonus};
4752
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
4765
4753
  `;
4766
4754
  bonusText.textContent = `+${this.options.bonusCredits.toLocaleString()} ${texts.bonus}`;
4767
4755
  bonusWrapper.appendChild(bonusText);
4768
4756
  contentContainer.appendChild(bonusWrapper);
4769
4757
  }
4770
4758
  else {
4771
- // 占位以保持高度一致
4772
4759
  const spacer = document.createElement('div');
4773
- spacer.style.cssText = 'height: 28px;';
4760
+ spacer.style.cssText = 'height: 24px; margin-bottom: 0;';
4774
4761
  contentContainer.appendChild(spacer);
4775
4762
  }
4776
4763
  card.appendChild(contentContainer);
@@ -4786,9 +4773,9 @@ class CreditPackCard {
4786
4773
  border: ${isHighlighted ? 'none' : `1px solid ${DESIGN_TOKENS.colors.border.button}`};
4787
4774
  background: ${isHighlighted ? DESIGN_TOKENS.colors.background.buttonHighlight : DESIGN_TOKENS.colors.background.button};
4788
4775
  color: ${isHighlighted ? '#0a0a0f' : DESIGN_TOKENS.colors.text.primary};
4789
- font-size: 16px;
4790
- font-weight: ${isHighlighted ? '700' : '600'};
4791
- line-height: 20px;
4776
+ font-size: 18px;
4777
+ font-weight: 700;
4778
+ line-height: 1;
4792
4779
  cursor: pointer;
4793
4780
  display: flex;
4794
4781
  align-items: center;
@@ -4796,8 +4783,9 @@ class CreditPackCard {
4796
4783
  overflow: hidden;
4797
4784
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
4798
4785
  z-index: 10;
4799
- margin-top: auto;
4800
- box-shadow: ${isHighlighted ? '0 4px 16px rgba(0, 255, 136, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3)' : 'none'};
4786
+ margin-top: 16px;
4787
+ font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
4788
+ box-shadow: ${isHighlighted ? '0 4px 16px rgba(0, 230, 153, 0.35)' : 'none'};
4801
4789
  `;
4802
4790
  // 按钮内边框(仅非高亮)
4803
4791
  if (!isHighlighted) {
@@ -4818,16 +4806,17 @@ class CreditPackCard {
4818
4806
  // 按钮悬停效果
4819
4807
  button.addEventListener('mouseenter', () => {
4820
4808
  if (isHighlighted) {
4821
- button.style.boxShadow = '0 6px 20px rgba(0, 255, 136, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.4)';
4809
+ button.style.boxShadow = '0 6px 20px rgba(0, 230, 153, 0.45)';
4810
+ button.style.transform = 'translateY(-1px)';
4822
4811
  }
4823
4812
  else {
4824
- button.style.background = 'rgba(255, 255, 255, 0.15)';
4813
+ button.style.background = 'rgba(255, 255, 255, 0.1)';
4814
+ button.style.transform = 'translateY(-1px)';
4825
4815
  }
4826
- button.style.transform = 'translateY(-2px)';
4827
4816
  });
4828
4817
  button.addEventListener('mouseleave', () => {
4829
4818
  if (isHighlighted) {
4830
- button.style.boxShadow = '0 4px 16px rgba(0, 255, 136, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3)';
4819
+ button.style.boxShadow = '0 4px 16px rgba(0, 230, 153, 0.35)';
4831
4820
  }
4832
4821
  else {
4833
4822
  button.style.background = DESIGN_TOKENS.colors.background.button;
@@ -4854,18 +4843,19 @@ class CreditPackCard {
4854
4843
  const badge = document.createElement('div');
4855
4844
  badge.style.cssText = `
4856
4845
  position: absolute;
4857
- top: -30px;
4858
- right: -14px;
4846
+ top: -16px;
4847
+ right: -12px;
4859
4848
  width: ${DESIGN_TOKENS.badge.size};
4860
4849
  height: ${DESIGN_TOKENS.badge.size};
4861
4850
  z-index: 30;
4862
4851
  pointer-events: none;
4852
+ transform: rotate(12deg);
4863
4853
  `;
4864
4854
  // SVG 内容
4865
4855
  const svgNS = 'http://www.w3.org/2000/svg';
4866
4856
  const svg = document.createElementNS(svgNS, 'svg');
4867
- svg.setAttribute('width', '86');
4868
- svg.setAttribute('height', '86');
4857
+ svg.setAttribute('width', '72');
4858
+ svg.setAttribute('height', '72');
4869
4859
  svg.setAttribute('viewBox', '0 0 86 86');
4870
4860
  svg.setAttribute('fill', 'none');
4871
4861
  svg.style.cssText = 'width: 100%; height: 100%;';
@@ -4881,47 +4871,25 @@ class CreditPackCard {
4881
4871
  starStroke.setAttribute('stroke-opacity', '0.08');
4882
4872
  svg.appendChild(starStroke);
4883
4873
  // 文字(中文或英文)
4884
- if (isZh) {
4885
- // 中文复杂路径 - 简化显示
4886
- const text1 = document.createElementNS(svgNS, 'text');
4887
- text1.setAttribute('x', '43');
4888
- text1.setAttribute('y', '35');
4889
- text1.setAttribute('text-anchor', 'middle');
4890
- text1.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4891
- text1.setAttribute('font-size', '12');
4892
- text1.setAttribute('font-weight', '700');
4893
- text1.textContent = 'On 1st';
4894
- svg.appendChild(text1);
4895
- const text2 = document.createElementNS(svgNS, 'text');
4896
- text2.setAttribute('x', '43');
4897
- text2.setAttribute('y', '51');
4898
- text2.setAttribute('text-anchor', 'middle');
4899
- text2.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4900
- text2.setAttribute('font-size', '13');
4901
- text2.setAttribute('font-weight', '700');
4902
- text2.textContent = 'Double';
4903
- svg.appendChild(text2);
4904
- }
4905
- else {
4906
- const text1 = document.createElementNS(svgNS, 'text');
4907
- text1.setAttribute('x', '43');
4908
- text1.setAttribute('y', '35');
4909
- text1.setAttribute('text-anchor', 'middle');
4910
- text1.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4911
- text1.setAttribute('font-size', '10');
4912
- text1.setAttribute('font-weight', '700');
4913
- text1.textContent = 'On 1st';
4914
- svg.appendChild(text1);
4915
- const text2 = document.createElementNS(svgNS, 'text');
4916
- text2.setAttribute('x', '43');
4917
- text2.setAttribute('y', '51');
4918
- text2.setAttribute('text-anchor', 'middle');
4919
- text2.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4920
- text2.setAttribute('font-size', '12');
4921
- text2.setAttribute('font-weight', '700');
4922
- text2.textContent = 'Double';
4923
- svg.appendChild(text2);
4924
- }
4874
+ const text1 = document.createElementNS(svgNS, 'text');
4875
+ text1.setAttribute('x', '43');
4876
+ text1.setAttribute('y', '38');
4877
+ text1.setAttribute('text-anchor', 'middle');
4878
+ text1.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4879
+ text1.setAttribute('font-size', '14');
4880
+ text1.setAttribute('font-weight', '800');
4881
+ text1.setAttribute('font-style', 'italic');
4882
+ text1.textContent = 'Double';
4883
+ svg.appendChild(text1);
4884
+ const text2 = document.createElementNS(svgNS, 'text');
4885
+ text2.setAttribute('x', '43');
4886
+ text2.setAttribute('y', '53');
4887
+ text2.setAttribute('text-anchor', 'middle');
4888
+ text2.setAttribute('fill', DESIGN_TOKENS.colors.badge.text);
4889
+ text2.setAttribute('font-size', '10');
4890
+ text2.setAttribute('font-weight', '700');
4891
+ text2.textContent = 'ON 1ST';
4892
+ svg.appendChild(text2);
4925
4893
  // 渐变定义
4926
4894
  const defs = document.createElementNS(svgNS, 'defs');
4927
4895
  const gradient = document.createElementNS(svgNS, 'linearGradient');
@@ -6643,7 +6611,7 @@ class LinkPaymentStrategy extends BasePaymentStrategy {
6643
6611
  // 创建 Link 支付实例
6644
6612
  const link = context.orderPayment.createLinkPayment(method, {
6645
6613
  callback_url: typeof window !== 'undefined'
6646
- ? `${window.location.origin}/pricing`
6614
+ ? `${window.location.origin}${window.location.pathname}`
6647
6615
  : '',
6648
6616
  });
6649
6617
  // 创建订单
@@ -8540,7 +8508,9 @@ class CreditPackageModal extends BasePackageModal {
8540
8508
  }
8541
8509
  .credit-pack-card {
8542
8510
  width: 100% !important;
8543
- height: 260px !important;
8511
+ height: 300px !important;
8512
+ padding: 28px 20px 20px !important;
8513
+ border-radius: 20px !important;
8544
8514
  }
8545
8515
  .payment-modal {
8546
8516
  width: 95vw !important;
@@ -8804,20 +8774,23 @@ class GenericPackageModal extends BasePackageModal {
8804
8774
  * Apply modal styling (hook method override)
8805
8775
  */
8806
8776
  applyModalStyling() {
8807
- // Modify modal style - make card fully fill
8777
+ // Modify modal style - make card fully fill, remove white background
8808
8778
  const modalElement = document.querySelector('.payment-modal');
8809
8779
  if (modalElement) {
8810
8780
  modalElement.style.background = 'transparent';
8781
+ modalElement.style.backgroundColor = 'transparent';
8811
8782
  modalElement.style.border = 'none';
8812
8783
  modalElement.style.padding = '0';
8813
- modalElement.style.borderRadius = '16px';
8814
- modalElement.style.overflow = 'hidden';
8784
+ modalElement.style.borderRadius = '0';
8785
+ modalElement.style.overflow = 'visible';
8786
+ modalElement.style.boxShadow = 'none';
8815
8787
  }
8816
8788
  // Modify content container style - remove padding
8817
8789
  const contentElement = document.querySelector('.payment-modal-content');
8818
8790
  if (contentElement) {
8819
8791
  contentElement.style.padding = '0';
8820
8792
  contentElement.style.margin = '0';
8793
+ contentElement.style.background = 'transparent';
8821
8794
  }
8822
8795
  // Listen for close button event from card
8823
8796
  const container = this.getContentContainer();
@@ -9212,7 +9185,7 @@ class GenericPackageModal extends BasePackageModal {
9212
9185
  /**
9213
9186
  * SDK version
9214
9187
  */
9215
- const VERSION$2 = '0.9.2';
9188
+ const VERSION$2 = '0.9.6';
9216
9189
 
9217
9190
  var __defProp = Object.defineProperty;
9218
9191
  var __defProps = Object.defineProperties;