@alipay/ams-checkout 1.23.0 → 1.24.0
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/index.d.ts +7 -7
- package/esm/config/index.js +10 -10
- package/esm/constant/index.d.ts +6 -0
- package/esm/constant/index.js +8 -0
- package/esm/core/bus/ability/globalData.d.ts +10 -0
- package/esm/core/bus/ability/globalData.js +89 -0
- package/esm/core/bus/ability/request.d.ts +10 -0
- package/esm/core/bus/ability/request.js +151 -0
- package/esm/core/bus/interface.d.ts +12 -0
- package/esm/core/bus/interface.js +16 -2
- package/esm/core/component/address.d.ts +2 -2
- package/esm/core/component/appPreloadProcessing.js +2 -0
- package/esm/core/component/ckp/index.d.ts +3 -3
- package/esm/core/component/ckp/index.js +6 -5
- 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 +816 -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 +184 -0
- package/esm/core/component/element/type.js +35 -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 +5 -5
- package/esm/core/component/index.js +20 -16
- package/esm/core/drop-in/index.d.ts +2 -2
- package/esm/core/drop-in/index.js +2 -2
- package/esm/core/instance/index.d.ts +5 -5
- package/esm/core/instance/index.js +11 -10
- package/esm/foundation/core/index.d.ts +26 -0
- package/esm/foundation/core/index.js +301 -0
- package/esm/foundation/index.d.ts +72 -0
- package/esm/foundation/index.js +42 -0
- package/esm/foundation/product-processor/easysafepay/deps.d.ts +15 -0
- package/esm/foundation/product-processor/easysafepay/deps.js +9 -0
- package/esm/foundation/product-processor/easysafepay/index.d.ts +26 -0
- package/esm/foundation/product-processor/easysafepay/index.js +536 -0
- package/esm/foundation/service/container/index.d.ts +28 -0
- package/esm/foundation/service/container/index.js +256 -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-bus/ability/callback.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/callback.js +55 -0
- package/esm/foundation/service/event-bus/ability/globalData.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/globalData.js +89 -0
- package/esm/foundation/service/event-bus/ability/request.d.ts +10 -0
- package/esm/foundation/service/event-bus/ability/request.js +151 -0
- package/esm/foundation/service/event-bus/ability/security.d.ts +12 -0
- package/esm/foundation/service/event-bus/ability/security.js +151 -0
- package/esm/foundation/service/event-bus/ability/tracker.d.ts +9 -0
- package/esm/foundation/service/event-bus/ability/tracker.js +80 -0
- package/esm/foundation/service/event-bus/busManager.d.ts +127 -0
- package/esm/foundation/service/event-bus/busManager.js +398 -0
- package/esm/foundation/service/event-bus/index.d.ts +20 -0
- package/esm/foundation/service/event-bus/index.js +88 -0
- package/esm/foundation/service/event-center.d.ts +75 -0
- package/esm/foundation/service/event-center.js +244 -0
- package/esm/foundation/service/global-data/index.d.ts +11 -0
- package/esm/foundation/service/global-data/index.js +69 -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 +235 -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 +211 -0
- package/esm/foundation/service/security/index.d.ts +26 -0
- package/esm/foundation/service/security/index.js +216 -0
- package/esm/{util → foundation/service/security}/security.d.ts +2 -2
- package/esm/{util → foundation/service/security}/security.js +3 -3
- package/esm/foundation/types/index.d.ts +4 -0
- package/esm/foundation/types/index.js +4 -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/redirect_utils.d.ts +6 -0
- package/esm/foundation/utils/redirect_utils.js +99 -0
- package/esm/foundation/utils/system_events.d.ts +4 -0
- package/esm/foundation/utils/system_events.js +71 -0
- package/esm/foundation/utils/web_app_url_utils.d.ts +37 -0
- package/esm/foundation/utils/web_app_url_utils.js +97 -0
- package/esm/index.d.ts +16 -10
- package/esm/index.js +70 -59
- package/esm/plugin/applepay/component.js +3 -3
- package/esm/plugin/applepay/service.d.ts +2 -2
- package/esm/plugin/applepay/service.js +2 -2
- package/esm/plugin/component/cashierApp.d.ts +7 -5
- package/esm/plugin/component/cashierApp.js +16 -8
- package/esm/plugin/component/channel.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.d.ts +4 -4
- package/esm/plugin/component/component.inline.style.js +10 -7
- package/esm/plugin/component/component.popup.style.d.ts +15 -6
- package/esm/plugin/component/component.popup.style.js +33 -15
- package/esm/plugin/component/index.d.ts +8 -7
- package/esm/plugin/component/index.js +153 -98
- 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 +1 -1
- package/esm/plugin/payment-element/utils.js +2 -1
- package/esm/plugin/type.d.ts +4 -4
- 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 +2 -0
- package/esm/types/index.d.ts +240 -38
- package/esm/types/index.js +103 -59
- package/esm/util/createIframeNode.d.ts +2 -2
- package/esm/util/createIframeNode.js +3 -3
- package/esm/util/index.d.ts +1 -1
- package/esm/util/index.js +3 -4
- package/package.json +2 -1
@@ -0,0 +1,35 @@
|
|
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
|
+
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
6
|
+
ThemeType["NostalgicGray"] = "nostalgicGray";
|
7
|
+
ThemeType["Default"] = "default";
|
8
|
+
ThemeType["Night"] = "night";
|
9
|
+
ThemeType["CherryBlossomPink"] = "cherryBlossomPink";
|
10
|
+
ThemeType["GamingPurple"] = "gamingPurple";
|
11
|
+
ThemeType["AgateGreen"] = "agateGreen";
|
12
|
+
return ThemeType;
|
13
|
+
}({});
|
14
|
+
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
|
15
|
+
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
|
16
|
+
EventCallbackCode["Failed"] = "Failed";
|
17
|
+
EventCallbackCode["Completed"] = "Completed";
|
18
|
+
return EventCallbackCode;
|
19
|
+
}({});
|
20
|
+
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
21
|
+
ELEMENT_ENVIRONMENT["DEV"] = "DEV";
|
22
|
+
ELEMENT_ENVIRONMENT["TEST"] = "TEST";
|
23
|
+
ELEMENT_ENVIRONMENT["SIT"] = "SIT";
|
24
|
+
ELEMENT_ENVIRONMENT["PRE"] = "PRE";
|
25
|
+
ELEMENT_ENVIRONMENT["PROD"] = "PROD";
|
26
|
+
return ELEMENT_ENVIRONMENT;
|
27
|
+
}({});
|
28
|
+
// export type IMountOptions = AddressMountOptions | LinkAuthMountOptions | PaymentMountOptions;
|
29
|
+
|
30
|
+
export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbackName) {
|
31
|
+
AddressEventCallbackName["SHIPPING_CHANGE"] = "SHIPPING_CHANGE";
|
32
|
+
return AddressEventCallbackName;
|
33
|
+
}({});
|
34
|
+
|
35
|
+
// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
export interface ISessionDataExtendInfo {
|
2
|
+
displayLayout: 'LEFT_ORDER_AND_RIGHT_PAYMENT' | 'LEFT_PAYMENT_AND_RIGHT_ORDER';
|
3
|
+
displayAntomLogo: string;
|
4
|
+
themeType: 'LIGHT' | 'NIGHT' | 'CUSTOMIZE';
|
5
|
+
OPEN_MULTI_PAYMENT_ABILITY: boolean;
|
6
|
+
[key: string]: any;
|
7
|
+
}
|
8
|
+
export interface LinkData {
|
9
|
+
linkId: string;
|
10
|
+
region: string;
|
11
|
+
displaySetting?: ISessionDataExtendInfo;
|
12
|
+
}
|
13
|
+
export declare const displayIframe: (selector: string) => void;
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import ComponentApp from '../../plugin/component';
|
2
|
-
import {
|
2
|
+
import { ComponentSignEnum, IcreateComponent, IOptionsParams, IPaymentSessionMetaData, Iselector, Isubmit, PaymentMethodTypeEnum, SubPaymentMethodTypeEnum } from '../../types';
|
3
3
|
import CoreInstance from '../instance/index';
|
4
|
-
export declare const getComponentSign: (params:
|
5
|
-
export declare const parseSessionData: (sessionData: string) => [
|
6
|
-
export type IAMSComponentOptions =
|
4
|
+
export declare const getComponentSign: (params: IPaymentSessionMetaData) => ComponentSignEnum;
|
5
|
+
export declare const parseSessionData: (sessionData: string) => [IPaymentSessionMetaData, string];
|
6
|
+
export type IAMSComponentOptions = IOptionsParams & {
|
7
7
|
appVersion: string;
|
8
8
|
};
|
9
9
|
export declare class AMSComponent extends CoreInstance {
|
10
10
|
_componentApp: ComponentApp;
|
11
|
-
channelType:
|
11
|
+
channelType: ComponentSignEnum[];
|
12
12
|
productSceneVersion: string;
|
13
13
|
timer: any;
|
14
14
|
constructor(options: IAMSComponentOptions);
|
@@ -40,10 +40,10 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
|
|
40
40
|
import ComponentApp from "../../plugin/component";
|
41
41
|
import { ExtendPlugin } from "../../plugin/const";
|
42
42
|
import { PaypalBusSubscriber } from "../../plugin/paypal";
|
43
|
-
import {
|
43
|
+
import { ComponentSignEnum, ComponentSignEnumV2, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum, DisplayTypeEnum } from "../../types";
|
44
44
|
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
45
45
|
import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
|
46
|
-
import { getSecurityConfigStorageKey } from "../../
|
46
|
+
import { getSecurityConfigStorageKey } from "../../foundation/service/security/security";
|
47
47
|
import { BusManager, BusMessage } from "../bus";
|
48
48
|
import { SDKCallbackBusSubscriber } from "../bus/ability/callback";
|
49
49
|
import { SecurityBusSubscriber } from "../bus/ability/security";
|
@@ -59,7 +59,7 @@ export var getComponentSign = function getComponentSign(params) {
|
|
59
59
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
60
60
|
if (productScene && paymentMethodCategoryType) return "".concat(productScene, "_").concat(paymentMethodCategoryType);
|
61
61
|
if (productScene) return "".concat(productScene);
|
62
|
-
return
|
62
|
+
return ComponentSignEnum.NONE;
|
63
63
|
};
|
64
64
|
export var parseSessionData = function parseSessionData(sessionData) {
|
65
65
|
try {
|
@@ -74,7 +74,7 @@ export var parseSessionData = function parseSessionData(sessionData) {
|
|
74
74
|
var resetEasyPaySceneVersion = function resetEasyPaySceneVersion(parseData) {
|
75
75
|
if (isPC() && parseData !== null && parseData !== void 0 && parseData.paymentSessionConfig) {
|
76
76
|
var productScene = parseData.paymentSessionConfig.productScene;
|
77
|
-
if (productScene ===
|
77
|
+
if (productScene === ProductSceneEnum.EASY_PAY) {
|
78
78
|
var _parseData$paymentMet;
|
79
79
|
// 非TOSS渠道,在PC场景需要改成1.0
|
80
80
|
if ('BANKTRANSFER_QUICKPAY' !== (parseData === null || parseData === void 0 || (_parseData$paymentMet = parseData.paymentMethodInfoView) === null || _parseData$paymentMet === void 0 ? void 0 : _parseData$paymentMet.paymentMethodType)) {
|
@@ -92,25 +92,26 @@ var handleSessionData = function handleSessionData(originSessionData) {
|
|
92
92
|
return [parseData !== null && parseData !== void 0 ? parseData : {}, sessionData];
|
93
93
|
};
|
94
94
|
var handleParams = function handleParams(params, _this) {
|
95
|
+
var _parseData$connectFac;
|
95
96
|
var _params = Object.assign({
|
96
97
|
paymentSessionMetaData: {},
|
97
|
-
renderDisplayType:
|
98
|
+
renderDisplayType: DisplayTypeEnum.popup
|
98
99
|
}, params);
|
99
100
|
var _handleSessionData = handleSessionData(_params.sessionData || (_params === null || _params === void 0 ? void 0 : _params.paymentSessionData)),
|
100
101
|
_handleSessionData2 = _slicedToArray(_handleSessionData, 2),
|
101
102
|
parseData = _handleSessionData2[0],
|
102
103
|
sessionData = _handleSessionData2[1];
|
103
104
|
var componentSign = getComponentSign(parseData);
|
104
|
-
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType ===
|
105
|
+
if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup) {
|
105
106
|
return Promise.reject({
|
106
107
|
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
107
108
|
message: "unsupported payment method"
|
108
109
|
});
|
109
110
|
}
|
110
|
-
if (_this.options.product ===
|
111
|
-
componentSign =
|
111
|
+
if (_this.options.product === ProductSceneEnum.ELEMENT_ADDRESS) {
|
112
|
+
componentSign = ComponentSignEnum.ELEMENT_ADDRESS;
|
112
113
|
}
|
113
|
-
if (componentSign ===
|
114
|
+
if (componentSign === ComponentSignEnum.NONE) {
|
114
115
|
// eslint-disable-next-line prefer-promise-reject-errors
|
115
116
|
return Promise.reject({
|
116
117
|
code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
|
@@ -124,6 +125,9 @@ var handleParams = function handleParams(params, _this) {
|
|
124
125
|
}
|
125
126
|
_params.sessionData = sessionData;
|
126
127
|
_params.paymentSessionMetaData = parseData;
|
128
|
+
if (parseData.paymentSessionConfig.productScene === "ELEMENT_PAYMENT" && parseData !== null && parseData !== void 0 && (_parseData$connectFac = parseData.connectFactor) !== null && _parseData$connectFac !== void 0 && _parseData$connectFac.enableConnect) {
|
129
|
+
console.log('截断处理payment render数据---------------');
|
130
|
+
}
|
127
131
|
return Promise.resolve({
|
128
132
|
iframeNodesParams: _params,
|
129
133
|
componentSign: componentSign
|
@@ -163,7 +167,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
163
167
|
selector: selector,
|
164
168
|
renderDisplayType: renderDisplayType
|
165
169
|
}, params);
|
166
|
-
if (this.options.product !==
|
170
|
+
if (this.options.product !== ProductSceneEnum.ELEMENT_ADDRESS && _params && !_params.sessionData && !(_params !== null && _params !== void 0 && _params.paymentSessionData)) {
|
167
171
|
return Promise.reject(ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR);
|
168
172
|
}
|
169
173
|
if (this.options.networkMode === networkModeEnum.proxy) {
|
@@ -201,7 +205,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
201
205
|
return _pluginAppendIframe.apply(this, arguments);
|
202
206
|
}
|
203
207
|
return pluginAppendIframe;
|
204
|
-
}()
|
208
|
+
}() // 保存服务端下发的支付信息,用于下次预加载
|
205
209
|
}, {
|
206
210
|
key: "savePreviousChannel",
|
207
211
|
value: function savePreviousChannel(iframeNodesParams) {
|
@@ -235,7 +239,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
235
239
|
});
|
236
240
|
}
|
237
241
|
var previousChannel = {
|
238
|
-
channelType: channelType ===
|
242
|
+
channelType: channelType === ComponentSignEnum.VAULTING_CARD ? ComponentSignEnum.CASHIER_PAYMENT_CARD : channelType,
|
239
243
|
productSceneVersion: productSceneVersion
|
240
244
|
};
|
241
245
|
localStorage.setItem('antom_checkout_previousChannel', JSON.stringify(previousChannel));
|
@@ -249,7 +253,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
249
253
|
value: function registerBusAbility() {
|
250
254
|
var _this$originOptions,
|
251
255
|
_this3 = this;
|
252
|
-
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !==
|
256
|
+
BusManager.debugTrace(((_this$originOptions = this.originOptions) === null || _this$originOptions === void 0 ? void 0 : _this$originOptions.environment) !== EnvironmentEnum.prod, this.logger);
|
253
257
|
BusManager.clear();
|
254
258
|
BusManager.addInterceptor({
|
255
259
|
onPublishException: function onPublishException(message, e) {
|
@@ -353,7 +357,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
353
357
|
this.logger.setComponentStartTime(Date.now());
|
354
358
|
return this.parameterInitAndCheck({
|
355
359
|
params: params,
|
356
|
-
renderDisplayType:
|
360
|
+
renderDisplayType: DisplayTypeEnum.popup
|
357
361
|
}).then(function (_params) {
|
358
362
|
return handleParams(_params, _this5);
|
359
363
|
}).catch(function (error) {
|
@@ -444,7 +448,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
444
448
|
this.logger.setComponentStartTime(Date.now());
|
445
449
|
return this.parameterInitAndCheck({
|
446
450
|
params: params,
|
447
|
-
renderDisplayType:
|
451
|
+
renderDisplayType: DisplayTypeEnum.inline,
|
448
452
|
selector: selector
|
449
453
|
}).then(function (_params) {
|
450
454
|
return handleParams(_params, _this7);
|
@@ -477,7 +481,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
|
|
477
481
|
return Promise.resolve();
|
478
482
|
}
|
479
483
|
var iframeNodesParams = appendParams.iframeNodesParams;
|
480
|
-
if (this.options.product !==
|
484
|
+
if (this.options.product !== ProductSceneEnum.ELEMENT_ADDRESS) {
|
481
485
|
this.savePreviousChannel(iframeNodesParams);
|
482
486
|
}
|
483
487
|
return this.pluginAppendIframe(appendParams);
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { IcreatePaymentParams,
|
2
|
-
export declare const mixinDropInConstructor: (options:
|
1
|
+
import { IcreatePaymentParams, IOptionsParams } from '../../types';
|
2
|
+
export declare const mixinDropInConstructor: (options: IOptionsParams, context: any) => void;
|
3
3
|
/**
|
4
4
|
* @description Create checkout application
|
5
5
|
* @description drop-in
|
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
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
|
-
import {
|
14
|
+
import { MessageName, networkModeEnum } from "../../types";
|
15
15
|
import { createIframeNode } from "../../util/createIframeNode";
|
16
16
|
export var mixinDropInConstructor = function mixinDropInConstructor(options, context) {
|
17
17
|
// Instantiate the plug-in and set render
|
@@ -57,7 +57,7 @@ export var confirmPayment = function confirmPayment(result) {
|
|
57
57
|
});
|
58
58
|
});
|
59
59
|
_this2.eventCenter.emit("".concat(BASEPLUGINID, "-handleRequestPayment"), {
|
60
|
-
name:
|
60
|
+
name: MessageName.SDK_TO_APP,
|
61
61
|
mode: _this2.options.mode,
|
62
62
|
appId: BASEPLUGINID,
|
63
63
|
instanceId: _this2._instanceId,
|
@@ -5,15 +5,15 @@
|
|
5
5
|
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
6
6
|
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
|
7
7
|
*/
|
8
|
-
import { ComponentActionNamesType } from
|
8
|
+
import { ComponentActionNamesType } from "../../plugin/type";
|
9
9
|
import ComponentApp from '../../plugin/component';
|
10
|
-
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig,
|
10
|
+
import type { AMSCheckoutOptions, IAppendParams, InitSecurityConfig, IOptionsParams } from '../../types/index';
|
11
11
|
import { EventCenter } from '../../util/index';
|
12
12
|
import { Logger } from '../../util/logger';
|
13
|
-
import { Security } from '../../
|
13
|
+
import { Security } from '../../foundation/service/security/security';
|
14
14
|
export default class AMSSDK {
|
15
15
|
options: AMSCheckoutOptions;
|
16
|
-
originOptions:
|
16
|
+
originOptions: IOptionsParams;
|
17
17
|
logger: Logger;
|
18
18
|
_eventCenter: EventCenter;
|
19
19
|
_instanceId: string;
|
@@ -22,7 +22,7 @@ export default class AMSSDK {
|
|
22
22
|
_componentApp: ComponentApp;
|
23
23
|
protected securitySdkMap: Map<string, Security>;
|
24
24
|
protected plugins: Map<string, any>;
|
25
|
-
constructor(options:
|
25
|
+
constructor(options: IOptionsParams);
|
26
26
|
private preInitSecurity;
|
27
27
|
/**
|
28
28
|
* @description Destroy and process some contents of the plug-in
|
@@ -24,11 +24,11 @@ import { v4 as uuid } from 'uuid';
|
|
24
24
|
import { sdkVersion } from "../../config/index";
|
25
25
|
import { ERRORMESSAGE, EVENT } from "../../constant";
|
26
26
|
import { antomConfig } from "../../service";
|
27
|
-
import {
|
27
|
+
import { EnvironmentEnum, modeEnum, networkModeEnum, osTypeEnum, ProductSceneEnum, terminalTypeEnum } from "../../types/index";
|
28
28
|
import { checkTimeElapsed, device, EventCenter, getOrSetStorageId, getType, queryParse, safeJson } from "../../util/index";
|
29
29
|
import CallApp from "../../util/intl-callapp/es/main";
|
30
30
|
import { LogConfig, Logger } from "../../util/logger";
|
31
|
-
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../
|
31
|
+
import { getSecurityConfigStorageKey, getSecurityHost, getSecurityScene, Security, SecurityRegionEnum } from "../../foundation/service/security/security";
|
32
32
|
import { compareVersion } from "../../util/versionCompare";
|
33
33
|
import { BusManager, BusMessage } from "../bus";
|
34
34
|
var AMSSDK = /*#__PURE__*/function () {
|
@@ -61,7 +61,8 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
61
61
|
this._storageId = _storageId;
|
62
62
|
|
63
63
|
// TODO Consumption data analysis control parameters
|
64
|
-
|
64
|
+
// Move to LoggerService
|
65
|
+
this.logger = new Logger(LogConfig, ![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
|
65
66
|
Logger.setInstance(this.logger);
|
66
67
|
this.logger.setMedta({
|
67
68
|
instanceId: this._instanceId
|
@@ -81,7 +82,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
81
82
|
var _this$options;
|
82
83
|
var antomSDKConfigKey = 'antomSDKConfigKey';
|
83
84
|
var config = safeJson(getOrSetStorageId(antomSDKConfigKey), {});
|
84
|
-
if (![
|
85
|
+
if (![EnvironmentEnum.prod, EnvironmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment)) return;
|
85
86
|
if (checkTimeElapsed()) {
|
86
87
|
antomConfig({
|
87
88
|
env: this.options.env.environment
|
@@ -89,7 +90,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
89
90
|
getOrSetStorageId(antomSDKConfigKey, JSON.stringify(res));
|
90
91
|
});
|
91
92
|
}
|
92
|
-
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) ||
|
93
|
+
var product = ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.product) || ProductSceneEnum.EASY_PAY;
|
93
94
|
var enable = true;
|
94
95
|
try {
|
95
96
|
var matchingConfig = config['pl_sec'].find(function (item) {
|
@@ -157,9 +158,9 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
157
158
|
value: function initSecurity(_ref) {
|
158
159
|
var _this = this;
|
159
160
|
var _ref$product = _ref.product,
|
160
|
-
product = _ref$product === void 0 ?
|
161
|
+
product = _ref$product === void 0 ? ProductSceneEnum.EASY_PAY : _ref$product,
|
161
162
|
_ref$scene = _ref.scene,
|
162
|
-
scene = _ref$scene === void 0 ?
|
163
|
+
scene = _ref$scene === void 0 ? ProductSceneEnum.EASY_PAY : _ref$scene;
|
163
164
|
this.logger.logInfo({
|
164
165
|
title: 'sdk_event_securitySdkPreInit'
|
165
166
|
}, {
|
@@ -258,7 +259,7 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
258
259
|
value: function _setEnv(options) {
|
259
260
|
var _queryParse = queryParse(),
|
260
261
|
_moreEnv = _queryParse._moreEnv;
|
261
|
-
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in
|
262
|
+
if (options !== null && options !== void 0 && options.environment && !((options === null || options === void 0 ? void 0 : options.environment) in EnvironmentEnum) && _moreEnv !== 'true') {
|
262
263
|
console.warn(ERRORMESSAGE.INIT_PARAMETER_ERROR.ENVIRONMENT_ERROR.message);
|
263
264
|
options.environment = 'prod';
|
264
265
|
}
|
@@ -488,8 +489,8 @@ var AMSSDK = /*#__PURE__*/function () {
|
|
488
489
|
}
|
489
490
|
actionNames = this._getPlugin(pluginKey);
|
490
491
|
}
|
491
|
-
if (this.options.product ===
|
492
|
-
actionNames = this._getPlugin(
|
492
|
+
if (this.options.product === ProductSceneEnum.ELEMENT_ADDRESS) {
|
493
|
+
actionNames = this._getPlugin(ProductSceneEnum.ELEMENT_ADDRESS);
|
493
494
|
}
|
494
495
|
return actionNames;
|
495
496
|
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { IOptionsParams, ProductSceneEnum } from '../../types';
|
2
|
+
import { BizFlowResult, PaymentContext, ProductProcessor, StartBizFlowOptions } from '../index';
|
3
|
+
import { ServiceProvider } from '../service';
|
4
|
+
/**
|
5
|
+
* @author 谦彧 <zhangmian.zm@alipay.com>
|
6
|
+
* @date 2024/9/17
|
7
|
+
*/
|
8
|
+
export declare class AntomSDKCore {
|
9
|
+
private bizFlowResult;
|
10
|
+
private initOptions;
|
11
|
+
private paymentContext;
|
12
|
+
private instanceId;
|
13
|
+
private sdkMetaData;
|
14
|
+
private productProcessors;
|
15
|
+
constructor();
|
16
|
+
registerProcessor(productScene: string, paymentMethod: string, processor: ProductProcessor): void;
|
17
|
+
init(options: IOptionsParams, productScene: ProductSceneEnum): void;
|
18
|
+
private prepare;
|
19
|
+
startBizFlow(options: StartBizFlowOptions): Promise<void>;
|
20
|
+
getServiceProvider(): ServiceProvider;
|
21
|
+
getBizFlowResult(): BizFlowResult;
|
22
|
+
getPaymentContext(): PaymentContext;
|
23
|
+
destroy(): void;
|
24
|
+
private handleBehaviorRender;
|
25
|
+
private cleanRender;
|
26
|
+
}
|