@alipay/ams-checkout 0.0.1694675458-dev.0 → 1.3.1-dev

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 (69) hide show
  1. package/{esm/config/request.d.ts → dist/esm/config/index.d.ts} +1 -0
  2. package/{esm/config/request.js → dist/esm/config/index.js} +3 -1
  3. package/{esm → dist/esm}/constant/index.d.ts +32 -54
  4. package/{esm → dist/esm}/constant/index.js +32 -54
  5. package/dist/esm/core/component/index.d.ts +17 -0
  6. package/dist/esm/core/component/index.js +127 -0
  7. package/{esm → dist/esm}/core/drop-in/index.d.ts +4 -4
  8. package/{esm → dist/esm}/core/drop-in/index.js +3 -3
  9. package/{esm → dist/esm}/core/instance/index.d.ts +23 -6
  10. package/{esm → dist/esm}/core/instance/index.js +75 -31
  11. package/{esm → dist/esm}/index.d.ts +10 -4
  12. package/{esm → dist/esm}/index.js +30 -8
  13. package/{esm → dist/esm}/plugin/component/cashierApp.d.ts +6 -5
  14. package/{esm → dist/esm}/plugin/component/cashierApp.js +74 -57
  15. package/{esm/plugin/component/component.inline.style.d.ts → dist/esm/plugin/component/component.style.d.ts} +1 -4
  16. package/dist/esm/plugin/component/component.style.js +15 -0
  17. package/{esm → dist/esm}/plugin/component/index.d.ts +33 -31
  18. package/{esm → dist/esm}/plugin/component/index.js +356 -273
  19. package/{esm → dist/esm}/plugin/drop-in/index.d.ts +5 -3
  20. package/{esm → dist/esm}/plugin/drop-in/index.js +3 -3
  21. package/{esm → dist/esm}/request/index.d.ts +2 -2
  22. package/{esm → dist/esm}/request/index.js +9 -9
  23. package/{esm → dist/esm}/request/utils.d.ts +3 -3
  24. package/{esm → dist/esm}/request/utils.js +4 -4
  25. package/dist/esm/service/index.d.ts +2 -0
  26. package/{esm → dist/esm}/types/index.d.ts +40 -99
  27. package/dist/esm/types/index.js +94 -0
  28. package/dist/esm/util/createIframeNode.d.ts +5 -0
  29. package/{esm → dist/esm}/util/createIframeNode.js +8 -8
  30. package/{esm → dist/esm}/util/index.d.ts +4 -6
  31. package/{esm → dist/esm}/util/index.js +7 -26
  32. package/dist/esm/util/mock.js +4 -0
  33. package/dist/umd/ams-checkout.min.js +1 -1
  34. package/package.json +54 -1
  35. package/esm/config/index.d.ts +0 -2
  36. package/esm/config/index.js +0 -17
  37. package/esm/core/component/index.d.ts +0 -31
  38. package/esm/core/component/index.js +0 -202
  39. package/esm/image/skeleton.svg +0 -18
  40. package/esm/plugin/component/component.inline.style.js +0 -38
  41. package/esm/plugin/component/component.popup.style.d.ts +0 -12
  42. package/esm/plugin/component/component.popup.style.js +0 -163
  43. package/esm/service/index.d.ts +0 -2
  44. package/esm/types/index.js +0 -134
  45. package/esm/util/createIframeNode.d.ts +0 -5
  46. package/esm/util/mock.js +0 -3
  47. /package/{esm → dist/esm}/image/cta.svg +0 -0
  48. /package/{esm → dist/esm}/service/index.js +0 -0
  49. /package/{esm → dist/esm}/util/get.d.ts +0 -0
  50. /package/{esm → dist/esm}/util/get.js +0 -0
  51. /package/{esm → dist/esm}/util/intl-callapp/es/browser.d.ts +0 -0
  52. /package/{esm → dist/esm}/util/intl-callapp/es/browser.js +0 -0
  53. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.d.ts +0 -0
  54. /package/{esm → dist/esm}/util/intl-callapp/es/evoke.js +0 -0
  55. /package/{esm → dist/esm}/util/intl-callapp/es/generate.d.ts +0 -0
  56. /package/{esm → dist/esm}/util/intl-callapp/es/generate.js +0 -0
  57. /package/{esm → dist/esm}/util/intl-callapp/es/index.d.ts +0 -0
  58. /package/{esm → dist/esm}/util/intl-callapp/es/index.js +0 -0
  59. /package/{esm → dist/esm}/util/intl-callapp/es/main.d.ts +0 -0
  60. /package/{esm → dist/esm}/util/intl-callapp/es/main.js +0 -0
  61. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.d.ts +0 -0
  62. /package/{esm → dist/esm}/util/intl-callapp/es/openWallet.js +0 -0
  63. /package/{esm → dist/esm}/util/intl-callapp/es/types.d.ts +0 -0
  64. /package/{esm → dist/esm}/util/intl-callapp/es/types.js +0 -0
  65. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.d.ts +0 -0
  66. /package/{esm → dist/esm}/util/intl-callapp/es/utils/config.js +0 -0
  67. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.d.ts +0 -0
  68. /package/{esm → dist/esm}/util/intl-callapp/es/utils/index.js +0 -0
  69. /package/{esm → dist/esm}/util/mock.d.ts +0 -0
@@ -12,6 +12,7 @@ export declare const clientId = "5J5Y8X4E2Y25GR00690";
12
12
  export declare const tntInstId = "ALIPW3SG";
13
13
  export declare const appId = "ANTOM_PAYMENT_WEB";
14
14
  export declare const sofaId: any;
15
+ export declare const closeImg = "https://file.page.alipay.net/resource/2023/3/21/3235f64c-84a6-4e33-9567-4cedf0960229.svg";
15
16
  export declare const hostSignMap: (hostSign: string | undefined, env: string) => string;
16
17
  export declare const lightSandboxMap: (operationType: string | undefined, env: string) => {
17
18
  appId: string;
@@ -22,7 +22,9 @@ export var requestHost = {
22
22
  export var clientId = '5J5Y8X4E2Y25GR00690';
23
23
  export var tntInstId = 'ALIPW3SG';
24
24
  export var appId = 'ANTOM_PAYMENT_WEB';
25
- export var sofaId = groupId || 'GROUP_20230523202227';
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';
26
28
  export var hostSignMap = function hostSignMap(hostSign, env) {
27
29
  var map = {
28
30
  SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
@@ -4,83 +4,74 @@
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";
8
7
  export declare const ERRORMESSAGE: {
9
8
  DOMAIN_NOT_IN_WHITE_LIST: {
10
- code: eventCodeEnum;
11
- message: string;
9
+ errorCode: string;
10
+ errorMessage: string;
12
11
  };
13
12
  NOT_JSON_FORMAT: {
14
- code: eventCodeEnum;
15
- message: string;
13
+ errorCode: string;
14
+ errorMessage: string;
16
15
  };
17
16
  SDK_COMPATIBILITY_ISSUES: {
18
- code: eventCodeEnum;
17
+ errorCode: string;
19
18
  BROWSER_NOT_SUPPORT_POSTMESSAGE: {
20
- code: eventCodeEnum;
21
- message: string;
19
+ errorCode: string;
20
+ errorMessage: string;
22
21
  };
23
22
  FAILED_TO_CREATE_IFRAME: {
24
- code: eventCodeEnum;
25
- message: string;
23
+ errorCode: string;
24
+ errorMessage: string;
26
25
  };
27
26
  };
28
27
  INIT_PARAMETER_ERROR: {
29
- code: eventCodeEnum;
28
+ errorCode: string;
30
29
  UI_MODE_NOT_SUPPORTED: {
31
- code: eventCodeEnum;
32
- message: string;
30
+ errorCode: string;
31
+ errorMessage: string;
33
32
  };
34
33
  ENVIRONMENT_ERROR: {
35
- code: eventCodeEnum;
36
- message: string;
34
+ errorCode: string;
35
+ errorMessage: string;
37
36
  };
38
37
  MODE_ERROR: {
39
- code: eventCodeEnum;
40
- message: string;
38
+ errorCode: string;
39
+ errorMessage: string;
41
40
  };
42
41
  LOCALE_ERROR: {
43
- code: eventCodeEnum;
44
- message: string;
42
+ errorCode: string;
43
+ errorMessage: string;
45
44
  };
46
45
  NET_MODE_NOT_SUPPORT: {
47
- code: eventCodeEnum;
48
- message: string;
46
+ errorCode: string;
47
+ errorMessage: string;
49
48
  };
50
49
  EVENT_ERROR: {
51
- code: eventCodeEnum;
52
- message: string;
50
+ errorCode: string;
51
+ errorMessage: string;
53
52
  };
54
53
  };
55
54
  CREATEPAYMENT_PARAMETER_ERROR: {
56
- code: eventCodeEnum;
55
+ errorCode: string;
57
56
  };
58
57
  CONFIRMPAYMENT_PARAMETER_ERROR: {
59
- code: string;
58
+ errorCode: string;
60
59
  };
61
60
  CREATECOMPONENT_ERROR: {
62
- code: eventCodeEnum;
63
- message: string;
61
+ errorCode: string;
62
+ errorMessage: string;
64
63
  SINGLETON_COMPONENT_ERROR: {
65
- code: eventCodeEnum;
66
- message: string;
67
- };
68
- LOAD_APP_TIMEOUT: {
69
- code: eventCodeEnum;
70
- message: string;
64
+ errorCode: string;
65
+ errorMessage: string;
71
66
  };
72
67
  };
73
68
  SDK_CALL_URL_ERROR: {
74
- code: eventCodeEnum;
69
+ errorCode: string;
75
70
  REDIRECT_ERROR: {
76
- code: eventCodeEnum;
77
- message: string;
71
+ errorCode: string;
72
+ errorMessage: string;
78
73
  };
79
74
  };
80
- SDK_SUBMIT_ERROR: {
81
- code: eventCodeEnum;
82
- message: string;
83
- };
84
75
  };
85
76
  export declare const BASEPLUGINID = "CHECKOUT";
86
77
  export declare const COMPONENTPLUGINID = "COMPONENT";
@@ -111,7 +102,7 @@ export declare const EVENT: {
111
102
  redirect: {
112
103
  name: string;
113
104
  };
114
- close: {
105
+ onClose: {
115
106
  name: string;
116
107
  uniqueKey: string;
117
108
  };
@@ -141,17 +132,4 @@ export declare const EVENT: {
141
132
  name: string;
142
133
  };
143
134
  };
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";
157
135
  export declare const LOADINGIMG = "data:image/png;base64,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";
@@ -4,82 +4,73 @@
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";
8
7
  export var ERRORMESSAGE = {
9
8
  DOMAIN_NOT_IN_WHITE_LIST: {
10
- code: eventCodeEnum.SDK_INTERNAL_ERROR,
11
- message: 'Origin of the message is not in the white list'
9
+ errorCode: 'SDK_INTERNAL_ERROR',
10
+ errorMessage: 'Origin of the message is not in the white list'
12
11
  },
13
12
  NOT_JSON_FORMAT: {
14
- code: eventCodeEnum.SDK_INTERNAL_ERROR,
15
- message: 'The message string should conform to the json format'
13
+ errorCode: 'SDK_INTERNAL_ERROR',
14
+ errorMessage: 'The message string should conform to the json format'
16
15
  },
17
16
  SDK_COMPATIBILITY_ISSUES: {
18
- code: eventCodeEnum.SDK_INTERNAL_ERROR,
17
+ errorCode: 'SDK_INTERNAL_ERROR',
19
18
  BROWSER_NOT_SUPPORT_POSTMESSAGE: {
20
- code: eventCodeEnum.SDK_INTERNAL_ERROR,
21
- message: 'The browser does not support the postmessage communication mode'
19
+ errorCode: 'SDK_INTERNAL_ERROR',
20
+ errorMessage: 'The browser does not support the postmessage communication mode'
22
21
  },
23
22
  FAILED_TO_CREATE_IFRAME: {
24
- code: eventCodeEnum.SDK_INTERNAL_ERROR,
25
- message: 'Failed to create iframe'
23
+ errorCode: 'SDK_INTERNAL_ERROR',
24
+ errorMessage: 'Failed to create iframe'
26
25
  }
27
26
  },
28
27
  INIT_PARAMETER_ERROR: {
29
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
28
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
30
29
  UI_MODE_NOT_SUPPORTED: {
31
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
32
- message: 'This UI mode is not supported'
30
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
31
+ errorMessage: 'This UI mode is not supported'
33
32
  },
34
33
  ENVIRONMENT_ERROR: {
35
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
36
- message: 'The current input environment does not support or is not in the standard enumeration'
34
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
35
+ errorMessage: 'The current input environment does not support or is not in the standard enumeration'
37
36
  },
38
37
  MODE_ERROR: {
39
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
40
- message: 'mode value not in enum'
38
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
39
+ errorMessage: 'mode value not in enum'
41
40
  },
42
41
  LOCALE_ERROR: {
43
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
44
- message: 'The current input language does not support or is not in the standard enumeration'
42
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
43
+ errorMessage: 'The current input language does not support or is not in the standard enumeration'
45
44
  },
46
45
  NET_MODE_NOT_SUPPORT: {
47
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
48
- message: 'The network mode is not supported'
46
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
47
+ errorMessage: 'The network mode is not supported'
49
48
  },
50
49
  EVENT_ERROR: {
51
- code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
52
- message: 'Parameter type should be function'
50
+ errorCode: 'SDK_INIT_PARAMETER_ERROR',
51
+ errorMessage: 'Parameter type should be function'
53
52
  }
54
53
  },
55
54
  CREATEPAYMENT_PARAMETER_ERROR: {
56
- code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR
55
+ errorCode: 'SDK_CREATEPAYMENT_PARAMETER_ERROR'
57
56
  },
58
57
  CONFIRMPAYMENT_PARAMETER_ERROR: {
59
- code: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
58
+ errorCode: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
60
59
  },
61
60
  CREATECOMPONENT_ERROR: {
62
- code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
63
- message: 'Failed to create component',
61
+ errorCode: 'SDK_CREATECOMPONENT_ERROR',
62
+ errorMessage: 'Failed to create component',
64
63
  SINGLETON_COMPONENT_ERROR: {
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'
64
+ errorCode: 'SDK_CREATECOMPONENT_ERROR',
65
+ errorMessage: 'Only one component can be rendered simultaneously'
71
66
  }
72
67
  },
73
68
  SDK_CALL_URL_ERROR: {
74
- code: eventCodeEnum.SDK_CALL_URL_ERROR,
69
+ errorCode: 'SDK_CALL_URL_ERROR',
75
70
  REDIRECT_ERROR: {
76
- code: eventCodeEnum.SDK_CALL_URL_ERROR,
77
- message: 'Redirect data exception'
71
+ errorCode: 'SDK_CALL_URL_ERROR',
72
+ errorMessage: 'Redirect data exception'
78
73
  }
79
- },
80
- SDK_SUBMIT_ERROR: {
81
- code: eventCodeEnum.SDK_CALL_URL_ERROR,
82
- message: 'Component not created or current browser compatibility issue, not supported'
83
74
  }
84
75
  };
85
76
  export var BASEPLUGINID = 'CHECKOUT';
@@ -111,7 +102,7 @@ export var EVENT = {
111
102
  redirect: {
112
103
  name: 'onRedirect'
113
104
  },
114
- close: {
105
+ onClose: {
115
106
  name: 'onClose',
116
107
  uniqueKey: 'userOnClose'
117
108
  },
@@ -141,17 +132,4 @@ export var EVENT = {
141
132
  name: 'dismissLoading'
142
133
  }
143
134
  };
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';
157
135
  export var LOADINGIMG = 'data:image/png;base64,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';
@@ -0,0 +1,17 @@
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
+ 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>;
17
+ }
@@ -0,0 +1,127 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
+ /**
12
+ * Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
13
+ *
14
+ * 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:
15
+ * 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
16
+ * 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.
17
+ */
18
+
19
+ import { COMPONENTPLUGINID, ERRORMESSAGE } from "../../constant";
20
+ import ComponentApp from "../../plugin/component";
21
+ import { componentNameEnum, mode, networkMode, paymentMethodCategoryTypeEnum, productSceneEnum } from "../../types";
22
+ import { createIframeNode } from "../../util/createIframeNode";
23
+ var getComponentSign = function getComponentSign(params) {
24
+ var _ref = params || {},
25
+ _ref$paymentSessionCo = _ref.paymentSessionConfig,
26
+ _ref$paymentSessionCo2 = _ref$paymentSessionCo === void 0 ? {} : _ref$paymentSessionCo,
27
+ _ref$paymentSessionCo3 = _ref$paymentSessionCo2.productScene,
28
+ productScene = _ref$paymentSessionCo3 === void 0 ? '' : _ref$paymentSessionCo3,
29
+ _ref$paymentSessionCo4 = _ref$paymentSessionCo2.paymentMethodCategoryType,
30
+ paymentMethodCategoryType = _ref$paymentSessionCo4 === void 0 ? '' : _ref$paymentSessionCo4;
31
+ if (productScene === productSceneEnum.EASY_PAY) return componentNameEnum.easyPay;
32
+ if (productScene === productSceneEnum.CASHIER_PAYMENT && paymentMethodCategoryType === paymentMethodCategoryTypeEnum.CARD) return componentNameEnum.card;
33
+ if (productScene === productSceneEnum.AUTO_DEBIT) {
34
+ return componentNameEnum.autoDebit;
35
+ }
36
+ return '';
37
+ };
38
+ var parsePaymentSessionData = function parsePaymentSessionData(paymentSessionData) {
39
+ try {
40
+ return [JSON.parse(atob(paymentSessionData.split('&&')[3])), paymentSessionData.split('&&').slice(0, 3).join('&&')];
41
+ } catch (error) {
42
+ console.error('Parsing paymentSessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.');
43
+ return [{}, paymentSessionData];
44
+ }
45
+ };
46
+ export var mixinComponentConstructor = function mixinComponentConstructor(options, context) {
47
+ // Instantiate the plug-in and set render
48
+ var ComponentPlugin = new ComponentApp();
49
+ ComponentPlugin.setRender(createIframeNode);
50
+ // Register Cashier Application Plug in
51
+ context._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
52
+ };
53
+
54
+ /**
55
+ * @description Create component application
56
+ * @description component
57
+ */
58
+ export var createComponent = /*#__PURE__*/function () {
59
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(componentNameOrParams, params) {
60
+ var _this = this;
61
+ var _params;
62
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ this.options.mode = mode.component;
66
+ this.options.networkMode = this.options.networkMode || networkMode.session;
67
+ if (!(typeof componentNameOrParams === 'string' && params)) {
68
+ _context.next = 8;
69
+ break;
70
+ }
71
+ _params = params;
72
+ if (componentNameOrParams in componentNameEnum) {
73
+ _context.next = 6;
74
+ break;
75
+ }
76
+ return _context.abrupt("return", Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR));
77
+ case 6:
78
+ _context.next = 9;
79
+ break;
80
+ case 8:
81
+ _params = componentNameOrParams;
82
+ case 9:
83
+ if (!(_params && !_params.paymentSessionData)) {
84
+ _context.next = 11;
85
+ break;
86
+ }
87
+ return _context.abrupt("return", Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR));
88
+ case 11:
89
+ if (!(this.options.networkMode === networkMode.proxy)) {
90
+ _context.next = 16;
91
+ break;
92
+ }
93
+ console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
94
+ return _context.abrupt("return", Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT));
95
+ case 16:
96
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
97
+ var _parsePaymentSessionD = parsePaymentSessionData(_params.paymentSessionData),
98
+ _parsePaymentSessionD2 = _slicedToArray(_parsePaymentSessionD, 2),
99
+ parseData = _parsePaymentSessionD2[0],
100
+ paymentSessionData = _parsePaymentSessionD2[1];
101
+ var componentName = typeof componentNameOrParams === 'string' ? componentNameOrParams : getComponentSign(parseData);
102
+ if (componentName === '') {
103
+ // eslint-disable-next-line prefer-promise-reject-errors
104
+ reject("".concat(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.errorCode, "\uFF1AAbnormal response data, interface failure, or unsupported payment method"));
105
+ return;
106
+ }
107
+ _params.paymentSessionData = paymentSessionData;
108
+ _params.paymentSessionMetaData = parseData;
109
+ try {
110
+ var componentApp = _this._getPlugin(COMPONENTPLUGINID);
111
+ componentApp.appendIframeNodes(componentName, _params).then(function () {
112
+ resolve();
113
+ });
114
+ } catch (error) {
115
+ reject(error);
116
+ }
117
+ }));
118
+ case 17:
119
+ case "end":
120
+ return _context.stop();
121
+ }
122
+ }, _callee, this);
123
+ }));
124
+ return function createComponent(_x, _x2) {
125
+ return _ref2.apply(this, arguments);
126
+ };
127
+ }();
@@ -5,15 +5,15 @@
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 { IcreatePaymentParams, IoptionsParams } from '../../types';
9
- export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
8
+ import { createPaymentParams, optionsParams } from '../../types';
9
+ export declare const mixinDropInConstructor: (options: optionsParams, context: any) => void;
10
10
  /**
11
11
  * @description Create checkout application
12
12
  * @description drop-in
13
13
  */
14
- export declare const createPayment: (params: IcreatePaymentParams) => Promise<void>;
14
+ export declare const createPayment: (params: createPaymentParams) => Promise<void>;
15
15
  export interface IcreatePaymentFunc {
16
- (params: IcreatePaymentParams): Promise<void>;
16
+ (params: createPaymentParams): Promise<void>;
17
17
  }
18
18
  /**
19
19
  * @description Take action on the interface result of payment submission
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
 
12
12
  import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
13
13
  import CheckoutApp from "../../plugin/drop-in";
14
- import { messageName, networkModeEnum } from "../../types";
14
+ import { messageName, networkMode } from "../../types";
15
15
  import { createIframeNode } from "../../util/createIframeNode";
16
16
  export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
17
17
  // Instantiate the plug-in and set render
@@ -28,7 +28,7 @@ export var mixinDropInConstructor = function mixinDropInConstructor(options, con
28
28
  */
29
29
  export var createPayment = function createPayment(params) {
30
30
  var _this = this;
31
- if (this.options.networkMode === networkModeEnum.proxy) {
31
+ if (this.options.networkMode === networkMode.proxy) {
32
32
  return new Promise(function (resolve, reject) {
33
33
  try {
34
34
  var checkoutApp = _this._getPlugin(BASEPLUGINID);
@@ -38,7 +38,7 @@ export var createPayment = function createPayment(params) {
38
38
  }
39
39
  });
40
40
  } else {
41
- console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
41
+ console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.errorMessage);
42
42
  return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
43
43
  }
44
44
  };
@@ -1,16 +1,16 @@
1
- import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams } from '../../types/index';
1
+ import type { AMSCheckoutOptions, callOnError, callOnSizeChanged, checkoutState, optionsParams } from '../../types/index';
2
2
  import { EventCenter } from '../../util/index';
3
3
  export default class AMSSDK {
4
4
  options: AMSCheckoutOptions;
5
- checkoutState: IcheckoutState;
6
- _eventCenter: EventCenter;
5
+ checkoutState: checkoutState;
6
+ eventCenter: EventCenter;
7
7
  protected plugins: Map<string, any>;
8
8
  _instanceId: string;
9
- constructor(options: IoptionsParams);
9
+ constructor(options: optionsParams);
10
10
  /**
11
11
  * @description Destroy and process some contents of the plug-in
12
12
  */
13
- unmount(): void;
13
+ destroy(): void;
14
14
  /**
15
15
  * @description Set the sdk basic configuration
16
16
  */
@@ -34,7 +34,7 @@ export default class AMSSDK {
34
34
  /**
35
35
  * @description Get Plug-in
36
36
  */
37
- protected _getPlugin(pluginId: string): any;
37
+ _getPlugin(pluginId: string): any;
38
38
  /**
39
39
  * @description Execute to open app or jump link
40
40
  */
@@ -47,4 +47,21 @@ export default class AMSSDK {
47
47
  * @description Overlay Subscription
48
48
  */
49
49
  protected _overrideSubscription(name: string, func: any, funcKey: string): void;
50
+ /**
51
+ * @description Create an event handler, called when an error occurs in AMSCheckout.
52
+ */
53
+ onError(event: callOnError): void;
54
+ /**
55
+ * @description Create an event handler, called when the checkout view is available for interaction.
56
+ * mode: dropin
57
+ */
58
+ /**
59
+ * @description Create an event handler, called after the user selects the payment method
60
+ * mode: dropin
61
+ */
62
+ /**
63
+ * @description Create an event handler
64
+ */
65
+ onSizeChanged(event: callOnSizeChanged): void;
66
+ onLog(event: callOnSizeChanged): void;
50
67
  }