@alipay/ams-checkout 0.0.1757298389-dev.10 → 0.0.1757298389-dev.12
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/constant/index.d.ts +37 -0
- package/esm/constant/index.js +38 -0
- package/esm/core/component/element/EventCenter/index.d.ts +29 -0
- package/esm/core/component/element/EventCenter/index.js +141 -0
- package/esm/core/component/element/elementController/index.d.ts +20 -2
- package/esm/core/component/element/elementController/index.js +459 -269
- package/esm/core/component/element/elementProcessor/addressProcessor.js +3 -3
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +4 -4
- package/esm/core/component/element/index.d.ts +6 -1
- package/esm/core/component/element/index.js +5 -2
- package/esm/core/component/element/type.d.ts +27 -0
- package/esm/core/component/element/type.js +38 -1
- package/esm/core/component/element/util.d.ts +16 -3
- package/esm/core/component/element/util.js +45 -6
- package/esm/foundation/service/log/keys.js +2 -0
- package/esm/foundation/service/requester/requester.js +2 -3
- package/esm/types/index.d.ts +5 -1
- package/esm/util/spm-map.d.ts +2 -0
- package/esm/util/spm-map.js +2 -1
- package/package.json +1 -1
|
@@ -20,9 +20,9 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
20
20
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
21
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
22
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
-
import { ProductSceneEnum } from "../../../../types";
|
|
24
23
|
import { parseSessionData } from "../..";
|
|
25
24
|
import PackageJson from "../../../../../package.json";
|
|
25
|
+
import { ProductSceneEnum } from "../../../../types";
|
|
26
26
|
import { generateIframeSrc as _generateIframeSrc } from "../util";
|
|
27
27
|
import BaseElementProcessor from "./baseElementProcessor";
|
|
28
28
|
var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
@@ -35,12 +35,12 @@ var AddressProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
35
35
|
_createClass(AddressProcessor, [{
|
|
36
36
|
key: "onReady",
|
|
37
37
|
value: function onReady(extraParam) {
|
|
38
|
-
var _paymentSessionObj$pa, _extraParam$originOne;
|
|
38
|
+
var _paymentSessionObj$co, _paymentSessionObj$pa, _extraParam$originOne;
|
|
39
39
|
var paymentContext = this.elementContainer.getPaymentContext();
|
|
40
40
|
var paymentSessionObj = paymentContext.paymentSessionObj,
|
|
41
41
|
paymentSessionId = paymentContext.paymentSessionId,
|
|
42
42
|
displayInfo = paymentContext.displayInfo;
|
|
43
|
-
var isConnect = paymentSessionObj.connectFactor.enableConnect && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
|
|
43
|
+
var isConnect = ((_paymentSessionObj$co = paymentSessionObj.connectFactor) === null || _paymentSessionObj$co === void 0 ? void 0 : _paymentSessionObj$co.enableConnect) && ((_paymentSessionObj$pa = paymentSessionObj.paymentSessionConfig) === null || _paymentSessionObj$pa === void 0 ? void 0 : _paymentSessionObj$pa.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
|
|
44
44
|
this.eventCenter.dispatchToApp({
|
|
45
45
|
event: 'renderComponent',
|
|
46
46
|
data: {
|
|
@@ -293,8 +293,8 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
293
293
|
'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
|
|
294
294
|
}).then(function (result) {
|
|
295
295
|
resolve(result);
|
|
296
|
-
}, function () {
|
|
297
|
-
reject(
|
|
296
|
+
}, function (e) {
|
|
297
|
+
reject(e);
|
|
298
298
|
});
|
|
299
299
|
});
|
|
300
300
|
};
|
|
@@ -323,8 +323,8 @@ var PaymentProcessor = /*#__PURE__*/function (_BaseElementProcessor) {
|
|
|
323
323
|
'Operation-Type': 'com.ipay.iexpfront.one.account.query'
|
|
324
324
|
}).then(function (result) {
|
|
325
325
|
resolve(result);
|
|
326
|
-
}, function () {
|
|
327
|
-
reject(
|
|
326
|
+
}, function (e) {
|
|
327
|
+
reject(e);
|
|
328
328
|
});
|
|
329
329
|
});
|
|
330
330
|
};
|
|
@@ -10,6 +10,11 @@ export declare class ElementComponent {
|
|
|
10
10
|
validateFields(): Promise<{
|
|
11
11
|
isValid: boolean;
|
|
12
12
|
}>;
|
|
13
|
-
submitPayment():
|
|
13
|
+
submitPayment(): Promise<import("./type").IMerchantResponse | {
|
|
14
|
+
error: {
|
|
15
|
+
code: string;
|
|
16
|
+
message: string;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
14
19
|
destroy(): void;
|
|
15
20
|
}
|
|
@@ -11,6 +11,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
11
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
12
|
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); }
|
|
13
13
|
import ElementController from "./elementController";
|
|
14
|
+
import { InvalidElementConfigError } from "./type";
|
|
14
15
|
import { formatElementOption, validateElementOption } from "./util";
|
|
15
16
|
export var ElementComponent = /*#__PURE__*/function () {
|
|
16
17
|
function ElementComponent(options) {
|
|
@@ -18,7 +19,9 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
|
18
19
|
_defineProperty(this, "options", void 0);
|
|
19
20
|
_defineProperty(this, "controller", void 0);
|
|
20
21
|
var validate = validateElementOption(options);
|
|
21
|
-
if (!validate)
|
|
22
|
+
if (!validate.isValid) {
|
|
23
|
+
throw new InvalidElementConfigError(validate.errors);
|
|
24
|
+
}
|
|
22
25
|
this.options = formatElementOption(options);
|
|
23
26
|
this.controller = new ElementController(options);
|
|
24
27
|
}
|
|
@@ -57,7 +60,7 @@ export var ElementComponent = /*#__PURE__*/function () {
|
|
|
57
60
|
}, {
|
|
58
61
|
key: "submitPayment",
|
|
59
62
|
value: function submitPayment() {
|
|
60
|
-
this.controller.submitPayment();
|
|
63
|
+
return this.controller.submitPayment();
|
|
61
64
|
}
|
|
62
65
|
}, {
|
|
63
66
|
key: "destroy",
|
|
@@ -393,4 +393,31 @@ export interface IToastOptions {
|
|
|
393
393
|
icon?: 'SUCCESS' | 'FAIL';
|
|
394
394
|
spin?: boolean;
|
|
395
395
|
}
|
|
396
|
+
export interface IMerchantResponse {
|
|
397
|
+
success?: boolean;
|
|
398
|
+
error?: {
|
|
399
|
+
code: string;
|
|
400
|
+
message?: string;
|
|
401
|
+
traceId?: string;
|
|
402
|
+
context?: any;
|
|
403
|
+
};
|
|
404
|
+
status?: string;
|
|
405
|
+
}
|
|
406
|
+
export declare class InvalidElementConfigError extends Error {
|
|
407
|
+
errors: Array<{
|
|
408
|
+
field: keyof IElementOptions;
|
|
409
|
+
message: string;
|
|
410
|
+
}>;
|
|
411
|
+
constructor(errors: Array<{
|
|
412
|
+
field: keyof IElementOptions;
|
|
413
|
+
message: string;
|
|
414
|
+
}>);
|
|
415
|
+
}
|
|
416
|
+
export declare enum EXPOSURE_API_EVENT {
|
|
417
|
+
DESTORY = "destroy",
|
|
418
|
+
MOUNT = "mount",
|
|
419
|
+
SUBMITPAYMENT = "submitPayment",
|
|
420
|
+
VALIDATAFIELDS = "validateFields",
|
|
421
|
+
UPDATEPAYMENT = "updatePayment"
|
|
422
|
+
}
|
|
396
423
|
export {};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
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 _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); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
8
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
9
|
+
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
10
|
+
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
11
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
+
function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
2
15
|
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
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
4
17
|
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); }
|
|
@@ -92,4 +105,28 @@ var AccountStatusEnum = /*#__PURE__*/function (AccountStatusEnum) {
|
|
|
92
105
|
AccountStatusEnum["EFFECTIVE"] = "EFFECTIVE";
|
|
93
106
|
AccountStatusEnum["UNREGISTERED"] = "UNREGISTERED";
|
|
94
107
|
return AccountStatusEnum;
|
|
95
|
-
}(AccountStatusEnum || {}); // element 接口start
|
|
108
|
+
}(AccountStatusEnum || {}); // element 接口start
|
|
109
|
+
export var InvalidElementConfigError = /*#__PURE__*/function (_Error) {
|
|
110
|
+
_inherits(InvalidElementConfigError, _Error);
|
|
111
|
+
var _super = _createSuper(InvalidElementConfigError);
|
|
112
|
+
function InvalidElementConfigError(errors) {
|
|
113
|
+
var _this;
|
|
114
|
+
_classCallCheck(this, InvalidElementConfigError);
|
|
115
|
+
var errorMessages = errors.map(function (e) {
|
|
116
|
+
return "".concat(e.field, ": ").concat(e.message);
|
|
117
|
+
});
|
|
118
|
+
_this = _super.call(this, "Invalid config:\n".concat(errorMessages.join('\n')));
|
|
119
|
+
_this.errors = errors;
|
|
120
|
+
_this.name = 'InvalidElementConfigError';
|
|
121
|
+
return _this;
|
|
122
|
+
}
|
|
123
|
+
return _createClass(InvalidElementConfigError);
|
|
124
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
125
|
+
export var EXPOSURE_API_EVENT = /*#__PURE__*/function (EXPOSURE_API_EVENT) {
|
|
126
|
+
EXPOSURE_API_EVENT["DESTORY"] = "destroy";
|
|
127
|
+
EXPOSURE_API_EVENT["MOUNT"] = "mount";
|
|
128
|
+
EXPOSURE_API_EVENT["SUBMITPAYMENT"] = "submitPayment";
|
|
129
|
+
EXPOSURE_API_EVENT["VALIDATAFIELDS"] = "validateFields";
|
|
130
|
+
EXPOSURE_API_EVENT["UPDATEPAYMENT"] = "updatePayment";
|
|
131
|
+
return EXPOSURE_API_EVENT;
|
|
132
|
+
}({});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IElementStatus } from '../../../foundation';
|
|
2
|
-
import { Ianalytics, IPaymentSessionMetaData } from '../../../types';
|
|
2
|
+
import { CashierSdkActionQueryResult, Ianalytics, IPaymentSessionMetaData } from '../../../types';
|
|
3
3
|
import { ContainerController } from './elementContainerService/containerService';
|
|
4
|
-
import { ELEMENT_ENVIRONMENT_TYPE, IElementOptions, IToastOptions
|
|
4
|
+
import { ELEMENT_ENVIRONMENT_TYPE, EventCallbackCode, IElementOptions, IToastOptions } from './type';
|
|
5
5
|
export declare const formatElementOption: (options: IElementOptions) => {
|
|
6
6
|
environment: ELEMENT_ENVIRONMENT_TYPE;
|
|
7
7
|
sessionData: string;
|
|
@@ -20,7 +20,10 @@ export declare const formatElementOption: (options: IElementOptions) => {
|
|
|
20
20
|
onEndLoading: () => void;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
export declare const validateElementOption: (options: IElementOptions) =>
|
|
23
|
+
export declare const validateElementOption: (options: IElementOptions) => {
|
|
24
|
+
isValid: boolean;
|
|
25
|
+
errors: any[];
|
|
26
|
+
};
|
|
24
27
|
/**
|
|
25
28
|
* 校验渲染条件
|
|
26
29
|
* 校验当前sdkSelector结点是否存在
|
|
@@ -32,6 +35,10 @@ export declare function checkCanMount({ sdkSelector, containerService, status, }
|
|
|
32
35
|
}): {
|
|
33
36
|
success: boolean;
|
|
34
37
|
errorMsg?: string;
|
|
38
|
+
error?: {
|
|
39
|
+
code: string;
|
|
40
|
+
message?: string;
|
|
41
|
+
};
|
|
35
42
|
};
|
|
36
43
|
export declare function checkCanUpdate({ status, paymentContainerService, newPaymentSessionData, oldPaymentSessionData, }: {
|
|
37
44
|
status: IElementStatus;
|
|
@@ -67,3 +74,9 @@ export declare const isElementMobile: () => boolean;
|
|
|
67
74
|
*/
|
|
68
75
|
export declare const isElementPad: () => boolean;
|
|
69
76
|
export declare const isElementPC: () => boolean;
|
|
77
|
+
/**
|
|
78
|
+
* 判断是否需要加载错误页
|
|
79
|
+
* @param {CashierSdkActionQueryResult} params
|
|
80
|
+
* @returns {boolean} - 是否需要加载错误页
|
|
81
|
+
*/
|
|
82
|
+
export declare const isLoadErrorPage: (params: CashierSdkActionQueryResult) => boolean;
|
|
@@ -25,15 +25,24 @@ export var formatElementOption = function formatElementOption(options) {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
export var validateElementOption = function validateElementOption(options) {
|
|
28
|
+
var errors = [];
|
|
28
29
|
if (!options.sessionData) {
|
|
30
|
+
errors.push({
|
|
31
|
+
field: 'sessionData',
|
|
32
|
+
message: 'sessionData is empty'
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (errors.length > 0) {
|
|
29
36
|
var _options$onEventCallb;
|
|
30
37
|
options === null || options === void 0 || (_options$onEventCallb = options.onEventCallback) === null || _options$onEventCallb === void 0 || _options$onEventCallb.call(options, {
|
|
31
38
|
code: EventCallbackCode.SDK_CREATE_COMPONENT_ERROR,
|
|
32
39
|
message: 'sessionData is empty'
|
|
33
40
|
});
|
|
34
|
-
return false;
|
|
35
41
|
}
|
|
36
|
-
return
|
|
42
|
+
return {
|
|
43
|
+
isValid: errors.length === 0,
|
|
44
|
+
errors: errors
|
|
45
|
+
};
|
|
37
46
|
};
|
|
38
47
|
|
|
39
48
|
/**
|
|
@@ -50,13 +59,15 @@ export function checkCanMount(_ref) {
|
|
|
50
59
|
console.error("Element with selector ".concat(sdkSelector, " not found."));
|
|
51
60
|
return {
|
|
52
61
|
success: false,
|
|
53
|
-
errorMsg: "Element with selector ".concat(sdkSelector, " not found.")
|
|
62
|
+
errorMsg: "Element with selector ".concat(sdkSelector, " not found."),
|
|
63
|
+
error: ERRORMESSAGE.PARAM_INVALID
|
|
54
64
|
};
|
|
55
65
|
}
|
|
56
66
|
if (status === IElementStatus.DESTROYED) {
|
|
57
67
|
return {
|
|
58
68
|
success: false,
|
|
59
|
-
errorMsg: "Creating components in the destroyed state is forbidden."
|
|
69
|
+
errorMsg: "Creating components in the destroyed state is forbidden.",
|
|
70
|
+
error: ERRORMESSAGE.UI_STATE_ERROR
|
|
60
71
|
};
|
|
61
72
|
}
|
|
62
73
|
if (status === IElementStatus.READY) {
|
|
@@ -67,7 +78,8 @@ export function checkCanMount(_ref) {
|
|
|
67
78
|
if (containerService) {
|
|
68
79
|
return {
|
|
69
80
|
success: false,
|
|
70
|
-
errorMsg: "SDK status error."
|
|
81
|
+
errorMsg: "SDK status error.",
|
|
82
|
+
error: ERRORMESSAGE.UI_STATE_ERROR
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
return {
|
|
@@ -429,7 +441,7 @@ export function showToast() {
|
|
|
429
441
|
textAlign: 'center',
|
|
430
442
|
marginTop: '12px',
|
|
431
443
|
lineHeight: '20px',
|
|
432
|
-
fontFamily:
|
|
444
|
+
fontFamily: 'Noto Sans',
|
|
433
445
|
fontWeight: 400,
|
|
434
446
|
fontSize: '14px'
|
|
435
447
|
}
|
|
@@ -474,4 +486,31 @@ export var isElementPad = function isElementPad() {
|
|
|
474
486
|
};
|
|
475
487
|
export var isElementPC = function isElementPC() {
|
|
476
488
|
return !isElementMobile();
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* 判断是否需要加载错误页
|
|
493
|
+
* @param {CashierSdkActionQueryResult} params
|
|
494
|
+
* @returns {boolean} - 是否需要加载错误页
|
|
495
|
+
*/
|
|
496
|
+
export var isLoadErrorPage = function isLoadErrorPage(params) {
|
|
497
|
+
var success = params.success,
|
|
498
|
+
paymentMethods = params.paymentMethods,
|
|
499
|
+
savedPaymentMethods = params.savedPaymentMethods,
|
|
500
|
+
orderAmountView = params.orderAmountView,
|
|
501
|
+
paymentAmountView = params.paymentAmountView;
|
|
502
|
+
|
|
503
|
+
// 校验是否存在支付方式
|
|
504
|
+
var hasValidPaymentMethods = paymentMethods && Array.isArray(paymentMethods) && paymentMethods.length > 0 || savedPaymentMethods && Array.isArray(savedPaymentMethods) && savedPaymentMethods.length > 0;
|
|
505
|
+
|
|
506
|
+
// 金额存在性校验
|
|
507
|
+
var hasAmountViews = !!orderAmountView && !!paymentAmountView;
|
|
508
|
+
|
|
509
|
+
// 错误条件判断(满足任意条件即需要展示错误页)
|
|
510
|
+
return !success ||
|
|
511
|
+
// 接口请求失败
|
|
512
|
+
!hasValidPaymentMethods ||
|
|
513
|
+
// 无有效支付方式
|
|
514
|
+
!hasAmountViews // 缺少金额展示
|
|
515
|
+
;
|
|
477
516
|
};
|
|
@@ -12,8 +12,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
12
12
|
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); }
|
|
13
13
|
import axios from 'axios';
|
|
14
14
|
import { ServiceProvider } from '..';
|
|
15
|
-
import { errorEnum } from "./deps";
|
|
16
|
-
import { appId, device, fomatGetwayError, get, hostSignMap, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
|
|
15
|
+
import { appId, device, errorEnum, fomatGetwayError, get, hostSignMap, lightSandboxMap, queryParse, requestHost, safeJson, sdkVersion, sofaId, tntInstId } from "./deps";
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* @author congle.zzq <congle.zzq@alipay.com>
|
|
@@ -116,7 +115,7 @@ export var RequesterService = /*#__PURE__*/function () {
|
|
|
116
115
|
errorMessage: _context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message
|
|
117
116
|
});
|
|
118
117
|
timeoutCode = _context.t0 !== null && _context.t0 !== void 0 && (_error$message = _context.t0.message) !== null && _error$message !== void 0 && _error$message.includes('timeout') ? errorEnum.TIMEOUT : '';
|
|
119
|
-
_errorCode = (_error === null || _error === void 0 ? void 0 : _error.errorCode)
|
|
118
|
+
_errorCode = timeoutCode || (_error === null || _error === void 0 ? void 0 : _error.errorCode);
|
|
120
119
|
this.reportRequestTimeCost({
|
|
121
120
|
title: 'a3753.b101271.c388193.d521387',
|
|
122
121
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
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, type IElementOptions } from '../core/component/oldElement/type';
|
|
10
|
+
export { ElementType, PaymentElementLayout, ThemeType, type IElementOptions, } from '../core/component/oldElement/type';
|
|
11
11
|
interface onCnageResult {
|
|
12
12
|
complete: boolean;
|
|
13
13
|
addressValue: AddressItem[];
|
|
@@ -594,6 +594,10 @@ export interface CashierSdkActionQueryResult {
|
|
|
594
594
|
channelOrderId?: string;
|
|
595
595
|
};
|
|
596
596
|
errorActions?: Record<string, string>;
|
|
597
|
+
orderAmountView?: IAmountView;
|
|
598
|
+
paymentAmountView?: IAmountView;
|
|
599
|
+
paymentMethods?: IPaymentMethod[];
|
|
600
|
+
savedPaymentMethods?: IPaymentMethod[];
|
|
597
601
|
}
|
|
598
602
|
export interface CashierSdkActionQuerySessionResult extends IPaymentSessionMetaData {
|
|
599
603
|
success: boolean;
|
package/esm/util/spm-map.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const ELEMENT_SPM_MAP: {
|
|
|
7
7
|
auto_apple_pay_start: string;
|
|
8
8
|
auto_apple_pay_failed: string;
|
|
9
9
|
auto_apple_pay_success: string;
|
|
10
|
+
sdk_element_handleHeartBeat: string;
|
|
10
11
|
};
|
|
11
12
|
export declare const SPM_MAP: {
|
|
12
13
|
sdk_event_mount_element: string;
|
|
@@ -17,6 +18,7 @@ export declare const SPM_MAP: {
|
|
|
17
18
|
auto_apple_pay_start: string;
|
|
18
19
|
auto_apple_pay_failed: string;
|
|
19
20
|
auto_apple_pay_success: string;
|
|
21
|
+
sdk_element_handleHeartBeat: string;
|
|
20
22
|
sdk_error_runtime_error: string;
|
|
21
23
|
sdk_event_sdkQuery_failed: string;
|
|
22
24
|
container_error_error_insert_js: string;
|
package/esm/util/spm-map.js
CHANGED
|
@@ -14,7 +14,8 @@ export var ELEMENT_SPM_MAP = {
|
|
|
14
14
|
multiple_instance_error: 'a3753.b101271.c403950',
|
|
15
15
|
auto_apple_pay_start: 'a3753.b107385.c398110',
|
|
16
16
|
auto_apple_pay_failed: 'a3753.b107385.c398111',
|
|
17
|
-
auto_apple_pay_success: 'a3753.b107385.c398112'
|
|
17
|
+
auto_apple_pay_success: 'a3753.b107385.c398112',
|
|
18
|
+
sdk_element_handleHeartBeat: 'a3753.b101271.c388217.d624449'
|
|
18
19
|
};
|
|
19
20
|
export var SPM_MAP = _objectSpread({
|
|
20
21
|
sdk_error_runtime_error: 'a3753.b101271.c388188.d512342',
|