@alipay/ams-checkout 0.0.1742382470-dev.4 → 0.0.1743078169-dev.3

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 (56) 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/constant/index.d.ts +3 -0
  5. package/esm/constant/index.js +3 -0
  6. package/esm/core/component/element/elementContainerService/containerService.d.ts +29 -0
  7. package/esm/core/component/element/elementContainerService/containerService.js +101 -0
  8. package/esm/core/component/element/elementContainerService/index.d.ts +19 -0
  9. package/esm/core/component/element/elementContainerService/index.js +55 -0
  10. package/esm/core/component/element/elementController/index.d.ts +22 -0
  11. package/esm/core/component/element/elementController/index.js +364 -0
  12. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +17 -0
  13. package/esm/core/component/element/elementProcessor/addressProcessor.js +122 -0
  14. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +14 -0
  15. package/esm/core/component/element/elementProcessor/authProcessor.js +70 -0
  16. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +36 -0
  17. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +79 -0
  18. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +17 -0
  19. package/esm/core/component/element/elementProcessor/paymentProcessor.js +179 -0
  20. package/esm/core/component/element/index.d.ts +8 -46
  21. package/esm/core/component/element/index.js +28 -922
  22. package/esm/core/component/element/type.d.ts +29 -1
  23. package/esm/core/component/element/util.d.ts +58 -0
  24. package/esm/core/component/element/util.js +321 -0
  25. package/esm/core/component/index.d.ts +5 -1
  26. package/esm/core/component/index.js +1 -2
  27. package/esm/core/component/oldElement/index.d.ts +59 -0
  28. package/esm/core/component/oldElement/index.js +956 -0
  29. package/esm/core/component/oldElement/type.d.ts +351 -0
  30. package/esm/core/component/oldElement/type.js +81 -0
  31. package/esm/foundation/core/index.d.ts +6 -1
  32. package/esm/foundation/core/index.js +68 -34
  33. package/esm/foundation/index.d.ts +7 -0
  34. package/esm/foundation/index.js +10 -2
  35. package/esm/foundation/product-processor/element/index.d.ts +7 -0
  36. package/esm/foundation/product-processor/element/index.js +24 -0
  37. package/esm/foundation/service/container/index.d.ts +6 -3
  38. package/esm/foundation/service/container/index.js +19 -7
  39. package/esm/foundation/service/container/popup.d.ts +1 -1
  40. package/esm/foundation/service/event-center.js +1 -0
  41. package/esm/index.js +1 -0
  42. package/esm/plugin/component/cashierApp.d.ts +1 -1
  43. package/esm/plugin/component/index.js +1 -1
  44. package/esm/types/index.d.ts +1 -1
  45. package/esm/types/index.js +1 -1
  46. package/package.json +1 -1
  47. /package/esm/core/component/{element → oldElement}/components/address.d.ts +0 -0
  48. /package/esm/core/component/{element → oldElement}/components/address.js +0 -0
  49. /package/esm/core/component/{element → oldElement}/components/auth.d.ts +0 -0
  50. /package/esm/core/component/{element → oldElement}/components/auth.js +0 -0
  51. /package/esm/core/component/{element → oldElement}/components/payment.d.ts +0 -0
  52. /package/esm/core/component/{element → oldElement}/components/payment.js +0 -0
  53. /package/esm/core/component/{element → oldElement}/mock.d.ts +0 -0
  54. /package/esm/core/component/{element → oldElement}/mock.js +0 -0
  55. /package/esm/core/component/{element → oldElement}/utils.d.ts +0 -0
  56. /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"));
@@ -210,6 +210,9 @@ export declare const EVENT: {
210
210
  getApplePayToken: {
211
211
  name: string;
212
212
  };
213
+ updated: {
214
+ name: string;
215
+ };
213
216
  };
214
217
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
215
218
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -212,6 +212,9 @@ export var EVENT = {
212
212
  },
213
213
  getApplePayToken: {
214
214
  name: 'getApplePayToken'
215
+ },
216
+ updated: {
217
+ name: 'updated'
215
218
  }
216
219
  };
217
220
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -0,0 +1,29 @@
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 _globalData?;
17
+ constructor({ type, instanceId, selector, processor, options, }: {
18
+ type: string;
19
+ instanceId: string;
20
+ selector: string;
21
+ processor: BaseElementProcessor;
22
+ options: any;
23
+ });
24
+ private addEventListener;
25
+ createWebLaunchPromise(): Promise<unknown>;
26
+ switchContainerStatus(status: IContainerStatus): void;
27
+ getEventService(): EventCenter;
28
+ getContainerService(): ContainerService;
29
+ }
@@ -0,0 +1,101 @@
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 { DisplayTypeEnum, PlatformEnum, ProductSceneEnum } from "./../../../../types";
11
+ export var IContainerStatus = /*#__PURE__*/function (IContainerStatus) {
12
+ IContainerStatus["UNINIT"] = "UNINIT";
13
+ IContainerStatus["INITING"] = "INITING";
14
+ IContainerStatus["READY"] = "READY";
15
+ IContainerStatus["IN_BIZ_FLOW"] = "IN_BIZ_FLOW";
16
+ IContainerStatus["DESTROYED"] = "DESTROYED";
17
+ return IContainerStatus;
18
+ }({});
19
+ export var ContainerController = /*#__PURE__*/function () {
20
+ function ContainerController(_ref) {
21
+ var _options$debugProps;
22
+ var type = _ref.type,
23
+ instanceId = _ref.instanceId,
24
+ selector = _ref.selector,
25
+ processor = _ref.processor,
26
+ options = _ref.options;
27
+ _classCallCheck(this, ContainerController);
28
+ _defineProperty(this, "containerStatus", void 0);
29
+ _defineProperty(this, "instanceId", void 0);
30
+ _defineProperty(this, "containerService", void 0);
31
+ _defineProperty(this, "eventService", void 0);
32
+ _defineProperty(this, "_globalData", void 0);
33
+ this._globalData = new Map();
34
+ this.switchContainerStatus(IContainerStatus.INITING);
35
+ this.instanceId = "".concat(instanceId, "-").concat(type);
36
+ this.containerService = ServiceProvider.getInstance(this.instanceId).getService('Container');
37
+ ServiceProvider.getInstance(this.instanceId).init({}, {
38
+ productScene: ProductSceneEnum.ELEMENT_PAYMENT,
39
+ sdkVersion: '',
40
+ webAppVersion: ''
41
+ });
42
+ this.containerService.load({
43
+ type: DisplayTypeEnum.inline,
44
+ platform: PlatformEnum.desktop,
45
+ isRetention: false,
46
+ selector: selector
47
+ }, processor.generateIframeSrc({
48
+ link: options === null || options === void 0 || (_options$debugProps = options.debugProps) === null || _options$debugProps === void 0 ? void 0 : _options$debugProps.localLink,
49
+ instanceId: this.instanceId
50
+ }));
51
+ this.eventService = ServiceProvider.getInstance(this.instanceId).getService('EventCenter');
52
+ this.addEventListener();
53
+ }
54
+ _createClass(ContainerController, [{
55
+ key: "addEventListener",
56
+ value: function addEventListener() {
57
+ var _this = this;
58
+ this.eventService.listen(EVENT.setGlobalData.name, function (result) {
59
+ _this._globalData.set(result === null || result === void 0 ? void 0 : result.dataKey, result === null || result === void 0 ? void 0 : result.data);
60
+ });
61
+ this.eventService.listen(EVENT.getGlobalData.name, function (data, result) {
62
+ var context = result.context;
63
+ if (context !== null && context !== void 0 && context.eventCallbackId) {
64
+ var _context$data;
65
+ var targetData = _this._globalData.get((_context$data = context.data) === null || _context$data === void 0 ? void 0 : _context$data.dataKey);
66
+ _this.eventService.dispatchToApp({
67
+ event: 'appEventCallback',
68
+ eventCallbackId: context === null || context === void 0 ? void 0 : context.eventCallbackId,
69
+ data: targetData
70
+ });
71
+ }
72
+ });
73
+ }
74
+ }, {
75
+ key: "createWebLaunchPromise",
76
+ value: function createWebLaunchPromise() {
77
+ var _this2 = this;
78
+ return new Promise(function (resolve) {
79
+ _this2.eventService.listen('onLaunch', function (res) {
80
+ resolve(res);
81
+ });
82
+ });
83
+ }
84
+ }, {
85
+ key: "switchContainerStatus",
86
+ value: function switchContainerStatus(status) {
87
+ this.containerStatus = status;
88
+ }
89
+ }, {
90
+ key: "getEventService",
91
+ value: function getEventService() {
92
+ return this.eventService;
93
+ }
94
+ }, {
95
+ key: "getContainerService",
96
+ value: function getContainerService() {
97
+ return this.containerService;
98
+ }
99
+ }]);
100
+ return ContainerController;
101
+ }();
@@ -0,0 +1,19 @@
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
+ mount({ type, selector, processor, options }: {
13
+ type: any;
14
+ selector: any;
15
+ processor: any;
16
+ options: any;
17
+ }): void;
18
+ getEventService(name: ElementType): import("../../../../foundation/service/event-center").EventCenter;
19
+ }
@@ -0,0 +1,55 @@
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: "mount",
35
+ value: function mount(_ref2) {
36
+ var type = _ref2.type,
37
+ selector = _ref2.selector,
38
+ processor = _ref2.processor,
39
+ options = _ref2.options;
40
+ this.addContainerService(type, new ContainerController({
41
+ type: type,
42
+ instanceId: this.instanceId,
43
+ selector: selector,
44
+ processor: processor,
45
+ options: options
46
+ }));
47
+ }
48
+ }, {
49
+ key: "getEventService",
50
+ value: function getEventService(name) {
51
+ return this.getContainerService(name).getEventService();
52
+ }
53
+ }]);
54
+ return ElementContainerService;
55
+ }();
@@ -0,0 +1,22 @@
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 elementContainerService;
9
+ constructor(options: IElementOptions);
10
+ private initService;
11
+ private initElementProcessors;
12
+ private onEventCallback;
13
+ mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string, cashier?: boolean): any;
14
+ private onValidateFunc;
15
+ submitPayment(): void;
16
+ private changeLoading;
17
+ private addEventListener;
18
+ private sendRequestAndWaitWebLaunch;
19
+ updatePayment(paymentSessionData: any): Promise<unknown>;
20
+ destroy(): void;
21
+ }
22
+ export default ElementController;