@alipay/ams-checkout 0.0.1758783821-dev.3 → 0.0.1758783821-dev.6

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 (33) hide show
  1. package/README.md +17 -1
  2. package/dist/umd/ams-checkout.min.js +1 -1
  3. package/esm/constant/index.d.ts +102 -88
  4. package/esm/constant/index.js +23 -6
  5. package/esm/core/component/element/elementController/index.d.ts +3 -8
  6. package/esm/core/component/element/elementController/index.js +31 -15
  7. package/esm/core/component/element/index.d.ts +3 -10
  8. package/esm/core/component/element/index.js +4 -1
  9. package/esm/core/component/element/type.d.ts +22 -4
  10. package/esm/core/component/element/type.js +16 -0
  11. package/esm/core/component/element/util.d.ts +1 -1
  12. package/esm/core/component/element/util.js +1 -1
  13. package/esm/plugin/component/channel.js +0 -1
  14. package/esm/plugin/component/index.js +2 -2
  15. package/esm/types/index.d.ts +2 -2
  16. package/esm/types/index.js +1 -1
  17. package/esm/util/spm-map.d.ts +2 -0
  18. package/esm/util/spm-map.js +2 -1
  19. package/package.json +12 -7
  20. package/esm/core/component/oldElement/components/address.d.ts +0 -19
  21. package/esm/core/component/oldElement/components/address.js +0 -68
  22. package/esm/core/component/oldElement/components/auth.d.ts +0 -17
  23. package/esm/core/component/oldElement/components/auth.js +0 -60
  24. package/esm/core/component/oldElement/components/payment.d.ts +0 -19
  25. package/esm/core/component/oldElement/components/payment.js +0 -74
  26. package/esm/core/component/oldElement/index.d.ts +0 -59
  27. package/esm/core/component/oldElement/index.js +0 -956
  28. package/esm/core/component/oldElement/mock.d.ts +0 -6
  29. package/esm/core/component/oldElement/mock.js +0 -567
  30. package/esm/core/component/oldElement/type.d.ts +0 -354
  31. package/esm/core/component/oldElement/type.js +0 -81
  32. package/esm/core/component/oldElement/utils.d.ts +0 -13
  33. package/esm/core/component/oldElement/utils.js +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1758783821-dev.3",
3
+ "version": "0.0.1758783821-dev.6",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",
@@ -16,8 +16,8 @@
16
16
  "scripts": {
17
17
  "build": "father build",
18
18
  "build:w": "father dev",
19
- "ci": "npm run lint",
20
- "cov": "jest --coverage",
19
+ "ci": "tnpm run cov",
20
+ "cov": "jest --coverage --silent",
21
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",
@@ -47,6 +47,7 @@
47
47
  "uuid": "^9.0.0"
48
48
  },
49
49
  "devDependencies": {
50
+ "@ali/ci": "^4.72.0",
50
51
  "@babel/core": "^7.20.7",
51
52
  "@babel/preset-env": "^7.20.2",
52
53
  "@commitlint/cli": "^17.3.0",
@@ -55,13 +56,13 @@
55
56
  "@testing-library/react": "^9.5.0",
56
57
  "@types/jest": "^29.2.4",
57
58
  "@types/uuid": "^9.0.0",
58
- "@typescript-eslint/eslint-plugin": "latest",
59
- "@typescript-eslint/parser": "^5.60.0",
59
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
60
+ "@typescript-eslint/parser": "^6.21.0",
60
61
  "babel-jest": "^29.3.1",
61
62
  "babel-loader": "^9.1.0",
62
63
  "babel-plugin-import": "^1.13.0",
63
- "eslint": "^8.36.0",
64
- "eslint-plugin-prettier": "latest",
64
+ "eslint": "^8.56.0",
65
+ "eslint-plugin-prettier": "^5.1.3",
65
66
  "father": "^4.2.3",
66
67
  "jest": "^29.5.0",
67
68
  "jest-environment-jsdom": "^29.3.1",
@@ -77,5 +78,9 @@
77
78
  },
78
79
  "publishConfig": {
79
80
  "access": "public"
81
+ },
82
+ "ci": {
83
+ "resourceClass": "L",
84
+ "type": "aci"
80
85
  }
81
86
  }
@@ -1,19 +0,0 @@
1
- import { AddressMountComponentsParams } from '../type';
2
- interface ElementAddressMountOptions extends Omit<AddressMountComponentsParams, 'type'> {
3
- selector: string;
4
- }
5
- export declare class ElementAddressComponent {
6
- private sdk;
7
- private elementContainer;
8
- private isConnect;
9
- constructor();
10
- create(options: {
11
- environment: string;
12
- locale: string;
13
- appVersion: string;
14
- }, isConnect: boolean): void;
15
- mount(options: ElementAddressMountOptions): Promise<HTMLIFrameElement | undefined>;
16
- update(): void;
17
- unmount(): void;
18
- }
19
- export {};
@@ -1,68 +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 { AddressComponent } from "../../address";
9
- export var ElementAddressComponent = /*#__PURE__*/function () {
10
- function ElementAddressComponent() {
11
- _classCallCheck(this, ElementAddressComponent);
12
- _defineProperty(this, "sdk", void 0);
13
- _defineProperty(this, "elementContainer", void 0);
14
- _defineProperty(this, "isConnect", void 0);
15
- }
16
- _createClass(ElementAddressComponent, [{
17
- key: "create",
18
- value: function create(options, isConnect) {
19
- this.isConnect = isConnect;
20
- this.sdk = new AddressComponent(options);
21
- }
22
- }, {
23
- key: "mount",
24
- value: function mount(options) {
25
- var _this = this;
26
- var elementContainer = document.querySelector(options.selector);
27
- if (this.isConnect) {
28
- elementContainer.style.display = 'none';
29
- }
30
- return new Promise(function (resolve) {
31
- _this.sdk.mountComponent({
32
- sessionData: options.sessionData,
33
- elementProps: options.elementProps,
34
- configParams: options.configParams,
35
- appearance: options.appearance,
36
- prefillValue: options.prefillValue,
37
- appendAliasContainerId: true
38
- }, options.selector).then(function () {
39
- var _elementContainer$get;
40
- _this.elementContainer = elementContainer;
41
- var iframes = elementContainer === null || elementContainer === void 0 || (_elementContainer$get = elementContainer.getElementsByTagName) === null || _elementContainer$get === void 0 ? void 0 : _elementContainer$get.call(elementContainer, 'iframe');
42
- resolve(iframes === null || iframes === void 0 ? void 0 : iframes[0]);
43
- }, function () {
44
- resolve(undefined);
45
- });
46
- });
47
- }
48
- }, {
49
- key: "update",
50
- value: function update() {
51
- if (this.elementContainer && this.isConnect) {
52
- this.elementContainer.style.display = '';
53
- }
54
- // 下发数据
55
- }
56
- }, {
57
- key: "unmount",
58
- value: function unmount() {
59
- var _this$elementContaine, _this$elementContaine2;
60
- var containers = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'div');
61
- if (containers !== null && containers !== void 0 && containers[0]) {
62
- var _containers$, _containers$$remove;
63
- (_containers$ = containers[0]) === null || _containers$ === void 0 || (_containers$$remove = _containers$.remove) === null || _containers$$remove === void 0 || _containers$$remove.call(_containers$);
64
- }
65
- }
66
- }]);
67
- return ElementAddressComponent;
68
- }();
@@ -1,17 +0,0 @@
1
- import { LinkAuthMountOptions } from '../type';
2
- interface ElementAuthMountOptions extends Omit<LinkAuthMountOptions, 'type' | 'elementProps'> {
3
- selector: string;
4
- url: string;
5
- }
6
- export declare class ElementAuthComponent {
7
- private elementContainer;
8
- constructor();
9
- create(options: {
10
- environment: string;
11
- locale: string;
12
- }): void;
13
- mount(options: ElementAuthMountOptions): Promise<HTMLIFrameElement | undefined>;
14
- update(height?: number): void;
15
- unmount(): void;
16
- }
17
- export {};
@@ -1,60 +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 { createIframe } from "../../../../foundation/service/container/utils";
9
- import { createInlineBaseElement } from "../../../../plugin/component/component.inline.style";
10
- export var ElementAuthComponent = /*#__PURE__*/function () {
11
- function ElementAuthComponent() {
12
- _classCallCheck(this, ElementAuthComponent);
13
- _defineProperty(this, "elementContainer", void 0);
14
- }
15
- _createClass(ElementAuthComponent, [{
16
- key: "create",
17
- value: function create(options) {}
18
- }, {
19
- key: "mount",
20
- value: function mount(options) {
21
- var _this = this;
22
- return new Promise(function (resolve) {
23
- try {
24
- var selector = options.selector,
25
- url = options.url;
26
- var containerId = (selector === null || selector === void 0 ? void 0 : selector.indexOf('#')) === -1 ? selector : selector.slice(1);
27
- var containerSelector = "antom-sdk-web-app-".concat(containerId);
28
- var container = createInlineBaseElement(selector);
29
- var webApp = createIframe(containerSelector);
30
- webApp.src = url;
31
- container.appendChild(webApp);
32
- _this.elementContainer = container;
33
- resolve(webApp);
34
- } catch (error) {
35
- resolve(undefined);
36
- }
37
- });
38
- }
39
- }, {
40
- key: "update",
41
- value: function update() {
42
- var _this$elementContaine, _this$elementContaine2;
43
- var height = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 100;
44
- var iframes = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'iframe');
45
- if (iframes !== null && iframes !== void 0 && iframes[0]) {
46
- var iframe = iframes[0];
47
- iframe.style.opacity = '1';
48
- iframe.style.overflow = 'visible';
49
- iframe.style.height = "".concat(height, "px");
50
- }
51
- }
52
- }, {
53
- key: "unmount",
54
- value: function unmount() {
55
- var _this$elementContaine3, _this$elementContaine4;
56
- (_this$elementContaine3 = this.elementContainer) === null || _this$elementContaine3 === void 0 || (_this$elementContaine4 = _this$elementContaine3.remove) === null || _this$elementContaine4 === void 0 || _this$elementContaine4.call(_this$elementContaine3);
57
- }
58
- }]);
59
- return ElementAuthComponent;
60
- }();
@@ -1,19 +0,0 @@
1
- import { PaymentMountOptions } from '../type';
2
- interface ElementPaymentMountOptions extends Omit<PaymentMountOptions, 'type'> {
3
- selector: string;
4
- }
5
- export declare class ElementPaymentComponent {
6
- private sdk;
7
- private elementContainer;
8
- private isConnect;
9
- constructor();
10
- create(options: {
11
- environment: string;
12
- locale: string;
13
- appVersion: string;
14
- }, isConnect: boolean): void;
15
- mount(options: ElementPaymentMountOptions): Promise<HTMLIFrameElement | undefined>;
16
- update(): void;
17
- unmount(): void;
18
- }
19
- export {};
@@ -1,74 +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 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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- 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); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- 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; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
- 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); }
10
- import AMSPaymentElement from "../../../../index";
11
- export var ElementPaymentComponent = /*#__PURE__*/function () {
12
- function ElementPaymentComponent() {
13
- _classCallCheck(this, ElementPaymentComponent);
14
- _defineProperty(this, "sdk", void 0);
15
- _defineProperty(this, "elementContainer", void 0);
16
- _defineProperty(this, "isConnect", void 0);
17
- }
18
- _createClass(ElementPaymentComponent, [{
19
- key: "create",
20
- value: function create(options, isConnect) {
21
- this.isConnect = isConnect;
22
- this.sdk = new AMSPaymentElement(_objectSpread(_objectSpread({}, options), {}, {
23
- analytics: {
24
- enabled: true
25
- },
26
- onEventCallback: function onEventCallback(state) {}
27
- }));
28
- }
29
- }, {
30
- key: "mount",
31
- value: function mount(options) {
32
- var _this = this;
33
- var elementContainer = document.querySelector(options.selector);
34
- if (this.isConnect) {
35
- elementContainer.style.display = 'none';
36
- }
37
- return new Promise(function (resolve) {
38
- _this.sdk.mountComponent({
39
- sessionData: options.sessionData,
40
- appearance: options.appearance,
41
- elementProps: options.elementProps,
42
- notRedirectAfterComplete: true,
43
- appendAliasContainerId: true
44
- }, options.selector).then(function () {
45
- var _elementContainer$get;
46
- _this.elementContainer = elementContainer;
47
- var iframes = elementContainer === null || elementContainer === void 0 || (_elementContainer$get = elementContainer.getElementsByTagName) === null || _elementContainer$get === void 0 ? void 0 : _elementContainer$get.call(elementContainer, 'iframe');
48
- resolve(iframes === null || iframes === void 0 ? void 0 : iframes[0]);
49
- }, function () {
50
- resolve(undefined);
51
- });
52
- });
53
- }
54
- }, {
55
- key: "update",
56
- value: function update() {
57
- if (this.elementContainer && this.isConnect) {
58
- this.elementContainer.style.display = 'initial';
59
- }
60
- // 下发数据
61
- }
62
- }, {
63
- key: "unmount",
64
- value: function unmount() {
65
- var _this$elementContaine, _this$elementContaine2;
66
- var containers = (_this$elementContaine = this.elementContainer) === null || _this$elementContaine === void 0 || (_this$elementContaine2 = _this$elementContaine.getElementsByTagName) === null || _this$elementContaine2 === void 0 ? void 0 : _this$elementContaine2.call(_this$elementContaine, 'div');
67
- if (containers !== null && containers !== void 0 && containers[0]) {
68
- var _containers$, _containers$$remove;
69
- (_containers$ = containers[0]) === null || _containers$ === void 0 || (_containers$$remove = _containers$.remove) === null || _containers$$remove === void 0 || _containers$$remove.call(_containers$);
70
- }
71
- }
72
- }]);
73
- return ElementPaymentComponent;
74
- }();
@@ -1,59 +0,0 @@
1
- import { IPaymentSessionMetaData } from '../../../types';
2
- import type { AddressMountOptions, AddressMountResult, IElementOptions, LinkAuthMountOptions, LinkAuthMountResult, PaymentMountOptions, PaymentMountResult } from './type';
3
- export interface IElementProcessorOptions {
4
- paymentSessionConfig: IPaymentSessionMetaData['paymentSessionConfig'];
5
- sessionData: string;
6
- environment: string;
7
- locale: string;
8
- isConnect: boolean;
9
- }
10
- export declare class ElementComponent {
11
- private parseData;
12
- private loading;
13
- private sessionData;
14
- private elementContainer;
15
- private authBase;
16
- private addressBase;
17
- private paymentBase;
18
- private _options;
19
- private eventService;
20
- private sdkActionRes;
21
- private oneAccountRes;
22
- private launchSource;
23
- private initCompleted;
24
- private isConnect;
25
- private iframeSrc;
26
- private mountOptions;
27
- private iframes;
28
- private loadingElement;
29
- private componentsCount;
30
- private eventCallback;
31
- private ApplePayService;
32
- constructor(options: IElementOptions);
33
- private createElement;
34
- private beforeMount;
35
- private createComponentSdk;
36
- private createIframeSrc;
37
- private closeLoading;
38
- private addListener;
39
- private launchFunc;
40
- private showIframe;
41
- private afterInit;
42
- private sendRenderData;
43
- private removeListener;
44
- private registerEventListener;
45
- private mountAuth;
46
- private mountAddress;
47
- private mountPayment;
48
- private initApplePaySdk;
49
- mountErrorHandle(): void;
50
- mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
51
- mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
52
- mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
53
- private resetState;
54
- unmount(): void;
55
- private onAfterSubmitFunc;
56
- private onValidateFunc;
57
- private validatePromiseFuncs;
58
- submitPayment(): Promise<void>;
59
- }