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