@alipay/ams-checkout 1.25.1 → 1.25.2
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/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.25.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.25.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.25.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.25.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.25.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.25.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.25.
|
8
|
+
export declare const AMSCheckoutAppVersion = "1.25.2";
|
9
|
+
export declare const AMSAutoDebitAppVersion = "1.25.2";
|
10
|
+
export declare const AMSEasyPayAppVersion = "1.25.2";
|
11
|
+
export declare const AMSCashierPaymentAppVersion = "1.25.2";
|
12
|
+
export declare const AMSVaultingAppVersion = "1.25.2";
|
13
|
+
export declare const AMSPaymentElementAppVersion = "1.25.2";
|
14
|
+
export declare const ADDRESSElementAppVersion = "1.25.2";
|
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.25.
|
39
|
-
export var AMSAutoDebitAppVersion = '1.25.
|
40
|
-
export var AMSEasyPayAppVersion = '1.25.
|
41
|
-
export var AMSCashierPaymentAppVersion = '1.25.
|
42
|
-
export var AMSVaultingAppVersion = '1.25.
|
43
|
-
export var AMSPaymentElementAppVersion = '1.25.
|
44
|
-
export var ADDRESSElementAppVersion = '1.25.
|
38
|
+
export var AMSCheckoutAppVersion = '1.25.2'; // 兜底版本号
|
39
|
+
export var AMSAutoDebitAppVersion = '1.25.2'; // 代扣
|
40
|
+
export var AMSEasyPayAppVersion = '1.25.2'; // easypay
|
41
|
+
export var AMSCashierPaymentAppVersion = '1.25.2'; // 收银台(卡、apm)
|
42
|
+
export var AMSVaultingAppVersion = '1.25.2'; // 绑卡
|
43
|
+
export var AMSPaymentElementAppVersion = '1.25.2'; // payment element
|
44
|
+
export var ADDRESSElementAppVersion = '1.25.2'; // address element
|
@@ -37,6 +37,7 @@ export declare class EventCenter implements Service {
|
|
37
37
|
* @param e - The message event.
|
38
38
|
*/
|
39
39
|
private handleAppMessage;
|
40
|
+
private checkEventCompliant;
|
40
41
|
/**
|
41
42
|
* Processes the application message and emits the associated event.
|
42
43
|
* @param data - Parsed EventPayload from the app.
|
@@ -109,7 +109,7 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
109
109
|
var isJson = isJsonString(e.data);
|
110
110
|
if (isJson) {
|
111
111
|
var eventPayload = JSON.parse(e.data);
|
112
|
-
if (
|
112
|
+
if (!this.checkEventCompliant(eventPayload)) {
|
113
113
|
return;
|
114
114
|
}
|
115
115
|
this._handleAppMessage(eventPayload);
|
@@ -117,6 +117,26 @@ export var EventCenter = /*#__PURE__*/function () {
|
|
117
117
|
console.error(ERRORMESSAGE.NOT_JSON_FORMAT);
|
118
118
|
}
|
119
119
|
}
|
120
|
+
}, {
|
121
|
+
key: "checkEventCompliant",
|
122
|
+
value: function checkEventCompliant(eventPayload) {
|
123
|
+
// connect element场景下,多子iframes共用AntomCore中生成的instanceId,此时将发送事件方instanceId与iframes中instanceId做比较看是否在其中
|
124
|
+
// 非connect场景下,直接将发送事件方instanceId与AntomCore的instanceId做比较
|
125
|
+
if (eventPayload.name !== MessageName.APP_TO_SDK) {
|
126
|
+
return false;
|
127
|
+
}
|
128
|
+
var iframesInstanceIds = this.iframes.map(function (iframe) {
|
129
|
+
var _iframe$ref;
|
130
|
+
if (!new URL((_iframe$ref = iframe.ref) === null || _iframe$ref === void 0 ? void 0 : _iframe$ref.src)) {
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
return new URL(iframe.ref.src).searchParams.get('instanceId');
|
134
|
+
}).filter(Boolean);
|
135
|
+
if (eventPayload.instanceId !== this.instanceId && !iframesInstanceIds.includes(eventPayload.instanceId)) {
|
136
|
+
return false;
|
137
|
+
}
|
138
|
+
return true;
|
139
|
+
}
|
120
140
|
|
121
141
|
/**
|
122
142
|
* Processes the application message and emits the associated event.
|