9.0.10076 • Published 4 years ago

@acoustic-content-sdk/component-utils v9.0.10076

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

npm

Framework independent collection of utility functions to implement services and components for sites next.

Table of Contents

Home > @acoustic-content-sdk/component-utils

component-utils package

Framework independent collection of utility functions to implement services and components for sites next.

Classes

ClassDescription
AbstractComponentResolverServiceBase class for component type resolvers
AbstractComponentsService
AbstractDeliverySearchResolverService
AbstractLayoutMappingResolver
AbstractLayoutResolverService
AbstractProtectedContentServiceService to tell whether or not to serve protected content
AbstractRenderingContextResolverServiceImplementation of a service that resolves the outbound parts of a rendering context
AbstractWchPageService

Functions

FunctionDescription
assertSameOrigin(aLeft, aRight, aLogSvc)Validates that the origin of both windows is the same, otherwise throws an exception
createLayoutComponentDecorator(aComponentConsumer, aLayoutMappingConsumer)Layout decorator and metadata.
createLayoutMappingDecorator(aLayoutMappingConsumer)Constructs the laout mapping decorator. Will callback the given function with the decorated object
getEditHostWindow(aCurrentWindow)Returns the window that controls the application. This is either the parent window or the opener window.

Interfaces

InterfaceDescription
AbstractRegisteredComponent
AbstractRegisteredLayoutMapping

Variables

VariableDescription
DEFAULT_LAYOUT_IDname of the default layout
PAGE_NOT_FOUND_LAYOUT_ID
selectId
selectIdFromRenderingContext
selectMetadata
VERSIONVersion and build number of the package

Type Aliases

Type AliasDescription
SendRequest

Home > @acoustic-content-sdk/component-utils > AbstractComponentResolverService

AbstractComponentResolverService class

Base class for component type resolvers

Signature:

export declare class AbstractComponentResolverService<TYPE> implements AbstractComponentResolver<TYPE> 

Constructors

ConstructorModifiersDescription
(constructor)(aComponentsService, aLayoutResolverService, aLayoutMappingService, aComponentTypeRefResolvers, aLogSvc)Constructs a new instance of the AbstractComponentResolverService class

Properties

PropertyModifiersTypeDescription
resolveComponent(aRenderingContext: RenderingContextV2, aLayoutMode?: string) => Observable<TYPE>

Home > @acoustic-content-sdk/component-utils > AbstractComponentsService

AbstractComponentsService class

Signature:

export declare class AbstractComponentsService<TYPE> implements AbstractComponentsRegistry<TYPE> 

Constructors

ConstructorModifiersDescription
(constructor)(aDefaultComponent, aPredicate, aLogSvc)Initializes our constructor. We make sure to keep all private instance variables as part of the closure and override the methods on the instance level. Since this is a singleton service, that approach does not cause a performance problem.

Properties

PropertyModifiersTypeDescription
getTypeByLayout(aLayout: Layout, aLayoutMode?: string) => Observable<TYPE>Returns the type object based on the layout configuration
getTypeBySelector(aSelector: string, aLayoutMode?: string) => Observable<TYPE>Returns the type object based on the layout selector
registerType(aController: string | string[], aType: TYPE, aLayoutModes?: string | string[]) => voiddefine the methods

Home > @acoustic-content-sdk/component-utils > AbstractDeliverySearchResolverService

AbstractDeliverySearchResolverService class

Signature:

export declare class AbstractDeliverySearchResolverService implements DeliverySearchResolver 

Constructors

ConstructorModifiersDescription
(constructor)(aFetchText, aProtected, aSeedResolver, aLogSvc)Constructs a new instance of the AbstractDeliverySearchResolverService class

Properties

PropertyModifiersTypeDescription
getDeliverySearchResults<T>(aQuery: QueryInput, aClassification: string) => Observable<SearchResults<T>>

Home > @acoustic-content-sdk/component-utils > AbstractLayoutMappingResolver

AbstractLayoutMappingResolver class

Signature:

export declare class AbstractLayoutMappingResolver implements LayoutMappingResolver 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the AbstractLayoutMappingResolver class

Properties

PropertyModifiersTypeDescription
getSelector(aLayoutMode: string, aRenderingContext: RenderingContextV2) => string | undefinedReturns the layout selector based on the rendering context
registerMapping(aId: string | string[], aSelector: string | string[], aLayoutMode?: string | string[]) => voidRegisters a layout mapping

Home > @acoustic-content-sdk/component-utils > AbstractLayoutResolverService

AbstractLayoutResolverService class

Signature:

export declare class AbstractLayoutResolverService implements LayoutResolver 

Constructors

ConstructorModifiersDescription
(constructor)(aDeliveryTypeResolver, aDeliveryLayoutMappingResolver, aDeliveryLayoutResolver, aLogSvc)Constructs a new instance of the AbstractLayoutResolverService class

Properties

PropertyModifiersTypeDescription
resolveLayout(aLayoutMode: string, aRenderingContext: RenderingContextV2) => Observable<Layout>

Home > @acoustic-content-sdk/component-utils > AbstractProtectedContentService

AbstractProtectedContentService class

Service to tell whether or not to serve protected content

Signature:

export declare class AbstractProtectedContentService implements ProtectedContent 

Constructors

ConstructorModifiersDescription
(constructor)(aUrlConfig$, aAuthStatus, aLogSvc)Constructs a new instance of the AbstractProtectedContentService class

Properties

PropertyModifiersTypeDescription
protected$Observable<boolean>

Home > @acoustic-content-sdk/component-utils > AbstractRenderingContextResolverService

AbstractRenderingContextResolverService class

Implementation of a service that resolves the outbound parts of a rendering context

Signature:

export declare class AbstractRenderingContextResolverService implements RenderingContextResolver 

Constructors

ConstructorModifiersDescription
(constructor)(aDeliveryContentResolver, aLogSvc)Constructs a new instance of the AbstractRenderingContextResolverService class

Properties

PropertyModifiersTypeDescription
resolveRenderingContext(aItem: RenderingContextInput, aProvider: RenderingContextProviderV2) => Observable<RenderingContextV2>

Home > @acoustic-content-sdk/component-utils > AbstractWchPageService

AbstractWchPageService class

Signature:

export declare class AbstractWchPageService implements WchPageService 

Constructors

ConstructorModifiersDescription
(constructor)(aDeliveryPageResolver, aUrlConfig$, aLogSvc)Constructs a new instance of the AbstractWchPageService class

Properties

PropertyModifiersTypeDescription
getRenderingContextByPath(aPath: string) => Observable<RenderingContextV2 | null | undefined>Resolves the rendering context given the path

Home > @acoustic-content-sdk/component-utils > assertSameOrigin

assertSameOrigin() function

Validates that the origin of both windows is the same, otherwise throws an exception

Signature:

export declare function assertSameOrigin(aLeft: WindowType, aRight: WindowType, aLogSvc?: LoggerService): void;

Parameters

ParameterTypeDescription
aLeftWindowTypeleft window to check
aRightWindowTyperight window to check
aLogSvcLoggerServiceoptionally the logger service

Returns:

void

Home > @acoustic-content-sdk/component-utils > createLayoutComponentDecorator

createLayoutComponentDecorator() function

Layout decorator and metadata.

Signature:

export declare function createLayoutComponentDecorator<TYPE, DIRECTIVE extends AbstractLayoutComponentDirective>(aComponentConsumer: BiConsumer<TYPE, AbstractRegisteredComponent<TYPE, DIRECTIVE>>, aLayoutMappingConsumer: BiConsumer<TYPE, AbstractRegisteredLayoutMapping<TYPE>>): <T extends TYPE>(aDirective?: DIRECTIVE) => (cls: T) => void;

Parameters

ParameterTypeDescription
aComponentConsumerBiConsumer<TYPE, AbstractRegisteredComponent<TYPE, DIRECTIVE>>
aLayoutMappingConsumerBiConsumer<TYPE, AbstractRegisteredLayoutMapping<TYPE>>

Returns:

<T extends TYPE>(aDirective?: DIRECTIVE) => (cls: T) => void

Home > @acoustic-content-sdk/component-utils > createLayoutMappingDecorator

createLayoutMappingDecorator() function

Constructs the laout mapping decorator. Will callback the given function with the decorated object

Signature:

export declare function createLayoutMappingDecorator<TYPE>(aLayoutMappingConsumer: BiConsumer<TYPE, AbstractRegisteredLayoutMapping<TYPE>>): <T extends TYPE>(aID: string | string[] | LayoutMappingDirective, aSelector?: string | string[] | TYPE, aLayoutMode?: string | string[]) => (cls: T) => void;

Parameters

ParameterTypeDescription
aLayoutMappingConsumerBiConsumer<TYPE, AbstractRegisteredLayoutMapping<TYPE>>

Returns:

<T extends TYPE>(aID: string | string[] | LayoutMappingDirective, aSelector?: string | string[] | TYPE, aLayoutMode?: string | string[]) => (cls: T) => void

Home > @acoustic-content-sdk/component-utils > getEditHostWindow

getEditHostWindow() function

Returns the window that controls the application. This is either the parent window or the opener window.

Signature:

export declare function getEditHostWindow(aCurrentWindow: WindowType): WindowType;

Parameters

ParameterTypeDescription
aCurrentWindowWindowTypethe current window

Returns:

WindowType

the controlling window

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredComponent

AbstractRegisteredComponent interface

Signature:

export interface AbstractRegisteredComponent<TYPE, DIRECTIVE extends AbstractLayoutComponentDirective> 

Properties

PropertyTypeDescription
directiveDIRECTIVE
typeTYPE

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredLayoutMapping

AbstractRegisteredLayoutMapping interface

Signature:

export interface AbstractRegisteredLayoutMapping<TYPE> 

Properties

PropertyTypeDescription
idstring | string[]Type IDs or content IDs to map this to
kindCONTENT_ITEM_KIND | CONTENT_ITEM_KIND[]Type IDs to map this to
layoutModestring | string[]An optional layout mode used with this layout mapping.
selectorstring | string[] | TYPEDefines the mapping between the layout controller to the layout implementation. If this property is missing, the selector of the component will be used instead.

Home > @acoustic-content-sdk/component-utils > DEFAULT_LAYOUT_ID

DEFAULT_LAYOUT_ID variable

name of the default layout

Signature:

DEFAULT_LAYOUT_ID = "wch-default-layout"

Home > @acoustic-content-sdk/component-utils > PAGE_NOT_FOUND_LAYOUT_ID

PAGE_NOT_FOUND_LAYOUT_ID variable

Signature:

PAGE_NOT_FOUND_LAYOUT_ID = "wch-404"

Home > @acoustic-content-sdk/component-utils > selectId

selectId variable

Signature:

selectId: import("rxjs").UnaryFunction<any, any>

Home > @acoustic-content-sdk/component-utils > selectIdFromRenderingContext

selectIdFromRenderingContext variable

Signature:

selectIdFromRenderingContext: import("rxjs").UnaryFunction<any, string>

Home > @acoustic-content-sdk/component-utils > selectMetadata

selectMetadata variable

Signature:

selectMetadata: import("rxjs").UnaryFunction<DeliveryReferenceElement | DeliveryContentItem | DeliveryGroupElement | RenderingContextV2, import("@acoustic-content-sdk/api").DeliveryGroupElementMetadata | import("@acoustic-content-sdk/api").DeliveryReferenceElementMetadata | import("@acoustic-content-sdk/api").DeliveryContentMetadata>

Home > @acoustic-content-sdk/component-utils > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

Home > @acoustic-content-sdk/component-utils > SendRequest

SendRequest type

Signature:

export declare type SendRequest = <T>(aUrl: string, aCredentials: boolean) => Observable<T>;

Home > @acoustic-content-sdk/component-utils > AbstractComponentResolverService > (constructor)

AbstractComponentResolverService.(constructor)

Constructs a new instance of the AbstractComponentResolverService class

Signature:

protected constructor(aComponentsService: AbstractComponentsService<TYPE>, aLayoutResolverService: LayoutResolver, aLayoutMappingService: LayoutMappingResolver, aComponentTypeRefResolvers?: AbstractComponentTypeRefResolver<TYPE>[], aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aComponentsServiceAbstractComponentsService<TYPE>
aLayoutResolverServiceLayoutResolver
aLayoutMappingServiceLayoutMappingResolver
aComponentTypeRefResolversAbstractComponentTypeRefResolver<TYPE>[]
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractComponentResolverService > resolveComponent

AbstractComponentResolverService.resolveComponent property

Signature:

resolveComponent: (aRenderingContext: RenderingContextV2, aLayoutMode?: string) => Observable<TYPE>;

Home > @acoustic-content-sdk/component-utils > AbstractComponentsService > (constructor)

AbstractComponentsService.(constructor)

Initializes our constructor. We make sure to keep all private instance variables as part of the closure and override the methods on the instance level. Since this is a singleton service, that approach does not cause a performance problem.

Signature:

protected constructor(aDefaultComponent: TYPE, aPredicate: EqualsPredicate<TYPE>, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aDefaultComponentTYPE
aPredicateEqualsPredicate<TYPE>
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractComponentsService > getTypeByLayout

AbstractComponentsService.getTypeByLayout property

Returns the type object based on the layout configuration

Signature:

getTypeByLayout: (aLayout: Layout, aLayoutMode?: string) => Observable<TYPE>;

Home > @acoustic-content-sdk/component-utils > AbstractComponentsService > getTypeBySelector

AbstractComponentsService.getTypeBySelector property

Returns the type object based on the layout selector

Signature:

getTypeBySelector: (aSelector: string, aLayoutMode?: string) => Observable<TYPE>;

Home > @acoustic-content-sdk/component-utils > AbstractComponentsService > registerType

AbstractComponentsService.registerType property

define the methods

Signature:

registerType: (aController: string | string[], aType: TYPE, aLayoutModes?: string | string[]) => void;

Home > @acoustic-content-sdk/component-utils > AbstractDeliverySearchResolverService > (constructor)

AbstractDeliverySearchResolverService.(constructor)

Constructs a new instance of the AbstractDeliverySearchResolverService class

Signature:

protected constructor(aFetchText: FetchText, aProtected: ProtectedContent, aSeedResolver?: SeedResolver, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aFetchTextFetchText
aProtectedProtectedContent
aSeedResolverSeedResolver
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractDeliverySearchResolverService > getDeliverySearchResults

AbstractDeliverySearchResolverService.getDeliverySearchResults property

Signature:

getDeliverySearchResults: <T>(aQuery: QueryInput, aClassification: string) => Observable<SearchResults<T>>;

Home > @acoustic-content-sdk/component-utils > AbstractLayoutMappingResolver > (constructor)

AbstractLayoutMappingResolver.(constructor)

Constructs a new instance of the AbstractLayoutMappingResolver class

Signature:

protected constructor();

Home > @acoustic-content-sdk/component-utils > AbstractLayoutMappingResolver > getSelector

AbstractLayoutMappingResolver.getSelector property

Returns the layout selector based on the rendering context

Signature:

getSelector: (aLayoutMode: string, aRenderingContext: RenderingContextV2) => string | undefined;

Home > @acoustic-content-sdk/component-utils > AbstractLayoutMappingResolver > registerMapping

AbstractLayoutMappingResolver.registerMapping property

Registers a layout mapping

Signature:

registerMapping: (aId: string | string[], aSelector: string | string[], aLayoutMode?: string | string[]) => void;

Home > @acoustic-content-sdk/component-utils > AbstractProtectedContentService > (constructor)

AbstractProtectedContentService.(constructor)

Constructs a new instance of the AbstractProtectedContentService class

Signature:

protected constructor(aUrlConfig$: Observable<UrlConfig>, aAuthStatus: AuthStatus, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aUrlConfig$Observable<UrlConfig>
aAuthStatusAuthStatus
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractProtectedContentService > protected$

AbstractProtectedContentService.protected$ property

Signature:

protected$: Observable<boolean>;

Home > @acoustic-content-sdk/component-utils > AbstractLayoutResolverService > (constructor)

AbstractLayoutResolverService.(constructor)

Constructs a new instance of the AbstractLayoutResolverService class

Signature:

protected constructor(aDeliveryTypeResolver: DeliveryTypeResolver, aDeliveryLayoutMappingResolver: DeliveryLayoutMappingResolver, aDeliveryLayoutResolver: DeliveryLayoutResolver, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aDeliveryTypeResolverDeliveryTypeResolver
aDeliveryLayoutMappingResolverDeliveryLayoutMappingResolver
aDeliveryLayoutResolverDeliveryLayoutResolver
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractLayoutResolverService > resolveLayout

AbstractLayoutResolverService.resolveLayout property

Signature:

resolveLayout: (aLayoutMode: string, aRenderingContext: RenderingContextV2) => Observable<Layout>;

Home > @acoustic-content-sdk/component-utils > AbstractWchPageService > (constructor)

AbstractWchPageService.(constructor)

Constructs a new instance of the AbstractWchPageService class

Signature:

protected constructor(aDeliveryPageResolver: DeliveryPageResolver, aUrlConfig$: Observable<UrlConfig>, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aDeliveryPageResolverDeliveryPageResolver
aUrlConfig$Observable<UrlConfig>
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractWchPageService > getRenderingContextByPath

AbstractWchPageService.getRenderingContextByPath property

Resolves the rendering context given the path

Signature:

getRenderingContextByPath: (aPath: string) => Observable<RenderingContextV2 | null | undefined>;

Home > @acoustic-content-sdk/component-utils > AbstractRenderingContextResolverService > (constructor)

AbstractRenderingContextResolverService.(constructor)

Constructs a new instance of the AbstractRenderingContextResolverService class

Signature:

protected constructor(aDeliveryContentResolver: DeliveryContentResolver, aLogSvc?: LoggerService);

Parameters

ParameterTypeDescription
aDeliveryContentResolverDeliveryContentResolver
aLogSvcLoggerService

Home > @acoustic-content-sdk/component-utils > AbstractRenderingContextResolverService > resolveRenderingContext

AbstractRenderingContextResolverService.resolveRenderingContext property

Signature:

resolveRenderingContext: (aItem: RenderingContextInput, aProvider: RenderingContextProviderV2) => Observable<RenderingContextV2>;

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredLayoutMapping > id

AbstractRegisteredLayoutMapping.id property

Type IDs or content IDs to map this to

Signature:

id?: string | string[];

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredLayoutMapping > kind

AbstractRegisteredLayoutMapping.kind property

Type IDs to map this to

Signature:

kind?: CONTENT_ITEM_KIND | CONTENT_ITEM_KIND[];

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredLayoutMapping > layoutMode

AbstractRegisteredLayoutMapping.layoutMode property

An optional layout mode used with this layout mapping.

Signature:

layoutMode?: string | string[];

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredLayoutMapping > selector

AbstractRegisteredLayoutMapping.selector property

Defines the mapping between the layout controller to the layout implementation. If this property is missing, the selector of the component will be used instead.

Signature:

selector: string | string[] | TYPE;

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredComponent > directive

AbstractRegisteredComponent.directive property

Signature:

directive: DIRECTIVE;

Home > @acoustic-content-sdk/component-utils > AbstractRegisteredComponent > type

AbstractRegisteredComponent.type property

Signature:

type: TYPE;