Socket
Socket
Sign inDemoInstall

@paperbits/core

Package Overview
Dependencies
Maintainers
2
Versions
620
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paperbits/core - npm Package Compare versions

Comparing version 0.1.39 to 0.1.40

36

navbar/navbarModelBinder.ts

@@ -18,5 +18,9 @@ import { NavbarModel } from "./navbarModel";

public async contractToModel(navbarContract: NavbarContract): Promise<NavbarModel> {
public async contractToModel(contract: NavbarContract): Promise<NavbarModel> {
if (!contract) {
throw new Error(`Parameter "contract" not specified.`);
}
const navbarModel = new NavbarModel();
const navigationItemContract = await this.navigationService.getNavigationItem(navbarContract.rootKey);
const navigationItemContract = await this.navigationService.getNavigationItem(contract.rootKey);

@@ -28,7 +32,7 @@ if (navigationItemContract) {

navbarModel.rootKey = navbarContract.rootKey;
navbarModel.pictureSourceKey = navbarContract.rootKey;
navbarModel.rootKey = contract.rootKey;
navbarModel.pictureSourceKey = contract.rootKey;
if (navbarContract.sourceKey) {
const media = await this.mediaService.getMediaByKey(navbarContract.sourceKey);
if (contract.sourceKey) {
const media = await this.mediaService.getMediaByKey(contract.sourceKey);

@@ -40,3 +44,3 @@ if (media) {

else {
console.warn(`Unable to set navbar branding. Media with source key ${navbarContract.sourceKey} not found.`);
console.warn(`Unable to set navbar branding. Media with source key ${contract.sourceKey} not found.`);
}

@@ -56,11 +60,15 @@ }

public async navigationItemToNavbarItemModel(navigationItemContract: NavigationItemContract): Promise<NavigationItemModel> {
public async navigationItemToNavbarItemModel(contract: NavigationItemContract): Promise<NavigationItemModel> {
if (!contract) {
throw new Error(`Parameter "contract" not specified.`);
}
const navbarItem = new NavigationItemModel();
navbarItem.label = navigationItemContract.label;
navbarItem.label = contract.label;
if (navigationItemContract.navigationItems) {
if (contract.navigationItems) {
const tasks = [];
navigationItemContract.navigationItems.forEach(child => {
contract.navigationItems.forEach(child => {
tasks.push(this.navigationItemToNavbarItemModel(child));

@@ -75,4 +83,4 @@ });

}
else if (navigationItemContract.targetKey) {
const contentItem = await this.contentItemService.getContentItemByKey(navigationItemContract.targetKey);
else if (contract.targetKey) {
const contentItem = await this.contentItemService.getContentItemByKey(contract.targetKey);

@@ -86,3 +94,3 @@ if (contentItem) {

console.warn(`No permalink key for item:`);
console.warn(navigationItemContract);
console.warn(contract);
}

@@ -89,0 +97,0 @@ navbarItem.isActive = navbarItem.url === this.routeHandler.getCurrentUrl();

{
"name": "@paperbits/core",
"version": "0.1.39",
"version": "0.1.40",
"description": "Paperbits core components.",

@@ -23,4 +23,4 @@ "author": "Paperbits",

"dependencies": {
"@paperbits/common": "0.1.39",
"@paperbits/styles": "0.1.39",
"@paperbits/common": "0.1.40",
"@paperbits/styles": "0.1.40",
"cropperjs": "^1.4.0",

@@ -27,0 +27,0 @@ "file-saver": "^2.0.0",

@@ -36,3 +36,3 @@ import { TableOfContentsModel } from "./tableOfContentsModel";

const contentItem = await this.contentItemService.getContentItemByKey(navigationItem.targetKey);
navbarItemModel.url = contentItem.permalink;

@@ -42,3 +42,3 @@

navbarItemModel.isActive = true;
if (contentItem.anchors) {

@@ -53,6 +53,10 @@ // navbarItemModel.nodes = await this.processAnchorItems(page.anchors);

public async contractToModel(tableOfContentsContract: TableOfContentsContract): Promise<TableOfContentsModel> {
public async contractToModel(contract: TableOfContentsContract): Promise<TableOfContentsModel> {
if (!contract) {
throw new Error(`Parameter "contract" not specified.`);
}
const tableOfContentsModel = new TableOfContentsModel();
tableOfContentsModel.title = tableOfContentsContract.title;
tableOfContentsModel.navigationItemKey = tableOfContentsContract.navigationItemKey;
tableOfContentsModel.title = contract.title;
tableOfContentsModel.navigationItemKey = contract.navigationItemKey;
tableOfContentsModel.items = [];

@@ -69,6 +73,6 @@

if (tableOfContentsContract.navigationItemKey) {
const assignedNavigationItem = await this.navigationService.getNavigationItem(tableOfContentsContract.navigationItemKey);
if (contract.navigationItemKey) {
const assignedNavigationItem = await this.navigationService.getNavigationItem(contract.navigationItemKey);
if (assignedNavigationItem.navigationItems) { // has child nav items
if (assignedNavigationItem && assignedNavigationItem.navigationItems) { // has child nav items
const promises = assignedNavigationItem.navigationItems.map(async navigationItem => {

@@ -75,0 +79,0 @@ return await this.processNavigationItem(navigationItem, currentPageUrl);

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