Skip to main content

Module: channel

Functions

setExtensions

setExtensions(extensions): void

Parameters

NameType
extensionsextensions

Returns

void

Defined in

packages/admin-sdk/src/channel.ts:27


send

send<MESSAGE_TYPE>(type, data, _targetWindow?, _origin?): Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | null>

With this method you can send actions or you can request data:

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameTypeDescription
typeMESSAGE_TYPEChoose a type of action from the send-types
dataMessageDataType<MESSAGE_TYPE>The matching data for the type
_targetWindow?Window-
_origin?string-

Returns

Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | null>

A promise with the response data in the given responseType

Defined in

packages/admin-sdk/src/channel.ts:102


handle

handle<MESSAGE_TYPE>(type, method): () => void

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameTypeDescription
typeMESSAGE_TYPEChoose a type of action from the send-types
method(data: MessageDataType<MESSAGE_TYPE>, additionalInformation: { _event_: MessageEvent<string> }) => ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>This method should return the response value

Returns

fn

The return value is a cancel function to stop listening to the events

▸ (): void

Returns

void

Defined in

packages/admin-sdk/src/channel.ts:263


publish

publish<MESSAGE_TYPE>(type, data, sources?): void

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
typeMESSAGE_TYPE
dataShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]
sources{ source: Window ; origin: string ; sdkVersion: undefined | string }[]

Returns

void

Defined in

packages/admin-sdk/src/channel.ts:398


subscribe

subscribe<MESSAGE_TYPE>(type, method): () => void

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
typeMESSAGE_TYPE
method(data: ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]) => void | Promise<unknown>

Returns

fn

▸ (): void

Returns

void

Defined in

packages/admin-sdk/src/channel.ts:420


createSender

createSender<MESSAGE_TYPE>(messageType, baseMessageOptions): (messageOptions?: MessageDataType<MESSAGE_TYPE>) => Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Factory method which creates a sender so that the type doesn't need to be defined and can be hidden. Also this allows to use a send method without a required second argument if the default options are defined.

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
messageTypeMESSAGE_TYPE
baseMessageOptionsMessageDataType<MESSAGE_TYPE>

Returns

fn

▸ (messageOptions?): Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Parameters
NameType
messageOptions?MessageDataType<MESSAGE_TYPE>
Returns

Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Defined in

packages/admin-sdk/src/channel.ts:434

createSender<MESSAGE_TYPE, BASE_OPTIONS>(messageType, baseMessageOptions): (messageOptions: Omit<MessageDataType<MESSAGE_TYPE>, keyof BASE_OPTIONS>) => Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes
BASE_OPTIONSextends Partial<MessageDataType<MESSAGE_TYPE>>

Parameters

NameType
messageTypeMESSAGE_TYPE
baseMessageOptionsBASE_OPTIONS

Returns

fn

▸ (messageOptions): Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Parameters
NameType
messageOptionsOmit<MessageDataType<MESSAGE_TYPE>, keyof BASE_OPTIONS>
Returns

Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Defined in

packages/admin-sdk/src/channel.ts:439

createSender<MESSAGE_TYPE>(messageType): (messageOptions: MessageDataType<MESSAGE_TYPE>) => Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
messageTypeMESSAGE_TYPE

Returns

fn

▸ (messageOptions): Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Parameters
NameType
messageOptionsMessageDataType<MESSAGE_TYPE>
Returns

Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>

Defined in

packages/admin-sdk/src/channel.ts:444


createHandler

createHandler<MESSAGE_TYPE>(messageType): (method: (data: MessageDataType<MESSAGE_TYPE>, additionalInformation: { _event_: MessageEvent<string> }) => ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>) => () => void

Factory method which creates a handler so that the type don't need to be defined and can be hidden.

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
messageTypeMESSAGE_TYPE

Returns

fn

▸ (method): () => void

Parameters
NameType
method(data: MessageDataType<MESSAGE_TYPE>, additionalInformation: { _event_: MessageEvent<string> }) => ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | Promise<ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]>
Returns

fn

▸ (): void

Returns

void

The return value is a cancel function to stop listening to the events

Defined in

packages/admin-sdk/src/channel.ts:462


createSubscriber

createSubscriber<MESSAGE_TYPE>(messageType): (method: (data: ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]) => void | Promise<unknown>, id?: string) => () => void

Factory method which creates a handler so that the type doesn't need to be defined and can be hidden.

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Parameters

NameType
messageTypeMESSAGE_TYPE

Returns

fn

▸ (method, id?): () => void

Parameters
NameType
method(data: ShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``]) => void | Promise<unknown>
id?string
Returns

fn

▸ (): void

Returns

void

Defined in

packages/admin-sdk/src/channel.ts:475


processDataRegistration

processDataRegistration(data): Promise<void>

Parameters

NameType
dataOmit<datasetRegistration, "responseType">

Returns

Promise<void>

Defined in

packages/admin-sdk/src/channel.ts:566

Type Aliases

extensions

Ƭ extensions: Object

Index signature

[key: string]: extension

Defined in

packages/admin-sdk/src/channel.ts:20


MessageDataType

Ƭ MessageDataType<TYPE>: Omit<ShopwareMessageTypes[TYPE], "responseType">

This type contains the data of the type without the responseType

Type parameters

NameType
TYPEextends keyof ShopwareMessageTypes

Defined in

packages/admin-sdk/src/channel.ts:49


ShopwareMessageSendData

Ƭ ShopwareMessageSendData<MESSAGE_TYPE>: Object

This is the structure of the data which will be send with send

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Type declaration

NameType
_typeMESSAGE_TYPE
_dataMessageDataType<MESSAGE_TYPE>
_callbackIdstring

Defined in

packages/admin-sdk/src/channel.ts:55


ShopwareMessageResponseData

Ƭ ShopwareMessageResponseData<MESSAGE_TYPE>: Object

This is the structure of the data which will be send back when the admin gives a response

Type parameters

NameType
MESSAGE_TYPEextends keyof ShopwareMessageTypes

Type declaration

NameType
_typeMESSAGE_TYPE
_responseShopwareMessageTypes[MESSAGE_TYPE][``"responseType"``] | null
_callbackIdstring

Defined in

packages/admin-sdk/src/channel.ts:65