Skip to main content

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​

CustomerDetailsInput

The details of the customer to add. The emailAddress field is required.

stakeholderType?​

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​

WorkflowExperience

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​

WorkflowExperience[]

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?​

DesignCreationProgressUpdate

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​

WorkflowExperience[]


getClient()​

getClient(): SpiffCommerceClient

Returns​

SpiffCommerceClient

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​

GlobalPropertyStateManager


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​

WorkflowExperience[]


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​

WorkflowExperience[]


getWorkflowViewerAmendLink(): string

Returns​

string


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​

WorkflowExperience

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​

WorkflowExperience

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​

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​

WorkflowExperience[]

The workflow experiences to remove from this bundle.

Returns​

Promise<void>


removeWorkflowExperiencesByTransactions()​

removeWorkflowExperiencesByTransactions(transactions): Promise<void>

Removes multiple workflow experiences from this bundle by their transactions.

Parameters​

transactions​

Transaction[]

The transactions to remove from this bundle.

Returns​

Promise<void>


replaceWorkflowExperience()​

replaceWorkflowExperience(index, experience): Promise<void>

Replaces a workflow experience at the given index with the given workflow experience. This essentially removes the old one and inserts the new one.

Parameters​

index​

number

The index to replace the workflow experience at.

experience​

WorkflowExperience

The workflow experience to replace the old one with.

Returns​

Promise<void>


setBundleOptions()​

setBundleOptions(bundleOptions?): void

Parameters​

bundleOptions?​

BundleOptions

Returns​

void


setDispatchDate()​

setDispatchDate(dd): Promise<void>

Parameters​

dd​

string

Returns​

Promise<void>


setMetadata()​

setMetadata(metadata): Promise<void>

Set custom metadata associated with this bundle.

Parameters​

metadata​

Map<string, string>

Updated map of metadata items.

Returns​

Promise<void>

A promise that resolves when the metadata has been updated in the Spiff Commerce system.


setName()​

setName(name): Promise<void>

Set the name of the bundle.

Parameters​

name​

string

The new name for the bundle.

Returns​

Promise<void>

A promise that resolves when the name has been updated in the Spiff Commerce system.


setNameAndMetadata()​

setNameAndMetadata(name, metadata): Promise<void>

Set the name and metadata for this bundle.

Parameters​

name​

string

The new name for the bundle.

metadata​

Map<string, string>

Updated map of metadata items.

Returns​

Promise<void>

A promise that resolves when the name and metadata have been updated in the Spiff Commerce system.


setPreviewService()​

setPreviewService(previewService?): Promise<void>

Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will also automatically inject the preview service into any new workflow experiences that are added to this bundle. If this method is called with no arguments or undefined, the preview service will be removed from this bundle.

Parameters​

previewService?​

ThreeDPreviewService

The preview service to use for this bundle.

Returns​

Promise<void>

A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.


setPurchaseOrder()​

setPurchaseOrder(po): Promise<void>

Parameters​

po​

string

Returns​

Promise<void>


sortWorkflowExperiences()​

sortWorkflowExperiences(sortFunc): Promise<void>

Sort the list of workflow experiences. The sorting is performed locally, and then the order is updated in the Spiff Commerce system.

Parameters​

sortFunc​

(expA, expB) => number

Returns​

Promise<void>

A promise that resolves when the re-ordering of the workflow experiences has been updated in the Spiff Commerce system. The sorting will occur immediately, but the promise will not resolve until the Spiff Commerce system has been updated.


swapWorkflowExperiences()​

swapWorkflowExperiences(a, b): Promise<void>

Swaps the workflow experiences at the given indices.

Parameters​

a​

number

b​

number

Returns​

Promise<void>


updateStakeholders()​

updateStakeholders(stakeholders): Promise<void>

Updates all stakeholders associated with this bundle. Write access to the bundle is required.

Parameters​

stakeholders​

BundleStakeholderInput[]

An array of stakeholders to update. Unknown stakeholders will be added, and absent stakeholders will be removed.

Returns​

Promise<void>