@alipay/ams-checkout 1.38.0 → 1.40.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/component/component.inline.style.js +1 -1
- package/esm/component/popupWindow.style.d.ts +4 -1
- package/esm/component/popupWindow.style.js +33 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +7 -7
- package/esm/constant/index.d.ts +7 -0
- package/esm/constant/index.js +7 -0
- package/esm/core/component/element/elementController/index.js +22 -14
- package/esm/core/component/element/type.d.ts +29 -15
- package/esm/core/component/element/type.js +20 -12
- package/esm/core/component/index.d.ts +1 -1
- package/esm/foundation/product-processor/autoDebit/deps.d.ts +14 -0
- package/esm/foundation/product-processor/autoDebit/deps.js +12 -0
- package/esm/foundation/product-processor/autoDebit/index.d.ts +48 -0
- package/esm/foundation/product-processor/autoDebit/index.js +466 -0
- package/esm/foundation/service/container/index.d.ts +2 -0
- package/esm/foundation/service/container/index.js +48 -24
- package/esm/foundation/service/container/popup.d.ts +9 -6
- package/esm/foundation/service/container/popup.js +3 -1
- package/esm/foundation/service/requester/requester.js +2 -2
- package/esm/foundation/utils/web_app_url_utils.d.ts +3 -3
- package/esm/foundation/utils/web_app_url_utils.js +15 -11
- package/esm/index.d.ts +7 -4
- package/esm/index.js +96 -47
- package/esm/plugin/component/cashierApp.js +2 -2
- package/esm/request/index.js +2 -2
- package/esm/types/index.d.ts +9 -2
- package/esm/types/index.js +2 -1
- package/esm/util/index.d.ts +8 -1
- package/esm/util/index.js +31 -3
- package/esm/util/spm-map.d.ts +18 -4
- package/esm/util/spm-map.js +20 -6
- package/package.json +1 -1
@@ -95,7 +95,7 @@ var renderElementPayment = function renderElementPayment(type) {
|
|
95
95
|
export var addInlineLoading = function addInlineLoading(_selector, platform, options) {
|
96
96
|
var loading = document.createElement('div');
|
97
97
|
loading.id = LOADING_ID;
|
98
|
-
if (options.componentSign === ComponentSignEnum.ELEMENT_PAYMENT) {
|
98
|
+
if ((options === null || options === void 0 ? void 0 : options.componentSign) === ComponentSignEnum.ELEMENT_PAYMENT) {
|
99
99
|
if (options.isExpressCheckout) {
|
100
100
|
loading.innerHTML = '';
|
101
101
|
} else {
|
@@ -2,10 +2,13 @@ export declare const createCustomSheet: (curTheme?: 'dark' | 'light') => void;
|
|
2
2
|
export declare const renderPopupLoading: (container: HTMLDivElement, curTheme: 'dark' | 'light') => void;
|
3
3
|
export declare const removePopupLoading: (isShowMockup?: boolean) => void;
|
4
4
|
export declare const insertStyleSheet: () => void;
|
5
|
-
export declare
|
5
|
+
export declare function createCloseIcon(onClose: () => void): HTMLDivElement;
|
6
|
+
export declare const createModal: ({ device, url, widthPadding, loadingConfig, showCloseOnLoading, onCloseOnLoading }: {
|
6
7
|
device: any;
|
7
8
|
url: any;
|
8
9
|
widthPadding: any;
|
9
10
|
loadingConfig: any;
|
11
|
+
showCloseOnLoading: any;
|
12
|
+
onCloseOnLoading: any;
|
10
13
|
}) => Promise<HTMLIFrameElement>;
|
11
14
|
export declare const destroyModal: () => void;
|
@@ -47,6 +47,27 @@ export var insertStyleSheet = function insertStyleSheet() {
|
|
47
47
|
style.innerHTML = modalStyles;
|
48
48
|
document.head.appendChild(style);
|
49
49
|
};
|
50
|
+
export function createCloseIcon(onClose) {
|
51
|
+
var closeIcon = document.createElement('div');
|
52
|
+
closeIcon.style.position = 'absolute';
|
53
|
+
closeIcon.style.right = '16px';
|
54
|
+
closeIcon.style.top = '23px';
|
55
|
+
closeIcon.style.cursor = 'pointer';
|
56
|
+
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
57
|
+
svg.setAttribute('width', '16');
|
58
|
+
svg.setAttribute('height', '16');
|
59
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
60
|
+
svg.setAttribute('fill', 'none');
|
61
|
+
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
62
|
+
path.setAttribute('fill-rule', 'evenodd');
|
63
|
+
path.setAttribute('clip-rule', 'evenodd');
|
64
|
+
path.setAttribute('d', 'M13.0449 2.99894L12.9494 2.91165L12.8685 2.85222L12.7802 2.7996C12.3611 2.57499 11.8556 2.64328 11.5228 2.9763L7.99909 6.50088L4.48854 2.99028L4.44701 2.95034C4.0098 2.57169 3.38048 2.57202 2.99838 2.9525L2.92363 3.03297L2.85175 3.12897L2.79916 3.21735C2.57471 3.63642 2.64292 4.14198 2.9757 4.47491L6.50186 8.00046L2.95226 11.5518C2.57141 11.9917 2.57173 12.6211 2.95197 13.0033L3.0324 13.078L3.12837 13.15L3.21674 13.2026C3.63573 13.4272 4.14123 13.3589 4.47407 13.0259L7.99909 9.49935L11.5474 13.0494C11.9944 13.4368 12.6238 13.4235 13.0212 13.0259L13.0922 12.9471L13.1559 12.8595C13.4298 12.4403 13.3789 11.8852 13.0211 11.5272L9.497 8.00115L13.0052 4.4915L13.07 4.4225C13.4304 4.00477 13.4199 3.37582 13.0449 2.99894Z');
|
65
|
+
path.setAttribute('fill', '#ABB9CC');
|
66
|
+
svg.appendChild(path);
|
67
|
+
closeIcon.appendChild(svg);
|
68
|
+
closeIcon.onclick = onClose;
|
69
|
+
return closeIcon;
|
70
|
+
}
|
50
71
|
var modalDevice = 'desktop';
|
51
72
|
// 插入弹窗
|
52
73
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
@@ -54,7 +75,9 @@ export var createModal = function createModal(_ref) {
|
|
54
75
|
var device = _ref.device,
|
55
76
|
url = _ref.url,
|
56
77
|
widthPadding = _ref.widthPadding,
|
57
|
-
loadingConfig = _ref.loadingConfig
|
78
|
+
loadingConfig = _ref.loadingConfig,
|
79
|
+
showCloseOnLoading = _ref.showCloseOnLoading,
|
80
|
+
onCloseOnLoading = _ref.onCloseOnLoading;
|
58
81
|
return new Promise(function (resolve, reject) {
|
59
82
|
try {
|
60
83
|
modalDevice = device;
|
@@ -87,6 +110,15 @@ export var createModal = function createModal(_ref) {
|
|
87
110
|
modal.style.backgroundColor = backgroundPrimary;
|
88
111
|
iframe.style.backgroundColor = backgroundPrimary;
|
89
112
|
}
|
113
|
+
|
114
|
+
// 弹窗渲染loading时关闭按钮逻辑
|
115
|
+
if (showCloseOnLoading) {
|
116
|
+
var closeIcon = createCloseIcon(onCloseOnLoading);
|
117
|
+
modal.appendChild(closeIcon);
|
118
|
+
iframe.addEventListener('load', function () {
|
119
|
+
modal.removeChild(closeIcon);
|
120
|
+
});
|
121
|
+
}
|
90
122
|
modal.appendChild(iframe);
|
91
123
|
var body = document.getElementsByTagName('body')[0];
|
92
124
|
body.appendChild(overlay);
|
package/esm/config/index.d.ts
CHANGED
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
|
|
5
5
|
/**
|
6
6
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
7
7
|
*/
|
8
|
-
export declare const AMSCheckoutAppVersion = "1.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.40.0";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.40.0";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.40.0";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.40.0";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.40.0";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.40.0";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.40.0";
|
package/esm/config/index.js
CHANGED
@@ -35,10 +35,10 @@ export var sdkVersion = json.version;
|
|
35
35
|
/**
|
36
36
|
* @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
|
37
37
|
*/
|
38
|
-
export var AMSCheckoutAppVersion = '1.
|
39
|
-
export var AMSAutoDebitAppVersion = '1.
|
40
|
-
export var AMSEasyPayAppVersion = '1.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.
|
42
|
-
export var AMSVaultingAppVersion = '1.
|
43
|
-
export var AMSPaymentElementAppVersion = '1.
|
44
|
-
export var ADDRESSElementAppVersion = '1.
|
38
|
+
export var AMSCheckoutAppVersion = '1.40.0'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.40.0'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.40.0'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.40.0'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.40.0'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.40.0'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.40.0'; // address element
|
package/esm/constant/index.d.ts
CHANGED
@@ -238,6 +238,13 @@ export declare const EVENT: {
|
|
238
238
|
inputFocus: {
|
239
239
|
name: string;
|
240
240
|
};
|
241
|
+
/**
|
242
|
+
* 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
|
243
|
+
* TODO 推荐使用BusManager
|
244
|
+
*/
|
245
|
+
messageForward: {
|
246
|
+
name: string;
|
247
|
+
};
|
241
248
|
};
|
242
249
|
export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
|
243
250
|
export declare const COMPONENT_SECTION_ID = "ams-component-section";
|
package/esm/constant/index.js
CHANGED
@@ -239,6 +239,13 @@ export var EVENT = {
|
|
239
239
|
},
|
240
240
|
inputFocus: {
|
241
241
|
name: 'onInputFocus'
|
242
|
+
},
|
243
|
+
/**
|
244
|
+
* 通过SDK转发web应用消息给其他web应用(用于iframe之间消息互通)
|
245
|
+
* TODO 推荐使用BusManager
|
246
|
+
*/
|
247
|
+
messageForward: {
|
248
|
+
name: 'onMessageForward'
|
242
249
|
}
|
243
250
|
};
|
244
251
|
export var COMPONENT_CONTAINER_ID = 'ams-component-container';
|
@@ -20,19 +20,19 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
20
20
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
21
21
|
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); }
|
22
22
|
import { cleanMockup, removeRetentionPopup } from "../../../../component/component.popup.style";
|
23
|
+
import { destroyModal } from "../../../../component/popupWindow.style";
|
23
24
|
import { ERRORMESSAGE, EVENT } from "../../../../constant";
|
24
25
|
import AddressProcessor from "../../../../core/component/element/elementProcessor/addressProcessor";
|
25
26
|
import AuthProcessor from "../../../../core/component/element/elementProcessor/authProcessor";
|
26
27
|
import PaymentProcessor from "../../../../core/component/element/elementProcessor/paymentProcessor";
|
27
28
|
import { IElementStatus } from "../../../../foundation";
|
28
29
|
import { AntomSDKCore } from "../../../../foundation/core";
|
29
|
-
import { destroyModal } from "../../../../component/popupWindow.style";
|
30
30
|
import { ElementProcessor } from "../../../../foundation/product-processor/element";
|
31
31
|
import { ProductSceneEnum } from "../../../../types";
|
32
32
|
import { ElementContainerService } from "../elementContainerService"; // 引入 ElementContainerService
|
33
33
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
34
34
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
35
|
-
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode } from "../type";
|
35
|
+
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, MountElementType } from "../type";
|
36
36
|
import { checkCanMount, checkCanUpdate, handleRedirect, showToast } from "../util";
|
37
37
|
var TIMEOUT_DURATION = 10000;
|
38
38
|
var ElementController = /*#__PURE__*/function () {
|
@@ -100,10 +100,14 @@ var ElementController = /*#__PURE__*/function () {
|
|
100
100
|
value: function onEventCallback(_ref) {
|
101
101
|
var _this$options, _this$options$onEvent;
|
102
102
|
var code = _ref.code,
|
103
|
-
message = _ref.message
|
103
|
+
_ref$message = _ref.message,
|
104
|
+
message = _ref$message === void 0 ? '' : _ref$message,
|
105
|
+
_ref$result = _ref.result,
|
106
|
+
result = _ref$result === void 0 ? undefined : _ref$result;
|
104
107
|
this === null || this === void 0 || (_this$options = this.options) === null || _this$options === void 0 || (_this$options$onEvent = _this$options.onEventCallback) === null || _this$options$onEvent === void 0 || _this$options$onEvent.call(_this$options, {
|
105
108
|
code: code,
|
106
|
-
message: message
|
109
|
+
message: message,
|
110
|
+
result: result
|
107
111
|
});
|
108
112
|
}
|
109
113
|
}, {
|
@@ -278,11 +282,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
278
282
|
key: "addEventListener",
|
279
283
|
value: function addEventListener(renderCallback) {
|
280
284
|
var _this4 = this;
|
281
|
-
this.serviceMap.EventCenter.listen(ElementPaymentEvent.
|
282
|
-
|
283
|
-
|
284
|
-
(_this4$elementProcess = (_this4$elementProcess2 = _this4.elementProcessors[data.source].eventListener)[data.event]) === null || _this4$elementProcess === void 0 || _this4$elementProcess.call(_this4$elementProcess2, data.data);
|
285
|
-
}
|
285
|
+
this.serviceMap.EventCenter.listen(ElementPaymentEvent.ON_EVENT_CALLBACK, function (data) {
|
286
|
+
var _this4$onEventCallbac;
|
287
|
+
(_this4$onEventCallbac = _this4.onEventCallback) === null || _this4$onEventCallbac === void 0 || _this4$onEventCallbac.call(_this4, data);
|
286
288
|
});
|
287
289
|
this.serviceMap.EventCenter.listen(EVENT.sizeChanged.name, function (data) {
|
288
290
|
clearTimeout(_this4.initTimeout);
|
@@ -323,9 +325,15 @@ var ElementController = /*#__PURE__*/function () {
|
|
323
325
|
this.serviceMap.EventCenter.listen(EVENT.showToast.name, function (data) {
|
324
326
|
showToast(data);
|
325
327
|
});
|
326
|
-
this.serviceMap.EventCenter.listen(
|
327
|
-
var
|
328
|
-
|
328
|
+
this.serviceMap.EventCenter.listen(EVENT.messageForward.name, function (data) {
|
329
|
+
var source = MountElementType[data.source];
|
330
|
+
var target = MountElementType[data.target];
|
331
|
+
if (_this4.elementProcessors[source] && _this4.elementProcessors[target]) {
|
332
|
+
_this4.elementProcessors[target].eventCenter.dispatchToApp({
|
333
|
+
event: data.event,
|
334
|
+
data: data
|
335
|
+
});
|
336
|
+
}
|
329
337
|
});
|
330
338
|
}
|
331
339
|
}, {
|
@@ -362,11 +370,11 @@ var ElementController = /*#__PURE__*/function () {
|
|
362
370
|
var paymentSessionObj = paymentContext.paymentSessionObj;
|
363
371
|
var isConnect = paymentSessionObj.connectFactor.enableConnect && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
|
364
372
|
if (!(paymentResult !== null && paymentResult !== void 0 && (_paymentResult$origin = paymentResult.originActionQueryResult) !== null && _paymentResult$origin !== void 0 && _paymentResult$origin.success) && isConnect) {
|
365
|
-
var _this$
|
373
|
+
var _this$onEventCallback;
|
366
374
|
clearTimeout(this.initTimeout);
|
367
375
|
this.changeLoading(false);
|
368
376
|
this.initTimeout = null;
|
369
|
-
(_this$
|
377
|
+
(_this$onEventCallback = this.onEventCallback) === null || _this$onEventCallback === void 0 || _this$onEventCallback.call(this, {
|
370
378
|
code: EventCallbackCode.SDK_CREATE_COMPONENT_ERROR,
|
371
379
|
message: 'Component initialization exception.'
|
372
380
|
});
|
@@ -2,6 +2,9 @@ import { ActionForm, ConnectErrorCode, IAmount, IAmountView, IMerchantAppointPar
|
|
2
2
|
import AddressProcessor from './elementProcessor/addressProcessor';
|
3
3
|
import AuthProcessor from './elementProcessor/authProcessor';
|
4
4
|
import PaymentProcessor from './elementProcessor/paymentProcessor';
|
5
|
+
/**
|
6
|
+
* element 消息事件名
|
7
|
+
*/
|
5
8
|
export declare enum ElementPaymentEvent {
|
6
9
|
RENDER_COMPONENT = "renderComponent",
|
7
10
|
CAPTURE_ASSET = "onCaptureAsset",
|
@@ -18,7 +21,8 @@ export declare enum ElementPaymentEvent {
|
|
18
21
|
*/
|
19
22
|
SEND_MUITI_APP_EVENT_TO_SDK = "sendMuitiAppEventToSdk",
|
20
23
|
LOG = "log",
|
21
|
-
HANDLE_PAYMENT = "handlePayment"
|
24
|
+
HANDLE_PAYMENT = "handlePayment",
|
25
|
+
ON_EVENT_CALLBACK = "onEventCallback"
|
22
26
|
}
|
23
27
|
export declare enum ElementPaymentMethod {
|
24
28
|
CONTAINER_ELEMENT = "CONTAINER_ELEMENT",
|
@@ -26,6 +30,19 @@ export declare enum ElementPaymentMethod {
|
|
26
30
|
ADDRESS_ELEMENT = "ADDRESS_ELEMENT",
|
27
31
|
PAYMENT_ELEMENT = "PAYMENT_ELEMENT"
|
28
32
|
}
|
33
|
+
export declare enum ElementType {
|
34
|
+
auth = "auth",
|
35
|
+
address = "address",
|
36
|
+
payment = "payment"
|
37
|
+
}
|
38
|
+
export declare const MountElementType: {
|
39
|
+
auth: ElementPaymentMethod;
|
40
|
+
address: ElementPaymentMethod;
|
41
|
+
payment: ElementPaymentMethod;
|
42
|
+
AUTH_ELEMENT: ElementType;
|
43
|
+
ADDRESS_ELEMENT: ElementType;
|
44
|
+
PAYMENT_ELEMENT: ElementType;
|
45
|
+
};
|
29
46
|
export declare enum ThemeType {
|
30
47
|
NostalgicGray = "nostalgicGray",
|
31
48
|
Default = "default",
|
@@ -34,27 +51,22 @@ export declare enum ThemeType {
|
|
34
51
|
GamingPurple = "gamingPurple",
|
35
52
|
AgateGreen = "agateGreen"
|
36
53
|
}
|
37
|
-
export declare enum ElementType {
|
38
|
-
auth = "auth",
|
39
|
-
address = "address",
|
40
|
-
payment = "payment"
|
41
|
-
}
|
42
54
|
export declare enum PaymentElementLayout {
|
43
55
|
Tabs = "tabs",
|
44
56
|
Accordion = "Accordion"
|
45
57
|
}
|
46
|
-
export declare enum MountElementType {
|
47
|
-
auth = "AUTH_ELEMENT",
|
48
|
-
address = "ADDRESS_ELEMENT",
|
49
|
-
payment = "PAYMENT_ELEMENT"
|
50
|
-
}
|
51
58
|
export declare const addressTheme: {
|
52
59
|
default: string;
|
53
60
|
night: string;
|
54
61
|
};
|
55
62
|
export declare enum EventCallbackCode {
|
56
63
|
SDK_CREATE_COMPONENT_ERROR = "SDK_CREATE_COMPONENT_ERROR",
|
57
|
-
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR"
|
64
|
+
SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
|
65
|
+
SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
|
66
|
+
SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
|
67
|
+
SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
|
68
|
+
SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
|
69
|
+
SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING"
|
58
70
|
}
|
59
71
|
export declare enum ELEMENT_ENVIRONMENT {
|
60
72
|
DEV = "DEV",
|
@@ -163,12 +175,14 @@ export interface LinkAuthMountResult extends BaseMountResult {
|
|
163
175
|
}
|
164
176
|
export interface PaymentMountResult extends BaseMountResult {
|
165
177
|
}
|
166
|
-
|
178
|
+
/**
|
179
|
+
* connect element之间通信的类型格式
|
180
|
+
*/
|
181
|
+
export interface ConnectElementMessageDataType<T = {}> {
|
167
182
|
source?: ElementPaymentMethod;
|
168
183
|
target?: ElementPaymentMethod;
|
169
|
-
success?: boolean;
|
170
184
|
data?: T;
|
171
|
-
event?:
|
185
|
+
event?: ElementPaymentEvent;
|
172
186
|
}
|
173
187
|
export interface ValidateResult<T = {}> {
|
174
188
|
success: boolean;
|
@@ -2,6 +2,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
2
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
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
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
|
+
/**
|
6
|
+
* element 消息事件名
|
7
|
+
*/
|
5
8
|
export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
6
9
|
ElementPaymentEvent["RENDER_COMPONENT"] = "renderComponent";
|
7
10
|
ElementPaymentEvent["CAPTURE_ASSET"] = "onCaptureAsset";
|
@@ -16,6 +19,7 @@ export var ElementPaymentEvent = /*#__PURE__*/function (ElementPaymentEvent) {
|
|
16
19
|
ElementPaymentEvent["SEND_MUITI_APP_EVENT_TO_SDK"] = "sendMuitiAppEventToSdk";
|
17
20
|
ElementPaymentEvent["LOG"] = "log";
|
18
21
|
ElementPaymentEvent["HANDLE_PAYMENT"] = "handlePayment";
|
22
|
+
ElementPaymentEvent["ON_EVENT_CALLBACK"] = "onEventCallback";
|
19
23
|
return ElementPaymentEvent;
|
20
24
|
}({});
|
21
25
|
export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|
@@ -25,6 +29,13 @@ export var ElementPaymentMethod = /*#__PURE__*/function (ElementPaymentMethod) {
|
|
25
29
|
ElementPaymentMethod["PAYMENT_ELEMENT"] = "PAYMENT_ELEMENT";
|
26
30
|
return ElementPaymentMethod;
|
27
31
|
}({});
|
32
|
+
export var ElementType = /*#__PURE__*/function (ElementType) {
|
33
|
+
ElementType["auth"] = "auth";
|
34
|
+
ElementType["address"] = "address";
|
35
|
+
ElementType["payment"] = "payment";
|
36
|
+
return ElementType;
|
37
|
+
}({});
|
38
|
+
export var MountElementType = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT), ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT), ElementType.payment, ElementPaymentMethod.PAYMENT_ELEMENT), ElementPaymentMethod.AUTH_ELEMENT, ElementType.auth), ElementPaymentMethod.ADDRESS_ELEMENT, ElementType.address), ElementPaymentMethod.PAYMENT_ELEMENT, ElementType.payment);
|
28
39
|
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
29
40
|
ThemeType["NostalgicGray"] = "nostalgicGray";
|
30
41
|
ThemeType["Default"] = "default";
|
@@ -34,27 +45,20 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
|
34
45
|
ThemeType["AgateGreen"] = "agateGreen";
|
35
46
|
return ThemeType;
|
36
47
|
}({});
|
37
|
-
export var ElementType = /*#__PURE__*/function (ElementType) {
|
38
|
-
ElementType["auth"] = "auth";
|
39
|
-
ElementType["address"] = "address";
|
40
|
-
ElementType["payment"] = "payment";
|
41
|
-
return ElementType;
|
42
|
-
}({});
|
43
48
|
export var PaymentElementLayout = /*#__PURE__*/function (PaymentElementLayout) {
|
44
49
|
PaymentElementLayout["Tabs"] = "tabs";
|
45
50
|
PaymentElementLayout["Accordion"] = "Accordion";
|
46
51
|
return PaymentElementLayout;
|
47
52
|
}({});
|
48
|
-
export var MountElementType = /*#__PURE__*/function (MountElementType) {
|
49
|
-
MountElementType["auth"] = "AUTH_ELEMENT";
|
50
|
-
MountElementType["address"] = "ADDRESS_ELEMENT";
|
51
|
-
MountElementType["payment"] = "PAYMENT_ELEMENT";
|
52
|
-
return MountElementType;
|
53
|
-
}({});
|
54
53
|
export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
|
55
54
|
export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
|
56
55
|
EventCallbackCode["SDK_CREATE_COMPONENT_ERROR"] = "SDK_CREATE_COMPONENT_ERROR";
|
57
56
|
EventCallbackCode["SDK_CREATEPAYMENT_PARAMETER_ERROR"] = "SDK_CREATEPAYMENT_PARAMETER_ERROR";
|
57
|
+
EventCallbackCode["SDK_PAYMENT_ERROR"] = "SDK_PAYMENT_ERROR";
|
58
|
+
EventCallbackCode["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
|
59
|
+
EventCallbackCode["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
|
60
|
+
EventCallbackCode["SDK_PAYMENT_SUCCESSFUL"] = "SDK_PAYMENT_SUCCESSFUL";
|
61
|
+
EventCallbackCode["SDK_PAYMENT_PROCESSING"] = "SDK_PAYMENT_PROCESSING";
|
58
62
|
return EventCallbackCode;
|
59
63
|
}({});
|
60
64
|
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
@@ -73,6 +77,10 @@ export var AddressEventCallbackName = /*#__PURE__*/function (AddressEventCallbac
|
|
73
77
|
return AddressEventCallbackName;
|
74
78
|
}({});
|
75
79
|
|
80
|
+
/**
|
81
|
+
* connect element之间通信的类型格式
|
82
|
+
*/
|
83
|
+
|
76
84
|
// export type IMountResult = AddressMountResult | LinkAuthMountResult | PaymentMountResult;
|
77
85
|
var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
|
78
86
|
AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
|
@@ -5,7 +5,7 @@ export declare const getComponentSign: (params: IPaymentSessionMetaData) => Comp
|
|
5
5
|
export declare const parseSessionData: (sessionData: string) => [IPaymentSessionMetaData, string];
|
6
6
|
export declare const handleParams: (params: IcreateComponent, _this: any) => Promise<{
|
7
7
|
iframeNodesParams: IappendIframeNodesParams;
|
8
|
-
componentSign: ComponentSignEnum.EASY_PAY_WALLET | ComponentSignEnum.EASY_PAY_APM | ComponentSignEnum.CASHIER_PAYMENT_CARD | ComponentSignEnum.CASHIER_PAYMENT_BANK | ComponentSignEnum.CASHIER_PAYMENT_APM | ComponentSignEnum.AUTO_DEBIT_WALLET | ComponentSignEnum.AUTO_DEBIT_PAY_WALLET | ComponentSignEnum.VAULTING_CARD | ComponentSignEnum.CHECKOUT_PAYMENT | ComponentSignEnum.ELEMENT_PAYMENT | ComponentSignEnum.ELEMENT_ADDRESS;
|
8
|
+
componentSign: ComponentSignEnum.EASY_PAY_WALLET | ComponentSignEnum.EASY_PAY_APM | ComponentSignEnum.CASHIER_PAYMENT_CARD | ComponentSignEnum.CASHIER_PAYMENT_BANK | ComponentSignEnum.CASHIER_PAYMENT_APM | ComponentSignEnum.AUTO_DEBIT_WALLET | ComponentSignEnum.AUTO_DEBIT_PAY_WALLET | ComponentSignEnum.VAULTING_CARD | ComponentSignEnum.CHECKOUT_PAYMENT | ComponentSignEnum.ELEMENT_PAYMENT | ComponentSignEnum.ELEMENT_ADDRESS | ComponentSignEnum.AUTO_DEBIT_APM;
|
9
9
|
}>;
|
10
10
|
export type IAMSComponentOptions = IoptionsParams & {
|
11
11
|
appVersion: string;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export type { BizFlowStartBehavior, PaymentContext, ProductProcessor, RedirectBehaviorPayload, RenderBehaviorPayload, SDKMetaData, } from '../..';
|
2
|
+
export { v2AppMarmotMap } from '../../../config';
|
3
|
+
export { COMPONENT_CONTAINER_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LOADTIME_LIMIT } from '../../../constant';
|
4
|
+
export { getComponentSign } from '../../../core/component';
|
5
|
+
export { ComponentSignEnum, eventCodeEnum, PlatformEnum } from '../../../types';
|
6
|
+
export type { CashierSdkActionQueryRequest, IoptionsParams } from '../../../types';
|
7
|
+
export { isPC, isTrue, queryParse } from '../../../util';
|
8
|
+
export { isLocalMock } from '../../../util/mock';
|
9
|
+
export { EventCenter } from '../..//service/event-center';
|
10
|
+
export { ServiceProvider } from '../../service';
|
11
|
+
export { LogService } from '../../service/log';
|
12
|
+
export { RequesterService } from '../../service/requester/requester';
|
13
|
+
export { SecurityService } from '../../service/security';
|
14
|
+
export { getWebAppV2Url } from '../../utils/web_app_url_utils';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
export { v2AppMarmotMap } from "../../../config";
|
2
|
+
export { COMPONENT_CONTAINER_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LOADTIME_LIMIT } from "../../../constant";
|
3
|
+
export { getComponentSign } from "../../../core/component";
|
4
|
+
export { ComponentSignEnum, eventCodeEnum, PlatformEnum } from "../../../types";
|
5
|
+
export { isPC, isTrue, queryParse } from "../../../util";
|
6
|
+
export { isLocalMock } from "../../../util/mock";
|
7
|
+
export { EventCenter } from "../..//service/event-center";
|
8
|
+
export { ServiceProvider } from "../../service";
|
9
|
+
export { LogService } from "../../service/log";
|
10
|
+
export { RequesterService } from "../../service/requester/requester";
|
11
|
+
export { SecurityService } from "../../service/security";
|
12
|
+
export { getWebAppV2Url } from "../../utils/web_app_url_utils";
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { BizFlowStartBehavior, IoptionsParams, PaymentContext, ProductProcessor, SDKMetaData } from './deps';
|
2
|
+
export declare class AutoDebitProcessor implements ProductProcessor {
|
3
|
+
private paymentContext?;
|
4
|
+
private initConfig;
|
5
|
+
private logger;
|
6
|
+
private eventCenter;
|
7
|
+
private securityService;
|
8
|
+
private instanceId;
|
9
|
+
private componentSign;
|
10
|
+
private hostSign;
|
11
|
+
private _performanceData;
|
12
|
+
private SECURITY_SDK_INIT_TIMEOUT;
|
13
|
+
init(config: IoptionsParams, instanceId: string, sdkMetaData: SDKMetaData): void;
|
14
|
+
startBizFlow(paymentContext: PaymentContext): Promise<BizFlowStartBehavior>;
|
15
|
+
private acquireApdidToken;
|
16
|
+
/**
|
17
|
+
* 获取SDK操作查询请求
|
18
|
+
* @returns {Promise<CashierSdkActionQueryRequest | { message?: string; success: boolean }>} 返回SDK操作查询请求或错误信息
|
19
|
+
*/
|
20
|
+
private getSdkActionQuery;
|
21
|
+
/**
|
22
|
+
* webLaunchPromise方法用于返回一个Promise对象,用于异步加载Web App
|
23
|
+
* @returns {Promise} 返回一个Promise对象
|
24
|
+
*/
|
25
|
+
private webLaunchPromise;
|
26
|
+
private sendRequestAndWaitWebLaunch;
|
27
|
+
private buildRedirectResult;
|
28
|
+
/**
|
29
|
+
* 构建 Web App 的 URL
|
30
|
+
* @returns {string} Web App 的 URL
|
31
|
+
*/
|
32
|
+
private buildWebAppUrl;
|
33
|
+
/**
|
34
|
+
* 初始化安全SDK
|
35
|
+
* @returns {Promise}
|
36
|
+
*/
|
37
|
+
private initSecuritySDK;
|
38
|
+
/**
|
39
|
+
* 设置容器宽度
|
40
|
+
* 如果是 Trustly 支付方式,并且显示平台为桌面端,则设置组件区块和容器的最大宽度为 656px
|
41
|
+
*/
|
42
|
+
private setAchAutoDebitContainerWidth;
|
43
|
+
/**
|
44
|
+
* 判断是否为Trustly支付方式
|
45
|
+
* @returns {boolean} true 表示是Trustly支付方式
|
46
|
+
*/
|
47
|
+
private get isTrustly();
|
48
|
+
}
|