@seaverse/payment-sdk 0.8.0 → 0.8.2
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 +229 -3
- package/dist/index.browser.js +1452 -1251
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +1452 -1250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +275 -157
- package/dist/index.js +1452 -1251
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1315,9 +1315,9 @@ interface BindCard {
|
|
|
1315
1315
|
user_type?: number;
|
|
1316
1316
|
}
|
|
1317
1317
|
/**
|
|
1318
|
-
*
|
|
1318
|
+
* Base package interface - common fields for all package types
|
|
1319
1319
|
*/
|
|
1320
|
-
interface
|
|
1320
|
+
interface BasePackage {
|
|
1321
1321
|
/** Unique package ID */
|
|
1322
1322
|
id: string;
|
|
1323
1323
|
/** Display name */
|
|
@@ -1332,6 +1332,11 @@ interface GenericPackage {
|
|
|
1332
1332
|
base_credits?: string;
|
|
1333
1333
|
/** Bonus credits (optional) */
|
|
1334
1334
|
bonus_credits?: string;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Generic package interface that supports all package types
|
|
1338
|
+
*/
|
|
1339
|
+
interface GenericPackage extends BasePackage {
|
|
1335
1340
|
/** Bonus percentage (e.g., 20 for +20%) */
|
|
1336
1341
|
bonus_percentage?: number;
|
|
1337
1342
|
/** Daily purchase limit (0 = unlimited) */
|
|
@@ -1546,6 +1551,93 @@ declare class PaymentModal {
|
|
|
1546
1551
|
isModalOpen(): boolean;
|
|
1547
1552
|
}
|
|
1548
1553
|
|
|
1554
|
+
/**
|
|
1555
|
+
* RetentionModal - 支付挽留弹框
|
|
1556
|
+
* 当用户尝试取消支付时弹出,提供优惠信息以挽留用户
|
|
1557
|
+
* 参考图片中的深色卡片设计风格
|
|
1558
|
+
*/
|
|
1559
|
+
interface RetentionModalOptions {
|
|
1560
|
+
/** 语言,默认 'en' */
|
|
1561
|
+
language?: 'en' | 'zh-CN';
|
|
1562
|
+
/** 商品名称 */
|
|
1563
|
+
productName: string;
|
|
1564
|
+
/** 购买数量(积分数等) */
|
|
1565
|
+
purchaseAmount: number;
|
|
1566
|
+
/** 活动赠送(例如:990) */
|
|
1567
|
+
bonusAmount?: number;
|
|
1568
|
+
/** 优惠价格(例如:"US$4.99") */
|
|
1569
|
+
discountPrice: string;
|
|
1570
|
+
/** 确认继续支付回调 */
|
|
1571
|
+
onContinue: () => void;
|
|
1572
|
+
/** 确认取消回调 */
|
|
1573
|
+
onCancel: () => void;
|
|
1574
|
+
/** 弹框关闭回调 */
|
|
1575
|
+
onClose?: () => void;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* 支付挽留弹框类
|
|
1579
|
+
*/
|
|
1580
|
+
declare class RetentionModal {
|
|
1581
|
+
private overlay;
|
|
1582
|
+
private modal;
|
|
1583
|
+
private options;
|
|
1584
|
+
private isExiting;
|
|
1585
|
+
private scrollY;
|
|
1586
|
+
private boundHandleEscKey;
|
|
1587
|
+
private countdownInterval;
|
|
1588
|
+
private remainingSeconds;
|
|
1589
|
+
constructor(options: RetentionModalOptions);
|
|
1590
|
+
/**
|
|
1591
|
+
* 打开弹框
|
|
1592
|
+
*/
|
|
1593
|
+
open(): void;
|
|
1594
|
+
/**
|
|
1595
|
+
* 关闭弹框
|
|
1596
|
+
*/
|
|
1597
|
+
close(): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* 创建弹框元素
|
|
1600
|
+
*/
|
|
1601
|
+
private createModal;
|
|
1602
|
+
/**
|
|
1603
|
+
* 添加 CSS 动画
|
|
1604
|
+
*/
|
|
1605
|
+
private addStyles;
|
|
1606
|
+
/**
|
|
1607
|
+
* 添加事件监听
|
|
1608
|
+
*/
|
|
1609
|
+
private attachEventListeners;
|
|
1610
|
+
/**
|
|
1611
|
+
* 处理 ESC 键
|
|
1612
|
+
*/
|
|
1613
|
+
private handleEscKey;
|
|
1614
|
+
/**
|
|
1615
|
+
* 启动倒计时
|
|
1616
|
+
*/
|
|
1617
|
+
private startCountdown;
|
|
1618
|
+
/**
|
|
1619
|
+
* 停止倒计时
|
|
1620
|
+
*/
|
|
1621
|
+
private stopCountdown;
|
|
1622
|
+
/**
|
|
1623
|
+
* 更新倒计时显示
|
|
1624
|
+
*/
|
|
1625
|
+
private updateCountdownDisplay;
|
|
1626
|
+
/**
|
|
1627
|
+
* 清理资源
|
|
1628
|
+
*/
|
|
1629
|
+
private cleanup;
|
|
1630
|
+
/**
|
|
1631
|
+
* HTML 转义工具函数
|
|
1632
|
+
* 防止 XSS 攻击
|
|
1633
|
+
*/
|
|
1634
|
+
private escapeHtml;
|
|
1635
|
+
/**
|
|
1636
|
+
* 检查弹框是否打开
|
|
1637
|
+
*/
|
|
1638
|
+
isOpen(): boolean;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1549
1641
|
/**
|
|
1550
1642
|
* DropinPaymentModal - Dropin 支付弹框
|
|
1551
1643
|
* 封装 DropinPaymentComponent 并在弹框中展示
|
|
@@ -1556,6 +1648,10 @@ interface DropinPaymentModalOptions extends Omit<DropinPaymentOptions, 'containe
|
|
|
1556
1648
|
modalTitle?: string;
|
|
1557
1649
|
/** 弹框选项 */
|
|
1558
1650
|
modalOptions?: Omit<PaymentModalOptions, 'title'>;
|
|
1651
|
+
/** 是否启用挽留弹框(默认:true) */
|
|
1652
|
+
enableRetention?: boolean;
|
|
1653
|
+
/** 挽留弹框配置 */
|
|
1654
|
+
retentionOptions?: Partial<RetentionModalOptions>;
|
|
1559
1655
|
}
|
|
1560
1656
|
declare class DropinPaymentModal {
|
|
1561
1657
|
private paymentInstance;
|
|
@@ -1566,6 +1662,9 @@ declare class DropinPaymentModal {
|
|
|
1566
1662
|
private modal;
|
|
1567
1663
|
private dropinPayment;
|
|
1568
1664
|
private containerElement;
|
|
1665
|
+
private retentionModal;
|
|
1666
|
+
private shouldShowRetention;
|
|
1667
|
+
private paymentCompleted;
|
|
1569
1668
|
constructor(paymentInstance: SeaartPaymentInstance, orderId: string, accountToken: string | undefined, paymentMethod: PaymentMethod, options: DropinPaymentModalOptions);
|
|
1570
1669
|
/**
|
|
1571
1670
|
* 打开弹框并渲染支付组件
|
|
@@ -1587,6 +1686,10 @@ declare class DropinPaymentModal {
|
|
|
1587
1686
|
* 隐藏加载状态
|
|
1588
1687
|
*/
|
|
1589
1688
|
private hideLoading;
|
|
1689
|
+
/**
|
|
1690
|
+
* 显示挽留弹框
|
|
1691
|
+
*/
|
|
1692
|
+
private showRetentionModal;
|
|
1590
1693
|
/**
|
|
1591
1694
|
* 检查弹框是否打开
|
|
1592
1695
|
*/
|
|
@@ -1667,10 +1770,33 @@ declare class SeaartPaymentSDK {
|
|
|
1667
1770
|
destroy(): void;
|
|
1668
1771
|
}
|
|
1669
1772
|
|
|
1773
|
+
/**
|
|
1774
|
+
* 积分套餐数据
|
|
1775
|
+
*/
|
|
1776
|
+
|
|
1777
|
+
interface CreditPackage extends BasePackage {
|
|
1778
|
+
day_limit: number;
|
|
1779
|
+
is_popular?: boolean;
|
|
1780
|
+
}
|
|
1781
|
+
declare const CREDIT_PACKAGES: CreditPackage[];
|
|
1782
|
+
/**
|
|
1783
|
+
* 创作力量类型和对应的积分消耗
|
|
1784
|
+
*/
|
|
1785
|
+
interface CreativePowerType {
|
|
1786
|
+
icon: string;
|
|
1787
|
+
name: string;
|
|
1788
|
+
name_cn: string;
|
|
1789
|
+
credits_range: string;
|
|
1790
|
+
description: string;
|
|
1791
|
+
description_cn: string;
|
|
1792
|
+
}
|
|
1793
|
+
declare const CREATIVE_POWER_TYPES: CreativePowerType[];
|
|
1794
|
+
|
|
1670
1795
|
/**
|
|
1671
1796
|
* 共享类型定义
|
|
1672
1797
|
* Shared types for CreditPackageModal and GenericPackageModal
|
|
1673
1798
|
*/
|
|
1799
|
+
|
|
1674
1800
|
/** 环境类型 */
|
|
1675
1801
|
type Environment = 'development' | 'production';
|
|
1676
1802
|
/** 环境配置接口 */
|
|
@@ -1713,237 +1839,229 @@ interface PaymentSDKConfig {
|
|
|
1713
1839
|
/** 自定义 CSS URL(覆盖环境配置) */
|
|
1714
1840
|
cssUrl?: string;
|
|
1715
1841
|
}
|
|
1716
|
-
|
|
1717
1842
|
/**
|
|
1718
|
-
*
|
|
1719
|
-
* 展示不同的积分套餐供用户选择
|
|
1843
|
+
* Base package modal options - common configuration for all package modals
|
|
1720
1844
|
*/
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
/** SDK 配置(必填 - 用于自动初始化支付 SDK) */
|
|
1845
|
+
interface BasePackageModalOptions<TPackage extends BasePackage> {
|
|
1846
|
+
/** SDK configuration (required for automatic SDK initialization) */
|
|
1724
1847
|
sdkConfig: PaymentSDKConfig;
|
|
1725
|
-
/**
|
|
1848
|
+
/** Language (default 'en') */
|
|
1726
1849
|
language?: 'en' | 'zh-CN';
|
|
1727
|
-
/** 弹框标题 */
|
|
1728
|
-
title?: string;
|
|
1729
|
-
/** 弹框标题(中文) */
|
|
1730
|
-
title_cn?: string;
|
|
1731
|
-
/** 副标题 */
|
|
1732
|
-
subtitle?: string;
|
|
1733
|
-
/** 副标题(中文) */
|
|
1734
|
-
subtitle_cn?: string;
|
|
1735
1850
|
/**
|
|
1736
|
-
*
|
|
1737
|
-
* @param orderId
|
|
1738
|
-
* @param transactionId
|
|
1851
|
+
* Payment success callback - notifies when payment is completed
|
|
1852
|
+
* @param orderId Order ID
|
|
1853
|
+
* @param transactionId Transaction ID
|
|
1854
|
+
* @param pkg Purchased package
|
|
1739
1855
|
*/
|
|
1740
|
-
onPaymentSuccess?: (orderId: string, transactionId: string) => void;
|
|
1856
|
+
onPaymentSuccess?: (orderId: string, transactionId: string, pkg: TPackage) => void;
|
|
1741
1857
|
/**
|
|
1742
|
-
*
|
|
1743
|
-
* @param error
|
|
1858
|
+
* Payment failed callback
|
|
1859
|
+
* @param error Error information
|
|
1860
|
+
* @param pkg Package that failed to purchase
|
|
1744
1861
|
*/
|
|
1745
|
-
onPaymentFailed?: (error: Error) => void;
|
|
1746
|
-
/**
|
|
1862
|
+
onPaymentFailed?: (error: Error, pkg: TPackage) => void;
|
|
1863
|
+
/** Modal close callback */
|
|
1747
1864
|
onClose?: () => void;
|
|
1748
1865
|
paymentMethod?: PaymentMethod;
|
|
1749
1866
|
accountToken?: string;
|
|
1750
1867
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* BasePackageModal - Abstract base class for package modals
|
|
1871
|
+
* Provides shared logic for SDK initialization, payment flow, and event handling
|
|
1872
|
+
*/
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* Abstract base class for package modals
|
|
1876
|
+
* Provides common functionality for SDK initialization, payment flow, and event handling
|
|
1877
|
+
*/
|
|
1878
|
+
declare abstract class BasePackageModal<TPackage extends BasePackage, TOptions extends BasePackageModalOptions<TPackage>> {
|
|
1879
|
+
protected modal: PaymentModal;
|
|
1880
|
+
protected options: TOptions;
|
|
1881
|
+
protected language: 'en' | 'zh-CN';
|
|
1882
|
+
protected resizeHandler: (() => void) | null;
|
|
1883
|
+
protected isInitializingSDK: boolean;
|
|
1884
|
+
protected sdkInitialized: boolean;
|
|
1885
|
+
protected paymentMethod?: PaymentMethod;
|
|
1886
|
+
protected accountToken?: string;
|
|
1887
|
+
constructor(options: TOptions);
|
|
1761
1888
|
/**
|
|
1762
|
-
*
|
|
1889
|
+
* Create and configure the PaymentModal instance
|
|
1890
|
+
* Subclasses define modal title, width, close behavior
|
|
1763
1891
|
*/
|
|
1764
|
-
|
|
1892
|
+
protected abstract createModal(): PaymentModal;
|
|
1765
1893
|
/**
|
|
1766
|
-
*
|
|
1767
|
-
*
|
|
1768
|
-
* @param maxRetries 最大重试次数,默认 1 次
|
|
1769
|
-
* @returns 是否初始化成功
|
|
1894
|
+
* Render the modal content (UI-specific logic)
|
|
1895
|
+
* Subclasses implement their own UI rendering
|
|
1770
1896
|
*/
|
|
1771
|
-
|
|
1897
|
+
protected abstract renderContent(): void;
|
|
1772
1898
|
/**
|
|
1773
|
-
*
|
|
1899
|
+
* Get packages to display
|
|
1900
|
+
* CreditPackageModal returns CREDIT_PACKAGES
|
|
1901
|
+
* GenericPackageModal returns this.options.packages
|
|
1774
1902
|
*/
|
|
1775
|
-
|
|
1903
|
+
protected abstract getPackages(): TPackage[];
|
|
1776
1904
|
/**
|
|
1777
|
-
*
|
|
1905
|
+
* Get package display name for payment modal title
|
|
1906
|
+
*/
|
|
1907
|
+
protected abstract getPackageDisplayName(pkg: TPackage): string;
|
|
1908
|
+
/**
|
|
1909
|
+
* Get loading button HTML with spinner
|
|
1910
|
+
* @param text Loading text
|
|
1911
|
+
* @param args Additional arguments (e.g., isPopular for CreditPackageModal)
|
|
1912
|
+
*/
|
|
1913
|
+
protected abstract getLoadingButtonHTML(text: string, ...args: any[]): string;
|
|
1914
|
+
/**
|
|
1915
|
+
* Open the modal
|
|
1916
|
+
*/
|
|
1917
|
+
open(): Promise<void>;
|
|
1918
|
+
/**
|
|
1919
|
+
* Close the modal
|
|
1778
1920
|
*/
|
|
1779
1921
|
close(): void;
|
|
1780
1922
|
/**
|
|
1781
|
-
*
|
|
1923
|
+
* Check if modal is open
|
|
1782
1924
|
*/
|
|
1783
|
-
|
|
1925
|
+
isOpen(): boolean;
|
|
1784
1926
|
/**
|
|
1785
|
-
*
|
|
1927
|
+
* Apply modal styling (hook method)
|
|
1928
|
+
* Subclasses can override to customize modal appearance
|
|
1786
1929
|
*/
|
|
1787
|
-
|
|
1930
|
+
protected applyModalStyling(): void;
|
|
1788
1931
|
/**
|
|
1789
|
-
*
|
|
1932
|
+
* Initialize payment SDK (identical in both classes)
|
|
1790
1933
|
*/
|
|
1791
|
-
|
|
1934
|
+
protected initializeSDK(): Promise<void>;
|
|
1792
1935
|
/**
|
|
1793
|
-
*
|
|
1936
|
+
* Wait for SDK initialization with timeout and retry
|
|
1937
|
+
* @param timeout Timeout in milliseconds (default 30 seconds)
|
|
1938
|
+
* @param maxRetries Maximum retry count (default 1)
|
|
1939
|
+
* @returns Whether initialization succeeded
|
|
1794
1940
|
*/
|
|
1795
|
-
|
|
1941
|
+
protected waitForSDKInitialization(timeout?: number, maxRetries?: number): Promise<boolean>;
|
|
1796
1942
|
/**
|
|
1797
|
-
*
|
|
1798
|
-
* @param text 加载文本
|
|
1799
|
-
* @param isPopular 是否为 Popular 套餐(用于调整颜色)
|
|
1943
|
+
* Handle payment flow (order creation + payment modal)
|
|
1800
1944
|
*/
|
|
1801
|
-
|
|
1945
|
+
protected handlePaymentFlow(pkg: TPackage, button: HTMLButtonElement, originalHTML: string): Promise<void>;
|
|
1802
1946
|
/**
|
|
1803
|
-
*
|
|
1947
|
+
* Open payment modal (DropinPaymentModal + PurchaseSuccessModal)
|
|
1804
1948
|
*/
|
|
1805
|
-
|
|
1949
|
+
protected openPaymentModal(orderId: string, pkg: TPackage): Promise<void>;
|
|
1806
1950
|
/**
|
|
1807
|
-
*
|
|
1951
|
+
* Attach event listeners to package buttons
|
|
1808
1952
|
*/
|
|
1809
|
-
|
|
1953
|
+
protected attachEventListeners(container: HTMLElement): void;
|
|
1810
1954
|
/**
|
|
1811
|
-
*
|
|
1955
|
+
* Cleanup resources
|
|
1812
1956
|
*/
|
|
1813
|
-
|
|
1957
|
+
protected cleanup(): void;
|
|
1814
1958
|
/**
|
|
1815
|
-
*
|
|
1959
|
+
* Format number with commas
|
|
1816
1960
|
*/
|
|
1817
|
-
|
|
1961
|
+
protected formatNumber(num: string): string;
|
|
1818
1962
|
/**
|
|
1819
|
-
*
|
|
1963
|
+
* Get content container from modal
|
|
1820
1964
|
*/
|
|
1821
|
-
|
|
1965
|
+
protected getContentContainer(): HTMLElement | null;
|
|
1822
1966
|
}
|
|
1823
1967
|
|
|
1824
1968
|
/**
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
* 套餐数据从外部配置传入,无硬编码
|
|
1969
|
+
* CreditPackageModal - 积分套餐选择弹框
|
|
1970
|
+
* 展示不同的积分套餐供用户选择
|
|
1828
1971
|
*/
|
|
1829
1972
|
|
|
1830
|
-
interface
|
|
1831
|
-
/**
|
|
1832
|
-
|
|
1833
|
-
/**
|
|
1834
|
-
|
|
1835
|
-
/**
|
|
1836
|
-
|
|
1973
|
+
interface CreditPackageModalOptions extends BasePackageModalOptions<CreditPackage> {
|
|
1974
|
+
/** Modal title */
|
|
1975
|
+
title?: string;
|
|
1976
|
+
/** Modal title (Chinese) */
|
|
1977
|
+
title_cn?: string;
|
|
1978
|
+
/** Subtitle */
|
|
1979
|
+
subtitle?: string;
|
|
1980
|
+
/** Subtitle (Chinese) */
|
|
1981
|
+
subtitle_cn?: string;
|
|
1982
|
+
}
|
|
1983
|
+
declare class CreditPackageModal extends BasePackageModal<CreditPackage, CreditPackageModalOptions> {
|
|
1984
|
+
private readonly SPACING;
|
|
1985
|
+
private readonly COLORS;
|
|
1837
1986
|
/**
|
|
1838
|
-
*
|
|
1839
|
-
* @param orderId 订单ID
|
|
1840
|
-
* @param transactionId 交易ID
|
|
1841
|
-
* @param pkg 购买的套餐
|
|
1987
|
+
* Create and configure the PaymentModal instance
|
|
1842
1988
|
*/
|
|
1843
|
-
|
|
1989
|
+
protected createModal(): PaymentModal;
|
|
1844
1990
|
/**
|
|
1845
|
-
*
|
|
1846
|
-
* @param error 错误信息
|
|
1847
|
-
* @param pkg 购买失败的套餐
|
|
1991
|
+
* Get packages to display
|
|
1848
1992
|
*/
|
|
1849
|
-
|
|
1850
|
-
/** 弹框关闭回调 */
|
|
1851
|
-
onClose?: () => void;
|
|
1852
|
-
}
|
|
1853
|
-
declare class GenericPackageModal {
|
|
1854
|
-
private modal;
|
|
1855
|
-
private options;
|
|
1856
|
-
private language;
|
|
1857
|
-
private resizeHandler;
|
|
1858
|
-
private isInitializingSDK;
|
|
1859
|
-
private sdkInitialized;
|
|
1860
|
-
private paymentMethod?;
|
|
1861
|
-
private accountToken?;
|
|
1862
|
-
constructor(options: GenericPackageModalOptions);
|
|
1993
|
+
protected getPackages(): CreditPackage[];
|
|
1863
1994
|
/**
|
|
1864
|
-
*
|
|
1995
|
+
* Get package display name for payment modal title
|
|
1865
1996
|
*/
|
|
1866
|
-
|
|
1997
|
+
protected getPackageDisplayName(pkg: CreditPackage): string;
|
|
1867
1998
|
/**
|
|
1868
|
-
*
|
|
1869
|
-
* @param timeout 超时时间(毫秒),默认 30 秒
|
|
1870
|
-
* @param maxRetries 最大重试次数,默认 1 次
|
|
1871
|
-
* @returns 是否初始化成功
|
|
1999
|
+
* Get loading button HTML with spinner
|
|
1872
2000
|
*/
|
|
1873
|
-
|
|
2001
|
+
protected getLoadingButtonHTML(text: string, isPopular?: boolean): string;
|
|
1874
2002
|
/**
|
|
1875
|
-
*
|
|
2003
|
+
* Apply modal styling (hook method override)
|
|
1876
2004
|
*/
|
|
1877
|
-
|
|
2005
|
+
protected applyModalStyling(): void;
|
|
1878
2006
|
/**
|
|
1879
|
-
*
|
|
2007
|
+
* Render modal content
|
|
1880
2008
|
*/
|
|
1881
|
-
|
|
2009
|
+
protected renderContent(): void;
|
|
2010
|
+
/**
|
|
2011
|
+
* Get responsive style configuration
|
|
2012
|
+
*/
|
|
2013
|
+
private getResponsiveStyles;
|
|
1882
2014
|
/**
|
|
1883
|
-
*
|
|
2015
|
+
* Render compute credits cards
|
|
1884
2016
|
*/
|
|
1885
|
-
private
|
|
2017
|
+
private renderComputeCreditsCards;
|
|
1886
2018
|
/**
|
|
1887
|
-
*
|
|
2019
|
+
* Render package card
|
|
1888
2020
|
*/
|
|
1889
2021
|
private renderPackageCard;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* GenericPackageModal - 通用套餐选择弹框
|
|
2026
|
+
* 支持多种套餐类型(破冰包、告急包、首充包等)
|
|
2027
|
+
* 套餐数据从外部配置传入,无硬编码
|
|
2028
|
+
*/
|
|
2029
|
+
|
|
2030
|
+
interface GenericPackageModalOptions extends BasePackageModalOptions<GenericPackage> {
|
|
2031
|
+
/** Package data (required - passed from external configuration) */
|
|
2032
|
+
packages: GenericPackage[];
|
|
2033
|
+
}
|
|
2034
|
+
declare class GenericPackageModal extends BasePackageModal<GenericPackage, GenericPackageModalOptions> {
|
|
2035
|
+
constructor(options: GenericPackageModalOptions);
|
|
1890
2036
|
/**
|
|
1891
|
-
*
|
|
2037
|
+
* Create and configure the PaymentModal instance
|
|
1892
2038
|
*/
|
|
1893
|
-
|
|
2039
|
+
protected createModal(): PaymentModal;
|
|
1894
2040
|
/**
|
|
1895
|
-
*
|
|
2041
|
+
* Get packages to display
|
|
1896
2042
|
*/
|
|
1897
|
-
|
|
2043
|
+
protected getPackages(): GenericPackage[];
|
|
1898
2044
|
/**
|
|
1899
|
-
*
|
|
2045
|
+
* Get package display name for payment modal title
|
|
1900
2046
|
*/
|
|
1901
|
-
|
|
2047
|
+
protected getPackageDisplayName(pkg: GenericPackage): string;
|
|
1902
2048
|
/**
|
|
1903
|
-
*
|
|
2049
|
+
* Get loading button HTML with spinner
|
|
1904
2050
|
*/
|
|
1905
|
-
|
|
2051
|
+
protected getLoadingButtonHTML(text: string): string;
|
|
1906
2052
|
/**
|
|
1907
|
-
*
|
|
2053
|
+
* Apply modal styling (hook method override)
|
|
1908
2054
|
*/
|
|
1909
|
-
|
|
2055
|
+
protected applyModalStyling(): void;
|
|
1910
2056
|
/**
|
|
1911
|
-
*
|
|
2057
|
+
* Render modal content
|
|
1912
2058
|
*/
|
|
1913
|
-
|
|
2059
|
+
protected renderContent(): void;
|
|
1914
2060
|
/**
|
|
1915
|
-
*
|
|
2061
|
+
* Render package card
|
|
1916
2062
|
*/
|
|
1917
|
-
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* 积分套餐数据
|
|
1922
|
-
*/
|
|
1923
|
-
interface CreditPackage {
|
|
1924
|
-
id: string;
|
|
1925
|
-
name: string;
|
|
1926
|
-
price: string;
|
|
1927
|
-
currency: string;
|
|
1928
|
-
base_credits: string;
|
|
1929
|
-
bonus_credits: string;
|
|
1930
|
-
credits: string;
|
|
1931
|
-
day_limit: number;
|
|
1932
|
-
is_popular?: boolean;
|
|
1933
|
-
}
|
|
1934
|
-
declare const CREDIT_PACKAGES: CreditPackage[];
|
|
1935
|
-
/**
|
|
1936
|
-
* 创作力量类型和对应的积分消耗
|
|
1937
|
-
*/
|
|
1938
|
-
interface CreativePowerType {
|
|
1939
|
-
icon: string;
|
|
1940
|
-
name: string;
|
|
1941
|
-
name_cn: string;
|
|
1942
|
-
credits_range: string;
|
|
1943
|
-
description: string;
|
|
1944
|
-
description_cn: string;
|
|
2063
|
+
private renderPackageCard;
|
|
1945
2064
|
}
|
|
1946
|
-
declare const CREATIVE_POWER_TYPES: CreativePowerType[];
|
|
1947
2065
|
|
|
1948
2066
|
/**
|
|
1949
2067
|
* 共享配置文件
|
|
@@ -2452,5 +2570,5 @@ declare function pollOrderStatus(transactionId: string, apiHost: string, authTok
|
|
|
2452
2570
|
*/
|
|
2453
2571
|
declare const VERSION = "0.8.0";
|
|
2454
2572
|
|
|
2455
|
-
export { API_ENDPOINTS, BIZ_CODE, BindCardPaymentComponent, COMPONENT_LOAD_TIMEOUT, CREATIVE_POWER_TYPES, CREDIT_PACKAGES, CheckoutAPI, CreditPackageModal, DEFAULT_CHECKOUT_CONFIG, DropinPaymentComponent, DropinPaymentModal, ENVIRONMENT_CONFIGS, ENV_CONFIG, ErrorHandler, GRID_COLUMNS, GenericPackageModal, HTTP_STATUS, LinkPaymentComponent, OrderPayment, PAYMENT_ELEMENT_NAME, PaymentAPIError, PaymentCheckoutClient, PaymentClient, PaymentError, PaymentModal, PaymentStorage, PurchaseSuccessModal, RESPONSIVE_BREAKPOINTS, SDK_CONFIG, ScriptLoader, SeaArtPayLoader, SeaartPaymentSDK, StylesheetLoader, VERSION, centsToDollars, changeSubscription, checkOrderStatus, createCheckoutPaymentError, createOrder, delay, dollarsToCents, formatPrice, generateOrderReference, getActiveSubscription, getCreditDetail, getCurrentSubscription, getCurrentUrl, getGlobalLoader, getSDKLocale, hideLoadingIndicator, isBrowser, isCheckoutPaymentError, pollOrderStatus, resetGlobalLoader, restartSubscription, safeJsonParse, showErrorMessage, showInfoMessage, showLoadingIndicator, showSuccessMessage, withTimeout };
|
|
2456
|
-
export type { ActiveSubscription, ApiErrorResponse, ApiResponse, ApiSuccessResponse, BaseCheckoutOptions, BillingPeriod, BindCard, BindCardCallbacks, BindCardPaymentOptions, CheckoutAPIConfig, CheckoutAPIResponse, CheckoutClientConfig, CheckoutClientStatus, CheckoutOptions, CheckoutPaymentError, CheckoutPaymentErrorCode, CheckoutResult, ComponentLoadStatus, CreateOrderResponse, CreativePowerType, CreditAccount, CreditAccountStatus, CreditDetailResponse$1 as CreditDetailResponse, CreditDetailSuccessResponse, CreditPackage, CreditPackageModalOptions, CreditPoolDetail, CreditPoolType$1 as CreditPoolType, CreditTransaction, CurrentSubscription, DropinCallbacks, DropinPaymentModalOptions, DropinPaymentOptions, Environment, EnvironmentConfig, GenericPackage, GenericPackageModalOptions, LinkPaymentOptions, ListTransactionsRequest, LoaderConfig, OrderInfo, OrderStatus, OrderStatusResponse, PaymentClientOptions, PaymentEnvironment, PaymentMethod, PaymentMethodsParams, PaymentModalOptions, PaymentReadyEventDetail, PaymentResult, PaymentSDKConfig, PaymentSuccessEventDetail, PaymentUnsuccessEventDetail, PaymentUnsuccessResult, PurchaseSuccessData, PurchaseSuccessModalOptions, PurchaseType, SDKCheckoutRequest, SDKCheckoutResponse, SDKConfig, SDKLoadStatus, ScriptLoaderOptions, SeaArtPaymentElement, SeaartBindCardPayment, SeaartDropinPayment, SeaartLinkPayment, SeaartPaymentComponentSDK, SeaartPaymentInstance, SeaartPaymentSDKConfig, ShowPaymentOptions, SubscribeOptions, SubscriptionParams, SubscriptionPeriod, TransactionListResponse, TransactionStatus, TransactionStorageData, TransactionType, UnifiedResponse };
|
|
2573
|
+
export { API_ENDPOINTS, BIZ_CODE, BindCardPaymentComponent, COMPONENT_LOAD_TIMEOUT, CREATIVE_POWER_TYPES, CREDIT_PACKAGES, CheckoutAPI, CreditPackageModal, DEFAULT_CHECKOUT_CONFIG, DropinPaymentComponent, DropinPaymentModal, ENVIRONMENT_CONFIGS, ENV_CONFIG, ErrorHandler, GRID_COLUMNS, GenericPackageModal, HTTP_STATUS, LinkPaymentComponent, OrderPayment, PAYMENT_ELEMENT_NAME, PaymentAPIError, PaymentCheckoutClient, PaymentClient, PaymentError, PaymentModal, PaymentStorage, PurchaseSuccessModal, RESPONSIVE_BREAKPOINTS, RetentionModal, SDK_CONFIG, ScriptLoader, SeaArtPayLoader, SeaartPaymentSDK, StylesheetLoader, VERSION, centsToDollars, changeSubscription, checkOrderStatus, createCheckoutPaymentError, createOrder, delay, dollarsToCents, formatPrice, generateOrderReference, getActiveSubscription, getCreditDetail, getCurrentSubscription, getCurrentUrl, getGlobalLoader, getSDKLocale, hideLoadingIndicator, isBrowser, isCheckoutPaymentError, pollOrderStatus, resetGlobalLoader, restartSubscription, safeJsonParse, showErrorMessage, showInfoMessage, showLoadingIndicator, showSuccessMessage, withTimeout };
|
|
2574
|
+
export type { ActiveSubscription, ApiErrorResponse, ApiResponse, ApiSuccessResponse, BaseCheckoutOptions, BillingPeriod, BindCard, BindCardCallbacks, BindCardPaymentOptions, CheckoutAPIConfig, CheckoutAPIResponse, CheckoutClientConfig, CheckoutClientStatus, CheckoutOptions, CheckoutPaymentError, CheckoutPaymentErrorCode, CheckoutResult, ComponentLoadStatus, CreateOrderResponse, CreativePowerType, CreditAccount, CreditAccountStatus, CreditDetailResponse$1 as CreditDetailResponse, CreditDetailSuccessResponse, CreditPackage, CreditPackageModalOptions, CreditPoolDetail, CreditPoolType$1 as CreditPoolType, CreditTransaction, CurrentSubscription, DropinCallbacks, DropinPaymentModalOptions, DropinPaymentOptions, Environment, EnvironmentConfig, GenericPackage, GenericPackageModalOptions, LinkPaymentOptions, ListTransactionsRequest, LoaderConfig, OrderInfo, OrderStatus, OrderStatusResponse, PaymentClientOptions, PaymentEnvironment, PaymentMethod, PaymentMethodsParams, PaymentModalOptions, PaymentReadyEventDetail, PaymentResult, PaymentSDKConfig, PaymentSuccessEventDetail, PaymentUnsuccessEventDetail, PaymentUnsuccessResult, PurchaseSuccessData, PurchaseSuccessModalOptions, PurchaseType, RetentionModalOptions, SDKCheckoutRequest, SDKCheckoutResponse, SDKConfig, SDKLoadStatus, ScriptLoaderOptions, SeaArtPaymentElement, SeaartBindCardPayment, SeaartDropinPayment, SeaartLinkPayment, SeaartPaymentComponentSDK, SeaartPaymentInstance, SeaartPaymentSDKConfig, ShowPaymentOptions, SubscribeOptions, SubscriptionParams, SubscriptionPeriod, TransactionListResponse, TransactionStatus, TransactionStorageData, TransactionType, UnifiedResponse };
|