@alipay/ams-checkout 0.0.1726734012-dev.1 → 0.0.1726734012-dev.11
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/component/channel.d.ts +19 -0
- package/esm/component/channel.js +87 -0
- package/esm/component/component.inline.style.d.ts +10 -0
- package/esm/component/component.inline.style.js +121 -0
- package/esm/component/component.popup.style.d.ts +25 -0
- package/esm/component/component.popup.style.js +203 -0
- package/esm/component/popupWindow.style.d.ts +11 -0
- package/esm/component/popupWindow.style.js +121 -0
- package/esm/config/index.d.ts +11 -0
- package/esm/config/index.js +20 -1
- package/esm/constant/index.d.ts +25 -0
- package/esm/constant/index.js +28 -0
- package/esm/core/bus/index.d.ts +3 -3
- package/esm/core/bus/index.js +14 -14
- package/esm/core/component/address.d.ts +8 -0
- package/esm/core/component/address.js +72 -0
- package/esm/core/component/appPreloadProcessing.js +2 -2
- package/esm/core/component/ckp/index.js +12 -8
- package/esm/core/component/element/components/address.d.ts +19 -0
- package/esm/core/component/element/components/address.js +68 -0
- package/esm/core/component/element/components/auth.d.ts +17 -0
- package/esm/core/component/element/components/auth.js +60 -0
- package/esm/core/component/element/components/payment.d.ts +19 -0
- package/esm/core/component/element/components/payment.js +74 -0
- package/esm/core/component/element/index.d.ts +47 -0
- package/esm/core/component/element/index.js +817 -0
- package/esm/core/component/element/mock.d.ts +4 -0
- package/esm/core/component/element/mock.js +491 -0
- package/esm/core/component/element/type.d.ts +191 -0
- package/esm/core/component/element/type.js +36 -0
- package/esm/core/component/element/utils.d.ts +13 -0
- package/esm/core/component/element/utils.js +6 -0
- package/esm/core/component/index.d.ts +14 -7
- package/esm/core/component/index.js +136 -78
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +2 -1
- package/esm/core/instance/index.js +27 -12
- package/esm/foundation/core/index.d.ts +28 -0
- package/esm/foundation/core/index.js +396 -0
- package/esm/foundation/index.d.ts +75 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +18 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +12 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +464 -0
- package/esm/foundation/service/api-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/callback.js +55 -0
- package/esm/foundation/service/api-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/api-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/api-bus/ability/request.js +151 -0
- package/esm/foundation/service/api-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/api-bus/ability/security.js +161 -0
- package/esm/foundation/service/api-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/api-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/api-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/api-bus/busManager.js +398 -0
- package/esm/foundation/service/api-bus/index.d.ts +20 -0
- package/esm/foundation/service/api-bus/index.js +88 -0
- package/esm/foundation/service/api-bus/interface.d.ts +48 -0
- package/esm/foundation/service/api-bus/interface.js +54 -0
- package/esm/foundation/service/container/index.d.ts +32 -0
- package/esm/foundation/service/container/index.js +332 -0
- package/esm/foundation/service/container/popup.d.ts +17 -0
- package/esm/foundation/service/container/popup.js +103 -0
- package/esm/foundation/service/container/utils.d.ts +7 -0
- package/esm/foundation/service/container/utils.js +48 -0
- package/esm/foundation/service/event-center.d.ts +82 -0
- package/esm/foundation/service/event-center.js +274 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +68 -0
- package/esm/foundation/service/index.d.ts +19 -0
- package/esm/foundation/service/index.js +82 -0
- package/esm/foundation/service/log/index.d.ts +43 -0
- package/esm/foundation/service/log/index.js +250 -0
- package/esm/foundation/service/log/keys.d.ts +13 -0
- package/esm/foundation/service/log/keys.js +103 -0
- package/esm/foundation/service/log/processor.d.ts +9 -0
- package/esm/foundation/service/log/processor.js +148 -0
- package/esm/foundation/service/log/types.d.ts +32 -0
- package/esm/foundation/service/log/types.js +1 -0
- package/esm/foundation/service/requester/deps.d.ts +17 -0
- package/esm/foundation/service/requester/deps.js +11 -0
- package/esm/foundation/service/requester/requester.d.ts +22 -0
- package/esm/foundation/service/requester/requester.js +217 -0
- package/esm/foundation/service/security/index.d.ts +28 -0
- package/esm/foundation/service/security/index.js +284 -0
- package/esm/foundation/service/security/security.d.ts +33 -0
- package/esm/foundation/service/security/security.js +182 -0
- package/esm/foundation/utils/gray_scale_utils.d.ts +7 -0
- package/esm/foundation/utils/gray_scale_utils.js +40 -0
- package/esm/foundation/utils/payment_context_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_context_utils.js +57 -0
- package/esm/foundation/utils/payment_product_utils.d.ts +13 -0
- package/esm/foundation/utils/payment_product_utils.js +38 -0
- package/esm/foundation/utils/redirect_utils.d.ts +11 -0
- package/esm/foundation/utils/redirect_utils.js +262 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +66 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +46 -0
- package/esm/foundation/utils/web_app_url_utils.js +112 -0
- package/esm/index.d.ts +21 -12
- package/esm/index.js +116 -56
- package/esm/plugin/applepay/component.js +13 -11
- package/esm/plugin/applepay/index.js +10 -6
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +26 -18
- package/esm/plugin/component/cashierApp.d.ts +10 -8
- package/esm/plugin/component/cashierApp.js +48 -11
- package/esm/plugin/component/channel.d.ts +4 -3
- package/esm/plugin/component/channel.js +39 -2
- package/esm/plugin/component/component.inline.style.d.ts +9 -10
- package/esm/plugin/component/component.inline.style.js +93 -10
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +30 -7
- package/esm/plugin/component/index.d.ts +14 -8
- package/esm/plugin/component/index.js +384 -187
- package/esm/plugin/component/popupWindow.style.d.ts +5 -2
- package/esm/plugin/component/popupWindow.style.js +70 -14
- package/esm/plugin/const.js +5 -5
- package/esm/plugin/drop-in/index.d.ts +5 -5
- package/esm/plugin/drop-in/index.js +7 -7
- package/esm/plugin/payment-element/utils.d.ts +2 -0
- package/esm/plugin/payment-element/utils.js +6 -0
- package/esm/plugin/paypal/index.js +2 -1
- package/esm/plugin/type.d.ts +4 -3
- package/esm/service/element.d.ts +4 -0
- package/esm/service/element.js +51 -0
- package/esm/service/index.d.ts +1 -0
- package/esm/service/index.js +6 -2
- package/esm/types/index.d.ts +339 -40
- package/esm/types/index.js +119 -55
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/getBackScheme.d.ts +5 -0
- package/esm/util/getBackScheme.js +133 -0
- package/esm/util/index.js +4 -8
- package/esm/util/logger.d.ts +3 -3
- package/esm/util/logger.js +49 -13
- package/esm/util/security.d.ts +3 -2
- package/esm/util/security.js +2 -2
- package/esm/util/spm-map.d.ts +172 -0
- package/esm/util/spm-map.js +172 -0
- package/package.json +3 -1
@@ -0,0 +1,57 @@
|
|
1
|
+
import { parseBase64ToString } from "../../util";
|
2
|
+
import { getStorageString, setStorageString } from "../../util/storage";
|
3
|
+
import { compareVersion, isVersionInStringRange } from "../../util/versionCompare";
|
4
|
+
import { getGrayscaleValue, isGreyscaleMatch, isWebPlatform } from "../../util/upgrade";
|
5
|
+
/**
|
6
|
+
* @author 谦彧 <zhangmian.zm@alipay.com>
|
7
|
+
* @date 2024/9/17
|
8
|
+
*/
|
9
|
+
export function convertPaymentSession(sessionData) {
|
10
|
+
try {
|
11
|
+
return {
|
12
|
+
id: sessionData.split('&&').slice(0, 3).join('&&'),
|
13
|
+
data: JSON.parse(parseBase64ToString(sessionData.split('&&')[3]))
|
14
|
+
};
|
15
|
+
} catch (error) {
|
16
|
+
console.error('Parsing sessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.', error);
|
17
|
+
return {
|
18
|
+
id: sessionData,
|
19
|
+
data: {}
|
20
|
+
};
|
21
|
+
}
|
22
|
+
}
|
23
|
+
export var getWebAppVersion = function getWebAppVersion(currentSDKMetaData) {
|
24
|
+
var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
25
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
26
|
+
var webAppVersion = findTargetWebAppVersionByConfig(currentSDKMetaData, mid, config);
|
27
|
+
if (webAppVersion) {
|
28
|
+
return webAppVersion;
|
29
|
+
}
|
30
|
+
webAppVersion = getStorageString("Antom_".concat(currentSDKMetaData.sdkVersion + currentSDKMetaData.productScene, "_LastAppVersion"), '');
|
31
|
+
if (webAppVersion) {
|
32
|
+
return webAppVersion;
|
33
|
+
}
|
34
|
+
return currentSDKMetaData.sdkVersion;
|
35
|
+
};
|
36
|
+
export var saveWebAppVersion = function saveWebAppVersion(webAppVersion, currentSDKMetaData) {
|
37
|
+
setStorageString("Antom_".concat(currentSDKMetaData.sdkVersion + currentSDKMetaData.productScene, "_LastAppVersion"), '');
|
38
|
+
};
|
39
|
+
var findTargetWebAppVersionByConfig = function findTargetWebAppVersionByConfig(currentSDKInfo) {
|
40
|
+
var mid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
41
|
+
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
42
|
+
var sortedConfig = config.sort(function (a, b) {
|
43
|
+
return compareVersion(b.appVersion, a.appVersion);
|
44
|
+
});
|
45
|
+
var targetConfigEntry = sortedConfig.find(function (configEntry) {
|
46
|
+
if (isVersionInStringRange(currentSDKInfo.sdkVersion, configEntry.v) && isWebPlatform(configEntry.platform)) {
|
47
|
+
var _configEntry$productS, _currentSDKInfo$produ, _configEntry$mid, _currentSDKInfo$greys;
|
48
|
+
var isMatchProductScene = (_configEntry$productS = configEntry.productScene) !== null && _configEntry$productS !== void 0 && _configEntry$productS.trim() ? configEntry.productScene.toUpperCase().includes(currentSDKInfo === null || currentSDKInfo === void 0 || (_currentSDKInfo$produ = currentSDKInfo.productScene) === null || _currentSDKInfo$produ === void 0 ? void 0 : _currentSDKInfo$produ.toUpperCase()) : true;
|
49
|
+
var isMatchMid = (_configEntry$mid = configEntry.mid) !== null && _configEntry$mid !== void 0 && _configEntry$mid.trim() ? configEntry.mid.toUpperCase().includes(mid === null || mid === void 0 ? void 0 : mid.toUpperCase()) : true;
|
50
|
+
var matchGreyscale = isGreyscaleMatch(configEntry, (_currentSDKInfo$greys = currentSDKInfo.greyscaleId) !== null && _currentSDKInfo$greys !== void 0 ? _currentSDKInfo$greys : getGrayscaleValue());
|
51
|
+
if (isMatchProductScene && isMatchMid && matchGreyscale) {
|
52
|
+
return configEntry;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
});
|
56
|
+
return (targetConfigEntry === null || targetConfigEntry === void 0 ? void 0 : targetConfigEntry.appVersion) || null;
|
57
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ProductSceneEnum } from "../../types";
|
2
|
+
export declare class ProductInfoCacheUtil {
|
3
|
+
static savePreviousProductInfo(productScene: ProductSceneEnum, info: {
|
4
|
+
productSceneVersion: string;
|
5
|
+
paymentMethodCategoryType: string;
|
6
|
+
hostSign: string;
|
7
|
+
}): void;
|
8
|
+
static getPreviousProductInfo(productScene: ProductSceneEnum, onError: (msg: string) => void): {
|
9
|
+
productSceneVersion: string;
|
10
|
+
paymentMethodCategoryType: string;
|
11
|
+
hostSign: string;
|
12
|
+
} | null;
|
13
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
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 _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
var KEY_PREVIOUS_PRODUCT_INFO = 'antom_checkout_previous_ProductInfo_';
|
8
|
+
export var ProductInfoCacheUtil = /*#__PURE__*/function () {
|
9
|
+
function ProductInfoCacheUtil() {
|
10
|
+
_classCallCheck(this, ProductInfoCacheUtil);
|
11
|
+
}
|
12
|
+
_createClass(ProductInfoCacheUtil, null, [{
|
13
|
+
key: "savePreviousProductInfo",
|
14
|
+
value: function savePreviousProductInfo(productScene, info) {
|
15
|
+
var key = KEY_PREVIOUS_PRODUCT_INFO + '_' + productScene;
|
16
|
+
localStorage.setItem(key, JSON.stringify({
|
17
|
+
productSceneVersion: info.productSceneVersion,
|
18
|
+
paymentMethodCategoryType: info.paymentMethodCategoryType,
|
19
|
+
hostSign: info.hostSign
|
20
|
+
}));
|
21
|
+
}
|
22
|
+
}, {
|
23
|
+
key: "getPreviousProductInfo",
|
24
|
+
value: function getPreviousProductInfo(productScene, onError) {
|
25
|
+
var key = KEY_PREVIOUS_PRODUCT_INFO + '_' + productScene;
|
26
|
+
var previousProductInfoString = localStorage.getItem(key);
|
27
|
+
if (previousProductInfoString) {
|
28
|
+
try {
|
29
|
+
return JSON.parse(previousProductInfoString);
|
30
|
+
} catch (error) {
|
31
|
+
onError(error === null || error === void 0 ? void 0 : error.message);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return null;
|
35
|
+
}
|
36
|
+
}]);
|
37
|
+
return ProductInfoCacheUtil;
|
38
|
+
}();
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { RedirectBehaviorPayload } from '../index';
|
2
|
+
import { LogService } from '../service/log';
|
3
|
+
/**
|
4
|
+
* @author 谦彧 <zhangmian.zm@alipay.com>
|
5
|
+
* @date 2024/9/19
|
6
|
+
*/
|
7
|
+
export declare const redirect: (payload: RedirectBehaviorPayload, instanceId: string) => void;
|
8
|
+
/**
|
9
|
+
* 通过配置规则检测 UA 和获得回跳 scheme
|
10
|
+
*/
|
11
|
+
export declare function getBackScheme(mockUa?: string, logger?: LogService): any;
|
@@ -0,0 +1,262 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
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; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
import { eventCodeEnum, RedirectType, TargetEnum } from "../../types";
|
8
|
+
import { ServiceProvider } from "../service";
|
9
|
+
import { isPC } from "../../util";
|
10
|
+
import CallApp from "../../util/intl-callapp/es/index";
|
11
|
+
import { EVENT } from "../../constant";
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @author 谦彧 <zhangmian.zm@alipay.com>
|
15
|
+
* @date 2024/9/19
|
16
|
+
*/
|
17
|
+
export var redirect = function redirect(payload, instanceId) {
|
18
|
+
var serviceProvider = ServiceProvider.getInstance(instanceId);
|
19
|
+
var logService = serviceProvider.getService('Log');
|
20
|
+
logService.logInfo({
|
21
|
+
title: 'sdk_event_call_url_start'
|
22
|
+
}, _objectSpread({}, payload)).send();
|
23
|
+
try {
|
24
|
+
if (payload.isCallApp && payload.schemeUrl) {
|
25
|
+
var detectSuccessDelay = payload.callAppDetectSuccessDelay;
|
26
|
+
var _callAppLib = new CallApp({
|
27
|
+
successCb: function successCb() {
|
28
|
+
successCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
29
|
+
},
|
30
|
+
resultJudgmentTime: detectSuccessDelay
|
31
|
+
});
|
32
|
+
_callAppLib.open({
|
33
|
+
scheme: payload.schemeUrl,
|
34
|
+
fallback: function fallback() {
|
35
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
// 支持 target: _blank,新开tab页打开
|
41
|
+
if (payload.browserLinkTarget === TargetEnum.BLANK) {
|
42
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
43
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
44
|
+
window.open(payload.url);
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
if (payload.browserLinkTarget === TargetEnum.REPLACE && !(payload !== null && payload !== void 0 && payload.applinkUrl) && !(payload !== null && payload !== void 0 && payload.schemeUrl)) {
|
48
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
49
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
50
|
+
window.location.replace(payload.url);
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
if (isPC()) {
|
54
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
55
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
56
|
+
window.location.href = payload.url;
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
if (!payload.schemeUrl && !payload.applinkUrl) {
|
60
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
61
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
62
|
+
window.location.href = payload.url;
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
// Use callApp lib to evoke
|
66
|
+
var callAppLib = new CallApp({
|
67
|
+
successCb: function successCb(evokeAppBy) {
|
68
|
+
var type = evokeAppBy.type == 'Scheme' ? RedirectType.SchemeUrl : RedirectType.ApplinkUrl;
|
69
|
+
successCallback(payload, type, evokeAppBy.url, serviceProvider);
|
70
|
+
}
|
71
|
+
});
|
72
|
+
var callSchemeUrl = function callSchemeUrl() {
|
73
|
+
callAppLib.open({
|
74
|
+
scheme: payload.schemeUrl,
|
75
|
+
fallback: function fallback() {
|
76
|
+
failCallback(payload, RedirectType.SchemeUrl, payload.schemeUrl, serviceProvider);
|
77
|
+
if (!payload.url) return failCallback(payload, RedirectType.NormalUrl, '', serviceProvider);
|
78
|
+
successCallback(payload, RedirectType.NormalUrl, payload.url, serviceProvider);
|
79
|
+
window.location.href = payload.url;
|
80
|
+
}
|
81
|
+
});
|
82
|
+
};
|
83
|
+
if (payload.applinkUrl) {
|
84
|
+
callAppLib.open({
|
85
|
+
link: payload.applinkUrl,
|
86
|
+
fallback: function fallback() {
|
87
|
+
failCallback(payload, RedirectType.ApplinkUrl, payload.applinkUrl, serviceProvider);
|
88
|
+
// Applink evoke failed, try to use scheme url
|
89
|
+
callSchemeUrl();
|
90
|
+
}
|
91
|
+
});
|
92
|
+
} else if (payload.schemeUrl) {
|
93
|
+
callSchemeUrl();
|
94
|
+
}
|
95
|
+
} catch (e) {
|
96
|
+
serviceProvider.getService('Log').logInfo({
|
97
|
+
title: 'sdk_event_call_url_failed'
|
98
|
+
}, {
|
99
|
+
redirectInfo: JSON.stringify(payload),
|
100
|
+
errorMessage: JSON.stringify(e)
|
101
|
+
}).send();
|
102
|
+
}
|
103
|
+
};
|
104
|
+
var successCallback = function successCallback(payload, type, url, serviceProvider) {
|
105
|
+
serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
|
106
|
+
code: eventCodeEnum.SDK_CALL_URL_SUCCESS,
|
107
|
+
message: "Successfully opened the app,".concat(type, ": ").concat(url)
|
108
|
+
});
|
109
|
+
serviceProvider.getService('Log').logInfo({
|
110
|
+
title: 'sdk_event_call_url_success'
|
111
|
+
}, {
|
112
|
+
redirectInfo: JSON.stringify(payload),
|
113
|
+
openType: type,
|
114
|
+
url: url
|
115
|
+
}).send();
|
116
|
+
};
|
117
|
+
var failCallback = function failCallback(payload, type, url, serviceProvider) {
|
118
|
+
serviceProvider.getService('EventCenter').emit(EVENT.eventCallback.name, {
|
119
|
+
code: eventCodeEnum.SDK_CALL_URL_ERROR,
|
120
|
+
message: "Failed to open app,applinkUrl: ".concat(payload === null || payload === void 0 ? void 0 : payload.applinkUrl, " schemeUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.schemeUrl, " normalUrl: ").concat(payload === null || payload === void 0 ? void 0 : payload.url)
|
121
|
+
});
|
122
|
+
serviceProvider.getService('Log').logInfo({
|
123
|
+
title: 'sdk_error_call_url_failed'
|
124
|
+
}, {
|
125
|
+
redirectInfo: JSON.stringify(payload),
|
126
|
+
openType: type,
|
127
|
+
url: url
|
128
|
+
}).send();
|
129
|
+
};
|
130
|
+
var UA_MATCH_RULES = [{
|
131
|
+
matchRule: 'AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z]+) Safari\\/([0-9\\._]+)$',
|
132
|
+
iosScheme: 'https',
|
133
|
+
andScheme: ''
|
134
|
+
}, {
|
135
|
+
matchRule: 'HeyTapBrowser',
|
136
|
+
iosScheme: '',
|
137
|
+
andScheme: ''
|
138
|
+
}, {
|
139
|
+
matchRule: 'HuaweiBrowser',
|
140
|
+
iosScheme: '',
|
141
|
+
andScheme: ''
|
142
|
+
}, {
|
143
|
+
matchRule: 'Kwai',
|
144
|
+
iosScheme: 'kwai',
|
145
|
+
andScheme: ''
|
146
|
+
}, {
|
147
|
+
matchRule: 'MQQBrowser',
|
148
|
+
iosScheme: 'mttbrowser',
|
149
|
+
andScheme: ''
|
150
|
+
}, {
|
151
|
+
matchRule: 'MicroMessenger',
|
152
|
+
iosScheme: '',
|
153
|
+
andScheme: ''
|
154
|
+
}, {
|
155
|
+
matchRule: 'MiuiBrowser',
|
156
|
+
iosScheme: '',
|
157
|
+
andScheme: ''
|
158
|
+
}, {
|
159
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* CriOS\\/([0-9\\._]+) Mobile\\/([0-9\\._A-Z\\._a-z]+) Safari\\/([0-9\\._]+)$',
|
160
|
+
iosScheme: 'googlechrome',
|
161
|
+
andScheme: ''
|
162
|
+
}, {
|
163
|
+
matchRule: 'Mozilla\\/([0-9\\.]+).* AppleWebKit\\/([0-9\\.]+).* Version\\/([0-9\\._]+) Mobile Safari\\/([0-9\\._]+)$',
|
164
|
+
iosScheme: 'googlechrome',
|
165
|
+
andScheme: ''
|
166
|
+
}, {
|
167
|
+
matchRule: 'NewsArticle',
|
168
|
+
iosScheme: 'snssdk141',
|
169
|
+
andScheme: ''
|
170
|
+
}, {
|
171
|
+
matchRule: 'UCBrowser',
|
172
|
+
iosScheme: 'ucbrowser',
|
173
|
+
andScheme: ''
|
174
|
+
}, {
|
175
|
+
matchRule: 'VideoArticle',
|
176
|
+
iosScheme: 'snssdk32',
|
177
|
+
andScheme: ''
|
178
|
+
}, {
|
179
|
+
matchRule: 'VivoBrowser',
|
180
|
+
iosScheme: '',
|
181
|
+
andScheme: ''
|
182
|
+
}, {
|
183
|
+
matchRule: 'ZhongAnWebView',
|
184
|
+
iosScheme: 'zaapp',
|
185
|
+
andScheme: ''
|
186
|
+
}, {
|
187
|
+
matchRule: 'aweme',
|
188
|
+
iosScheme: 'snssdk1128',
|
189
|
+
andScheme: ''
|
190
|
+
}, {
|
191
|
+
matchRule: 'aweme_lite',
|
192
|
+
iosScheme: 'snssdk2329',
|
193
|
+
andScheme: ''
|
194
|
+
}, {
|
195
|
+
matchRule: 'com.xs.fm',
|
196
|
+
iosScheme: 'novelfm3040',
|
197
|
+
andScheme: ''
|
198
|
+
}, {
|
199
|
+
matchRule: 'netdisk',
|
200
|
+
iosScheme: '',
|
201
|
+
andScheme: ''
|
202
|
+
}, {
|
203
|
+
matchRule: 'qqnews',
|
204
|
+
iosScheme: 'qqnews',
|
205
|
+
andScheme: ''
|
206
|
+
}];
|
207
|
+
|
208
|
+
/**
|
209
|
+
* 通过配置规则检测 UA 和获得回跳 scheme
|
210
|
+
*/
|
211
|
+
export function getBackScheme(mockUa, logger) {
|
212
|
+
var ua = mockUa || window.navigator.userAgent || '';
|
213
|
+
// 获取规则
|
214
|
+
var uaMatchedRule = UA_MATCH_RULES;
|
215
|
+
var matchedRule;
|
216
|
+
var matched = null;
|
217
|
+
for (var i = 0; i < uaMatchedRule.length; i++) {
|
218
|
+
var rule = uaMatchedRule[i];
|
219
|
+
matched = ua.match(rule.matchRule);
|
220
|
+
if (matched) {
|
221
|
+
matchedRule = rule;
|
222
|
+
break;
|
223
|
+
}
|
224
|
+
}
|
225
|
+
if (!matchedRule) {
|
226
|
+
logBackScheme(logger, ua, '');
|
227
|
+
return;
|
228
|
+
}
|
229
|
+
if (isAndroid(ua)) {
|
230
|
+
logBackScheme(logger, ua, matchedRule.andScheme);
|
231
|
+
return matchedRule.andScheme;
|
232
|
+
}
|
233
|
+
if (isIOS(ua)) {
|
234
|
+
logBackScheme(logger, ua, matchedRule.iosScheme);
|
235
|
+
return matchedRule.iosScheme;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
function logBackScheme(logger, userAgent, scheme) {
|
239
|
+
if (logger) {
|
240
|
+
logger.logInfo({
|
241
|
+
title: 'a3753.b101271.c377460'
|
242
|
+
}, {
|
243
|
+
eventMessage: scheme
|
244
|
+
});
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
248
|
+
/**
|
249
|
+
* 当前运行环境是否 Android
|
250
|
+
*/
|
251
|
+
function isAndroid(mockUA) {
|
252
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
253
|
+
return /android|adr|linux/.test(ua);
|
254
|
+
}
|
255
|
+
|
256
|
+
/**
|
257
|
+
* 当前运行环境是否 IOS
|
258
|
+
*/
|
259
|
+
function isIOS(mockUA) {
|
260
|
+
var ua = (mockUA || navigator.userAgent).toLowerCase();
|
261
|
+
return /iphone|ipad|ipod|ios|macintosh/.test(ua);
|
262
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { EventCenter } from '../service/event-center';
|
2
|
+
export declare const registerSystemEvents: (eventCenter: EventCenter) => void;
|
3
|
+
export declare const unRegisterSystemEvents: (eventCenter: EventCenter) => void;
|
4
|
+
export declare const getIframeOrigin: (iframe: HTMLIFrameElement) => string;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import { EVENT } from "../../constant";
|
2
|
+
import { v4 as uuid } from 'uuid';
|
3
|
+
export var registerSystemEvents = function registerSystemEvents(eventCenter) {
|
4
|
+
var handleSubmitForm = function handleSubmitForm(data) {
|
5
|
+
var attributes = data.attributes;
|
6
|
+
var _document = document,
|
7
|
+
body = _document.body;
|
8
|
+
var form = document.createElement('form');
|
9
|
+
form.setAttribute('height', '1');
|
10
|
+
form.setAttribute('width', '1');
|
11
|
+
Object.keys(attributes.data).forEach(function (key) {
|
12
|
+
var input = document.createElement('input');
|
13
|
+
input.setAttribute('type', 'hidden');
|
14
|
+
input.setAttribute('name', key);
|
15
|
+
input.setAttribute('value', attributes.data[key]);
|
16
|
+
form.appendChild(input);
|
17
|
+
});
|
18
|
+
form.setAttribute('action', attributes.action);
|
19
|
+
form.setAttribute('method', 'post');
|
20
|
+
body.appendChild(form);
|
21
|
+
setTimeout(function () {
|
22
|
+
form.submit();
|
23
|
+
}, 0);
|
24
|
+
};
|
25
|
+
var handleBeforeSubmit = function handleBeforeSubmit(data) {
|
26
|
+
if (eventCenter.isExist(EVENT.beforeSubmit.name)) {
|
27
|
+
eventCenter.emit(EVENT.beforeSubmit.name, data);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
var eventCallbackId = uuid();
|
31
|
+
eventCenter.dispatchToApp({
|
32
|
+
event: EVENT.beforeSubmitDone.name,
|
33
|
+
eventCallbackId: eventCallbackId,
|
34
|
+
data: {
|
35
|
+
result: 'IGNORE'
|
36
|
+
}
|
37
|
+
});
|
38
|
+
};
|
39
|
+
var handleSendBroadcast = function handleSendBroadcast(data) {
|
40
|
+
eventCenter.dispatchToApp({
|
41
|
+
event: EVENT.receiveBroadcast.name,
|
42
|
+
data: data
|
43
|
+
});
|
44
|
+
};
|
45
|
+
var handleSendMultiAppEventToSdk = function handleSendMultiAppEventToSdk(data) {
|
46
|
+
eventCenter.dispatchToApp({
|
47
|
+
event: EVENT.receiveMuitiAppFromSdk.name,
|
48
|
+
data: data
|
49
|
+
});
|
50
|
+
};
|
51
|
+
eventCenter.listen(EVENT.submitForm.name, handleSubmitForm);
|
52
|
+
eventCenter.listen(EVENT.beforeSubmit.name, handleBeforeSubmit);
|
53
|
+
eventCenter.listen(EVENT.sendBroadcast.name, handleSendBroadcast);
|
54
|
+
// deprecated
|
55
|
+
eventCenter.listen(EVENT.sendMuitiAppEventToSdk.name, handleSendMultiAppEventToSdk);
|
56
|
+
};
|
57
|
+
export var unRegisterSystemEvents = function unRegisterSystemEvents(eventCenter) {
|
58
|
+
eventCenter.unlisten(EVENT.submitForm.name);
|
59
|
+
eventCenter.unlisten(EVENT.beforeSubmit.name);
|
60
|
+
eventCenter.unlisten(EVENT.sendBroadcast.name);
|
61
|
+
eventCenter.unlisten(EVENT.sendMuitiAppEventToSdk.name);
|
62
|
+
};
|
63
|
+
export var getIframeOrigin = function getIframeOrigin(iframe) {
|
64
|
+
var url = new URL(iframe.src);
|
65
|
+
return url.origin;
|
66
|
+
};
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { DisplayTypeEnum, PaymentMethodCategoryTypeEnum } from '../../types';
|
2
|
+
import { SDKMetaData } from '../index';
|
3
|
+
/**
|
4
|
+
* Tell the SDK which version of the Web App to load.
|
5
|
+
* Sent by server inside paymentSession.
|
6
|
+
*/
|
7
|
+
export interface WebAppMatchConfig {
|
8
|
+
/**
|
9
|
+
* SDK support version range, '{minVer}|{maxVer}', such as '1.0.0' or '1.0.0|2.0.0' or '2.0.0'
|
10
|
+
* If SDK version < maxVer and > minVer, then will use this config entry.
|
11
|
+
*/
|
12
|
+
v: string;
|
13
|
+
appVersion: string;
|
14
|
+
productScene?: string;
|
15
|
+
platform?: string;
|
16
|
+
mid?: string;
|
17
|
+
greyscale?: string;
|
18
|
+
}
|
19
|
+
export interface QueryParams {
|
20
|
+
displayType: DisplayTypeEnum;
|
21
|
+
locale: string;
|
22
|
+
instanceId: string;
|
23
|
+
analyticsEnabled: boolean;
|
24
|
+
isPreload?: string;
|
25
|
+
hostSign?: string;
|
26
|
+
}
|
27
|
+
export declare const getWebAppUrlInfo: (params: {
|
28
|
+
environment: string;
|
29
|
+
sdkMetaData: SDKMetaData;
|
30
|
+
productSceneVersion: string;
|
31
|
+
paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
|
32
|
+
isPreload?: boolean;
|
33
|
+
query: QueryParams;
|
34
|
+
}) => {
|
35
|
+
path: string;
|
36
|
+
locationSearch: string;
|
37
|
+
};
|
38
|
+
export declare const getWebAppUrl: (params: {
|
39
|
+
environment: string;
|
40
|
+
sdkMetaData: SDKMetaData;
|
41
|
+
productSceneVersion: string;
|
42
|
+
paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
|
43
|
+
isPreload?: boolean;
|
44
|
+
query: QueryParams;
|
45
|
+
}) => string;
|
46
|
+
export declare const parseWebAppMatchConfig: (extendInfo: string) => WebAppMatchConfig[];
|
@@ -0,0 +1,112 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
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; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
5
|
+
import { ComponentSignEnum } from "../../types";
|
6
|
+
import { marmotMap } from "../../config";
|
7
|
+
import { queryParse, serialize } from "../../util";
|
8
|
+
import { isDebugLog } from "../../util/debug";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Tell the SDK which version of the Web App to load.
|
12
|
+
* Sent by server inside paymentSession.
|
13
|
+
*/
|
14
|
+
|
15
|
+
export var getWebAppUrlInfo = function getWebAppUrlInfo(params) {
|
16
|
+
var environment = params.environment,
|
17
|
+
sdkMetaData = params.sdkMetaData,
|
18
|
+
productSceneVersion = params.productSceneVersion,
|
19
|
+
paymentMethodCategoryType = params.paymentMethodCategoryType,
|
20
|
+
query = params.query,
|
21
|
+
isPreload = params.isPreload;
|
22
|
+
var path = getAppPath(environment, sdkMetaData, productSceneVersion, paymentMethodCategoryType);
|
23
|
+
var _queryParse = queryParse(),
|
24
|
+
_sandbox = _queryParse._sandbox,
|
25
|
+
_light_sandbox = _queryParse._light_sandbox,
|
26
|
+
_queryParse$requestHo = _queryParse.requestHost,
|
27
|
+
requestHost = _queryParse$requestHo === void 0 ? '' : _queryParse$requestHo,
|
28
|
+
_queryParse$groupId = _queryParse.groupId,
|
29
|
+
groupId = _queryParse$groupId === void 0 ? '' : _queryParse$groupId,
|
30
|
+
LOCAL_MOCK = _queryParse.LOCAL_MOCK,
|
31
|
+
_displayType = _queryParse._displayType;
|
32
|
+
var urlParams = {};
|
33
|
+
for (var key in query) {
|
34
|
+
urlParams[key] = '' + query[key];
|
35
|
+
}
|
36
|
+
// 如果是preload模式,添加一个preload的query参数
|
37
|
+
if (isPreload) {
|
38
|
+
urlParams['isPreload'] = 'true';
|
39
|
+
}
|
40
|
+
urlParams.appMatched = sdkMetaData.webAppVersion ? 'true' : 'false';
|
41
|
+
urlParams.sdkVersion = sdkMetaData.sdkVersion;
|
42
|
+
urlParams.refUrl = window.location.href;
|
43
|
+
urlParams._componentStartTime = "".concat(Date.now());
|
44
|
+
if (LOCAL_MOCK) urlParams.LOCAL_MOCK = LOCAL_MOCK;
|
45
|
+
if (requestHost) urlParams.requestHost = requestHost;
|
46
|
+
if (groupId) urlParams.groupId = groupId;
|
47
|
+
if (environment === 'light_sandbox' || _light_sandbox === 'true') urlParams.sandbox = 'true';
|
48
|
+
if (environment === 'sandbox' || _sandbox === 'true') urlParams.shadow = 'true';
|
49
|
+
if (_displayType) urlParams.displayType = _displayType;
|
50
|
+
var locationSearch = serialize(urlParams);
|
51
|
+
if (isDebugLog()) {
|
52
|
+
console.log('appUpgrade#getIframeUrl#appMatched', urlParams.appMatched);
|
53
|
+
console.log('appUpgrade#getIframeUrl#url', path, locationSearch);
|
54
|
+
}
|
55
|
+
return {
|
56
|
+
path: path,
|
57
|
+
locationSearch: locationSearch
|
58
|
+
};
|
59
|
+
};
|
60
|
+
export var getWebAppUrl = function getWebAppUrl(params) {
|
61
|
+
var info = getWebAppUrlInfo(params);
|
62
|
+
var webAppUrl;
|
63
|
+
if (info.path.indexOf('?') !== -1) {
|
64
|
+
webAppUrl = "".concat(info.path, "&").concat(info.locationSearch);
|
65
|
+
} else {
|
66
|
+
webAppUrl = "".concat(info.path, "?").concat(info.locationSearch);
|
67
|
+
}
|
68
|
+
return webAppUrl;
|
69
|
+
};
|
70
|
+
var getAppPath = function getAppPath() {
|
71
|
+
var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'prod';
|
72
|
+
var sdkMetaData = arguments.length > 1 ? arguments[1] : undefined;
|
73
|
+
var productSceneVersion = arguments.length > 2 ? arguments[2] : undefined;
|
74
|
+
var paymentMethodCategoryType = arguments.length > 3 ? arguments[3] : undefined;
|
75
|
+
var _ref = queryParse() || {},
|
76
|
+
urlTestHost = _ref.host;
|
77
|
+
// only for test while testurl?host=https://xxxxx.test.html
|
78
|
+
if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {
|
79
|
+
return urlTestHost;
|
80
|
+
}
|
81
|
+
var validProductSceneVersion = getValidProductSceneVersion(sdkMetaData.productScene, productSceneVersion, paymentMethodCategoryType);
|
82
|
+
var productSceneWithPaymentMethodCategoryType = "".concat(sdkMetaData.productScene, "_").concat(paymentMethodCategoryType);
|
83
|
+
var webAppVersion = sdkMetaData.webAppVersion;
|
84
|
+
return "".concat(marmotMap[environment], "/").concat(productSceneWithPaymentMethodCategoryType, "/").concat(validProductSceneVersion, "/index.").concat(webAppVersion, ".html");
|
85
|
+
};
|
86
|
+
export var parseWebAppMatchConfig = function parseWebAppMatchConfig(extendInfo) {
|
87
|
+
if (!extendInfo) {
|
88
|
+
return [];
|
89
|
+
}
|
90
|
+
try {
|
91
|
+
var _extendInfoJson$sdkUp;
|
92
|
+
var extendInfoJson = JSON.parse(extendInfo);
|
93
|
+
return extendInfoJson === null || extendInfoJson === void 0 || (_extendInfoJson$sdkUp = extendInfoJson.sdkUpgradeInfo) === null || _extendInfoJson$sdkUp === void 0 ? void 0 : _extendInfoJson$sdkUp.versions;
|
94
|
+
} catch (error) {
|
95
|
+
console.error('Parse the config for Web app failed#', error);
|
96
|
+
return [];
|
97
|
+
}
|
98
|
+
};
|
99
|
+
var getValidProductSceneVersion = function getValidProductSceneVersion(productScene, productSceneVer, paymentMethodCategoryType) {
|
100
|
+
var _supportMapping;
|
101
|
+
var supportMapping = (_supportMapping = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.NONE, ['']), ComponentSignEnum.AUTO_DEBIT_WALLET, ['1.0']), ComponentSignEnum.AUTO_DEBIT_PAY_WALLET, ['']), ComponentSignEnum.CASHIER_PAYMENT_BANK, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_CARD, ['1.0']), ComponentSignEnum.CASHIER_PAYMENT_APM, ['1.0']), ComponentSignEnum.EASY_PAY_WALLET, ['1.0', '2.0']), ComponentSignEnum.EASY_PAY_APM, ['2.0']), ComponentSignEnum.VAULTING_CARD, ['1.0']), ComponentSignEnum.ELEMENT_PAYMENT, ['1.0']), _defineProperty(_defineProperty(_supportMapping, ComponentSignEnum.ELEMENT_ADDRESS, ['1.0']), ComponentSignEnum.CHECKOUT_PAYMENT, ['1.0']));
|
102
|
+
var targetVersions = supportMapping[productScene + '_' + paymentMethodCategoryType];
|
103
|
+
if (!targetVersions) {
|
104
|
+
return '';
|
105
|
+
}
|
106
|
+
// 从左到右,从旧到新
|
107
|
+
var isSupport = targetVersions.find(function (it) {
|
108
|
+
return it === productSceneVer;
|
109
|
+
});
|
110
|
+
var latestVersion = targetVersions[targetVersions.length - 1];
|
111
|
+
return isSupport ? productSceneVer : latestVersion;
|
112
|
+
};
|
package/esm/index.d.ts
CHANGED
@@ -1,16 +1,11 @@
|
|
1
|
-
|
2
|
-
|
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
|
-
*/
|
1
|
+
import { AddressComponent } from './core/component/address';
|
2
|
+
import { ElementComponent } from './core/component/element';
|
8
3
|
import { AMSComponent } from './core/component/index';
|
9
|
-
import {
|
4
|
+
import { ComponentSignEnum, IcreateComponent, IElementOptions, IoptionsAddressParams, IoptionsParams } from './types';
|
10
5
|
export { AMSCheckoutPage } from './core/component/ckp';
|
11
6
|
export * from './types';
|
12
7
|
export declare class AMSCheckout extends AMSComponent {
|
13
|
-
constructor(_options: IoptionsParams, channelType?:
|
8
|
+
constructor(_options: IoptionsParams, channelType?: ComponentSignEnum[], productSceneVersion?: string);
|
14
9
|
}
|
15
10
|
export declare class AMSAutoDebit extends AMSCheckout {
|
16
11
|
constructor(options: IoptionsParams);
|
@@ -18,13 +13,27 @@ export declare class AMSAutoDebit extends AMSCheckout {
|
|
18
13
|
export declare class AMSAutoDebitPay extends AMSCheckout {
|
19
14
|
constructor(options: IoptionsParams);
|
20
15
|
}
|
21
|
-
export declare class AMSEasyPay extends AMSCheckout {
|
22
|
-
constructor(options: IoptionsParams);
|
23
|
-
}
|
24
16
|
export declare class AMSCashierPayment extends AMSCheckout {
|
25
17
|
constructor(options: IoptionsParams);
|
26
18
|
}
|
27
19
|
export declare class AMSVaulting extends AMSCheckout {
|
28
20
|
constructor(options: IoptionsParams);
|
29
21
|
}
|
22
|
+
export declare class AntomElement extends AMSCheckout {
|
23
|
+
constructor(options: IoptionsParams);
|
24
|
+
}
|
25
|
+
export declare class AddressElement extends AddressComponent {
|
26
|
+
constructor(options: IoptionsAddressParams);
|
27
|
+
}
|
28
|
+
export declare class Element extends ElementComponent {
|
29
|
+
constructor(options: IElementOptions);
|
30
|
+
}
|
30
31
|
export default AMSCheckout;
|
32
|
+
export declare class AMSEasyPay {
|
33
|
+
private core;
|
34
|
+
private easySafePayProcessor;
|
35
|
+
constructor(options: IoptionsParams);
|
36
|
+
createComponent(params: IcreateComponent): void;
|
37
|
+
preload(): void;
|
38
|
+
unmount(): void;
|
39
|
+
}
|