Skip to main content

DGW.mount

Usage: DGW.mount(opts);

The opts object properties

Property name and formatDescription
containerId: stringThe HTML ID of the container to which you mount the instance.
container: HTMLElementThe HTML element to which you mount the instance.
sessionId: stringPass the session ID from the backend into this field.
merchantId: stringThe merchant ID from your Delivery Gateway account. If you use this property, the web plugin will handle session creation for you.
view: DgwViewAn object describing the view to be displayed. The type field defines the view.

Additional fields for the view property

Field name and formatDescriptionAdditional fields
type: "delivery-method-selection"This view provides a delivery method selector with methods that can be enabled or disabled on the Delivery Gateway admin panel.- openSelectedMethodInModal: boolean: Flag indicating whether the pickup point selector and address selector components should be opened in a modal window, or in place (default: true).
- operatorsAsSeparateMethods: boolean: Setting this flag to true will cause all pickup point providers to be rendered as separate checkboxes.
- showHomeDeliveryOperatorIcons: boolean: Controls whether the icons of available providers for home delivery are displayed on the delivery method selector.
type: "pickup-point-selection"This view renders a standalone pickup point selector for cases where you want to handle delivery method selection with your own solution, or pickup point delivery is the only method you provide.- openInModal: boolean: Setting this flag to true will cause the pickup point selector modal to open immediately. Recommended with hideMainLoadingIndicator also set to true. Closing the modal unmounts the instance and calls the onClose callback.
- hideMainLoadingIndicator: boolean: Hides the main loading indicator normally visible during initialization and after a pickup point has been selected.
- selectedOperatorFilters: OperatorEnum[]: An array of OperatorEnum values that will be selected in the operator filter panel by default.
- ownShopFilterSelected: boolean: Controls whether the filter for own shops will be selected by default.
type: "profile-page-addresses"Renders an address management form where users can create new addresses, or edit and delete their existing addresses. Can be used as a drop-in address management solution for profile pages. Saved addresses only work with a session created using the Merchant API.

Optional properties

Property name and formatDescription
onAddressSelected?(result: AddressSelectionResult): Promise<DgwUserDataValidationResult> | voidA callback that will be called when the user has selected a pickup point, or an address for home delivery. If this callback returns a Promise, the Web Plugin will await it, and if the isValid field isn’t set to true, it will show the recipient form again with any field error messages displayed in the corresponding recipient fields.
onClosed()?: voidThis callback is called when the pickup point selector is closed by the user.
recipient?: Partial<DgwRecipient>An optional, partial DgwRecipient object that may be provided to pre-fill recipient data during both pickup point selection and address selection.

The returned DGW instance fields

Field name and formatDescription
unmount(): voidImmediately unmounts the instance, removing all content from the container.
isMounted(): booleanReturns a boolean indicating whether the instance is still mounted.