@alipay/ams-checkout 0.0.1730706734-dev.1 → 0.0.1730706734-dev.11

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.0";
14
- export declare const ADDRESSElementAppVersion = "1.23.0";
8
+ export declare const AMSCheckoutAppVersion = "1.24.0";
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.24.0";
14
+ export declare const ADDRESSElementAppVersion = "1.24.0";
@@ -26,19 +26,19 @@ export var elementAppMarmotMap = {
26
26
  dev: 'http://page.alipay.net/page/antom-web-checkout-v2',
27
27
  sit: 'http://page.test.alipay.net/page/antom-web-checkout-v2',
28
28
  pre: 'https://pre.ac.alipay.com/page/antom-web-checkout-v2',
29
- sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
30
- light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout-v2',
31
- prod: 'https://ac.alipay.com/page/antom-web-checkout-v2'
29
+ sandbox: 'https://checkout.antom.com',
30
+ light_sandbox: 'https://checkout.antom.com',
31
+ prod: 'https://checkout.antom.com'
32
32
  };
33
33
  export var sdkVersion = json.version;
34
34
 
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.0'; // payment element
44
- export var ADDRESSElementAppVersion = '1.23.0'; // address element
38
+ export var AMSCheckoutAppVersion = '1.24.0'; // 兜底版本号
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.24.0'; // payment element
44
+ export var ADDRESSElementAppVersion = '1.24.0'; // address element
@@ -13,12 +13,13 @@ var CKP_PAYMENT_PAGE_HOST = {
13
13
  DEV: 'https://dev.page.alipay.net',
14
14
  TEST: 'https://test.page.alipay.net',
15
15
  PRE: 'https://pre.ac.alipay.com',
16
- PROD: 'https://ac.alipay.com'
16
+ PROD: 'https://checkout.antom.com'
17
17
  };
18
18
 
19
19
  // for local development
20
20
 
21
21
  var CKP_PAGE_ADDRESS = '/page/antom-web-checkout-v2/checkout-page/pages/payment/index.html';
22
+ var CKP_PAGE_NEW_ADDRESS = '/checkout-page/pages/payment/index.html';
22
23
  export var getCKPPageAddress = function getCKPPageAddress(env) {
23
24
  switch (env) {
24
25
  case 'dev':
@@ -30,7 +31,7 @@ export var getCKPPageAddress = function getCKPPageAddress(env) {
30
31
  case 'prod':
31
32
  case 'sandbox':
32
33
  case 'light_sandbox':
33
- return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_ADDRESS);
34
+ return "".concat(CKP_PAYMENT_PAGE_HOST.PROD).concat(CKP_PAGE_NEW_ADDRESS);
34
35
  default:
35
36
  // for local development, e.g. http://localhost:5173/checkout-page/src/pages/payment/index.html
36
37
  return env;
@@ -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);
@@ -317,14 +322,14 @@ export var ElementComponent = /*#__PURE__*/function () {
317
322
  });
318
323
  });
319
324
  // 发送validate消息
320
- _defineProperty(this, "onValidateFunc", function (target) {
325
+ _defineProperty(this, "onValidateFunc", function (target, params) {
321
326
  return new Promise(function (resolve) {
322
327
  _this4.eventService.emitAndListen({
323
328
  event: ElementPaymentEvent.VALIDATE,
324
329
  data: {
325
330
  target: target,
326
331
  source: ElementPaymentMethod.CONTAINER_ELEMENT,
327
- params: {}
332
+ params: params
328
333
  }
329
334
  }, function (result) {
330
335
  resolve(result);
@@ -372,38 +377,46 @@ export var ElementComponent = /*#__PURE__*/function () {
372
377
  }
373
378
  return _context.abrupt("return", resolve(undefined));
374
379
  case 17:
375
- if (!_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT)) {
376
- _context.next = 26;
380
+ if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
381
+ _context.next = 32;
377
382
  break;
378
383
  }
379
- _context.next = 20;
380
- return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT);
381
- case 20:
384
+ _context.prev = 18;
385
+ _context.next = 21;
386
+ return _this4.onValidateFunc(ElementPaymentMethod.PAYMENT_ELEMENT, params);
387
+ case 21:
382
388
  _result2 = _context.sent;
383
- console.log('element submit validate payment---------', _result2);
389
+ console.log('element submit validate payment---------', _result2, _this4.isConnect);
384
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;
385
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;
386
392
  if (_result2 !== null && _result2 !== void 0 && (_result2$data3 = _result2.data) !== null && _result2$data3 !== void 0 && _result2$data3.success) {
387
- _context.next = 26;
393
+ _context.next = 27;
388
394
  break;
389
395
  }
390
396
  return _context.abrupt("return", resolve(undefined));
391
- 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:
392
405
  // params.paymentFactors = paymentResult.data?.data.paymentFactors;
393
406
  // params.paymentMethod = paymentResult.data?.data.paymentMethod;
394
407
  resolve(params);
395
- case 27:
408
+ case 33:
396
409
  case "end":
397
410
  return _context.stop();
398
411
  }
399
- }, _callee);
412
+ }, _callee, null, [[18, 29]]);
400
413
  }));
401
414
  return function (_x) {
402
415
  return _ref.apply(this, arguments);
403
416
  };
404
417
  }());
405
418
  });
406
- var env = options.environment || ELEMENT_ENVIRONMENT.DEV;
419
+ var env = options.environment || ELEMENT_ENVIRONMENT.PROD;
407
420
  this._options = _objectSpread(_objectSpread({}, options), {}, {
408
421
  environment: env.toLocaleLowerCase()
409
422
  });
@@ -500,13 +513,20 @@ export var ElementComponent = /*#__PURE__*/function () {
500
513
  key: "createIframeSrc",
501
514
  value: function createIframeSrc() {
502
515
  var env = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ELEMENT_ENVIRONMENT.DEV;
503
- var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.24.1';
504
- 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');
516
+ var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '1.24.0';
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://ac.alipay.com/page/antom-web-checkout-v2');
505
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) {}
506
526
  return {
507
527
  auth: "".concat(baseUrl[_env], "/auth-element/").concat(version, "/pages/element_auth/index.html"),
508
528
  address: "".concat(baseUrl[_env], "/element-address/").concat(version, "/pages/address/index.html"),
509
- payment: "".concat(baseUrl[_env], "/elements/").concat(version, "/pages/element_payment/index.html")
529
+ payment: payment
510
530
  };
511
531
  }
512
532
 
@@ -549,6 +569,12 @@ export var ElementComponent = /*#__PURE__*/function () {
549
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);
550
570
  }
551
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
+ });
552
578
  this.eventService.listen(ElementPaymentEvent.LOG, function (result) {
553
579
  console.log('antom sdk 组件日志回调');
554
580
  });
@@ -754,6 +780,8 @@ export var ElementComponent = /*#__PURE__*/function () {
754
780
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
755
781
  while (1) switch (_context2.prev = _context2.next) {
756
782
  case 0:
783
+ // this.onAfterSubmitFunc(ElementPaymentMethod.PAYMENT_ELEMENT, submitResult);
784
+ // return
757
785
  if ((_this$_options$loadin7 = this._options.loading) !== null && _this$_options$loadin7 !== void 0 && _this$_options$loadin7.onStartLoading) {
758
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);
759
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;