@bloomreach/spa-sdk
Advanced tools
Comparing version 14.3.3 to 14.4.0
@@ -75,3 +75,4 @@ /** | ||
/** | ||
* Clears previously rendered meta-data objects. | ||
* Clears all previously rendered meta-data objects. | ||
* @deprecated Use a callback returned by the `render` method. | ||
*/ | ||
@@ -83,4 +84,5 @@ clear(): void; | ||
* @param tail The tailing node of the page fragment. | ||
* @return The callback to clear rendered meta-data objects. | ||
*/ | ||
render(head: Node, tail: Node): void; | ||
render(head: Node, tail: Node): () => void; | ||
} | ||
@@ -161,3 +163,3 @@ | ||
*/ | ||
getParameters(): ComponentParameters; | ||
getParameters<T = ComponentParameters>(): T; | ||
/** | ||
@@ -281,3 +283,143 @@ * @return The direct children of the component. | ||
interface DocumentDataModel { | ||
id: string; | ||
localeString?: string; | ||
name: string; | ||
[property: string]: any; | ||
} | ||
/** | ||
* Document used on the page. | ||
*/ | ||
interface Document { | ||
/** | ||
* @return The document id. | ||
*/ | ||
getId(): string; | ||
/** | ||
* @return The document locale. | ||
*/ | ||
getLocale(): string | undefined; | ||
/** | ||
* @return The document meta-data collection. | ||
*/ | ||
getMeta(): MetaCollection; | ||
/** | ||
* @return The document name. | ||
*/ | ||
getName(): string; | ||
/** | ||
* @return The document data. | ||
*/ | ||
getData(): DocumentDataModel; | ||
getData<T extends Record<string, any>>(): T & DocumentDataModel; | ||
/** | ||
* @return The link to the content. | ||
*/ | ||
getUrl(): string | undefined; | ||
} | ||
/** | ||
* Checks whether a value is a document. | ||
* @param value The value to check. | ||
*/ | ||
declare function isDocument(value: any): value is Document; | ||
/** | ||
* A manage content button. | ||
*/ | ||
declare const TYPE_MANAGE_CONTENT_BUTTON = "MANAGE_CONTENT_LINK"; | ||
interface ManageContentButton { | ||
/** | ||
* The content entity to open for editing. | ||
*/ | ||
content?: Content | Document; | ||
/** | ||
* Template query to use for creating new documents. | ||
*/ | ||
documentTemplateQuery?: string; | ||
/** | ||
* Template query to use in case folders specified by `path` do not yet exist and must be created. | ||
*/ | ||
folderTemplateQuery?: string; | ||
/** | ||
* Initial location of a new document, relative to the `root`. | ||
*/ | ||
path?: string; | ||
/** | ||
* Name of the component parameter in which the document path is stored. | ||
*/ | ||
parameter?: string; | ||
/** | ||
* Flag indicating that the picked value should be stored as a relative path. | ||
*/ | ||
relative?: boolean; | ||
/** | ||
* Path to the root folder of selectable document locations. | ||
*/ | ||
root?: string; | ||
} | ||
interface MenuItem { | ||
/** | ||
* @return The child items. | ||
*/ | ||
getChildren(): MenuItem[]; | ||
/** | ||
* @return The menu item depth level. | ||
*/ | ||
getDepth(): number; | ||
/** | ||
* @return The menu item link. | ||
*/ | ||
getLink(): Link | undefined; | ||
/** | ||
* @return The menu item name. | ||
*/ | ||
getName(): string; | ||
/** | ||
* @return The menu item parameters. | ||
*/ | ||
getParameters(): object; | ||
/** | ||
* @return The menu item url. | ||
*/ | ||
getUrl(): string | undefined; | ||
/** | ||
* @return Whether the menu item is expanded. | ||
*/ | ||
isExpanded(): boolean; | ||
/** | ||
* @return Whether the menu item is repository based. | ||
*/ | ||
isRepositoryBased(): boolean; | ||
/** | ||
* @return Whether the menu item is selected. | ||
*/ | ||
isSelected(): boolean; | ||
} | ||
/** | ||
* A manage menu button. | ||
*/ | ||
declare const TYPE_MANAGE_MENU_BUTTON = "EDIT_MENU_LINK"; | ||
interface Menu { | ||
/** | ||
* @return The menu items. | ||
*/ | ||
getItems(): MenuItem[]; | ||
/** | ||
* @return The menu meta-data collection. | ||
*/ | ||
getMeta(): MetaCollection; | ||
/** | ||
* @return The current menu item. | ||
*/ | ||
getSelected(): MenuItem | undefined; | ||
} | ||
/** | ||
* Checks whether a value is a menu. | ||
* @param value The value to check. | ||
*/ | ||
declare function isMenu(value: unknown): value is Menu; | ||
/** | ||
* Meta-data of a visitor. | ||
@@ -315,4 +457,17 @@ * @see https://documentation.bloomreach.com/library/enterprise/enterprise-features/targeting/visitors-visits-and-cookies.html | ||
declare type ChannelParameters = Record<string, any>; | ||
declare type PageLinks = 'self' | 'site'; | ||
/** | ||
* Current channel info. | ||
*/ | ||
interface ChannelInfoModel { | ||
props: ChannelParameters; | ||
} | ||
/** | ||
* Current channel of a page. | ||
*/ | ||
interface ChannelModel { | ||
info: ChannelInfoModel; | ||
} | ||
/** | ||
* Meta-data of a page root component. | ||
@@ -356,2 +511,3 @@ */ | ||
interface PageModel { | ||
channel: ChannelModel; | ||
document?: Reference; | ||
@@ -368,2 +524,22 @@ links: Record<PageLinks, Link>; | ||
/** | ||
* Generates a manage content button. | ||
* @return The manage content button meta-data. | ||
*/ | ||
getButton(type: typeof TYPE_MANAGE_CONTENT_BUTTON, button: ManageContentButton): MetaCollection; | ||
/** | ||
* Generates a manage menu button. | ||
* @return The menu button meta-data. | ||
*/ | ||
getButton(type: typeof TYPE_MANAGE_MENU_BUTTON, menu: Menu): MetaCollection; | ||
/** | ||
* Generates a meta-data collection for the Experience Manager buttons. | ||
* @return The button meta-data. | ||
*/ | ||
getButton(type: string, ...params: any[]): MetaCollection; | ||
/** | ||
* Gets current channel parameters. | ||
* @returns The channel parameters. | ||
*/ | ||
getChannelParameters<T extends ChannelParameters = ChannelParameters>(): T; | ||
/** | ||
* Gets a root component in the page. | ||
@@ -399,2 +575,3 @@ * @return The root component. | ||
* @param meta The meta-data collection model as returned by the page-model-api. | ||
* @deprecated Use `getButton` method to create buttons. | ||
*/ | ||
@@ -454,3 +631,3 @@ getMeta(meta: MetaCollectionModel): MetaCollection; | ||
*/ | ||
rewriteLinks(content: string, type?: SupportedType): string; | ||
rewriteLinks(content: string, type?: string): string; | ||
/** | ||
@@ -482,4 +659,5 @@ * Synchronizes the CMS integration state. | ||
interface ContainerItemModel extends ComponentModel { | ||
ctype?: string; | ||
label?: string; | ||
meta: ContainerItemMeta; | ||
label?: string; | ||
type: typeof TYPE_COMPONENT_CONTAINER_ITEM; | ||
@@ -500,2 +678,8 @@ } | ||
/** | ||
* Returns the label of a container item catalogue component. | ||
* | ||
* @return The label of a catalogue component (e.g. "News List"). | ||
*/ | ||
getLabel(): string | undefined; | ||
/** | ||
* Returns the type of a container item. The available types depend on which | ||
@@ -565,61 +749,2 @@ * container items have been configured in the backend. | ||
interface MenuItem { | ||
/** | ||
* @return The child items. | ||
*/ | ||
getChildren(): MenuItem[]; | ||
/** | ||
* @return The menu item depth level. | ||
*/ | ||
getDepth(): number; | ||
/** | ||
* @return The menu item link. | ||
*/ | ||
getLink(): Link | undefined; | ||
/** | ||
* @return The menu item name. | ||
*/ | ||
getName(): string; | ||
/** | ||
* @return The menu item parameters. | ||
*/ | ||
getParameters(): object; | ||
/** | ||
* @return The menu item url. | ||
*/ | ||
getUrl(): string | undefined; | ||
/** | ||
* @return Whether the menu item is expanded. | ||
*/ | ||
isExpanded(): boolean; | ||
/** | ||
* @return Whether the menu item is repository based. | ||
*/ | ||
isRepositoryBased(): boolean; | ||
/** | ||
* @return Whether the menu item is selected. | ||
*/ | ||
isSelected(): boolean; | ||
} | ||
interface Menu { | ||
/** | ||
* @return The menu items. | ||
*/ | ||
getItems(): MenuItem[]; | ||
/** | ||
* @return The menu meta-data collection. | ||
*/ | ||
getMeta(): MetaCollection; | ||
/** | ||
* @return The current menu item. | ||
*/ | ||
getSelected(): MenuItem | undefined; | ||
} | ||
/** | ||
* Checks whether a value is a menu. | ||
* @param value The value to check. | ||
*/ | ||
declare function isMenu(value: unknown): value is Menu; | ||
declare type MenuItemLinks = 'site'; | ||
@@ -716,2 +841,3 @@ /** | ||
_meta: ContainerItemMeta; | ||
ctype?: string; | ||
label?: string; | ||
@@ -747,2 +873,3 @@ type: typeof TYPE_COMPONENT_CONTAINER_ITEM$1; | ||
_meta: PageModel['meta']; | ||
channel?: PageModel['channel']; | ||
content?: { | ||
@@ -754,44 +881,2 @@ [reference: string]: ContentModel$1; | ||
interface DocumentDataModel { | ||
id: string; | ||
localeString?: string; | ||
name: string; | ||
[property: string]: any; | ||
} | ||
/** | ||
* Document used on the page. | ||
*/ | ||
interface Document { | ||
/** | ||
* @return The document id. | ||
*/ | ||
getId(): string; | ||
/** | ||
* @return The document locale. | ||
*/ | ||
getLocale(): string | undefined; | ||
/** | ||
* @return The document meta-data collection. | ||
*/ | ||
getMeta(): MetaCollection; | ||
/** | ||
* @return The document name. | ||
*/ | ||
getName(): string; | ||
/** | ||
* @return The document data. | ||
*/ | ||
getData(): DocumentDataModel; | ||
getData<T extends Record<string, any>>(): T & DocumentDataModel; | ||
/** | ||
* @return The link to the content. | ||
*/ | ||
getUrl(): string | undefined; | ||
} | ||
/** | ||
* Checks whether a value is a document. | ||
* @param value The value to check. | ||
*/ | ||
declare function isDocument(value: any): value is Document; | ||
interface Image { | ||
@@ -880,3 +965,66 @@ /** | ||
interface PaginationItem { | ||
/** | ||
* @return The page number. | ||
*/ | ||
getNumber(): number; | ||
/** | ||
* @return The page URL. | ||
*/ | ||
getUrl(): string | undefined; | ||
} | ||
interface Pagination { | ||
/** | ||
* @return The current page. | ||
*/ | ||
getCurrent(): PaginationItem; | ||
/** | ||
* @return The first page. | ||
*/ | ||
getFirst(): PaginationItem; | ||
/** | ||
* @return The current page items. | ||
*/ | ||
getItems(): Reference[]; | ||
/** | ||
* @return The last page. | ||
*/ | ||
getLast(): PaginationItem; | ||
/** | ||
* @return The next page. | ||
*/ | ||
getNext(): PaginationItem | undefined; | ||
/** | ||
* @return The number of items before the current page. | ||
*/ | ||
getOffset(): number; | ||
/** | ||
* @return Currently listed pages. | ||
*/ | ||
getPages(): PaginationItem[]; | ||
/** | ||
* @return The previous page. | ||
*/ | ||
getPrevious(): PaginationItem | undefined; | ||
/** | ||
* @return The number of items listed on the current page. | ||
*/ | ||
getSize(): number; | ||
/** | ||
* @return The total number of items. | ||
*/ | ||
getTotal(): number; | ||
/** | ||
* @return Whether the pagination is enabled. | ||
*/ | ||
isEnabled(): boolean; | ||
} | ||
/** | ||
* Checks whether a value is a pagination. | ||
* @param value The value to check. | ||
*/ | ||
declare function isPagination(value: unknown): value is Pagination; | ||
/** | ||
* Checks whether a value is a page component. | ||
@@ -1103,2 +1251,2 @@ * @param value The value to check. | ||
export { Component, Configuration, Container, ContainerItem, Content, Document, Image, ImageSet, Link, META_POSITION_BEGIN, META_POSITION_END, Menu$2 as Menu, MenuItem, Meta, MetaCollection, MetaComment, Page, PageModel$2 as PageModel, Reference, TYPE_CONTAINER_BOX, TYPE_CONTAINER_INLINE, TYPE_CONTAINER_NO_MARKUP, TYPE_CONTAINER_ORDERED_LIST, TYPE_CONTAINER_UNORDERED_LIST, TYPE_LINK_EXTERNAL, TYPE_LINK_INTERNAL, TYPE_LINK_RESOURCE, destroy, initialize, isComponent, isContainer, isContainerItem, isContent, isDocument, isImageSet, isLink, isMenu, isMeta, isMetaComment, isPage, isReference }; | ||
export { Component, Configuration, Container, ContainerItem, Content, Document, Image, ImageSet, Link, META_POSITION_BEGIN, META_POSITION_END, ManageContentButton, Menu$2 as Menu, MenuItem, Meta, MetaCollection, MetaComment, Page, PageModel$2 as PageModel, Pagination, PaginationItem, Reference, TYPE_CONTAINER_BOX, TYPE_CONTAINER_INLINE, TYPE_CONTAINER_NO_MARKUP, TYPE_CONTAINER_ORDERED_LIST, TYPE_CONTAINER_UNORDERED_LIST, TYPE_LINK_EXTERNAL, TYPE_LINK_INTERNAL, TYPE_LINK_RESOURCE, TYPE_MANAGE_CONTENT_BUTTON, TYPE_MANAGE_MENU_BUTTON, destroy, initialize, isComponent, isContainer, isContainerItem, isContent, isDocument, isImageSet, isLink, isMenu, isMeta, isMetaComment, isPage, isPagination, isReference }; |
{ | ||
"name": "@bloomreach/spa-sdk", | ||
"version": "14.3.3", | ||
"version": "14.4.0", | ||
"description": "Bloomreach SPA SDK", | ||
@@ -14,4 +14,4 @@ "keywords": [ | ||
"type": "git", | ||
"url": "https://code.onehippo.org/cms-community/bloomreach-spa-sdk", | ||
"directory": "packages/spa-sdk" | ||
"url": "https://github.com/bloomreach/brxm.git", | ||
"directory": "spa-sdk/packages/spa-sdk" | ||
}, | ||
@@ -58,25 +58,25 @@ "bugs": { | ||
"devDependencies": { | ||
"@babel/core": "^7.9", | ||
"@babel/plugin-proposal-class-properties": "^7.8", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.9", | ||
"@babel/plugin-transform-object-assign": "^7.8", | ||
"@babel/polyfill": "^7.8", | ||
"@babel/preset-env": "^7.9", | ||
"@types/jest": "^25.2", | ||
"@babel/core": "^7.12", | ||
"@babel/plugin-proposal-class-properties": "^7.12", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.12", | ||
"@babel/plugin-transform-object-assign": "^7.12", | ||
"@babel/polyfill": "^7.12", | ||
"@babel/preset-env": "^7.12", | ||
"@rollup/plugin-babel": "^5.2", | ||
"@types/jest": "^26.0", | ||
"@types/xmldom": "^0.1", | ||
"babel-plugin-transform-async-to-promises": "^0.8", | ||
"jest": "^26.0", | ||
"jest-junit": "^11.1", | ||
"js-beautify": "^1.11", | ||
"rollup": "^2.10", | ||
"rollup-plugin-babel": "^4.4", | ||
"jest": "^26.6", | ||
"jest-junit": "^12.0", | ||
"js-beautify": "^1.13", | ||
"rollup": "^2.32", | ||
"rollup-plugin-dts": "^1.4", | ||
"rollup-plugin-terser": "^5.3", | ||
"rollup-plugin-typescript2": "^0.27", | ||
"ts-jest": "^26.0", | ||
"rollup-plugin-terser": "^7.0", | ||
"rollup-plugin-typescript2": "^0.28", | ||
"ts-jest": "^26.4", | ||
"tslint": "^6.1", | ||
"tslint-config-airbnb": "^5.11", | ||
"typedoc": "^0.17", | ||
"typedoc": "^0.19", | ||
"typedoc-plugin-external-module-map": "^1.2", | ||
"typescript": "^3.8" | ||
"typescript": "^4.0" | ||
}, | ||
@@ -87,4 +87,4 @@ "dependencies": { | ||
"reflect-metadata": "^0.1", | ||
"xmldom": "^0.3" | ||
"xmldom": "^0.4" | ||
} | ||
} |
@@ -106,2 +106,3 @@ # Bloomreach SPA SDK | ||
`isMetaComment(value): boolean` | Checks whether a value is a meta-data comment. | ||
`isPagination(value): boolean` | Checks whether a value is a pagination. | ||
`isLink(value): boolean` | Checks whether a value is a link. | ||
@@ -123,2 +124,4 @@ `isReference(value): boolean` | Checks whether a value is a content reference. | ||
`TYPE_LINK_RESOURCE` | Link to a CMS resource. | ||
`TYPE_MANAGE_MENU_BUTTON` | A manage menu button. | ||
`TYPE_MANAGE_CONTENT_BUTTON` | A manage content button. | ||
@@ -131,6 +134,8 @@ #### Objects | ||
--- | --- | ||
`getButton(type: string, ...params: any[]): MetaCollection` | Generates a meta-data collection for the Experience Manager buttons. | ||
`getChannelParameters(): object` | Gets current channel parameters. | ||
<code>getComponent(...componentNames): Component | undefined</code> | Gets a component in the page (e.g. `getComponent('main', 'right')`). If `componentNames` is omitted, then the page root component will be returned. | ||
<code>getContent<T>(reference: Reference | string): Content | T | undefined</code> | Gets a content item used on the page. | ||
<code>getDocument<T>(): T | undefined</code> | Gets the page root document. This option is available only along with the Experience Pages feature. | ||
`getMeta(meta): MetaCollection` | Generates a meta-data collection from the provided `meta` model. | ||
`getMeta(meta): MetaCollection` | Generates a meta-data collection from the provided `meta` model. The method is **deprecated** and will be removed in the next major release. | ||
<code>getTitle(): string | undefined</code> | Gets the title of the page, or `undefined` if not configured. | ||
@@ -174,2 +179,3 @@ `getUrl(link?: Link): string` | Generates a URL for a link object.<br> - If the link object type is internal, then it will prepend `spaBaseUrl` or `baseUrl`. In case when the link starts with the same path as in `cmsBaseUrl`, this part will be removed.<br> - If the link object type is unknown, then it will return `undefined`.<br> - If the link parameter is omitted, then the link to the current page will be returned.<br> - In other cases, the link will be returned as-is. | ||
--- | --- | ||
<code>getLabel(): string | undefined</code> | Returns the label of a container item catalogue component. | ||
<code>getType(): string | undefined</code> | Returns the type of a container item. The available types depend on which container items have been configured in the backend (e.g. "Banner"). | ||
@@ -261,3 +267,3 @@ `isHidden(): boolean` | Returns whether the component should not render anything. Hiding components is only possible with the Relevance feature. | ||
`clear(): void` | Clears previously rendered meta-data objects. | ||
`render(head: HTMLElement, tail: HTMLElement): void;` | Renders meta-data objects on the page. | ||
`render(head: HTMLElement, tail: HTMLElement): () => void;` | Renders meta-data objects on the page and returns the callback clearing rendered objects. | ||
@@ -272,2 +278,27 @@ ##### Meta | ||
##### Pagination | ||
The `Pagination` object holds the pagination data with all the pagination items. | ||
Method | Description | ||
--- | --- | ||
`getCurrent(): PaginationItem` | Returns the current page. | ||
`getFirst(): PaginationItem` | Returns the first page. | ||
`getItems(): Reference[]` | Returns the current page items. | ||
`getLast(): PaginationItem` | Returns the last page. | ||
<code>getNext(): PaginationItem | undefined</code> | Returns the next page. | ||
`getOffset(): number` | Returns the number of items before the current page. | ||
`getPages(): PaginationItem[]` | Returns currently listed pages. | ||
<code>getPrevious(): PaginationItem | undefined</code> | Returns the previous page. | ||
`getSize(): number` | Returns the number of items listed on the current page. | ||
`getTotal(): number` | Returns the total number of items. | ||
`isEnabled(): boolean` | Returns whether the pagination is enabled. | ||
##### PaginationItem | ||
The `PaginationItem` object holds a pagination item that is used by the `Pagination` object. | ||
Method | Description | ||
--- | --- | ||
`getNumber(): number` | Returns the page number. | ||
<code>getUrl(): string | undefined</code> | Returns the page URL. | ||
## Links | ||
@@ -274,0 +305,0 @@ - [SPA integration concept](https://documentation.bloomreach.com/library/concepts/spa-integration/introduction.html). |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
348338
7003
308
+ Addedxmldom@0.4.0(transitive)
- Removedxmldom@0.3.0(transitive)
Updatedxmldom@^0.4