@alipay/ams-checkout 0.0.1757298389-dev.2 → 0.0.1757298389-dev.3
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/umd/ams-checkout.min.js +1 -1
- package/esm/core/component/element/elementContainerService/containerService.js +3 -2
- package/esm/core/component/element/elementController/index.d.ts +0 -1
- package/esm/core/component/element/elementController/index.js +22 -42
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +7 -6
- package/esm/core/component/element/type.d.ts +1 -2
- package/esm/core/component/element/type.js +0 -1
- package/package.json +1 -1
@@ -19,7 +19,7 @@ export var IContainerStatus = /*#__PURE__*/function (IContainerStatus) {
|
|
19
19
|
}({});
|
20
20
|
export var ContainerController = /*#__PURE__*/function () {
|
21
21
|
function ContainerController(_ref) {
|
22
|
-
var _options$debugProps;
|
22
|
+
var _options$debugProps, _options$debugProps2;
|
23
23
|
var type = _ref.type,
|
24
24
|
instanceId = _ref.instanceId,
|
25
25
|
selector = _ref.selector,
|
@@ -41,6 +41,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
41
41
|
sdkVersion: '',
|
42
42
|
webAppVersion: ''
|
43
43
|
});
|
44
|
+
var iframesSrcLink = options !== null && options !== void 0 && (_options$debugProps = options.debugProps) !== null && _options$debugProps !== void 0 && _options$debugProps.isDebug ? (options === null || options === void 0 || (_options$debugProps2 = options.debugProps) === null || _options$debugProps2 === void 0 ? void 0 : _options$debugProps2.localLink) || '' : '';
|
44
45
|
this.containerElement = this.containerService.load({
|
45
46
|
type: DisplayTypeEnum.inline,
|
46
47
|
platform: isElementPad() ? PlatformEnum.desktop : isElementPC() ? PlatformEnum.desktop : PlatformEnum.mobile,
|
@@ -51,7 +52,7 @@ export var ContainerController = /*#__PURE__*/function () {
|
|
51
52
|
display: 'block'
|
52
53
|
}
|
53
54
|
}, processor.generateIframeSrc({
|
54
|
-
link:
|
55
|
+
link: iframesSrcLink,
|
55
56
|
instanceId: this.instanceId
|
56
57
|
}));
|
57
58
|
this.eventService = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
|
@@ -46,8 +46,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
46
46
|
_defineProperty(this, "loading", void 0);
|
47
47
|
_defineProperty(this, "elementProcessors", void 0);
|
48
48
|
_defineProperty(this, "initTimeout", void 0);
|
49
|
-
_defineProperty(this, "processingSubmitPay", void 0);
|
50
|
-
// 支付中
|
51
49
|
_defineProperty(this, "elementContainerService", void 0);
|
52
50
|
// 新增变量
|
53
51
|
_defineProperty(this, "onStatusChangeCallback", void 0);
|
@@ -81,7 +79,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
81
79
|
});
|
82
80
|
this.options = options;
|
83
81
|
var _options = options;
|
84
|
-
this.processingSubmitPay = false;
|
85
82
|
this.onStatusChangeCallback = _options === null || _options === void 0 ? void 0 : _options.onStatusChangeCallback;
|
86
83
|
this.elementContainer = new AntomSDKCore();
|
87
84
|
this.elementContainer.registerProcessor(ProductSceneEnum.ELEMENT_PAYMENT, '', new ElementProcessor());
|
@@ -220,44 +217,34 @@ var ElementController = /*#__PURE__*/function () {
|
|
220
217
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
221
218
|
while (1) switch (_context.prev = _context.next) {
|
222
219
|
case 0:
|
223
|
-
if (!_this3.processingSubmitPay) {
|
224
|
-
_context.next = 4;
|
225
|
-
break;
|
226
|
-
}
|
227
|
-
return _context.abrupt("return", resolve({
|
228
|
-
isValid: false
|
229
|
-
}));
|
230
|
-
case 4:
|
231
220
|
if (!((_this3$elementProcess = _this3.elementProcessors) !== null && _this3$elementProcess !== void 0 && _this3$elementProcess[ElementType.payment])) {
|
232
|
-
_context.next =
|
221
|
+
_context.next = 13;
|
233
222
|
break;
|
234
223
|
}
|
235
|
-
_context.prev =
|
236
|
-
_context.next =
|
224
|
+
_context.prev = 1;
|
225
|
+
_context.next = 4;
|
237
226
|
return _this3.onValidateFunc((_this3$elementProcess2 = _this3.elementProcessors[ElementType.payment]) === null || _this3$elementProcess2 === void 0 ? void 0 : _this3$elementProcess2.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT);
|
238
|
-
case
|
227
|
+
case 4:
|
239
228
|
validateResult = _context.sent;
|
240
|
-
return _context.abrupt("return", resolve(
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
_context.prev = 12;
|
245
|
-
_context.t0 = _context["catch"](5);
|
229
|
+
return _context.abrupt("return", resolve(validateResult.data));
|
230
|
+
case 8:
|
231
|
+
_context.prev = 8;
|
232
|
+
_context.t0 = _context["catch"](1);
|
246
233
|
return _context.abrupt("return", resolve({
|
247
234
|
isValid: false
|
248
235
|
}));
|
249
|
-
case
|
250
|
-
_context.next =
|
236
|
+
case 11:
|
237
|
+
_context.next = 14;
|
251
238
|
break;
|
252
|
-
case
|
239
|
+
case 13:
|
253
240
|
return _context.abrupt("return", resolve({
|
254
241
|
isValid: false
|
255
242
|
}));
|
256
|
-
case
|
243
|
+
case 14:
|
257
244
|
case "end":
|
258
245
|
return _context.stop();
|
259
246
|
}
|
260
|
-
}, _callee, null, [[
|
247
|
+
}, _callee, null, [[1, 8]]);
|
261
248
|
}));
|
262
249
|
return function (_x) {
|
263
250
|
return _ref2.apply(this, arguments);
|
@@ -271,7 +258,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
271
258
|
this.changeLoading(true);
|
272
259
|
new Promise( /*#__PURE__*/function () {
|
273
260
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve) {
|
274
|
-
var params, _this4$elementProcess, _result$data, _result$data2, result, _this4$elementProcess2, _result$data3, _result$data4, _result, _this4$elementProcess3
|
261
|
+
var params, _this4$elementProcess, _result$data, _result$data2, result, _this4$elementProcess2, _result$data3, _result$data4, _result, _this4$elementProcess3;
|
275
262
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
276
263
|
while (1) switch (_context2.prev = _context2.next) {
|
277
264
|
case 0:
|
@@ -307,29 +294,25 @@ var ElementController = /*#__PURE__*/function () {
|
|
307
294
|
return _context2.abrupt("return", resolve(undefined));
|
308
295
|
case 15:
|
309
296
|
if (!_this4.elementProcessors[ElementType.payment]) {
|
310
|
-
_context2.next =
|
297
|
+
_context2.next = 25;
|
311
298
|
break;
|
312
299
|
}
|
313
300
|
_context2.prev = 16;
|
314
|
-
|
315
|
-
_context2.next = 20;
|
301
|
+
_context2.next = 19;
|
316
302
|
return _this4.onValidateAndSubmitPay((_this4$elementProcess3 = _this4.elementProcessors[ElementType.payment]) === null || _this4$elementProcess3 === void 0 ? void 0 : _this4$elementProcess3.eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
317
|
-
case
|
318
|
-
paymentSubmitResult = _context2.sent;
|
319
|
-
_this4.processingSubmitPay = paymentSubmitResult === null || paymentSubmitResult === void 0 || (_paymentSubmitResult$ = paymentSubmitResult.data) === null || _paymentSubmitResult$ === void 0 ? void 0 : _paymentSubmitResult$.success;
|
303
|
+
case 19:
|
320
304
|
return _context2.abrupt("return", resolve(undefined));
|
321
|
-
case
|
322
|
-
_context2.prev =
|
305
|
+
case 22:
|
306
|
+
_context2.prev = 22;
|
323
307
|
_context2.t0 = _context2["catch"](16);
|
324
|
-
_this4.processingSubmitPay = false;
|
325
308
|
return _context2.abrupt("return", resolve(undefined));
|
326
|
-
case
|
309
|
+
case 25:
|
327
310
|
resolve(params);
|
328
|
-
case
|
311
|
+
case 26:
|
329
312
|
case "end":
|
330
313
|
return _context2.stop();
|
331
314
|
}
|
332
|
-
}, _callee2, null, [[16,
|
315
|
+
}, _callee2, null, [[16, 22]]);
|
333
316
|
}));
|
334
317
|
return function (_x2) {
|
335
318
|
return _ref3.apply(this, arguments);
|
@@ -367,9 +350,6 @@ var ElementController = /*#__PURE__*/function () {
|
|
367
350
|
var _this5$onEventCallbac;
|
368
351
|
(_this5$onEventCallbac = _this5.onEventCallback) === null || _this5$onEventCallbac === void 0 || _this5$onEventCallbac.call(_this5, data);
|
369
352
|
});
|
370
|
-
this.serviceMap.EventCenter.listen(ElementPaymentEvent.ON_PAY_STATUS_CHANGE, function (data) {
|
371
|
-
_this5.processingSubmitPay = data.isProcessingPay;
|
372
|
-
});
|
373
353
|
this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
374
354
|
clearTimeout(_this5.initTimeout);
|
375
355
|
_this5.initTimeout = null;
|
@@ -242,18 +242,19 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
242
242
|
value: function () {
|
243
243
|
var _obtainData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
244
244
|
var _paymentSessionObj$co;
|
245
|
-
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo,
|
245
|
+
var requestService, _this$elementContaine8, paymentSession, paymentSessionObj, displayInfo, _displayInfo, debugProps, _this$options2, environment, locale, _ref4, paymentSessionConfig, hostSign, isConnect, LOCAL_MOCK, _queryParse, appType, terminalType, generateActionQueryPromise, generateOneAccountQueryPromise, _yield$Promise$all, _yield$Promise$all2, originActionQueryResult, originOneAccountQueryResult;
|
246
246
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
247
247
|
while (1) switch (_context2.prev = _context2.next) {
|
248
248
|
case 0:
|
249
249
|
requestService = ServiceProvider.getInstance(this.instanceId).getService('Requester');
|
250
250
|
_this$elementContaine8 = this.elementContainer.getPaymentContext(), paymentSession = _this$elementContaine8.paymentSession, paymentSessionObj = _this$elementContaine8.paymentSessionObj, displayInfo = _this$elementContaine8.displayInfo;
|
251
|
-
|
251
|
+
_displayInfo = displayInfo;
|
252
|
+
debugProps = _displayInfo.debugProps;
|
252
253
|
_this$options2 = this.options, environment = _this$options2.env.environment, locale = _this$options2.locale;
|
253
254
|
_ref4 = paymentSessionObj || {}, paymentSessionConfig = _ref4.paymentSessionConfig;
|
254
255
|
hostSign = paymentSession.split('&&')[1] || '';
|
255
256
|
isConnect = paymentSessionObj === null || paymentSessionObj === void 0 || (_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect;
|
256
|
-
LOCAL_MOCK =
|
257
|
+
LOCAL_MOCK = (debugProps === null || debugProps === void 0 ? void 0 : debugProps.isDebug) && (debugProps === null || debugProps === void 0 ? void 0 : debugProps.local_mock);
|
257
258
|
_queryParse = queryParse(this.getElementUrl()), appType = _queryParse.appType;
|
258
259
|
terminalType = isElementPad() ? 'WEB' : appType ? 'APP' : isElementPC() ? 'WEB' : 'WAP';
|
259
260
|
generateActionQueryPromise = function generateActionQueryPromise() {
|
@@ -322,9 +323,9 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
322
323
|
});
|
323
324
|
});
|
324
325
|
};
|
325
|
-
_context2.next =
|
326
|
+
_context2.next = 15;
|
326
327
|
return Promise.all(isConnect ? [generateActionQueryPromise(), generateOneAccountQueryPromise()] : [generateActionQueryPromise()]);
|
327
|
-
case
|
328
|
+
case 15:
|
328
329
|
_yield$Promise$all = _context2.sent;
|
329
330
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
330
331
|
originActionQueryResult = _yield$Promise$all2[0];
|
@@ -337,7 +338,7 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
337
338
|
originActionQueryResult: originActionQueryResult,
|
338
339
|
originOneAccountQueryResult: originOneAccountQueryResult
|
339
340
|
});
|
340
|
-
case
|
341
|
+
case 21:
|
341
342
|
case "end":
|
342
343
|
return _context2.stop();
|
343
344
|
}
|
@@ -23,8 +23,7 @@ export declare enum ElementPaymentEvent {
|
|
23
23
|
SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
|
24
24
|
LOG = "log",
|
25
25
|
HANDLE_PAYMENT = "handlePayment",
|
26
|
-
ON_EVENT_CALLBACK = "onEventCallback"
|
27
|
-
ON_PAY_STATUS_CHANGE = "onPayStatusChange"
|
26
|
+
ON_EVENT_CALLBACK = "onEventCallback"
|
28
27
|
}
|
29
28
|
export declare enum ElementPaymentMethod {
|
30
29
|
CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
|
@@ -21,7 +21,6 @@ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
|
21
21
|
ElementPaymentEvent["LOG"] = "log";
|
22
22
|
ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
|
23
23
|
ElementPaymentEvent["ON_EVENT_CALLBACK"] = "onEventCallback";
|
24
|
-
ElementPaymentEvent["ON_PAY_STATUS_CHANGE"] = "onPayStatusChange";
|
25
24
|
return ElementPaymentEvent;
|
26
25
|
}({});
|
27
26
|
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|