@alipay/ams-checkout 0.0.1744283958-dev.6 → 0.0.1745390310-dev.0

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.
Files changed (64) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/component.inline.style.js +1 -1
  3. package/esm/component/popupWindow.style.js +1 -4
  4. package/esm/config/index.d.ts +7 -7
  5. package/esm/config/index.js +7 -7
  6. package/esm/constant/index.d.ts +0 -9
  7. package/esm/constant/index.js +0 -9
  8. package/esm/core/component/ckp/index.d.ts +26 -6
  9. package/esm/core/component/ckp/index.js +357 -25
  10. package/esm/core/component/ckp/interface.d.ts +540 -0
  11. package/esm/core/component/ckp/interface.js +233 -0
  12. package/esm/core/component/element/index.d.ts +46 -8
  13. package/esm/core/component/element/index.js +922 -28
  14. package/esm/core/component/element/mock.d.ts +0 -2
  15. package/esm/core/component/element/mock.js +0 -360
  16. package/esm/core/component/element/type.d.ts +1 -42
  17. package/esm/core/component/index.d.ts +1 -5
  18. package/esm/core/component/index.js +2 -1
  19. package/esm/foundation/core/index.d.ts +1 -6
  20. package/esm/foundation/core/index.js +34 -68
  21. package/esm/foundation/index.d.ts +0 -8
  22. package/esm/foundation/index.js +2 -11
  23. package/esm/foundation/service/container/index.d.ts +3 -6
  24. package/esm/foundation/service/container/index.js +14 -41
  25. package/esm/foundation/service/container/popup.d.ts +1 -1
  26. package/esm/foundation/service/event-center.js +0 -1
  27. package/esm/index.js +0 -1
  28. package/esm/plugin/component/cashierApp.d.ts +1 -1
  29. package/esm/plugin/component/index.js +1 -1
  30. package/esm/types/index.d.ts +1 -1
  31. package/esm/types/index.js +1 -1
  32. package/package.json +1 -1
  33. package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -33
  34. package/esm/core/component/element/elementContainerService/containerService.js +0 -122
  35. package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
  36. package/esm/core/component/element/elementContainerService/index.js +0 -63
  37. package/esm/core/component/element/elementController/index.d.ts +0 -25
  38. package/esm/core/component/element/elementController/index.js +0 -448
  39. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
  40. package/esm/core/component/element/elementProcessor/addressProcessor.js +0 -145
  41. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
  42. package/esm/core/component/element/elementProcessor/authProcessor.js +0 -125
  43. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -38
  44. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +0 -85
  45. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -20
  46. package/esm/core/component/element/elementProcessor/paymentProcessor.js +0 -356
  47. package/esm/core/component/element/util.d.ts +0 -60
  48. package/esm/core/component/element/util.js +0 -451
  49. package/esm/core/component/oldElement/index.d.ts +0 -59
  50. package/esm/core/component/oldElement/index.js +0 -956
  51. package/esm/core/component/oldElement/mock.d.ts +0 -6
  52. package/esm/core/component/oldElement/mock.js +0 -567
  53. package/esm/core/component/oldElement/type.d.ts +0 -351
  54. package/esm/core/component/oldElement/type.js +0 -81
  55. package/esm/foundation/product-processor/element/index.d.ts +0 -7
  56. package/esm/foundation/product-processor/element/index.js +0 -24
  57. /package/esm/core/component/{oldElement → element}/components/address.d.ts +0 -0
  58. /package/esm/core/component/{oldElement → element}/components/address.js +0 -0
  59. /package/esm/core/component/{oldElement → element}/components/auth.d.ts +0 -0
  60. /package/esm/core/component/{oldElement → element}/components/auth.js +0 -0
  61. /package/esm/core/component/{oldElement → element}/components/payment.d.ts +0 -0
  62. /package/esm/core/component/{oldElement → element}/components/payment.js +0 -0
  63. /package/esm/core/component/{oldElement → element}/utils.d.ts +0 -0
  64. /package/esm/core/component/{oldElement → element}/utils.js +0 -0
@@ -115,7 +115,7 @@ export var createInlineBaseElement = function createInlineBaseElement(selector)
115
115
  var amsComponentContainer = document.createElement('div');
116
116
  amsComponentContainer.className = "".concat(containerId, "-inline");
117
117
  amsComponentContainer.id = containerId;
118
- var selectorDom = document.querySelector("".concat(selector));
118
+ var selectorDom = document.querySelector("#".concat(selector));
119
119
  if (selectorDom) selectorDom.appendChild(amsComponentContainer);
120
120
  return amsComponentContainer;
121
121
  };
@@ -2,7 +2,7 @@ import { AMSPOPUP_PREFIX, ANIMATION_TIME, MOCKUP_ID, POPUPLOADING_ID } from "../
2
2
  import { getDesignFontSize } from "../util";
3
3
 
4
4
  // CSS样式字符串
5
- var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-popup-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-popup-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n");
5
+ var modalStyles = "\n .".concat(AMSPOPUP_PREFIX, "modal {\n /* \u6DFB\u52A0\u5F39\u7A97\u6837\u5F0F */\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n .").concat(AMSPOPUP_PREFIX, "modal-mobile{\n background-color: #fff;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n position: fixed;\n bottom: 0;\n left: 0%;\n z-index: 9999; /* \u8BBE\u7F6E\u5F39\u7A97\u7684\u5C42\u7EA7\u4E3A 9999 */\n overflow: hidden;\n }\n\n .").concat(AMSPOPUP_PREFIX, "overlay {\n /* \u6DFB\u52A0\u8499\u5C42\u6837\u5F0F */\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: 999;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeIn {\n /* \u6DFB\u52A0\u6DE1\u5165\u52A8\u753B */\n animation: fadeIn ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "fadeOut {\n /* \u6DFB\u52A0\u6DE1\u51FA\u52A8\u753B */\n animation: fadeOut ").concat(ANIMATION_TIME, "ms;\n animation-fill-mode: forwards;\n }\n\n .").concat(AMSPOPUP_PREFIX, "-drawer-enter {\n animation: slideIn ").concat(ANIMATION_TIME, "ms forwards;\n }\n \n @keyframes slideIn {\n from {\n transform: translateY(100%); /* \u6ED1\u5165\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 0 */\n }\n to {\n transform: translateY(0); /* \u6ED1\u5165\u7ED3\u675F\u65F6\u5728\u539F\u4F4D\u7F6E */\n opacity: 1; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 1 */\n }\n }\n\n /* \u62BD\u5C49\u4ECE\u5E95\u90E8\u6ED1\u51FA */\n .").concat(AMSPOPUP_PREFIX, "-drawer-exit {\n animation: slideOut ").concat(ANIMATION_TIME, "ms forwards;\n }\n\n @keyframes slideOut {\n from {\n transform: translateY(0); /* \u6ED1\u51FA\u65F6\u4ECE\u5F53\u524D\u4F4D\u7F6E\u5F00\u59CB */\n opacity: 1; /* \u521D\u59CB\u900F\u660E\u5EA6\u4E3A 1 */\n }\n to {\n transform: translateY(100%); /* \u6ED1\u51FA\u7ED3\u675F\u65F6\u5728\u89C6\u53E3\u5E95\u90E8\u5916 */\n opacity: 0; /* \u7ED3\u675F\u65F6\u900F\u660E\u5EA6\u4E3A 0 */\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u5165\u52A8\u753B */\n @keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-webkit-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n @-moz-keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n }\n\n /* \u5B9A\u4E49\u6DE1\u51FA\u52A8\u753B */\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @-moz-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n\n.ams-component-popup-loading {\n width: 0.8em;\n height:0.8em;\n border-radius: 8px;\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1001;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n}\n\n.ams-component-popup-loading .line {\n width: 40px;\n height: 40px;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.ams-component-popup-loading .line div {\n position: absolute;\n left: 17.67px;\n top: 0;\n width: 5.33px;\n height: 40px;\n}\n\n.ams-component-popup-loading .line div:before,\n.ams-component-popup-loading .line div:after {\n content: '';\n display: block;\n height: 13.33px;\n background: black;\n border-radius: 5.3px;\n}\n.ams-component-popup-loading .line div:after {\n margin-top: 13.33px;\n}\n\n.ams-component-popup-loading .line div:nth-child(2) {\n -webkit-transform: rotate(45deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(3) {\n -webkit-transform: rotate(90deg);\n}\n\n.ams-component-popup-loading .line div:nth-child(4) {\n -webkit-transform: rotate(135deg);\n}\n\n/** \u52A0\u8F7D\u52A8\u753B **/\n@-webkit-keyframes load {\n 0% {\n opacity: 0;\n }\n\n 100% {\n opacity: 1;\n }\n}\n\n.ams-component-popup-loading .line div:nth-child(1):before {\n -webkit-animation: load 1s linear 0s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):before {\n -webkit-animation: load 1s linear 0.125s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):before {\n -webkit-animation: load 1s linear 0.25s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):before {\n -webkit-animation: load 1s linear 0.375s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(1):after {\n -webkit-animation: load 1s linear 0.5s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(2):after {\n -webkit-animation: load 1s linear 0.675s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(3):after {\n -webkit-animation: load 1s linear 0.75s infinite;\n}\n\n.ams-component-popup-loading .line div:nth-child(4):after {\n -webkit-animation: load 1s linear 0.875s infinite;\n}\n\n.ams-component-popup-loading-logo {\n width: 0.44em;\n height: 0.44em;\n -webkit-transform:rotate(360deg);\n transform:rotate(360deg);\n -webkit-transition:-webkit-transform 1s linear;\n transition:transform 1s linear;\n animation: ams-component-loading-logo 1s linear infinite;\n}\n");
6
6
  var getCurrentTheme = function getCurrentTheme() {
7
7
  var curTheme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
8
8
  var theme = {
@@ -104,9 +104,6 @@ export var createModal = function createModal(_ref) {
104
104
  // 销毁弹窗
105
105
  export var destroyModal = function destroyModal() {
106
106
  var overlay = document.querySelector(".".concat(AMSPOPUP_PREFIX, "overlay"));
107
- if (!overlay) {
108
- return;
109
- }
110
107
  var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile"));
111
108
  overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
112
109
  overlay.classList.add("".concat(AMSPOPUP_PREFIX, "fadeOut"));
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
5
5
  /**
6
6
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
7
  */
8
- export declare const AMSCheckoutAppVersion = "1.34.0";
9
- export declare const AMSAutoDebitAppVersion = "1.34.0";
10
- export declare const AMSEasyPayAppVersion = "1.34.0";
11
- export declare const AMSCashierPaymentAppVersion = "1.34.0";
12
- export declare const AMSVaultingAppVersion = "1.34.0";
13
- export declare const AMSPaymentElementAppVersion = "1.34.0";
14
- export declare const ADDRESSElementAppVersion = "1.34.0";
8
+ export declare const AMSCheckoutAppVersion = "1.33.0";
9
+ export declare const AMSAutoDebitAppVersion = "1.33.0";
10
+ export declare const AMSEasyPayAppVersion = "1.33.0";
11
+ export declare const AMSCashierPaymentAppVersion = "1.33.0";
12
+ export declare const AMSVaultingAppVersion = "1.33.0";
13
+ export declare const AMSPaymentElementAppVersion = "1.33.0";
14
+ export declare const ADDRESSElementAppVersion = "1.33.0";
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
37
  */
38
- export var AMSCheckoutAppVersion = '1.34.0'; // 兜底版本号
39
- export var AMSAutoDebitAppVersion = '1.34.0'; // 代扣
40
- export var AMSEasyPayAppVersion = '1.34.0'; // easypay
41
- export var AMSCashierPaymentAppVersion = '1.34.0'; // 收银台(卡、apm)
42
- export var AMSVaultingAppVersion = '1.34.0'; // 绑卡
43
- export var AMSPaymentElementAppVersion = '1.34.0'; // payment element
44
- export var ADDRESSElementAppVersion = '1.34.0'; // address element
38
+ export var AMSCheckoutAppVersion = '1.33.0'; // 兜底版本号
39
+ export var AMSAutoDebitAppVersion = '1.33.0'; // 代扣
40
+ export var AMSEasyPayAppVersion = '1.33.0'; // easypay
41
+ export var AMSCashierPaymentAppVersion = '1.33.0'; // 收银台(卡、apm)
42
+ export var AMSVaultingAppVersion = '1.33.0'; // 绑卡
43
+ export var AMSPaymentElementAppVersion = '1.33.0'; // payment element
44
+ export var ADDRESSElementAppVersion = '1.33.0'; // address element
@@ -210,15 +210,6 @@ export declare const EVENT: {
210
210
  getApplePayToken: {
211
211
  name: string;
212
212
  };
213
- updated: {
214
- name: string;
215
- };
216
- webAppReady: {
217
- name: string;
218
- };
219
- showToast: {
220
- name: string;
221
- };
222
213
  };
223
214
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
224
215
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -212,15 +212,6 @@ export var EVENT = {
212
212
  },
213
213
  getApplePayToken: {
214
214
  name: 'getApplePayToken'
215
- },
216
- updated: {
217
- name: 'updated'
218
- },
219
- webAppReady: {
220
- name: 'webAppReady'
221
- },
222
- showToast: {
223
- name: 'showToast'
224
215
  }
225
216
  };
226
217
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -1,16 +1,24 @@
1
- import { IcreateComponent, IoptionsParams } from '../../../types';
2
- import { Logger } from '../../../util/logger';
1
+ import { IcreateComponent, IoptionsParams, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../../types';
2
+ import CoreInstance from '../../instance/index';
3
3
  type LOCAL_URL = string;
4
4
  export type CKPEmbeddedAppEnv = 'dev' | 'sit' | 'pre' | 'prod';
5
5
  export type CKPEmbeddedEventType = 'SDK_PAYMENT_SUCCESSFUL' | 'SDK_PAYMENT_FAIL' | 'SDK_PAYMENT_CANCEL' | 'SDK_PAYMENT_CLICK_BACK_TO_MERCHANT';
6
6
  export declare const getCKPPageAddress: (env: IoptionsParams['environment'] | LOCAL_URL) => string;
7
- export declare class AMSCheckoutPage {
8
- logger: Logger;
9
- private _instanceId;
10
- private originOptions;
7
+ export declare class AMSCheckoutPage extends CoreInstance {
11
8
  private readonly APP_IFRAME_ID;
12
9
  private eventListener?;
13
10
  constructor(options: Pick<IoptionsParams, 'environment' | 'locale' | 'onEventCallback'>);
11
+ /**
12
+ * 初始化 Bus总线的能力
13
+ */
14
+ /**
15
+ * To determine whether the corresponding payment method is available,
16
+ * only the channel described in the document will be called, and it will be returned as available by default
17
+ * @param paymentMethod - described in the document
18
+ * @param subPaymentMethod - described in the document
19
+ * @returns
20
+ */
21
+ canMakePayments(paymentMethod: PaymentMethodTypeEnum, subPaymentMethod?: SubPaymentMethodTypeEnum): Promise<boolean>;
14
22
  private generateIframeSrc;
15
23
  private eventListenerWrapper;
16
24
  private addListener;
@@ -23,5 +31,17 @@ export declare class AMSCheckoutPage {
23
31
  * 卸载组件
24
32
  */
25
33
  unmount(): void;
34
+ /**
35
+ * @description Execute payment submission process
36
+ * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
37
+ * @param data - Transfer information in the submission interface according to your requirements (optional)
38
+ */
39
+ applePaySubmit({ paymentRequest, paymentSessionData, paymentMethod, version, request }: {
40
+ paymentRequest: any;
41
+ paymentSessionData: any;
42
+ paymentMethod: any;
43
+ version: any;
44
+ request: any;
45
+ }, paymentEndFn: any, doSubmit: any): void;
26
46
  }
27
47
  export {};
@@ -1,14 +1,30 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
5
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
6
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
2
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
8
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
9
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
5
17
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
19
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
20
  import { v4 as uuid } from 'uuid';
21
+ import ApplePayService from "../../../plugin/applepay/service";
22
+ import { getApplePayPaymentSession } from "../../../service";
9
23
  import { EnvironmentEnum } from "../../../types";
10
24
  import { queryParse } from "../../../util";
11
25
  import { LogConfig, Logger } from "../../../util/logger";
26
+ import { BusManager, BusMessage } from "../../bus";
27
+ import CoreInstance from "../../instance/index";
12
28
  var CKP_PAYMENT_PAGE_HOST = {
13
29
  DEV: 'https://dev.page.alipay.net',
14
30
  TEST: 'https://test.page.alipay.net',
@@ -37,16 +53,19 @@ export var getCKPPageAddress = function getCKPPageAddress(env) {
37
53
  return env;
38
54
  }
39
55
  };
40
- export var AMSCheckoutPage = /*#__PURE__*/function () {
56
+ export var AMSCheckoutPage = /*#__PURE__*/function (_CoreInstance) {
57
+ _inherits(AMSCheckoutPage, _CoreInstance);
58
+ var _super = _createSuper(AMSCheckoutPage);
41
59
  function AMSCheckoutPage(options) {
42
- var _this = this;
60
+ var _this;
43
61
  _classCallCheck(this, AMSCheckoutPage);
44
- _defineProperty(this, "logger", void 0);
45
- _defineProperty(this, "_instanceId", void 0);
46
- _defineProperty(this, "originOptions", void 0);
47
- _defineProperty(this, "APP_IFRAME_ID", 'antom-checkout-page-sub-page-iframe');
48
- _defineProperty(this, "eventListener", void 0);
49
- _defineProperty(this, "generateIframeSrc", function (sessionData) {
62
+ _this = _super.call(this, options);
63
+ // logger: Logger;
64
+ // private _instanceId: string;
65
+ // private originOptions: IoptionsParams;
66
+ _defineProperty(_assertThisInitialized(_this), "APP_IFRAME_ID", 'antom-checkout-page-sub-page-iframe');
67
+ _defineProperty(_assertThisInitialized(_this), "eventListener", void 0);
68
+ _defineProperty(_assertThisInitialized(_this), "generateIframeSrc", function (sessionData) {
50
69
  var env = _this.originOptions.environment || 'prod';
51
70
  var session = sessionData || '';
52
71
  var lang = _this.originOptions.locale || 'en_US';
@@ -67,45 +86,149 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
67
86
  });
68
87
  return url;
69
88
  });
70
- _defineProperty(this, "eventListenerWrapper", function (event) {
89
+ _defineProperty(_assertThisInitialized(_this), "eventListenerWrapper", function (event) {
71
90
  var _ref = JSON.parse(event.data) || {},
72
91
  code = _ref.code,
73
92
  message = _ref.message,
74
93
  result = _ref.result;
75
94
  if (code && code.startsWith('SDK_PAYMENT')) {
76
- var _this$eventListener;
95
+ var _this$eventListener, _this2;
77
96
  console.log('[antom-web-sdk] <antom-checkout-page> eventListenerWrapper', event, message, result);
78
- (_this$eventListener = _this.eventListener) === null || _this$eventListener === void 0 || _this$eventListener.call(_this, {
97
+ (_this$eventListener = (_this2 = _this).eventListener) === null || _this$eventListener === void 0 || _this$eventListener.call(_this2, {
79
98
  code: code,
80
99
  message: message,
81
100
  result: result
82
101
  });
83
102
  }
84
103
  });
85
- _defineProperty(this, "addListener", function () {
104
+ _defineProperty(_assertThisInitialized(_this), "addListener", function () {
86
105
  window.addEventListener('message', _this.eventListenerWrapper);
87
106
  });
88
- _defineProperty(this, "removeListener", function () {
107
+ _defineProperty(_assertThisInitialized(_this), "removeListener", function () {
89
108
  window.removeEventListener('message', _this.eventListenerWrapper);
90
109
  });
91
110
  options.environment = options.environment || EnvironmentEnum.prod;
92
- this._instanceId = uuid();
93
- this.originOptions = options;
94
- this.eventListener = options.onEventCallback;
95
- this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
96
- Logger.setInstance(this.logger);
97
- this.logger.setMedta({
98
- instanceId: this._instanceId
111
+ _this._instanceId = uuid();
112
+ _this.originOptions = options;
113
+ _this.eventListener = options.onEventCallback;
114
+ // this.registerBusAbility();
115
+
116
+ _this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
117
+ Logger.setInstance(_this.logger);
118
+ _this.logger.setMedta({
119
+ instanceId: _this._instanceId
99
120
  });
100
- this.logger.initTracker();
101
- this.logger.setComponentStartTime(Date.now());
102
- this.logger.setTrackId(this._instanceId);
103
- this.logger.logInfo({
121
+ _this.logger.initTracker();
122
+ _this.logger.setComponentStartTime(Date.now());
123
+ _this.logger.setTrackId(_this._instanceId);
124
+ _this.logger.logInfo({
104
125
  title: 'NEW_AMSSDK_BY_MECHANT',
105
126
  msg: "".concat(options === null || options === void 0 ? void 0 : options.environment, "_").concat(options === null || options === void 0 ? void 0 : options.locale)
106
127
  }).send();
128
+ return _this;
107
129
  }
130
+ /**
131
+ * 初始化 Bus总线的能力
132
+ */
133
+ // private registerBusAbility() {
134
+ // BusManager.debugTrace(this.originOptions?.environment !== EnvironmentEnum.prod, this.logger);
135
+ // BusManager.clear();
136
+ // BusManager.addInterceptor({
137
+ // onPublishException: (message: BusMessage, e) => {
138
+ // this.logger.logError(
139
+ // { title: 'onBusPublishException' },
140
+ // {
141
+ // ...message,
142
+ // errorMessage: JSON.stringify(e),
143
+ // },
144
+ // );
145
+ // },
146
+ // });
147
+ // // subscribe basic ablility
148
+ // // BusManager.subscribe(
149
+ // // new SDKCallbackBusSubscriber((state: { code: string; message?: string; result?: EventCallbackResult }) => {
150
+ // this._componentApp?.AMSSDK?._eventCenter.emit(EVENT.eventCallback.name, state);
151
+ // // }),
152
+ // // );
153
+ // // BusManager.subscribe(
154
+ // // new SecurityBusSubscriber((deviceIdParameter: DeviceIdParameter, isPolling: boolean) => {
155
+ // // return this._componentApp?.getDeviceIdAndLog(deviceIdParameter, isPolling);
156
+ // // }),
157
+ // // );
158
+
159
+ // // BusManager.subscribe(new TrackerBusSubscriber(this.logger));
160
+ // // subscribe plugin
161
+ // BusManager.subscribe(new ApplePayBusSubscriber(this.logger));
162
+
163
+ // // register bus plugin
164
+ // ExtendPlugin.forEach((item) => {
165
+ // if (item?.busSubscriber) {
166
+ // BusManager.subscribe(item?.busSubscriber);
167
+ // }
168
+
169
+ // const paymentChannelMatcher = item.paymentChannelMatcher;
170
+ // if (paymentChannelMatcher) {
171
+ // this._registerPlugin(paymentChannelMatcher.paymentMethod, item.busActionNames);
172
+ // }
173
+ // const sessionMatcher = item.sessionMatcher;
174
+ // if (sessionMatcher) {
175
+ // const pluginKey =
176
+ // sessionMatcher.productScene + sessionMatcher.productSceneVersion + sessionMatcher.paymentMethodCategoryType;
177
+ // if (sessionMatcher.paymentMethodTypes) {
178
+ // sessionMatcher.paymentMethodTypes.forEach((paymentMethodType) => {
179
+ // const subPluginKey = pluginKey + paymentMethodType;
180
+ // this._registerPlugin(subPluginKey, item.busActionNames);
181
+ // });
182
+ // } else {
183
+ // this._registerPlugin(pluginKey, item.busActionNames);
184
+ // }
185
+ // }
186
+ // const optInit = item?.busActionNames?.optional_init;
187
+ // if (optInit) {
188
+ // BusManager.publish(new BusMessage(optInit, JSON.stringify(this.originOptions)));
189
+ // }
190
+ // });
191
+ // }
192
+ /**
193
+ * To determine whether the corresponding payment method is available,
194
+ * only the channel described in the document will be called, and it will be returned as available by default
195
+ * @param paymentMethod - described in the document
196
+ * @param subPaymentMethod - described in the document
197
+ * @returns
198
+ */
108
199
  _createClass(AMSCheckoutPage, [{
200
+ key: "canMakePayments",
201
+ value: function canMakePayments(paymentMethod, subPaymentMethod) {
202
+ var _this3 = this;
203
+ // 判断支付方式是否可用
204
+ return new Promise(function (resolve) {
205
+ var _this3$_getPlugin;
206
+ if (!paymentMethod) {
207
+ return resolve(true);
208
+ }
209
+ var actionName = (_this3$_getPlugin = _this3._getPlugin(paymentMethod)) === null || _this3$_getPlugin === void 0 ? void 0 : _this3$_getPlugin.canMakePayments;
210
+ if (actionName && BusManager.isSubscribed(actionName)) {
211
+ BusManager.publishForResult(new BusMessage(actionName, JSON.stringify({
212
+ paymentMethod: paymentMethod,
213
+ subPaymentMethod: subPaymentMethod
214
+ })), {
215
+ fallback: false
216
+ }).then(function (message) {
217
+ resolve(message.getJSONObject());
218
+ }).catch(function (e) {
219
+ _this3.logger.logInfo({
220
+ title: 'canMakePayments_error'
221
+ }, {
222
+ errorMessage: JSON.stringify(e)
223
+ });
224
+ resolve(false);
225
+ });
226
+ } else {
227
+ resolve(true);
228
+ }
229
+ });
230
+ }
231
+ }, {
109
232
  key: "mountComponent",
110
233
  value:
111
234
  /**
@@ -167,6 +290,215 @@ export var AMSCheckoutPage = /*#__PURE__*/function () {
167
290
  }
168
291
  return;
169
292
  }
293
+ /**
294
+ * @description Execute payment submission process
295
+ * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
296
+ * @param data - Transfer information in the submission interface according to your requirements (optional)
297
+ */
298
+ }, {
299
+ key: "applePaySubmit",
300
+ value: function applePaySubmit(_ref2, paymentEndFn, doSubmit) {
301
+ var _this4 = this,
302
+ _request$total,
303
+ _request$total2;
304
+ var paymentRequest = _ref2.paymentRequest,
305
+ paymentSessionData = _ref2.paymentSessionData,
306
+ paymentMethod = _ref2.paymentMethod,
307
+ version = _ref2.version,
308
+ request = _ref2.request;
309
+ var appleService = new ApplePayService(this.logger);
310
+ if (!ApplePayService.canMakePayments(version)) {
311
+ this.logger.logError({
312
+ code: 'a3753.b103030.c386485.d507471'
313
+ }, {
314
+ paymentRequest: paymentRequest
315
+ });
316
+ paymentEndFn === null || paymentEndFn === void 0 || paymentEndFn({
317
+ status: false,
318
+ error: {
319
+ errorCode: 'APPLE_PAY_NOT_SUPPORTED'
320
+ }
321
+ });
322
+ return;
323
+ }
324
+ var getMerchantSession = /*#__PURE__*/function () {
325
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref3) {
326
+ var validationUrl, requestParams;
327
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
328
+ while (1) switch (_context.prev = _context.next) {
329
+ case 0:
330
+ validationUrl = _ref3.validationUrl;
331
+ // get validateUrl
332
+ requestParams = {
333
+ validateUrl: validationUrl,
334
+ paymentSessionData: paymentSessionData
335
+ };
336
+ return _context.abrupt("return", getApplePayPaymentSession(paymentSessionData, requestParams, {
337
+ env: 'prod',
338
+ envInfo: {
339
+ deviceId: ''
340
+ }
341
+ }, _this4.logger).then(function (res) {
342
+ if (res !== null && res !== void 0 && res.success && res.merchantSessionObject) {
343
+ return Promise.resolve(res.merchantSessionObject);
344
+ }
345
+ paymentEndFn === null || paymentEndFn === void 0 || paymentEndFn({
346
+ status: false,
347
+ error: {
348
+ errorCode: res === null || res === void 0 ? void 0 : res.errorCode,
349
+ errorMessage: res === null || res === void 0 ? void 0 : res.errorMessage
350
+ }
351
+ });
352
+ return Promise.reject({
353
+ errorCode: res.errorCode,
354
+ errorMessage: res.errorMessage
355
+ });
356
+ }).catch(function (error) {
357
+ _this4.logger.logError({
358
+ code: 'a3753.b103030.c386485.d507483'
359
+ }, error);
360
+ paymentEndFn === null || paymentEndFn === void 0 || paymentEndFn({
361
+ status: false,
362
+ error: {
363
+ errorCode: 'APPLE_PAY_PAYMENT_SESSION_REQUEST_FAILED'
364
+ }
365
+ });
366
+ return Promise.reject(error);
367
+ }));
368
+ case 3:
369
+ case "end":
370
+ return _context.stop();
371
+ }
372
+ }, _callee);
373
+ }));
374
+ return function getMerchantSession(_x) {
375
+ return _ref4.apply(this, arguments);
376
+ };
377
+ }();
378
+ var completePaymentAuthorized = /*#__PURE__*/function () {
379
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
380
+ var _ref6,
381
+ paymentToken,
382
+ billingContact,
383
+ shippingContact,
384
+ paramsPaymentFactors,
385
+ params,
386
+ submitResult,
387
+ _args2 = arguments;
388
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
389
+ while (1) switch (_context2.prev = _context2.next) {
390
+ case 0:
391
+ _ref6 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, paymentToken = _ref6.paymentToken, billingContact = _ref6.billingContact, shippingContact = _ref6.shippingContact;
392
+ // 外网沙箱环境
393
+ paramsPaymentFactors = {
394
+ instPaymentToken: paymentToken,
395
+ applePayBillingContact: billingContact,
396
+ applePayShippingContact: shippingContact
397
+ };
398
+ _context2.prev = 2;
399
+ params = _objectSpread(_objectSpread({}, paymentMethod), {}, {
400
+ paymentFactors: paramsPaymentFactors
401
+ });
402
+ _context2.t0 = doSubmit;
403
+ if (!_context2.t0) {
404
+ _context2.next = 9;
405
+ break;
406
+ }
407
+ _context2.next = 8;
408
+ return doSubmit(params);
409
+ case 8:
410
+ _context2.t0 = _context2.sent;
411
+ case 9:
412
+ submitResult = _context2.t0;
413
+ if (!(submitResult !== null && submitResult !== void 0 && submitResult.success || (submitResult === null || submitResult === void 0 ? void 0 : submitResult.errorStatus) === 'U')) {
414
+ _context2.next = 12;
415
+ break;
416
+ }
417
+ return _context2.abrupt("return", Promise.resolve(submitResult));
418
+ case 12:
419
+ return _context2.abrupt("return", Promise.reject({
420
+ errorCode: submitResult.errorCode,
421
+ errorMessage: submitResult.errorMessage
422
+ }));
423
+ case 15:
424
+ _context2.prev = 15;
425
+ _context2.t1 = _context2["catch"](2);
426
+ paymentEndFn === null || paymentEndFn === void 0 || paymentEndFn({
427
+ status: false,
428
+ error: _context2.t1
429
+ });
430
+ return _context2.abrupt("return", Promise.reject(_context2.t1));
431
+ case 19:
432
+ case "end":
433
+ return _context2.stop();
434
+ }
435
+ }, _callee2, null, [[2, 15]]);
436
+ }));
437
+ return function completePaymentAuthorized() {
438
+ return _ref5.apply(this, arguments);
439
+ };
440
+ }();
441
+ var completeApplePay = function completeApplePay(data) {
442
+ paymentEndFn === null || paymentEndFn === void 0 || paymentEndFn({
443
+ status: true,
444
+ result: data
445
+ });
446
+ };
447
+ appleService.setApplePayParams(getMerchantSession, completePaymentAuthorized, completeApplePay, paymentEndFn);
448
+ var param = {
449
+ paymentSessionFactor: {
450
+ extendInfo: {
451
+ merchantCapabilities: request === null || request === void 0 ? void 0 : request.merchantCapabilities,
452
+ supportedNetworks: request === null || request === void 0 ? void 0 : request.supportedNetworks,
453
+ requiredBillingContactFields: null,
454
+ requiredShippingContactFields: null
455
+ },
456
+ merchantInfo: {
457
+ partnerId: '1',
458
+ registeredCountry: request === null || request === void 0 ? void 0 : request.countryCode,
459
+ merchantName: request === null || request === void 0 || (_request$total = request.total) === null || _request$total === void 0 ? void 0 : _request$total.label
460
+ },
461
+ paymentAmount: {
462
+ currency: request === null || request === void 0 ? void 0 : request.currencyCode,
463
+ value: request === null || request === void 0 || (_request$total2 = request.total) === null || _request$total2 === void 0 ? void 0 : _request$total2.amount
464
+ }
465
+ }
466
+ };
467
+ appleService.startPay(param);
468
+ // return new Promise((resolve, reject) => {
469
+ // try {
470
+ // const eventCallbackId = uuid();
471
+
472
+ // this.logger.logInfo({
473
+ // title: 'sdk_event_apiSubmit',
474
+ // });
475
+ // const actionName = this.getBusActionNames()?.submit;
476
+ // if (actionName && BusManager.isSubscribed(actionName)) {
477
+ // // 执行出错了,在通用拦截器返回
478
+ // BusManager.publishForResult(
479
+ // new BusMessage(
480
+ // actionName,
481
+ // JSON.stringify({
482
+ // appendParams: this._appendParams,
483
+ // options: this.originOptions,
484
+ // data: data,
485
+ // }),
486
+ // ),
487
+ // ).then((busMessage) => {
488
+ // resolve(busMessage?.getJSONObject());
489
+ // });
490
+ // } else {
491
+ // // eslint-disable-next-line @typescript-eslint/no-explicit-any
492
+ // // this._eventCenter.once(eventCallbackId, (_data: any) => {
493
+ // // resolve(_data);
494
+ // // });
495
+ // // this._componentApp.dispatchToApp({ context: { event: 'submitPay', eventCallbackId, data } });
496
+ // }
497
+ // } catch (error) {
498
+ // reject(error);
499
+ // }
500
+ // });
501
+ }
170
502
  }]);
171
503
  return AMSCheckoutPage;
172
- }();
504
+ }(CoreInstance);