@alipay/ams-checkout 2.0.13 → 2.0.16
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/ams-checkout.js +3 -3
- package/dist/ams-checkout.min.js +1 -1
- package/esm/core/component/element/EventCenter/index.d.ts +10 -0
- package/esm/core/component/element/EventCenter/index.js +40 -4
- package/esm/core/component/element/elementController/index.d.ts +2 -0
- package/esm/core/component/element/elementController/index.js +29 -2
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +47 -4
- package/esm/core/component/element/type.d.ts +2 -1
- package/esm/modern/index.js +1 -1
- package/esm/plugin/component/channel.d.ts +4 -1
- package/esm/plugin/component/channel.js +6 -2
- package/esm/plugin/component/index.js +7 -6
- package/esm/types/index.d.ts +1 -0
- package/package.json +8 -2
- package/types.d.ts +24 -3
- package/types.untrimmed.d.ts +27 -3
|
@@ -20,6 +20,16 @@ export declare class EventCenter {
|
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
22
|
endEvent(startId: string, extra?: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* Cancels a single active event and reports it as an ended event with canceled=true.
|
|
25
|
+
* This is used when the mount flow is terminated early (for example, on destroy or abnormal exit).
|
|
26
|
+
*/
|
|
27
|
+
cancelEvent(startId: string, extra?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Cancels all active events whose event id starts with the given prefix.
|
|
30
|
+
* For example, prefix 'mount' will cancel events like mount_1_start.
|
|
31
|
+
*/
|
|
32
|
+
cancelByPrefix(prefix: string, extra?: any): void;
|
|
23
33
|
private startHeartbeat;
|
|
24
34
|
private stopHeartbeat;
|
|
25
35
|
private sendHeartbeat;
|
|
@@ -89,17 +89,53 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
|
89
89
|
// 如果活动事件数量为0,则停止心跳
|
|
90
90
|
if (this.activeEvents.size === 0) this.stopHeartbeat();
|
|
91
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Cancels a single active event and reports it as an ended event with canceled=true.
|
|
95
|
+
* This is used when the mount flow is terminated early (for example, on destroy or abnormal exit).
|
|
96
|
+
*/
|
|
97
|
+
}, {
|
|
98
|
+
key: "cancelEvent",
|
|
99
|
+
value: function cancelEvent(startId, extra) {
|
|
100
|
+
if (!this.activeEvents.has(startId)) return;
|
|
101
|
+
var startTime = this.activeEvents.get(startId);
|
|
102
|
+
this.activeEvents.delete(startId);
|
|
103
|
+
var type = this.getEventNameFromStart(startId, 'end');
|
|
104
|
+
this.sendLog(type, _objectSpread({
|
|
105
|
+
eventName: this.buildIdFromStart(startId, 'end'),
|
|
106
|
+
startTime: startTime,
|
|
107
|
+
endTime: Date.now(),
|
|
108
|
+
canceled: true
|
|
109
|
+
}, extra || {}));
|
|
110
|
+
if (this.activeEvents.size === 0) this.stopHeartbeat();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Cancels all active events whose event id starts with the given prefix.
|
|
115
|
+
* For example, prefix 'mount' will cancel events like mount_1_start.
|
|
116
|
+
*/
|
|
117
|
+
}, {
|
|
118
|
+
key: "cancelByPrefix",
|
|
119
|
+
value: function cancelByPrefix(prefix, extra) {
|
|
120
|
+
var _this = this;
|
|
121
|
+
var ids = Array.from(this.activeEvents.keys()).filter(function (id) {
|
|
122
|
+
return id.startsWith(prefix);
|
|
123
|
+
});
|
|
124
|
+
ids.forEach(function (id) {
|
|
125
|
+
return _this.cancelEvent(id, extra);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
92
128
|
}, {
|
|
93
129
|
key: "startHeartbeat",
|
|
94
130
|
value: function startHeartbeat() {
|
|
95
|
-
var
|
|
131
|
+
var _this2 = this;
|
|
96
132
|
if (this.heartbeatIntervalId) return;
|
|
97
133
|
this.heartbeatIntervalId = setInterval(function () {
|
|
98
|
-
if (
|
|
99
|
-
|
|
134
|
+
if (_this2.activeEvents.size === 0) {
|
|
135
|
+
_this2.stopHeartbeat();
|
|
100
136
|
return;
|
|
101
137
|
}
|
|
102
|
-
|
|
138
|
+
_this2.sendHeartbeat();
|
|
103
139
|
}, this.HEARTBEAT_INTERVAL);
|
|
104
140
|
}
|
|
105
141
|
}, {
|
|
@@ -20,6 +20,8 @@ declare class ElementController {
|
|
|
20
20
|
private handleInitializationError;
|
|
21
21
|
private handleMountError;
|
|
22
22
|
private clearAndSetInitTimeout;
|
|
23
|
+
private clearInitTimeout;
|
|
24
|
+
private clearEvents;
|
|
23
25
|
private setInitTimeout;
|
|
24
26
|
private initializeAndMountProcessor;
|
|
25
27
|
private handleStartBizFlowError;
|
|
@@ -189,6 +189,25 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
189
189
|
this.initTimeout = this.setInitTimeout(resolve);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
// Clears the pending init timeout to avoid timeout callbacks from stale Element instances.
|
|
193
|
+
}, {
|
|
194
|
+
key: "clearInitTimeout",
|
|
195
|
+
value: function clearInitTimeout() {
|
|
196
|
+
clearTimeout(this.initTimeout);
|
|
197
|
+
this.initTimeout = null;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Clears mount-related heartbeat events to avoid stale heartbeat reporting after abnormal exit.
|
|
201
|
+
}, {
|
|
202
|
+
key: "clearEvents",
|
|
203
|
+
value: function clearEvents(reason) {
|
|
204
|
+
var _this$elementEventCen, _this$elementEventCen2;
|
|
205
|
+
// antlog examples: actionName=mount_end&msg=destroy, actionName=mount_end&msg=webLaunch
|
|
206
|
+
(_this$elementEventCen = (_this$elementEventCen2 = this.elementEventCenter).cancelByPrefix) === null || _this$elementEventCen === void 0 || _this$elementEventCen.call(_this$elementEventCen2, 'mount', {
|
|
207
|
+
msg: reason
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
192
211
|
// 设置初始化超时定时器
|
|
193
212
|
}, {
|
|
194
213
|
key: "setInitTimeout",
|
|
@@ -660,18 +679,22 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
660
679
|
_this5.sendReady(key, options);
|
|
661
680
|
});
|
|
662
681
|
}
|
|
663
|
-
_context5.next =
|
|
682
|
+
_context5.next = 26;
|
|
664
683
|
break;
|
|
665
684
|
case 20:
|
|
666
685
|
_context5.prev = 20;
|
|
667
686
|
_context5.t0 = _context5["catch"](1);
|
|
668
687
|
this.handleInitializationError();
|
|
688
|
+
// Fix: when request processing enters the catch path (excluding success=false business responses),
|
|
689
|
+
// stale timeout and heartbeat events must be cleared to avoid duplicate error callbacks.
|
|
690
|
+
this.clearInitTimeout();
|
|
691
|
+
this.clearEvents('webLaunch');
|
|
669
692
|
readyCallback({
|
|
670
693
|
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.INITIALIZE_TIMEOUT.API), {}, {
|
|
671
694
|
traceId: _context5.t0 === null || _context5.t0 === void 0 ? void 0 : _context5.t0.traceId
|
|
672
695
|
})
|
|
673
696
|
});
|
|
674
|
-
case
|
|
697
|
+
case 26:
|
|
675
698
|
case "end":
|
|
676
699
|
return _context5.stop();
|
|
677
700
|
}
|
|
@@ -828,6 +851,10 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
828
851
|
}, {
|
|
829
852
|
key: "destroyHandle",
|
|
830
853
|
value: function destroyHandle() {
|
|
854
|
+
// Fix: when a failed mount is destroyed and a new mount succeeds within the 16s timeout window,
|
|
855
|
+
// clear stale timeout and heartbeat events from the destroyed instance.
|
|
856
|
+
this.clearEvents('destroy');
|
|
857
|
+
this.clearInitTimeout();
|
|
831
858
|
this.elementContainer.destroy();
|
|
832
859
|
cleanMockup();
|
|
833
860
|
removeRetentionPopup();
|
|
@@ -132,14 +132,18 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
132
132
|
});
|
|
133
133
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
134
134
|
this.eventCenter.listen(EVENT.getApplePayToken.name, function (data) {
|
|
135
|
+
var _this2$obtainDataRes;
|
|
135
136
|
var _this2$elementContain = _this2.elementContainer.getPaymentContext(),
|
|
136
137
|
paymentSessionObj = _this2$elementContain.paymentSessionObj,
|
|
137
138
|
paymentSession = _this2$elementContain.paymentSession;
|
|
139
|
+
// SDK shipping takes priority; fall back to sdkAction.query shippingInfo (from createSession)
|
|
140
|
+
var shipping = (data === null || data === void 0 ? void 0 : data.shipping) || ((_this2$obtainDataRes = _this2.obtainDataRes) === null || _this2$obtainDataRes === void 0 || (_this2$obtainDataRes = _this2$obtainDataRes.originActionQueryResult) === null || _this2$obtainDataRes === void 0 ? void 0 : _this2$obtainDataRes.shippingInfo);
|
|
138
141
|
var applePayService = new ApplePaySdk({
|
|
139
142
|
paymentSessionData: paymentSession,
|
|
140
143
|
parseData: paymentSessionObj,
|
|
141
144
|
logger: logger,
|
|
142
|
-
env: _this2.options.env.environment
|
|
145
|
+
env: _this2.options.env.environment,
|
|
146
|
+
shipping: shipping
|
|
143
147
|
});
|
|
144
148
|
applePayService.startPay().then(function (res) {
|
|
145
149
|
_this2.eventCenter.dispatchToApp({
|
|
@@ -272,15 +276,27 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
272
276
|
LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
|
|
273
277
|
_queryParse = queryParse(this.getElementUrl()), appType = _queryParse.appType;
|
|
274
278
|
terminalType = isElementPad() ? 'WEB' : appType ? 'APP' : isElementPC() ? 'WEB' : 'WAP';
|
|
279
|
+
/**
|
|
280
|
+
* 生成查询支付动作的Promise
|
|
281
|
+
* 该方法负责向后端发起sdkAction查询请求,获取支付相关的动作配置信息。
|
|
282
|
+
* 支持本地mock模式用于开发调试,生产环境会发起真实的HTTP请求。
|
|
283
|
+
* @returns {Promise<CashierSdkActionQueryResult>} 返回支付动作查询结果的Promise
|
|
284
|
+
*/
|
|
275
285
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
|
276
286
|
return new Promise(function (resolve, reject) {
|
|
277
287
|
var _displayInfo$merchant;
|
|
288
|
+
// 本地mock模式:直接返回预设的sdkAction,用于开发调试
|
|
278
289
|
if (LOCAL_MOCK) {
|
|
279
290
|
setTimeout(function () {
|
|
280
291
|
resolve(sdkAction);
|
|
281
292
|
}, 100);
|
|
282
293
|
return;
|
|
283
294
|
}
|
|
295
|
+
_this3.getLogger().logInfo({
|
|
296
|
+
title: 'sdk_action_query_start'
|
|
297
|
+
}, {
|
|
298
|
+
config: safeStringify(paymentSessionConfig)
|
|
299
|
+
});
|
|
284
300
|
var sdkRequestData = {
|
|
285
301
|
paymentSessionConfig: paymentSessionConfig,
|
|
286
302
|
paymentSessionData: paymentSession,
|
|
@@ -289,12 +305,18 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
289
305
|
isUserPreferredLocale: true
|
|
290
306
|
}
|
|
291
307
|
};
|
|
308
|
+
|
|
309
|
+
// 可选参数:商户指定的储值卡信息
|
|
292
310
|
if (displayInfo !== null && displayInfo !== void 0 && (_displayInfo$merchant = displayInfo.merchantAppointParam) !== null && _displayInfo$merchant !== void 0 && _displayInfo$merchant.storedCard) {
|
|
293
311
|
sdkRequestData.merchantAppointParam = displayInfo.merchantAppointParam;
|
|
294
312
|
}
|
|
313
|
+
|
|
314
|
+
// 可选参数:控制支付完成后是否重定向
|
|
295
315
|
if (Object.prototype.hasOwnProperty.call(displayInfo, 'notRedirectAfterComplete')) {
|
|
296
316
|
sdkRequestData.notRedirectAfterComplete = displayInfo.notRedirectAfterComplete;
|
|
297
317
|
}
|
|
318
|
+
|
|
319
|
+
// 发起支付动作查询请求
|
|
298
320
|
requestService.request(sdkRequestData, {
|
|
299
321
|
env: environment,
|
|
300
322
|
envInfo: {
|
|
@@ -304,8 +326,13 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
304
326
|
hostSign: hostSign,
|
|
305
327
|
timeout: 300000,
|
|
306
328
|
// TODO dev环境接口超时
|
|
307
|
-
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
|
329
|
+
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query',
|
|
330
|
+
// 避免被第三方库或axios拦截器覆写,降低请求被错误处理的风险
|
|
331
|
+
headers: {
|
|
332
|
+
'Content-Type': 'application/json' // 手动指定Content-Type为application/json,确保符合MGW预期
|
|
333
|
+
}
|
|
308
334
|
}).then(function (result) {
|
|
335
|
+
// 记录请求结果日志
|
|
309
336
|
if (!result.success) {
|
|
310
337
|
_this3.getLogger().logError({
|
|
311
338
|
title: 'sdk_event_sdkQuery_failed'
|
|
@@ -324,6 +351,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
324
351
|
}
|
|
325
352
|
resolve(result);
|
|
326
353
|
}, function (e) {
|
|
354
|
+
// 请求异常处理:记录错误日志并reject
|
|
327
355
|
reject(e);
|
|
328
356
|
_this3.getLogger().logError({
|
|
329
357
|
title: 'sdk_event_sdkQuery_failed'
|
|
@@ -334,19 +362,28 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
334
362
|
});
|
|
335
363
|
});
|
|
336
364
|
};
|
|
365
|
+
/**
|
|
366
|
+
* 生成查询用户账户信息的Promise
|
|
367
|
+
* 该方法负责向后端发起oneAccount查询请求,获取用户的账户相关信息(如会员等级、权益等)。
|
|
368
|
+
* 支持本地mock模式用于开发调试,生产环境会发起真实的HTTP请求。
|
|
369
|
+
* @returns {Promise<AccountQueryResult>} 返回账户信息查询结果的Promise
|
|
370
|
+
*/
|
|
337
371
|
generateOneAccountQueryPromise = function generateOneAccountQueryPromise() {
|
|
338
372
|
return new Promise(function (resolve, reject) {
|
|
373
|
+
// 本地mock模式:直接返回预设的oneAccount数据,用于开发调试
|
|
339
374
|
if (LOCAL_MOCK) {
|
|
340
375
|
setTimeout(function () {
|
|
341
376
|
resolve(oneAccount);
|
|
342
377
|
}, 100);
|
|
343
378
|
return;
|
|
344
379
|
}
|
|
380
|
+
|
|
381
|
+
// 发起账户信息查询请求
|
|
345
382
|
requestService.request({
|
|
346
383
|
paymentSessionConfig: paymentSessionConfig,
|
|
347
384
|
paymentSessionData: paymentSession,
|
|
348
385
|
accountInfo: {
|
|
349
|
-
email: ''
|
|
386
|
+
email: '' // 邮箱字段预留,当前传空字符串
|
|
350
387
|
}
|
|
351
388
|
}, {
|
|
352
389
|
env: environment,
|
|
@@ -356,10 +393,16 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
356
393
|
},
|
|
357
394
|
timeout: 300000,
|
|
358
395
|
// TODO dev环境接口超时
|
|
359
|
-
'Operation-Type': 'com.ipay.iexpfront.one.account.query'
|
|
396
|
+
'Operation-Type': 'com.ipay.iexpfront.one.account.query',
|
|
397
|
+
// 避免被第三方库或axios拦截器覆写,降低请求被错误处理的风险
|
|
398
|
+
headers: {
|
|
399
|
+
'Content-Type': 'application/json' // 手动指定Content-Type为application/json,确保符合MGW预期
|
|
400
|
+
}
|
|
360
401
|
}).then(function (result) {
|
|
402
|
+
// 直接透传查询结果,不做额外处理
|
|
361
403
|
resolve(result);
|
|
362
404
|
}, function (e) {
|
|
405
|
+
// 请求异常处理:直接reject错误,由调用方处理
|
|
363
406
|
reject(e);
|
|
364
407
|
});
|
|
365
408
|
});
|
|
@@ -174,6 +174,7 @@ export interface PaymentMountOptions extends BaseMountOptions {
|
|
|
174
174
|
'state-success': string;
|
|
175
175
|
'state-info': string;
|
|
176
176
|
'state-marketing': string;
|
|
177
|
+
'state-conventional': string;
|
|
177
178
|
'radius-backup': string;
|
|
178
179
|
'radius-module': string;
|
|
179
180
|
'radius-component': string;
|
|
@@ -373,7 +374,7 @@ interface IUserName {
|
|
|
373
374
|
}
|
|
374
375
|
type Shippings = ShippingsItem[];
|
|
375
376
|
type IPaymentMethods = IPaymentMethod[];
|
|
376
|
-
interface CKPShipping {
|
|
377
|
+
export interface CKPShipping {
|
|
377
378
|
shippingRateId?: string;
|
|
378
379
|
shippingRateData?: ShippingRateData;
|
|
379
380
|
shippingAddress: ShippingAddress;
|
package/esm/modern/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import { createLoader } from '@antglobal/create-sdk-loader';
|
|
|
15
15
|
|
|
16
16
|
import { stageName } from "./stageName";
|
|
17
17
|
var SDKURL = {
|
|
18
|
-
DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("2.0.
|
|
18
|
+
DEV: "https://sdk-dev.marmot-cloud.com/package/ams-checkout/".concat("2.0.16", "/ams-checkout.js"),
|
|
19
19
|
LOCAL: "http://localhost:3000/ams-checkout.min.js",
|
|
20
20
|
PROD: 'https://js.antom.com/v2/ams-checkout.js'
|
|
21
21
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type EventPayload, type IPaymentSessionMetaData } from '../../types';
|
|
2
|
+
import type { CKPShipping } from '../../core/component/element/type';
|
|
2
3
|
import { Logger } from '../../util/logger';
|
|
3
4
|
export type IChannelBehavior = {
|
|
4
5
|
usePaymentSessionAsQueryResult: boolean;
|
|
@@ -32,11 +33,13 @@ export declare class ApplePaySdk {
|
|
|
32
33
|
private paymentStatus;
|
|
33
34
|
private logger;
|
|
34
35
|
private env;
|
|
35
|
-
|
|
36
|
+
private shipping?;
|
|
37
|
+
constructor({ paymentSessionData, parseData, logger, env, shipping, }: {
|
|
36
38
|
paymentSessionData: string;
|
|
37
39
|
parseData: IPaymentSessionMetaData;
|
|
38
40
|
logger: Logger;
|
|
39
41
|
env?: string;
|
|
42
|
+
shipping?: CKPShipping;
|
|
40
43
|
});
|
|
41
44
|
startPay(): Promise<unknown>;
|
|
42
45
|
begin(): Promise<unknown>;
|
|
@@ -136,7 +136,8 @@ export var ApplePaySdk = /*#__PURE__*/function () {
|
|
|
136
136
|
parseData = _ref.parseData,
|
|
137
137
|
logger = _ref.logger,
|
|
138
138
|
_ref$env = _ref.env,
|
|
139
|
-
env = _ref$env === void 0 ? EnvironmentEnum.prod : _ref$env
|
|
139
|
+
env = _ref$env === void 0 ? EnvironmentEnum.prod : _ref$env,
|
|
140
|
+
shipping = _ref.shipping;
|
|
140
141
|
_classCallCheck(this, ApplePaySdk);
|
|
141
142
|
_defineProperty(this, "APPLESDKURL", 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js');
|
|
142
143
|
_defineProperty(this, "session", null);
|
|
@@ -148,10 +149,12 @@ export var ApplePaySdk = /*#__PURE__*/function () {
|
|
|
148
149
|
_defineProperty(this, "paymentStatus", void 0);
|
|
149
150
|
_defineProperty(this, "logger", void 0);
|
|
150
151
|
_defineProperty(this, "env", void 0);
|
|
152
|
+
_defineProperty(this, "shipping", void 0);
|
|
151
153
|
this.paymentSessionData = paymentSessionData;
|
|
152
154
|
this.parseData = parseData;
|
|
153
155
|
this.env = env;
|
|
154
156
|
this.logger = logger;
|
|
157
|
+
this.shipping = shipping;
|
|
155
158
|
}
|
|
156
159
|
_createClass(ApplePaySdk, [{
|
|
157
160
|
key: "startPay",
|
|
@@ -346,7 +349,8 @@ export var ApplePaySdk = /*#__PURE__*/function () {
|
|
|
346
349
|
paymentFactors: params,
|
|
347
350
|
paymentMethod: {
|
|
348
351
|
paymentMethodType: 'APPLEPAY'
|
|
349
|
-
}
|
|
352
|
+
},
|
|
353
|
+
shipping: this.shipping
|
|
350
354
|
};
|
|
351
355
|
_context4.t2 = this.env;
|
|
352
356
|
_context4.next = 6;
|
|
@@ -1384,12 +1384,13 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
1386
1386
|
if ((data === null || data === void 0 || (_data$context6 = data.context) === null || _data$context6 === void 0 ? void 0 : _data$context6.event) === EVENT.getApplePayToken.name) {
|
|
1387
|
-
var _this$_renderParams18, _this$_renderParams19;
|
|
1387
|
+
var _this$_renderParams18, _this$_renderParams19, _data$context7;
|
|
1388
1388
|
var applePayService = new ApplePaySdk({
|
|
1389
1389
|
paymentSessionData: (_this$_renderParams18 = this._renderParams) === null || _this$_renderParams18 === void 0 ? void 0 : _this$_renderParams18.sessionData,
|
|
1390
1390
|
parseData: (_this$_renderParams19 = this._renderParams) === null || _this$_renderParams19 === void 0 ? void 0 : _this$_renderParams19.paymentSessionMetaData,
|
|
1391
1391
|
logger: this.AMSSDK.logger,
|
|
1392
|
-
env: this.AMSSDK.options.env.environment
|
|
1392
|
+
env: this.AMSSDK.options.env.environment,
|
|
1393
|
+
shipping: data === null || data === void 0 || (_data$context7 = data.context) === null || _data$context7 === void 0 || (_data$context7 = _data$context7.data) === null || _data$context7 === void 0 ? void 0 : _data$context7.shipping
|
|
1393
1394
|
});
|
|
1394
1395
|
applePayService.startPay().then(function (res) {
|
|
1395
1396
|
_this7.dispatchToApp({
|
|
@@ -1435,11 +1436,11 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1435
1436
|
key: "logEventCallback",
|
|
1436
1437
|
value: function logEventCallback(data, title) {
|
|
1437
1438
|
if (data.context.event === EVENT.eventCallback.name) {
|
|
1438
|
-
var _data$
|
|
1439
|
+
var _data$context9;
|
|
1439
1440
|
var callbackData = '';
|
|
1440
1441
|
try {
|
|
1441
|
-
var _data$
|
|
1442
|
-
callbackData = JSON.stringify((data === null || data === void 0 || (_data$
|
|
1442
|
+
var _data$context8;
|
|
1443
|
+
callbackData = JSON.stringify((data === null || data === void 0 || (_data$context8 = data.context) === null || _data$context8 === void 0 ? void 0 : _data$context8.data) || '');
|
|
1443
1444
|
} catch (e) {
|
|
1444
1445
|
console.error(e);
|
|
1445
1446
|
}
|
|
@@ -1447,7 +1448,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
|
1447
1448
|
title: title
|
|
1448
1449
|
}, {
|
|
1449
1450
|
callbackData: callbackData,
|
|
1450
|
-
callbackId: (data === null || data === void 0 || (_data$
|
|
1451
|
+
callbackId: (data === null || data === void 0 || (_data$context9 = data.context) === null || _data$context9 === void 0 ? void 0 : _data$context9.eventCallbackId) || ''
|
|
1451
1452
|
}).send();
|
|
1452
1453
|
}
|
|
1453
1454
|
}
|
package/esm/types/index.d.ts
CHANGED
|
@@ -572,6 +572,7 @@ export interface CashierSubmitPayRequest {
|
|
|
572
572
|
paymentMethodDetail?: Record<string, any>;
|
|
573
573
|
category?: string;
|
|
574
574
|
};
|
|
575
|
+
shipping?: import('../core/component/element/type').CKPShipping;
|
|
575
576
|
}
|
|
576
577
|
export interface CashierSubmitPayRequest {
|
|
577
578
|
paymentMethodType?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alipay/ams-checkout",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"exports": {
|
|
@@ -58,7 +58,13 @@
|
|
|
58
58
|
"generateApi": "intl-oneapi generate && prettier --write src/modern/sdk/oneapi",
|
|
59
59
|
"lint": "eslint ./src",
|
|
60
60
|
"test": "jest --coverage --silent",
|
|
61
|
-
"tsc": "tsc --noEmit"
|
|
61
|
+
"tsc": "tsc --noEmit",
|
|
62
|
+
"code-review-biz": "node .agents/skills/code-review-biz/scripts/code-review-cli.js",
|
|
63
|
+
"code-review-biz:mr": "node .agents/skills/code-review-biz/scripts/code-review-cli.js --url=",
|
|
64
|
+
"code-review-biz:push": "node .agents/skills/code-review-biz/scripts/code-review-cli.js --mode=pre-push",
|
|
65
|
+
"code-review-biz:init": "node .agents/skills/code-review-biz/scripts/lib/init.js init",
|
|
66
|
+
"code-review-biz:update": "node .agents/skills/code-review-biz/scripts/lib/init.js update",
|
|
67
|
+
"prepare": "husky install || true"
|
|
62
68
|
},
|
|
63
69
|
"commitlint": {
|
|
64
70
|
"extends": [
|
package/types.d.ts
CHANGED
|
@@ -233,7 +233,7 @@ export declare class AntomSDKError extends AntomError<AntomSDKErrorCodes> {
|
|
|
233
233
|
name: string;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
declare const AntomSDKErrorCodes: {
|
|
236
|
+
export declare const AntomSDKErrorCodes: {
|
|
237
237
|
/**
|
|
238
238
|
* @description 找不到主元素
|
|
239
239
|
*/
|
|
@@ -246,6 +246,26 @@ declare const AntomSDKErrorCodes: {
|
|
|
246
246
|
* @description WebApp 初始化超时
|
|
247
247
|
*/
|
|
248
248
|
readonly SDK_LAUNCH_PAYMENT_APP_ERROR: "SDK_LAUNCH_PAYMENT_APP_ERROR";
|
|
249
|
+
/**
|
|
250
|
+
* @description 参数非法,缺少必填参数或参数值不合法
|
|
251
|
+
*/
|
|
252
|
+
readonly PARAM_INVALID: "PARAM_INVALID";
|
|
253
|
+
/**
|
|
254
|
+
* @description channelClientId 查询接口超时
|
|
255
|
+
*/
|
|
256
|
+
readonly CHANNEL_CLIENT_ID_QUERY_TIMEOUT: "CHANNEL_CLIENT_ID_QUERY_TIMEOUT";
|
|
257
|
+
/**
|
|
258
|
+
* @description channelClientId 查询返回 success=true 但缺少 channelClientId
|
|
259
|
+
*/
|
|
260
|
+
readonly CHANNEL_CLIENT_ID_MISSING: "CHANNEL_CLIENT_ID_MISSING";
|
|
261
|
+
/**
|
|
262
|
+
* @description channelClientId 查询失败(success=false 或其他异常)
|
|
263
|
+
*/
|
|
264
|
+
readonly CHANNEL_CLIENT_ID_QUERY_FAILED: "CHANNEL_CLIENT_ID_QUERY_FAILED";
|
|
265
|
+
/**
|
|
266
|
+
* @description channelClientId 查询失败(请求异常,如网络错误、服务器错误等)
|
|
267
|
+
*/
|
|
268
|
+
readonly CHANNEL_CLIENT_ID_QUERY_ERROR: "CHANNEL_CLIENT_ID_QUERY_ERROR";
|
|
249
269
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
250
270
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
251
271
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -275,9 +295,9 @@ declare const AntomSDKErrorCodes: {
|
|
|
275
295
|
readonly INVALID_REDIRECT_URL: "INVALID_REDIRECT_URL";
|
|
276
296
|
};
|
|
277
297
|
|
|
278
|
-
declare type AntomSDKErrorCodes = typeof AntomSDKErrorCodes[keyof typeof AntomSDKErrorCodes];
|
|
298
|
+
export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeof AntomSDKErrorCodes];
|
|
279
299
|
|
|
280
|
-
export declare type AntomTheme =
|
|
300
|
+
export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
|
|
281
301
|
|
|
282
302
|
declare interface APICallbackOptions {
|
|
283
303
|
requestType: 'fetch' | 'xhr';
|
|
@@ -695,6 +715,7 @@ declare interface BaseAppearance<A extends Partial<Appearance>> {
|
|
|
695
715
|
declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Record<string, any>, SubmitReplay extends Record<string, any> = Record<string, any>, SubmitParams extends Record<string, any> = Record<string, any>, AppErrorCodes extends string = string, OpenModalConfig extends BaseOpenModalConfig = BaseOpenModalConfig> {
|
|
696
716
|
error: ErrorPayload<AppErrorCodes>;
|
|
697
717
|
/* Excluded from this release type: "OPENSDK@HANDSHAKE" */
|
|
718
|
+
/* Excluded from this release type: "OPENSDK@READY_HANDSHAKE" */
|
|
698
719
|
/* Excluded from this release type: "OPENSDK@UPDATE_CONFIG" */
|
|
699
720
|
/* Excluded from this release type: "OPENSDK@HANDSHAKE_ACK" */
|
|
700
721
|
/* Excluded from this release type: "OPENSDK@SUBMIT" */
|
package/types.untrimmed.d.ts
CHANGED
|
@@ -260,7 +260,7 @@ export declare class AntomSDKError extends AntomError<AntomSDKErrorCodes> {
|
|
|
260
260
|
name: string;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
declare const AntomSDKErrorCodes: {
|
|
263
|
+
export declare const AntomSDKErrorCodes: {
|
|
264
264
|
/**
|
|
265
265
|
* @description 找不到主元素
|
|
266
266
|
*/
|
|
@@ -273,6 +273,26 @@ declare const AntomSDKErrorCodes: {
|
|
|
273
273
|
* @description WebApp 初始化超时
|
|
274
274
|
*/
|
|
275
275
|
readonly SDK_LAUNCH_PAYMENT_APP_ERROR: "SDK_LAUNCH_PAYMENT_APP_ERROR";
|
|
276
|
+
/**
|
|
277
|
+
* @description 参数非法,缺少必填参数或参数值不合法
|
|
278
|
+
*/
|
|
279
|
+
readonly PARAM_INVALID: "PARAM_INVALID";
|
|
280
|
+
/**
|
|
281
|
+
* @description channelClientId 查询接口超时
|
|
282
|
+
*/
|
|
283
|
+
readonly CHANNEL_CLIENT_ID_QUERY_TIMEOUT: "CHANNEL_CLIENT_ID_QUERY_TIMEOUT";
|
|
284
|
+
/**
|
|
285
|
+
* @description channelClientId 查询返回 success=true 但缺少 channelClientId
|
|
286
|
+
*/
|
|
287
|
+
readonly CHANNEL_CLIENT_ID_MISSING: "CHANNEL_CLIENT_ID_MISSING";
|
|
288
|
+
/**
|
|
289
|
+
* @description channelClientId 查询失败(success=false 或其他异常)
|
|
290
|
+
*/
|
|
291
|
+
readonly CHANNEL_CLIENT_ID_QUERY_FAILED: "CHANNEL_CLIENT_ID_QUERY_FAILED";
|
|
292
|
+
/**
|
|
293
|
+
* @description channelClientId 查询失败(请求异常,如网络错误、服务器错误等)
|
|
294
|
+
*/
|
|
295
|
+
readonly CHANNEL_CLIENT_ID_QUERY_ERROR: "CHANNEL_CLIENT_ID_QUERY_ERROR";
|
|
276
296
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
277
297
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
278
298
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -302,9 +322,9 @@ declare const AntomSDKErrorCodes: {
|
|
|
302
322
|
readonly INVALID_REDIRECT_URL: "INVALID_REDIRECT_URL";
|
|
303
323
|
};
|
|
304
324
|
|
|
305
|
-
declare type AntomSDKErrorCodes = typeof AntomSDKErrorCodes[keyof typeof AntomSDKErrorCodes];
|
|
325
|
+
export declare type AntomSDKErrorCodes = (typeof AntomSDKErrorCodes)[keyof typeof AntomSDKErrorCodes];
|
|
306
326
|
|
|
307
|
-
export declare type AntomTheme =
|
|
327
|
+
export declare type AntomTheme = 'default' | 'agateGreen' | 'night' | 'nostalgicGray' | 'gamingPurple' | 'cherryBlossomPink' | 'light';
|
|
308
328
|
|
|
309
329
|
declare interface APICallbackOptions {
|
|
310
330
|
requestType: 'fetch' | 'xhr';
|
|
@@ -725,6 +745,10 @@ declare interface BaseBridgeEventMap<AppConfig extends Record<string, any> = Rec
|
|
|
725
745
|
* @internal 内部事件 不暴露给商户
|
|
726
746
|
*/
|
|
727
747
|
"OPENSDK@HANDSHAKE": AppConfig;
|
|
748
|
+
/**
|
|
749
|
+
* @internal 内部事件 不暴露给商户
|
|
750
|
+
*/
|
|
751
|
+
"OPENSDK@READY_HANDSHAKE": void;
|
|
728
752
|
/**
|
|
729
753
|
* @internal 内部事件 不暴露给商户
|
|
730
754
|
*/
|