Socket
Socket
Sign inDemoInstall

@frontify/app-bridge-theme

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@frontify/app-bridge-theme - npm Package Compare versions

Comparing version 0.0.0-alpha.11 to 0.0.0-alpha.12

390

dist/index.d.ts

@@ -18,25 +18,2 @@ import { Simplify } from 'type-fest';

declare interface AppBridgeTheme_2 {
dispatch<CommandName extends keyof CommandRegistry_2>(
dispatchHandler: DispatchHandlerParameter_2<CommandName, CommandRegistry_2>,
): Promise<void>;
context(): ContextReturn_2<Context_2, void>;
context<Key extends keyof Context_2>(key: Key): ContextReturn_2<Context_2, Key>;
context(key?: keyof Context_2 | void): unknown;
subscribe<EventName extends keyof AppBridgeThemeEvent_2>(
eventName: EventNameParameter_2<EventName, AppBridgeThemeEvent_2>,
callback: EventCallbackParameter_2<EventName, AppBridgeThemeEvent_2>,
): EventUnsubscribeFunction_2;
/**
* @deprecated
* Search in the current Guideline for a given query.
* @param query - The query to search for.
* @param order - The order in which the results should be returned. Defaults to 'relevance'.
*/
searchInGuideline(query: string, order?: 'relevance' | 'newest' | 'oldest'): Promise<GuidelineSearchResult_2[]>;
}
export declare type AppBridgeThemeEvent = EventNameValidator<Pick<EventRegistry, 'assetsChosen'> & ContextAsEventName<Context & {

@@ -46,11 +23,2 @@ '*': Context;

declare type AppBridgeThemeEvent_2 = EventNameValidator_2<
Pick<EventRegistry_2, 'assetsChosen'> &
ContextAsEventName_2<
Context_2 & {
'*': Context_2;
}
>
>;
export declare type Asset = {

@@ -81,27 +49,2 @@ id: number;

declare type Asset_2 = {
id: number;
creatorName: string;
extension: string;
externalUrl: Nullable<string>;
fileName: string;
title: string;
status: string;
objectType: string;
height: Nullable<number>;
width: Nullable<number>;
genericUrl: string;
previewUrl: string;
originUrl: string;
projectId: number;
fileSize: number;
fileSizeHumanReadable: string;
fileId: string;
token: string;
projectType: Nullable<string>;
revisionId: Nullable<number>;
backgroundColor: Nullable<string>;
isDownloadProtected: boolean;
};
export declare interface BrandPortalLink {

@@ -113,10 +56,4 @@ isEnabled(): boolean;

declare interface BrandPortalLink_2 {
isEnabled(): boolean;
title(language?: string): string;
url(language?: string): string;
}
export declare const closeSearchDialog: () => DispatchHandlerParameter<"closeSearchDialog", CommandRegistry>;
export declare const closeSearchDialog: () => DispatchHandlerParameter_2<"closeSearchDialog", CommandRegistry>;
declare type CommandNamePattern = {

@@ -126,10 +63,4 @@ [commandName: `${CommandVerb}${string}`]: unknown;

declare type CommandNamePattern_2 = { [commandName: `${CommandVerb_2}${string}`]: unknown };
declare type CommandNameValidator<CommandNameObject> = Simplify<ObjectNameValidator<CommandNameObject, CommandNamePattern, 'Command'>>;
declare type CommandNameValidator_2<CommandNameObject> = Simplify<
ObjectNameValidator_2<CommandNameObject, CommandNamePattern_2, 'Command'>
>;
export declare type CommandRegistry = CommandNameValidator<{

@@ -143,14 +74,4 @@ openSearchDialog: void;

declare type CommandRegistry_2 = CommandNameValidator_2<{
openSearchDialog: void;
closeSearchDialog: void;
navigate: string;
navigateToDocumentSection: number | string;
hydrateContextDocumentNavigation: number;
}>;
declare type CommandVerb = 'open' | 'close' | 'navigate' | 'hydrateContext';
declare type CommandVerb_2 = 'open' | 'close' | 'navigate' | 'hydrateContext';
export declare type Context = {

@@ -178,24 +99,2 @@ brandId: number;

declare type Context_2 = {
brandId: number;
brandPortalLink: BrandPortalLink_2 | null;
projectId: number;
portalId: number;
portalNavigation: PortalNavigationItem_2[] | null;
documentNavigation: Record<number, DocumentChildNavigationItem_2[] | undefined>;
portalToken: string | null;
currentLanguage: string;
defaultLanguage: string;
isEditing: boolean;
isPublicLink: boolean;
isAuthenticated: boolean;
isSearchDialogOpen: boolean;
languages: Language_2[];
template: TemplateContext_2 | null;
settings: {
templateSettings: Record<string, unknown>;
templateAssets: Record<string, Asset_2[]>;
};
};
declare type ContextAsEventName<Context> = {

@@ -208,9 +107,2 @@ [ContextKey in keyof Context as ContextKey extends string ? `Context.${ContextKey}` : never]: [

declare type ContextAsEventName_2<Context> = {
[ContextKey in keyof Context as ContextKey extends string ? `Context.${ContextKey}` : never]: [
Context[ContextKey],
Context[ContextKey],
];
};
export declare type ContextReturn<Context, Key> = Key extends keyof Context ? {

@@ -236,33 +128,5 @@ /**

declare type ContextReturn_2<Context, Key> = Key extends keyof Context
? {
/**
* Gets the current value of the context object at the given key.
*/
get(): Readonly<Context[Key]>;
/**
* Subscribes to changes in the context object at the given key.
*/
subscribe(
callbackFunction: (nextContext: Context[Key], previousContext: Context[Key]) => void,
): EventUnsubscribeFunction_2;
}
: {
/**
* Gets the current value of the context object.
*/
get(): Readonly<Context>;
/**
* Subscribes to changes in the context object.
*/
subscribe(
callbackFunction: (nextContext: Context, previousContext: Context) => void,
): EventUnsubscribeFunction_2;
};
export declare interface CoverPage extends CoverPageBase {
}
declare interface CoverPage_2 extends CoverPageBase_2 {}
declare interface CoverPageBase {

@@ -277,16 +141,5 @@ id(): number;

declare interface CoverPageBase_2 {
id(): number;
title(language?: string): string;
isPublished(): boolean;
isHiddenInNavigation(): boolean;
url(language?: string): string;
type: 'cover-page';
}
export declare interface CoverPageNavigationItem extends CoverPageBase {
}
declare interface CoverPageNavigationItem_2 extends CoverPageBase_2 {}
declare type DispatchHandler<CommandName extends keyof CommandRegistry, TCommand extends CommandRegistry> = TCommand[CommandName] extends void ? {

@@ -299,16 +152,4 @@ name: CommandName;

declare type DispatchHandler_2<
CommandName extends keyof CommandRegistry_2,
TCommand extends CommandRegistry_2,
> = TCommand[CommandName] extends void ? { name: CommandName } : { name: CommandName; payload: TCommand[CommandName] };
export declare type DispatchHandlerParameter<CommandName, TCommand extends CommandRegistry> = CommandName extends keyof CommandRegistry ? DispatchHandler<CommandName, TCommand> : WrongNamePattern<CommandName, 'Command'>;
declare type DispatchHandlerParameter_2<
CommandName,
TCommand extends CommandRegistry_2,
> = CommandName extends keyof CommandRegistry_2
? DispatchHandler_2<CommandName, TCommand>
: WrongNamePattern_2<CommandName, 'Command'>;
declare interface Document_2 extends DocumentBase {

@@ -319,6 +160,2 @@ documentGroupId(): Nullable<number>;

declare interface Document_3 extends DocumentBase_2 {
documentGroupId(): Nullable<number>;
}
declare interface DocumentBase {

@@ -332,17 +169,4 @@ id(): number;

declare interface DocumentBase_2 {
id(): number;
title(language?: string): string;
slug(language?: string): string;
url(language?: string): string;
type: 'document';
}
export declare type DocumentChildNavigationItem = PageCategoryNavigationItem | DocumentPageNavigationItem | DocumentPageLinkNavigationItem;
declare type DocumentChildNavigationItem_2 =
| PageCategoryNavigationItem_2
| DocumentPageNavigationItem_2
| DocumentPageLinkNavigationItem_2;
export declare interface DocumentGroupNavigationItem {

@@ -355,9 +179,2 @@ id(): number;

declare interface DocumentGroupNavigationItem_2 {
id(): number;
title(language?: string): string;
children(): (DocumentNavigationItem_2 | DocumentLibraryNavigationItem_2 | DocumentLinkNavigationItem_2)[];
type: 'document-group';
}
export declare interface DocumentLibrary extends DocumentLibraryBase {

@@ -367,6 +184,2 @@ documentGroupId(): Nullable<number>;

declare interface DocumentLibrary_2 extends DocumentLibraryBase_2 {
documentGroupId(): Nullable<number>;
}
declare interface DocumentLibraryBase {

@@ -380,10 +193,2 @@ id(): number;

declare interface DocumentLibraryBase_2 {
id(): number;
title(language?: string): string;
slug(language?: string): string;
url(language?: string): string;
type: 'document-library';
}
export declare interface DocumentLibraryNavigationItem extends DocumentLibraryBase {

@@ -393,6 +198,2 @@ parentId(): Nullable<number>;

declare interface DocumentLibraryNavigationItem_2 extends DocumentLibraryBase_2 {
parentId(): Nullable<number>;
}
export declare interface DocumentLinkNavigationItem {

@@ -410,14 +211,2 @@ id(): number;

declare interface DocumentLinkNavigationItem_2 {
id(): number;
title(language?: string): string;
url(): string;
displayMode(): LinkSettingsDisplay_2;
iconPosition(): LinkSettingsIconPosition_2;
customIconUrl(): Nullable<string>;
shouldOpenInNewTab(): boolean;
parentId(): Nullable<number>;
type: 'document-link';
}
export declare interface DocumentNavigationItem extends DocumentBase {

@@ -427,6 +216,2 @@ parentId(): Nullable<number>;

declare interface DocumentNavigationItem_2 extends DocumentBase_2 {
parentId(): Nullable<number>;
}
export declare interface DocumentPage extends DocumentPageBase {

@@ -437,7 +222,2 @@ categoryId(): Nullable<number>;

declare interface DocumentPage_2 extends DocumentPageBase_2 {
categoryId(): Nullable<number>;
documentId(): number;
}
declare interface DocumentPageBase {

@@ -451,10 +231,2 @@ id(): number;

declare interface DocumentPageBase_2 {
id(): number;
title(language?: string): string;
slug(language?: string): string;
url(language?: string): string;
type: 'document-page';
}
export declare interface DocumentPageHeadingNavigationItem {

@@ -467,9 +239,2 @@ id(): number;

declare interface DocumentPageHeadingNavigationItem_2 {
id(): number;
title(language?: string): string;
slug(language?: string): string;
type: 'document-page-heading';
}
export declare interface DocumentPageLinkNavigationItem {

@@ -482,9 +247,2 @@ id(): number;

declare interface DocumentPageLinkNavigationItem_2 {
id(): number;
title(language?: string): string;
url(): string;
type: 'document-page-link';
}
export declare interface DocumentPageNavigationItem extends DocumentPageBase {

@@ -494,22 +252,6 @@ headings(): DocumentPageHeadingNavigationItem[];

declare interface DocumentPageNavigationItem_2 extends DocumentPageBase_2 {
headings(): DocumentPageHeadingNavigationItem_2[];
}
export declare type EventCallbackParameter<EventName, AppBridgeThemeEvent> = EventName extends keyof AppBridgeThemeEvent ? AppBridgeThemeEvent[EventName] extends any[] ? (...eventReturn: AppBridgeThemeEvent[EventName]) => void : (eventReturn: AppBridgeThemeEvent[EventName]) => void : () => void;
declare type EventCallbackParameter_2<EventName, AppBridgeThemeEvent> = EventName extends keyof AppBridgeThemeEvent
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
AppBridgeThemeEvent[EventName] extends any[]
? (...eventReturn: AppBridgeThemeEvent[EventName]) => void
: (eventReturn: AppBridgeThemeEvent[EventName]) => void
: () => void;
export declare type EventNameParameter<EventName, EventNameParameter extends EventNamePattern> = EventName extends keyof EventNameParameter ? EventName : WrongNamePattern<EventName, 'Event'>;
declare type EventNameParameter_2<
EventName,
EventNameParameter extends EventNamePattern_2,
> = EventName extends keyof EventNameParameter ? EventName : WrongNamePattern_2<EventName, 'Event'>;
export declare type EventNamePattern = {

@@ -519,12 +261,4 @@ [eventName: `Context.${string}` | `${string}${Capitalize<EventVerb>}`]: unknown;

declare type EventNamePattern_2 = {
[eventName: `Context.${string}` | `${string}${Capitalize<EventVerb_2>}`]: unknown;
};
export declare type EventNameValidator<EventNameObject> = Simplify<ObjectNameValidator<EventNameObject, EventNamePattern, 'Event'>>;
declare type EventNameValidator_2<EventNameObject> = Simplify<
ObjectNameValidator_2<EventNameObject, EventNamePattern_2, 'Event'>
>;
export declare type EventRegistry = EventNameValidator<{

@@ -536,14 +270,6 @@ assetsChosen: {

declare type EventRegistry_2 = EventNameValidator_2<{
assetsChosen: { assets: Asset_2[] };
}>;
export declare type EventUnsubscribeFunction = () => void;
declare type EventUnsubscribeFunction_2 = () => void;
declare type EventVerb = 'chosen';
declare type EventVerb_2 = 'chosen';
export declare type GuidelineSearchResult = {

@@ -571,28 +297,4 @@ highlights: string[];

declare type GuidelineSearchResult_2 = {
highlights: string[];
type: GuidelineSearchResultType_2;
objectId: number;
pageId: number;
pageSlug: string;
pageTitle: string;
pageCategorySlug: string | null;
blockId: number;
documentId: number;
documentSlug: string;
documentTitle: string;
portalId: number;
portalToken: string | null;
sectionId: string | null;
sectionSlug: string | null;
sectionTitle: string | null;
colorHex?: string;
projectColorId?: string;
guidelineTitle: string;
};
declare type GuidelineSearchResultType = (typeof GuidelineSearchResultTypeMap)[keyof typeof GuidelineSearchResultTypeMap];
declare type GuidelineSearchResultType_2 = (typeof GuidelineSearchResultTypeMap_2)[keyof typeof GuidelineSearchResultTypeMap_2];
export declare const GuidelineSearchResultTypeMap: {

@@ -605,11 +307,4 @@ block: string;

declare const GuidelineSearchResultTypeMap_2 = {
block: 'BLOCK',
section: 'SECTION',
page: 'PAGE',
color: 'COLOR',
};
export declare const hydrateContextDocumentNavigation: (documentId: CommandRegistry["hydrateContextDocumentNavigation"]) => DispatchHandlerParameter<"hydrateContextDocumentNavigation", CommandRegistry>;
export declare const hydrateContextDocumentNavigation: (documentId: CommandRegistry["hydrateContextDocumentNavigation"]) => DispatchHandlerParameter_2<"hydrateContextDocumentNavigation", CommandRegistry>;
export declare type Language = {

@@ -634,24 +329,2 @@ /**

declare type Language_2 = {
/**
* The language code in ISO 639-1 format.
*/
isoCode: string;
/**
* The name of the language.
*/
name: string;
/**
* Indicates whether the language is the default language.
*/
isDefault: boolean;
/**
* Indicates whether the language is in draft state.
*/
isDraft: boolean;
};
export declare enum LinkSettingsDisplay {

@@ -663,8 +336,2 @@ TextAndIcon = "ICON_TEXT",

declare enum LinkSettingsDisplay_2 {
TextAndIcon = 'ICON_TEXT',
IconOnly = 'ICON',
TextOnly = 'TEXT',
}
export declare enum LinkSettingsIconPosition {

@@ -675,30 +342,12 @@ Right = "RIGHT",

declare enum LinkSettingsIconPosition_2 {
Right = 'RIGHT',
Left = 'LEFT',
}
declare type NameContextList = 'Command' | 'Event';
declare type NameContextList_2 = 'Command' | 'Event';
export declare const navigate: (path: CommandRegistry["navigate"]) => DispatchHandlerParameter<"navigate", CommandRegistry>;
export declare const navigate: (path: CommandRegistry["navigate"]) => DispatchHandlerParameter_2<"navigate", CommandRegistry>;
export declare const navigateToDocumentSection: (sectionId: CommandRegistry["navigateToDocumentSection"]) => DispatchHandlerParameter<"navigateToDocumentSection", CommandRegistry>;
export declare const navigateToDocumentSection: (sectionId: CommandRegistry["navigateToDocumentSection"]) => DispatchHandlerParameter_2<"navigateToDocumentSection", CommandRegistry>;
export declare type ObjectNameValidator<NameObject, PatternObject, NameContext extends NameContextList> = keyof NameObject extends keyof PatternObject ? NameObject : WrongNamePattern<`${Exclude<Extract<keyof NameObject, string>, Extract<keyof PatternObject, string>>}`, NameContext>;
declare type ObjectNameValidator_2<
NameObject,
PatternObject,
NameContext extends NameContextList_2,
> = keyof NameObject extends keyof PatternObject
? NameObject
: WrongNamePattern_2<
`${Exclude<Extract<keyof NameObject, string>, Extract<keyof PatternObject, string>>}`,
NameContext
>;
export declare const openSearchDialog: () => DispatchHandlerParameter<"openSearchDialog", CommandRegistry>;
export declare const openSearchDialog: () => DispatchHandlerParameter_2<"openSearchDialog", CommandRegistry>;
export declare interface PageCategoryNavigationItem {

@@ -712,19 +361,4 @@ id(): number;

declare interface PageCategoryNavigationItem_2 {
id(): number;
title(language?: string): string;
slug(language?: string): string;
children(): (DocumentPageNavigationItem_2 | DocumentPageLinkNavigationItem_2)[];
type: 'page-category';
}
export declare type PortalNavigationItem = CoverPageNavigationItem | DocumentGroupNavigationItem | DocumentNavigationItem | DocumentLibraryNavigationItem | DocumentLinkNavigationItem;
declare type PortalNavigationItem_2 =
| CoverPageNavigationItem_2
| DocumentGroupNavigationItem_2
| DocumentNavigationItem_2
| DocumentLibraryNavigationItem_2
| DocumentLinkNavigationItem_2;
export declare type SubscribeMap<Event> = {

@@ -749,14 +383,6 @@ [EventName in keyof Event as EventName]: Map<EventCallbackParameter<keyof Event, Event>, boolean>;

declare type TemplateContext_2 = { templateId: string; type: ThemeTemplate_2 } & (
| { type: 'documentPage'; document: Document_3; documentPage: DocumentPage_2 }
| { type: 'library'; document: DocumentLibrary_2 }
| { type: 'cover'; coverPage: CoverPage_2 }
);
export declare type ThemeTemplate = 'documentPage' | 'cover' | 'library';
declare type ThemeTemplate_2 = 'documentPage' | 'cover' | 'library';
export declare const useDocumentNavigation: (appBridge: AppBridgeTheme, document: DocumentNavigationItem) => DocumentChildNavigationItem[];
export declare const useDocumentNavigation: (appBridge: AppBridgeTheme_2, document: DocumentNavigationItem) => DocumentChildNavigationItem[];
export declare const useIsEditing: (appBridge: AppBridgeTheme) => boolean;

@@ -773,6 +399,2 @@

declare type WrongNamePattern_2<ApiMethodName, NameContext extends NameContextList_2> = ApiMethodName extends string
? `The following ${NameContext} do not match the naming pattern: ${ApiMethodName}`
: never;
export { }

14

dist/index.js

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

import { useSyncExternalStore as n, useEffect as o } from "react";
const s = (t) => n(t.context("isEditing").subscribe, t.context("isEditing").get), i = (t) => {
const e = n(
import { useSyncExternalStore as a, useEffect as o } from "react";
const s = (t) => a(t.context("isEditing").subscribe, t.context("isEditing").get), i = (t) => {
const e = a(
t.context("currentLanguage").subscribe,
t.context("currentLanguage").get
), a = n(
), n = a(
t.context("defaultLanguage").subscribe,
t.context("defaultLanguage").get
);
return { currentLanguage: e, defaultLanguage: a };
return { currentLanguage: e, defaultLanguage: n };
}, c = (t) => ({

@@ -15,3 +15,3 @@ name: "hydrateContextDocumentNavigation",

}), l = (t, e) => {
const a = n(
const n = a(
t.context("documentNavigation").subscribe,

@@ -22,3 +22,3 @@ t.context("documentNavigation").get

t.dispatch(c(e.id()));
}, [t, e]), a[e.id()] ?? [];
}, [t, e]), n ? n[e.id()] ?? [] : [];
}, x = () => ({

@@ -25,0 +25,0 @@ name: "openSearchDialog"

{
"name": "@frontify/app-bridge-theme",
"type": "module",
"version": "0.0.0-alpha.11",
"version": "0.0.0-alpha.12",
"description": "Package to establish communication between Frontify and themes",

@@ -6,0 +6,0 @@ "author": "Frontify Developers <developers@frontify.com>",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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