@alipay/ams-checkout 0.0.1705989903-dev.0 → 0.0.1707132905-dev.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.
@@ -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(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];
@@ -221,7 +221,7 @@ export var AMSComponent = /*#__PURE__*/function (_CoreInstance) {
221
221
  data: data
222
222
  }
223
223
  });
224
- _this4.logger.logError({
224
+ _this4.logger.logInfo({
225
225
  title: 'sdk_event_apiSubmit'
226
226
  });
227
227
  } catch (error) {
@@ -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.9.0';
56
+ this._appVersion = '1.10.0';
57
57
  this._isInitComponent = false;
58
58
  this._selector = "#".concat(COMPONENT_SECTION_ID);
59
59
  this.createIframeNode = function () {
@@ -315,9 +315,6 @@ var ComponentApp = /*#__PURE__*/function () {
315
315
  var _this4 = this;
316
316
  return new Promise(function (resolve, reject) {
317
317
  _this4._loadAppPromiseResolve = resolve;
318
- _this4.AMSSDK.logger.logError({
319
- title: 'sdk_event_webAppPreLoadStart'
320
- });
321
318
  setTimeout(function () {
322
319
  reject(ERRORMESSAGE.CREATECOMPONENT_ERROR.LOAD_APP_TIMEOUT);
323
320
  }, loadTimeLimit !== null && loadTimeLimit !== void 0 ? loadTimeLimit : LOADTIME_LIMIT);
@@ -375,8 +375,8 @@ export interface ApplePayPaymentSessionResult {
375
375
  message?: string;
376
376
  }
377
377
  export declare enum redirectTypeEnum {
378
- UNSAFE_BROWSER = "UNSAFE_BROWSER",
379
- SAFETY_BROWSER = "SAFETY_BROWSER",
378
+ UNSAFE_BROWSER = "UNSAFE_BROWSER",// 非安全浏览器
379
+ SAFETY_BROWSER = "SAFETY_BROWSER",// 安全浏览器
380
380
  INVOKE_SDK = "INVOKE_SDK"
381
381
  }
382
382
  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,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1705989903-dev.0",
3
+ "version": "0.0.1707132905-dev.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",