@debtcollective/dc-header-component
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [3.3.3](https://github.com/debtcollective/packages/compare/@debtcollective/dc-header-component@3.3.2...@debtcollective/dc-header-component@3.3.3) (2021-06-15) | ||
### Bug Fixes | ||
* **header:** isolate sanitise url to be used on different context ([3705f69](https://github.com/debtcollective/packages/commit/3705f69)) | ||
## [3.3.2](https://github.com/debtcollective/packages/compare/@debtcollective/dc-header-component@3.3.1...@debtcollective/dc-header-component@3.3.2) (2021-06-15) | ||
@@ -8,0 +19,0 @@ |
@@ -356,2 +356,12 @@ 'use strict'; | ||
const sanitiseSSOUrl = (ssoUrl) => { | ||
if (ssoUrl === "/") { | ||
return window.location.origin; | ||
} | ||
if (ssoUrl.charAt(ssoUrl.length - 1) === "/") { | ||
return ssoUrl.slice(0, -1); | ||
} | ||
return ssoUrl; | ||
}; | ||
/** | ||
@@ -362,3 +372,3 @@ * preffix a given string with the base community URL. | ||
*/ | ||
const preffixCommunityURL = (community, str) => `${community}/${str}`; | ||
const preffixCommunityURL = (community, str) => `${sanitiseSSOUrl(community)}/${str}`; | ||
/** | ||
@@ -372,3 +382,5 @@ * Takes an object with avatar_template (typically user) and return a full | ||
const getAvatarURL = ({ avatar_template }, community, size = 64) => { | ||
return preffixCommunityURL(community, avatar_template.replace(`{size}`, size)); | ||
return preffixCommunityURL(community, avatar_template | ||
.replace(`{size}`, size) | ||
.replace("/user_avatar", "user_avatar")); | ||
}; | ||
@@ -408,11 +420,2 @@ | ||
}; | ||
const sanitiseSSOUrl = (ssoUrl) => { | ||
if (ssoUrl === "/") { | ||
return window.location.origin; | ||
} | ||
if (ssoUrl.charAt(ssoUrl.length - 1) === "/") { | ||
return ssoUrl.slice(0, -1); | ||
} | ||
return ssoUrl; | ||
}; | ||
const syncCurrentUser = async (community) => { | ||
@@ -419,0 +422,0 @@ let currentUser; |
@@ -0,1 +1,2 @@ | ||
import { sanitiseSSOUrl } from "../utils/sanitise"; | ||
// https://stackoverflow.com/a/33829607/1422380 | ||
@@ -33,11 +34,2 @@ const getCSRFToken = async (discourseEndpoint) => { | ||
}; | ||
const sanitiseSSOUrl = (ssoUrl) => { | ||
if (ssoUrl === "/") { | ||
return window.location.origin; | ||
} | ||
if (ssoUrl.charAt(ssoUrl.length - 1) === "/") { | ||
return ssoUrl.slice(0, -1); | ||
} | ||
return ssoUrl; | ||
}; | ||
export const syncCurrentUser = async (community) => { | ||
@@ -44,0 +36,0 @@ let currentUser; |
@@ -0,1 +1,2 @@ | ||
import { sanitiseSSOUrl } from "./sanitise"; | ||
/** | ||
@@ -6,3 +7,3 @@ * preffix a given string with the base community URL. | ||
*/ | ||
export const preffixCommunityURL = (community, str) => `${community}/${str}`; | ||
export const preffixCommunityURL = (community, str) => `${sanitiseSSOUrl(community)}/${str}`; | ||
/** | ||
@@ -16,3 +17,5 @@ * Takes an object with avatar_template (typically user) and return a full | ||
export const getAvatarURL = ({ avatar_template }, community, size = 64) => { | ||
return preffixCommunityURL(community, avatar_template.replace(`{size}`, size)); | ||
return preffixCommunityURL(community, avatar_template | ||
.replace(`{size}`, size) | ||
.replace("/user_avatar", "user_avatar")); | ||
}; |
@@ -352,2 +352,12 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getAssetPath } from './index-8956c047.js'; | ||
const sanitiseSSOUrl = (ssoUrl) => { | ||
if (ssoUrl === "/") { | ||
return window.location.origin; | ||
} | ||
if (ssoUrl.charAt(ssoUrl.length - 1) === "/") { | ||
return ssoUrl.slice(0, -1); | ||
} | ||
return ssoUrl; | ||
}; | ||
/** | ||
@@ -358,3 +368,3 @@ * preffix a given string with the base community URL. | ||
*/ | ||
const preffixCommunityURL = (community, str) => `${community}/${str}`; | ||
const preffixCommunityURL = (community, str) => `${sanitiseSSOUrl(community)}/${str}`; | ||
/** | ||
@@ -368,3 +378,5 @@ * Takes an object with avatar_template (typically user) and return a full | ||
const getAvatarURL = ({ avatar_template }, community, size = 64) => { | ||
return preffixCommunityURL(community, avatar_template.replace(`{size}`, size)); | ||
return preffixCommunityURL(community, avatar_template | ||
.replace(`{size}`, size) | ||
.replace("/user_avatar", "user_avatar")); | ||
}; | ||
@@ -404,11 +416,2 @@ | ||
}; | ||
const sanitiseSSOUrl = (ssoUrl) => { | ||
if (ssoUrl === "/") { | ||
return window.location.origin; | ||
} | ||
if (ssoUrl.charAt(ssoUrl.length - 1) === "/") { | ||
return ssoUrl.slice(0, -1); | ||
} | ||
return ssoUrl; | ||
}; | ||
const syncCurrentUser = async (community) => { | ||
@@ -415,0 +418,0 @@ let currentUser; |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as l}from"./p-1822b0d8.js";(()=>{const l=import.meta.url,n={};return""!==l&&(n.resourcesUrl=new URL(".",l).href),e(n)})().then((e=>l([["p-ac36bfe0",[[1,"dc-header",{homepage:[1],community:[1],returnurl:[1],user:[32],isShrink:[32],scrollTop:[32],isMenuOpen:[32],isProfileMenuOpen:[32]},[[9,"scroll","handleScroll"],[0,"toggleMenu","toggleMenuHandler"],[0,"toggleProfileMenu","toggleProfileMenuHandler"],[0,"closeAll","closeAll"]]],[1,"dc-menu",{open:[4],community:[1],homepage:[1],host:[1],user:[16]},[[4,"keydown","handleEscapeKey"]]],[1,"dc-profile",{shrank:[4],expanded:[4],community:[1],homepage:[1],host:[1],user:[16]},[[4,"keydown","handleEscapeKey"]]],[4,"dc-link",{to:[1],target:[1],namespace:[1]},[[2,"click","handleClick"]]]]]],e))); | ||
import{p as e,b as l}from"./p-1822b0d8.js";(()=>{const l=import.meta.url,n={};return""!==l&&(n.resourcesUrl=new URL(".",l).href),e(n)})().then((e=>l([["p-8ca655d8",[[1,"dc-header",{homepage:[1],community:[1],returnurl:[1],user:[32],isShrink:[32],scrollTop:[32],isMenuOpen:[32],isProfileMenuOpen:[32]},[[9,"scroll","handleScroll"],[0,"toggleMenu","toggleMenuHandler"],[0,"toggleProfileMenu","toggleProfileMenuHandler"],[0,"closeAll","closeAll"]]],[1,"dc-menu",{open:[4],community:[1],homepage:[1],host:[1],user:[16]},[[4,"keydown","handleEscapeKey"]]],[1,"dc-profile",{shrank:[4],expanded:[4],community:[1],homepage:[1],host:[1],user:[16]},[[4,"keydown","handleEscapeKey"]]],[4,"dc-link",{to:[1],target:[1],namespace:[1]},[[2,"click","handleClick"]]]]]],e))); |
{ | ||
"name": "@debtcollective/dc-header-component", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Stencil header component for debtcollective web apps", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.cjs.js", | ||
"license": "BSD-3-Clause", | ||
"gitHead": "edc6f0417b279514c12734181449bf264c7b04ca" | ||
"gitHead": "9e768d695d99879e1f717be56762936e4a79f3fd" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
600984
61
9812