Interface: Bundle
A bundle serves as a container for a set of workflow experience.
Methods
addEventListener()
addEventListener<
K>(event,listener):void
Add an event listener to this bundle.
Type Parameters
K
K extends keyof BundleEventMap
Parameters
event
K
The event to listen for.
listener
(event) => void
The listener to call when the event occurs.
Returns
void
addProductId()
addProductId(
id):Promise<void>
Parameters
id
string
Returns
Promise<void>
addStakeholder()
addStakeholder(
customerDetails,stakeholderType?):Promise<void>
Add a stakeholder to this bundle. If the stakeholder already exists, it will be updated. Write access to the bundle is required.
Parameters
customerDetails
The details of the customer to add. The emailAddress field is required.
stakeholderType?
The type of stakeholder to add. Defaults to Owner.
Returns
Promise<void>
addWorkflowExperience()
addWorkflowExperience(
experience):Promise<void>
Add another workflow experience to this bundle.
Parameters
experience
The workflow experience to add to this bundle.
Returns
Promise<void>
addWorkflowExperiences()
addWorkflowExperiences(
experiences):Promise<void>
Adds multiple workflow experiences to this bundle.
Parameters
experiences
The workflow experiences to add to this bundle.
Returns
Promise<void>
applyGlobalPropertyState()
applyGlobalPropertyState(
state):Promise<void>
Parameters
state
Pick<GlobalPropertyState, "aspects">
Returns
Promise<void>
approve()
approve(
note?,stakeholderId?):Promise<void>
Parameters
note?
string
stakeholderId?
string
Returns
Promise<void>
assignProductCollection()
assignProductCollection(
productCollectionId):Promise<void>
Assigns a Product Collection to the Bundle.
Parameters
productCollectionId
string
The ID of the Product Collection to assign to this Bundle.
Returns
Promise<void>
attachAddress()
attachAddress(
streetAddress?,apartment?,city?,country?,state?,postCode?):Promise<void>
Parameters
streetAddress?
string
apartment?
string
city?
string
country?
string
state?
string
postCode?
string
Returns
Promise<void>
attachOrganization()
attachOrganization(
name):Promise<void>
Parameters
name
string
Returns
Promise<void>
convertToTemplate()
convertToTemplate(
name?):Promise<GlobalPropertyTemplate>
Converts this Bundle's Global Property State to a new Global Property Template. If no Customer is present in the state, this function will return an error.
Parameters
name?
string
Returns
Promise<GlobalPropertyTemplate>
finish()
finish(
onProgressUpdate?,createPreviewImage?):Promise<BundleDesignCreationMessage>
Finalizes all experiences within the bundle. This will return a promise that resolves when all experiences have been finalized. The promise resolves with a list of messages that indicate the status of each experience including helpful details like what product to add to cart on supported e-commerce platforms.
Parameters
onProgressUpdate?
A callback that will be called when the progress of the finalization changes.
createPreviewImage?
(workflowExperience, shouldRender3D?) => Promise<string | undefined>
A callback that will be called when a preview image is required. This is used to generate a preview image for the design. If this callback is not provided, no preview image will be generated.
Returns
Promise<BundleDesignCreationMessage>
An object containing an array of design messages, along with the Bundle's Id and the event type.
generateQuoteId()
generateQuoteId():
Promise<string>
Returns
Promise<string>
getAllStakeholders()
getAllStakeholders():
Promise<BundleStakeholder[]>
Retrieves all stakeholders associated with this bundle.
Returns
Promise<BundleStakeholder[]>
getChildWorkflowExperiences()
getChildWorkflowExperiences(
parentTransactionId):WorkflowExperience[]
Returns child workflow experiences that belong to a given parent transaction.
Parameters
parentTransactionId
string
Returns
getClient()
getClient():
SpiffCommerceClient
Returns
The client that this bundle is associated with.
getCurrentStakeholder()
getCurrentStakeholder():
Promise<BundleStakeholder|undefined>
Retrieves the current stakeholder for this bundle. This is the stakeholder that has write access to the bundle. If no stakeholder has write access, this will return undefined.
Returns
Promise<BundleStakeholder | undefined>
A promise that resolves with the current stakeholder, or undefined if no stakeholder has write access.
getDispatchDate()
getDispatchDate():
string|undefined
Returns
string | undefined
getGlobalProperties()
getGlobalProperties():
Promise<GlobalPropertyHandle[]>
Get a handle to the global properties available within this bundle. Setting values via this method will make selections on all experiences that share the property.
Returns
Promise<GlobalPropertyHandle[]>
getGlobalPropertyConfiguration()
getGlobalPropertyConfiguration():
GlobalPropertyConfiguration|undefined
Returns
GlobalPropertyConfiguration | undefined
The raw Global Property Configuration that is in use, otherwise undefined.
The Configuration attached to the Bundle's Activation takes precedence over the one attached to its Product Collection.
getGlobalPropertyStateManager()
getGlobalPropertyStateManager():
GlobalPropertyStateManager
Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
Returns
getGlobalPropertyTotalSubunits()
getGlobalPropertyTotalSubunits():
Promise<number>
Get the total in subunits for all global properties in this bundle.
Returns
Promise<number>
getId()
getId():
string
Returns
string
The id of the bundle entity in the Spiff Commerce system.
getInitializationPromise()
getInitializationPromise():
Promise<void>
Returns a promise that resolves when the bundle has been initialized. This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
Returns
Promise<void>
getMetadata()
getMetadata():
Map<string,string>
Returns
Map<string, string>
Custom metadata associated with this bundle.
getName()
getName():
string
Returns
string
The name of the bundle.
getPreviewService()
getPreviewService():
ThreeDPreviewService|undefined
Retrieves the current preview service for this bundle, if one exists.
If a preview service was specified when calling client.getExistingBundle, this will return that service.
Call setPreviewService to update the preview service for this bundle.
Returns
ThreeDPreviewService | undefined
getProductCollection()
getProductCollection():
ProductCollection|undefined
Retrieves the product collection associated with this bundle. If the bundle is not associated with a product collection, this method will return undefined.
Returns
ProductCollection | undefined
getProductIds()
getProductIds():
string[] |undefined
Returns
string[] | undefined
getPurchaseOrder()
getPurchaseOrder():
string|undefined
Returns
string | undefined
getQuoteCompleteMessage()
getQuoteCompleteMessage():
CompleteQuoteMessage
Returns
CompleteQuoteMessage
getQuoteId()
getQuoteId():
string|undefined
Returns
string | undefined
The quote id of the bundle, if it has one. This is used to identify the bundle in the Spiff Commerce system for quoting purposes.
getShareActions()
getShareActions():
ShareAction[] |undefined
Returns
ShareAction[] | undefined
getTemplate()
getTemplate():
boolean
Returns
boolean
True if this bundle is a template, false otherwise.
getTest()
getTest():
boolean
Returns
boolean
True if this bundle is a test bundle, false otherwise.
getTopLevelWorkflowExperiences()
getTopLevelWorkflowExperiences():
WorkflowExperience[]
Returns only top-level workflow experiences (excludes child transactions that were added as extras/add-ons via Product Steps).
Returns
getTotalSubunits()
getTotalSubunits():
number
Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
Returns
number
getWorkflowExperienceCount()
getWorkflowExperienceCount():
number
Returns
number
The number of workflow experiences in this bundle.
getWorkflowExperiences()
getWorkflowExperiences():
WorkflowExperience[]
Returns all workflow experiences currently added to this bundle.
Returns
getWorkflowViewerAmendLink()
getWorkflowViewerAmendLink():
string
Returns
string
getWorkflowViewerLink()
getWorkflowViewerLink():
string
Returns
string
hasGlobalProperties()
hasGlobalProperties():
boolean
Returns true if this bundle is associated with an Activation or a Product Collection that is linked to a Global Property Configuration
Returns
boolean
insertWorkflowExperience()
insertWorkflowExperience(
experience,index):Promise<void>
Inserts the given workflow experience into the bundle at the given index.
NOTE: If you intend to insert a workflow experience at the end of the bundle, use addWorkflowExperience instead as it is more efficient.
Parameters
experience
The workflow experience to insert.
index
number
The index to insert the workflow experience at.
Returns
Promise<void>
placeOrder()
placeOrder():
Promise<Order>
A convenience function allowing you to place an order with all the items in the bundle.
Returns
Promise<Order>
reject()
reject(
note?,stakeholderId?):Promise<void>
Parameters
note?
string
stakeholderId?
string
Returns
Promise<void>
removeEventListener()
removeEventListener<
K>(event,listener):void
Remove a previously added event listener from this bundle.
Type Parameters
K
K extends keyof BundleEventMap
Parameters
event
K
listener
(event) => void
Returns
void
removeProductIds()
removeProductIds(
ids):Promise<void>
Parameters
ids
string[]
Returns
Promise<void>
removeStakeholder()
removeStakeholder(
emailAddress):Promise<void>
Removes a stakeholder from this bundle. Write access to the bundle is required.
Parameters
emailAddress
string
The email address of the stakeholder to remove.
Returns
Promise<void>
removeWorkflowExperience()
removeWorkflowExperience(
experience):Promise<void>
Remove a workflow experience from this bundle.
Parameters
experience
The workflow experience to remove from this bundle.
Returns
Promise<void>
removeWorkflowExperienceByTransaction()
removeWorkflowExperienceByTransaction(
transaction):Promise<void>
Remove a workflow experience from this bundle by transaction.
Parameters
transaction
The transaction to remove from this bundle.
Returns
Promise<void>
removeWorkflowExperiences()
removeWorkflowExperiences(
experiences):Promise<void>
Removes multiple workflow experiences from this bundle.
Parameters
experiences
The workflow experiences to remove from this bundle.
Returns
Promise<void>