@alipay/ams-checkout 1.9.0 → 1.10.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/core/component/index.js +2 -2
- package/esm/plugin/component/index.js +1 -1
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +14 -1
- package/esm/util/versionCompare.d.ts +1 -5
- package/esm/util/versionCompare.js +0 -5
- package/package.json +1 -1
@@ -29,7 +29,7 @@ import { v4 as uuid } from 'uuid';
|
|
29
29
|
import { COMPONENTPLUGINID, ERRORMESSAGE, EVENT } from "../../constant";
|
30
30
|
import ComponentApp from "../../plugin/component";
|
31
31
|
import { componentSignEnum, modeEnum, networkModeEnum, productSceneEnum, renderDisplayTypeEnum } from "../../types";
|
32
|
-
import { getOrSetStorageId, isPC } from "../../util";
|
32
|
+
import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
|
33
33
|
import { createIframeNode } from "../../util/createIframeNode";
|
34
34
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
35
35
|
import CoreInstance from "../instance/index";
|
@@ -44,7 +44,7 @@ export var getComponentSign = function getComponentSign(params) {
|
|
44
44
|
};
|
45
45
|
export var parseSessionData = function parseSessionData(sessionData) {
|
46
46
|
try {
|
47
|
-
return [JSON.parse(
|
47
|
+
return [JSON.parse(parseBase64ToString(sessionData.split('&&')[3])), sessionData.split('&&').slice(0, 3).join('&&')];
|
48
48
|
} catch (error) {
|
49
49
|
console.error('Parsing sessionData is abnormal and may affect the payment link. Please ensure to use the new version of SDK.');
|
50
50
|
return [{}, sessionData];
|
@@ -53,7 +53,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
53
53
|
_defineProperty(this, "_merchantAppointParam", void 0);
|
54
54
|
_defineProperty(this, "_webAppHeartBeatTimeoutId", void 0);
|
55
55
|
_defineProperty(this, "_webAppHeartBeatTimeoutFn", void 0);
|
56
|
-
this._appVersion = '1.
|
56
|
+
this._appVersion = '1.10.0';
|
57
57
|
this._isInitComponent = false;
|
58
58
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
59
59
|
this.createIframeNode = function () {
|
package/esm/util/index.d.ts
CHANGED
@@ -37,4 +37,5 @@ declare const addSetFontSizeEvent: () => void;
|
|
37
37
|
*/
|
38
38
|
declare const getOrSetStorageId: (key: string, value?: string) => string;
|
39
39
|
declare const checkTimeElapsed: () => boolean;
|
40
|
-
|
40
|
+
declare function parseBase64ToString(base64: string): string;
|
41
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString, };
|
package/esm/util/index.js
CHANGED
@@ -246,4 +246,17 @@ var checkTimeElapsed = function checkTimeElapsed() {
|
|
246
246
|
localStorage.setItem(key, currentTime.toString());
|
247
247
|
return true;
|
248
248
|
};
|
249
|
-
|
249
|
+
|
250
|
+
// https://developer.mozilla.org/en-US/docs/Glossary/Base64
|
251
|
+
function parseBase64ToString(base64) {
|
252
|
+
try {
|
253
|
+
var binString = atob(base64);
|
254
|
+
var uint8Array = Uint8Array.from(binString, function (m) {
|
255
|
+
return m.codePointAt(0);
|
256
|
+
});
|
257
|
+
return new TextDecoder().decode(uint8Array);
|
258
|
+
} catch (error) {
|
259
|
+
return null;
|
260
|
+
}
|
261
|
+
}
|
262
|
+
export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, parseBase64ToString };
|
@@ -1,10 +1,6 @@
|
|
1
|
-
/**
|
2
|
-
* @author 谦彧 <zhangmian.zm@alipay.com>
|
3
|
-
* @date 2023/11/1
|
4
|
-
*/
|
5
1
|
/**
|
6
2
|
* 返回值0标识一样大,1表示v1大,-1表示v2大
|
7
3
|
* @param v1
|
8
4
|
* @param v2
|
9
5
|
*/
|
10
|
-
export declare function compareVersion(v1: string, v2: string): 1 |
|
6
|
+
export declare function compareVersion(v1: string, v2: string): 1 | 0 | -1;
|