@alipay/ams-checkout 0.0.1730878287-dev.1 → 0.0.1730878287-dev.10

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.
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
5
5
  /**
6
6
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
7
  */
8
- export declare const AMSCheckoutAppVersion = "1.23.0";
9
- export declare const AMSAutoDebitAppVersion = "1.23.0";
10
- export declare const AMSEasyPayAppVersion = "1.23.0";
11
- export declare const AMSCashierPaymentAppVersion = "1.23.0";
12
- export declare const AMSVaultingAppVersion = "1.23.0";
13
- export declare const AMSPaymentElementAppVersion = "1.23.2";
14
- export declare const ADDRESSElementAppVersion = "1.23.2";
8
+ export declare const AMSCheckoutAppVersion = "1.23.2-domain";
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
+ export declare const AMSPaymentElementAppVersion = "1.23.2-domain";
14
+ export declare const ADDRESSElementAppVersion = "1.23.2-domain";
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
37
  */
38
- export var AMSCheckoutAppVersion = '1.23.0'; // 兜底版本号
39
- export var AMSAutoDebitAppVersion = '1.23.0'; // 代扣
40
- export var AMSEasyPayAppVersion = '1.23.0'; // easypay
41
- export var AMSCashierPaymentAppVersion = '1.23.0'; // 收银台(卡、apm)
42
- export var AMSVaultingAppVersion = '1.23.0'; // 绑卡
43
- export var AMSPaymentElementAppVersion = '1.23.2'; // payment element
44
- export var ADDRESSElementAppVersion = '1.23.2'; // address element
38
+ export var AMSCheckoutAppVersion = '1.23.2-domain'; // 兜底版本号
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
+ export var AMSPaymentElementAppVersion = '1.23.2-domain'; // payment element
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 containerSelector = "antom-sdk-web-app-".concat(selector);
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
- // import { oneAccount, sdkAction } from './mock';
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 () {
@@ -292,7 +293,11 @@ export var ElementComponent = /*#__PURE__*/function () {
292
293
  // TODO dev环境submit提交接口超时
293
294
  'Operation-Type': 'com.ipay.iexpcashier.cashier.submitPayByPaymentSession'
294
295
  }).then(function (result) {
295
- console.log('element submit result ------', result);
296
+ var _result$codeFormViews, _result$actionForm;
297
+ if (result !== null && result !== void 0 && result.codeFormViews && result !== null && result !== void 0 && (_result$codeFormViews = result.codeFormViews) !== null && _result$codeFormViews !== void 0 && (_result$codeFormViews = _result$codeFormViews[0]) !== null && _result$codeFormViews !== void 0 && _result$codeFormViews.codeExpireTime && result !== null && result !== void 0 && result.actionForm && !(result !== null && result !== void 0 && (_result$actionForm = result.actionForm) !== null && _result$actionForm !== void 0 && _result$actionForm.paymentCodeExpireTime)) {
298
+ var _result$codeFormViews2;
299
+ result.actionForm.paymentCodeExpireTime = result === null || result === void 0 || (_result$codeFormViews2 = result.codeFormViews) === null || _result$codeFormViews2 === void 0 || (_result$codeFormViews2 = _result$codeFormViews2[0]) === null || _result$codeFormViews2 === void 0 ? void 0 : _result$codeFormViews2.codeExpireTime;
300
+ }
296
301
  if (result.errorCode === ConnectErrorCode.RISK_REJECT) {
297
302
  _this4.onSubmitRiskFunc(ElementPaymentMethod.ADDRESS_ELEMENT);
298
303
  _this4.onSubmitRiskFunc(ElementPaymentMethod.AUTH_ELEMENT);
@@ -304,18 +309,27 @@ export var ElementComponent = /*#__PURE__*/function () {
304
309
  success: result.success,
305
310
  msg: result.errorMessage
306
311
  });
312
+ }, function () {
313
+ resolve({
314
+ success: false,
315
+ msg: 'submitPayByPaymentSession api error'
316
+ });
317
+ // this?._options?.onEventCallback?.({
318
+ // code: EventCallbackCode.Failed,
319
+ // message: 'submitPayByPaymentSession api error',
320
+ // });
307
321
  });
308
322
  });
309
323
  });
310
324
  // 发送validate消息
311
- _defineProperty(this, "onValidateFunc", function (target) {
325
+ _defineProperty(this, "onValidateFunc", function (target, params) {
312
326
  return new Promise(function (resolve) {
313
327
  _this4.eventService.emitAndListen({
314
328
  event: ElementPaymentEvent.VALIDATE,
315
329
  data: {
316
330
  target: target,
317
331
  source: ElementPaymentMethod.CONTAINER_ELEMENT,
318
- params: {}
332
+ params: params
319
333
  }
320
334
  }, function (result) {
321
335
  resolve(result);
@@ -363,38 +377,49 @@ export var ElementComponent = /*#__PURE__*/function () {
363
377
  }
364
378
  return _context.abrupt("return", resolve(undefined));
365
379
  case 17:
366
- if (!_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT)) {
367
- _context.next = 26;
380
+ if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
381
+ _context.next = 32;
368
382
  break;
369
383
  }
370
- _context.next = 20;
371
- return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT);
372
- case 20:
384
+ _context.prev = 18;
385
+ _context.next = 21;
386
+ return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT, params);
387
+ case 21:
373
388
  _result2 = _context.sent;
374
- console.log('element submit validate payment---------', _result2);
389
+ console.log('element submit validate payment---------', _result2, _this4.isConnect);
375
390
  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
391
  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
392
  if (_result2 !== null && _result2 !== void 0 && (_result2$data3 = _result2.data) !== null && _result2$data3 !== void 0 && _result2$data3.success) {
378
- _context.next = 26;
393
+ _context.next = 27;
379
394
  break;
380
395
  }
381
396
  return _context.abrupt("return", resolve(undefined));
382
- case 26:
397
+ case 27:
398
+ _context.next = 32;
399
+ break;
400
+ case 29:
401
+ _context.prev = 29;
402
+ _context.t0 = _context["catch"](18);
403
+ return _context.abrupt("return", resolve(undefined));
404
+ case 32:
383
405
  // params.paymentFactors = paymentResult.data?.data.paymentFactors;
384
406
  // params.paymentMethod = paymentResult.data?.data.paymentMethod;
385
407
  resolve(params);
386
- case 27:
408
+ case 33:
387
409
  case "end":
388
410
  return _context.stop();
389
411
  }
390
- }, _callee);
412
+ }, _callee, null, [[18, 29]]);
391
413
  }));
392
414
  return function (_x) {
393
415
  return _ref.apply(this, arguments);
394
416
  };
395
417
  }());
396
418
  });
397
- this._options = options;
419
+ var env = options.environment || ELEMENT_ENVIRONMENT.PROD;
420
+ this._options = _objectSpread(_objectSpread({}, options), {}, {
421
+ environment: env.toLocaleLowerCase()
422
+ });
398
423
  this.eventCallback = _defineProperty(_defineProperty(_defineProperty({}, ElementPaymentMethod.ADDRESS_ELEMENT, {}), ElementPaymentMethod.AUTH_ELEMENT, {}), ElementPaymentMethod.PAYMENT_ELEMENT, {});
399
424
  this.launchSource = [];
400
425
  this.componentsCount = 0;
@@ -489,12 +514,19 @@ export var ElementComponent = /*#__PURE__*/function () {
489
514
  value: function createIframeSrc() {
490
515
  var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ELEMENT_ENVIRONMENT.DEV;
491
516
  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://cdn-pre.marmot-cloud.com/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PROD, 'https://checkout.antom.com');
517
+ 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://checkout.antom.com');
493
518
  var _env = (env === null || env === void 0 ? void 0 : env.toLocaleUpperCase()) || ELEMENT_ENVIRONMENT.DEV;
519
+ var payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/element_payment/index.html");
520
+ try {
521
+ var expressCheckout = JSON.parse(JSON.parse(this.parseData.extendInfo).expressCheckout);
522
+ if (expressCheckout) {
523
+ payment = "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/express_checkout/index.html");
524
+ }
525
+ } catch (error) {}
494
526
  return {
495
527
  auth: "".concat(baseUrl[_env], "/auth-element/").concat(version, "/pages/element_auth/index.html"),
496
528
  address: "".concat(baseUrl[_env], "/element-address/").concat(version, "/pages/address/index.html"),
497
- payment: "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/element_payment/index.html")
529
+ payment: payment
498
530
  };
499
531
  }
500
532
 
@@ -537,6 +569,12 @@ export var ElementComponent = /*#__PURE__*/function () {
537
569
  (_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
570
  }
539
571
  });
572
+ this.eventService.listen(ConstantEvent.close.name, function () {
573
+ _this6.unmount();
574
+ });
575
+ this.eventService.listen(ConstantEvent.redirect.name, function (data, res) {
576
+ data.isDestroy && _this6.unmount();
577
+ });
540
578
  this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
541
579
  console.log('antom sdk 组件日志回调');
542
580
  });
@@ -742,6 +780,8 @@ export var ElementComponent = /*#__PURE__*/function () {
742
780
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
743
781
  while (1) switch (_context2.prev = _context2.next) {
744
782
  case 0:
783
+ // this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
784
+ // return
745
785
  if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
746
786
  (_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
787
  }
@@ -1,3 +1,4 @@
1
1
  export declare const sdkAction: any;
2
2
  export declare const oneAccount: any;
3
3
  export declare const paymentResult: any;
4
+ export declare const submitResult: any;