@alipay/ams-checkout 1.4.0 → 1.5.2
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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/constant/index.d.ts +53 -32
- package/esm/constant/index.js +53 -32
- package/esm/core/component/index.d.ts +23 -9
- package/esm/core/component/index.js +145 -43
- package/esm/core/drop-in/index.d.ts +4 -4
- package/esm/core/drop-in/index.js +3 -3
- package/esm/core/instance/index.d.ts +6 -15
- package/esm/core/instance/index.js +31 -53
- package/esm/image/skeleton.svg +18 -0
- package/esm/index.d.ts +4 -10
- package/esm/index.js +8 -30
- package/esm/plugin/component/cashierApp.d.ts +1 -1
- package/esm/plugin/component/cashierApp.js +16 -15
- package/esm/plugin/component/{component.style.d.ts → component.inline.style.d.ts} +4 -1
- package/esm/plugin/component/component.inline.style.js +38 -0
- package/esm/plugin/component/component.popup.style.d.ts +12 -0
- package/esm/plugin/component/component.popup.style.js +163 -0
- package/esm/plugin/component/index.d.ts +29 -32
- package/esm/plugin/component/index.js +225 -333
- package/esm/plugin/drop-in/index.d.ts +3 -5
- package/esm/plugin/drop-in/index.js +3 -3
- package/esm/request/index.d.ts +2 -2
- package/esm/request/index.js +3 -3
- package/esm/request/utils.d.ts +3 -3
- package/esm/request/utils.js +4 -4
- package/esm/service/index.d.ts +2 -2
- package/esm/types/index.d.ts +71 -34
- package/esm/types/index.js +84 -47
- package/esm/util/createIframeNode.d.ts +3 -3
- package/esm/util/createIframeNode.js +8 -8
- package/esm/util/index.d.ts +6 -4
- package/esm/util/index.js +22 -5
- package/esm/util/mock.js +1 -2
- package/package.json +1 -1
- package/esm/plugin/component/component.style.js +0 -15
package/esm/constant/index.d.ts
CHANGED
@@ -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
|
-
|
10
|
-
|
10
|
+
code: eventCodeEnum;
|
11
|
+
message: string;
|
11
12
|
};
|
12
13
|
NOT_JSON_FORMAT: {
|
13
|
-
|
14
|
-
|
14
|
+
code: eventCodeEnum;
|
15
|
+
message: string;
|
15
16
|
};
|
16
17
|
SDK_COMPATIBILITY_ISSUES: {
|
17
|
-
|
18
|
+
code: eventCodeEnum;
|
18
19
|
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
19
|
-
|
20
|
-
|
20
|
+
code: eventCodeEnum;
|
21
|
+
message: string;
|
21
22
|
};
|
22
23
|
FAILED_TO_CREATE_IFRAME: {
|
23
|
-
|
24
|
-
|
24
|
+
code: eventCodeEnum;
|
25
|
+
message: string;
|
25
26
|
};
|
26
27
|
};
|
27
28
|
INIT_PARAMETER_ERROR: {
|
28
|
-
|
29
|
+
code: eventCodeEnum;
|
29
30
|
UI_MODE_NOT_SUPPORTED: {
|
30
|
-
|
31
|
-
|
31
|
+
code: eventCodeEnum;
|
32
|
+
message: string;
|
32
33
|
};
|
33
34
|
ENVIRONMENT_ERROR: {
|
34
|
-
|
35
|
-
|
35
|
+
code: eventCodeEnum;
|
36
|
+
message: string;
|
36
37
|
};
|
37
38
|
MODE_ERROR: {
|
38
|
-
|
39
|
-
|
39
|
+
code: eventCodeEnum;
|
40
|
+
message: string;
|
40
41
|
};
|
41
42
|
LOCALE_ERROR: {
|
42
|
-
|
43
|
-
|
43
|
+
code: eventCodeEnum;
|
44
|
+
message: string;
|
44
45
|
};
|
45
46
|
NET_MODE_NOT_SUPPORT: {
|
46
|
-
|
47
|
-
|
47
|
+
code: eventCodeEnum;
|
48
|
+
message: string;
|
48
49
|
};
|
49
50
|
EVENT_ERROR: {
|
50
|
-
|
51
|
-
|
51
|
+
code: eventCodeEnum;
|
52
|
+
message: string;
|
52
53
|
};
|
53
54
|
};
|
54
55
|
CREATEPAYMENT_PARAMETER_ERROR: {
|
55
|
-
|
56
|
+
code: eventCodeEnum;
|
56
57
|
};
|
57
58
|
CONFIRMPAYMENT_PARAMETER_ERROR: {
|
58
|
-
|
59
|
+
code: string;
|
59
60
|
};
|
60
61
|
CREATECOMPONENT_ERROR: {
|
61
|
-
|
62
|
-
|
62
|
+
code: eventCodeEnum;
|
63
|
+
message: string;
|
63
64
|
SINGLETON_COMPONENT_ERROR: {
|
64
|
-
|
65
|
-
|
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
|
-
|
74
|
+
code: eventCodeEnum;
|
70
75
|
REDIRECT_ERROR: {
|
71
|
-
|
72
|
-
|
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
|
-
|
114
|
+
close: {
|
106
115
|
name: string;
|
107
116
|
uniqueKey: string;
|
108
117
|
};
|
@@ -132,5 +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;
|
135
156
|
export declare const closeImg = "https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg";
|
136
157
|
export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3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2mVh1FkjfAkohJgLj1GEVtZIRFACP0fCm/AgmdREnzYqIRhFHkvq+J77MBFQpEPpCQOYPcntwIWeK6Mu0P9D9pzJq4u5hj+AAAAAElFTkSuQmCC";
|
package/esm/constant/index.js
CHANGED
@@ -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
|
-
|
10
|
-
|
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
|
-
|
14
|
-
|
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
|
-
|
18
|
+
code: eventCodeEnum.SDK_INTERNAL_ERROR,
|
18
19
|
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
-
|
24
|
+
code: eventCodeEnum.SDK_INTERNAL_ERROR,
|
25
|
+
message: 'Failed to create iframe'
|
25
26
|
}
|
26
27
|
},
|
27
28
|
INIT_PARAMETER_ERROR: {
|
28
|
-
|
29
|
+
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
|
29
30
|
UI_MODE_NOT_SUPPORTED: {
|
30
|
-
|
31
|
-
|
31
|
+
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
|
32
|
+
message: 'This UI mode is not supported'
|
32
33
|
},
|
33
34
|
ENVIRONMENT_ERROR: {
|
34
|
-
|
35
|
-
|
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
|
-
|
39
|
-
|
39
|
+
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
|
40
|
+
message: 'mode value not in enum'
|
40
41
|
},
|
41
42
|
LOCALE_ERROR: {
|
42
|
-
|
43
|
-
|
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
|
-
|
47
|
-
|
47
|
+
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
|
48
|
+
message: 'The network mode is not supported'
|
48
49
|
},
|
49
50
|
EVENT_ERROR: {
|
50
|
-
|
51
|
-
|
51
|
+
code: eventCodeEnum.SDK_INIT_PARAMETER_ERROR,
|
52
|
+
message: 'Parameter type should be function'
|
52
53
|
}
|
53
54
|
},
|
54
55
|
CREATEPAYMENT_PARAMETER_ERROR: {
|
55
|
-
|
56
|
+
code: eventCodeEnum.SDK_CREATEPAYMENT_PARAMETER_ERROR
|
56
57
|
},
|
57
58
|
CONFIRMPAYMENT_PARAMETER_ERROR: {
|
58
|
-
|
59
|
+
code: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
|
59
60
|
},
|
60
61
|
CREATECOMPONENT_ERROR: {
|
61
|
-
|
62
|
-
|
62
|
+
code: eventCodeEnum.SDK_CREATECOMPONENT_ERROR,
|
63
|
+
message: 'Failed to create component',
|
63
64
|
SINGLETON_COMPONENT_ERROR: {
|
64
|
-
|
65
|
-
|
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
|
-
|
74
|
+
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
70
75
|
REDIRECT_ERROR: {
|
71
|
-
|
72
|
-
|
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
|
-
|
114
|
+
close: {
|
106
115
|
name: 'onClose',
|
107
116
|
uniqueKey: 'userOnClose'
|
108
117
|
},
|
@@ -132,5 +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;
|
135
156
|
export var closeImg = 'https://cdn.marmot-cloud.com/storage/2023/5/18/1692a487-99b5-4314-9d6f-e9814bc1ca41.svg';
|
136
157
|
export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEBAMAAACjap6UAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAITgAACE4AUWWMWAAAAAqUExURUdwTKe3zKGxyK27z7K/05ytxLbD1bvH2Jaowb/K28DL3JCjvYueucDL2xLcxpgAAAAOdFJOUwCKoHRft0w5zCgY4fYKKSYvdQAABvtJREFUaN6lmt+LG1UUx6fddbcZHOgkpWutBTPbVBEfNp1xS6uF2oQURUGnBBbqw7YdsooV2ipZ06c+uBBZCistDRMUqgV1gnnwJ4HMg2jBh+Qh1bW1A/lfPOfcO9lkNz/m3j3dh2XT+eznfM+dmTvTKsroUovpeGotbyetlXuKTH17vFxeKq9R5fOJG8KAR6+Uy2vlJag8ALDmxSDa2TLWEhos5UPKnEA7sy8yALNYyod1/mpUwiYpQB9MYy1sJZWybwgRgLGGDLRAhg1ftn0qIqHBkijzefBO7HwKRN6cTJguNxoho38gjGHb7y5PTHJpvdyLgsaap3UBSdjISKWMCZlqzzTBosGj4CMJC+LEmh8/20+b62jRM+EGjIAQsLDnxhH+IQduUS7P50p1R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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
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
}
|
@@ -1,3 +1,17 @@
|
|
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 _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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
6
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
8
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
9
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
10
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
11
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
12
|
+
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; }
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
1
15
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
16
|
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."); }
|
3
17
|
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); }
|
@@ -12,11 +26,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
26
|
* 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.
|
13
27
|
*/
|
14
28
|
|
15
|
-
import { COMPONENTPLUGINID, ERRORMESSAGE } from "../../constant";
|
29
|
+
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
16
30
|
import ComponentApp from "../../plugin/component";
|
17
|
-
import { componentSignEnum,
|
31
|
+
import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
18
32
|
import { isPC } from "../../util";
|
19
33
|
import { createIframeNode } from "../../util/createIframeNode";
|
34
|
+
import CoreInstance from "../instance/index";
|
20
35
|
var getComponentSign = function getComponentSign(params) {
|
21
36
|
var _params$paymentSessio = params.paymentSessionConfig,
|
22
37
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
@@ -52,49 +67,136 @@ var handlePaymentSessionData = function handlePaymentSessionData(originPaymentSe
|
|
52
67
|
resetEasyPaySceneVersion(parseData);
|
53
68
|
return [parseData, paymentSessionData];
|
54
69
|
};
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
var _params = params;
|
72
|
-
if (_params && !_params.paymentSessionData) {
|
73
|
-
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR);
|
70
|
+
var handleParams = function handleParams(params) {
|
71
|
+
var _params = Object.assign({
|
72
|
+
paymentSessionMetaData: {},
|
73
|
+
renderDisplayType: renderDisplayTypeEnum.popup
|
74
|
+
}, params);
|
75
|
+
var _handlePaymentSession = handlePaymentSessionData(_params.paymentSessionData),
|
76
|
+
_handlePaymentSession2 = _slicedToArray(_handlePaymentSession, 2),
|
77
|
+
parseData = _handlePaymentSession2[0],
|
78
|
+
paymentSessionData = _handlePaymentSession2[1];
|
79
|
+
var componentSign = getComponentSign(parseData);
|
80
|
+
if (componentSign === componentSignEnum.NONE) {
|
81
|
+
// eslint-disable-next-line prefer-promise-reject-errors
|
82
|
+
return Promise.reject({
|
83
|
+
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
84
|
+
message: "Abnormal response data, interface failure, or unsupported payment method"
|
85
|
+
});
|
74
86
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
87
|
+
_params.paymentSessionData = paymentSessionData;
|
88
|
+
_params.paymentSessionMetaData = parseData;
|
89
|
+
return Promise.resolve({
|
90
|
+
iframeNodesParams: _params,
|
91
|
+
componentSign: componentSign
|
92
|
+
});
|
93
|
+
};
|
94
|
+
export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
95
|
+
_inherits(AMSComponent, _CoreInstance);
|
96
|
+
var _super = _createSuper(AMSComponent);
|
97
|
+
function AMSComponent(options) {
|
98
|
+
var _this;
|
99
|
+
_classCallCheck(this, AMSComponent);
|
100
|
+
_this = _super.call(this, options);
|
101
|
+
// Instantiate the plug-in and set render
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "_componentApp", void 0);
|
103
|
+
var ComponentPlugin = new ComponentApp();
|
104
|
+
ComponentPlugin.setRender(createIframeNode);
|
105
|
+
// Register Cashier Application Plug in
|
106
|
+
_this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
|
107
|
+
_this._componentApp = _this._getPlugin(COMPONENTPLUGINID);
|
108
|
+
return _this;
|
78
109
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
110
|
+
_createClass(AMSComponent, [{
|
111
|
+
key: "parameterInitAndCheck",
|
112
|
+
value: function parameterInitAndCheck(_ref) {
|
113
|
+
var params = _ref.params,
|
114
|
+
selector = _ref.selector,
|
115
|
+
renderDisplayType = _ref.renderDisplayType;
|
116
|
+
this.options.mode = modeEnum.component;
|
117
|
+
this.options.networkMode = this.options.networkMode || networkModeEnum.session;
|
118
|
+
var _params = Object.assign({
|
119
|
+
selector: selector,
|
120
|
+
renderDisplayType: renderDisplayType
|
121
|
+
}, params);
|
122
|
+
if (_params && !_params.paymentSessionData) {
|
123
|
+
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
|
124
|
+
}
|
125
|
+
if (this.options.networkMode === networkModeEnum.proxy) {
|
126
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
127
|
+
return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
|
128
|
+
}
|
129
|
+
return Promise.resolve(_params);
|
88
130
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
131
|
+
}, {
|
132
|
+
key: "pluginAppendIframe",
|
133
|
+
value: function pluginAppendIframe(appendParams) {
|
134
|
+
try {
|
135
|
+
return this._componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams);
|
136
|
+
} catch (error) {
|
137
|
+
return Promise.reject(error);
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* @description Create component application
|
143
|
+
* @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.
|
144
|
+
*/
|
145
|
+
}, {
|
146
|
+
key: "createComponent",
|
147
|
+
value: function createComponent(params) {
|
148
|
+
var _this2 = this;
|
149
|
+
return this.parameterInitAndCheck({
|
150
|
+
params: params,
|
151
|
+
renderDisplayType: renderDisplayTypeEnum.popup
|
152
|
+
}).then(function (_params) {
|
153
|
+
return handleParams(_params);
|
154
|
+
}).catch(function (error) {
|
155
|
+
_this2._eventCenter.emit(EVENT.error.name, error);
|
156
|
+
return Promise.reject(error);
|
157
|
+
}).then(function (appendParams) {
|
158
|
+
return _this2.pluginAppendIframe(appendParams);
|
95
159
|
});
|
96
|
-
} catch (error) {
|
97
|
-
reject(error);
|
98
160
|
}
|
99
|
-
|
100
|
-
|
161
|
+
/**
|
162
|
+
* @description Create and render components in the specified element area
|
163
|
+
* @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.
|
164
|
+
*/
|
165
|
+
}, {
|
166
|
+
key: "mountComponent",
|
167
|
+
value: function mountComponent(params, selector) {
|
168
|
+
var _this3 = this;
|
169
|
+
return this.parameterInitAndCheck({
|
170
|
+
params: params,
|
171
|
+
renderDisplayType: renderDisplayTypeEnum.inline,
|
172
|
+
selector: selector
|
173
|
+
}).then(function (_params) {
|
174
|
+
return handleParams(_params);
|
175
|
+
}).catch(function (error) {
|
176
|
+
_this3._eventCenter.emit(EVENT.error.name, error);
|
177
|
+
return Promise.reject(error);
|
178
|
+
}).then(function (appendParams) {
|
179
|
+
return _this3.pluginAppendIframe(appendParams);
|
180
|
+
});
|
181
|
+
}
|
182
|
+
/**
|
183
|
+
* @description Execute payment submission process
|
184
|
+
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
185
|
+
*/
|
186
|
+
}, {
|
187
|
+
key: "submit",
|
188
|
+
value: function submit() {
|
189
|
+
try {
|
190
|
+
this._componentApp.dispatchToApp({
|
191
|
+
context: {
|
192
|
+
event: 'submitPay',
|
193
|
+
data: {}
|
194
|
+
}
|
195
|
+
});
|
196
|
+
} catch (error) {
|
197
|
+
console.error(error);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}]);
|
201
|
+
return AMSComponent;
|
202
|
+
}(CoreInstance);
|
@@ -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 {
|
9
|
-
export declare const mixinDropInConstructor: (options:
|
8
|
+
import { IcreatePaymentParams, IoptionsParams } from '../../types';
|
9
|
+
export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
|
10
10
|
/**
|
11
11
|
* @description Create checkout application
|
12
12
|
* @description drop-in
|
13
13
|
*/
|
14
|
-
export declare const createPayment: (params:
|
14
|
+
export declare const createPayment: (params: IcreatePaymentParams) => Promise<void>;
|
15
15
|
export interface IcreatePaymentFunc {
|
16
|
-
(params:
|
16
|
+
(params: IcreatePaymentParams): 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,
|
14
|
+
import { messageName, networkModeEnum } 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 ===
|
31
|
+
if (this.options.networkMode === networkModeEnum.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.
|
41
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
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,
|
1
|
+
import type { AMSCheckoutOptions, IcheckoutState, IoptionsParams } from '../../types/index';
|
2
2
|
import { EventCenter } from '../../util/index';
|
3
3
|
export default class AMSSDK {
|
4
4
|
options: AMSCheckoutOptions;
|
5
|
-
checkoutState:
|
6
|
-
|
5
|
+
checkoutState: IcheckoutState;
|
6
|
+
_eventCenter: EventCenter;
|
7
7
|
protected plugins: Map<string, any>;
|
8
8
|
_instanceId: string;
|
9
|
-
constructor(options:
|
9
|
+
constructor(options: IoptionsParams);
|
10
10
|
/**
|
11
11
|
* @description Destroy and process some contents of the plug-in
|
12
12
|
*/
|
13
|
-
|
13
|
+
unmount(): 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
|
-
_getPlugin(pluginId: string): any;
|
37
|
+
protected _getPlugin(pluginId: string): any;
|
38
38
|
/**
|
39
39
|
* @description Execute to open app or jump link
|
40
40
|
*/
|
@@ -47,13 +47,4 @@ 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
|
56
|
-
*/
|
57
|
-
onSizeChanged(event: callOnSizeChanged): void;
|
58
|
-
onLog(event: callOnLog): void;
|
59
50
|
}
|