@rh-support/utils
Advanced tools
Comparing version 0.0.59 to 0.0.60
@@ -1,2 +0,2 @@ | ||
define(['exports', 'lodash/isEmpty', 'lodash/includes', 'lodash/filter', 'lodash/forEach', 'lodash/map', 'lodash/isFunction', 'lodash/reduce', 'lodash/concat', 'lodash/merge', 'js-markdown-extra', 'lodash/assign', 'lodash/get', 'lodash/isString', 'marked', 'lodash/orderBy', 'lodash/uniq', 'lodash/zipObject', 'solr-query-builder', 'qs'], function (exports, isEmpty, includes, filter, forEach, map, isFunction, reduce, concat, merge, jsMarkdownExtra, assign, get, isString, marked, orderBy, uniq, zipObject, SolrQueryBuilder, qs) { 'use strict'; | ||
define(['exports', 'lodash/isEmpty', 'lodash/includes', 'lodash/filter', 'lodash/forEach', 'lodash/map', 'lodash/isFunction', 'lodash/reduce', 'lodash/concat', 'lodash/merge', 'js-markdown-extra', 'lodash/assign', 'lodash/get', 'lodash/isString', 'marked', 'lodash/orderBy', 'lodash/uniq', 'lodash/zipObject', 'solr-query-builder', 'qs', 'lodash/sortBy'], function (exports, isEmpty, includes, filter, forEach, map, isFunction, reduce, concat, merge, jsMarkdownExtra, assign, get, isString, marked, orderBy, uniq, zipObject, SolrQueryBuilder, qs, sortBy) { 'use strict'; | ||
@@ -21,2 +21,3 @@ isEmpty = isEmpty && isEmpty.hasOwnProperty('default') ? isEmpty['default'] : isEmpty; | ||
qs = qs && qs.hasOwnProperty('default') ? qs['default'] : qs; | ||
sortBy = sortBy && sortBy.hasOwnProperty('default') ? sortBy['default'] : sortBy; | ||
@@ -307,16 +308,2 @@ function getApiResourceObject(data = undefined, isFetching = false, isError = false, errorMessage = '') { | ||
}; | ||
const computeFormattedDate = (date) => { | ||
date = new Date(date); | ||
const monthIndex = date.getMonth(); | ||
const dd = date.getDate(); | ||
const yyyy = date.getFullYear(); | ||
const monthNames = [ | ||
'January', 'February', 'March', | ||
'April', 'May', 'June', 'July', | ||
'August', 'September', 'October', | ||
'November', 'December' | ||
]; | ||
const formattedDate = `${monthNames[monthIndex]} ${dd}, ${yyyy}`; | ||
return formattedDate; | ||
}; | ||
@@ -350,2 +337,9 @@ function toOption(value, labelKey, disabledKey, classNameFn) { | ||
function haltEvent(event) { | ||
if (event) { | ||
event.stopPropagation(); | ||
event.preventDefault(); | ||
} | ||
} | ||
function getConfigField(config, fieldName, fieldType = null) { | ||
@@ -695,4 +689,5 @@ let values = reduce(config, (result, v) => { | ||
const emojiPattern = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug; | ||
const mailformat = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/; | ||
function isEmailValid(object) { | ||
const mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||
if (object.match(mailformat)) { | ||
@@ -706,3 +701,2 @@ return true; | ||
function isValidRHEmail(object) { | ||
const mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||
if (object.match(mailformat) && object.search('redhat.com') > 0) { | ||
@@ -715,2 +709,10 @@ return true; | ||
} | ||
function isEmojiPattern(object) { | ||
if (object && object.match(emojiPattern)) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
function isValidGuid(object) { | ||
@@ -726,2 +728,40 @@ const guidFormat = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; | ||
(function (CustomElements) { | ||
CustomElements["pfeTabs"] = "pfe-tabs"; | ||
})(exports.CustomElements || (exports.CustomElements = {})); | ||
/** | ||
* This function is to check if custom elements exist and require them if they do not. | ||
* The check is needed because of how the packages are split and that patternfly elements | ||
* use window.customElements.define without checking if it is already defined, which throws an | ||
* error. Since our packages are split up and lazy loaded this check is necessary to make sure that | ||
* the pfelement does not get defined twice. | ||
*/ | ||
function requireCustomElement(elements) { | ||
elements.forEach((elementObj) => { | ||
if (window.customElements.get(elementObj.element) === undefined) { | ||
elementObj.requireCb(); | ||
} | ||
}); | ||
} | ||
const getHydraContactFromStrataUser = (strataUser) => { | ||
return { | ||
firstName: strataUser.first_name, | ||
lastName: strataUser.last_name, | ||
isOrgAdmin: strataUser.org_admin, | ||
ssoUsername: strataUser.sso_username, | ||
accountNumber: strataUser.account_number, | ||
isInternal: strataUser.is_internal, | ||
}; | ||
}; | ||
const sortHydraContacts = (hydraContacts) => { | ||
return sortBy(hydraContacts, 'firstName', 'lastName'); | ||
}; | ||
const getHydraContactsFromStrataUsers = (strataUsers) => { | ||
return map(strataUsers, undefined.getHydraContactFromStrataUser); | ||
}; | ||
const getSortedHydraContactsFromStrataUsers = (strataUsers) => { | ||
return undefined.sortHydraContacts(map(strataUsers, undefined.getHydraContactFromStrataUser)); | ||
}; | ||
exports.CacheUtilsService = CacheUtilsService; | ||
@@ -733,3 +773,2 @@ exports.arrays2csv = arrays2csv; | ||
exports.cleanupMarkDown = cleanupMarkDown; | ||
exports.computeFormattedDate = computeFormattedDate; | ||
exports.computeRecommendationAbstract = computeRecommendationAbstract; | ||
@@ -741,2 +780,3 @@ exports.computeRecommendationTitle = computeRecommendationTitle; | ||
exports.elementOrEmpty = elementOrEmpty; | ||
exports.emojiPattern = emojiPattern; | ||
exports.escapeDoubleQuotes = escapeDoubleQuotes; | ||
@@ -751,6 +791,10 @@ exports.formatDate = formatDate; | ||
exports.getHeaderValue = getHeaderValue; | ||
exports.getHydraContactFromStrataUser = getHydraContactFromStrataUser; | ||
exports.getHydraContactsFromStrataUsers = getHydraContactsFromStrataUsers; | ||
exports.getRecommendationAbstract = getRecommendationAbstract; | ||
exports.getRecommendationTitle = getRecommendationTitle; | ||
exports.getSortedHydraContactsFromStrataUsers = getSortedHydraContactsFromStrataUsers; | ||
exports.getStringifiedParams = getStringifiedParams; | ||
exports.getUrlParsedParams = getUrlParsedParams; | ||
exports.haltEvent = haltEvent; | ||
exports.handleProductSearchResponse = handleProductSearchResponse; | ||
@@ -761,2 +805,3 @@ exports.haventLoadedMetadata = haventLoadedMetadata; | ||
exports.isEmailValid = isEmailValid; | ||
exports.isEmojiPattern = isEmojiPattern; | ||
exports.isFirefox = isFirefox; | ||
@@ -773,4 +818,6 @@ exports.isJsons = isJsons; | ||
exports.jsonsHeaders = jsonsHeaders; | ||
exports.mailformat = mailformat; | ||
exports.markdownToHTML = markdownToHTML; | ||
exports.replaceHighlightingData = replaceHighlightingData; | ||
exports.requireCustomElement = requireCustomElement; | ||
exports.scrollIntoSection = scrollIntoSection; | ||
@@ -781,2 +828,3 @@ exports.showFts = showFts; | ||
exports.solrResponseToPivotFields = solrResponseToPivotFields; | ||
exports.sortHydraContacts = sortHydraContacts; | ||
exports.string2csv = string2csv; | ||
@@ -783,0 +831,0 @@ exports.toCSV = toCSV; |
@@ -6,2 +6,1 @@ export declare const formatDate: (date: any, locale?: string, format?: { | ||
}) => string; | ||
export declare const computeFormattedDate: (date: any) => string; |
@@ -7,15 +7,1 @@ export const formatDate = (date, locale = 'en-us', format = { month: 'short', day: 'numeric', year: 'numeric' }) => { | ||
}; | ||
export const computeFormattedDate = (date) => { | ||
date = new Date(date); | ||
const monthIndex = date.getMonth(); | ||
const dd = date.getDate(); | ||
const yyyy = date.getFullYear(); | ||
const monthNames = [ | ||
'January', 'February', 'March', | ||
'April', 'May', 'June', 'July', | ||
'August', 'September', 'October', | ||
'November', 'December' | ||
]; | ||
const formattedDate = `${monthNames[monthIndex]} ${dd}, ${yyyy}`; | ||
return formattedDate; | ||
}; |
@@ -7,2 +7,3 @@ export * from './apiUtils'; | ||
export * from './dropdownUtils'; | ||
export * from './eventUtils'; | ||
export * from './hydraConfigUtils'; | ||
@@ -16,1 +17,3 @@ export * from './markdownUtils'; | ||
export * from './validatorUtils'; | ||
export * from './customElementUtils'; | ||
export * from './userUtils'; |
@@ -7,2 +7,3 @@ export * from './apiUtils'; | ||
export * from './dropdownUtils'; | ||
export * from './eventUtils'; | ||
export * from './hydraConfigUtils'; | ||
@@ -16,1 +17,3 @@ export * from './markdownUtils'; | ||
export * from './validatorUtils'; | ||
export * from './customElementUtils'; | ||
export * from './userUtils'; |
@@ -0,4 +1,7 @@ | ||
declare const emojiPattern: RegExp; | ||
declare const mailformat: RegExp; | ||
declare function isEmailValid(object: any): boolean; | ||
declare function isValidRHEmail(object: any): boolean; | ||
declare function isEmojiPattern(object: any): boolean; | ||
declare function isValidGuid(object: any): boolean; | ||
export { isEmailValid, isValidRHEmail, isValidGuid }; | ||
export { isEmailValid, isValidRHEmail, isEmojiPattern, emojiPattern, mailformat, isValidGuid }; |
@@ -0,3 +1,4 @@ | ||
const emojiPattern = /[\u{1f300}-\u{1f5ff}\u{1f900}-\u{1f9ff}\u{1f600}-\u{1f64f}\u{1f680}-\u{1f6ff}\u{2600}-\u{26ff}\u{2700}-\u{27bf}\u{1f1e6}-\u{1f1ff}\u{1f191}-\u{1f251}\u{1f004}\u{1f0cf}\u{1f170}-\u{1f171}\u{1f17e}-\u{1f17f}\u{1f18e}\u{3030}\u{2b50}\u{2b55}\u{2934}-\u{2935}\u{2b05}-\u{2b07}\u{2b1b}-\u{2b1c}\u{3297}\u{3299}\u{303d}\u{00a9}\u{00ae}\u{2122}\u{23f3}\u{24c2}\u{23e9}-\u{23ef}\u{25b6}\u{23f8}-\u{23fa}]/ug; | ||
const mailformat = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/; | ||
function isEmailValid(object) { | ||
const mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||
if (object.match(mailformat)) { | ||
@@ -12,3 +13,2 @@ return true; | ||
function isValidRHEmail(object) { | ||
const mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; | ||
if (object.match(mailformat) && object.search('redhat.com') > 0) { | ||
@@ -21,2 +21,10 @@ return true; | ||
} | ||
function isEmojiPattern(object) { | ||
if (object && object.match(emojiPattern)) { | ||
return true; | ||
} | ||
else { | ||
return false; | ||
} | ||
} | ||
function isValidGuid(object) { | ||
@@ -31,2 +39,2 @@ const guidFormat = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i; | ||
} | ||
export { isEmailValid, isValidRHEmail, isValidGuid }; | ||
export { isEmailValid, isValidRHEmail, isEmojiPattern, emojiPattern, mailformat, isValidGuid }; |
{ | ||
"name": "@rh-support/utils", | ||
"version": "0.0.59", | ||
"version": "0.0.60", | ||
"description": "> TODO: description", | ||
@@ -48,2 +48,3 @@ "author": "Vikas Rathee <vrathee@redhat.com>", | ||
"@rh-support/types": "^0.0.45", | ||
"hydrajs": "git+https://gitlab.cee.redhat.com/redhataccess/hydrajs.git#2.0.18", | ||
"js-markdown-extra": "^1.2.4", | ||
@@ -57,4 +58,5 @@ "localforage": "^1.7.3", | ||
"dependencies": { | ||
"@rh-support/api": "^0.0.59", | ||
"@rh-support/types": "^0.0.59", | ||
"@rh-support/api": "^0.0.60", | ||
"@rh-support/types": "^0.0.60", | ||
"hydrajs": "git+https://gitlab.cee.redhat.com/redhataccess/hydrajs.git#2.0.18", | ||
"js-markdown-extra": "^1.2.4", | ||
@@ -73,3 +75,3 @@ "localforage": "^1.7.3", | ||
}, | ||
"gitHead": "f6ec38ab111b59b8dce80d06158ccb19c377f073" | ||
"gitHead": "3f05e8e34039173a773935bf02229201349afd8f" | ||
} |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
81940
39
1763
18
1
+ Addedhydrajs@git+https://gitlab.cee.redhat.com/redhataccess/hydrajs.git#2.0.18
+ Added@rh-support/api@0.0.60(transitive)
+ Added@rh-support/types@0.0.60(transitive)
- Removed@rh-support/api@0.0.59(transitive)
- Removed@rh-support/types@0.0.59(transitive)
Updated@rh-support/api@^0.0.60
Updated@rh-support/types@^0.0.60