@alipay/ams-checkout 1.3.2 → 1.5.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 (40) hide show
  1. package/dist/umd/ams-checkout.min.js +1 -1
  2. package/esm/config/index.d.ts +1 -15
  3. package/esm/config/index.js +9 -62
  4. package/esm/config/request.d.ts +21 -0
  5. package/esm/config/request.js +67 -0
  6. package/esm/constant/index.d.ts +54 -32
  7. package/esm/constant/index.js +54 -32
  8. package/esm/core/component/index.d.ts +23 -9
  9. package/esm/core/component/index.js +161 -98
  10. package/esm/core/drop-in/index.d.ts +4 -4
  11. package/esm/core/drop-in/index.js +3 -3
  12. package/esm/core/instance/index.d.ts +6 -23
  13. package/esm/core/instance/index.js +31 -75
  14. package/esm/image/skeleton.svg +18 -0
  15. package/esm/index.d.ts +4 -10
  16. package/esm/index.js +8 -30
  17. package/esm/plugin/component/cashierApp.d.ts +5 -6
  18. package/esm/plugin/component/cashierApp.js +48 -64
  19. package/esm/plugin/component/{component.style.d.ts → component.inline.style.d.ts} +4 -1
  20. package/esm/plugin/component/component.inline.style.js +38 -0
  21. package/esm/plugin/component/component.popup.style.d.ts +12 -0
  22. package/esm/plugin/component/component.popup.style.js +163 -0
  23. package/esm/plugin/component/index.d.ts +30 -33
  24. package/esm/plugin/component/index.js +248 -349
  25. package/esm/plugin/drop-in/index.d.ts +3 -5
  26. package/esm/plugin/drop-in/index.js +3 -3
  27. package/esm/request/index.d.ts +2 -2
  28. package/esm/request/index.js +8 -7
  29. package/esm/request/utils.d.ts +3 -3
  30. package/esm/request/utils.js +4 -4
  31. package/esm/service/index.d.ts +2 -2
  32. package/esm/types/index.d.ts +96 -37
  33. package/esm/types/index.js +92 -52
  34. package/esm/util/createIframeNode.d.ts +3 -3
  35. package/esm/util/createIframeNode.js +8 -8
  36. package/esm/util/index.d.ts +6 -4
  37. package/esm/util/index.js +22 -5
  38. package/esm/util/mock.js +1 -2
  39. package/package.json +1 -1
  40. package/esm/plugin/component/component.style.js +0 -15
@@ -1,16 +1,2 @@
1
- export declare const requestHost: {
2
- [key: string]: string;
3
- };
4
- export declare const clientId = "5J5Y8X4E2Y25GR00690";
5
- export declare const tntInstId = "ALIPW3SG";
6
- export declare const appId = "ANTOM_PAYMENT_WEB";
7
- export declare const sofaId: any;
8
- export declare const closeImg = "https://file.page.alipay.net/resource/2023/3/21/3235f64c-84a6-4e33-9567-4cedf0960229.svg";
9
- export declare const hostSignMap: (hostSign: string | undefined, env: string) => string;
10
- export declare const lightSandboxMap: (operationType: string | undefined, env: string) => {
11
- appId: string;
12
- sofaId: any;
13
- baseURL: string;
14
- 'Operation-Type': string;
15
- };
1
+ export declare const marmptMap: Record<string, string>;
16
2
  export declare const sdkVersion: string;
@@ -5,66 +5,13 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
- import packageJSON from "../../package.json";
9
- import { queryParse } from "../util";
10
- var _queryParse = queryParse(),
11
- _light_sandbox = _queryParse._light_sandbox,
12
- groupId = _queryParse.groupId,
13
- host = _queryParse.requestHost;
14
- export var requestHost = {
15
- local: 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
16
- dev: host || 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
17
- sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
18
- pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
19
- prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
20
- sandbox: 'https://imgs-sea-global.alipay.com/mgw.htm'
8
+ import json from "../../package.json";
9
+ export var marmptMap = {
10
+ dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
11
+ sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
12
+ pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
13
+ sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
14
+ light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
15
+ prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
21
16
  };
22
- export var clientId = '5J5Y8X4E2Y25GR00690';
23
- export var tntInstId = 'ALIPW3SG';
24
- export var appId = 'ANTOM_PAYMENT_WEB';
25
- export var sofaId = groupId || 'GROUP_20230523202227'; // 2.0
26
-
27
- export var closeImg = 'https://file.page.alipay.net/resource/2023/3/21/3235f64c-84a6-4e33-9567-4cedf0960229.svg';
28
- export var hostSignMap = function hostSignMap(hostSign, env) {
29
- var map = {
30
- SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
31
- US: 'https://imgs-na-global.alipay.com/mgw.htm',
32
- DE: 'https://imgs-de-global.alipay.com/mgw.htm'
33
- };
34
- var preMap = {
35
- SG: 'https://imgs-sea-pre.alipay.com/mgw.htm',
36
- US: 'https://imgs-pre.alipay.com/mgw.htm',
37
- DE: 'https://imgs-de-pre.alipay.com/mgw.htm'
38
- };
39
- if (env === 'prod' || env === 'sandbox' || env === 'light_sandbox') {
40
- return map[hostSign || 'SG'];
41
- } else if (env === 'pre') {
42
- return preMap[hostSign || 'SG'];
43
- } else return '';
44
- };
45
- export var lightSandboxMap = function lightSandboxMap() {
46
- var operationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
47
- var env = arguments.length > 1 ? arguments[1] : undefined;
48
- var map = {
49
- pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
50
- sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
51
- dev: host || 'http://imgs-13.sggz00b.stable.alipay.net/mgw.htm'
52
- };
53
- var typeMap = {
54
- 'com.ipay.iexpcashier.sdkAction.query': 'com.ipay.iopensandbox.sdk.paymentSession.query'
55
- };
56
- var appId = 'SDK_MOCK_SANDBOX';
57
- var sofaId = groupId || 'GROUP_20230315210531';
58
- if (typeMap[operationType] && env === 'light_sandbox' || _light_sandbox === 'true') return {
59
- appId: appId,
60
- sofaId: sofaId,
61
- baseURL: map[env],
62
- 'Operation-Type': typeMap[operationType]
63
- };else return {
64
- appId: '',
65
- sofaId: '',
66
- baseURL: '',
67
- 'Operation-Type': ''
68
- };
69
- };
70
- export var sdkVersion = packageJSON.version;
17
+ export var sdkVersion = json.version;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
+ * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
+ */
8
+ export declare const requestHost: {
9
+ [key: string]: string;
10
+ };
11
+ export declare const clientId = "5J5Y8X4E2Y25GR00690";
12
+ export declare const tntInstId = "ALIPW3SG";
13
+ export declare const appId = "ANTOM_PAYMENT_WEB";
14
+ export declare const sofaId: any;
15
+ export declare const hostSignMap: (hostSign: string | undefined, env: string) => string;
16
+ export declare const lightSandboxMap: (operationType: string | undefined, env: string) => {
17
+ appId: string;
18
+ sofaId: any;
19
+ baseURL: string;
20
+ 'Operation-Type': string;
21
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5
+ * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
+ * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
+ */
8
+
9
+ import { queryParse } from "../util";
10
+ var _queryParse = queryParse(),
11
+ _light_sandbox = _queryParse._light_sandbox,
12
+ groupId = _queryParse.groupId,
13
+ host = _queryParse.requestHost;
14
+ export var requestHost = {
15
+ local: 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
16
+ dev: host || 'http://imgs-1164.gz00b.dev.alipay.net/mgw.htm',
17
+ sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
18
+ pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
19
+ prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
20
+ sandbox: 'https://imgs-sea-global.alipay.com/mgw.htm'
21
+ };
22
+ export var clientId = '5J5Y8X4E2Y25GR00690';
23
+ export var tntInstId = 'ALIPW3SG';
24
+ export var appId = 'ANTOM_PAYMENT_WEB';
25
+ export var sofaId = groupId || 'GROUP_20230523202227';
26
+ export var hostSignMap = function hostSignMap(hostSign, env) {
27
+ var map = {
28
+ SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
29
+ US: 'https://imgs-na-global.alipay.com/mgw.htm',
30
+ DE: 'https://imgs-de-global.alipay.com/mgw.htm'
31
+ };
32
+ var preMap = {
33
+ SG: 'https://imgs-sea-pre.alipay.com/mgw.htm',
34
+ US: 'https://imgs-pre.alipay.com/mgw.htm',
35
+ DE: 'https://imgs-de-pre.alipay.com/mgw.htm'
36
+ };
37
+ if (env === 'prod' || env === 'sandbox' || env === 'light_sandbox') {
38
+ return map[hostSign || 'SG'];
39
+ } else if (env === 'pre') {
40
+ return preMap[hostSign || 'SG'];
41
+ } else return '';
42
+ };
43
+ export var lightSandboxMap = function lightSandboxMap() {
44
+ var operationType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
45
+ var env = arguments.length > 1 ? arguments[1] : undefined;
46
+ var map = {
47
+ pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
48
+ sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
49
+ dev: host || 'http://imgs-13.sggz00b.stable.alipay.net/mgw.htm'
50
+ };
51
+ var typeMap = {
52
+ 'com.ipay.iexpcashier.sdkAction.query': 'com.ipay.iopensandbox.sdk.paymentSession.query'
53
+ };
54
+ var appId = 'SDK_MOCK_SANDBOX';
55
+ var sofaId = groupId || 'GROUP_20230315210531';
56
+ if (typeMap[operationType] && env === 'light_sandbox' || _light_sandbox === 'true') return {
57
+ appId: appId,
58
+ sofaId: sofaId,
59
+ baseURL: map[env],
60
+ 'Operation-Type': typeMap[operationType]
61
+ };else return {
62
+ appId: '',
63
+ sofaId: '',
64
+ baseURL: '',
65
+ 'Operation-Type': ''
66
+ };
67
+ };
@@ -4,74 +4,83 @@
4
4
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
5
5
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
6
6
  */
7
+ import { eventCodeEnum } from "../types";
7
8
  export declare const ERRORMESSAGE: {
8
9
  DOMAIN_NOT_IN_WHITE_LIST: {
9
- errorCode: string;
10
- errorMessage: string;
10
+ code: eventCodeEnum;
11
+ message: string;
11
12
  };
12
13
  NOT_JSON_FORMAT: {
13
- errorCode: string;
14
- errorMessage: string;
14
+ code: eventCodeEnum;
15
+ message: string;
15
16
  };
16
17
  SDK_COMPATIBILITY_ISSUES: {
17
- errorCode: string;
18
+ code: eventCodeEnum;
18
19
  BROWSER_NOT_SUPPORT_POSTMESSAGE: {
19
- errorCode: string;
20
- errorMessage: string;
20
+ code: eventCodeEnum;
21
+ message: string;
21
22
  };
22
23
  FAILED_TO_CREATE_IFRAME: {
23
- errorCode: string;
24
- errorMessage: string;
24
+ code: eventCodeEnum;
25
+ message: string;
25
26
  };
26
27
  };
27
28
  INIT_PARAMETER_ERROR: {
28
- errorCode: string;
29
+ code: eventCodeEnum;
29
30
  UI_MODE_NOT_SUPPORTED: {
30
- errorCode: string;
31
- errorMessage: string;
31
+ code: eventCodeEnum;
32
+ message: string;
32
33
  };
33
34
  ENVIRONMENT_ERROR: {
34
- errorCode: string;
35
- errorMessage: string;
35
+ code: eventCodeEnum;
36
+ message: string;
36
37
  };
37
38
  MODE_ERROR: {
38
- errorCode: string;
39
- errorMessage: string;
39
+ code: eventCodeEnum;
40
+ message: string;
40
41
  };
41
42
  LOCALE_ERROR: {
42
- errorCode: string;
43
- errorMessage: string;
43
+ code: eventCodeEnum;
44
+ message: string;
44
45
  };
45
46
  NET_MODE_NOT_SUPPORT: {
46
- errorCode: string;
47
- errorMessage: string;
47
+ code: eventCodeEnum;
48
+ message: string;
48
49
  };
49
50
  EVENT_ERROR: {
50
- errorCode: string;
51
- errorMessage: string;
51
+ code: eventCodeEnum;
52
+ message: string;
52
53
  };
53
54
  };
54
55
  CREATEPAYMENT_PARAMETER_ERROR: {
55
- errorCode: string;
56
+ code: eventCodeEnum;
56
57
  };
57
58
  CONFIRMPAYMENT_PARAMETER_ERROR: {
58
- errorCode: string;
59
+ code: string;
59
60
  };
60
61
  CREATECOMPONENT_ERROR: {
61
- errorCode: string;
62
- errorMessage: string;
62
+ code: eventCodeEnum;
63
+ message: string;
63
64
  SINGLETON_COMPONENT_ERROR: {
64
- errorCode: string;
65
- errorMessage: string;
65
+ code: eventCodeEnum;
66
+ message: string;
67
+ };
68
+ LOAD_APP_TIMEOUT: {
69
+ code: eventCodeEnum;
70
+ message: string;
66
71
  };
67
72
  };
68
73
  SDK_CALL_URL_ERROR: {
69
- errorCode: string;
74
+ code: eventCodeEnum;
70
75
  REDIRECT_ERROR: {
71
- errorCode: string;
72
- errorMessage: string;
76
+ code: eventCodeEnum;
77
+ message: string;
73
78
  };
74
79
  };
80
+ SDK_SUBMIT_ERROR: {
81
+ code: eventCodeEnum;
82
+ message: string;
83
+ };
75
84
  };
76
85
  export declare const BASEPLUGINID = "CHECKOUT";
77
86
  export declare const COMPONENTPLUGINID = "COMPONENT";
@@ -102,7 +111,7 @@ export declare const EVENT: {
102
111
  redirect: {
103
112
  name: string;
104
113
  };
105
- onClose: {
114
+ close: {
106
115
  name: string;
107
116
  uniqueKey: string;
108
117
  };
@@ -132,4 +141,17 @@ export declare const EVENT: {
132
141
  name: string;
133
142
  };
134
143
  };
144
+ export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
145
+ export declare const COMPONENT_SECTION_ID = "ams-component-section";
146
+ export declare const COMPONENT_IFRAME_TAG_ID = "ams-checkout-component";
147
+ export declare const COMPONENT_CLOSE_BLOCK_ID = "asm-component-close-block";
148
+ export declare const COMPONENT_RETENTION_ID = "ams-component-retention";
149
+ export declare const MOCKUP_ID = "ams-component-mockup";
150
+ export declare const LOADING_ID = "ams-component-loading";
151
+ export declare const LISTENER_PREFIX = "_ams_sdk_component_listener";
152
+ export declare const INLINE_BASE_STYLE_ID = "ams-inline-component-style";
153
+ export declare const INLINE_IMG_CLASSNAME = "inline-loading";
154
+ export declare const LOADTIME_LIMIT = 15000;
155
+ export declare const ANIMATION_TIME = 300;
156
+ export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
135
157
  export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxe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YqIRhFHkvq+J77MBFQpEPpCQOYPcntwIWeK6Mu0P9D9pzJq4u5hj+AAAAAElFTkSuQmCC";
@@ -4,73 +4,82 @@
4
4
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
5
5
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
6
6
  */
7
+ import { eventCodeEnum } from "../types";
7
8
  export var ERRORMESSAGE = {
8
9
  DOMAIN_NOT_IN_WHITE_LIST: {
9
- errorCode: 'SDK_INTERNAL_ERROR',
10
- errorMessage: 'Origin of the message is not in the white list'
10
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
11
+ message: 'Origin of the message is not in the white list'
11
12
  },
12
13
  NOT_JSON_FORMAT: {
13
- errorCode: 'SDK_INTERNAL_ERROR',
14
- errorMessage: 'The message string should conform to the json format'
14
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
15
+ message: 'The message string should conform to the json format'
15
16
  },
16
17
  SDK_COMPATIBILITY_ISSUES: {
17
- errorCode: 'SDK_INTERNAL_ERROR',
18
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
18
19
  BROWSER_NOT_SUPPORT_POSTMESSAGE: {
19
- errorCode: 'SDK_INTERNAL_ERROR',
20
- errorMessage: 'The browser does not support the postmessage communication mode'
20
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
21
+ message: 'The browser does not support the postmessage communication mode'
21
22
  },
22
23
  FAILED_TO_CREATE_IFRAME: {
23
- errorCode: 'SDK_INTERNAL_ERROR',
24
- errorMessage: 'Failed to create iframe'
24
+ code: eventCodeEnum.SDK_INTERNAL_ERROR,
25
+ message: 'Failed to create iframe'
25
26
  }
26
27
  },
27
28
  INIT_PARAMETER_ERROR: {
28
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
29
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
29
30
  UI_MODE_NOT_SUPPORTED: {
30
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
31
- errorMessage: 'This UI mode is not supported'
31
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
32
+ message: 'This UI mode is not supported'
32
33
  },
33
34
  ENVIRONMENT_ERROR: {
34
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
35
- errorMessage: 'The current input environment does not support or is not in the standard enumeration'
35
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
36
+ message: 'The current input environment does not support or is not in the standard enumeration'
36
37
  },
37
38
  MODE_ERROR: {
38
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
39
- errorMessage: 'mode value not in enum'
39
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
40
+ message: 'mode value not in enum'
40
41
  },
41
42
  LOCALE_ERROR: {
42
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
43
- errorMessage: 'The current input language does not support or is not in the standard enumeration'
43
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
44
+ message: 'The current input language does not support or is not in the standard enumeration'
44
45
  },
45
46
  NET_MODE_NOT_SUPPORT: {
46
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
47
- errorMessage: 'The network mode is not supported'
47
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
48
+ message: 'The network mode is not supported'
48
49
  },
49
50
  EVENT_ERROR: {
50
- errorCode: 'SDK_INIT_PARAMETER_ERROR',
51
- errorMessage: 'Parameter type should be function'
51
+ code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
52
+ message: 'Parameter type should be function'
52
53
  }
53
54
  },
54
55
  CREATEPAYMENT_PARAMETER_ERROR: {
55
- errorCode: 'SDK_CREATEPAYMENT_PARAMETER_ERROR'
56
+ code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR
56
57
  },
57
58
  CONFIRMPAYMENT_PARAMETER_ERROR: {
58
- errorCode: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
59
+ code: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
59
60
  },
60
61
  CREATECOMPONENT_ERROR: {
61
- errorCode: 'SDK_CREATECOMPONENT_ERROR',
62
- errorMessage: 'Failed to create component',
62
+ code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
63
+ message: 'Failed to create component',
63
64
  SINGLETON_COMPONENT_ERROR: {
64
- errorCode: 'SDK_CREATECOMPONENT_ERROR',
65
- errorMessage: 'Only one component can be rendered simultaneously'
65
+ code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
66
+ message: 'Only one component can be rendered simultaneously'
67
+ },
68
+ LOAD_APP_TIMEOUT: {
69
+ code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
70
+ message: 'Load resource timeout'
66
71
  }
67
72
  },
68
73
  SDK_CALL_URL_ERROR: {
69
- errorCode: 'SDK_CALL_URL_ERROR',
74
+ code: eventCodeEnum.SDK_CALL_URL_ERROR,
70
75
  REDIRECT_ERROR: {
71
- errorCode: 'SDK_CALL_URL_ERROR',
72
- errorMessage: 'Redirect data exception'
76
+ code: eventCodeEnum.SDK_CALL_URL_ERROR,
77
+ message: 'Redirect data exception'
73
78
  }
79
+ },
80
+ SDK_SUBMIT_ERROR: {
81
+ code: eventCodeEnum.SDK_CALL_URL_ERROR,
82
+ message: 'Component not created or current browser compatibility issue, not supported'
74
83
  }
75
84
  };
76
85
  export var BASEPLUGINID = 'CHECKOUT';
@@ -102,7 +111,7 @@ export var EVENT = {
102
111
  redirect: {
103
112
  name: 'onRedirect'
104
113
  },
105
- onClose: {
114
+ close: {
106
115
  name: 'onClose',
107
116
  uniqueKey: 'userOnClose'
108
117
  },
@@ -132,4 +141,17 @@ export var EVENT = {
132
141
  name: 'dismissLoading'
133
142
  }
134
143
  };
144
+ export var COMPONENT_CONTAINER_ID = 'ams-component-container';
145
+ export var COMPONENT_SECTION_ID = 'ams-component-section';
146
+ export var COMPONENT_IFRAME_TAG_ID = 'ams-checkout-component';
147
+ export var COMPONENT_CLOSE_BLOCK_ID = 'asm-component-close-block';
148
+ export var COMPONENT_RETENTION_ID = 'ams-component-retention';
149
+ export var MOCKUP_ID = 'ams-component-mockup';
150
+ export var LOADING_ID = 'ams-component-loading';
151
+ export var LISTENER_PREFIX = '_ams_sdk_component_listener';
152
+ export var INLINE_BASE_STYLE_ID = 'ams-inline-component-style';
153
+ export var INLINE_IMG_CLASSNAME = 'inline-loading';
154
+ export var LOADTIME_LIMIT = 15000;
155
+ export var ANIMATION_TIME = 300;
156
+ export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
135
157
  export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxeKq9R5fOJG8KAR6+Uy2vlJag8ALDmxSDa2TLWEhos5UP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pzJq4u5hj+AAAAAElFTkSuQmCC';
@@ -5,13 +5,27 @@
5
5
  * 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
- import { componentNameEnum, IcreateComponent, optionsParams } from '../../types';
9
- export declare const mixinComponentConstructor: (options: optionsParams, context: any) => void;
10
- /**
11
- * @description Create component application
12
- * @description component
13
- */
14
- export declare const createComponent: (componentNameOrParams: string | componentNameEnum | IcreateComponent, params?: IcreateComponent) => Promise<void>;
15
- export interface IcreateComponentFunc {
16
- (componentName: string | componentNameEnum, params: IcreateComponent): Promise<any>;
8
+ import ComponentApp from '../../plugin/component';
9
+ import { IcreateComponent, IoptionsParams, Iselector } from '../../types';
10
+ import CoreInstance from '../instance/index';
11
+ export declare class AMSComponent extends CoreInstance {
12
+ _componentApp: ComponentApp;
13
+ constructor(options: IoptionsParams);
14
+ private parameterInitAndCheck;
15
+ private pluginAppendIframe;
16
+ /**
17
+ * @description Create component application
18
+ * @param params - The data source created by the component, necessary paymentSessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
19
+ */
20
+ createComponent(params: IcreateComponent): Promise<void>;
21
+ /**
22
+ * @description Create and render components in the specified element area
23
+ * @param params - The data source created by the component, necessary paymentSessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
24
+ */
25
+ mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
26
+ /**
27
+ * @description Execute payment submission process
28
+ * @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
29
+ */
30
+ submit(): void;
17
31
  }