CarrierWidgetConfig
in package
FinalYes
Config for rendering a carrier widget on the front end (checkout step 2).
The three carriers return the selection by three mechanisms; mechanism tells the front
end behavior how to hook into the result:
callback: Packeta,Packeta.Widget.pick(apiKey, callback, options), the result comes directly in the JS callback.postMessage: Balikovna,<iframe src="scriptUrl">, the result arrives throughwindow.addEventListener('message', ...)withevent.data.message === eventName.customEvent: PPL 2.0,<script src="scriptUrl">plus the Web Component<elementTag>, the result arrives throughelementTag.addEventListener(eventName, ...)inevent.detail.
scriptUrl is either the JS library address (Packeta, PPL) or the iframe address
(Balikovna); mechanism tells which.
Table of Contents
Properties
- $apiKey : string|null
- $elementTag : string|null
- $eventName : string|null
- $mechanism : string
- $options : array<string|int, mixed>
- $scriptUrl : string
Methods
- __construct() : mixed
Properties
$apiKey read-only
public
string|null
$apiKey
$elementTag read-only
public
string|null
$elementTag
= null
$eventName read-only
public
string|null
$eventName
= null
$mechanism read-only
public
string
$mechanism
$options read-only
public
array<string|int, mixed>
$options
= []
$scriptUrl read-only
public
string
$scriptUrl
Methods
__construct()
public
__construct(string $scriptUrl, string|null $apiKey, string $mechanism[, array<string, mixed> $options = [] ][, string|null $elementTag = null ][, string|null $eventName = null ]) : mixed
Parameters
- $scriptUrl : string
- $apiKey : string|null
- $mechanism : string
- $options : array<string, mixed> = []
-
config passed to the widget (language, currency, country, weight)
- $elementTag : string|null = null
- $eventName : string|null = null