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

@debtcollective/dc-header-component

Package Overview
Dependencies
Maintainers
4
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@debtcollective/dc-header-component - npm Package Compare versions

Comparing version 3.6.3 to 4.0.0

dist/header/p-d87bd6e3.entry.js

21

CHANGELOG.md

@@ -6,2 +6,23 @@ # Change Log

# [4.0.0](https://github.com/debtcollective/packages/compare/@debtcollective/dc-header-component@3.6.3...@debtcollective/dc-header-component@4.0.0) (2021-11-11)
### Bug Fixes
* remove top-level await for cjs module ([0a19fcd](https://github.com/debtcollective/packages/commit/0a19fcd))
### Features
* pull sitemenu from wordpress ([2b90541](https://github.com/debtcollective/packages/commit/2b90541))
### BREAKING CHANGES
* Pulls sitemenu from wordpress and removes old sitemenu in config.json
## [3.6.3](https://github.com/debtcollective/packages/compare/@debtcollective/dc-header-component@3.6.2...@debtcollective/dc-header-component@3.6.3) (2021-07-26)

@@ -8,0 +29,0 @@

345

dist/cjs/dc-header_4.cjs.entry.js

@@ -26,138 +26,2 @@ 'use strict';

const siteMenu = [
{
type: "MENU_ITEM_LINK",
text: "Join the union",
url: "{homepage}/debt-union",
authenticated: false
},
{
type: "MENU_ITEM_LINK",
text: "Members Hub",
url: "https://membership.debtcollective.org/",
authenticated: true
},
{
type: "MENU_ITEM_LINK",
text: "Browse events",
url: "{community}/upcoming-events"
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "For members",
items: [
{
type: "LINK",
text: "Connect with other debtors",
url: "{community}/"
},
{
type: "LINK",
text: "Join a working group",
url: "{community}/t/join-a-working-group/4957/2"
},
{
type: "LINK",
text: "Join a local branch",
url: "{community}/c/working-groups/local-organizing/20"
},
{
type: "LINK",
text: "Join a commitee",
url: "{community}/t/debt-collective-higher-education-committee/4958"
},
{
type: "LINK",
text: "View past trainings",
url: "{community}/t/training-educational-videos/4959"
}
]
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "Cancel student debt",
items: [
{
type: "LINK",
text: "Sign the petition",
url: "https://actionnetwork.org/petitions/bidenjubilee100",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Email your reps",
url: "https://actionnetwork.org/letters/cancel-all-student-debt-today",
attrs: {
target: "_blank"
}
}
]
},
{
type: "MENU_ITEM_LINK",
text: "Dispute your debt",
url: "https://tools.debtcollective.org/"
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "About",
items: [
{
type: "LINK",
text: "Our union",
url: "{homepage}/about-us/"
},
{
type: "LINK",
text: "Learn about debt",
url: "https://www.youtube.com/playlist?list=PLnQCwElJCNf9NHOqHicDrb03RX04nNl-h",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Our team",
url: "{homepage}/our-team/"
},
{
type: "LINK",
text: "Our book",
url: "https://www.haymarketbooks.org/books/1520-can-t-pay-won-t-pay",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Contact",
url: "{homepage}/contact-us/"
}
]
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "Support us",
items: [
{
type: "LINK",
text: "Volunteer",
url: "https://volunteer.debtcollective.org/"
},
{
type: "LINK",
text: "Shop",
url: "https://debt-collective.creator-spring.com/",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Donate",
url: "{homepage}/donate/"
}
]
}
];

@@ -247,2 +111,95 @@ const userMenu = [

const trimSlash = (url) => {
if (url === "/") {
return window.location.origin;
}
if (url.charAt(url.length - 1) === "/") {
return url.slice(0, -1);
}
return url;
};
const addSlash = (url) => {
if (url.charAt(url.length - 1) !== "/") {
return `${url}/`;
}
return url;
};
// https://stackoverflow.com/a/33829607/1422380
const getCSRFToken = async (discourseEndpoint) => {
const url = `${discourseEndpoint}/session/csrf.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying CSRF token";
}
const json = await response.json();
return json.csrf;
};
const getCurrentUser = async (discourseEndpoint, { csrfToken }) => {
const url = `${discourseEndpoint}/session/current.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
// Could be the case for no active session
if (!response.ok) {
return;
}
const json = await response.json();
const { current_user: currentUser } = json;
return currentUser;
};
const getWordpressNav = async (wordpress) => {
const url = `${wordpress}`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying Wordpress JSON Nav";
}
const json = await response.json();
return json;
};
const syncCurrentUser = async (community) => {
let currentUser;
let discourseEndpoint = trimSlash(community);
try {
const csrfToken = await getCSRFToken(discourseEndpoint);
currentUser = await getCurrentUser(discourseEndpoint, { csrfToken });
}
catch (error) {
console.warn("Unable to get user session", error);
}
return currentUser;
};
const logout = async (community, username) => {
let discourseEndpoint = trimSlash(community);
const url = `${discourseEndpoint}/session/${username}`;
const csrfToken = await getCSRFToken(discourseEndpoint);
try {
await fetch(url, {
method: "DELETE",
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
}
catch (error) {
console.error("Unable to logout successfully", error);
}
};
var __rest = (undefined && undefined.__rest) || function (s, e) {

@@ -259,2 +216,3 @@ var t = {};

};
// pull siteMenu from wordpress site
const interpolateURL = (url, { user = { username: "" }, community, homepage, returnUrl = "" }) => {

@@ -277,2 +235,30 @@ return (url

};
const interpolateWordpressNav = async (wordpress) => {
const wordpressNav = await getWordpressNav(wordpress);
var wordpressNavConfig = [];
wordpressNav.items.forEach(item => {
let row = {};
if (item.child_items) {
row["type"] = "MENU_ITEM_EXPANDABLE";
row["text"] = item.title;
row["items"] = [];
item.child_items.forEach(child => {
var childItem = {
"type": "LINK",
"text": child.title,
"url": child.url
};
row["items"].push(childItem);
});
wordpressNavConfig.push(row);
}
else {
row["type"] = "MENU_ITEM_LINK";
row["text"] = item.title;
row["url"] = item.url;
wordpressNavConfig.push(row);
}
});
config["siteMenu"] = wordpressNavConfig;
};
/**

@@ -361,2 +347,3 @@ * Method to digest the config.json and avoid a mapping within

componentWillRender() {
interpolateWordpressNav(this.wordpress);
this.socialLinks = getSocialLinks();

@@ -385,18 +372,2 @@ this.config = getSiteMenuConfig({

const trimSlash = (url) => {
if (url === "/") {
return window.location.origin;
}
if (url.charAt(url.length - 1) === "/") {
return url.slice(0, -1);
}
return url;
};
const addSlash = (url) => {
if (url.charAt(url.length - 1) !== "/") {
return `${url}/`;
}
return url;
};
/**

@@ -421,65 +392,2 @@ * preffix a given string with the base community URL.

// https://stackoverflow.com/a/33829607/1422380
const getCSRFToken = async (discourseEndpoint) => {
const url = `${discourseEndpoint}/session/csrf.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying CSRF token";
}
const json = await response.json();
return json.csrf;
};
const getCurrentUser = async (discourseEndpoint, { csrfToken }) => {
const url = `${discourseEndpoint}/session/current.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
// Could be the case for no active session
if (!response.ok) {
return;
}
const json = await response.json();
const { current_user: currentUser } = json;
return currentUser;
};
const syncCurrentUser = async (community) => {
let currentUser;
let discourseEndpoint = trimSlash(community);
try {
const csrfToken = await getCSRFToken(discourseEndpoint);
currentUser = await getCurrentUser(discourseEndpoint, { csrfToken });
}
catch (error) {
console.warn("Unable to get user session", error);
}
return currentUser;
};
const logout = async (community, username) => {
let discourseEndpoint = trimSlash(community);
const url = `${discourseEndpoint}/session/${username}`;
const csrfToken = await getCSRFToken(discourseEndpoint);
try {
await fetch(url, {
method: "DELETE",
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
}
catch (error) {
console.error("Unable to logout successfully", error);
}
};
const profileCss = ":host{--brand-color:#ff4630;--button-color:#ff4630;--button-hover-color:#ee2812;--outline-button-hover-color:#fffbea;--text-color:#434343;--text-color-light:#74736f;--disabled-text-color:#52575c;--font-size:1rem;--column-gap:15px;--main-bg-color:#fbfbfb;--main-font:\"Libre Franklin\", sans-serif}.btn-primary,.btn-outline,.btn-transparent{align-items:center;border-radius:0.5rem;cursor:pointer;display:flex;font-size:1rem;font-family:var(--main-font);justify-content:center;padding:0.5rem;transition:background 0.216s ease, color 0.216s ease;font-weight:bold}@media (min-width: 768px){.btn-primary,.btn-outline,.btn-transparent{padding-left:1rem;padding-right:1rem}}.btn-transparent{background:none;border:none;display:flex;font-size:var(--font-size);padding:0}.btn-outline{background:transparent;border:0.0625rem solid var(--text-color);color:var(--text-color)}.btn-outline:hover{background:var(--outline-button-hover-color)}.btn-primary{background:var(--button-color);border:0.0625rem solid var(--button-color);color:#ffffff}.btn-primary:hover{border:0.0625rem solid var(--button-hover-color);background:var(--button-hover-color)}.material-icons{color:var(--text-color);font-family:\"Material Icons\";font-weight:normal;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}:host .hover-green:hover{color:#1e9981}:host .hover-yellow:hover{color:#ffed9c}:host .hover-red:hover{color:#ff4630}:host .m-0{margin:0rem}:host .m-1{margin:0.5rem}:host .m-2{margin:1rem}:host .m-3{margin:1.5rem}:host .m-4{margin:2rem}:host .m-5{margin:2.5rem}:host .m-6{margin:3rem}:host .m-auto{margin:auto}:host .mt-0{margin-top:0rem}:host .mt-1{margin-top:0.5rem}:host .mt-2{margin-top:1rem}:host .mt-3{margin-top:1.5rem}:host .mt-4{margin-top:2rem}:host .mt-5{margin-top:2.5rem}:host .mt-6{margin-top:3rem}:host .mt-auto{margin-top:auto}:host .mb-0{margin-bottom:0rem}:host .mb-1{margin-bottom:0.5rem}:host .mb-2{margin-bottom:1rem}:host .mb-3{margin-bottom:1.5rem}:host .mb-4{margin-bottom:2rem}:host .mb-5{margin-bottom:2.5rem}:host .mb-6{margin-bottom:3rem}:host .mb-auto{margin-bottom:auto}:host .ml-0{margin-left:0rem}:host .ml-1{margin-left:0.5rem}:host .ml-2{margin-left:1rem}:host .ml-3{margin-left:1.5rem}:host .ml-4{margin-left:2rem}:host .ml-5{margin-left:2.5rem}:host .ml-6{margin-left:3rem}:host .ml-auto{margin-left:auto}:host .mr-0{margin-right:0rem}:host .mr-1{margin-right:0.5rem}:host .mr-2{margin-right:1rem}:host .mr-3{margin-right:1.5rem}:host .mr-4{margin-right:2rem}:host .mr-5{margin-right:2.5rem}:host .mr-6{margin-right:3rem}:host .mr-auto{margin-right:auto}@media (min-width: 359px){:host .d-xxs-block.d-xxs-block{display:block !important}}@media (min-width: 576px){:host .d-xs-block.d-xs-block{display:block !important}}@media (min-width: 768px){:host .d-sm-block.d-sm-block{display:block !important}}@media (min-width: 992px){:host .d-md-block.d-md-block{display:block !important}}@media (min-width: 1200px){:host .d-lg-block.d-lg-block{display:block !important}}:host .d-block{display:block !important}@media (min-width: 359px){:host .d-xxs-flex.d-xxs-flex{display:flex !important}}@media (min-width: 576px){:host .d-xs-flex.d-xs-flex{display:flex !important}}@media (min-width: 768px){:host .d-sm-flex.d-sm-flex{display:flex !important}}@media (min-width: 992px){:host .d-md-flex.d-md-flex{display:flex !important}}@media (min-width: 1200px){:host .d-lg-flex.d-lg-flex{display:flex !important}}:host .d-flex{display:flex !important}@media (min-width: 359px){:host .d-xxs-none.d-xxs-none{display:none !important}}@media (min-width: 576px){:host .d-xs-none.d-xs-none{display:none !important}}@media (min-width: 768px){:host .d-sm-none.d-sm-none{display:none !important}}@media (min-width: 992px){:host .d-md-none.d-md-none{display:none !important}}@media (min-width: 1200px){:host .d-lg-none.d-lg-none{display:none !important}}:host .d-none{display:none !important}:host .hidden{display:none !important}:host{font-family:var(--main-font)}a,a:visited{text-decoration:none}.text,.text-underlined,.text-sm,.text-lg{color:var(--text-color);text-decoration:none}.text,.text-underlined{font-size:1rem;font-weight:200;line-height:2.5}.text-sm{font-size:0.75rem;font-weight:200;line-height:1.25}.text-lg{font-size:1.25rem;font-weight:800;line-height:2.5}.text-underlined{font-weight:bold;text-decoration:underline}.text-color-light{color:var(--text-color-light)}:host .avatar{border-radius:50%;box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2);box-sizing:content-box;height:3rem;position:absolute;color:transparent;text-indent:-9999px;width:3rem;top:50%;left:0;transform:translate3d(0, -50%, 0)}:host .avatar.avatar-open{border:0.25rem solid #ffed9c;left:-0.25rem}@media (max-width: 768px){:host .profile-toggle.is-shrink,:host .profile-toggle.is-shrink .avatar{height:2rem}:host .profile-toggle.is-shrink{width:3.5rem}:host .profile-toggle.is-shrink .avatar{width:2rem}}:host .profile-toggle{border-radius:50%;outline:none;position:relative;height:3rem;width:4.5rem;padding-right:1.5rem}:host .profile-toggle .icon{font-size:0.75rem;position:absolute;right:0.325rem}:host .section-links{display:flex;justify-content:space-between}:host .profile-dropdown-container{position:relative}:host .profile-dropdown-container .material-icons{text-decoration:none;cursor:pointer}:host .profile-dropdown-container .connector{border-bottom:0.625rem solid #fbfbfb;border-left:0.625rem solid transparent;border-right:0.625rem solid transparent;display:none;height:0;margin-left:1.125rem;position:absolute;width:0;bottom:-1px;z-index:1020}:host .profile-dropdown{background-color:#fbfbfb;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.4);bottom:0;display:none;position:absolute;width:320px;right:-15px;border-radius:0.25rem;overflow:hidden;padding:15px 0 0;transform:translate3d(0, 100%, 0);z-index:1020}@media (min-width: 359px){:host .profile-dropdown{right:0}}:host .profile-dropdown.profile-expanded,:host .profile-dropdown.profile-expanded+.connector{display:block}:host .profile-dropdown-section{padding:0 15px}:host .profile-dropdown-footer{background:#fff;border-top:0.0625rem solid #e8e8e8;padding:1.5rem 0;display:flex;justify-content:space-around}:host .notification-badge{background-color:#24ba9d;border-radius:100%;bottom:0.25rem;height:0.5rem;left:0.125rem;position:absolute;width:0.5rem;color:transparent;z-index:1}:host .notification-color{color:#24ba9d}";

@@ -554,2 +462,7 @@

this.community = "https://community.debtcollective.org/";
/**
* URL to the wordpress menu
* with the latest "/"
*/
this.wordpress = "https://wordpress-test.debtcollective.org/wp-json/menus/v1/menus/2";
}

@@ -603,3 +516,3 @@ componentWillRender() {

render() {
return (index.h(index.Host, null, index.h("header", { class: `navbar-top navbar l-header ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, index.h("div", { class: "l-header-item btn-container navbar-item" }, index.h("button", { class: "btn-transparent", onClick: this.toggleMenuHandler.bind(this) }, index.h("span", { class: "material-icons" }, "menu"))), index.h("div", { class: "l-header-item logo-container navbar-item" }, index.h("a", { class: `logo ${this.isShrink ? "logo-shrink" : ""}`, href: this.homepage }, index.h("img", { class: "d-sm-none", src: this._logoSmall, alt: "The Debtcollective" }), index.h("img", { class: "d-none d-sm-block ml-2 fixed-size", src: this._logo, alt: "The Debtcollective" }))), index.h("div", { class: "l-header-item session-container navbar-item" }, this.user ? (index.h("dc-profile", { shrank: this.isShrink, user: this.user, homepage: this.homepage, community: this.community, expanded: this.isProfileMenuOpen })) : (index.h("span", { class: "d-none d-sm-flex ml-auto" }, index.h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), index.h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))))), this.user ? null : (index.h("div", { class: `navbar-bottom navbar d-sm-none ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, index.h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), index.h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))), index.h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community }), index.h("div", { class: `document-cloak ${this.isMenuOpen || this.isProfileMenuOpen ? "d-block" : "hidden"}`, onClick: this.closeAll.bind(this), hidden: !this.isMenuOpen })));
return (index.h(index.Host, null, index.h("header", { class: `navbar-top navbar l-header ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, index.h("div", { class: "l-header-item btn-container navbar-item" }, index.h("button", { class: "btn-transparent", onClick: this.toggleMenuHandler.bind(this) }, index.h("span", { class: "material-icons" }, "menu"))), index.h("div", { class: "l-header-item logo-container navbar-item" }, index.h("a", { class: `logo ${this.isShrink ? "logo-shrink" : ""}`, href: this.homepage }, index.h("img", { class: "d-sm-none", src: this._logoSmall, alt: "The Debtcollective" }), index.h("img", { class: "d-none d-sm-block ml-2 fixed-size", src: this._logo, alt: "The Debtcollective" }))), index.h("div", { class: "l-header-item session-container navbar-item" }, this.user ? (index.h("dc-profile", { shrank: this.isShrink, user: this.user, homepage: this.homepage, community: this.community, expanded: this.isProfileMenuOpen })) : (index.h("span", { class: "d-none d-sm-flex ml-auto" }, index.h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), index.h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))))), this.user ? null : (index.h("div", { class: `navbar-bottom navbar d-sm-none ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, index.h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), index.h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))), index.h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community, wordpress: this.wordpress }), index.h("div", { class: `document-cloak ${this.isMenuOpen || this.isProfileMenuOpen ? "d-block" : "hidden"}`, onClick: this.closeAll.bind(this), hidden: !this.isMenuOpen })));
}

@@ -606,0 +519,0 @@ static get assetsDirs() { return ["assets"]; }

@@ -18,3 +18,3 @@ 'use strict';

patchBrowser().then(options => {
return index.bootstrapLazy([["dc-header_4.cjs",[[1,"dc-header",{"homepage":[1],"community":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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"]]]]]], options);
return index.bootstrapLazy([["dc-header_4.cjs",[[1,"dc-header",{"homepage":[1],"community":[1],"wordpress":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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],"wordpress":[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"]]]]]], options);
});

@@ -17,3 +17,3 @@ 'use strict';

return patchEsm().then(() => {
return index.bootstrapLazy([["dc-header_4.cjs",[[1,"dc-header",{"homepage":[1],"community":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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"]]]]]], options);
return index.bootstrapLazy([["dc-header_4.cjs",[[1,"dc-header",{"homepage":[1],"community":[1],"wordpress":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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],"wordpress":[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"]]]]]], options);
});

@@ -20,0 +20,0 @@ };

@@ -22,2 +22,7 @@ import "./menu";

this.community = "https://community.debtcollective.org/";
/**
* URL to the wordpress menu
* with the latest "/"
*/
this.wordpress = "https://wordpress-test.debtcollective.org/wp-json/menus/v1/menus/2";
}

@@ -86,3 +91,3 @@ componentWillRender() {

h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))),
h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community }),
h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community, wordpress: this.wordpress }),
h("div", { class: `document-cloak ${this.isMenuOpen || this.isProfileMenuOpen ? "d-block" : "hidden"}`, onClick: this.closeAll.bind(this), hidden: !this.isMenuOpen })));

@@ -136,2 +141,20 @@ }

},
"wordpress": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": "URL to the wordpress menu\nwith the latest \"/\""
},
"attribute": "wordpress",
"reflect": false,
"defaultValue": "\"https://wordpress-test.debtcollective.org/wp-json/menus/v1/menus/2\""
},
"returnurl": {

@@ -138,0 +161,0 @@ "type": "string",

import "./link";
import { Component, h, Event, Prop, Listen } from "@stencil/core";
import { getSiteMenuConfig, getSocialLinks } from "../../utils/config";
import { getSiteMenuConfig, getSocialLinks, interpolateWordpressNav } from "../../utils/config";
export class Menu {
componentWillRender() {
interpolateWordpressNav(this.wordpress);
this.socialLinks = getSocialLinks();

@@ -112,2 +113,19 @@ this.config = getSiteMenuConfig({

},
"wordpress": {
"type": "string",
"mutable": false,
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"required": false,
"optional": false,
"docs": {
"tags": [],
"text": ""
},
"attribute": "wordpress",
"reflect": false
},
"host": {

@@ -114,0 +132,0 @@ "type": "string",

@@ -34,2 +34,16 @@ import { trimSlash } from "../utils/normalise";

};
export const getWordpressNav = async (wordpress) => {
const url = `${wordpress}`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying Wordpress JSON Nav";
}
const json = await response.json();
return json;
};
export const syncCurrentUser = async (community) => {

@@ -36,0 +50,0 @@ let currentUser;

@@ -13,2 +13,4 @@ var __rest = (this && this.__rest) || function (s, e) {

import config from "../config.json";
import { getWordpressNav } from "../services/session";
// pull siteMenu from wordpress site
const interpolateURL = (url, { user = { username: "" }, community, homepage, returnUrl = "" }) => {

@@ -31,2 +33,30 @@ return (url

};
export const interpolateWordpressNav = async (wordpress) => {
const wordpressNav = await getWordpressNav(wordpress);
var wordpressNavConfig = [];
wordpressNav.items.forEach(item => {
let row = {};
if (item.child_items) {
row["type"] = "MENU_ITEM_EXPANDABLE";
row["text"] = item.title;
row["items"] = [];
item.child_items.forEach(child => {
var childItem = {
"type": "LINK",
"text": child.title,
"url": child.url
};
row["items"].push(childItem);
});
wordpressNavConfig.push(row);
}
else {
row["type"] = "MENU_ITEM_LINK";
row["text"] = item.title;
row["url"] = item.url;
wordpressNavConfig.push(row);
}
});
config["siteMenu"] = wordpressNavConfig;
};
/**

@@ -33,0 +63,0 @@ * Method to digest the config.json and avoid a mapping within

@@ -22,138 +22,2 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getAssetPath } from './index-8956c047.js';

const siteMenu = [
{
type: "MENU_ITEM_LINK",
text: "Join the union",
url: "{homepage}/debt-union",
authenticated: false
},
{
type: "MENU_ITEM_LINK",
text: "Members Hub",
url: "https://membership.debtcollective.org/",
authenticated: true
},
{
type: "MENU_ITEM_LINK",
text: "Browse events",
url: "{community}/upcoming-events"
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "For members",
items: [
{
type: "LINK",
text: "Connect with other debtors",
url: "{community}/"
},
{
type: "LINK",
text: "Join a working group",
url: "{community}/t/join-a-working-group/4957/2"
},
{
type: "LINK",
text: "Join a local branch",
url: "{community}/c/working-groups/local-organizing/20"
},
{
type: "LINK",
text: "Join a commitee",
url: "{community}/t/debt-collective-higher-education-committee/4958"
},
{
type: "LINK",
text: "View past trainings",
url: "{community}/t/training-educational-videos/4959"
}
]
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "Cancel student debt",
items: [
{
type: "LINK",
text: "Sign the petition",
url: "https://actionnetwork.org/petitions/bidenjubilee100",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Email your reps",
url: "https://actionnetwork.org/letters/cancel-all-student-debt-today",
attrs: {
target: "_blank"
}
}
]
},
{
type: "MENU_ITEM_LINK",
text: "Dispute your debt",
url: "https://tools.debtcollective.org/"
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "About",
items: [
{
type: "LINK",
text: "Our union",
url: "{homepage}/about-us/"
},
{
type: "LINK",
text: "Learn about debt",
url: "https://www.youtube.com/playlist?list=PLnQCwElJCNf9NHOqHicDrb03RX04nNl-h",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Our team",
url: "{homepage}/our-team/"
},
{
type: "LINK",
text: "Our book",
url: "https://www.haymarketbooks.org/books/1520-can-t-pay-won-t-pay",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Contact",
url: "{homepage}/contact-us/"
}
]
},
{
type: "MENU_ITEM_EXPANDABLE",
text: "Support us",
items: [
{
type: "LINK",
text: "Volunteer",
url: "https://volunteer.debtcollective.org/"
},
{
type: "LINK",
text: "Shop",
url: "https://debt-collective.creator-spring.com/",
attrs: {
target: "_blank"
}
},
{
type: "LINK",
text: "Donate",
url: "{homepage}/donate/"
}
]
}
];

@@ -243,2 +107,95 @@ const userMenu = [

const trimSlash = (url) => {
if (url === "/") {
return window.location.origin;
}
if (url.charAt(url.length - 1) === "/") {
return url.slice(0, -1);
}
return url;
};
const addSlash = (url) => {
if (url.charAt(url.length - 1) !== "/") {
return `${url}/`;
}
return url;
};
// https://stackoverflow.com/a/33829607/1422380
const getCSRFToken = async (discourseEndpoint) => {
const url = `${discourseEndpoint}/session/csrf.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying CSRF token";
}
const json = await response.json();
return json.csrf;
};
const getCurrentUser = async (discourseEndpoint, { csrfToken }) => {
const url = `${discourseEndpoint}/session/current.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
// Could be the case for no active session
if (!response.ok) {
return;
}
const json = await response.json();
const { current_user: currentUser } = json;
return currentUser;
};
const getWordpressNav = async (wordpress) => {
const url = `${wordpress}`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying Wordpress JSON Nav";
}
const json = await response.json();
return json;
};
const syncCurrentUser = async (community) => {
let currentUser;
let discourseEndpoint = trimSlash(community);
try {
const csrfToken = await getCSRFToken(discourseEndpoint);
currentUser = await getCurrentUser(discourseEndpoint, { csrfToken });
}
catch (error) {
console.warn("Unable to get user session", error);
}
return currentUser;
};
const logout = async (community, username) => {
let discourseEndpoint = trimSlash(community);
const url = `${discourseEndpoint}/session/${username}`;
const csrfToken = await getCSRFToken(discourseEndpoint);
try {
await fetch(url, {
method: "DELETE",
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
}
catch (error) {
console.error("Unable to logout successfully", error);
}
};
var __rest = (undefined && undefined.__rest) || function (s, e) {

@@ -255,2 +212,3 @@ var t = {};

};
// pull siteMenu from wordpress site
const interpolateURL = (url, { user = { username: "" }, community, homepage, returnUrl = "" }) => {

@@ -273,2 +231,30 @@ return (url

};
const interpolateWordpressNav = async (wordpress) => {
const wordpressNav = await getWordpressNav(wordpress);
var wordpressNavConfig = [];
wordpressNav.items.forEach(item => {
let row = {};
if (item.child_items) {
row["type"] = "MENU_ITEM_EXPANDABLE";
row["text"] = item.title;
row["items"] = [];
item.child_items.forEach(child => {
var childItem = {
"type": "LINK",
"text": child.title,
"url": child.url
};
row["items"].push(childItem);
});
wordpressNavConfig.push(row);
}
else {
row["type"] = "MENU_ITEM_LINK";
row["text"] = item.title;
row["url"] = item.url;
wordpressNavConfig.push(row);
}
});
config["siteMenu"] = wordpressNavConfig;
};
/**

@@ -357,2 +343,3 @@ * Method to digest the config.json and avoid a mapping within

componentWillRender() {
interpolateWordpressNav(this.wordpress);
this.socialLinks = getSocialLinks();

@@ -381,18 +368,2 @@ this.config = getSiteMenuConfig({

const trimSlash = (url) => {
if (url === "/") {
return window.location.origin;
}
if (url.charAt(url.length - 1) === "/") {
return url.slice(0, -1);
}
return url;
};
const addSlash = (url) => {
if (url.charAt(url.length - 1) !== "/") {
return `${url}/`;
}
return url;
};
/**

@@ -417,65 +388,2 @@ * preffix a given string with the base community URL.

// https://stackoverflow.com/a/33829607/1422380
const getCSRFToken = async (discourseEndpoint) => {
const url = `${discourseEndpoint}/session/csrf.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw "Error trying CSRF token";
}
const json = await response.json();
return json.csrf;
};
const getCurrentUser = async (discourseEndpoint, { csrfToken }) => {
const url = `${discourseEndpoint}/session/current.json`;
const response = await fetch(url, {
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
// Could be the case for no active session
if (!response.ok) {
return;
}
const json = await response.json();
const { current_user: currentUser } = json;
return currentUser;
};
const syncCurrentUser = async (community) => {
let currentUser;
let discourseEndpoint = trimSlash(community);
try {
const csrfToken = await getCSRFToken(discourseEndpoint);
currentUser = await getCurrentUser(discourseEndpoint, { csrfToken });
}
catch (error) {
console.warn("Unable to get user session", error);
}
return currentUser;
};
const logout = async (community, username) => {
let discourseEndpoint = trimSlash(community);
const url = `${discourseEndpoint}/session/${username}`;
const csrfToken = await getCSRFToken(discourseEndpoint);
try {
await fetch(url, {
method: "DELETE",
credentials: "include",
headers: {
Accept: "application/json",
"X-CSRF-Token": csrfToken,
},
});
}
catch (error) {
console.error("Unable to logout successfully", error);
}
};
const profileCss = ":host{--brand-color:#ff4630;--button-color:#ff4630;--button-hover-color:#ee2812;--outline-button-hover-color:#fffbea;--text-color:#434343;--text-color-light:#74736f;--disabled-text-color:#52575c;--font-size:1rem;--column-gap:15px;--main-bg-color:#fbfbfb;--main-font:\"Libre Franklin\", sans-serif}.btn-primary,.btn-outline,.btn-transparent{align-items:center;border-radius:0.5rem;cursor:pointer;display:flex;font-size:1rem;font-family:var(--main-font);justify-content:center;padding:0.5rem;transition:background 0.216s ease, color 0.216s ease;font-weight:bold}@media (min-width: 768px){.btn-primary,.btn-outline,.btn-transparent{padding-left:1rem;padding-right:1rem}}.btn-transparent{background:none;border:none;display:flex;font-size:var(--font-size);padding:0}.btn-outline{background:transparent;border:0.0625rem solid var(--text-color);color:var(--text-color)}.btn-outline:hover{background:var(--outline-button-hover-color)}.btn-primary{background:var(--button-color);border:0.0625rem solid var(--button-color);color:#ffffff}.btn-primary:hover{border:0.0625rem solid var(--button-hover-color);background:var(--button-hover-color)}.material-icons{color:var(--text-color);font-family:\"Material Icons\";font-weight:normal;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:\"liga\"}:host .hover-green:hover{color:#1e9981}:host .hover-yellow:hover{color:#ffed9c}:host .hover-red:hover{color:#ff4630}:host .m-0{margin:0rem}:host .m-1{margin:0.5rem}:host .m-2{margin:1rem}:host .m-3{margin:1.5rem}:host .m-4{margin:2rem}:host .m-5{margin:2.5rem}:host .m-6{margin:3rem}:host .m-auto{margin:auto}:host .mt-0{margin-top:0rem}:host .mt-1{margin-top:0.5rem}:host .mt-2{margin-top:1rem}:host .mt-3{margin-top:1.5rem}:host .mt-4{margin-top:2rem}:host .mt-5{margin-top:2.5rem}:host .mt-6{margin-top:3rem}:host .mt-auto{margin-top:auto}:host .mb-0{margin-bottom:0rem}:host .mb-1{margin-bottom:0.5rem}:host .mb-2{margin-bottom:1rem}:host .mb-3{margin-bottom:1.5rem}:host .mb-4{margin-bottom:2rem}:host .mb-5{margin-bottom:2.5rem}:host .mb-6{margin-bottom:3rem}:host .mb-auto{margin-bottom:auto}:host .ml-0{margin-left:0rem}:host .ml-1{margin-left:0.5rem}:host .ml-2{margin-left:1rem}:host .ml-3{margin-left:1.5rem}:host .ml-4{margin-left:2rem}:host .ml-5{margin-left:2.5rem}:host .ml-6{margin-left:3rem}:host .ml-auto{margin-left:auto}:host .mr-0{margin-right:0rem}:host .mr-1{margin-right:0.5rem}:host .mr-2{margin-right:1rem}:host .mr-3{margin-right:1.5rem}:host .mr-4{margin-right:2rem}:host .mr-5{margin-right:2.5rem}:host .mr-6{margin-right:3rem}:host .mr-auto{margin-right:auto}@media (min-width: 359px){:host .d-xxs-block.d-xxs-block{display:block !important}}@media (min-width: 576px){:host .d-xs-block.d-xs-block{display:block !important}}@media (min-width: 768px){:host .d-sm-block.d-sm-block{display:block !important}}@media (min-width: 992px){:host .d-md-block.d-md-block{display:block !important}}@media (min-width: 1200px){:host .d-lg-block.d-lg-block{display:block !important}}:host .d-block{display:block !important}@media (min-width: 359px){:host .d-xxs-flex.d-xxs-flex{display:flex !important}}@media (min-width: 576px){:host .d-xs-flex.d-xs-flex{display:flex !important}}@media (min-width: 768px){:host .d-sm-flex.d-sm-flex{display:flex !important}}@media (min-width: 992px){:host .d-md-flex.d-md-flex{display:flex !important}}@media (min-width: 1200px){:host .d-lg-flex.d-lg-flex{display:flex !important}}:host .d-flex{display:flex !important}@media (min-width: 359px){:host .d-xxs-none.d-xxs-none{display:none !important}}@media (min-width: 576px){:host .d-xs-none.d-xs-none{display:none !important}}@media (min-width: 768px){:host .d-sm-none.d-sm-none{display:none !important}}@media (min-width: 992px){:host .d-md-none.d-md-none{display:none !important}}@media (min-width: 1200px){:host .d-lg-none.d-lg-none{display:none !important}}:host .d-none{display:none !important}:host .hidden{display:none !important}:host{font-family:var(--main-font)}a,a:visited{text-decoration:none}.text,.text-underlined,.text-sm,.text-lg{color:var(--text-color);text-decoration:none}.text,.text-underlined{font-size:1rem;font-weight:200;line-height:2.5}.text-sm{font-size:0.75rem;font-weight:200;line-height:1.25}.text-lg{font-size:1.25rem;font-weight:800;line-height:2.5}.text-underlined{font-weight:bold;text-decoration:underline}.text-color-light{color:var(--text-color-light)}:host .avatar{border-radius:50%;box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2);box-sizing:content-box;height:3rem;position:absolute;color:transparent;text-indent:-9999px;width:3rem;top:50%;left:0;transform:translate3d(0, -50%, 0)}:host .avatar.avatar-open{border:0.25rem solid #ffed9c;left:-0.25rem}@media (max-width: 768px){:host .profile-toggle.is-shrink,:host .profile-toggle.is-shrink .avatar{height:2rem}:host .profile-toggle.is-shrink{width:3.5rem}:host .profile-toggle.is-shrink .avatar{width:2rem}}:host .profile-toggle{border-radius:50%;outline:none;position:relative;height:3rem;width:4.5rem;padding-right:1.5rem}:host .profile-toggle .icon{font-size:0.75rem;position:absolute;right:0.325rem}:host .section-links{display:flex;justify-content:space-between}:host .profile-dropdown-container{position:relative}:host .profile-dropdown-container .material-icons{text-decoration:none;cursor:pointer}:host .profile-dropdown-container .connector{border-bottom:0.625rem solid #fbfbfb;border-left:0.625rem solid transparent;border-right:0.625rem solid transparent;display:none;height:0;margin-left:1.125rem;position:absolute;width:0;bottom:-1px;z-index:1020}:host .profile-dropdown{background-color:#fbfbfb;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.4);bottom:0;display:none;position:absolute;width:320px;right:-15px;border-radius:0.25rem;overflow:hidden;padding:15px 0 0;transform:translate3d(0, 100%, 0);z-index:1020}@media (min-width: 359px){:host .profile-dropdown{right:0}}:host .profile-dropdown.profile-expanded,:host .profile-dropdown.profile-expanded+.connector{display:block}:host .profile-dropdown-section{padding:0 15px}:host .profile-dropdown-footer{background:#fff;border-top:0.0625rem solid #e8e8e8;padding:1.5rem 0;display:flex;justify-content:space-around}:host .notification-badge{background-color:#24ba9d;border-radius:100%;bottom:0.25rem;height:0.5rem;left:0.125rem;position:absolute;width:0.5rem;color:transparent;z-index:1}:host .notification-color{color:#24ba9d}";

@@ -550,2 +458,7 @@

this.community = "https://community.debtcollective.org/";
/**
* URL to the wordpress menu
* with the latest "/"
*/
this.wordpress = "https://wordpress-test.debtcollective.org/wp-json/menus/v1/menus/2";
}

@@ -599,3 +512,3 @@ componentWillRender() {

render() {
return (h(Host, null, h("header", { class: `navbar-top navbar l-header ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, h("div", { class: "l-header-item btn-container navbar-item" }, h("button", { class: "btn-transparent", onClick: this.toggleMenuHandler.bind(this) }, h("span", { class: "material-icons" }, "menu"))), h("div", { class: "l-header-item logo-container navbar-item" }, h("a", { class: `logo ${this.isShrink ? "logo-shrink" : ""}`, href: this.homepage }, h("img", { class: "d-sm-none", src: this._logoSmall, alt: "The Debtcollective" }), h("img", { class: "d-none d-sm-block ml-2 fixed-size", src: this._logo, alt: "The Debtcollective" }))), h("div", { class: "l-header-item session-container navbar-item" }, this.user ? (h("dc-profile", { shrank: this.isShrink, user: this.user, homepage: this.homepage, community: this.community, expanded: this.isProfileMenuOpen })) : (h("span", { class: "d-none d-sm-flex ml-auto" }, h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))))), this.user ? null : (h("div", { class: `navbar-bottom navbar d-sm-none ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))), h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community }), h("div", { class: `document-cloak ${this.isMenuOpen || this.isProfileMenuOpen ? "d-block" : "hidden"}`, onClick: this.closeAll.bind(this), hidden: !this.isMenuOpen })));
return (h(Host, null, h("header", { class: `navbar-top navbar l-header ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, h("div", { class: "l-header-item btn-container navbar-item" }, h("button", { class: "btn-transparent", onClick: this.toggleMenuHandler.bind(this) }, h("span", { class: "material-icons" }, "menu"))), h("div", { class: "l-header-item logo-container navbar-item" }, h("a", { class: `logo ${this.isShrink ? "logo-shrink" : ""}`, href: this.homepage }, h("img", { class: "d-sm-none", src: this._logoSmall, alt: "The Debtcollective" }), h("img", { class: "d-none d-sm-block ml-2 fixed-size", src: this._logo, alt: "The Debtcollective" }))), h("div", { class: "l-header-item session-container navbar-item" }, this.user ? (h("dc-profile", { shrank: this.isShrink, user: this.user, homepage: this.homepage, community: this.community, expanded: this.isProfileMenuOpen })) : (h("span", { class: "d-none d-sm-flex ml-auto" }, h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))))), this.user ? null : (h("div", { class: `navbar-bottom navbar d-sm-none ${this.isMenuOpen ? "is-moved" : ""} ${this.isShrink ? "is-shrink" : ""}` }, h("a", { href: this.config.login.url, class: "btn-outline" }, this.config.login.text), h("a", { href: this.config.join.url, class: "btn-primary ml-1" }, this.config.join.text))), h("dc-menu", { open: this.isMenuOpen, user: this.user, homepage: this.homepage, community: this.community, wordpress: this.wordpress }), h("div", { class: `document-cloak ${this.isMenuOpen || this.isProfileMenuOpen ? "d-block" : "hidden"}`, onClick: this.closeAll.bind(this), hidden: !this.isMenuOpen })));
}

@@ -602,0 +515,0 @@ static get assetsDirs() { return ["assets"]; }

@@ -16,3 +16,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-8956c047.js';

patchBrowser().then(options => {
return bootstrapLazy([["dc-header_4",[[1,"dc-header",{"homepage":[1],"community":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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"]]]]]], options);
return bootstrapLazy([["dc-header_4",[[1,"dc-header",{"homepage":[1],"community":[1],"wordpress":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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],"wordpress":[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"]]]]]], options);
});

@@ -13,3 +13,3 @@ import { p as promiseResolve, b as bootstrapLazy } from './index-8956c047.js';

return patchEsm().then(() => {
return bootstrapLazy([["dc-header_4",[[1,"dc-header",{"homepage":[1],"community":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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"]]]]]], options);
return bootstrapLazy([["dc-header_4",[[1,"dc-header",{"homepage":[1],"community":[1],"wordpress":[1],"returnurl":[1],"logo":[8],"logosmall":[8],"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],"wordpress":[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"]]]]]], options);
});

@@ -16,0 +16,0 @@ };

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

import{p as e,b as l}from"./p-1822b0d8.js";(()=>{const l=import.meta.url,o={};return""!==l&&(o.resourcesUrl=new URL(".",l).href),e(o)})().then((e=>l([["p-3fb6bf3a",[[1,"dc-header",{homepage:[1],community:[1],returnurl:[1],logo:[8],logosmall:[8],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 o}from"./p-1822b0d8.js";(()=>{const o=import.meta.url,l={};return""!==o&&(l.resourcesUrl=new URL(".",o).href),e(l)})().then((e=>o([["p-d87bd6e3",[[1,"dc-header",{homepage:[1],community:[1],wordpress:[1],returnurl:[1],logo:[8],logosmall:[8],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],wordpress:[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)));

@@ -27,2 +27,6 @@ /* eslint-disable */

"returnurl": string;
/**
* URL to the wordpress menu with the latest "/"
*/
"wordpress": string;
}

@@ -50,2 +54,3 @@ interface DcLink {

};
"wordpress": string;
}

@@ -126,2 +131,6 @@ interface DcProfile {

"returnurl"?: string;
/**
* URL to the wordpress menu with the latest "/"
*/
"wordpress"?: string;
}

@@ -155,2 +164,3 @@ interface DcLink {

};
"wordpress"?: string;
}

@@ -157,0 +167,0 @@ interface DcProfile {

@@ -51,2 +51,7 @@ import "./menu";

/**
* URL to the wordpress menu
* with the latest "/"
*/
wordpress: string;
/**
* URL to use after login processed typically full URL from host

@@ -53,0 +58,0 @@ * with the latest "/"

@@ -9,2 +9,3 @@ import "./link";

homepage: string;
wordpress: string;
host: string;

@@ -11,0 +12,0 @@ /**

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

export declare const getWordpressNav: (wordpress: any) => Promise<any>;
export declare const syncCurrentUser: (community: any) => Promise<any>;
export declare const logout: (community: any, username: any) => Promise<void>;

@@ -0,1 +1,2 @@

export declare const interpolateWordpressNav: (wordpress: any) => Promise<void>;
/**

@@ -49,21 +50,3 @@ * Method to digest the config.json and avoid a mapping within

}) => {
expandables: ({
type: string;
text: string;
url: string;
authenticated: boolean;
items: any;
} | {
type: string;
text: string;
url: string;
authenticated?: undefined;
items: any;
} | {
type: string;
text: string;
url?: undefined;
authenticated?: undefined;
items: any;
})[];
expandables: any[];
authenticatedLinks: any[];

@@ -70,0 +53,0 @@ guestLinks: any[];

{
"name": "@debtcollective/dc-header-component",
"version": "3.6.3",
"version": "4.0.0",
"description": "Stencil header component for debtcollective web apps",

@@ -42,3 +42,3 @@ "main": "dist/index.cjs.js",

"license": "BSD-3-Clause",
"gitHead": "bbd282d283b93d7a68ec63685d1442f9389f5276"
"gitHead": "a6915620ad4f9bd310559c5e7819fd70680dc365"
}
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