@alipay/ams-checkout 0.0.1784542444-dev.2 → 0.0.1784542444-dev.21
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/ams-checkout.js +3 -3
- package/dist/ams-checkout.min.js +1 -1
- package/dist/ams-checkout.min.js.map +1 -1
- package/esm/config/index.js +1 -1
- package/esm/core/component/element/elementProcessor/paymentProcessor.js +7 -5
- package/esm/core/component/element/modernElementController/adapter.js +1 -0
- package/esm/core/component/element/modernElementController/index.d.ts +3 -1
- package/esm/core/component/element/modernElementController/index.js +474 -262
- package/esm/core/utils/connectConfig.d.ts +11 -0
- package/esm/core/utils/connectConfig.js +28 -0
- package/esm/foundation/service/event-center.js +12 -9
- package/esm/modern/tools.js +1 -1
- package/esm/plugin/component/channel.d.ts +1 -1
- package/esm/plugin/component/channel.js +11 -2
- package/esm/util/logger.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +82 -5
- package/types.untrimmed.d.ts +93 -6
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether to query oneAccount API based on connect mode and merchant flag.
|
|
3
|
+
*
|
|
4
|
+
* In simpler connect mode (when onlyIntegrateCardElementConnectMerchantFlag is 'true'),
|
|
5
|
+
* the oneAccount API call should be skipped to avoid unnecessary network requests.
|
|
6
|
+
*
|
|
7
|
+
* @param isConnect - Whether connect mode is enabled
|
|
8
|
+
* @param extendInfo - JSON string containing merchant configuration flags
|
|
9
|
+
* @returns true if oneAccount API should be queried, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export declare function shouldQueryOneAccount(isConnect: boolean, extendInfo?: string): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines whether to query oneAccount API based on connect mode and merchant flag.
|
|
3
|
+
*
|
|
4
|
+
* In simpler connect mode (when onlyIntegrateCardElementConnectMerchantFlag is 'true'),
|
|
5
|
+
* the oneAccount API call should be skipped to avoid unnecessary network requests.
|
|
6
|
+
*
|
|
7
|
+
* @param isConnect - Whether connect mode is enabled
|
|
8
|
+
* @param extendInfo - JSON string containing merchant configuration flags
|
|
9
|
+
* @returns true if oneAccount API should be queried, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
export function shouldQueryOneAccount(isConnect, extendInfo) {
|
|
12
|
+
if (!isConnect) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
if (!extendInfo) {
|
|
16
|
+
// No extendInfo provided, default to querying oneAccount for safety
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
var parsed = JSON.parse(extendInfo);
|
|
21
|
+
var flag = parsed === null || parsed === void 0 ? void 0 : parsed.onlyIntegrateCardElementConnectMerchantFlag;
|
|
22
|
+
// Explicitly convert to string to handle both boolean and string values from backend
|
|
23
|
+
return String(flag) !== 'true';
|
|
24
|
+
} catch (_unused) {
|
|
25
|
+
// If parsing fails, default to querying oneAccount for safety
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
+
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); }
|
|
4
4
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
5
|
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); } }
|
|
6
6
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -106,17 +106,20 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
|
106
106
|
if ((_e$data = e.data) !== null && _e$data !== void 0 && _e$data.source && ['react-devtools-content-script', 'react-devtools-backend-manager', 'react-devtools-bridge'].includes(e.data.source)) {
|
|
107
107
|
return; // Ignore messages from React DevTools
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
this._handleAppMessage(_eventPayload);
|
|
109
|
+
// postMessage 结构化克隆传递的是对象,不是 JSON 字符串;先判断是否为对象,再尝试 JSON 解析
|
|
110
|
+
var eventPayload;
|
|
111
|
+
if (_typeof(e.data) === 'object' && e.data !== null) {
|
|
112
|
+
eventPayload = e.data;
|
|
113
|
+
} else if (isJsonString(e.data)) {
|
|
114
|
+
eventPayload = JSON.parse(e.data);
|
|
117
115
|
} else {
|
|
118
116
|
console.error(ERRORMESSAGE.NOT_JSON_FORMAT);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!this.checkEventCompliant(eventPayload)) {
|
|
120
|
+
return;
|
|
119
121
|
}
|
|
122
|
+
this._handleAppMessage(eventPayload);
|
|
120
123
|
}
|
|
121
124
|
}, {
|
|
122
125
|
key: "checkEventCompliant",
|