@alipay/ams-checkout 0.0.1755258111-dev.0 → 0.0.1755258862-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 (99) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/component/channel.d.ts +1 -3
  3. package/esm/component/channel.js +62 -26
  4. package/esm/component/component.inline.style.js +2 -2
  5. package/esm/component/popupWindow.style.d.ts +1 -4
  6. package/esm/component/popupWindow.style.js +2 -37
  7. package/esm/config/index.d.ts +8 -8
  8. package/esm/config/index.js +8 -8
  9. package/esm/constant/index.d.ts +2 -41
  10. package/esm/constant/index.js +5 -43
  11. package/esm/core/component/ckp/index.d.ts +0 -2
  12. package/esm/core/component/ckp/index.js +5 -41
  13. package/esm/core/component/element/index.d.ts +46 -7
  14. package/esm/core/component/element/index.js +923 -31
  15. package/esm/core/component/element/mock.d.ts +0 -4
  16. package/esm/core/component/element/mock.js +1 -365
  17. package/esm/core/component/element/type.d.ts +34 -74
  18. package/esm/core/component/element/type.js +12 -20
  19. package/esm/core/component/index.d.ts +1 -5
  20. package/esm/core/component/index.js +2 -1
  21. package/esm/core/instance/index.d.ts +1 -1
  22. package/esm/core/instance/index.js +1 -1
  23. package/esm/foundation/core/index.d.ts +1 -9
  24. package/esm/foundation/core/index.js +49 -153
  25. package/esm/foundation/index.d.ts +0 -20
  26. package/esm/foundation/index.js +2 -13
  27. package/esm/foundation/product-processor/easysafepay/deps.d.ts +1 -3
  28. package/esm/foundation/product-processor/easysafepay/deps.js +1 -3
  29. package/esm/foundation/product-processor/easysafepay/index.d.ts +0 -5
  30. package/esm/foundation/product-processor/easysafepay/index.js +138 -266
  31. package/esm/foundation/service/container/index.d.ts +3 -14
  32. package/esm/foundation/service/container/index.js +25 -178
  33. package/esm/foundation/service/container/popup.d.ts +7 -10
  34. package/esm/foundation/service/container/popup.js +1 -3
  35. package/esm/foundation/service/event-center.js +0 -1
  36. package/esm/foundation/service/log/keys.js +1 -3
  37. package/esm/foundation/service/log/types.d.ts +0 -1
  38. package/esm/foundation/service/requester/requester.js +37 -17
  39. package/esm/foundation/utils/preload_helper.d.ts +2 -2
  40. package/esm/foundation/utils/preload_helper.js +4 -8
  41. package/esm/foundation/utils/redirect_utils.js +18 -34
  42. package/esm/foundation/utils/web_app_url_utils.d.ts +1 -71
  43. package/esm/foundation/utils/web_app_url_utils.js +8 -219
  44. package/esm/index.d.ts +4 -7
  45. package/esm/index.js +48 -98
  46. package/esm/plugin/component/cashierApp.d.ts +1 -1
  47. package/esm/plugin/component/cashierApp.js +5 -5
  48. package/esm/plugin/component/channel.d.ts +1 -3
  49. package/esm/plugin/component/channel.js +12 -10
  50. package/esm/plugin/component/index.js +44 -47
  51. package/esm/plugin/type.d.ts +1 -1
  52. package/esm/request/index.js +2 -2
  53. package/esm/types/index.d.ts +3 -37
  54. package/esm/types/index.js +2 -10
  55. package/esm/util/index.d.ts +1 -8
  56. package/esm/util/index.js +3 -31
  57. package/esm/util/spm-map.d.ts +4 -18
  58. package/esm/util/spm-map.js +6 -20
  59. package/package.json +4 -27
  60. package/esm/constant/easysafepay.d.ts +0 -16
  61. package/esm/constant/easysafepay.js +0 -19
  62. package/esm/core/component/element/elementContainerService/containerService.d.ts +0 -33
  63. package/esm/core/component/element/elementContainerService/containerService.js +0 -123
  64. package/esm/core/component/element/elementContainerService/index.d.ts +0 -20
  65. package/esm/core/component/element/elementContainerService/index.js +0 -63
  66. package/esm/core/component/element/elementController/index.d.ts +0 -27
  67. package/esm/core/component/element/elementController/index.js +0 -493
  68. package/esm/core/component/element/elementProcessor/addressProcessor.d.ts +0 -20
  69. package/esm/core/component/element/elementProcessor/addressProcessor.js +0 -160
  70. package/esm/core/component/element/elementProcessor/authProcessor.d.ts +0 -20
  71. package/esm/core/component/element/elementProcessor/authProcessor.js +0 -125
  72. package/esm/core/component/element/elementProcessor/baseElementProcessor.d.ts +0 -41
  73. package/esm/core/component/element/elementProcessor/baseElementProcessor.js +0 -96
  74. package/esm/core/component/element/elementProcessor/paymentProcessor.d.ts +0 -20
  75. package/esm/core/component/element/elementProcessor/paymentProcessor.js +0 -380
  76. package/esm/core/component/element/util.d.ts +0 -69
  77. package/esm/core/component/element/util.js +0 -477
  78. package/esm/core/component/oldElement/index.d.ts +0 -59
  79. package/esm/core/component/oldElement/index.js +0 -956
  80. package/esm/core/component/oldElement/mock.d.ts +0 -6
  81. package/esm/core/component/oldElement/mock.js +0 -567
  82. package/esm/core/component/oldElement/type.d.ts +0 -354
  83. package/esm/core/component/oldElement/type.js +0 -81
  84. package/esm/foundation/product-processor/autoDebit/deps.d.ts +0 -14
  85. package/esm/foundation/product-processor/autoDebit/deps.js +0 -12
  86. package/esm/foundation/product-processor/autoDebit/index.d.ts +0 -48
  87. package/esm/foundation/product-processor/autoDebit/index.js +0 -466
  88. package/esm/foundation/product-processor/element/index.d.ts +0 -7
  89. package/esm/foundation/product-processor/element/index.js +0 -24
  90. package/esm/util/redirect.d.ts +0 -6
  91. package/esm/util/redirect.js +0 -54
  92. /package/esm/core/component/{oldElement → element}/components/address.d.ts +0 -0
  93. /package/esm/core/component/{oldElement → element}/components/address.js +0 -0
  94. /package/esm/core/component/{oldElement → element}/components/auth.d.ts +0 -0
  95. /package/esm/core/component/{oldElement → element}/components/auth.js +0 -0
  96. /package/esm/core/component/{oldElement → element}/components/payment.d.ts +0 -0
  97. /package/esm/core/component/{oldElement → element}/components/payment.js +0 -0
  98. /package/esm/core/component/{oldElement → element}/utils.d.ts +0 -0
  99. /package/esm/core/component/{oldElement → element}/utils.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1755258111-dev.0",
3
+ "version": "0.0.1755258862-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
@@ -16,31 +16,12 @@
16
16
  "scripts": {
17
17
  "build": "father build",
18
18
  "build:w": "father dev",
19
+ "dev": "father dev",
19
20
  "ci": "npm run lint",
20
21
  "cov": "jest --coverage",
21
- "dev": "father dev",
22
22
  "format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
23
23
  "lint": "eslint ./src",
24
- "test": "jest --silent",
25
- "tsc": "tsc --noEmit"
26
- },
27
- "commitlint": {
28
- "extends": [
29
- "@commitlint/config-conventional"
30
- ]
31
- },
32
- "lint-staged": {
33
- "*.{js,jsx}": [
34
- "eslint --fix",
35
- "prettier --write"
36
- ],
37
- "*.{ts,tsx}": [
38
- "eslint --fix",
39
- "prettier --parser=typescript --write"
40
- ],
41
- "*.{md,json}": [
42
- "prettier --write"
43
- ]
24
+ "test": "jest"
44
25
  },
45
26
  "dependencies": {
46
27
  "axios": "^1.3.4",
@@ -49,8 +30,6 @@
49
30
  "devDependencies": {
50
31
  "@babel/core": "^7.20.7",
51
32
  "@babel/preset-env": "^7.20.2",
52
- "@commitlint/cli": "^17.3.0",
53
- "@commitlint/config-conventional": "^17.3.0",
54
33
  "@testing-library/jest-dom": "^5.1.1",
55
34
  "@testing-library/react": "^9.5.0",
56
35
  "@types/jest": "^29.2.4",
@@ -72,9 +51,7 @@
72
51
  "ts-node": "^10.9.1",
73
52
  "typescript": "^4.9.5"
74
53
  },
75
- "engines": {
76
- "install-node": "18"
77
- },
54
+ "engines": {},
78
55
  "publishConfig": {
79
56
  "access": "public"
80
57
  }
@@ -1,16 +0,0 @@
1
- /**
2
- * ESP 构建产物page名称
3
- */
4
- export declare enum ESP_PAGE_NAME {
5
- API_PORTAL = "api-portal",
6
- SDK_PORTAL = "sdk-portal",
7
- DOUBLE_FA = "double-fa",
8
- PRELOAD = "preload"
9
- }
10
- /**
11
- * ESP集成模式
12
- */
13
- export declare enum MODE {
14
- SDK = "SDK",
15
- API = "API"
16
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * ESP 构建产物page名称
3
- */
4
- export var ESP_PAGE_NAME = /*#__PURE__*/function (ESP_PAGE_NAME) {
5
- ESP_PAGE_NAME["API_PORTAL"] = "api-portal";
6
- ESP_PAGE_NAME["SDK_PORTAL"] = "sdk-portal";
7
- ESP_PAGE_NAME["DOUBLE_FA"] = "double-fa";
8
- ESP_PAGE_NAME["PRELOAD"] = "preload";
9
- return ESP_PAGE_NAME;
10
- }({});
11
-
12
- /**
13
- * ESP集成模式
14
- */
15
- export var MODE = /*#__PURE__*/function (MODE) {
16
- MODE["SDK"] = "SDK";
17
- MODE["API"] = "API";
18
- return MODE;
19
- }({});
@@ -1,33 +0,0 @@
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
- }
@@ -1,123 +0,0 @@
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
- }();
@@ -1,20 +0,0 @@
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
- }
@@ -1,63 +0,0 @@
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
- }();
@@ -1,27 +0,0 @@
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): 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;