@alipay/ams-checkout 1.5.0 → 1.5.7
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/config/request.js +3 -3
- package/esm/core/component/index.d.ts +4 -11
- package/esm/core/component/index.js +39 -30
- package/esm/core/drop-in/index.d.ts +0 -7
- package/esm/core/drop-in/index.js +16 -16
- package/esm/core/instance/index.js +1 -0
- package/esm/plugin/component/cashierApp.d.ts +3 -1
- package/esm/plugin/component/cashierApp.js +7 -3
- package/esm/plugin/component/component.inline.style.d.ts +1 -1
- package/esm/plugin/component/component.popup.style.d.ts +1 -1
- package/esm/plugin/component/component.popup.style.js +2 -0
- package/esm/plugin/component/index.d.ts +6 -8
- package/esm/plugin/component/index.js +84 -35
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +1 -0
- package/esm/request/index.d.ts +0 -7
- package/esm/request/index.js +23 -14
- package/esm/request/utils.d.ts +1 -1
- package/esm/request/utils.js +3 -0
- package/esm/types/index.d.ts +36 -9
- package/esm/types/index.js +3 -1
- package/esm/util/createIframeNode.js +7 -0
- package/esm/util/get.js +7 -0
- package/esm/util/index.d.ts +3 -3
- package/esm/util/index.js +5 -8
- package/esm/util/security.d.ts +12 -0
- package/esm/util/security.js +107 -0
- package/package.json +1 -1
package/esm/config/request.js
CHANGED
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
|
|
12
12
|
groupId = _queryParse.groupId,
|
13
13
|
host = _queryParse.requestHost;
|
14
14
|
export var requestHost = {
|
15
|
-
local: 'http://imgs-
|
16
|
-
dev: host || 'http://imgs-
|
15
|
+
local: 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
|
17
17
|
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
18
|
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
19
|
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -22,7 +22,7 @@ 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 || '
|
25
|
+
export var sofaId = groupId || 'GROUP_20230913102142';
|
26
26
|
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
27
|
var map = {
|
28
28
|
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -1,12 +1,5 @@
|
|
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
1
|
import ComponentApp from '../../plugin/component';
|
9
|
-
import { IcreateComponent, IoptionsParams, Iselector } from '../../types';
|
2
|
+
import { IcreateComponent, IoptionsParams, Iselector, Isubmit } from '../../types';
|
10
3
|
import CoreInstance from '../instance/index';
|
11
4
|
export declare class AMSComponent extends CoreInstance {
|
12
5
|
_componentApp: ComponentApp;
|
@@ -15,17 +8,17 @@ export declare class AMSComponent extends CoreInstance {
|
|
15
8
|
private pluginAppendIframe;
|
16
9
|
/**
|
17
10
|
* @description Create component application
|
18
|
-
* @param params - The data source created by the component, necessary
|
11
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
19
12
|
*/
|
20
13
|
createComponent(params: IcreateComponent): Promise<void>;
|
21
14
|
/**
|
22
15
|
* @description Create and render components in the specified element area
|
23
|
-
* @param params - The data source created by the component, necessary
|
16
|
+
* @param params - The data source created by the component, necessary sessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
24
17
|
*/
|
25
18
|
mountComponent(params: IcreateComponent, selector: Iselector): Promise<void>;
|
26
19
|
/**
|
27
20
|
* @description Execute payment submission process
|
28
21
|
* @description - When using your own payment button, you can execute the submit payment process by actively calling this function.
|
29
22
|
*/
|
30
|
-
submit():
|
23
|
+
submit(data?: Isubmit): Promise<unknown>;
|
31
24
|
}
|
@@ -25,7 +25,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
25
|
* 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
|
26
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.
|
27
27
|
*/
|
28
|
-
|
28
|
+
import { v4 as uuid } from 'uuid';
|
29
29
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
30
30
|
import ComponentApp from "../../plugin/component";
|
31
31
|
import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
@@ -41,12 +41,12 @@ var getComponentSign = function getComponentSign(params) {
|
|
41
41
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
42
42
|
return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
|
43
43
|
};
|
44
|
-
var
|
44
|
+
var parseSessionData = function parseSessionData(sessionData) {
|
45
45
|
try {
|
46
|
-
return [JSON.parse(atob(
|
46
|
+
return [JSON.parse(atob(sessionData.split('&&')[3])), sessionData.split('&&').slice(0, 3).join('&&')];
|
47
47
|
} catch (error) {
|
48
|
-
console.error('Parsing
|
49
|
-
return [{},
|
48
|
+
console.error('Parsing sessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.');
|
49
|
+
return [{}, sessionData];
|
50
50
|
}
|
51
51
|
};
|
52
52
|
|
@@ -59,23 +59,23 @@ var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
|
59
59
|
}
|
60
60
|
}
|
61
61
|
};
|
62
|
-
var
|
63
|
-
var
|
64
|
-
|
65
|
-
parseData =
|
66
|
-
|
62
|
+
var handleSessionData = function handleSessionData(originSessionData) {
|
63
|
+
var _parseSessionData = parseSessionData(originSessionData),
|
64
|
+
_parseSessionData2 = _slicedToArray(_parseSessionData, 2),
|
65
|
+
parseData = _parseSessionData2[0],
|
66
|
+
sessionData = _parseSessionData2[1];
|
67
67
|
resetEasyPaySceneVersion(parseData);
|
68
|
-
return [parseData,
|
68
|
+
return [parseData, sessionData];
|
69
69
|
};
|
70
70
|
var handleParams = function handleParams(params) {
|
71
71
|
var _params = Object.assign({
|
72
72
|
paymentSessionMetaData: {},
|
73
73
|
renderDisplayType: renderDisplayTypeEnum.popup
|
74
74
|
}, params);
|
75
|
-
var
|
76
|
-
|
77
|
-
parseData =
|
78
|
-
|
75
|
+
var _handleSessionData = handleSessionData(_params.sessionData),
|
76
|
+
_handleSessionData2 = _slicedToArray(_handleSessionData, 2),
|
77
|
+
parseData = _handleSessionData2[0],
|
78
|
+
sessionData = _handleSessionData2[1];
|
79
79
|
var componentSign = getComponentSign(parseData);
|
80
80
|
if (componentSign === componentSignEnum.NONE) {
|
81
81
|
// eslint-disable-next-line prefer-promise-reject-errors
|
@@ -84,7 +84,7 @@ var handleParams = function handleParams(params) {
|
|
84
84
|
message: "Abnormal response data, interface failure, or unsupported payment method"
|
85
85
|
});
|
86
86
|
}
|
87
|
-
_params.
|
87
|
+
_params.sessionData = sessionData;
|
88
88
|
_params.paymentSessionMetaData = parseData;
|
89
89
|
return Promise.resolve({
|
90
90
|
iframeNodesParams: _params,
|
@@ -119,7 +119,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
119
119
|
selector: selector,
|
120
120
|
renderDisplayType: renderDisplayType
|
121
121
|
}, params);
|
122
|
-
if (_params && !_params.
|
122
|
+
if (_params && !_params.sessionData) {
|
123
123
|
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
|
124
124
|
}
|
125
125
|
if (this.options.networkMode === networkModeEnum.proxy) {
|
@@ -140,7 +140,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
140
140
|
|
141
141
|
/**
|
142
142
|
* @description Create component application
|
143
|
-
* @param params - The data source created by the component, necessary
|
143
|
+
* @param params - The data source created by the component, necessary sessionData, optional appearance configuration, and refer to the documentation for other parameters and detailed information.
|
144
144
|
*/
|
145
145
|
}, {
|
146
146
|
key: "createComponent",
|
@@ -160,7 +160,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
160
160
|
}
|
161
161
|
/**
|
162
162
|
* @description Create and render components in the specified element area
|
163
|
-
* @param params - The data source created by the component, necessary
|
163
|
+
* @param params - The data source created by the component, necessary sessionData, necessary element selector IDs, optional appearance configurations, and refer to the documentation for other parameters and detailed information.
|
164
164
|
*/
|
165
165
|
}, {
|
166
166
|
key: "mountComponent",
|
@@ -185,17 +185,26 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
185
185
|
*/
|
186
186
|
}, {
|
187
187
|
key: "submit",
|
188
|
-
value: function submit() {
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
188
|
+
value: function submit(data) {
|
189
|
+
var _this4 = this;
|
190
|
+
return new Promise(function (resolve, reject) {
|
191
|
+
try {
|
192
|
+
var eventCallbackId = uuid();
|
193
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
194
|
+
_this4._eventCenter.once(eventCallbackId, function (_data) {
|
195
|
+
resolve(_data);
|
196
|
+
});
|
197
|
+
_this4._componentApp.dispatchToApp({
|
198
|
+
context: {
|
199
|
+
event: 'submitPay',
|
200
|
+
eventCallbackId: eventCallbackId,
|
201
|
+
data: data
|
202
|
+
}
|
203
|
+
});
|
204
|
+
} catch (error) {
|
205
|
+
reject(error);
|
206
|
+
}
|
207
|
+
});
|
199
208
|
}
|
200
209
|
}]);
|
201
210
|
return AMSComponent;
|
@@ -1,10 +1,3 @@
|
|
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
1
|
import { IcreatePaymentParams, IoptionsParams } from '../../types';
|
9
2
|
export declare const mixinDropInConstructor: (options: IoptionsParams, context: any) => void;
|
10
3
|
/**
|
@@ -8,7 +8,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
8
8
|
* 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
|
9
9
|
* 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.
|
10
10
|
*/
|
11
|
-
|
11
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
12
12
|
import { BASEPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
13
13
|
import CheckoutApp from "../../plugin/drop-in";
|
14
14
|
import { messageName, networkModeEnum } from "../../types";
|
@@ -49,8 +49,8 @@ export var createPayment = function createPayment(params) {
|
|
49
49
|
export var confirmPayment = function confirmPayment(result) {
|
50
50
|
var _this2 = this;
|
51
51
|
return new Promise(function (resolve, reject) {
|
52
|
-
_this2.eventCenter.once('onRedirect', function (
|
53
|
-
_this2._redirect(
|
52
|
+
_this2.eventCenter.once('onRedirect', function (payload) {
|
53
|
+
_this2._redirect(payload).then(function () {
|
54
54
|
resolve();
|
55
55
|
}).catch(function (err) {
|
56
56
|
reject(err);
|
@@ -73,21 +73,21 @@ export var confirmPayment = function confirmPayment(result) {
|
|
73
73
|
*/
|
74
74
|
export var _subscribeFromCheckoutPlugin = function _subscribeFromCheckoutPlugin() {
|
75
75
|
var _this3 = this;
|
76
|
-
var eventKeyMap = new Map([[EVENT.error.name, function (
|
77
|
-
_this3.eventCenter.emit(EVENT.error.name,
|
78
|
-
}], [EVENT.ready.name, function (
|
79
|
-
_this3.eventCenter.emit(EVENT.ready.name,
|
80
|
-
}], [EVENT.redirect.name, function (
|
81
|
-
_this3.eventCenter.emit(EVENT.redirect.name,
|
82
|
-
}], [EVENT.paymentMethodSelected.name, function (
|
83
|
-
_this3.checkoutState.paymentMethodType =
|
76
|
+
var eventKeyMap = new Map([[EVENT.error.name, function (payload) {
|
77
|
+
_this3.eventCenter.emit(EVENT.error.name, payload.context.data);
|
78
|
+
}], [EVENT.ready.name, function (payload) {
|
79
|
+
_this3.eventCenter.emit(EVENT.ready.name, payload.context.data);
|
80
|
+
}], [EVENT.redirect.name, function (payload) {
|
81
|
+
_this3.eventCenter.emit(EVENT.redirect.name, payload.context.data);
|
82
|
+
}], [EVENT.paymentMethodSelected.name, function (payload) {
|
83
|
+
_this3.checkoutState.paymentMethodType = payload.context.data.paymentMethodType;
|
84
84
|
_this3.eventCenter.emit(EVENT.paymentMethodSelected.name, {
|
85
|
-
paymentMethodType:
|
85
|
+
paymentMethodType: payload.context.data.paymentMethodType
|
86
86
|
});
|
87
|
-
}], [EVENT.sizeChanged.name, function (
|
88
|
-
_this3.eventCenter.emit(EVENT.sizeChanged.name,
|
89
|
-
}], [EVENT.log.name, function (
|
90
|
-
_this3.eventCenter.emit(EVENT.log.name,
|
87
|
+
}], [EVENT.sizeChanged.name, function (payload) {
|
88
|
+
_this3.eventCenter.emit(EVENT.sizeChanged.name, payload.context.data);
|
89
|
+
}], [EVENT.log.name, function (payload) {
|
90
|
+
_this3.eventCenter.emit(EVENT.log.name, payload.context.data);
|
91
91
|
}]]);
|
92
92
|
var _iterator = _createForOfIteratorHelper(eventKeyMap.keys()),
|
93
93
|
_step;
|
@@ -15,6 +15,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
15
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
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
17
|
*/
|
18
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
18
19
|
import { v4 as uuid } from 'uuid';
|
19
20
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
20
21
|
import { environmentEnum, modeEnum, networkModeEnum, osTypeEnum, terminalTypeEnum } from "../../types/index";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { componentSignEnum, Ianalytics } from '../../types';
|
2
|
-
|
2
|
+
import { renderDisplayTypeEnum } from '../../types/index';
|
3
|
+
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
|
3
4
|
export declare const getAppDomain: (domainParams: {
|
4
5
|
environment: string;
|
5
6
|
appVersion: string;
|
@@ -16,6 +17,7 @@ export declare const getIframeUrl: (iframeParams: {
|
|
16
17
|
extendInfo: string;
|
17
18
|
locale: string;
|
18
19
|
instanceId: string;
|
20
|
+
renderDisplayType: renderDisplayTypeEnum;
|
19
21
|
}) => string;
|
20
22
|
/**
|
21
23
|
* @description Create iframe
|
@@ -22,7 +22,7 @@ var getAppVersion = function getAppVersion(_extendInfo) {
|
|
22
22
|
};
|
23
23
|
var getFinalProductSceneVersion = function getFinalProductSceneVersion(componentSign, productSceneVersion) {
|
24
24
|
var _signSupportMap;
|
25
|
-
var signSupportMap = (_signSupportMap = {}, _defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), _defineProperty(_signSupportMap, componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), _signSupportMap);
|
25
|
+
var signSupportMap = (_signSupportMap = {}, _defineProperty(_signSupportMap, componentSignEnum.NONE, ['']), _defineProperty(_signSupportMap, componentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), _defineProperty(_signSupportMap, componentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), _defineProperty(_signSupportMap, componentSignEnum.VAULTING_CARD, ['1.0']), _signSupportMap);
|
26
26
|
var supportProductSceneVersion = signSupportMap[componentSign];
|
27
27
|
// 从左到右,从旧到新
|
28
28
|
var isSupport = supportProductSceneVersion.find(function (it) {
|
@@ -69,7 +69,8 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
69
69
|
appVersion = iframeParams.appVersion,
|
70
70
|
extendInfo = iframeParams.extendInfo,
|
71
71
|
locale = iframeParams.locale,
|
72
|
-
instanceId = iframeParams.instanceId
|
72
|
+
instanceId = iframeParams.instanceId,
|
73
|
+
renderDisplayType = iframeParams.renderDisplayType;
|
73
74
|
var path = getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo || '');
|
74
75
|
var initialScale = 1;
|
75
76
|
var scale = getViewPort('initial-scale') || initialScale;
|
@@ -80,8 +81,10 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
80
81
|
requestHost = _queryParse$requestHo === void 0 ? '' : _queryParse$requestHo,
|
81
82
|
_queryParse$groupId = _queryParse.groupId,
|
82
83
|
groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
|
83
|
-
LOCAL_MOCK = _queryParse.LOCAL_MOCK
|
84
|
+
LOCAL_MOCK = _queryParse.LOCAL_MOCK,
|
85
|
+
_displayType = _queryParse._displayType;
|
84
86
|
var urlParams = Object.assign({}, {
|
87
|
+
displayType: renderDisplayType,
|
85
88
|
locale: locale,
|
86
89
|
scale: scale,
|
87
90
|
instanceId: instanceId,
|
@@ -94,6 +97,7 @@ export var getIframeUrl = function getIframeUrl(iframeParams) {
|
|
94
97
|
if (groupId) urlParams.groupId = groupId;
|
95
98
|
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
96
99
|
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
100
|
+
if (_displayType) urlParams.displayType = _displayType;
|
97
101
|
var locationSearch = serialize(urlParams);
|
98
102
|
return "".concat(path, "?").concat(locationSearch);
|
99
103
|
};
|
@@ -8,4 +8,4 @@
|
|
8
8
|
import { platformEnum } from '../../types';
|
9
9
|
export declare const inlineComponentAddCss: () => void;
|
10
10
|
export declare const addInlineLoading: (_selector: HTMLDivElement, platform: platformEnum) => void;
|
11
|
-
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement
|
11
|
+
export declare const createInlineBaseElement: (selector: string) => HTMLDivElement;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { platformEnum } from '../../types';
|
2
2
|
export declare const componentAddCSS: () => void;
|
3
|
-
export declare const createBaseElement: (platform: platformEnum, closeBtnFunc: () => void) => HTMLDivElement
|
3
|
+
export declare const createBaseElement: (platform: platformEnum, closeBtnFunc: () => void) => HTMLDivElement;
|
4
4
|
export declare const createCloseBtn: (platform: platformEnum, closeBtnFunc: () => void) => void;
|
5
5
|
export declare const createRetentionPopup: (platform: platformEnum, remainBtnFunc: () => void, leaveBtnFunc: () => void) => void;
|
6
6
|
export declare const hideRetentionPopup: () => void;
|
@@ -113,6 +113,8 @@ export var addPopupLoading = function addPopupLoading() {
|
|
113
113
|
var body = document.getElementsByTagName('body')[0];
|
114
114
|
body === null || body === void 0 ? void 0 : body.appendChild(loading);
|
115
115
|
};
|
116
|
+
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
116
118
|
export var handleDeclareInfo = function handleDeclareInfo(_ref) {
|
117
119
|
var _ref$closeDialogData = _ref.closeDialogData,
|
118
120
|
closeDialogData = _ref$closeDialogData === void 0 ? {} : _ref$closeDialogData;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type AMSCheckout from '../../core/instance';
|
2
|
-
import type {
|
2
|
+
import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, Iselector } from '../../types';
|
3
3
|
import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
|
4
4
|
type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
|
5
5
|
export default class ComponentApp {
|
@@ -7,7 +7,7 @@ export default class ComponentApp {
|
|
7
7
|
AMSSDK: AMSCheckout;
|
8
8
|
platform: platformEnum;
|
9
9
|
_performanceData: any[];
|
10
|
-
_loadAppPromiseResolve: ((value:
|
10
|
+
_loadAppPromiseResolve: ((value: boolean) => void) | null;
|
11
11
|
_isInitComponent: boolean;
|
12
12
|
private appDomain;
|
13
13
|
private createIframeNode;
|
@@ -32,6 +32,7 @@ export default class ComponentApp {
|
|
32
32
|
* @description Set the rendering capability of the cashier plug-in. Different technology stacks have some differences in the packaging and use of rendering functions
|
33
33
|
*/
|
34
34
|
setRender(renderFunc: IrenderFuncParams): void;
|
35
|
+
initAPSecurity(): void;
|
35
36
|
/**
|
36
37
|
* @description render iframe content
|
37
38
|
*/
|
@@ -58,7 +59,7 @@ export default class ComponentApp {
|
|
58
59
|
/**
|
59
60
|
* @description Processing messages from iframe
|
60
61
|
*/
|
61
|
-
_handleAppMessage(data:
|
62
|
+
_handleAppMessage(data: eventPayload): void;
|
62
63
|
private handleSizeChanged;
|
63
64
|
private handleRedirect;
|
64
65
|
private handleDeclareInfo;
|
@@ -66,15 +67,12 @@ export default class ComponentApp {
|
|
66
67
|
/**
|
67
68
|
* @description Send message to SDK
|
68
69
|
*/
|
69
|
-
dispatchToSDK(event: string, data: any): void;
|
70
|
+
dispatchToSDK(event: string, data: any, eventCallbackId?: string): void;
|
70
71
|
/**
|
71
72
|
* @description Send message to iframe
|
72
73
|
*/
|
73
74
|
dispatchToApp(payload: {
|
74
|
-
context:
|
75
|
-
event: string;
|
76
|
-
data: any;
|
77
|
-
};
|
75
|
+
context: eventPayloadContext;
|
78
76
|
}): any;
|
79
77
|
/**
|
80
78
|
* @description Subscribe to messages from SDK
|