Label Workflow Element
The Label Workflow Element streamlines the implementation process by eliminating the need to instantiate individual elements (Purchase Label, Shipment Summary, Void Label).
Under the hood, using a shipmentId, salesOrderId, or externalShipmentId the Label Workflow Element will check for labels and determine which step of the label purchase process needs to be displayed.
NOTE:
If any labels (active or voided) correspond to the provided ID, the Shipment Summary Element will be displayed.
If a salesOrderId is provided, the Label Workflow will first check for the corresponding shipments. While ShipEngine Sales Orders have a one-to-many relationship with Shipments, the Label Workflow is designed to handle only one Shipment at a time. If you plan to use the Label Workflow Element with Sales Orders, we recommend that you limit one Shipment to each Sales Order. Initially, the workflow will search for shipments with a status of pending indicating that these shipments are eligible for purchase. A new shipment will be created if one cannot be found using the provided salesOrderId.
Check out the shipment documentation to learn more about Shipments and their statuses.
NOTE:
It is recommended to initialize a workflow Element as a whole; however, all nested Elements can be instantiated individually.
To hydrate the Label Workflow Element with shipment data, you can provide a salesOrderId, shipmentId, or externalShipmentId; a new shipment will be created as a side-effect if a salesOrderId is provided. Check out the Sales Order documentation to learn more about making a sales order.
NOTE:
If you are using Sales Orders and created them with either
externalOrderId,externalOrderNumber,ororderSourceCode,you can use that to hydrate the Label Workflow Element.
React Component
SDK
The Label Workflow takes all of the Props/Arguments that the Purchase Label, Shipment Summary, and Void Label Element with a few minor adjustments. First, rather than individually accepting each shipment entity ID, the Label Workflow accepts a multiplexedId prop containing any ShipEngine entity IDs used to associate shipments. Second, to provide some differentiation between props, the void label callback was renamed to be more conspicuous. Lastly, the features props of each Element are combined into a single features prop.
| Args/Props | Description |
|---|---|
callbacks | object, optional DEPRECATED An optional set of callbacks that will be invoked at various points in the Label Purchase Workflow. See below for more information |
features | object, optional A set of features to be enabled or disabled. See features |
multiplexedId | object, optional A unique pattern of props that help index which Element is being displayed. See below for more information |
onVoidLabelComplete | object, optional The Void Label onComplete callback renamed. A function that will be invoked when the request to void a given shipping label is completed. |
onVoidLabelSuccess | object, optional The Void Label onSuccess callback renamed. A function that will be invoked when the request to void a given shipping label is successful. |
Features
Features are optional configuration keys used to customize the label workflow experience. Any features in the Label Workflow Element will override what is set in the features prop/argument within the ElementsProvider or ElementsSDK constructor. We recommend setting these within the feature prop/argument within the ElementsProvider or the ElementsSDK class constructor.
| Features | Description |
|---|---|
purchaseLabelFeatures | object, optional See Purchase Label Features for a comprehensive list of configurable features. |
shipmentSummaryFeatures | object, optional See Shipment Summary Features for a comprehensive list of configurable features. |
Callbacks
WARNING:
The
callbacksprop has been deprecated as of Elements version 2.15.0. The Label Workflow has been updated to directly accept all the props available on each of the individual Elements (Purchase Label, Shipment Summary, and Void Label Element), including those previously available in the callbacks prop.
| ID | Description |
|---|---|
onLabelCreateSuccess | function, optional An optional callback function that will be invoked when a label has been successfully purchased. |
onVoidLabelComplete | function, optional An optional callback function that will be invoked when voiding a label has been completed. |
onVoidLabelSuccess | function, optional An optional callback function that will be invoked when a label has been successfully voided. |
Multiplexed ID
| ID | Description |
|---|---|
externalOrderId | string, optional The Order ID used by an external order source (i.e. PayPal, Shopify, eBay, etc.) |
externalOrderNumber | string, optional The Order number used by an external order source (i.e. PayPal, Shopify, eBay, etc.) |
externalShipmentId | string, optional A unique external ID applied on creation of a ShipEngine Shipment is used to identify a Shipment. A new one-off shipment will be created if a shipment can't be found by the provided external Id |
orderSourceCode | string, optional The API code used to identify the type of Order Source. |
salesOrderId | string, optional The ShipEngine Sales Order ID is used to identify the order. |
shipmentId | string, optional The ShipEngine Shipment ID used to identify the shipment. |