Module: channel
Functions
setExtensions
▸ setExtensions(extensions
): void
Parameters
Name | Type |
---|---|
extensions | extensions |
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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type | Description |
---|---|---|
type | MESSAGE_TYPE | Choose a type of action from the send-types |
data | MessageDataType <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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type | Description |
---|---|---|
type | MESSAGE_TYPE | Choose 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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
type | MESSAGE_TYPE |
data | ShopwareMessageTypes [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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
type | MESSAGE_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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
messageType | MESSAGE_TYPE |
baseMessageOptions | MessageDataType <MESSAGE_TYPE > |
Returns
fn
▸ (messageOptions?
): Promise
<ShopwareMessageTypes
[MESSAGE_TYPE
][``"responseType"``]>
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
BASE_OPTIONS | extends Partial <MessageDataType <MESSAGE_TYPE >> |
Parameters
Name | Type |
---|---|
messageType | MESSAGE_TYPE |
baseMessageOptions | BASE_OPTIONS |
Returns
fn
▸ (messageOptions
): Promise
<ShopwareMessageTypes
[MESSAGE_TYPE
][``"responseType"``]>
Parameters
Name | Type |
---|---|
messageOptions | Omit <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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
messageType | MESSAGE_TYPE |
Returns
fn
▸ (messageOptions
): Promise
<ShopwareMessageTypes
[MESSAGE_TYPE
][``"responseType"``]>
Parameters
Name | Type |
---|---|
messageOptions | MessageDataType <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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
messageType | MESSAGE_TYPE |
Returns
fn
▸ (method
): () => void
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Parameters
Name | Type |
---|---|
messageType | MESSAGE_TYPE |
Returns
fn
▸ (method
, id?
): () => void
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
data | Omit <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
Name | Type |
---|---|
TYPE | extends 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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Type declaration
Name | Type |
---|---|
_type | MESSAGE_TYPE |
_data | MessageDataType <MESSAGE_TYPE > |
_callbackId | string |
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
Name | Type |
---|---|
MESSAGE_TYPE | extends keyof ShopwareMessageTypes |
Type declaration
Name | Type |
---|---|
_type | MESSAGE_TYPE |
_response | ShopwareMessageTypes [MESSAGE_TYPE ][``"responseType"``] | null |
_callbackId | string |
Defined in
packages/admin-sdk/src/channel.ts:65