@alipay/ams-checkout 0.0.1705581945-dev.0 → 0.0.1705581945-dev.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.
@@ -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 @@ var getComponentSign = function getComponentSign(params) {
44
44
  };
45
45
  var parseSessionData = function parseSessionData(sessionData) {
46
46
  try {
47
- return [JSON.parse(atob(sessionData.split('&&')[3])), sessionData.split('&&').slice(0, 3).join('&&')];
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];
@@ -324,8 +324,8 @@ export interface CashierSdkActionQueryResult {
324
324
  authUrl?: string;
325
325
  }
326
326
  export declare enum redirectTypeEnum {
327
- UNSAFE_BROWSER = "UNSAFE_BROWSER",
328
- SAFETY_BROWSER = "SAFETY_BROWSER",
327
+ UNSAFE_BROWSER = "UNSAFE_BROWSER",// 非安全浏览器
328
+ SAFETY_BROWSER = "SAFETY_BROWSER",// 安全浏览器
329
329
  INVOKE_SDK = "INVOKE_SDK"
330
330
  }
331
331
  export interface ActionForm {
@@ -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
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed, };
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
- export { getType, EventCenter, getViewPort, getOrigin, serialize, isJsonString, isDom, device, safeJson, isPC, queryParse, getDesignFontSize, amsSetSize, addSetFontSizeEvent, getOrSetStorageId, checkTimeElapsed };
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 };
@@ -7,4 +7,4 @@
7
7
  * @param v1
8
8
  * @param v2
9
9
  */
10
- export declare function compareVersion(v1: string, v2: string): 1 | -1 | 0;
10
+ export declare function compareVersion(v1: string, v2: string): 1 | 0 | -1;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@alipay/ams-checkout","version":"0.0.1705581945-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
1
+ {"name":"@alipay/ams-checkout","version":"0.0.1705581945-dev.2","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}