Unified Shipping Module - Data Model

Types used in configuration options

Contents

Type Reference

ShippingOption

A ShippingOption configures the look of a user selectable simple shipping option, without a location or selectable delivery windows

Key Type Allowed values Description
id string Unique identifier for the shipping option
name string Name of the shipping option to be displayed
minDeliveryDays number minimal number of days the delivery needs to reach the destination, if 0 is specified, same-day delivery is assumed
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination. If this is specified, the delivery time will be displayed as "x to y dager"
price Price Price for the shipping option, if not specified, free is assumed
description string Additional description for the shipping text, displayed below the delivery time if specified
logoUrl string A url to a logo image to be displayed for the shipping option. Maximum displayable logo size is 70x37 px. The logo url can be specified as relative to the embedding host, or absolute
additionalData any Any arbitrary data that should be returned when the option is selected. This data is not used by the checkout anywhere, it is just passed through as-is.
updateInterval number Interval for periodic updates of this shipping option in seconds. Periodic updates will only be performedif an update handler function is defined as well
onUpdateOption (callback: updatedProps => void) => void Update handler function for periodic updates. The function passed here gets called on each periodic update with a callback function to pass the updated properties of this shipping option.
default boolean Pre-select this option after initialization
PickupShippingOption

A shipping option where the user can select a location from a list, e.g. for pickup point delivery or self-pickup at a store

Key Type Allowed values Description
id string Unique identifier for the shipping option
name string Name of the shipping option to be displayed
minDeliveryDays number minimal number of days the delivery needs to reach the destination, if 0 is specified, same-day delivery is assumed
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination. If this is specified, the delivery time will be displayed as "x to y dager"
price Price Price for the shipping option, if not specified, free is assumed
description string Additional description for the shipping text, displayed below the delivery time if specified
logoUrl string A url to a logo image to be displayed for the shipping option. Maximum displayable logo size is 70x37 px. The logo url can be specified as relative to the embedding host, or absolute
additionalData any Any arbitrary data that should be returned when the option is selected. This data is not used by the checkout anywhere, it is just passed through as-is.
updateInterval number Interval for periodic updates of this shipping option in seconds. Periodic updates will only be performedif an update handler function is defined as well
onUpdateOption (callback: updatedProps => void) => void Update handler function for periodic updates. The function passed here gets called on each periodic update with a callback function to pass the updated properties of this shipping option.
default boolean Pre-select this option after initialization
locations ShippingLocation[] A list of pickup locations, at least one needs to be specified. If more than one location is specified, a dropdown list is shown
ServiceLevelShippingOption

A shipping option where users can select different levels of service with varying prices and delivery times from a list, e.g. tracked or untracked parcels, standard or premium shipping, etc...

Key Type Allowed values Description
id string Unique identifier for the shipping option
name string Name of the shipping option to be displayed
minDeliveryDays number Will be ignored, as this will be evaluated from the specified service level
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination. If this is specified, the delivery time will be displayed as "x to y dager"
price Price Will be ignored, as the price is individually specified for each service level
description string Additional description for the shipping text, displayed below the delivery time if specified
logoUrl string A url to a logo image to be displayed for the shipping option. Maximum displayable logo size is 70x37 px. The logo url can be specified as relative to the embedding host, or absolute
additionalData any Any arbitrary data that should be returned when the option is selected. This data is not used by the checkout anywhere, it is just passed through as-is.
updateInterval number Interval for periodic updates of this shipping option in seconds. Periodic updates will only be performedif an update handler function is defined as well
onUpdateOption (callback: updatedProps => void) => void Update handler function for periodic updates. The function passed here gets called on each periodic update with a callback function to pass the updated properties of this shipping option.
default boolean Pre-select this option after initialization
levels ShippingServiceLevel[] The different service levels for the delivery service to choose from
PorterbuddyShippingOption

Porterbuddy Shipping presents a matrix where the user can select a delivery window.

Key Type Allowed values Description
id string Unique identifier for the shipping option
name string Name of the shipping option to be displayed
minDeliveryDays number Will be ignored, as this will be evaluated from the specified delivery windows
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination. If this is specified, the delivery time will be displayed as "x to y dager"
price Price Will be ignored, as the price is individually specified for each delivery window
description string Additional description for the shipping text, displayed below the delivery time if specified
logoUrl String Will be ignored, the Porterbuddy logo is built into the consolidated checkout
additionalData any Any arbitrary data that should be returned when the option is selected. This data is not used by the checkout anywhere, it is just passed through as-is.
updateInterval number Interval for periodic updates of this shipping option in seconds. Periodic updates will only be performedif an update handler function is defined as well
onUpdateOption (callback: updatedProps => void) => void Update handler function for periodic updates. The function passed here gets called on each periodic update with a callback function to pass the updated properties of this shipping option.
default boolean Pre-select this option after initialization
deliveryWindows DeliveryWindow[] The available delivery windows for delivering to the recipient
discount number Discount to be applied on all delivery window shown, specified as hundreds of a value unit (e.g. discount=5000 for a price reduction by 50 NOK)
ShippingLocation

A location for either pickup point delivery or store pickup

Key Type Allowed values Description
id string A unique id for the shipping location
name string Name of the location, to be displayed in the option card
address string Address of the location, to be displayed in the option card
openingHours string Opening hours of the location (arbitrary string)
logoUrl string A url to a logo image to be displayed for the location. Maximum displayable logo size is 70x37 px. The logo url can be specified as relative to the embedding host, or absolute. If a location with a logo is selected, the logo for the whole option is set to the one for the location
description string Additional description for the shipping location, will be displayed below the other fields if present
ShippingServiceLevel

A selected service level for a shipping carrier

Key Type Allowed values Description
id string A unique id for the shipping service level
name string Name of the shipping service level, to be displayed in the option card
minDeliveryDays number minimal number of days the delivery needs to reach the destination, if 0 is specified, same-day delivery is assumed
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination. If this is specified, the delivery time will be displayed as "x to y dager"
price Price Price for the shipping option, if not specified, free is assumed
description string Additional description for the shipping service level, will be displayed below the other fields if present
Price

A price for a shipping option

Key Type Allowed values Description
fractionalDenomination number The price amount on a base of 1/100 of the specified currency, e.g. a fractional denomination of 4900 describes a price of 49,00
currency string NOK A currency code. Currently, only "NOK" is supported
DeliveryWindow

A delivery window for Porterbuddy deliveries

Key Type Allowed values Description
product string delivery The delivery product. Currently, only "delivery" is available
start string Start time of the delivery window in iso format
end string End time of the delivery window in iso format
price Price Price for this delivery window
displayPrice Price Display price for this delivery window, shown instead of the price
consolidated boolean Indicates if this delivery window can be used to consolidate with an existing delivery
ShippingCategory

A shipping category. Supported values are "home", "pickupPoint" and "store"

SelectedShipping

Data for the currently selected shipping option

Key Type Allowed values Description
id string Unique id of the selected shipping option
price Price Price of the selected shipping option as displayed
minDeliveryDays number minimal number of days the delivery needs to reach the destination
maxDeliveryDays number maximum number of the days the delivery might need to reach the destination
data ShippingLocation | ShippingServiceLevel | SelectedPorterbuddyOption Additional data to describe the selected option. Only present if the selected option is PickupShippingOption or PorterbuddyShippingOption
additionalData any Arbitrary data that was specified in the Shipping Option definition and was passed-through as-is.
SelectedPorterbuddyOption

Additional data for a currently selected porterbuddy delivery option

Key Type Allowed values Description
deliveryWindow DeliveryWindow The selected delivery window
deliveryWindowIndex number index of the selected delivery window
SelectionPropertyChangeListener

Definition for a listener for property changes when a shipping option is selected

Key Type Allowed values Description
optionId string the id of the shipping option to listen to
propertyPath string Path of the property to listen for changes
onChange (value: any) => void Function to be called on property changes
RecipientInfo

Info about the recipient of a delivery

Key Type Allowed values Description
postCode string Recipient's postcode
email string E-Mail address of the recipient
CheckoutCallbacks

Callback functions to interact with the widget from external scripts

Key Type Allowed values Description
forceRefresh () => Promise<Void> Completely refreshes the checkout with the current value of the options object. Current selections will be lost.
setRecipientInfo (recipientInfo: RecipientInfo) => void Sets the recipient info and updates the delivery option properties from the current state of the options object
refreshShippingOptions () => void Refreshes the currently displayed shipping options with the values from the configuration object
ColorScheme

Color Scheme definition to override the default colors

Key Type Allowed values Description
base string The base color for the color scheme. This color is used for selected elements, default value is #fa9772.Supported values are hex, rgb and hsl color definitions, use of named colors can yield unwanted results!
contrastLight string Light contrast color for the base color, used e.g. for the window in the home category icon, default value is #72f6ff. Supported values are hex, rgb and hsl color definitions
contrastDark string Dark contrast color for the base color, used e.g. for the door in the home category icon, default value is #006698. Supported values are hex, rgb and hsl color definitions