@alipay/ams-checkout 0.0.1730878287-dev.6 → 0.0.1730878287-dev.7
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/config/index.d.ts +4 -4
- package/esm/config/index.js +4 -4
- package/esm/core/component/element/components/auth.js +2 -1
- package/esm/core/component/element/index.js +52 -16
- package/esm/core/component/element/mock.d.ts +1 -0
- package/esm/core/component/element/mock.js +331 -996
- package/esm/core/component/element/type.d.ts +1 -0
- package/esm/core/component/element/type.js +1 -0
- package/esm/plugin/component/index.d.ts +1 -0
- package/esm/plugin/component/index.js +42 -10
- package/package.json +1 -1
- package/esm/core/component/element/element-mock.d.ts +0 -2
- package/esm/core/component/element/element-mock.js +0 -263
package/esm/config/index.d.ts
CHANGED
@@ -6,9 +6,9 @@ export declare const sdkVersion: string;
|
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
*/
|
8
8
|
export declare const AMSCheckoutAppVersion = "1.23.2-domain";
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.24.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.24.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.24.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.24.0";
|
13
13
|
export declare const AMSPaymentElementAppVersion = "1.23.2-domain";
|
14
14
|
export declare const ADDRESSElementAppVersion = "1.23.2-domain";
|
package/esm/config/index.js
CHANGED
@@ -36,9 +36,9 @@ export var sdkVersion = json.version;
|
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
*/
|
38
38
|
export var AMSCheckoutAppVersion = '1.23.2-domain'; // 兜底版本号
|
39
|
-
export var AMSAutoDebitAppVersion = '1.
|
40
|
-
export var AMSEasyPayAppVersion = '1.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.
|
42
|
-
export var AMSVaultingAppVersion = '1.
|
39
|
+
export var AMSAutoDebitAppVersion = '1.24.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.24.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.24.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.24.0'; // 绑卡
|
43
43
|
export var AMSPaymentElementAppVersion = '1.23.2-domain'; // payment element
|
44
44
|
export var ADDRESSElementAppVersion = '1.23.2-domain'; // address element
|
@@ -23,7 +23,8 @@ export var ElementAuthComponent = /*#__PURE__*/function () {
|
|
23
23
|
try {
|
24
24
|
var selector = options.selector,
|
25
25
|
url = options.url;
|
26
|
-
var
|
26
|
+
var containerId = (selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1);
|
27
|
+
var containerSelector = "antom-sdk-web-app-".concat(containerId);
|
27
28
|
var container = createInlineBaseElement(selector);
|
28
29
|
var webApp = createIframe(containerSelector);
|
29
30
|
webApp.src = url;
|
@@ -22,7 +22,8 @@ import { parseSessionData } from "../index";
|
|
22
22
|
import { ElementAddressComponent } from "./components/address";
|
23
23
|
import { ElementAuthComponent } from "./components/auth";
|
24
24
|
import { ElementPaymentComponent } from "./components/payment";
|
25
|
-
|
25
|
+
import { EVENT as ConstantEvent } from "../../../constant";
|
26
|
+
// import { oneAccount, sdkAction, submitResult } from './mock';
|
26
27
|
|
27
28
|
import { addressTheme, ELEMENT_ENVIRONMENT, ThemeType } from "./type";
|
28
29
|
var ElementProcessor = /*#__PURE__*/function () {
|
@@ -304,18 +305,27 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
304
305
|
success: result.success,
|
305
306
|
msg: result.errorMessage
|
306
307
|
});
|
308
|
+
}, function () {
|
309
|
+
resolve({
|
310
|
+
success: false,
|
311
|
+
msg: 'submitPayByPaymentSession api error'
|
312
|
+
});
|
313
|
+
// this?._options?.onEventCallback?.({
|
314
|
+
// code: EventCallbackCode.Failed,
|
315
|
+
// message: 'submitPayByPaymentSession api error',
|
316
|
+
// });
|
307
317
|
});
|
308
318
|
});
|
309
319
|
});
|
310
320
|
// 发送validate消息
|
311
|
-
_defineProperty(this, "onValidateFunc", function (target) {
|
321
|
+
_defineProperty(this, "onValidateFunc", function (target, params) {
|
312
322
|
return new Promise(function (resolve) {
|
313
323
|
_this4.eventService.emitAndListen({
|
314
324
|
event: ElementPaymentEvent.VALIDATE,
|
315
325
|
data: {
|
316
326
|
target: target,
|
317
327
|
source: ElementPaymentMethod.CONTAINER_ELEMENT,
|
318
|
-
params:
|
328
|
+
params: params
|
319
329
|
}
|
320
330
|
}, function (result) {
|
321
331
|
resolve(result);
|
@@ -363,38 +373,49 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
363
373
|
}
|
364
374
|
return _context.abrupt("return", resolve(undefined));
|
365
375
|
case 17:
|
366
|
-
if (!_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT)) {
|
367
|
-
_context.next =
|
376
|
+
if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
|
377
|
+
_context.next = 32;
|
368
378
|
break;
|
369
379
|
}
|
370
|
-
_context.
|
371
|
-
|
372
|
-
|
380
|
+
_context.prev = 18;
|
381
|
+
_context.next = 21;
|
382
|
+
return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
383
|
+
case 21:
|
373
384
|
_result2 = _context.sent;
|
374
|
-
console.log('element submit validate payment---------', _result2);
|
385
|
+
console.log('element submit validate payment---------', _result2, _this4.isConnect);
|
375
386
|
params.paymentFactors = (_result2$data = _result2.data) === null || _result2$data === void 0 || (_result2$data = _result2$data.data) === null || _result2$data === void 0 ? void 0 : _result2$data.paymentFactors;
|
376
387
|
params.paymentMethod = (_result2$data2 = _result2.data) === null || _result2$data2 === void 0 || (_result2$data2 = _result2$data2.data) === null || _result2$data2 === void 0 ? void 0 : _result2$data2.paymentMethod;
|
377
388
|
if (_result2 !== null && _result2 !== void 0 && (_result2$data3 = _result2.data) !== null && _result2$data3 !== void 0 && _result2$data3.success) {
|
378
|
-
_context.next =
|
389
|
+
_context.next = 27;
|
379
390
|
break;
|
380
391
|
}
|
381
392
|
return _context.abrupt("return", resolve(undefined));
|
382
|
-
case
|
393
|
+
case 27:
|
394
|
+
_context.next = 32;
|
395
|
+
break;
|
396
|
+
case 29:
|
397
|
+
_context.prev = 29;
|
398
|
+
_context.t0 = _context["catch"](18);
|
399
|
+
return _context.abrupt("return", resolve(undefined));
|
400
|
+
case 32:
|
383
401
|
// params.paymentFactors = paymentResult.data?.data.paymentFactors;
|
384
402
|
// params.paymentMethod = paymentResult.data?.data.paymentMethod;
|
385
403
|
resolve(params);
|
386
|
-
case
|
404
|
+
case 33:
|
387
405
|
case "end":
|
388
406
|
return _context.stop();
|
389
407
|
}
|
390
|
-
}, _callee);
|
408
|
+
}, _callee, null, [[18, 29]]);
|
391
409
|
}));
|
392
410
|
return function (_x) {
|
393
411
|
return _ref.apply(this, arguments);
|
394
412
|
};
|
395
413
|
}());
|
396
414
|
});
|
397
|
-
|
415
|
+
var env = options.environment || ELEMENT_ENVIRONMENT.PROD;
|
416
|
+
this._options = _objectSpread(_objectSpread({}, options), {}, {
|
417
|
+
environment: env.toLocaleLowerCase()
|
418
|
+
});
|
398
419
|
this.eventCallback = _defineProperty(_defineProperty(_defineProperty({}, ElementPaymentMethod.ADDRESS_ELEMENT, {}), ElementPaymentMethod.AUTH_ELEMENT, {}), ElementPaymentMethod.PAYMENT_ELEMENT, {});
|
399
420
|
this.launchSource = [];
|
400
421
|
this.componentsCount = 0;
|
@@ -489,12 +510,19 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
489
510
|
value: function createIframeSrc() {
|
490
511
|
var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ELEMENT_ENVIRONMENT.DEV;
|
491
512
|
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.24.0';
|
492
|
-
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, 'http://dev.page.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.TEST, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PRE, 'https://
|
513
|
+
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, 'http://dev.page.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.TEST, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.SIT, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PRE, 'https://pre.ac.alipay.com/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PROD, 'https://ac.alipay.com/page/antom-web-checkout-v2');
|
493
514
|
var _env = (env === null || env === void 0 ? void 0 : env.toLocaleUpperCase()) || ELEMENT_ENVIRONMENT.DEV;
|
515
|
+
var payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/element_payment/index.html");
|
516
|
+
try {
|
517
|
+
var expressCheckout = JSON.parse(JSON.parse(this.parseData.extendInfo).expressCheckout);
|
518
|
+
if (expressCheckout) {
|
519
|
+
payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/express_checkout/index.html");
|
520
|
+
}
|
521
|
+
} catch (error) {}
|
494
522
|
return {
|
495
523
|
auth: "".concat(baseUrl[_env], "/auth-element/").concat(version, "/pages/element_auth/index.html"),
|
496
524
|
address: "".concat(baseUrl[_env], "/element-address/").concat(version, "/pages/address/index.html"),
|
497
|
-
payment:
|
525
|
+
payment: payment
|
498
526
|
};
|
499
527
|
}
|
500
528
|
|
@@ -537,6 +565,12 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
537
565
|
(_this6$eventCallback$ = (_this6$eventCallback$2 = _this6.eventCallback[result.source])[result.event]) === null || _this6$eventCallback$ === void 0 || _this6$eventCallback$.call(_this6$eventCallback$2, result.data);
|
538
566
|
}
|
539
567
|
});
|
568
|
+
this.eventService.listen(ConstantEvent.close.name, function () {
|
569
|
+
_this6.unmount();
|
570
|
+
});
|
571
|
+
this.eventService.listen(ConstantEvent.redirect.name, function (data, res) {
|
572
|
+
data.isDestroy && _this6.unmount();
|
573
|
+
});
|
540
574
|
this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
|
541
575
|
console.log('antom sdk 组件日志回调');
|
542
576
|
});
|
@@ -742,6 +776,8 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
742
776
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
743
777
|
while (1) switch (_context2.prev = _context2.next) {
|
744
778
|
case 0:
|
779
|
+
// this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
|
780
|
+
// return
|
745
781
|
if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
|
746
782
|
(_this$_options$loadin8 = this._options.loading) === null || _this$_options$loadin8 === void 0 || (_this$_options$loadin9 = _this$_options$loadin8.onStartLoading) === null || _this$_options$loadin9 === void 0 || _this$_options$loadin9.call(_this$_options$loadin8);
|
747
783
|
}
|