Socket
Socket
Sign inDemoInstall

@alipay/ams-checkout

Package Overview
Dependencies
10
Maintainers
2
Versions
300
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.12.0 to 1.13.0

esm/util/debug.d.ts

3

esm/core/instance/index.js

@@ -61,2 +61,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); }

this.logger = new Logger(LogConfig, ![environmentEnum.prod, environmentEnum.sandbox].includes(options === null || options === void 0 ? void 0 : options.environment));
Logger.setInstance(this.logger);
this.logger.setMedta({

@@ -94,3 +95,3 @@ instanceId: this._instanceId

var minVersion = item === null || item === void 0 || (_item$v = item.v) === null || _item$v === void 0 ? void 0 : _item$v.split('|')[0];
var maxVersion = (item === null || item === void 0 || (_item$v2 = item.v) === null || _item$v2 === void 0 ? void 0 : _item$v2.split('|')[1]) || '999.9.9';
var maxVersion = (item === null || item === void 0 || (_item$v2 = item.v) === null || _item$v2 === void 0 ? void 0 : _item$v2.split('|')[1]) || '999999.9.9';
var matchVersion = compareVersion(sdkVersion, minVersion) >= 0 && compareVersion(maxVersion, sdkVersion) >= 0;

@@ -97,0 +98,0 @@ return ((item === null || item === void 0 || (_item$platform = item.platform) === null || _item$platform === void 0 ? void 0 : _item$platform.includes('Web')) || (item === null || item === void 0 ? void 0 : item.platform) === '') && (item === null || item === void 0 ? void 0 : item.product) === product && (!(item !== null && item !== void 0 && item.v) || matchVersion);

@@ -1,3 +0,3 @@

import { renderDisplayTypeEnum, componentSignEnum, Ianalytics } from '../../types';
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productSceneVersion: string, extendInfo: string) => any;
import { componentSignEnum, Ianalytics, renderDisplayTypeEnum } from '../../types';
export declare const getAppPath: (environment: string, appVersion: string, componentSign: componentSignEnum, productScene: string, productSceneVersion: string, extendInfo: string, mid: string) => any;
export declare const getAppDomain: (domainParams: {

@@ -7,4 +7,6 @@ environment: string;

componentSign: componentSignEnum;
productScene: string;
productSceneVersion: string;
extendInfo: string;
mid: string;
}) => string;

@@ -14,2 +16,3 @@ export declare const getIframeUrl: (iframeParams: {

analytics?: Ianalytics;
productScene: string;
productSceneVersion: string;

@@ -24,2 +27,3 @@ environment: string;

hostSign?: string;
mid: string;
}) => {

@@ -26,0 +30,0 @@ path: string;

@@ -13,8 +13,36 @@ 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); }

import { marmotMap, sdkVersion } from "../../config/index";
import { componentSignEnum } from "../../types";
import { isDebugLog } from "../../util/debug";
import { getViewPort, queryParse, serialize } from "../../util/index";
import { componentSignEnum } from "../../types";
var getAppVersion = function getAppVersion(_extendInfo) {
import { Logger } from "../../util/logger";
import { getLastAppVersion, getMatchAppVersion, setLastAppVersion } from "../../util/upgrade";
var getAppVersion = function getAppVersion(_extendInfo, productScene, mid) {
try {
var info = JSON.parse(_extendInfo);
return info.versionMap.web[sdkVersion].targetWebVerison;
var _Logger$getInstance;
var appVersion = getMatchAppVersion(_extendInfo, {
sdkVersion: sdkVersion,
productScene: productScene,
mid: mid
});
// 有sessionData加载时
(_Logger$getInstance = Logger.getInstance()) === null || _Logger$getInstance === void 0 || _Logger$getInstance.logInfo({
title: 'sdk_event_appUpgradeInfo'
}, {
appUpgradeVersion: appVersion,
appUpgraded: appVersion ? true : false,
isPreload: _extendInfo ? false : true,
extendInfo: _extendInfo,
productScene: productScene,
mid: mid
});
// 没有匹配到版本,查询上次的加载版本
if (!appVersion) {
appVersion = getLastAppVersion(productScene);
return appVersion;
}
// 不为空时代表是有sessionData,因此要保存当前版本
if (_extendInfo) {
setLastAppVersion(productScene, appVersion);
}
return appVersion;
} catch (error) {

@@ -38,9 +66,22 @@ return '';

var componentSign = arguments.length > 2 ? arguments[2] : undefined;
var productSceneVersion = arguments.length > 3 ? arguments[3] : undefined;
var extendInfo = arguments.length > 4 ? arguments[4] : undefined;
var productScene = arguments.length > 3 ? arguments[3] : undefined;
var productSceneVersion = arguments.length > 4 ? arguments[4] : undefined;
var extendInfo = arguments.length > 5 ? arguments[5] : undefined;
var mid = arguments.length > 6 ? arguments[6] : undefined;
var _ref = queryParse() || {},
urlTestHost = _ref.host;
var finalAppVersion = getAppVersion(extendInfo) || appVersion;
var upgradeAppVersion = getAppVersion(extendInfo, productScene, mid);
var finalAppVersion = upgradeAppVersion || appVersion;
// 当有升级版本时,更新到全局字段
if (upgradeAppVersion) {
var _Logger$getInstance2;
(_Logger$getInstance2 = Logger.getInstance()) === null || _Logger$getInstance2 === void 0 || _Logger$getInstance2.setMedta({
webAppVersion: finalAppVersion
});
}
if (isDebugLog()) {
console.log('appUpgrade#getAppPath#finalAppVersion', finalAppVersion);
console.log('appUpgrade#getAppPath#extendInfo', extendInfo, mid);
}
var finalProductSceneVersion = getFinalProductSceneVersion(componentSign, productSceneVersion);
// only for test while testurl?host=https://xxxxx.test.html

@@ -56,6 +97,8 @@ if (urlTestHost && !['sandbox', 'light_sandbox', 'prod'].includes(environment)) {

componentSign = domainParams.componentSign,
productScene = domainParams.productScene,
productSceneVersion = domainParams.productSceneVersion,
extendInfo = domainParams.extendInfo;
extendInfo = domainParams.extendInfo,
mid = domainParams.mid;
var reg = /^https?:\/\/([^/<>\s]+\.?)*/;
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo));
var macth = reg.exec(getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo, mid));
return macth && macth[0] || '';

@@ -69,2 +112,3 @@ };

} : _iframeParams$analyti,
productScene = iframeParams.productScene,
productSceneVersion = iframeParams.productSceneVersion,

@@ -80,4 +124,11 @@ environment = iframeParams.environment,

_iframeParams$hostSig = iframeParams.hostSign,
hostSign = _iframeParams$hostSig === void 0 ? '' : _iframeParams$hostSig;
var path = getAppPath(environment, appVersion, componentSign, productSceneVersion, extendInfo || '');
hostSign = _iframeParams$hostSig === void 0 ? '' : _iframeParams$hostSig,
_iframeParams$mid = iframeParams.mid,
mid = _iframeParams$mid === void 0 ? '' : _iframeParams$mid;
var path = getAppPath(environment, appVersion, componentSign, productScene, productSceneVersion, extendInfo || '', mid);
var appMatched = getMatchAppVersion(extendInfo, {
sdkVersion: sdkVersion,
productScene: productScene,
mid: mid
}) ? 'true' : 'false';
var initialScale = 1;

@@ -99,2 +150,3 @@ var scale = getViewPort('initial-scale') || initialScale;

instanceId: instanceId,
appMatched: appMatched,
analyticsEnabled: (analytics === null || analytics === void 0 ? void 0 : analytics.enabled) === false ? 'false' : 'true',

@@ -115,2 +167,6 @@ sdkVersion: sdkVersion,

var locationSearch = serialize(urlParams);
if (isDebugLog()) {
console.log('appUpgrade#getIframeUrl#appMatched', appMatched);
console.log('appUpgrade#getIframeUrl#url', path, locationSearch);
}
return {

@@ -117,0 +173,0 @@ path: path,

@@ -15,2 +15,3 @@ interface LogPayload {

sdkVersion?: string;
webAppVersion?: string;
fistLogTime?: number;

@@ -46,4 +47,7 @@ fsDuration?: number;

private isLoaded;
private static instance;
private trackId;
constructor(config: Config, debug: boolean);
static setInstance(instance: Logger): Logger;
static getInstance(): Logger;
setMedta(mdata: LogMetaData): void;

@@ -50,0 +54,0 @@ logError(error: LogPayload, extra?: Extra): Logger;

@@ -189,5 +189,16 @@ 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); }

}
}], [{
key: "setInstance",
value: function setInstance(instance) {
return this.instance = instance;
}
}, {
key: "getInstance",
value: function getInstance() {
return this.instance;
}
}]);
return Logger;
}();
_defineProperty(Logger, "instance", void 0);
export var LogConfig = {

@@ -194,0 +205,0 @@ scriptUrl: 'https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_intl-tracker/1.6.0/dist/common.min.js',

@@ -7,3 +7,10 @@ /**

export declare function compareVersion(v1: string, v2: string): 0 | 1 | -1;
/**
* 判断version版本是否在range参数版本的范围内
* @param version
* @param range
* @returns
*/
export declare function isVersionInStringRange(version: string, range: string): boolean;
export declare function isVersionInRange(currentVersion: any, minVersion: any, maxVersion: any): boolean;
export declare function matchVersion(config: any, currentVersion: any): boolean;

@@ -52,2 +52,24 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

}
/**
* 判断version版本是否在range参数版本的范围内
* @param version
* @param range
* @returns
*/
export function isVersionInStringRange(version, range) {
if (!range) {
// 未指定版本限制
return true;
}
if (range.includes(',')) {
return range.split(',').includes(version);
}
if (!range.includes('|')) {
return version === range;
}
var minVersion = range.split('|')[0];
var maxVersion = range.split('|')[1] || '999999.9.9';
var matchVersion = compareVersion(version, minVersion) >= 0 && compareVersion(maxVersion, version) >= 0;
return matchVersion;
}
export function isVersionInRange(currentVersion, minVersion, maxVersion) {

@@ -54,0 +76,0 @@ function splitVersion(version) {

{
"name": "@alipay/ams-checkout",
"version": "1.12.0",
"version": "1.13.0",
"description": "",

@@ -5,0 +5,0 @@ "author": "",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc