@alipay/ams-checkout 0.0.1691379784-dev.6 → 0.0.1691743027-dev.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 +40 -32
- package/esm/constant/index.js +40 -32
- package/esm/core/component/index.d.ts +22 -9
- package/esm/core/component/index.js +148 -43
- package/esm/core/drop-in/index.d.ts +1 -1
- 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 +15 -15
- package/esm/plugin/component/component.style.d.ts +4 -1
- package/esm/plugin/component/component.style.js +32 -4
- package/esm/plugin/component/index.d.ts +16 -9
- package/esm/plugin/component/index.js +213 -157
- package/esm/plugin/drop-in/index.js +1 -1
- 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 +61 -34
- package/esm/types/index.js +73 -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/constant/index.d.ts
CHANGED
@@ -6,72 +6,80 @@
|
|
6
6
|
*/
|
7
7
|
export declare const ERRORMESSAGE: {
|
8
8
|
DOMAIN_NOT_IN_WHITE_LIST: {
|
9
|
-
|
10
|
-
|
9
|
+
code: string;
|
10
|
+
message: string;
|
11
11
|
};
|
12
12
|
NOT_JSON_FORMAT: {
|
13
|
-
|
14
|
-
|
13
|
+
code: string;
|
14
|
+
message: string;
|
15
15
|
};
|
16
16
|
SDK_COMPATIBILITY_ISSUES: {
|
17
|
-
|
17
|
+
code: string;
|
18
18
|
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
19
|
-
|
20
|
-
|
19
|
+
code: string;
|
20
|
+
message: string;
|
21
21
|
};
|
22
22
|
FAILED_TO_CREATE_IFRAME: {
|
23
|
-
|
24
|
-
|
23
|
+
code: string;
|
24
|
+
message: string;
|
25
25
|
};
|
26
26
|
};
|
27
27
|
INIT_PARAMETER_ERROR: {
|
28
|
-
|
28
|
+
code: string;
|
29
29
|
UI_MODE_NOT_SUPPORTED: {
|
30
|
-
|
31
|
-
|
30
|
+
code: string;
|
31
|
+
message: string;
|
32
32
|
};
|
33
33
|
ENVIRONMENT_ERROR: {
|
34
|
-
|
35
|
-
|
34
|
+
code: string;
|
35
|
+
message: string;
|
36
36
|
};
|
37
37
|
MODE_ERROR: {
|
38
|
-
|
39
|
-
|
38
|
+
code: string;
|
39
|
+
message: string;
|
40
40
|
};
|
41
41
|
LOCALE_ERROR: {
|
42
|
-
|
43
|
-
|
42
|
+
code: string;
|
43
|
+
message: string;
|
44
44
|
};
|
45
45
|
NET_MODE_NOT_SUPPORT: {
|
46
|
-
|
47
|
-
|
46
|
+
code: string;
|
47
|
+
message: string;
|
48
48
|
};
|
49
49
|
EVENT_ERROR: {
|
50
|
-
|
51
|
-
|
50
|
+
code: string;
|
51
|
+
message: string;
|
52
52
|
};
|
53
53
|
};
|
54
54
|
CREATEPAYMENT_PARAMETER_ERROR: {
|
55
|
-
|
55
|
+
code: string;
|
56
56
|
};
|
57
57
|
CONFIRMPAYMENT_PARAMETER_ERROR: {
|
58
|
-
|
58
|
+
code: string;
|
59
59
|
};
|
60
60
|
CREATECOMPONENT_ERROR: {
|
61
|
-
|
62
|
-
|
61
|
+
code: string;
|
62
|
+
message: string;
|
63
63
|
SINGLETON_COMPONENT_ERROR: {
|
64
|
-
|
65
|
-
|
64
|
+
code: string;
|
65
|
+
message: string;
|
66
|
+
};
|
67
|
+
LOAD_APP_TIMEOUT: {
|
68
|
+
code: string;
|
69
|
+
message: string;
|
66
70
|
};
|
67
71
|
};
|
68
72
|
SDK_CALL_URL_ERROR: {
|
69
|
-
|
73
|
+
code: string;
|
70
74
|
REDIRECT_ERROR: {
|
71
|
-
|
72
|
-
|
75
|
+
code: string;
|
76
|
+
message: string;
|
73
77
|
};
|
74
78
|
};
|
79
|
+
SDK_SUBMIT_ERROR: {
|
80
|
+
code: string;
|
81
|
+
message: string;
|
82
|
+
};
|
75
83
|
};
|
76
84
|
export declare const BASEPLUGINID = "CHECKOUT";
|
77
85
|
export declare const COMPONENTPLUGINID = "COMPONENT";
|
@@ -102,7 +110,7 @@ export declare const EVENT: {
|
|
102
110
|
redirect: {
|
103
111
|
name: string;
|
104
112
|
};
|
105
|
-
|
113
|
+
close: {
|
106
114
|
name: string;
|
107
115
|
uniqueKey: string;
|
108
116
|
};
|
package/esm/constant/index.js
CHANGED
@@ -6,71 +6,79 @@
|
|
6
6
|
*/
|
7
7
|
export var ERRORMESSAGE = {
|
8
8
|
DOMAIN_NOT_IN_WHITE_LIST: {
|
9
|
-
|
10
|
-
|
9
|
+
code: 'SDK_INTERNAL_ERROR',
|
10
|
+
message: 'Origin of the message is not in the white list'
|
11
11
|
},
|
12
12
|
NOT_JSON_FORMAT: {
|
13
|
-
|
14
|
-
|
13
|
+
code: 'SDK_INTERNAL_ERROR',
|
14
|
+
message: 'The message string should conform to the json format'
|
15
15
|
},
|
16
16
|
SDK_COMPATIBILITY_ISSUES: {
|
17
|
-
|
17
|
+
code: 'SDK_INTERNAL_ERROR',
|
18
18
|
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
19
|
-
|
20
|
-
|
19
|
+
code: 'SDK_INTERNAL_ERROR',
|
20
|
+
message: 'The browser does not support the postmessage communication mode'
|
21
21
|
},
|
22
22
|
FAILED_TO_CREATE_IFRAME: {
|
23
|
-
|
24
|
-
|
23
|
+
code: 'SDK_INTERNAL_ERROR',
|
24
|
+
message: 'Failed to create iframe'
|
25
25
|
}
|
26
26
|
},
|
27
27
|
INIT_PARAMETER_ERROR: {
|
28
|
-
|
28
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
29
29
|
UI_MODE_NOT_SUPPORTED: {
|
30
|
-
|
31
|
-
|
30
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
31
|
+
message: 'This UI mode is not supported'
|
32
32
|
},
|
33
33
|
ENVIRONMENT_ERROR: {
|
34
|
-
|
35
|
-
|
34
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
35
|
+
message: 'The current input environment does not support or is not in the standard enumeration'
|
36
36
|
},
|
37
37
|
MODE_ERROR: {
|
38
|
-
|
39
|
-
|
38
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
39
|
+
message: 'mode value not in enum'
|
40
40
|
},
|
41
41
|
LOCALE_ERROR: {
|
42
|
-
|
43
|
-
|
42
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
43
|
+
message: 'The current input language does not support or is not in the standard enumeration'
|
44
44
|
},
|
45
45
|
NET_MODE_NOT_SUPPORT: {
|
46
|
-
|
47
|
-
|
46
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
47
|
+
message: 'The network mode is not supported'
|
48
48
|
},
|
49
49
|
EVENT_ERROR: {
|
50
|
-
|
51
|
-
|
50
|
+
code: 'SDK_INIT_PARAMETER_ERROR',
|
51
|
+
message: 'Parameter type should be function'
|
52
52
|
}
|
53
53
|
},
|
54
54
|
CREATEPAYMENT_PARAMETER_ERROR: {
|
55
|
-
|
55
|
+
code: 'SDK_CREATEPAYMENT_PARAMETER_ERROR'
|
56
56
|
},
|
57
57
|
CONFIRMPAYMENT_PARAMETER_ERROR: {
|
58
|
-
|
58
|
+
code: 'SDK_CONFIRMPAYMENT_PARAMETER_ERROR'
|
59
59
|
},
|
60
60
|
CREATECOMPONENT_ERROR: {
|
61
|
-
|
62
|
-
|
61
|
+
code: 'SDK_CREATECOMPONENT_ERROR',
|
62
|
+
message: 'Failed to create component',
|
63
63
|
SINGLETON_COMPONENT_ERROR: {
|
64
|
-
|
65
|
-
|
64
|
+
code: 'SDK_CREATECOMPONENT_ERROR',
|
65
|
+
message: 'Only one component can be rendered simultaneously'
|
66
|
+
},
|
67
|
+
LOAD_APP_TIMEOUT: {
|
68
|
+
code: 'SDK_CREATECOMPONENT_ERROR',
|
69
|
+
message: 'Load resource timeout'
|
66
70
|
}
|
67
71
|
},
|
68
72
|
SDK_CALL_URL_ERROR: {
|
69
|
-
|
73
|
+
code: 'SDK_CALL_URL_ERROR',
|
70
74
|
REDIRECT_ERROR: {
|
71
|
-
|
72
|
-
|
75
|
+
code: 'SDK_CALL_URL_ERROR',
|
76
|
+
message: 'Redirect data exception'
|
73
77
|
}
|
78
|
+
},
|
79
|
+
SDK_SUBMIT_ERROR: {
|
80
|
+
code: 'SDK_SUBMIT_ERROR',
|
81
|
+
message: 'Component not created or current browser compatibility issue, not supported'
|
74
82
|
}
|
75
83
|
};
|
76
84
|
export var BASEPLUGINID = 'CHECKOUT';
|
@@ -102,7 +110,7 @@ export var EVENT = {
|
|
102
110
|
redirect: {
|
103
111
|
name: 'onRedirect'
|
104
112
|
},
|
105
|
-
|
113
|
+
close: {
|
106
114
|
name: 'onClose',
|
107
115
|
uniqueKey: 'userOnClose'
|
108
116
|
},
|
@@ -5,13 +5,26 @@
|
|
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 { IcreateComponent,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
import { IcreateComponent, IoptionsParams, Iselector } from '../../types';
|
9
|
+
import CoreInstance from '../instance/index';
|
10
|
+
export declare class AMSComponent extends CoreInstance {
|
11
|
+
private componentApp;
|
12
|
+
constructor(options: IoptionsParams);
|
13
|
+
private parameterInitAndCheck;
|
14
|
+
private pluginAppendIframe;
|
15
|
+
/**
|
16
|
+
* @description Create component application
|
17
|
+
* @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.
|
18
|
+
*/
|
19
|
+
createComponent(params: IcreateComponent): Promise<void>;
|
20
|
+
/**
|
21
|
+
* @description Create and render components in the specified element area
|
22
|
+
* @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.
|
23
|
+
*/
|
24
|
+
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
25
|
+
/**
|
26
|
+
* @description Execute payment submission process
|
27
|
+
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
28
|
+
*/
|
29
|
+
submit(): void;
|
17
30
|
}
|
@@ -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,139 @@ 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
|
-
var _this = this;
|
69
|
-
this.options.mode = mode.component;
|
70
|
-
this.options.networkMode = this.options.networkMode || networkMode.session;
|
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("".concat(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code, "\uFF1AAbnormal response data, interface failure, or unsupported payment method"));
|
74
83
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
84
|
+
_params.paymentSessionData = paymentSessionData;
|
85
|
+
_params.paymentSessionMetaData = parseData;
|
86
|
+
return Promise.resolve({
|
87
|
+
iframeNodesParams: _params,
|
88
|
+
componentSign: componentSign
|
89
|
+
});
|
90
|
+
};
|
91
|
+
export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
92
|
+
_inherits(AMSComponent, _CoreInstance);
|
93
|
+
var _super = _createSuper(AMSComponent);
|
94
|
+
function AMSComponent(options) {
|
95
|
+
var _this;
|
96
|
+
_classCallCheck(this, AMSComponent);
|
97
|
+
_this = _super.call(this, options);
|
98
|
+
// Instantiate the plug-in and set render
|
99
|
+
_defineProperty(_assertThisInitialized(_this), "componentApp", void 0);
|
100
|
+
var ComponentPlugin = new ComponentApp();
|
101
|
+
ComponentPlugin.setRender(createIframeNode);
|
102
|
+
// Register Cashier Application Plug in
|
103
|
+
_this._registerPlugin(COMPONENTPLUGINID, ComponentPlugin);
|
104
|
+
_this.componentApp = _this._getPlugin(COMPONENTPLUGINID);
|
105
|
+
return _this;
|
78
106
|
}
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
107
|
+
_createClass(AMSComponent, [{
|
108
|
+
key: "parameterInitAndCheck",
|
109
|
+
value: function parameterInitAndCheck(_ref) {
|
110
|
+
var params = _ref.params,
|
111
|
+
selector = _ref.selector,
|
112
|
+
renderDisplayType = _ref.renderDisplayType;
|
113
|
+
this.options.mode = modeEnum.component;
|
114
|
+
this.options.networkMode = this.options.networkMode || networkModeEnum.session;
|
115
|
+
var _params = Object.assign({
|
116
|
+
selector: selector,
|
117
|
+
renderDisplayType: renderDisplayType
|
118
|
+
}, params);
|
119
|
+
if (_params && !_params.paymentSessionData) {
|
120
|
+
return Promise.reject(ERRORMESSAGE.CREATECOMPONENT_ERROR);
|
121
|
+
}
|
122
|
+
if (this.options.networkMode === networkModeEnum.proxy) {
|
123
|
+
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT.message);
|
124
|
+
return Promise.reject(ERRORMESSAGE.INIT_PARAMETER_ERROR.NET_MODE_NOT_SUPPORT);
|
125
|
+
}
|
126
|
+
return Promise.resolve(_params);
|
88
127
|
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
128
|
+
}, {
|
129
|
+
key: "pluginAppendIframe",
|
130
|
+
value: function pluginAppendIframe(appendParams) {
|
131
|
+
try {
|
132
|
+
this.componentApp.appendIframeNodes(appendParams.componentSign, appendParams.iframeNodesParams).then(function () {
|
133
|
+
return Promise.resolve();
|
134
|
+
});
|
135
|
+
} catch (error) {
|
136
|
+
return Promise.reject(error);
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* @description Create component application
|
142
|
+
* @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.
|
143
|
+
*/
|
144
|
+
}, {
|
145
|
+
key: "createComponent",
|
146
|
+
value: function createComponent(params) {
|
147
|
+
var _this2 = this;
|
148
|
+
return this.parameterInitAndCheck({
|
149
|
+
params: params,
|
150
|
+
renderDisplayType: renderDisplayTypeEnum.popup
|
151
|
+
}).then(function (_params) {
|
152
|
+
return handleParams(_params);
|
153
|
+
}).catch(function (error) {
|
154
|
+
_this2._eventCenter.emit(EVENT.error.name, {
|
155
|
+
code: ERRORMESSAGE.CREATECOMPONENT_ERROR
|
156
|
+
});
|
157
|
+
return Promise.reject(error);
|
158
|
+
}).then(function (appendParams) {
|
159
|
+
return _this2.pluginAppendIframe(appendParams);
|
95
160
|
});
|
96
|
-
} catch (error) {
|
97
|
-
reject(error);
|
98
161
|
}
|
99
|
-
|
100
|
-
|
162
|
+
/**
|
163
|
+
* @description Create and render components in the specified element area
|
164
|
+
* @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.
|
165
|
+
*/
|
166
|
+
}, {
|
167
|
+
key: "mountComponent",
|
168
|
+
value: function mountComponent(params, selector) {
|
169
|
+
var _this3 = this;
|
170
|
+
return this.parameterInitAndCheck({
|
171
|
+
params: params,
|
172
|
+
renderDisplayType: renderDisplayTypeEnum.inline,
|
173
|
+
selector: selector
|
174
|
+
}).then(function (_params) {
|
175
|
+
return handleParams(_params);
|
176
|
+
}).catch(function (error) {
|
177
|
+
_this3._eventCenter.emit(EVENT.error.name, {
|
178
|
+
code: ERRORMESSAGE.CREATECOMPONENT_ERROR
|
179
|
+
});
|
180
|
+
return Promise.reject(error);
|
181
|
+
}).then(function (appendParams) {
|
182
|
+
return _this3.pluginAppendIframe(appendParams);
|
183
|
+
});
|
184
|
+
}
|
185
|
+
/**
|
186
|
+
* @description Execute payment submission process
|
187
|
+
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
188
|
+
*/
|
189
|
+
}, {
|
190
|
+
key: "submit",
|
191
|
+
value: function submit() {
|
192
|
+
try {
|
193
|
+
this.componentApp.dispatchToApp({
|
194
|
+
context: {
|
195
|
+
event: 'submitPay',
|
196
|
+
data: {}
|
197
|
+
}
|
198
|
+
});
|
199
|
+
} catch (error) {
|
200
|
+
console.error(error);
|
201
|
+
}
|
202
|
+
}
|
203
|
+
}]);
|
204
|
+
return AMSComponent;
|
205
|
+
}(CoreInstance);
|
@@ -5,7 +5,7 @@
|
|
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 { createPaymentParams
|
8
|
+
import { createPaymentParams } from '../../types';
|
9
9
|
export declare const mixinDropInConstructor: (options: optionsParams, context: any) => void;
|
10
10
|
/**
|
11
11
|
* @description Create checkout application
|
@@ -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
|
}
|