@seaverse/payment-sdk 0.8.2 → 0.9.0
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 +158 -0
- package/dist/index.browser.js +4556 -767
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +4560 -768
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +650 -128
- package/dist/index.js +4556 -767
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -401,7 +401,7 @@ type SubscriptionPeriod = 'week' | 'month' | 'year' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
|
401
401
|
/**
|
|
402
402
|
* 计费周期
|
|
403
403
|
*/
|
|
404
|
-
type BillingPeriod = 'month' | 'year';
|
|
404
|
+
type BillingPeriod$1 = 'month' | 'year';
|
|
405
405
|
/**
|
|
406
406
|
* 订阅参数
|
|
407
407
|
*/
|
|
@@ -444,7 +444,7 @@ interface CheckoutOptions extends BaseCheckoutOptions {
|
|
|
444
444
|
*/
|
|
445
445
|
interface SubscribeOptions extends CheckoutOptions {
|
|
446
446
|
/** 计费周期(可选,"month" 或 "year",默认 "month") */
|
|
447
|
-
billing_period?: BillingPeriod;
|
|
447
|
+
billing_period?: BillingPeriod$1;
|
|
448
448
|
/** 购买类型:1-一次性,2-订阅(必填) */
|
|
449
449
|
purchaseType: PurchaseType;
|
|
450
450
|
}
|
|
@@ -476,7 +476,7 @@ interface SDKCheckoutRequest {
|
|
|
476
476
|
/** 购买类型:1-一次性,2-订阅(必填) */
|
|
477
477
|
purchase_type: PurchaseType;
|
|
478
478
|
/** 计费周期(可选,仅订阅时使用,默认 'month')- 用于区分月付和年付 */
|
|
479
|
-
billing_period?: BillingPeriod;
|
|
479
|
+
billing_period?: BillingPeriod$1;
|
|
480
480
|
/** 支付完成后的重定向 URL(可选) */
|
|
481
481
|
redirect_url?: string;
|
|
482
482
|
}
|
|
@@ -768,7 +768,7 @@ declare class CheckoutAPI {
|
|
|
768
768
|
*/
|
|
769
769
|
createSubscriptionCheckout(params: {
|
|
770
770
|
productId: string;
|
|
771
|
-
billingPeriod?: BillingPeriod;
|
|
771
|
+
billingPeriod?: BillingPeriod$1;
|
|
772
772
|
/** 支付完成后的重定向 URL */
|
|
773
773
|
redirectUrl?: string;
|
|
774
774
|
}): Promise<CheckoutResult>;
|
|
@@ -1346,6 +1346,18 @@ interface GenericPackage extends BasePackage {
|
|
|
1346
1346
|
/** Package type for categorization */
|
|
1347
1347
|
package_type?: 'iceBreaker' | 'emergency' | 'firstCharge' | 'custom';
|
|
1348
1348
|
}
|
|
1349
|
+
interface CreditPackageItem extends BasePackage {
|
|
1350
|
+
/** 总积分(与 credits 相同,API 返回字段) */
|
|
1351
|
+
total_credits: string;
|
|
1352
|
+
/** 基础积分 */
|
|
1353
|
+
base_credits: string;
|
|
1354
|
+
/** 奖励积分 */
|
|
1355
|
+
bonus_credits: string;
|
|
1356
|
+
/** 每日购买限制 */
|
|
1357
|
+
remain_daily_limit: number;
|
|
1358
|
+
/** 是否为首次购买积分包 */
|
|
1359
|
+
is_first_purchase_pkg: boolean;
|
|
1360
|
+
}
|
|
1349
1361
|
|
|
1350
1362
|
/**
|
|
1351
1363
|
* LinkPaymentComponent
|
|
@@ -1553,8 +1565,9 @@ declare class PaymentModal {
|
|
|
1553
1565
|
|
|
1554
1566
|
/**
|
|
1555
1567
|
* RetentionModal - 支付挽留弹框
|
|
1556
|
-
*
|
|
1557
|
-
*
|
|
1568
|
+
* 当用户尝试取消支付时弹出,提供订单信息以挽留用户
|
|
1569
|
+
*
|
|
1570
|
+
* 设计风格:深色卡片 + 清晰信息层次 + 渐变 CTA 按钮
|
|
1558
1571
|
*/
|
|
1559
1572
|
interface RetentionModalOptions {
|
|
1560
1573
|
/** 语言,默认 'en' */
|
|
@@ -1565,7 +1578,7 @@ interface RetentionModalOptions {
|
|
|
1565
1578
|
purchaseAmount: number;
|
|
1566
1579
|
/** 活动赠送(例如:990) */
|
|
1567
1580
|
bonusAmount?: number;
|
|
1568
|
-
/** 优惠价格(例如:"
|
|
1581
|
+
/** 优惠价格(例如:"$4.99") */
|
|
1569
1582
|
discountPrice: string;
|
|
1570
1583
|
/** 确认继续支付回调 */
|
|
1571
1584
|
onContinue: () => void;
|
|
@@ -1600,41 +1613,25 @@ declare class RetentionModal {
|
|
|
1600
1613
|
*/
|
|
1601
1614
|
private createModal;
|
|
1602
1615
|
/**
|
|
1603
|
-
*
|
|
1616
|
+
* 注入 CSS 动画和 hover 效果
|
|
1604
1617
|
*/
|
|
1605
1618
|
private addStyles;
|
|
1606
1619
|
/**
|
|
1607
|
-
*
|
|
1620
|
+
* 事件监听
|
|
1608
1621
|
*/
|
|
1609
1622
|
private attachEventListeners;
|
|
1610
|
-
/**
|
|
1611
|
-
* 处理 ESC 键
|
|
1612
|
-
*/
|
|
1613
1623
|
private handleEscKey;
|
|
1614
1624
|
/**
|
|
1615
|
-
*
|
|
1625
|
+
* 倒计时
|
|
1616
1626
|
*/
|
|
1617
1627
|
private startCountdown;
|
|
1618
|
-
/**
|
|
1619
|
-
* 停止倒计时
|
|
1620
|
-
*/
|
|
1621
1628
|
private stopCountdown;
|
|
1622
|
-
/**
|
|
1623
|
-
* 更新倒计时显示
|
|
1624
|
-
*/
|
|
1625
1629
|
private updateCountdownDisplay;
|
|
1626
1630
|
/**
|
|
1627
1631
|
* 清理资源
|
|
1628
1632
|
*/
|
|
1629
1633
|
private cleanup;
|
|
1630
|
-
/**
|
|
1631
|
-
* HTML 转义工具函数
|
|
1632
|
-
* 防止 XSS 攻击
|
|
1633
|
-
*/
|
|
1634
1634
|
private escapeHtml;
|
|
1635
|
-
/**
|
|
1636
|
-
* 检查弹框是否打开
|
|
1637
|
-
*/
|
|
1638
1635
|
isOpen(): boolean;
|
|
1639
1636
|
}
|
|
1640
1637
|
|
|
@@ -1770,28 +1767,6 @@ declare class SeaartPaymentSDK {
|
|
|
1770
1767
|
destroy(): void;
|
|
1771
1768
|
}
|
|
1772
1769
|
|
|
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
|
-
|
|
1795
1770
|
/**
|
|
1796
1771
|
* 共享类型定义
|
|
1797
1772
|
* Shared types for CreditPackageModal and GenericPackageModal
|
|
@@ -1970,31 +1945,56 @@ declare abstract class BasePackageModal<TPackage extends BasePackage, TOptions e
|
|
|
1970
1945
|
* 展示不同的积分套餐供用户选择
|
|
1971
1946
|
*/
|
|
1972
1947
|
|
|
1973
|
-
interface CreditPackageModalOptions extends BasePackageModalOptions<
|
|
1948
|
+
interface CreditPackageModalOptions extends BasePackageModalOptions<CreditPackageItem> {
|
|
1974
1949
|
/** Modal title */
|
|
1975
1950
|
title?: string;
|
|
1976
1951
|
/** Modal title (Chinese) */
|
|
1977
1952
|
title_cn?: string;
|
|
1978
|
-
/** Subtitle */
|
|
1979
|
-
subtitle?: string;
|
|
1980
|
-
/** Subtitle (Chinese) */
|
|
1981
|
-
subtitle_cn?: string;
|
|
1982
1953
|
}
|
|
1983
|
-
declare class CreditPackageModal extends BasePackageModal<
|
|
1954
|
+
declare class CreditPackageModal extends BasePackageModal<CreditPackageItem, CreditPackageModalOptions> {
|
|
1984
1955
|
private readonly SPACING;
|
|
1985
1956
|
private readonly COLORS;
|
|
1957
|
+
private dynamicPackages;
|
|
1958
|
+
private isFetchingPackages;
|
|
1959
|
+
/**
|
|
1960
|
+
* Override open to fetch packages before rendering
|
|
1961
|
+
*/
|
|
1962
|
+
open(): Promise<void>;
|
|
1986
1963
|
/**
|
|
1987
1964
|
* Create and configure the PaymentModal instance
|
|
1988
1965
|
*/
|
|
1989
1966
|
protected createModal(): PaymentModal;
|
|
1990
1967
|
/**
|
|
1991
|
-
* Get packages to display
|
|
1968
|
+
* Get packages to display (dynamic or fallback to static)
|
|
1969
|
+
*/
|
|
1970
|
+
protected getPackages(): CreditPackageItem[];
|
|
1971
|
+
/**
|
|
1972
|
+
* Fetch available packages from API
|
|
1973
|
+
*/
|
|
1974
|
+
private fetchDynamicPackages;
|
|
1975
|
+
/**
|
|
1976
|
+
* Parse purchase limit string to day_limit number
|
|
1977
|
+
* Example: "Daily limit: 1" => 1
|
|
1978
|
+
*/
|
|
1979
|
+
private parsePurchaseLimit;
|
|
1980
|
+
/**
|
|
1981
|
+
* 覆盖 BasePackageModal 的 handlePaymentFlow 方法
|
|
1982
|
+
* 使用 PaymentCheckoutModal 替代旧的 DropinPaymentModal
|
|
1983
|
+
* 支付成功后刷新积分包列表,而不是立即关闭弹框
|
|
1984
|
+
*/
|
|
1985
|
+
protected handlePaymentFlow(pkg: CreditPackageItem, button: HTMLButtonElement, originalHTML: string): Promise<void>;
|
|
1986
|
+
/**
|
|
1987
|
+
* 将 CreditPackageItem 转换为 Product
|
|
1988
|
+
*/
|
|
1989
|
+
private convertToProduct;
|
|
1990
|
+
/**
|
|
1991
|
+
* 构建 AutoCreateOrderConfig
|
|
1992
1992
|
*/
|
|
1993
|
-
|
|
1993
|
+
private buildAutoCreateOrderConfig;
|
|
1994
1994
|
/**
|
|
1995
1995
|
* Get package display name for payment modal title
|
|
1996
1996
|
*/
|
|
1997
|
-
protected getPackageDisplayName(pkg:
|
|
1997
|
+
protected getPackageDisplayName(pkg: CreditPackageItem): string;
|
|
1998
1998
|
/**
|
|
1999
1999
|
* Get loading button HTML with spinner
|
|
2000
2000
|
*/
|
|
@@ -2012,11 +2012,7 @@ declare class CreditPackageModal extends BasePackageModal<CreditPackage, CreditP
|
|
|
2012
2012
|
*/
|
|
2013
2013
|
private getResponsiveStyles;
|
|
2014
2014
|
/**
|
|
2015
|
-
* Render
|
|
2016
|
-
*/
|
|
2017
|
-
private renderComputeCreditsCards;
|
|
2018
|
-
/**
|
|
2019
|
-
* Render package card
|
|
2015
|
+
* Render package card using CreditPackCard component
|
|
2020
2016
|
*/
|
|
2021
2017
|
private renderPackageCard;
|
|
2022
2018
|
}
|
|
@@ -2057,12 +2053,321 @@ declare class GenericPackageModal extends BasePackageModal<GenericPackage, Gener
|
|
|
2057
2053
|
* Render modal content
|
|
2058
2054
|
*/
|
|
2059
2055
|
protected renderContent(): void;
|
|
2056
|
+
/**
|
|
2057
|
+
* 覆盖 BasePackageModal 的 handlePaymentFlow 方法
|
|
2058
|
+
* 使用 PaymentCheckoutModal 替代 DropinPaymentModal
|
|
2059
|
+
*/
|
|
2060
|
+
protected handlePaymentFlow(pkg: GenericPackage, button: HTMLButtonElement, originalHTML: string): Promise<void>;
|
|
2061
|
+
/**
|
|
2062
|
+
* 将 GenericPackage 转换为 Product
|
|
2063
|
+
*/
|
|
2064
|
+
private convertToProduct;
|
|
2065
|
+
/**
|
|
2066
|
+
* 构建 AutoCreateOrderConfig
|
|
2067
|
+
*/
|
|
2068
|
+
private buildAutoCreateOrderConfig;
|
|
2060
2069
|
/**
|
|
2061
2070
|
* Render package card
|
|
2062
2071
|
*/
|
|
2063
2072
|
private renderPackageCard;
|
|
2064
2073
|
}
|
|
2065
2074
|
|
|
2075
|
+
/**
|
|
2076
|
+
* 商品类型
|
|
2077
|
+
*/
|
|
2078
|
+
declare enum PRODUCT_TYPE$1 {
|
|
2079
|
+
SUBSCRIPTION = "subscription",
|
|
2080
|
+
CREDITPACK = "credit_package"
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* 订单状态
|
|
2084
|
+
*/
|
|
2085
|
+
type OrderStatus = 'pending' | 'paid' | 'failed' | 'expired' | 'refunded';
|
|
2086
|
+
/**
|
|
2087
|
+
* 商品数据
|
|
2088
|
+
*/
|
|
2089
|
+
interface ProductData {
|
|
2090
|
+
/** 商品ID */
|
|
2091
|
+
product_id: string;
|
|
2092
|
+
/** 商品名称 */
|
|
2093
|
+
product_name: string;
|
|
2094
|
+
/** 商品类型 */
|
|
2095
|
+
product_type: PRODUCT_TYPE$1;
|
|
2096
|
+
/** 商品价格 */
|
|
2097
|
+
price: number;
|
|
2098
|
+
/** 商品货币 */
|
|
2099
|
+
currency: string;
|
|
2100
|
+
/** 订阅周期 */
|
|
2101
|
+
subscription_period?: 'month' | 'year';
|
|
2102
|
+
/** 积分 */
|
|
2103
|
+
total_credits?: number;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* SDK 配置
|
|
2107
|
+
*/
|
|
2108
|
+
interface SdkConfig {
|
|
2109
|
+
/** 应用 ID */
|
|
2110
|
+
app_id: string;
|
|
2111
|
+
/** API 域名 */
|
|
2112
|
+
api_host: string;
|
|
2113
|
+
/** 环境 */
|
|
2114
|
+
environment: string;
|
|
2115
|
+
}
|
|
2116
|
+
/**
|
|
2117
|
+
* 订阅计费周期
|
|
2118
|
+
*/
|
|
2119
|
+
type BillingPeriod = 'month' | 'year';
|
|
2120
|
+
/**
|
|
2121
|
+
* 积分池类型
|
|
2122
|
+
*/
|
|
2123
|
+
type CreditPoolType = 'daily' | 'event' | 'monthly' | 'permanent';
|
|
2124
|
+
|
|
2125
|
+
/**
|
|
2126
|
+
* Order API
|
|
2127
|
+
* 订单管理 - 查询和轮询订单状态
|
|
2128
|
+
*/
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* 订单状态响应
|
|
2132
|
+
*/
|
|
2133
|
+
interface OrderStatusResponse {
|
|
2134
|
+
status: OrderStatus;
|
|
2135
|
+
product: ProductData;
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
* 查询订单状态
|
|
2140
|
+
* @param transactionId SDK checkout 返回的 transaction_id
|
|
2141
|
+
* @param apiHost Payment API 地址
|
|
2142
|
+
* @param authToken 认证 Token
|
|
2143
|
+
* @returns 订单状态
|
|
2144
|
+
*/
|
|
2145
|
+
declare function checkOrderStatus(transactionId: string, apiHost: string, authToken?: string): Promise<OrderStatusResponse>;
|
|
2146
|
+
/**
|
|
2147
|
+
* 轮询订单状态直到支付完成或超时
|
|
2148
|
+
* @param transactionId SDK checkout 返回的 transaction_id
|
|
2149
|
+
* @param apiHost Payment API 地址
|
|
2150
|
+
* @param authToken 认证 Token
|
|
2151
|
+
* @param options 轮询配置
|
|
2152
|
+
* @returns 最终订单状态
|
|
2153
|
+
*/
|
|
2154
|
+
declare function pollOrderStatus(transactionId: string, apiHost: string, authToken: string | undefined, options?: {
|
|
2155
|
+
/** 轮询间隔(毫秒),默认 2000ms */
|
|
2156
|
+
interval?: number;
|
|
2157
|
+
/** 最大轮询次数,默认 30 次(总计 60 秒) */
|
|
2158
|
+
maxAttempts?: number;
|
|
2159
|
+
/** 每次轮询后的回调 */
|
|
2160
|
+
onPoll?: (status: OrderStatus, attempt: number) => void;
|
|
2161
|
+
}): Promise<OrderStatusResponse>;
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* @filename types.ts
|
|
2165
|
+
* @description PaymentCheckoutModal 的 TypeScript 类型定义
|
|
2166
|
+
*/
|
|
2167
|
+
|
|
2168
|
+
/**
|
|
2169
|
+
* 产品类型
|
|
2170
|
+
*/
|
|
2171
|
+
declare const PRODUCT_TYPE: {
|
|
2172
|
+
readonly SUBSCRIPTION: "subscription";
|
|
2173
|
+
readonly CREDITPACK: "credit_package";
|
|
2174
|
+
readonly CHANGE_SUBSCRIPTION: "change_subscription";
|
|
2175
|
+
};
|
|
2176
|
+
/**
|
|
2177
|
+
* 产品类型的类型定义
|
|
2178
|
+
*/
|
|
2179
|
+
type ProductType = (typeof PRODUCT_TYPE)[keyof typeof PRODUCT_TYPE];
|
|
2180
|
+
/**
|
|
2181
|
+
* 商品信息
|
|
2182
|
+
*/
|
|
2183
|
+
interface Product {
|
|
2184
|
+
id: string;
|
|
2185
|
+
name: string;
|
|
2186
|
+
price: number;
|
|
2187
|
+
currency: string;
|
|
2188
|
+
type: ProductType;
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* 自动创建订单配置
|
|
2192
|
+
*/
|
|
2193
|
+
interface AutoCreateOrderConfig {
|
|
2194
|
+
/** 产品ID */
|
|
2195
|
+
productId: string;
|
|
2196
|
+
/** 购买类型:1-一次性购买,2-订阅 */
|
|
2197
|
+
purchaseType: 1 | 2;
|
|
2198
|
+
/** API 主机地址 */
|
|
2199
|
+
apiHost: string;
|
|
2200
|
+
/** 账户 Token */
|
|
2201
|
+
accountToken: string;
|
|
2202
|
+
/** 客户端 ID */
|
|
2203
|
+
clientId: string;
|
|
2204
|
+
/** 国家代码 */
|
|
2205
|
+
countryCode: string;
|
|
2206
|
+
}
|
|
2207
|
+
/**
|
|
2208
|
+
* PaymentCheckoutModal 配置选项
|
|
2209
|
+
*/
|
|
2210
|
+
interface PaymentCheckoutModalOptions {
|
|
2211
|
+
/** 当前选择的商品 */
|
|
2212
|
+
product?: Product | null;
|
|
2213
|
+
/** 自动创建订单配置(优先级最高) */
|
|
2214
|
+
autoCreateOrder?: AutoCreateOrderConfig;
|
|
2215
|
+
/** OrderPayment 实例(提前创建时使用) */
|
|
2216
|
+
payment?: OrderPayment;
|
|
2217
|
+
/** 订单 transaction_id(延迟创建支付实例时使用) */
|
|
2218
|
+
transactionId?: string;
|
|
2219
|
+
/** 支付方式列表(当不使用 autoCreateOrder 时需要提供) */
|
|
2220
|
+
paymentMethods?: PaymentMethod[];
|
|
2221
|
+
/** 是否正在加载支付方式 */
|
|
2222
|
+
loadingMethods?: boolean;
|
|
2223
|
+
/** 当前业务类型:1-一次性购买,2-订阅 */
|
|
2224
|
+
currentBusinessType?: 1 | 2 | null;
|
|
2225
|
+
/** 支付成功回调 */
|
|
2226
|
+
onPaymentSuccess?: (payload: OrderStatusResponse) => void;
|
|
2227
|
+
/** 支付失败回调 */
|
|
2228
|
+
onPaymentFailed?: (error: {
|
|
2229
|
+
message: string;
|
|
2230
|
+
}) => void;
|
|
2231
|
+
/** 选择支付方式回调 */
|
|
2232
|
+
onPaymentMethodSelect?: (method: PaymentMethod) => void;
|
|
2233
|
+
/** Link 支付开始回调(用于显示验证弹窗) */
|
|
2234
|
+
onLinkPaymentStart?: (paymentMethodName: string) => void;
|
|
2235
|
+
/** 加载回调 */
|
|
2236
|
+
onLoading?: (loading: boolean) => void;
|
|
2237
|
+
/** 弹框标题 */
|
|
2238
|
+
modalTitle?: string;
|
|
2239
|
+
/** 弹框选项 */
|
|
2240
|
+
modalOptions?: Omit<PaymentModalOptions, 'title'>;
|
|
2241
|
+
/** 是否显示返回按钮 */
|
|
2242
|
+
showBackButton?: boolean;
|
|
2243
|
+
/** 返回按钮文本 */
|
|
2244
|
+
backButtonText?: string;
|
|
2245
|
+
/** 用户账号名称 */
|
|
2246
|
+
accountName?: string;
|
|
2247
|
+
/** 语言设置 */
|
|
2248
|
+
language?: 'en' | 'zh-CN';
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* PaymentCheckoutModal - 通用支付收银台弹框
|
|
2253
|
+
* 支持 Link、Dropin 和 BindCard 三种支付方式
|
|
2254
|
+
* 纯 JavaScript 实现,不依赖任何框架
|
|
2255
|
+
*/
|
|
2256
|
+
|
|
2257
|
+
declare class PaymentCheckoutModal {
|
|
2258
|
+
private options;
|
|
2259
|
+
private modal;
|
|
2260
|
+
private orderPayment;
|
|
2261
|
+
private containerElement;
|
|
2262
|
+
private retentionModal;
|
|
2263
|
+
private bindCardPayment;
|
|
2264
|
+
private verificationModal;
|
|
2265
|
+
private isCleanedUp;
|
|
2266
|
+
private orderService;
|
|
2267
|
+
private loadingManager;
|
|
2268
|
+
private stateManager;
|
|
2269
|
+
private strategyFactory;
|
|
2270
|
+
private uiRenderer;
|
|
2271
|
+
constructor(options: PaymentCheckoutModalOptions);
|
|
2272
|
+
/**
|
|
2273
|
+
* 获取当前语言的文本
|
|
2274
|
+
*/
|
|
2275
|
+
private getText;
|
|
2276
|
+
/**
|
|
2277
|
+
* 打开弹框
|
|
2278
|
+
*/
|
|
2279
|
+
open(): Promise<void>;
|
|
2280
|
+
/**
|
|
2281
|
+
* 显示加载指示器(使用 LoadingManager)
|
|
2282
|
+
*/
|
|
2283
|
+
private showLoading;
|
|
2284
|
+
/**
|
|
2285
|
+
* 隐藏加载指示器(使用 LoadingManager)
|
|
2286
|
+
*/
|
|
2287
|
+
private hideLoading;
|
|
2288
|
+
/**
|
|
2289
|
+
* 自动创建订单(使用 OrderService)
|
|
2290
|
+
*/
|
|
2291
|
+
private handleAutoCreateOrder;
|
|
2292
|
+
/**
|
|
2293
|
+
* 检查 SDK 是否已初始化
|
|
2294
|
+
*/
|
|
2295
|
+
private checkSDKInitialized;
|
|
2296
|
+
/**
|
|
2297
|
+
* 开始轮询订单状态(使用 OrderService)
|
|
2298
|
+
*/
|
|
2299
|
+
private startOrderPolling;
|
|
2300
|
+
/**
|
|
2301
|
+
* 停止轮询订单状态(使用 OrderService)
|
|
2302
|
+
*/
|
|
2303
|
+
private stopOrderPolling;
|
|
2304
|
+
/**
|
|
2305
|
+
* 检查订单状态(使用 OrderService)
|
|
2306
|
+
* 点击"我已完成支付"按钮后,开始轮询订单状态(最多 10 次)
|
|
2307
|
+
*/
|
|
2308
|
+
private checkOrderStatus;
|
|
2309
|
+
/**
|
|
2310
|
+
* 显示支付失败弹窗
|
|
2311
|
+
*/
|
|
2312
|
+
private showPaymentFailedModal;
|
|
2313
|
+
/**
|
|
2314
|
+
* 显示支付验证弹窗(仅用于 Link 支付)
|
|
2315
|
+
*/
|
|
2316
|
+
private showVerificationModal;
|
|
2317
|
+
/**
|
|
2318
|
+
* 处理支付成功
|
|
2319
|
+
*/
|
|
2320
|
+
private handlePaymentSuccess;
|
|
2321
|
+
/**
|
|
2322
|
+
* 从 transactionId 创建 OrderPayment
|
|
2323
|
+
*/
|
|
2324
|
+
private createOrderPaymentFromTransactionId;
|
|
2325
|
+
/**
|
|
2326
|
+
* 渲染支付方式列表
|
|
2327
|
+
*/
|
|
2328
|
+
private renderPaymentMethods;
|
|
2329
|
+
/**
|
|
2330
|
+
* 自动选中默认支付方式(优先选中第一个 Dropin 支付方式)
|
|
2331
|
+
*/
|
|
2332
|
+
private autoSelectDefaultPaymentMethod;
|
|
2333
|
+
/**
|
|
2334
|
+
* 处理支付方式选择
|
|
2335
|
+
*/
|
|
2336
|
+
private handleSelectPaymentMethod;
|
|
2337
|
+
/**
|
|
2338
|
+
* 执行支付策略
|
|
2339
|
+
*/
|
|
2340
|
+
private executePaymentStrategy;
|
|
2341
|
+
/**
|
|
2342
|
+
* 渲染卡片列表
|
|
2343
|
+
*/
|
|
2344
|
+
private renderCardList;
|
|
2345
|
+
/**
|
|
2346
|
+
* 渲染错误状态
|
|
2347
|
+
*/
|
|
2348
|
+
private renderError;
|
|
2349
|
+
/**
|
|
2350
|
+
* 显示挽留弹框
|
|
2351
|
+
*/
|
|
2352
|
+
private showRetentionModal;
|
|
2353
|
+
/**
|
|
2354
|
+
* 显示购买成功弹框
|
|
2355
|
+
*/
|
|
2356
|
+
private showPurchaseSuccessModal;
|
|
2357
|
+
/**
|
|
2358
|
+
* 关闭弹框
|
|
2359
|
+
*/
|
|
2360
|
+
close(): void;
|
|
2361
|
+
/**
|
|
2362
|
+
* 清理资源
|
|
2363
|
+
*/
|
|
2364
|
+
private cleanup;
|
|
2365
|
+
/**
|
|
2366
|
+
* 检查弹框是否打开
|
|
2367
|
+
*/
|
|
2368
|
+
isOpen(): boolean;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2066
2371
|
/**
|
|
2067
2372
|
* 共享配置文件
|
|
2068
2373
|
* Shared configuration for CreditPackageModal and GenericPackageModal
|
|
@@ -2147,15 +2452,6 @@ declare function hideLoadingIndicator(loader?: HTMLElement | null): void;
|
|
|
2147
2452
|
*/
|
|
2148
2453
|
declare function showInfoMessage(message: string, duration?: number): void;
|
|
2149
2454
|
|
|
2150
|
-
/**
|
|
2151
|
-
* PurchaseSuccessModal - 购买成功弹窗
|
|
2152
|
-
* 纯 JavaScript 实现,不依赖 React
|
|
2153
|
-
*
|
|
2154
|
-
* 参考设计: credit-pack-success-modal
|
|
2155
|
-
* - 邮件确认卡片风格
|
|
2156
|
-
* - 精美的动画效果(淡入淡出、缩放)
|
|
2157
|
-
* - 包含成功图标、套餐详情、积分数、支付金额
|
|
2158
|
-
*/
|
|
2159
2455
|
interface PurchaseSuccessData {
|
|
2160
2456
|
/** 套餐名称 */
|
|
2161
2457
|
packName: string;
|
|
@@ -2188,6 +2484,7 @@ declare class PurchaseSuccessModal {
|
|
|
2188
2484
|
private isExiting;
|
|
2189
2485
|
private scrollY;
|
|
2190
2486
|
private boundHandleEscKey;
|
|
2487
|
+
private boundPreventTouchMove;
|
|
2191
2488
|
constructor(options: PurchaseSuccessModalOptions);
|
|
2192
2489
|
/**
|
|
2193
2490
|
* 打开弹窗
|
|
@@ -2217,6 +2514,200 @@ declare class PurchaseSuccessModal {
|
|
|
2217
2514
|
* 处理 ESC 键
|
|
2218
2515
|
*/
|
|
2219
2516
|
private handleEscKey;
|
|
2517
|
+
/**
|
|
2518
|
+
* 阻止 body 的触摸滑动
|
|
2519
|
+
*/
|
|
2520
|
+
private preventTouchMove;
|
|
2521
|
+
/**
|
|
2522
|
+
* 清理资源
|
|
2523
|
+
*/
|
|
2524
|
+
private cleanup;
|
|
2525
|
+
/**
|
|
2526
|
+
* HTML 转义工具函数
|
|
2527
|
+
* 防止 XSS 攻击
|
|
2528
|
+
*/
|
|
2529
|
+
private escapeHtml;
|
|
2530
|
+
/**
|
|
2531
|
+
* 检查弹窗是否打开
|
|
2532
|
+
*/
|
|
2533
|
+
isOpen(): boolean;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
/**
|
|
2537
|
+
* PaymentVerificationModal - 支付验证状态弹窗
|
|
2538
|
+
* 纯 JavaScript 实现,不依赖 React
|
|
2539
|
+
*
|
|
2540
|
+
* 样式完全参考 next-meta 项目的设计
|
|
2541
|
+
* 按钮逻辑参考 @seaart/payment-component
|
|
2542
|
+
*/
|
|
2543
|
+
interface PaymentVerificationOptions {
|
|
2544
|
+
/** 语言,默认 'en' */
|
|
2545
|
+
language?: 'en' | 'zh-CN';
|
|
2546
|
+
/** 交易ID */
|
|
2547
|
+
transactionId: string;
|
|
2548
|
+
/** 产品名称(可选) */
|
|
2549
|
+
productName?: string;
|
|
2550
|
+
/** 支付方式名称 */
|
|
2551
|
+
paymentMethodName?: string;
|
|
2552
|
+
/** 成功回调 */
|
|
2553
|
+
onSuccess?: (orderInfo: any) => void;
|
|
2554
|
+
/** 失败回调 */
|
|
2555
|
+
onFailed?: (error: {
|
|
2556
|
+
message: string;
|
|
2557
|
+
}) => void;
|
|
2558
|
+
/** 超时回调 */
|
|
2559
|
+
onTimeout?: () => void;
|
|
2560
|
+
/** Cancel 按钮回调 */
|
|
2561
|
+
onCancel?: () => void;
|
|
2562
|
+
/** Complete Payment 按钮回调 */
|
|
2563
|
+
onCompletePayment?: () => void;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* 支付验证弹窗类
|
|
2567
|
+
*/
|
|
2568
|
+
declare class PaymentVerificationModal {
|
|
2569
|
+
private overlay;
|
|
2570
|
+
private modal;
|
|
2571
|
+
private options;
|
|
2572
|
+
private isExiting;
|
|
2573
|
+
private scrollY;
|
|
2574
|
+
private boundHandleEscKey;
|
|
2575
|
+
private boundPreventTouchMove;
|
|
2576
|
+
constructor(options: PaymentVerificationOptions);
|
|
2577
|
+
/**
|
|
2578
|
+
* 打开弹窗
|
|
2579
|
+
*/
|
|
2580
|
+
open(): void;
|
|
2581
|
+
/**
|
|
2582
|
+
* 关闭弹窗
|
|
2583
|
+
*/
|
|
2584
|
+
close(): void;
|
|
2585
|
+
/**
|
|
2586
|
+
* 创建弹窗元素
|
|
2587
|
+
*/
|
|
2588
|
+
private createModal;
|
|
2589
|
+
/**
|
|
2590
|
+
* 生成弹窗 HTML
|
|
2591
|
+
*/
|
|
2592
|
+
private getModalHTML;
|
|
2593
|
+
/**
|
|
2594
|
+
* 获取语言文本
|
|
2595
|
+
*/
|
|
2596
|
+
private getTexts;
|
|
2597
|
+
/**
|
|
2598
|
+
* 添加 CSS 动画
|
|
2599
|
+
*/
|
|
2600
|
+
private addStyles;
|
|
2601
|
+
/**
|
|
2602
|
+
* 添加事件监听
|
|
2603
|
+
*/
|
|
2604
|
+
private attachEventListeners;
|
|
2605
|
+
/**
|
|
2606
|
+
* 处理 Cancel 按钮
|
|
2607
|
+
*/
|
|
2608
|
+
private handleCancel;
|
|
2609
|
+
/**
|
|
2610
|
+
* 处理 Complete Payment 按钮
|
|
2611
|
+
*/
|
|
2612
|
+
private handleCompletePayment;
|
|
2613
|
+
/**
|
|
2614
|
+
* 切换到 Processing(加载中)状态
|
|
2615
|
+
* 显示加载动画和 "Checking payment status..." 文本
|
|
2616
|
+
* 按钮变为 "Processing..." 且不可点击
|
|
2617
|
+
*/
|
|
2618
|
+
showProcessing(): void;
|
|
2619
|
+
/**
|
|
2620
|
+
* 恢复到初始状态(隐藏加载动画,恢复按钮文本)
|
|
2621
|
+
*/
|
|
2622
|
+
hideProcessing(): void;
|
|
2623
|
+
/**
|
|
2624
|
+
* 处理 ESC 键
|
|
2625
|
+
*/
|
|
2626
|
+
private handleEscKey;
|
|
2627
|
+
/**
|
|
2628
|
+
* 阻止 body 的触摸滑动
|
|
2629
|
+
*/
|
|
2630
|
+
private preventTouchMove;
|
|
2631
|
+
/**
|
|
2632
|
+
* 清理资源
|
|
2633
|
+
*/
|
|
2634
|
+
private cleanup;
|
|
2635
|
+
/**
|
|
2636
|
+
* 检查弹窗是否打开
|
|
2637
|
+
*/
|
|
2638
|
+
isOpen(): boolean;
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
/**
|
|
2642
|
+
* PaymentFailedModal - 支付失败弹窗
|
|
2643
|
+
* 纯 JavaScript 实现,不依赖 React
|
|
2644
|
+
*
|
|
2645
|
+
* 样式与 PaymentVerificationModal 保持一致
|
|
2646
|
+
* 深蓝渐变主题背景,按钮样式统一
|
|
2647
|
+
*/
|
|
2648
|
+
interface PaymentFailedModalOptions {
|
|
2649
|
+
/** 语言,默认 'en' */
|
|
2650
|
+
language?: 'en' | 'zh-CN';
|
|
2651
|
+
/** 错误标题 */
|
|
2652
|
+
title?: string;
|
|
2653
|
+
/** 错误消息 */
|
|
2654
|
+
message: string;
|
|
2655
|
+
/** 错误详情(可选,支持展开/折叠) */
|
|
2656
|
+
details?: string;
|
|
2657
|
+
/** 关闭回调 */
|
|
2658
|
+
onClose?: () => void;
|
|
2659
|
+
/** 重试回调(可选) */
|
|
2660
|
+
onRetry?: () => void;
|
|
2661
|
+
}
|
|
2662
|
+
/**
|
|
2663
|
+
* 支付失败弹窗类
|
|
2664
|
+
*/
|
|
2665
|
+
declare class PaymentFailedModal {
|
|
2666
|
+
private overlay;
|
|
2667
|
+
private modal;
|
|
2668
|
+
private options;
|
|
2669
|
+
private isExiting;
|
|
2670
|
+
private scrollY;
|
|
2671
|
+
private boundHandleEscKey;
|
|
2672
|
+
private boundPreventTouchMove;
|
|
2673
|
+
private detailsExpanded;
|
|
2674
|
+
constructor(options: PaymentFailedModalOptions);
|
|
2675
|
+
/**
|
|
2676
|
+
* 打开弹窗
|
|
2677
|
+
*/
|
|
2678
|
+
open(): void;
|
|
2679
|
+
/**
|
|
2680
|
+
* 关闭弹窗
|
|
2681
|
+
*/
|
|
2682
|
+
close(): void;
|
|
2683
|
+
/**
|
|
2684
|
+
* 创建弹窗元素
|
|
2685
|
+
*/
|
|
2686
|
+
private createModal;
|
|
2687
|
+
/**
|
|
2688
|
+
* 生成弹窗 HTML
|
|
2689
|
+
*/
|
|
2690
|
+
private getModalHTML;
|
|
2691
|
+
/**
|
|
2692
|
+
* 添加 CSS 动画
|
|
2693
|
+
*/
|
|
2694
|
+
private addStyles;
|
|
2695
|
+
/**
|
|
2696
|
+
* 添加事件监听
|
|
2697
|
+
*/
|
|
2698
|
+
private attachEventListeners;
|
|
2699
|
+
/**
|
|
2700
|
+
* 切换详情展开/折叠
|
|
2701
|
+
*/
|
|
2702
|
+
private toggleDetails;
|
|
2703
|
+
/**
|
|
2704
|
+
* 处理 ESC 键
|
|
2705
|
+
*/
|
|
2706
|
+
private handleEscKey;
|
|
2707
|
+
/**
|
|
2708
|
+
* 阻止 body 的触摸滑动
|
|
2709
|
+
*/
|
|
2710
|
+
private preventTouchMove;
|
|
2220
2711
|
/**
|
|
2221
2712
|
* 清理资源
|
|
2222
2713
|
*/
|
|
@@ -2340,6 +2831,7 @@ declare class StylesheetLoader {
|
|
|
2340
2831
|
* Subscription API
|
|
2341
2832
|
* 订阅管理 - 查询、变更、重启订阅
|
|
2342
2833
|
*/
|
|
2834
|
+
|
|
2343
2835
|
/**
|
|
2344
2836
|
* 当前订阅状态
|
|
2345
2837
|
*/
|
|
@@ -2347,7 +2839,7 @@ interface CurrentSubscription {
|
|
|
2347
2839
|
subscription_id: string;
|
|
2348
2840
|
product_id: string;
|
|
2349
2841
|
tier: string;
|
|
2350
|
-
billing_period:
|
|
2842
|
+
billing_period: BillingPeriod;
|
|
2351
2843
|
status: string;
|
|
2352
2844
|
cancel_at_period_end: boolean;
|
|
2353
2845
|
current_period_end: number;
|
|
@@ -2358,7 +2850,7 @@ interface CurrentSubscription {
|
|
|
2358
2850
|
interface ActiveSubscription {
|
|
2359
2851
|
subscription_id: string;
|
|
2360
2852
|
tier: number;
|
|
2361
|
-
billing_period:
|
|
2853
|
+
billing_period: BillingPeriod;
|
|
2362
2854
|
price: string;
|
|
2363
2855
|
currency: string;
|
|
2364
2856
|
current_period_start: number;
|
|
@@ -2367,14 +2859,6 @@ interface ActiveSubscription {
|
|
|
2367
2859
|
cancel_at_period_end: boolean;
|
|
2368
2860
|
can_cancel: boolean;
|
|
2369
2861
|
}
|
|
2370
|
-
/**
|
|
2371
|
-
* 统一响应格式
|
|
2372
|
-
*/
|
|
2373
|
-
interface UnifiedResponse<T = any> {
|
|
2374
|
-
code: number;
|
|
2375
|
-
msg: string;
|
|
2376
|
-
data: T | null;
|
|
2377
|
-
}
|
|
2378
2862
|
/**
|
|
2379
2863
|
* 创建订单响应
|
|
2380
2864
|
*/
|
|
@@ -2392,17 +2876,6 @@ interface CreateOrderResponse {
|
|
|
2392
2876
|
/** SDK 配置 */
|
|
2393
2877
|
sdk_config: SdkConfig;
|
|
2394
2878
|
}
|
|
2395
|
-
/**
|
|
2396
|
-
* SDK 配置
|
|
2397
|
-
*/
|
|
2398
|
-
interface SdkConfig {
|
|
2399
|
-
/** 应用 ID */
|
|
2400
|
-
app_id: string;
|
|
2401
|
-
/** API 域名 */
|
|
2402
|
-
api_host: string;
|
|
2403
|
-
/** 环境 */
|
|
2404
|
-
environment: string;
|
|
2405
|
-
}
|
|
2406
2879
|
/**
|
|
2407
2880
|
* 获取当前订阅状态(用于升降级判断)
|
|
2408
2881
|
*/
|
|
@@ -2414,11 +2887,13 @@ declare function getCurrentSubscription(apiHost: string, authToken?: string, sig
|
|
|
2414
2887
|
* @param params 创建订单参数
|
|
2415
2888
|
* @param product_id 产品ID
|
|
2416
2889
|
* @param purchase_type 购买类型(1=一次性, 2=订阅)
|
|
2890
|
+
* @param currency 币种(可选,如 USD, CNY)
|
|
2417
2891
|
* @returns 创建订单响应
|
|
2418
2892
|
*/
|
|
2419
2893
|
declare function createOrder(apiHost: string, authToken: string, params: {
|
|
2420
2894
|
product_id: string;
|
|
2421
2895
|
purchase_type: number | string;
|
|
2896
|
+
currency?: string;
|
|
2422
2897
|
}): Promise<CreateOrderResponse | null | undefined>;
|
|
2423
2898
|
/**
|
|
2424
2899
|
* 获取活跃订阅详情
|
|
@@ -2448,10 +2923,6 @@ declare function restartSubscription(apiHost: string, authToken: string | undefi
|
|
|
2448
2923
|
message: string;
|
|
2449
2924
|
next_billing_date: number;
|
|
2450
2925
|
}>;
|
|
2451
|
-
/**
|
|
2452
|
-
* 积分池类型
|
|
2453
|
-
*/
|
|
2454
|
-
type CreditPoolType = 'daily' | 'event' | 'monthly' | 'permanent';
|
|
2455
2926
|
/**
|
|
2456
2927
|
* 积分池详情
|
|
2457
2928
|
*/
|
|
@@ -2483,43 +2954,94 @@ interface CreditDetailResponse {
|
|
|
2483
2954
|
declare function getCreditDetail(apiHost: string, authToken?: string): Promise<CreditDetailResponse | null>;
|
|
2484
2955
|
|
|
2485
2956
|
/**
|
|
2486
|
-
*
|
|
2487
|
-
*
|
|
2488
|
-
|
|
2489
|
-
/**
|
|
2490
|
-
* 订单状态
|
|
2957
|
+
* @filename packages/index.ts
|
|
2958
|
+
* @description 积分包(Credit Package)API 接口
|
|
2959
|
+
* 新版接口:GET /api/v1/payment/sdk/packages/available
|
|
2491
2960
|
*/
|
|
2492
|
-
|
|
2961
|
+
|
|
2493
2962
|
/**
|
|
2494
|
-
*
|
|
2963
|
+
* 可用积分包列表响应
|
|
2495
2964
|
*/
|
|
2496
|
-
interface
|
|
2497
|
-
|
|
2965
|
+
interface AvailablePackagesResponse {
|
|
2966
|
+
code: number;
|
|
2967
|
+
msg: string;
|
|
2968
|
+
data: {
|
|
2969
|
+
packages: CreditPackageItem[];
|
|
2970
|
+
} | null;
|
|
2498
2971
|
}
|
|
2499
2972
|
/**
|
|
2500
|
-
*
|
|
2501
|
-
* @param
|
|
2502
|
-
* @param
|
|
2503
|
-
* @
|
|
2504
|
-
* @returns 订单状态
|
|
2973
|
+
* 获取可用积分包列表
|
|
2974
|
+
* @param apiHost API 主机地址
|
|
2975
|
+
* @param token 认证 Token
|
|
2976
|
+
* @returns 可用的积分包列表
|
|
2505
2977
|
*/
|
|
2506
|
-
declare function
|
|
2978
|
+
declare function fetchAvailablePackages(apiHost: string, token: string): Promise<CreditPackageItem[]>;
|
|
2979
|
+
|
|
2507
2980
|
/**
|
|
2508
|
-
*
|
|
2509
|
-
* @
|
|
2510
|
-
*
|
|
2511
|
-
*
|
|
2512
|
-
*
|
|
2513
|
-
*
|
|
2981
|
+
* @filename CreditPackCard.ts
|
|
2982
|
+
* @description 积分包卡片组件(纯 JavaScript 实现)
|
|
2983
|
+
* 完整迁移自 Restore UI Design 项目的 PricingCard 组件
|
|
2984
|
+
*
|
|
2985
|
+
* 设计特点:
|
|
2986
|
+
* - 深色主题,半透明玻璃态背景
|
|
2987
|
+
* - 支持高亮状态(推荐套餐)带绿色渐变
|
|
2988
|
+
* - 光晕效果和呼吸动画
|
|
2989
|
+
* - SVG 徽章装饰(首充双倍)
|
|
2990
|
+
* - 悬停微交互和平滑过渡
|
|
2991
|
+
*/
|
|
2992
|
+
interface CreditPackCardOptions {
|
|
2993
|
+
/** 积分包 ID */
|
|
2994
|
+
id: string;
|
|
2995
|
+
/** 积分包名称 */
|
|
2996
|
+
name: string;
|
|
2997
|
+
/** 价格(美元) */
|
|
2998
|
+
price: number;
|
|
2999
|
+
/** 基础积分 */
|
|
3000
|
+
baseCredits: number;
|
|
3001
|
+
/** 奖励积分 */
|
|
3002
|
+
bonusCredits: number;
|
|
3003
|
+
/** 总积分 */
|
|
3004
|
+
totalCredits: number;
|
|
3005
|
+
/** 购买限制(可选) */
|
|
3006
|
+
purchaseLimit?: string;
|
|
3007
|
+
/** 是否推荐 */
|
|
3008
|
+
recommended?: boolean;
|
|
3009
|
+
/** 是否首充双倍 */
|
|
3010
|
+
isFirstPurchase?: boolean;
|
|
3011
|
+
/** 语言 */
|
|
3012
|
+
language?: 'en' | 'zh-CN';
|
|
3013
|
+
/** 点击购买回调 */
|
|
3014
|
+
onBuy: (packId: string) => Promise<void>;
|
|
3015
|
+
}
|
|
3016
|
+
/**
|
|
3017
|
+
* 积分包卡片组件
|
|
2514
3018
|
*/
|
|
2515
|
-
declare
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
/**
|
|
2521
|
-
|
|
2522
|
-
|
|
3019
|
+
declare class CreditPackCard {
|
|
3020
|
+
private options;
|
|
3021
|
+
private card;
|
|
3022
|
+
private loading;
|
|
3023
|
+
constructor(options: CreditPackCardOptions);
|
|
3024
|
+
/**
|
|
3025
|
+
* 渲染卡片到容器
|
|
3026
|
+
*/
|
|
3027
|
+
render(container: HTMLElement): void;
|
|
3028
|
+
/**
|
|
3029
|
+
* 创建卡片元素 - 完全还原 Restore UI Design
|
|
3030
|
+
*/
|
|
3031
|
+
private createCard;
|
|
3032
|
+
/**
|
|
3033
|
+
* 创建双倍奖励徽章 SVG
|
|
3034
|
+
*/
|
|
3035
|
+
private createDoubleBonusBadge;
|
|
3036
|
+
/**
|
|
3037
|
+
* 处理购买 - 更新为使用 span 而不是 button
|
|
3038
|
+
*/
|
|
3039
|
+
private handleBuy;
|
|
3040
|
+
/**
|
|
3041
|
+
* 销毁卡片
|
|
3042
|
+
*/
|
|
3043
|
+
destroy(): void;
|
|
3044
|
+
}
|
|
2523
3045
|
|
|
2524
3046
|
/**
|
|
2525
3047
|
* @seaverse/payment-sdk
|
|
@@ -2568,7 +3090,7 @@ declare function pollOrderStatus(transactionId: string, apiHost: string, authTok
|
|
|
2568
3090
|
/**
|
|
2569
3091
|
* SDK version
|
|
2570
3092
|
*/
|
|
2571
|
-
declare const VERSION = "0.
|
|
3093
|
+
declare const VERSION = "0.9.0";
|
|
2572
3094
|
|
|
2573
|
-
export { API_ENDPOINTS, BIZ_CODE, BindCardPaymentComponent, COMPONENT_LOAD_TIMEOUT,
|
|
2574
|
-
export type { ActiveSubscription, ApiErrorResponse, ApiResponse, ApiSuccessResponse, BaseCheckoutOptions, BillingPeriod, BindCard, BindCardCallbacks, BindCardPaymentOptions, CheckoutAPIConfig, CheckoutAPIResponse, CheckoutClientConfig, CheckoutClientStatus, CheckoutOptions, CheckoutPaymentError, CheckoutPaymentErrorCode, CheckoutResult, ComponentLoadStatus, CreateOrderResponse,
|
|
3095
|
+
export { API_ENDPOINTS, BIZ_CODE, BindCardPaymentComponent, COMPONENT_LOAD_TIMEOUT, CheckoutAPI, CreditPackCard, CreditPackageModal, DEFAULT_CHECKOUT_CONFIG, DropinPaymentComponent, DropinPaymentModal, ENVIRONMENT_CONFIGS, ENV_CONFIG, ErrorHandler, GRID_COLUMNS, GenericPackageModal, HTTP_STATUS, LinkPaymentComponent, OrderPayment, PAYMENT_ELEMENT_NAME, PaymentAPIError, PaymentCheckoutClient, PaymentCheckoutModal, PaymentClient, PaymentError, PaymentFailedModal, PaymentModal, PaymentStorage, PaymentVerificationModal, PurchaseSuccessModal, RESPONSIVE_BREAKPOINTS, RetentionModal, SDK_CONFIG, ScriptLoader, SeaArtPayLoader, SeaartPaymentSDK, StylesheetLoader, VERSION, centsToDollars, changeSubscription, checkOrderStatus, createCheckoutPaymentError, createOrder, delay, dollarsToCents, fetchAvailablePackages, formatPrice, generateOrderReference, getActiveSubscription, getCreditDetail, getCurrentSubscription, getCurrentUrl, getGlobalLoader, getSDKLocale, hideLoadingIndicator, isBrowser, isCheckoutPaymentError, pollOrderStatus, resetGlobalLoader, restartSubscription, safeJsonParse, showErrorMessage, showInfoMessage, showLoadingIndicator, showSuccessMessage, withTimeout };
|
|
3096
|
+
export type { ActiveSubscription, ApiErrorResponse, ApiResponse, ApiSuccessResponse, AutoCreateOrderConfig, AvailablePackagesResponse, BaseCheckoutOptions, BillingPeriod$1 as BillingPeriod, BindCard, BindCardCallbacks, BindCardPaymentOptions, CheckoutAPIConfig, CheckoutAPIResponse, CheckoutClientConfig, CheckoutClientStatus, CheckoutOptions, CheckoutPaymentError, CheckoutPaymentErrorCode, CheckoutResult, ComponentLoadStatus, CreateOrderResponse, CreditAccount, CreditAccountStatus, CreditDetailResponse$1 as CreditDetailResponse, CreditDetailSuccessResponse, CreditPackCardOptions, CreditPackageModalOptions, CreditPoolDetail, CreditPoolType$1 as CreditPoolType, CreditTransaction, CurrentSubscription, DropinCallbacks, DropinPaymentModalOptions, DropinPaymentOptions, Environment, EnvironmentConfig, GenericPackage, GenericPackageModalOptions, LinkPaymentOptions, ListTransactionsRequest, LoaderConfig, OrderInfo, OrderStatus, OrderStatusResponse, PaymentCheckoutModalOptions, PaymentClientOptions, PaymentEnvironment, PaymentFailedModalOptions, PaymentMethod, PaymentMethodsParams, PaymentModalOptions, PaymentReadyEventDetail, PaymentResult, PaymentSDKConfig, PaymentSuccessEventDetail, PaymentUnsuccessEventDetail, PaymentUnsuccessResult, PaymentVerificationOptions, Product, PurchaseSuccessData, PurchaseSuccessModalOptions, PurchaseType, RetentionModalOptions, SDKCheckoutRequest, SDKCheckoutResponse, SDKConfig, SDKLoadStatus, ScriptLoaderOptions, SeaArtPaymentElement, SeaartBindCardPayment, SeaartDropinPayment, SeaartLinkPayment, SeaartPaymentComponentSDK, SeaartPaymentInstance, SeaartPaymentSDKConfig, ShowPaymentOptions, SubscribeOptions, SubscriptionParams, SubscriptionPeriod, TransactionListResponse, TransactionStatus, TransactionStorageData, TransactionType };
|