@alipay/ams-checkout 1.33.0 → 1.35.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 (63) 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 +4 -1
  4. package/esm/config/index.d.ts +7 -7
  5. package/esm/config/index.js +7 -7
  6. package/esm/constant/index.d.ts +9 -0
  7. package/esm/constant/index.js +9 -0
  8. package/esm/core/component/element/elementContainerService/containerService.d.ts +33 -0
  9. package/esm/core/component/element/elementContainerService/containerService.js +123 -0
  10. package/esm/core/component/element/elementContainerService/index.d.ts +20 -0
  11. package/esm/core/component/element/elementContainerService/index.js +63 -0
  12. package/esm/core/component/element/elementController/index.d.ts +27 -0
  13. package/esm/core/component/element/elementController/index.js +484 -0
  14. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +20 -0
  15. package/esm/core/component/element/elementProcessor/addressProcessor.js +160 -0
  16. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +20 -0
  17. package/esm/core/component/element/elementProcessor/authProcessor.js +125 -0
  18. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +41 -0
  19. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +96 -0
  20. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +20 -0
  21. package/esm/core/component/element/elementProcessor/paymentProcessor.js +380 -0
  22. package/esm/core/component/element/index.d.ts +8 -46
  23. package/esm/core/component/element/index.js +33 -922
  24. package/esm/core/component/element/mock.d.ts +4 -0
  25. package/esm/core/component/element/mock.js +365 -1
  26. package/esm/core/component/element/type.d.ts +42 -1
  27. package/esm/core/component/element/util.d.ts +66 -0
  28. package/esm/core/component/element/util.js +478 -0
  29. package/esm/core/component/index.d.ts +5 -1
  30. package/esm/core/component/index.js +1 -2
  31. package/esm/core/component/oldElement/index.d.ts +59 -0
  32. package/esm/core/component/oldElement/index.js +956 -0
  33. package/esm/core/component/oldElement/mock.d.ts +6 -0
  34. package/esm/core/component/oldElement/mock.js +567 -0
  35. package/esm/core/component/oldElement/type.d.ts +351 -0
  36. package/esm/core/component/oldElement/type.js +81 -0
  37. package/esm/core/instance/index.d.ts +1 -1
  38. package/esm/foundation/core/index.d.ts +6 -1
  39. package/esm/foundation/core/index.js +70 -35
  40. package/esm/foundation/index.d.ts +14 -0
  41. package/esm/foundation/index.js +13 -2
  42. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  43. package/esm/foundation/product-processor/element/index.js +24 -0
  44. package/esm/foundation/service/container/index.d.ts +6 -3
  45. package/esm/foundation/service/container/index.js +45 -15
  46. package/esm/foundation/service/container/popup.d.ts +1 -1
  47. package/esm/foundation/service/event-center.js +1 -0
  48. package/esm/foundation/service/log/keys.js +3 -1
  49. package/esm/index.js +1 -0
  50. package/esm/plugin/component/cashierApp.d.ts +1 -1
  51. package/esm/plugin/component/index.js +1 -1
  52. package/esm/plugin/type.d.ts +1 -1
  53. package/esm/types/index.d.ts +1 -1
  54. package/esm/types/index.js +1 -1
  55. package/package.json +1 -1
  56. /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
  57. /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
  58. /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
  59. /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
  60. /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
  61. /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
  62. /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
  63. /package/esm/core/component/{element → oldElement}/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,6 +104,9 @@ 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
+ }
107
110
  var modal = modalDevice === 'desktop' ? document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal")) : document.querySelector(".".concat(AMSPOPUP_PREFIX, "modal-mobile"));
108
111
  overlay.classList.remove("".concat(AMSPOPUP_PREFIX, "fadeIn"));
109
112
  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.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";
8
+ export declare const AMSCheckoutAppVersion = "1.35.0";
9
+ export declare const AMSAutoDebitAppVersion = "1.35.0";
10
+ export declare const AMSEasyPayAppVersion = "1.35.0";
11
+ export declare const AMSCashierPaymentAppVersion = "1.35.0";
12
+ export declare const AMSVaultingAppVersion = "1.35.0";
13
+ export declare const AMSPaymentElementAppVersion = "1.35.0";
14
+ export declare const ADDRESSElementAppVersion = "1.35.0";
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
35
35
  /**
36
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
37
37
  */
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
38
+ export var AMSCheckoutAppVersion = '1.35.0'; // 兜底版本号
39
+ export var AMSAutoDebitAppVersion = '1.35.0'; // 代扣
40
+ export var AMSEasyPayAppVersion = '1.35.0'; // easypay
41
+ export var AMSCashierPaymentAppVersion = '1.35.0'; // 收银台(卡、apm)
42
+ export var AMSVaultingAppVersion = '1.35.0'; // 绑卡
43
+ export var AMSPaymentElementAppVersion = '1.35.0'; // payment element
44
+ export var ADDRESSElementAppVersion = '1.35.0'; // address element
@@ -210,6 +210,15 @@ 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
+ };
213
222
  };
214
223
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
215
224
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -212,6 +212,15 @@ 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'
215
224
  }
216
225
  };
217
226
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -0,0 +1,33 @@
1
+ import BaseElementProcessor from '../elementProcessor/baseElementProcessor';
2
+ import { ContainerService } from './../../../../foundation/service/container';
3
+ import { EventCenter } from './../../../../foundation/service/event-center';
4
+ export declare enum IContainerStatus {
5
+ UNINIT = "UNINIT",
6
+ INITING = "INITING",
7
+ READY = "READY",
8
+ IN_BIZ_FLOW = "IN_BIZ_FLOW",
9
+ DESTROYED = "DESTROYED"
10
+ }
11
+ export declare class ContainerController {
12
+ private containerStatus;
13
+ private instanceId;
14
+ private containerService;
15
+ private eventService;
16
+ private containerElement;
17
+ private _globalData?;
18
+ constructor({ type, instanceId, selector, processor, options, }: {
19
+ type: string;
20
+ instanceId: string;
21
+ selector: string;
22
+ processor: BaseElementProcessor;
23
+ options: any;
24
+ });
25
+ private addEventListener;
26
+ getContainerElement(): HTMLDivElement;
27
+ createWebLaunchPromise(): Promise<unknown>;
28
+ switchContainerStatus(status: IContainerStatus): void;
29
+ getContainerStatus(): IContainerStatus;
30
+ getEventService(): EventCenter;
31
+ destroy(): void;
32
+ getContainerService(): ContainerService;
33
+ }
@@ -0,0 +1,123 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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
+ import { EVENT } from "../../../../constant";
9
+ import { ServiceProvider } from "./../../../../foundation/service";
10
+ import { isElementPC, isElementPad } from "../util";
11
+ import { DisplayTypeEnum, PlatformEnum, ProductSceneEnum } from "./../../../../types";
12
+ export var IContainerStatus = /*#__PURE__*/function (IContainerStatus) {
13
+ IContainerStatus["UNINIT"] = "UNINIT";
14
+ IContainerStatus["INITING"] = "INITING";
15
+ IContainerStatus["READY"] = "READY";
16
+ IContainerStatus["IN_BIZ_FLOW"] = "IN_BIZ_FLOW";
17
+ IContainerStatus["DESTROYED"] = "DESTROYED";
18
+ return IContainerStatus;
19
+ }({});
20
+ export var ContainerController = /*#__PURE__*/function () {
21
+ function ContainerController(_ref) {
22
+ var _options$debugProps;
23
+ var type = _ref.type,
24
+ instanceId = _ref.instanceId,
25
+ selector = _ref.selector,
26
+ processor = _ref.processor,
27
+ options = _ref.options;
28
+ _classCallCheck(this, ContainerController);
29
+ _defineProperty(this, "containerStatus", void 0);
30
+ _defineProperty(this, "instanceId", void 0);
31
+ _defineProperty(this, "containerService", void 0);
32
+ _defineProperty(this, "eventService", void 0);
33
+ _defineProperty(this, "containerElement", void 0);
34
+ _defineProperty(this, "_globalData", void 0);
35
+ this._globalData = new Map();
36
+ this.switchContainerStatus(IContainerStatus.INITING);
37
+ this.instanceId = "".concat(instanceId, "-").concat(type);
38
+ this.containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
39
+ ServiceProvider.getInstance(this.instanceId).init({}, {
40
+ productScene: ProductSceneEnum.ELEMENT_PAYMENT,
41
+ sdkVersion: '',
42
+ webAppVersion: ''
43
+ });
44
+ this.containerElement = this.containerService.load({
45
+ type: DisplayTypeEnum.inline,
46
+ platform: isElementPad() ? PlatformEnum.desktop : isElementPC() ? PlatformEnum.desktop : PlatformEnum.mobile,
47
+ isRetention: false,
48
+ selector: selector,
49
+ appendAliasContainerId: true,
50
+ iframeStyle: {
51
+ display: 'block'
52
+ }
53
+ }, processor.generateIframeSrc({
54
+ link: options === null || options === void 0 || (_options$debugProps = options.debugProps) === null || _options$debugProps === void 0 ? void 0 : _options$debugProps.localLink,
55
+ instanceId: this.instanceId
56
+ }));
57
+ this.eventService = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
58
+ this.addEventListener();
59
+ }
60
+ _createClass(ContainerController, [{
61
+ key: "addEventListener",
62
+ value: function addEventListener() {
63
+ var _this = this;
64
+ this.eventService.listen(EVENT.setGlobalData.name, function (result) {
65
+ _this._globalData.set(result === null || result === void 0 ? void 0 : result.dataKey, result === null || result === void 0 ? void 0 : result.data);
66
+ });
67
+ this.eventService.listen(EVENT.getGlobalData.name, function (data, result) {
68
+ var context = result.context;
69
+ if (context !== null && context !== void 0 && context.eventCallbackId) {
70
+ var _context$data;
71
+ var targetData = _this._globalData.get((_context$data = context.data) === null || _context$data === void 0 ? void 0 : _context$data.dataKey);
72
+ _this.eventService.dispatchToApp({
73
+ event: 'appEventCallback',
74
+ eventCallbackId: context === null || context === void 0 ? void 0 : context.eventCallbackId,
75
+ data: targetData
76
+ });
77
+ }
78
+ });
79
+ }
80
+ }, {
81
+ key: "getContainerElement",
82
+ value: function getContainerElement() {
83
+ return this.containerElement;
84
+ }
85
+ }, {
86
+ key: "createWebLaunchPromise",
87
+ value: function createWebLaunchPromise() {
88
+ var _this2 = this;
89
+ return new Promise(function (resolve) {
90
+ _this2.eventService.listen('onLaunch', function (res) {
91
+ resolve(res);
92
+ });
93
+ });
94
+ }
95
+ }, {
96
+ key: "switchContainerStatus",
97
+ value: function switchContainerStatus(status) {
98
+ this.containerStatus = status;
99
+ }
100
+ }, {
101
+ key: "getContainerStatus",
102
+ value: function getContainerStatus() {
103
+ return this.containerStatus;
104
+ }
105
+ }, {
106
+ key: "getEventService",
107
+ value: function getEventService() {
108
+ return this.eventService;
109
+ }
110
+ }, {
111
+ key: "destroy",
112
+ value: function destroy() {
113
+ this.eventService.destroy();
114
+ this.containerElement.remove();
115
+ }
116
+ }, {
117
+ key: "getContainerService",
118
+ value: function getContainerService() {
119
+ return this.containerService;
120
+ }
121
+ }]);
122
+ return ContainerController;
123
+ }();
@@ -0,0 +1,20 @@
1
+ import { ElementType } from '../type';
2
+ import { ContainerController } from './containerService';
3
+ export declare class ElementContainerService {
4
+ private containerServices;
5
+ private instanceId;
6
+ constructor({ instanceId }: {
7
+ instanceId: any;
8
+ });
9
+ addContainerService(name: ElementType, service: ContainerController): void;
10
+ getContainerService(name: ElementType): ContainerController | undefined;
11
+ getContainerServices(): Map<ElementType, ContainerController>;
12
+ destroy(): void;
13
+ mount({ type, selector, processor, options }: {
14
+ type: any;
15
+ selector: any;
16
+ processor: any;
17
+ options: any;
18
+ }): void;
19
+ getEventService(name: ElementType): import("../../../../foundation/service/event-center").EventCenter;
20
+ }
@@ -0,0 +1,63 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ 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
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ 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
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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
+ import { ContainerController } from "./containerService";
9
+ export var ElementContainerService = /*#__PURE__*/function () {
10
+ function ElementContainerService(_ref) {
11
+ var instanceId = _ref.instanceId;
12
+ _classCallCheck(this, ElementContainerService);
13
+ _defineProperty(this, "containerServices", void 0);
14
+ _defineProperty(this, "instanceId", void 0);
15
+ this.containerServices = new Map();
16
+ this.instanceId = instanceId;
17
+ }
18
+ _createClass(ElementContainerService, [{
19
+ key: "addContainerService",
20
+ value: function addContainerService(name, service) {
21
+ this.containerServices.set(name, service);
22
+ }
23
+ }, {
24
+ key: "getContainerService",
25
+ value: function getContainerService(name) {
26
+ return this.containerServices.get(name);
27
+ }
28
+ }, {
29
+ key: "getContainerServices",
30
+ value: function getContainerServices() {
31
+ return this.containerServices;
32
+ }
33
+ }, {
34
+ key: "destroy",
35
+ value: function destroy() {
36
+ this.containerServices.forEach(function (value) {
37
+ value.destroy();
38
+ });
39
+ this.containerServices = new Map();
40
+ }
41
+ }, {
42
+ key: "mount",
43
+ value: function mount(_ref2) {
44
+ var type = _ref2.type,
45
+ selector = _ref2.selector,
46
+ processor = _ref2.processor,
47
+ options = _ref2.options;
48
+ this.addContainerService(type, new ContainerController({
49
+ type: type,
50
+ instanceId: this.instanceId,
51
+ selector: selector,
52
+ processor: processor,
53
+ options: options
54
+ }));
55
+ }
56
+ }, {
57
+ key: "getEventService",
58
+ value: function getEventService(name) {
59
+ return this.getContainerService(name).getEventService();
60
+ }
61
+ }]);
62
+ return ElementContainerService;
63
+ }();
@@ -0,0 +1,27 @@
1
+ import { AddressMountOptions, IElementOptions, LinkAuthMountOptions, PaymentMountOptions } from '../type';
2
+ declare class ElementController {
3
+ private options;
4
+ private elementContainer;
5
+ private serviceMap;
6
+ private loading;
7
+ private elementProcessors;
8
+ private initTimeout;
9
+ private elementContainerService;
10
+ private onStatusChangeCallback;
11
+ constructor(options: IElementOptions);
12
+ private initService;
13
+ private initElementProcessors;
14
+ private onEventCallback;
15
+ mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string, cashier?: boolean): any;
16
+ private onValidateFunc;
17
+ submitPayment(): void;
18
+ private changeLoading;
19
+ private addEventListener;
20
+ private sendRequestAndWaitWebLaunch;
21
+ private sendReady;
22
+ updatePayment(paymentSessionData: any): Promise<unknown>;
23
+ private destroyHandle;
24
+ destroy(): void;
25
+ private setControllerStatusOrView;
26
+ }
27
+ export default ElementController;