Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

seer-dynamic-component

Package Overview
Dependencies
Maintainers
6
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

seer-dynamic-component - npm Package Compare versions

Comparing version 1.6.7 to 1.6.8

213

lib/utils.js

@@ -19,2 +19,5 @@ import "core-js/modules/es6.object.keys.js";

import "core-js/modules/es6.regexp.to-string.js";
import "core-js/modules/es6.regexp.search.js";
import "core-js/modules/es6.regexp.constructor.js";
import "core-js/modules/es6.regexp.match.js";
import "core-js/modules/es6.string.includes.js";

@@ -27,2 +30,3 @@ import "core-js/modules/es7.array.includes.js";

*/
var request = require('sync-request');
export var getCompInfo = function getCompInfo(id, relativePath) {

@@ -179,53 +183,172 @@ return new Promise(function (resolve, reject) {

};
//获取当前平台的多语资源
export var getLangData = function getLangData(_ref2) {
var groupCode = _ref2.groupCode,
tenantid = _ref2.tenantid,
langApi = _ref2.langApi,
lang = _ref2.lang,
packJs = _ref2.packJs,
callback = _ref2.callback,
includeFw = _ref2.includeFw;
//已经加载过的则不需要再次加载
if (window.seerConfig && window.seerConfig.groupCodeList && window.seerConfig.groupCodeList.includes(groupCode)) {
callback && callback(data);
return true;
export var getLangOrign = function getLangOrign() {
var origin;
if (window._YMSHOST_) {
origin = window._YMSHOST_;
} else if (window.parent._YMSHOST_) {
origin = window.parent._YMSHOST_;
} else if (window.opener._YMSHOST_) {
origin = window.opener._YMSHOST_;
}
lang = lang || window.lang;
if (!lang) {
return false;
if (!origin) {
origin = xssFilter(window.location.origin);
}
if (typeof includeFw === 'undefined') {
includeFw = true;
return origin;
};
export var inDiwork = function inDiwork(opener) {
try {
return window.seerConfig && window.seerConfig.inDiwork || window.jDiwork || opener && opener.seerConfig && opener.seerConfig.inDiwork;
} catch (_unused) {
return getCookie('YKJ_IS_DIWORK') === '1';
}
var diworkContext = window.diworkContext ? window.diworkContext() : null;
if (diworkContext) {
// if(!diworkContext.ext.multilingualFlag) {
// return false;
// }
if (!tenantid) {
tenantid = diworkContext.tenantid;
};
export var getLocale = function getLocale() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'locale';
if (window.diworkContext && window.diworkContext()) {
return window.diworkContext()[key];
}
return getUrlParam(key);
};
export var getUrlParam = function getUrlParam(name, path) {
var getPath = path || window.location.search;
var reg = new RegExp("(^|&|\\?)" + name + "=([^&]*)(&|$)");
var r = getPath.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
} else {
getPath = path || window.location.hash;
var _reg = new RegExp("(^|&|\\?)" + name + "=([^&]*)(&|$)");
var _r = getPath.substr(1).match(_reg);
if (_r != null) {
return unescape(_r[2]);
}
} else if (seerConfig && seerConfig.userInfo) {
var userInfo = seerConfig.userInfo || {};
if (!userInfo.enableMultilingual) {
return false;
}
if (!path && inDiwork() && name !== "target") {
// 去iframe后,参数都在target中
var target = getUrlParam("target");
if (target) {
target = decodeURIComponent(target);
var result = getUrlParam(name, target);
return result;
}
if (!tenantid) {
tenantid = userInfo.tenantPk || '0'; //可以直接从url中取
}
}
return null;
};
langApi = langApi || (window._YMSHOST_ ? window._YMSHOST_ : xssFilter(window.location.origin)) + "/iuap-apcom-i18n";
lang.init(packJs || {});
lang.jsonpUuid(tenantid, groupCode, langApi, function (data) {
callback && callback(data);
}, 'YS', includeFw);
//把已经加载过的多语模块存入全局变量中
window.seerConfig = window.seerConfig || {};
window.seerConfig.groupCodeList = window.seerConfig.groupCodeList || [];
if (!window.seerConfig.groupCodeList.includes(groupCode)) {
window.seerConfig.groupCodeList.push(groupCode);
}
return true;
};
//获取当前平台的多语资源
export var getLangData = /*#__PURE__*/function () {
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
var groupCode, tenantid, langApi, lang, packJs, callback, includeFw, diworkContext, userInfo, locale, initPackLangJson, initResponse, jsonLocale, langInit;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) switch (_context2.prev = _context2.next) {
case 0:
groupCode = _ref2.groupCode, tenantid = _ref2.tenantid, langApi = _ref2.langApi, lang = _ref2.lang, packJs = _ref2.packJs, callback = _ref2.callback, includeFw = _ref2.includeFw;
//已经加载过的则不需要再次加载
window.seerConfig = window.seerConfig || {};
if (!(window.seerConfig && window.seerConfig.groupCodeList && window.seerConfig.groupCodeList.includes(groupCode))) {
_context2.next = 5;
break;
}
callback && callback();
return _context2.abrupt("return", true);
case 5:
lang = lang || window.lang;
if (lang) {
_context2.next = 10;
break;
}
window.seerConfig.loadLangError = 1;
callback && callback();
return _context2.abrupt("return", false);
case 10:
if (typeof includeFw === 'undefined') {
includeFw = true;
}
diworkContext = window.diworkContext ? window.diworkContext() : null;
if (!diworkContext) {
_context2.next = 20;
break;
}
if (diworkContext.ext.multilingualFlag) {
_context2.next = 17;
break;
}
window.seerConfig.loadLangError = 1;
callback && callback();
return _context2.abrupt("return", false);
case 17:
if (!tenantid) {
tenantid = diworkContext.tenantid;
}
_context2.next = 27;
break;
case 20:
if (!(seerConfig && seerConfig.userInfo)) {
_context2.next = 27;
break;
}
userInfo = seerConfig.userInfo || {};
if (userInfo.enableMultilingual) {
_context2.next = 26;
break;
}
window.seerConfig.loadLangError = 1;
callback && callback();
return _context2.abrupt("return", false);
case 26:
if (!tenantid) {
tenantid = userInfo.tenantPk || '0'; //可以直接从url中取
}
case 27:
locale = getLocale("locale");
if (inDiwork()) {
_context2.next = 47;
break;
}
initPackLangJson = {};
_context2.prev = 30;
_context2.next = 33;
return request('GET', "/iuap-data-common/ucf-wh/intelliv/static/js/lang/".concat(groupCode, "/").concat(locale, ".json"));
case 33:
initResponse = _context2.sent;
if (initResponse.body && initResponse.statusCode === 200) {
initPackLangJson = JSON.parse(initResponse.body);
}
_context2.next = 40;
break;
case 37:
_context2.prev = 37;
_context2.t0 = _context2["catch"](30);
console.error('获取多语错误');
case 40:
jsonLocale = locale.toLowerCase().replace(/_/, '');
langInit = {};
langInit[jsonLocale] = initPackLangJson;
lang.init(langInit);
callback && callback();
_context2.next = 50;
break;
case 47:
langApi = langApi || getLangOrign() + "/iuap-apcom-i18n";
lang.init(packJs || {});
lang.jsonpUuid(tenantid, groupCode, langApi, function (data) {
callback && callback(data);
}, 'YS', includeFw);
case 50:
//把已经加载过的多语模块存入全局变量中
window.seerConfig = window.seerConfig || {};
window.seerConfig.groupCodeList = window.seerConfig.groupCodeList || [];
if (!window.seerConfig.groupCodeList.includes(groupCode)) {
window.seerConfig.groupCodeList.push(groupCode);
}
return _context2.abrupt("return", true);
case 54:
case "end":
return _context2.stop();
}
}, _callee2, null, [[30, 37]]);
}));
return function getLangData(_x2) {
return _ref3.apply(this, arguments);
};
}();
{
"name": "seer-dynamic-component",
"version": "1.6.7",
"version": "1.6.8",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc