@alipay/ams-checkout 0.0.1758783821-dev.3 → 0.0.1758783821-dev.6
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/README.md +17 -1
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/constant/index.d.ts +102 -88
- package/esm/constant/index.js +23 -6
- package/esm/core/component/element/elementController/index.d.ts +3 -8
- package/esm/core/component/element/elementController/index.js +31 -15
- package/esm/core/component/element/index.d.ts +3 -10
- package/esm/core/component/element/index.js +4 -1
- package/esm/core/component/element/type.d.ts +22 -4
- package/esm/core/component/element/type.js +16 -0
- package/esm/core/component/element/util.d.ts +1 -1
- package/esm/core/component/element/util.js +1 -1
- package/esm/plugin/component/channel.js +0 -1
- package/esm/plugin/component/index.js +2 -2
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.js +1 -1
- package/esm/util/spm-map.d.ts +2 -0
- package/esm/util/spm-map.js +2 -1
- package/package.json +12 -7
- package/esm/core/component/oldElement/components/address.d.ts +0 -19
- package/esm/core/component/oldElement/components/address.js +0 -68
- package/esm/core/component/oldElement/components/auth.d.ts +0 -17
- package/esm/core/component/oldElement/components/auth.js +0 -60
- package/esm/core/component/oldElement/components/payment.d.ts +0 -19
- package/esm/core/component/oldElement/components/payment.js +0 -74
- package/esm/core/component/oldElement/index.d.ts +0 -59
- package/esm/core/component/oldElement/index.js +0 -956
- package/esm/core/component/oldElement/mock.d.ts +0 -6
- package/esm/core/component/oldElement/mock.js +0 -567
- package/esm/core/component/oldElement/type.d.ts +0 -354
- package/esm/core/component/oldElement/type.js +0 -81
- package/esm/core/component/oldElement/utils.d.ts +0 -13
- package/esm/core/component/oldElement/utils.js +0 -6
package/esm/constant/index.d.ts
CHANGED
|
@@ -6,117 +6,117 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { eventCodeEnum } from '../types';
|
|
8
8
|
export declare const ERRORMESSAGE: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
DOMAIN_NOT_IN_WHITE_LIST: {
|
|
10
|
+
code: eventCodeEnum;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
NOT_JSON_FORMAT: {
|
|
14
|
+
code: eventCodeEnum;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
SDK_COMPATIBILITY_ISSUES: {
|
|
18
|
+
code: eventCodeEnum;
|
|
19
|
+
BROWSER_NOT_SUPPORT_POSTMESSAGE: {
|
|
20
|
+
code: eventCodeEnum;
|
|
21
|
+
message: string;
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
FAILED_TO_CREATE_IFRAME: {
|
|
24
|
+
code: eventCodeEnum;
|
|
25
|
+
message: string;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
INIT_PARAMETER_ERROR: {
|
|
29
|
+
code: eventCodeEnum;
|
|
30
|
+
UI_MODE_NOT_SUPPORTED: {
|
|
31
|
+
code: eventCodeEnum;
|
|
32
|
+
message: string;
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
ENVIRONMENT_ERROR: {
|
|
35
|
+
code: eventCodeEnum;
|
|
36
|
+
message: string;
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
MODE_ERROR: {
|
|
39
|
+
code: eventCodeEnum;
|
|
40
|
+
message: string;
|
|
41
41
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
LOCALE_ERROR: {
|
|
43
|
+
code: eventCodeEnum;
|
|
44
|
+
message: string;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
NET_MODE_NOT_SUPPORT: {
|
|
47
|
+
code: eventCodeEnum;
|
|
48
|
+
message: string;
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
EVENT_ERROR: {
|
|
51
|
+
code: eventCodeEnum;
|
|
52
|
+
message: string;
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
CREATEPAYMENT_PARAMETER_ERROR: {
|
|
56
|
+
code: eventCodeEnum;
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
CREATECOMPONENT_ERROR: {
|
|
59
|
+
code: eventCodeEnum;
|
|
60
|
+
message: string;
|
|
61
|
+
SINGLETON_COMPONENT_ERROR: {
|
|
62
|
+
code: eventCodeEnum;
|
|
63
|
+
message: string;
|
|
64
64
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
LOAD_APP_TIMEOUT: {
|
|
66
|
+
code: eventCodeEnum;
|
|
67
|
+
message: string;
|
|
68
68
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
NETWORK_REQUEST_ERROR: {
|
|
70
|
+
code: eventCodeEnum;
|
|
71
|
+
message: string;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
SDK_LAUNCH_PAYMENT_APP_ERROR: {
|
|
75
|
+
code: eventCodeEnum;
|
|
76
|
+
CALL_APP_URL_ERROR: {
|
|
77
|
+
code: eventCodeEnum;
|
|
78
|
+
message: string;
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
SDK_SUBMIT_ERROR: {
|
|
82
|
+
code: eventCodeEnum;
|
|
83
|
+
message: string;
|
|
84
84
|
};
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
PARAM_INVALID: {
|
|
86
|
+
code: string;
|
|
87
|
+
message: string;
|
|
88
88
|
};
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
UI_STATE_ERROR: {
|
|
90
|
+
code: string;
|
|
91
|
+
message: string;
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
CONTAINER_NOT_LOADED: {
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
96
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
INITALIZE_TIMEOUT: {
|
|
98
|
+
code: string;
|
|
99
|
+
API: {
|
|
100
|
+
code: string;
|
|
101
|
+
message: string;
|
|
102
102
|
};
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
WEB: {
|
|
104
|
+
code: string;
|
|
105
|
+
message: string;
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
ERR_DATA_STRUCT_UNRECOGNIZED: {
|
|
109
|
+
code: string;
|
|
110
|
+
message: string;
|
|
111
111
|
};
|
|
112
112
|
/**
|
|
113
113
|
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
|
114
114
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
SDK_CALL_URL_ERROR: {
|
|
116
|
+
code: eventCodeEnum;
|
|
117
|
+
REDIRECT_ERROR: {
|
|
118
|
+
code: eventCodeEnum;
|
|
119
|
+
message: string;
|
|
120
120
|
};
|
|
121
121
|
};
|
|
122
122
|
};
|
|
@@ -315,9 +315,23 @@ export declare const LOADINGIMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA
|
|
|
315
315
|
* @description Promise回调code映射
|
|
316
316
|
*/
|
|
317
317
|
export declare const PROMISE_CALLBACK_CODE: {
|
|
318
|
-
SUCCESS:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
318
|
+
SUCCESS: {
|
|
319
|
+
code: string;
|
|
320
|
+
};
|
|
321
|
+
UNKNOWN_EXCEPTION: {
|
|
322
|
+
code: string;
|
|
323
|
+
message: string;
|
|
324
|
+
};
|
|
325
|
+
REPEAT_REQ_REJECT: {
|
|
326
|
+
code: string;
|
|
327
|
+
message: string;
|
|
328
|
+
};
|
|
329
|
+
PROCESS_FAIL: {
|
|
330
|
+
code: string;
|
|
331
|
+
message: string;
|
|
332
|
+
};
|
|
333
|
+
INQUIRY_PAYMENT_SESSION_FAILED: {
|
|
334
|
+
code: string;
|
|
335
|
+
message: string;
|
|
336
|
+
};
|
|
323
337
|
};
|
package/esm/constant/index.js
CHANGED
|
@@ -107,7 +107,7 @@ export var ERRORMESSAGE = {
|
|
|
107
107
|
},
|
|
108
108
|
ERR_DATA_STRUCT_UNRECOGNIZED: {
|
|
109
109
|
code: 'ERR_DATA_STRUCT_UNRECOGNIZED',
|
|
110
|
-
|
|
110
|
+
message: 'The request is abnormal and the transaction cannot be initiated.'
|
|
111
111
|
},
|
|
112
112
|
/**
|
|
113
113
|
@deprecated 已废弃 请使用SDK_LAUNCH_PAYMENT_APP_ERROR
|
|
@@ -120,6 +120,9 @@ export var ERRORMESSAGE = {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
+
|
|
124
|
+
// as const satisfies Record<string, ErrorMessage>;
|
|
125
|
+
|
|
123
126
|
export var BASEPLUGINID = 'CHECKOUT';
|
|
124
127
|
export var COMPONENTPLUGINID = 'COMPONENT';
|
|
125
128
|
export var EVENT = {
|
|
@@ -321,9 +324,23 @@ export var LOADINGIMG = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIQAAACEB
|
|
|
321
324
|
* @description Promise回调code映射
|
|
322
325
|
*/
|
|
323
326
|
export var PROMISE_CALLBACK_CODE = {
|
|
324
|
-
SUCCESS:
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
327
|
+
SUCCESS: {
|
|
328
|
+
code: 'SUCCESS'
|
|
329
|
+
},
|
|
330
|
+
UNKNOWN_EXCEPTION: {
|
|
331
|
+
code: 'UNKNOWN_EXCEPTION',
|
|
332
|
+
message: 'Unknown anomaly. Please check the payment status and contact the merchant.'
|
|
333
|
+
},
|
|
334
|
+
REPEAT_REQ_REJECT: {
|
|
335
|
+
code: 'REPEAT_REQ_REJECT',
|
|
336
|
+
message: 'The order status is abnormal. Please check the payment status and contact the merchant.'
|
|
337
|
+
},
|
|
338
|
+
PROCESS_FAIL: {
|
|
339
|
+
code: 'PROCESS_FAIL',
|
|
340
|
+
message: 'The order status is abnormal. Please check the payment status and contact the merchant.'
|
|
341
|
+
},
|
|
342
|
+
INQUIRY_PAYMENT_SESSION_FAILED: {
|
|
343
|
+
code: 'INQUIRY_PAYMENT_SESSION_FAILED',
|
|
344
|
+
message: 'Unknown anomaly. Please check the payment status and contact the merchant.'
|
|
345
|
+
}
|
|
329
346
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressMountOptions, IElementOptions,
|
|
1
|
+
import { AddressMountOptions, ICommonApiResponse, IElementOptions, IPaymentApiResponse, LinkAuthMountOptions, PaymentMountOptions } from '../type';
|
|
2
2
|
declare class ElementController {
|
|
3
3
|
private options;
|
|
4
4
|
private elementContainer;
|
|
@@ -23,7 +23,7 @@ declare class ElementController {
|
|
|
23
23
|
private setInitTimeout;
|
|
24
24
|
private initializeAndMountProcessor;
|
|
25
25
|
private handleStartBizFlowError;
|
|
26
|
-
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string):
|
|
26
|
+
mount(renderOptions: LinkAuthMountOptions | AddressMountOptions | PaymentMountOptions, sdkSelector: string): Promise<ICommonApiResponse>;
|
|
27
27
|
private onValidateFunc;
|
|
28
28
|
private onValidateAndSubmitPay;
|
|
29
29
|
/**
|
|
@@ -33,12 +33,7 @@ declare class ElementController {
|
|
|
33
33
|
validateFields(): Promise<{
|
|
34
34
|
isValid: boolean;
|
|
35
35
|
}>;
|
|
36
|
-
submitPayment(): Promise<
|
|
37
|
-
error: {
|
|
38
|
-
readonly code: "CONTAINER_NOT_LOADED";
|
|
39
|
-
readonly message: "The request is abnormal and the transaction cannot be initiated.";
|
|
40
|
-
};
|
|
41
|
-
}>;
|
|
36
|
+
submitPayment(): Promise<IPaymentApiResponse>;
|
|
42
37
|
private changeLoading;
|
|
43
38
|
private addEventListener;
|
|
44
39
|
private sendRequestAndWaitWebLaunch;
|
|
@@ -23,6 +23,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
23
23
|
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; }
|
|
24
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
25
25
|
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); }
|
|
26
|
+
import { ELEMENT_SPM_MAP } from "../../../../util/spm-map";
|
|
26
27
|
import { cleanMockup, removeRetentionPopup } from "../../../../component/component.popup.style";
|
|
27
28
|
import { destroyModal } from "../../../../component/popupWindow.style";
|
|
28
29
|
import { ERRORMESSAGE, EVENT, PROMISE_CALLBACK_CODE } from "../../../../constant";
|
|
@@ -37,7 +38,7 @@ import { ElementContainerService } from "../elementContainerService"; // 引入
|
|
|
37
38
|
import { IContainerStatus } from "../elementContainerService/containerService";
|
|
38
39
|
import { EventCenter as ElementEventCenter } from "../EventCenter/index";
|
|
39
40
|
import { oneAccountUpdate, sdkActionUpdate } from "../mock";
|
|
40
|
-
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType } from "../type";
|
|
41
|
+
import { ElementPaymentEvent, ElementPaymentMethod, ElementType, EventCallbackCode, EXPOSURE_API_EVENT, MountElementType, PaymentStatus } from "../type";
|
|
41
42
|
import { checkCanMount, checkCanUpdate, handleRedirect, isLoadErrorPage, showToast } from "../util";
|
|
42
43
|
var TIMEOUT_DURATION = 10000;
|
|
43
44
|
var ElementController = /*#__PURE__*/function () {
|
|
@@ -326,7 +327,8 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
326
327
|
break;
|
|
327
328
|
}
|
|
328
329
|
res = {
|
|
329
|
-
error: ERRORMESSAGE.
|
|
330
|
+
error: ERRORMESSAGE.UI_STATE_ERROR,
|
|
331
|
+
status: PaymentStatus.FAIL
|
|
330
332
|
};
|
|
331
333
|
this.elementEventCenter.endEvent(startEventId, res);
|
|
332
334
|
return _context4.abrupt("return", Promise.resolve(res));
|
|
@@ -366,8 +368,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
366
368
|
_context2.next = 11;
|
|
367
369
|
break;
|
|
368
370
|
}
|
|
371
|
+
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
369
372
|
recordResult = data;
|
|
370
|
-
resolve(
|
|
373
|
+
resolve(recordResult);
|
|
371
374
|
return _context2.abrupt("return", false);
|
|
372
375
|
case 11:
|
|
373
376
|
return _context2.abrupt("return", true);
|
|
@@ -408,24 +411,30 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
408
411
|
case 15:
|
|
409
412
|
_yield$_this3$onValid2 = _context3.sent;
|
|
410
413
|
data = _yield$_this3$onValid2.data;
|
|
414
|
+
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
415
|
+
// TODO checkout 返回的错误未包含 status 和 message @马杰 @薛浩
|
|
411
416
|
recordResult = data;
|
|
412
|
-
resolve(
|
|
417
|
+
resolve(recordResult);
|
|
413
418
|
case 19:
|
|
414
|
-
_context3.next =
|
|
419
|
+
_context3.next = 27;
|
|
415
420
|
break;
|
|
416
421
|
case 21:
|
|
417
422
|
_context3.prev = 21;
|
|
418
423
|
_context3.t0 = _context3["catch"](0);
|
|
419
424
|
errorResult = {
|
|
420
|
-
error: {
|
|
421
|
-
code: ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED.code,
|
|
425
|
+
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED), {}, {
|
|
422
426
|
context: JSON.stringify(_context3.t0)
|
|
423
|
-
},
|
|
424
|
-
status:
|
|
427
|
+
}),
|
|
428
|
+
status: PaymentStatus.FAIL
|
|
425
429
|
};
|
|
430
|
+
_this3.serviceMap.Log.logError({
|
|
431
|
+
title: ELEMENT_SPM_MAP.sdk_element_missKeyData
|
|
432
|
+
}, {
|
|
433
|
+
msg: JSON.stringify(errorResult)
|
|
434
|
+
});
|
|
426
435
|
recordResult = errorResult;
|
|
427
436
|
resolve(errorResult);
|
|
428
|
-
case
|
|
437
|
+
case 27:
|
|
429
438
|
case "end":
|
|
430
439
|
return _context3.stop();
|
|
431
440
|
}
|
|
@@ -602,12 +611,19 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
602
611
|
traceId = _response$originActio.traceId,
|
|
603
612
|
errorCode = _response$originActio.errorCode,
|
|
604
613
|
errorMessage = _response$originActio.errorMessage;
|
|
605
|
-
var error = {
|
|
606
|
-
code: ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED.code
|
|
607
|
-
};
|
|
614
|
+
var error = _objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED);
|
|
608
615
|
if (PROMISE_CALLBACK_CODE[errorCode]) {
|
|
609
|
-
|
|
610
|
-
error
|
|
616
|
+
var _PROMISE_CALLBACK_COD;
|
|
617
|
+
error = {
|
|
618
|
+
code: PROMISE_CALLBACK_CODE[errorCode].code,
|
|
619
|
+
message: ((_PROMISE_CALLBACK_COD = PROMISE_CALLBACK_CODE[errorCode]) === null || _PROMISE_CALLBACK_COD === void 0 ? void 0 : _PROMISE_CALLBACK_COD.message) || errorMessage
|
|
620
|
+
};
|
|
621
|
+
} else {
|
|
622
|
+
this.serviceMap.Log.logError({
|
|
623
|
+
title: ELEMENT_SPM_MAP.sdk_element_missKeyData
|
|
624
|
+
}, {
|
|
625
|
+
rpcTraceId: traceId
|
|
626
|
+
});
|
|
611
627
|
}
|
|
612
628
|
return {
|
|
613
629
|
error: _objectSpread(_objectSpread({}, error), {}, {
|
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IElementOptions, PaymentMountOptions } from './type';
|
|
2
2
|
export declare class ElementComponent {
|
|
3
3
|
private options;
|
|
4
4
|
private controller;
|
|
5
5
|
constructor(options: IElementOptions);
|
|
6
6
|
updatePayment(paymentSessionData: any): Promise<unknown>;
|
|
7
|
-
mount(renderOptions:
|
|
8
|
-
mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
|
9
|
-
mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
|
|
7
|
+
mount(renderOptions: PaymentMountOptions, sdkSelector: string): Promise<import("./type").ICommonApiResponse>;
|
|
10
8
|
validateFields(): Promise<{
|
|
11
9
|
isValid: boolean;
|
|
12
10
|
}>;
|
|
13
|
-
submitPayment(): Promise<import("./type").
|
|
14
|
-
error: {
|
|
15
|
-
readonly code: "CONTAINER_NOT_LOADED";
|
|
16
|
-
readonly message: "The request is abnormal and the transaction cannot be initiated.";
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
11
|
+
submitPayment(): Promise<import("./type").IPaymentApiResponse>;
|
|
19
12
|
destroy(): void;
|
|
20
13
|
}
|
|
@@ -43,7 +43,10 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
|
43
43
|
return _updatePayment.apply(this, arguments);
|
|
44
44
|
}
|
|
45
45
|
return updatePayment;
|
|
46
|
-
}()
|
|
46
|
+
}() // 暂不透出 link 和 address element
|
|
47
|
+
// mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
|
|
48
|
+
// mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
|
|
49
|
+
// mount(renderOptions: PaymentMountOptions, sdkSelector: string);
|
|
47
50
|
}, {
|
|
48
51
|
key: "mount",
|
|
49
52
|
value: function mount(renderOptions, sdkSelector) {
|
|
@@ -36,6 +36,20 @@ export declare enum ElementType {
|
|
|
36
36
|
address = "address",
|
|
37
37
|
payment = "payment"
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* TODO 替换外外网链接
|
|
41
|
+
* 支付状态参考: https://yuque.antfin.com/antom_ka_team/yg9y7x/fe8xxqgbivnx5fd2#rGgE
|
|
42
|
+
*/
|
|
43
|
+
export declare enum PaymentStatus {
|
|
44
|
+
SUCCESS = "SUCCESS",
|
|
45
|
+
PROCESSING = "PROCESSING",
|
|
46
|
+
CANCELLED = "CANCELLED",
|
|
47
|
+
PENDING = "PENDING",
|
|
48
|
+
S = "SUCCESS",
|
|
49
|
+
F = "FAIL",
|
|
50
|
+
U = "PROCESSING",
|
|
51
|
+
FAIL = "FAIL"
|
|
52
|
+
}
|
|
39
53
|
export declare const MountElementType: {
|
|
40
54
|
auth: ElementPaymentMethod;
|
|
41
55
|
address: ElementPaymentMethod;
|
|
@@ -194,6 +208,8 @@ export interface ValidateResult<T = {}> {
|
|
|
194
208
|
success: boolean;
|
|
195
209
|
data: {
|
|
196
210
|
success: boolean;
|
|
211
|
+
status: PaymentStatus;
|
|
212
|
+
message?: string;
|
|
197
213
|
data: T;
|
|
198
214
|
};
|
|
199
215
|
}
|
|
@@ -393,15 +409,17 @@ export interface IToastOptions {
|
|
|
393
409
|
icon?: 'SUCCESS' | 'FAIL';
|
|
394
410
|
spin?: boolean;
|
|
395
411
|
}
|
|
396
|
-
export interface
|
|
397
|
-
success?: boolean;
|
|
412
|
+
export interface ICommonApiResponse {
|
|
398
413
|
error?: {
|
|
399
414
|
code: string;
|
|
400
|
-
message
|
|
415
|
+
message: string;
|
|
401
416
|
traceId?: string;
|
|
402
417
|
context?: any;
|
|
403
418
|
};
|
|
404
|
-
|
|
419
|
+
}
|
|
420
|
+
export interface IPaymentApiResponse extends ICommonApiResponse {
|
|
421
|
+
status: keyof typeof PaymentStatus;
|
|
422
|
+
userCanceled3D?: boolean;
|
|
405
423
|
}
|
|
406
424
|
export declare class InvalidElementConfigError extends Error {
|
|
407
425
|
errors: Array<{
|
|
@@ -49,6 +49,22 @@ export var ElementType = /*#__PURE__*/function (ElementType) {
|
|
|
49
49
|
ElementType["payment"] = "payment";
|
|
50
50
|
return ElementType;
|
|
51
51
|
}({});
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* TODO 替换外外网链接
|
|
55
|
+
* 支付状态参考: https://yuque.antfin.com/antom_ka_team/yg9y7x/fe8xxqgbivnx5fd2#rGgE
|
|
56
|
+
*/
|
|
57
|
+
export var PaymentStatus = /*#__PURE__*/function (PaymentStatus) {
|
|
58
|
+
PaymentStatus["SUCCESS"] = "SUCCESS";
|
|
59
|
+
PaymentStatus["PROCESSING"] = "PROCESSING";
|
|
60
|
+
PaymentStatus["CANCELLED"] = "CANCELLED";
|
|
61
|
+
PaymentStatus["PENDING"] = "PENDING";
|
|
62
|
+
PaymentStatus["S"] = "SUCCESS";
|
|
63
|
+
PaymentStatus["F"] = "FAIL";
|
|
64
|
+
PaymentStatus["U"] = "PROCESSING";
|
|
65
|
+
PaymentStatus["FAIL"] = "FAIL";
|
|
66
|
+
return PaymentStatus;
|
|
67
|
+
}({});
|
|
52
68
|
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);
|
|
53
69
|
export var ThemeType = /*#__PURE__*/function (ThemeType) {
|
|
54
70
|
ThemeType["NostalgicGray"] = "nostalgicGray";
|
|
@@ -39,7 +39,7 @@ export declare function checkCanMount({ sdkSelector, containerService, status, }
|
|
|
39
39
|
errorMsg?: string;
|
|
40
40
|
error?: {
|
|
41
41
|
code: string;
|
|
42
|
-
message
|
|
42
|
+
message: string;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
45
|
export declare function checkCanUpdate({ status, paymentContainerService, newPaymentSessionData, oldPaymentSessionData, }: {
|
|
@@ -136,7 +136,7 @@ export function generateIframeSrc(_ref3) {
|
|
|
136
136
|
var extendInfo = (paymentSessionObj === null || paymentSessionObj === void 0 ? void 0 : paymentSessionObj.extendInfo) || '';
|
|
137
137
|
var mid = paymentSessionObj === null || paymentSessionObj === void 0 ? void 0 : paymentSessionObj.clientId;
|
|
138
138
|
var hostSign = (paymentSession || '').split('&&')[1] || '';
|
|
139
|
-
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, '
|
|
139
|
+
var baseUrl = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ELEMENT_ENVIRONMENT.DEV, 'https://dev.ac.alipay.com/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.TEST, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.SIT, 'http://page.test.alipay.net/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.PRE, 'https://pre.ac.alipay.com/page/antom-web-checkout-v2'), ELEMENT_ENVIRONMENT.SANDBOX, 'https://checkout.antom.com'), ELEMENT_ENVIRONMENT.PROD, 'https://checkout.antom.com');
|
|
140
140
|
var _env = (environment === null || environment === void 0 ? void 0 : environment.toLocaleUpperCase()) || ELEMENT_ENVIRONMENT.DEV;
|
|
141
141
|
if (!link) {
|
|
142
142
|
link = "".concat(baseUrl[_env]).concat(pageUrl);
|
|
@@ -17,13 +17,13 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
17
17
|
* 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.
|
|
18
18
|
*/
|
|
19
19
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
20
|
+
import { ElementPaymentMethod } from "../../core/component/element/type";
|
|
20
21
|
import { v4 as uuid } from 'uuid';
|
|
21
22
|
import { sdkVersion } from "../../config";
|
|
22
23
|
import { COMPONENTPLUGINID, COMPONENT_CLOSE_BLOCK_ID, COMPONENT_CLOSE_MASK_BLOCK_ID, COMPONENT_CONTAINER_ID, COMPONENT_RETENTION_ID, COMPONENT_SECTION_ID, ERRORMESSAGE, EVENT, LISTENER_PREFIX, LOADING_ID, LOADTIME_LIMIT, MOCKUP_ID, POPUP_LOADTIME_LOG_LIMIT, TIMEOUT_WEB_APP_HEART_BEAT, TIME_DELAY_SEND_HEART_BEAT } from "../../constant";
|
|
23
|
-
import { ElementPaymentMethod } from "../../core/component/oldElement/type";
|
|
24
24
|
import { queryPaymentInfo, submitPayInfo } from "../../service";
|
|
25
25
|
import { ComponentSignEnum, DisplayTypeEnum, eventCodeEnum, MessageName, PlatformEnum, ProductSceneEnum, RedirectType, TargetEnum } from "../../types";
|
|
26
|
-
import { getType, isJsonString, isPC
|
|
26
|
+
import { device, getType, isJsonString, isPC } from "../../util";
|
|
27
27
|
import { getBackScheme } from "../../util/getBackScheme";
|
|
28
28
|
import { isLocalMock } from "../../util/mock";
|
|
29
29
|
import { matchVersion } from "../../util/versionCompare";
|
package/esm/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { IApplePayContactField } from '../plugin/applepay/interface';
|
|
9
9
|
export type onChange = () => onCnageResult;
|
|
10
|
-
export { ElementType, PaymentElementLayout, ThemeType
|
|
10
|
+
export { type IElementOptions, ElementType, PaymentElementLayout, ThemeType } from '../core/component/element/type';
|
|
11
11
|
interface onCnageResult {
|
|
12
12
|
complete: boolean;
|
|
13
13
|
addressValue: AddressItem[];
|
|
@@ -838,6 +838,6 @@ export declare enum EventLoggingEventId {
|
|
|
838
838
|
}
|
|
839
839
|
export interface ErrorMessage {
|
|
840
840
|
code: string;
|
|
841
|
-
message
|
|
841
|
+
message: string;
|
|
842
842
|
[key: string]: ErrorMessage | string;
|
|
843
843
|
}
|
package/esm/types/index.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
10
|
|
|
11
|
-
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/
|
|
11
|
+
export { ElementType, PaymentElementLayout, ThemeType } from "../core/component/element/type";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* SDK options
|
package/esm/util/spm-map.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const ELEMENT_SPM_MAP: {
|
|
|
10
10
|
sdk_element_handleHeartBeat: string;
|
|
11
11
|
sdk_element_handleInterAction: string;
|
|
12
12
|
sdk_element_callback_error: string;
|
|
13
|
+
sdk_element_missKeyData: string;
|
|
13
14
|
};
|
|
14
15
|
export declare const SPM_MAP: {
|
|
15
16
|
sdk_event_mount_element: string;
|
|
@@ -23,6 +24,7 @@ export declare const SPM_MAP: {
|
|
|
23
24
|
sdk_element_handleHeartBeat: string;
|
|
24
25
|
sdk_element_handleInterAction: string;
|
|
25
26
|
sdk_element_callback_error: string;
|
|
27
|
+
sdk_element_missKeyData: string;
|
|
26
28
|
sdk_error_runtime_error: string;
|
|
27
29
|
sdk_event_sdkQuery_failed: string;
|
|
28
30
|
container_error_error_insert_js: string;
|
package/esm/util/spm-map.js
CHANGED
|
@@ -17,7 +17,8 @@ export var ELEMENT_SPM_MAP = {
|
|
|
17
17
|
auto_apple_pay_success: 'a3753.b107385.c398112',
|
|
18
18
|
sdk_element_handleHeartBeat: 'a3753.b101271.c388217.d624449',
|
|
19
19
|
sdk_element_handleInterAction: 'a3753.b101271.c388217.d630402',
|
|
20
|
-
sdk_element_callback_error: 'a3753.b101271.c388217.d630403'
|
|
20
|
+
sdk_element_callback_error: 'a3753.b101271.c388217.d630403',
|
|
21
|
+
sdk_element_missKeyData: 'a3753.b101271.c388217.d630404'
|
|
21
22
|
};
|
|
22
23
|
export var SPM_MAP = _objectSpread({
|
|
23
24
|
sdk_error_runtime_error: 'a3753.b101271.c388188.d512342',
|