CoolCMS API

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 through window.addEventListener('message', ...) with event.data.message === eventName.
  • customEvent: PPL 2.0, <script src="scriptUrl"> plus the Web Component <elementTag>, the result arrives through elementTag.addEventListener(eventName, ...) in event.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

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
On this page

Search results