@seaverse/payment-sdk 0.3.0 → 0.4.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/dist/index.browser.js +21 -9
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +21 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +22 -8
- package/dist/index.js +21 -9
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.browser.js
CHANGED
|
@@ -4141,23 +4141,28 @@ class PaymentClient {
|
|
|
4141
4141
|
*/
|
|
4142
4142
|
/**
|
|
4143
4143
|
* 环境配置
|
|
4144
|
-
* - development: 开发/测试环境
|
|
4145
|
-
* - production: 生产环境
|
|
4146
4144
|
*/
|
|
4147
4145
|
const ENV_CONFIG = {
|
|
4148
|
-
|
|
4146
|
+
develop: {
|
|
4149
4147
|
apiHost: 'https://aiart-openresty.dev.seaart.dev',
|
|
4148
|
+
iframeUrl: 'https://aiart-payment-page.dev.seaart.dev',
|
|
4150
4149
|
},
|
|
4151
|
-
|
|
4150
|
+
release: {
|
|
4152
4151
|
apiHost: 'https://www.seaart.ai',
|
|
4152
|
+
iframeUrl: 'https://pay.seaart.ai',
|
|
4153
4153
|
},
|
|
4154
4154
|
};
|
|
4155
|
+
/**
|
|
4156
|
+
* SDK 加载超时时间(毫秒)
|
|
4157
|
+
* @deprecated 使用 COMPONENT_LOAD_TIMEOUT 替代
|
|
4158
|
+
*/
|
|
4159
|
+
const SDK_LOAD_TIMEOUT = 15000;
|
|
4155
4160
|
/**
|
|
4156
4161
|
* Web Component 加载超时时间(毫秒)
|
|
4157
4162
|
*/
|
|
4158
4163
|
const COMPONENT_LOAD_TIMEOUT = 15000;
|
|
4159
4164
|
/**
|
|
4160
|
-
* Web Component
|
|
4165
|
+
* Web Component 元素名称
|
|
4161
4166
|
*/
|
|
4162
4167
|
const PAYMENT_ELEMENT_NAME = 'seaart-payment';
|
|
4163
4168
|
/**
|
|
@@ -4171,9 +4176,11 @@ const API_ENDPOINTS$1 = {
|
|
|
4171
4176
|
* 默认配置
|
|
4172
4177
|
*/
|
|
4173
4178
|
const DEFAULT_CHECKOUT_CONFIG = {
|
|
4174
|
-
environment: '
|
|
4179
|
+
environment: 'develop',
|
|
4175
4180
|
debug: false,
|
|
4176
4181
|
language: 'en',
|
|
4182
|
+
/** @deprecated 使用 componentTimeout 替代 */
|
|
4183
|
+
sdkTimeout: SDK_LOAD_TIMEOUT,
|
|
4177
4184
|
componentTimeout: COMPONENT_LOAD_TIMEOUT,
|
|
4178
4185
|
};
|
|
4179
4186
|
/**
|
|
@@ -4216,7 +4223,7 @@ class SeaArtPayLoader {
|
|
|
4216
4223
|
this.config = {
|
|
4217
4224
|
timeout: config.timeout ?? COMPONENT_LOAD_TIMEOUT,
|
|
4218
4225
|
debug: config.debug ?? false,
|
|
4219
|
-
environment: config.environment ?? '
|
|
4226
|
+
environment: config.environment ?? 'develop',
|
|
4220
4227
|
};
|
|
4221
4228
|
}
|
|
4222
4229
|
/**
|
|
@@ -4397,6 +4404,7 @@ class CheckoutAPI {
|
|
|
4397
4404
|
price: params.price,
|
|
4398
4405
|
purchase_type: 1,
|
|
4399
4406
|
extra: params.extra,
|
|
4407
|
+
redirect_url: params.redirectUrl,
|
|
4400
4408
|
});
|
|
4401
4409
|
}
|
|
4402
4410
|
/**
|
|
@@ -4410,6 +4418,7 @@ class CheckoutAPI {
|
|
|
4410
4418
|
purchase_type: 2,
|
|
4411
4419
|
subscription: params.subscription,
|
|
4412
4420
|
extra: params.extra,
|
|
4421
|
+
redirect_url: params.redirectUrl,
|
|
4413
4422
|
});
|
|
4414
4423
|
}
|
|
4415
4424
|
/**
|
|
@@ -4485,6 +4494,7 @@ class CheckoutAPI {
|
|
|
4485
4494
|
transactionId: response.transaction_id,
|
|
4486
4495
|
price: response.price,
|
|
4487
4496
|
currency: response.currency,
|
|
4497
|
+
redirectUrl: response.redirect_url,
|
|
4488
4498
|
sdkConfig: {
|
|
4489
4499
|
appId: response.sdk_config.app_id,
|
|
4490
4500
|
apiHost: response.sdk_config.api_host,
|
|
@@ -4553,7 +4563,7 @@ class CheckoutAPI {
|
|
|
4553
4563
|
* const checkoutClient = new PaymentCheckoutClient({
|
|
4554
4564
|
* apiHost: 'https://payment.sg.seaverse.dev',
|
|
4555
4565
|
* authToken: 'your-jwt-token',
|
|
4556
|
-
* environment: '
|
|
4566
|
+
* environment: 'develop',
|
|
4557
4567
|
* debug: true,
|
|
4558
4568
|
* });
|
|
4559
4569
|
*
|
|
@@ -4659,6 +4669,7 @@ class PaymentCheckoutClient {
|
|
|
4659
4669
|
productName: options.productName,
|
|
4660
4670
|
price: options.price,
|
|
4661
4671
|
extra: options.extra,
|
|
4672
|
+
redirectUrl: options.redirectUrl,
|
|
4662
4673
|
});
|
|
4663
4674
|
// 自动打开支付弹窗
|
|
4664
4675
|
this.showPaymentModal({
|
|
@@ -4700,6 +4711,7 @@ class PaymentCheckoutClient {
|
|
|
4700
4711
|
firstDays: options.firstDays ?? 0,
|
|
4701
4712
|
},
|
|
4702
4713
|
extra: options.extra,
|
|
4714
|
+
redirectUrl: options.redirectUrl,
|
|
4703
4715
|
});
|
|
4704
4716
|
// 自动打开支付弹窗
|
|
4705
4717
|
this.showPaymentModal({
|
|
@@ -5047,7 +5059,7 @@ function getSDKLocale(locale) {
|
|
|
5047
5059
|
/**
|
|
5048
5060
|
* SDK version
|
|
5049
5061
|
*/
|
|
5050
|
-
const VERSION$2 = '0.3.
|
|
5062
|
+
const VERSION$2 = '0.3.1';
|
|
5051
5063
|
|
|
5052
5064
|
var __defProp$1 = Object.defineProperty;
|
|
5053
5065
|
var __defProps$1 = Object.defineProperties;
|