@spiffcommerce/core 21.9.1 → 21.10.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
2
- import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, Workflow, ILayout, LayoutsState, LayoutData, SilentStepData, Placeable, StepStorage, CanvasCommand, CommandContext, LayoutState, SerializableStep, CommandState, GlobalPropertyConfiguration, AspectType, Asset, MaterialResource, AssetType, StepType, GlobalPropertyConfigurationAspect, Theme, FrameStepData, CreateElementCommand, FrameElement, IllustrationStepData, IllustrationElement, ColorDefinition, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, InformationStepData } from '@spiffcommerce/papyrus';
2
+ import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, Workflow, ILayout, LayoutsState, LayoutData, Asset, MaterialResource, AssetType, StepType, AspectType, CommandState, CommandContext, GlobalPropertyConfigurationAspect, GlobalPropertyConfiguration, Theme, SilentStepData, Placeable, StepStorage, CanvasCommand, LayoutState, SerializableStep, FrameStepData, CreateElementCommand, FrameElement, IllustrationStepData, IllustrationElement, ColorDefinition, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, InformationStepData } from '@spiffcommerce/papyrus';
3
3
  export { Animatable, AnyStepData, AspectType, Asset, AssetType, BringForwardCommand, BringToBackCommand, BringToFrontCommand, CanvasCommand, ColorDefinition, ColorProfileProps, CommandContext, CommandState, CreateElementCommand, CreateLayoutCommand, DeleteElementCommand, DigitalContentStepData, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, FrameElement, FrameStepData, GroupCommand, ILayout, IllustrationElement, IllustrationStepData, ImageElement, InformationStepData, LayoutData, LayoutElement, LayoutElementFactory, LayoutElementType, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, MoveCommand, OptionResource, PictureStepData, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, Theme, UnitOfMeasurement, VariantResource, Workflow, WorkflowPanel, dataUrlFromExternalUrl, determineCorrectFontSizeAndLines, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getAxisAlignedBoundingBox, getFrameData, getSvgElement, loadFont, patternImageDataCache, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout, setCanvasModule } from '@spiffcommerce/papyrus';
4
4
  import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
5
5
  import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
@@ -344,2351 +344,2362 @@ interface StepAspectValue {
344
344
  declare const stepAspectValuesToDesignInputSteps: (stepAspectValues: StepAspectValue[], workflow: Workflow) => DesignInputStep[];
345
345
  declare const generateStateFromDesignInputSteps: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<LayoutsState>;
346
346
 
347
- interface SilentIllustrationStepData extends SilentStepData, Placeable {
348
- }
349
- interface EditedSteps {
350
- [stepName: string]: boolean;
351
- }
352
- interface MandatorySteps {
353
- [stepName: string]: boolean;
354
- }
355
- type StepElements = {
356
- [key: string]: RegionElement[];
357
- };
358
- type StepInitialised = {
359
- [key: string]: boolean;
360
- };
361
- type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
362
- interface WorkflowStorage {
363
- [stepName: string]: StepStorage;
364
- }
365
- interface WorkflowMetadata {
366
- [stepName: string]: StepMetadata;
367
- }
368
- interface WorkflowSelections {
369
- [stepName: string]: {
370
- selections: VariantResource[];
371
- };
372
- }
373
- interface InformationResult {
374
- message: string;
375
- messageType: InformationMessageType;
376
- stepID: string;
377
- }
378
- declare enum InformationMessageType {
379
- Error = "Error",
380
- Warning = "Warning",
381
- Info = "Info"
382
- }
383
347
  /**
384
- * Services required for the operaiton of individual steps.
348
+ * An asset manager provides a way to create and
349
+ * manage assets on the Spiff Commerce Platform.
385
350
  */
386
- interface StepSpecificServices {
387
- frameService?: FrameService;
388
- module?: ModuleProduct;
389
- }
390
- type DesignCreationProgressUpdate = (message: string) => void;
391
- type ConfirmCallback = (isConfirmed: boolean) => void;
392
- type EditedCallback = (editedSteps: EditedSteps) => void;
393
- type ElementsCallback = (elements: StepElements) => void;
394
- type InformationResultCallback = (messages: InformationResult[]) => void;
395
- type InitCallback = (stepInitialised: StepInitialised) => void;
396
- type MakingAdjustmentsCallback = (makingAdjustments: string) => void;
397
- type MandatoryCallback = (mandatorySteps: MandatorySteps) => void;
398
- type MetadataCallback = (metadata: WorkflowMetadata) => void;
399
- type SelectionCallback = (callbackOptions: {
400
- selectionCost: number;
401
- selections: StepSelections;
402
- traversableScenes: WorkflowScene[];
403
- }) => void;
404
- type StepSpecificStorageCallback = (selections: StepStorage) => void;
405
- type StorageCallback = (storage: WorkflowStorage) => void;
406
- type StateMutationFunc = (options?: Omit<MutationOptions, "mutation">) => Promise<FetchResult<any, Record<string, any>, Record<string, any>>>;
407
- interface WorkflowManager {
408
- addPoller: (poller: Poller) => void;
409
- addConfirmCallback: (callback: ConfirmCallback) => void;
410
- addEditedCallback: (callback: EditedCallback) => void;
411
- addElementsCallback: (callback: ElementsCallback) => void;
412
- addInformationResultCallback: (callback: InformationResultCallback) => void;
413
- addInitCallback: (callback: InitCallback) => void;
414
- addMakingAdjustmentsCallback: (callback: MakingAdjustmentsCallback) => void;
415
- addMandatoryCallback: (callback: MandatoryCallback) => void;
416
- addMetadataCallback: (callback: MetadataCallback) => void;
417
- addSelectionCallback: (callback: SelectionCallback) => void;
418
- addStepSpecificStorageCallback: (callback: StepSpecificStorageCallback, stepName: string) => void;
419
- addStorageCallback: (callback: StorageCallback) => void;
420
- getCommandDispatcher: () => (command: CanvasCommand) => void;
421
- getCommandContext: () => CommandContext;
422
- getLayouts: () => ILayout[];
423
- getAllLayoutData: () => LayoutState[];
424
- getLayoutPreviewService: () => LayoutPreviewService | undefined;
425
- getPreviewService: () => ThreeDPreviewService | undefined;
426
- getProfanities: () => string[];
427
- getRegionElements: (stepName: string) => RegionElement[];
428
- getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
429
- getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
430
- getStepStorage: (stepName: string) => StepStorage | undefined;
431
- getMetadata: (stepName: string) => StepMetadata | undefined;
432
- getWorkflowMetadata: () => WorkflowMetadata;
433
- getInformationResults(): InformationResult[];
434
- getTransaction: () => Transaction;
435
- getTransactionCustomer: () => Customer | undefined;
436
- setTransactionCustomer: (customer: Customer) => void;
437
- /**
438
- * @deprecated Use setTransactionCustomer instead.
439
- */
440
- setTransactionCustomerDetails: (details: {
441
- email: string;
442
- }) => void;
443
- getWorkflow: () => Workflow;
444
- getWorkflowSelections: () => WorkflowSelections;
445
- getProduct: () => Product;
351
+ interface AssetManager {
446
352
  /**
447
- * A promise resolving when the initial state of the workflow has completed loading.
353
+ * Uploads a file to the Spiff Commerce Platform.
448
354
  */
449
- getInitializationPromise: () => Promise<void>;
355
+ uploadFile: (file: File, onProgress: (val: number) => void) => Promise<Asset>;
450
356
  /**
451
- * Returns true when the initial state of the workflow has been loaded and settled.
357
+ * From an existing asset, generates a new asset that has the background replaced with transparency.
358
+ * This process is idempotent, i.e. it will only run once for a given asset.
359
+ * @param asset The existing asset to remove the background from.
360
+ * @returns A promise that resolves with a new asset.
452
361
  */
453
- isInitialized(): boolean;
454
- markStepsAsInitialised: (stepNames: string[]) => void;
455
- getUpdatesPending: () => boolean;
456
- markUpdateCompleted: (id: string) => void;
457
- markUpdatePending: () => string;
458
- outstandingRequestsPromise: () => Promise<void>;
459
- reset: () => Promise<void>;
460
- setCurrentAdjustingStepId: (stepId: string) => void;
461
- setEditedStatus: (stepName: string, status: boolean) => void;
462
- setInformationResults: (results: InformationResult[]) => void;
463
- setMandatoryFulfilled: (stepName: string, status: boolean) => void;
464
- setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
465
- toggleDesignConfirmed: () => void;
466
- updateMetadata: (stepName: string, update: any) => void;
362
+ removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
363
+ }
364
+ declare class AssetService implements AssetManager {
365
+ private cache;
366
+ private bgrmCache;
367
+ private materialCache;
467
368
  /**
468
- * @deprecated State updates are being pulled internally. This function will be removed in the future.
369
+ * Allows for retrieving an asset, returns the option from a cache if possible.
469
370
  */
470
- updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
471
- updateStorage: (stepName: string, update: StepStorage) => void;
472
- getModelContainer: () => ModelContainer | undefined;
473
- setModelContainer: (container: ModelContainer) => void;
371
+ getLocalOrFromServer(assetKey: string): Promise<Asset>;
474
372
  /**
475
- * Injects the model of this product into the preview service.
476
- * This also overwrites the internal preview service.
477
- * @param previewService The preview service to inject into.
478
- * @param refocusCamera Optional: Run camera focus Defaults to `true`.
373
+ * Caches an asset if it doesn't already exist.
479
374
  */
480
- injectIntoPreviewService(previewService: ThreeDPreviewService, refocusCamera?: boolean): Promise<void>;
375
+ cacheAsset(asset: Asset): void;
481
376
  /**
482
- * Ejects the model of this product from the preview service. This also sets the internal preview service to undefined.
377
+ * Caches a material if it doesn't already exist.
483
378
  */
484
- ejectFromPreviewService(): void;
379
+ cacheMaterial(material: MaterialResource): void;
485
380
  /**
486
- * Enables or disables uploading of workflow state to the server.
487
- * @param enabled When true, workflow state will be uploaded to the server.
381
+ * Allows for retrieving a material, returns the option from a cache if possible.
382
+ * @param id The option ID to be retrieved.
488
383
  */
489
- setWorkflowStateSyncEnabled: (enabled: boolean) => void;
490
- }
491
-
492
- interface StepService<T extends AnyStepData> {
384
+ getMaterialLocalOrFromServer(id: string): Promise<MaterialResource>;
493
385
  /**
494
- * Initialize the given step, or reload from serialized data if present.
386
+ * Upload a user asset to the server. Using callbacks to notify important events.
387
+ * The asset will be stored via the persistence service for future access, if available.
495
388
  */
496
- init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
497
- }
498
- interface FileInfo {
389
+ uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
390
+ uploadAsset(file: FileInfo, assetType: AssetType, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
391
+ uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
392
+ removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
393
+ removePersistedAsset(assetKey: string): void;
394
+ getPersistedAssets(): PersistedAsset[];
499
395
  /**
500
- * The name of the file.
396
+ * Convert a File object for an image into a FileInfo.
501
397
  */
502
- name: string;
398
+ loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
503
399
  /**
504
- * A blob object representing the
505
- * data of the file.
400
+ * Handles mimeType resolution & asset creation request
401
+ * @param file A file info object containing data about the file and its name
402
+ * @param assetType The type of asset we're expecting to upload
506
403
  */
507
- blob: Blob;
508
- }
509
- /**
510
- * A command along with a function to run afterwards.
511
- */
512
- interface CommandWithFollowup {
513
- command?: CanvasCommand;
514
- followup?: () => Promise<void>;
515
- }
516
- /**
517
- * The variant selections of a completed step.
518
- */
519
- interface SelectedVariants {
520
- [stepName: string]: {
521
- id: string;
522
- name: string;
523
- priceModifier: number;
524
- }[];
525
- }
526
- interface ExportedData {
527
- [name: string]: {
528
- value: string;
529
- priceModifier: number;
530
- };
531
- }
532
- interface DesignCreationMessage {
533
- additionalExternalProductId?: string;
534
- additionalExternalVariantId?: string;
535
- baseCost?: number;
536
- designProductId?: string;
537
- designProductVariantId?: string;
538
- event: string;
539
- exportedData: ExportedData;
540
- externalCartProductId?: string;
541
- externalCartProductVariantId?: string;
542
- lineItemImageUrl: string;
543
- metadata?: {
544
- [stepName: string]: string;
545
- };
546
- optionsCost: number;
547
- processExecutionId?: string;
548
- quantity?: number;
549
- selectedVariants?: SelectedVariants;
550
- sku?: string;
551
- transactionId: string;
552
- transactionOwnerId?: string;
553
- weight?: number;
554
- workflowViewerLink: string;
555
- workflowViewerReadOnlyLink: string;
404
+ private dispatchCreateAssetRequest;
405
+ private guessMIME;
556
406
  }
557
- interface BundleDesignCreationMessage {
558
- bundleId: string;
559
- items: DesignCreationMessage[];
407
+ interface PersistedAsset {
408
+ assetKey: string;
409
+ src: string;
560
410
  }
411
+ declare const assetService: AssetService;
412
+
561
413
  /**
562
- * Represents a transaction.
414
+ * A wrapping component that provides a simple interface for interacting with a variant.
563
415
  */
564
- interface Transaction {
416
+ declare class Variant {
417
+ private readonly variantData;
418
+ constructor(variant: VariantResource);
419
+ getType(): AssetType | undefined;
565
420
  /**
566
- * A unique identifier for this transaction. Useful for reloading and
567
- * modifying state of the transaction.
421
+ * @returns The unique identifier for the variant.
568
422
  */
569
- id: string;
423
+ getId(): string;
570
424
  /**
571
- * User-supplied name for the associated design.
425
+ * @returns The configured name of the variant. Generally a human readable value.
572
426
  */
573
- designName?: string;
427
+ getName(): string;
574
428
  /**
575
- * The workflow associated with this transaction.
429
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
576
430
  */
577
- workflowId?: string;
431
+ getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
578
432
  /**
579
- * Temporary ID that grants write permission to the transaction.
580
- */
581
- transactionOwnerId?: string;
582
- /**
583
- * The current state of the design.
433
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
434
+ * Presented in subunits of the currency of the option. For example, if the option is configured to use USD, the price modifier will be in cents.
584
435
  */
585
- workflowState?: string;
436
+ getPrice(): number;
586
437
  /**
587
- * URL to a partner-specific logo intended to display during the workflow experience.
438
+ * @returns The URL for the base asset resource configured on this variant
588
439
  */
589
- customLogoLink?: string;
440
+ getAsset(): string | undefined;
590
441
  /**
591
- * URL to a logo intended to display at the periphery of the workflow experience.
442
+ * @returns The URL for the base asset resource configured on this variant
592
443
  */
593
- workflowFooterLogoLink?: string;
444
+ getAssetResource(): Asset | undefined;
594
445
  /**
595
- * URL to the corresponding integration in the REST API.
446
+ * @returns The URL for a thumbnail resource configured on this variant.
596
447
  */
597
- restApiIntegrationLink?: string;
448
+ getThumbnail(): string | undefined;
598
449
  /**
599
- * URL to redirect to when a workflow is finished.
450
+ * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
451
+ * @deprecated To be removed in a future version, Please use getThumbnail() instead
600
452
  */
601
- callbackUrl?: string;
453
+ getDisplayImage(): string | undefined;
602
454
  /**
603
- * Product that this transaction belongs to.
455
+ * @returns When this variant is configured to have a color, this will return the hex value for that color.
604
456
  */
605
- product?: Product;
457
+ getColor(): string | undefined;
606
458
  /**
607
- * The integration product related to this lineitem.
459
+ * @returns True when the variant is the default for its containing option. False otherwise.
608
460
  */
609
- integrationProduct?: IntegrationProductResource;
461
+ isDefault(): boolean;
610
462
  /**
611
- * Whether this transaction has previously been ordered.
463
+ * @returns The underlying variant resource. Generally not needed but made available just incase.
612
464
  */
613
- isOrdered?: boolean;
465
+ getResource(): VariantResource;
614
466
  /**
615
- * @deprecated use isOrdered to check whether transaction has been ordered instead.
467
+ * @returns True when the variant is enabled. False otherwise.
616
468
  */
617
- lineItem?: LineItem;
469
+ isEnabled(): boolean;
470
+ }
471
+
472
+ /**
473
+ * A StepHandle allows for managing the state of a specific step in a workflow. This class
474
+ * abstracts away the complexities of dealing with a step directly and allows for using high level
475
+ * concepts instead of dealing with the underlying data structures.
476
+ */
477
+ declare abstract class StepHandle<T extends AnyStepData> {
618
478
  /**
619
- * The external product variant ID representing the design product related
620
- * to this transaction, null unless the createDesignProduct flag was set
621
- * and the design was finalized using createDesign operation.
479
+ * Stores whether or not the step is currently updating.
622
480
  */
623
- /**@deprecated use externalCartProductVariantId instead of this moving forward */
624
- externalDesignProductVariantId?: string;
481
+ private static readonly updateState;
625
482
  /**
626
- * The external product id representing the design product related
627
- * to this transaction, null unless the createDesignProduct flag was set
628
- * and the design was finalized using createDesign operation.
483
+ * Access to the workflow manager this step is contained by.
629
484
  */
630
- /**@deprecated use externalCartProductId instead of this moving forward. */
631
- externalDesignProductId?: string;
485
+ protected readonly manager: WorkflowManager;
632
486
  /**
633
- * The external product id representing the product related to the transaction.
634
- * This value can hold any type of transaction such as design and standard products.
487
+ * The step metadata, useful for determining logic based on configuration.
635
488
  */
636
- externalCartProductId?: string;
489
+ protected readonly step: Step<T>;
490
+ constructor(manager: WorkflowManager, step: Step<T>);
637
491
  /**
638
- * The external product variant id representing the product related to the transaction.
639
- * This value can hold any type of transaction such as design and standard products.
492
+ * Set the current update state of this step. All step handles pointing to this step will
493
+ * see this value.
494
+ * @param value The new value
640
495
  */
641
- externalCartProductVariantId?: string;
642
- priceModifierTotal?: number;
496
+ protected setUpdateState(value: boolean): void;
643
497
  /**
644
- * URL to open the transaction in the workflow viewer.
498
+ * @returns Gets the current update state of this step. All step handles for this step will see this value.
645
499
  */
646
- workflowViewerLink?: string;
647
- workflowViewerReadOnlyLink?: string;
648
- previewImageLink?: string;
649
- lastSyncedAt?: string;
500
+ protected getUpdateState(): boolean;
650
501
  /**
651
- * The users who have access to this transaction.
502
+ * Gets the currently selected variant, or undefined if no variant is selected.
652
503
  */
653
- stakeholders?: Stakeholder[];
504
+ getCurrentVariant(): Variant | undefined;
654
505
  /**
655
- * The amount of this transaction that was, or will be, ordered
506
+ * @returns A list of valid variants for this step. Does not include disabled variants.
656
507
  */
657
- quantity?: number;
658
- printFileUrl1?: string;
659
- printFileUrl2?: string;
660
- printFileUrl3?: string;
661
- printFileUrl4?: string;
662
- printFileUrl5?: string;
663
- }
664
- /**
665
- * An integration product represents the connection of a product in SpiffCommerce with
666
- * a product on a third party platform.
667
- */
668
- interface IntegrationProductResource {
508
+ getAvailableVariants(): Variant[];
669
509
  /**
670
- * The ID of the IntegrationProduct entity. Used internally by SpiffCommerce.
510
+ * @returns A list of all variants for this step, including disabled ones.
671
511
  */
672
- id: string;
512
+ getAllVariants(): Variant[];
673
513
  /**
674
- * The ID of the product on the third party platform. For example a Shopify product ID.
514
+ * Most step types have a base option type that variants can be selected for.
515
+ * Selects a specific variant for this step. This will execute all required changes to
516
+ * the design and update the metadata to include the new selection. Any conditions
517
+ * that would be triggered will also be executed.
675
518
  */
676
- externalProductId?: string;
519
+ abstract selectVariant(variant: Variant): Promise<void>;
677
520
  /**
678
- * The integration that this product is associated with. For example a Shopify integration.
521
+ * @returns A unique identifier for this step within the workflow.
679
522
  */
680
- integration?: Integration;
523
+ getId(): string;
681
524
  /**
682
- * The ID of an additional product (on the third party platform) that should be added to the cart.
525
+ * @returns The name of the step
683
526
  */
684
- additionalExternalProductId?: string;
527
+ getName(): string;
685
528
  /**
686
- * A supplementary ID for the additional product. Shopify uses the variant ids to add products to the cart.
529
+ * @returns A message that can accompany the step name in UI components. Used to describe the purpose of the step in more detail.
687
530
  */
688
- additionalExternalVariantId?: string;
531
+ getHelpText(): string | undefined;
689
532
  /**
690
- * When the additionalExternalProductId is set, this is the IntegrationProduct that is associated with it.
691
- * If no Spiff product has been associated with the additionalExternalProductId, this will be null.
533
+ * @returns The type of the step handle.
692
534
  */
693
- additionalIntegrationProduct?: IntegrationProductResource;
535
+ getType(): StepType;
694
536
  /**
695
- * The product that this integration product is associated with.
537
+ * @returns The underlying data for this step. Favor using the step handle methods instead of this.
696
538
  */
697
- product?: Product;
698
- }
699
- interface Integration {
700
- id: string;
701
- enabled: boolean;
702
- externalIntegrationId?: string;
703
- type?: IntegrationType;
704
- isCurrent?: boolean;
705
- }
706
- declare enum IntegrationType {
707
- Hub = "Hub",
708
- Shopify = "Shopify"
709
- }
710
- /**
711
- * Fields found in a variant within a line item resource.
712
- */
713
- interface LineItemVariant {
714
- currencyCode: string;
715
- optionName: string;
716
- priceModifier: number;
717
- stepName: string;
718
- variantName: string;
719
- }
720
- interface LineItem {
721
- id: string;
722
- transactionId?: string;
723
- previewImageUrl?: string;
724
- product: Product;
725
- quantity: number;
726
- metadata?: LineItemMetadata[];
727
- variants: LineItemVariant[];
728
- }
729
- interface LineItemMetadata {
730
- stepName: string;
731
- metadata: string;
732
- }
733
- interface ProductWorkflow$1 {
734
- friendlyName: string;
735
- id: string;
736
- index?: number;
737
- present?: boolean;
738
- imageUrl: string;
739
- workflowName: string;
740
- }
741
- interface Partner {
742
- id?: string;
743
- name?: string;
744
- currencyCode?: string;
745
- customerDetailsPromptMarkdown?: string;
746
- }
747
- interface Product {
539
+ getRaw(): Step<T>;
540
+ getTags(): string[];
541
+ hasTag(tag: string): boolean;
748
542
  /**
749
- * ID of the partner owner.
543
+ * @param type The AspectType to fetch the value for.
544
+ * @returns A boolean indicating whether this step should override Global Properties.
545
+ * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
546
+ * and when this step is associated with one or more Global Property Aspects.
750
547
  */
751
- partnerId?: string;
752
- partner?: Partner;
548
+ getOverrideGlobalPropertyConfiguration(type: AspectType): boolean;
753
549
  /**
754
- * Whether a line item for this product is delivered as soon as the order is received.
550
+ * Sets whether or not this step should override Global Properties.
551
+ * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
552
+ * and when this step is associated with one or more Global Property Aspects.
553
+ * @param type The AspectType to override.
755
554
  */
756
- autoprint: boolean;
555
+ setOverrideGlobalPropertyConfiguration(type: AspectType, value: boolean): void;
757
556
  /**
758
- * Whether this product can be quickprinted.
557
+ * Retrieves the identifiers of all of the configured aspects for the specified Global Property Configuration.
558
+ * @param configurationId The ID of the Global Property Configuration. You can usually find this with `bundle.getGlobalPropertyConfiguration()?.id`
559
+ * @returns An array of strings matching the keys of all the Global Property Aspects in the Configuration that this step is configured to use.
759
560
  */
760
- canQuickprint?: boolean;
561
+ getGlobalPropertyAspects(configurationId: string): string[];
761
562
  /**
762
- * The internal identifier for this product.
563
+ * Fires any configured animations on the 3D preview for this step.
564
+ * This includes camera & model animations. If the preview is unavailable
565
+ * this function will do nothing.
763
566
  */
764
- id: string;
567
+ executeAnimations(): void;
568
+ }
569
+
570
+ declare const createDesign: (workflowManager: WorkflowManager, workflow: Workflow, layouts: ILayout[], getReducerState: () => CommandState, product: Product, transaction: Transaction, workflowSelections: WorkflowSelections, designName: string, onProgressUpdate: DesignCreationProgressUpdate, createPreviewImage: (shouldRender3D?: boolean, transactionId?: string) => Promise<string | undefined>, workflowMetadata?: WorkflowMetadata) => Promise<DesignCreationMessage>;
571
+ interface SavedDesign {
765
572
  /**
766
- * The human friendly name of the product.
573
+ * The user's name for this saved design.
767
574
  */
768
- name: string;
575
+ title: string;
769
576
  /**
770
- * A URL to the image asset associated with this product.
577
+ * A URL pointing to an image of the design. Typically a data URL
771
578
  */
772
- imageUrl?: string;
579
+ thumbnail?: string;
773
580
  /**
774
- * A resource url for a 3D model used to represent this product
775
- * in the 3d editor. If not available we assume the product doesn't support 3D.
581
+ * The ID of the transaction relating to this design.
776
582
  */
777
- modelUrl?: string;
583
+ transactionId: string;
778
584
  /**
779
- * A URL for the image used as an overlay on any workflows
780
- * that incorporate a product overlay step.
585
+ * The product ID for this transaction.
781
586
  */
782
- overlayImageUrl?: string;
587
+ productId: string;
783
588
  /**
784
- * Words which can't be used in a workflow for this product.
589
+ * The integration product ID related to this order.
785
590
  */
786
- profanities?: {
787
- id: string;
788
- createdAt: string;
789
- userId: string;
790
- word: string;
791
- }[];
591
+ integrationProductId: string;
792
592
  /**
793
- * The max characters that can be typed for quickprint.
593
+ * The name of the workflow annotated at time of save (may be different from current workflow name).
794
594
  */
795
- quickprintMaxLength?: number;
595
+ workflowName: string;
796
596
  /**
797
- * The name of the module to use for quickprint.
597
+ * The ID of the workflow annotated at time of save.
798
598
  */
799
- quickprintModuleName?: string;
599
+ workflowId: string;
800
600
  /**
801
- * If true, the product should be displayed in the client as if it is available.
802
- * Should be displayed as if it is unavailable otherwise.
601
+ * The last edit that occured on this saved design.
803
602
  */
804
- enabled: boolean;
603
+ lastEdited: Date;
604
+ }
605
+ /**
606
+ * The design service exposes helper functionality wrapping important design management operations.
607
+ * NOTE: In the future this interface should allow for storing/pulling designs from the server.
608
+ */
609
+ declare class DesignService {
610
+ readonly localPersistenceKey = "designTransactions";
611
+ private storageMethod;
612
+ private designSavedListeners;
805
613
  /**
806
- * Workflows which have been assigned to this product.
614
+ * @param func The function to call when a design is saved.
807
615
  */
808
- workflows?: ProductWorkflow$1[];
616
+ attachSaveListener(func: (design: SavedDesign) => void): void;
809
617
  /**
810
- * The base price of this product in sub units. Essentially the cost of the
811
- * product without any customisations applied.
618
+ * @param func The function to remove from the list of listeners.
812
619
  */
813
- basePrice?: number;
620
+ detachSaveListener(func: (design: SavedDesign) => void): void;
814
621
  /**
815
- * The weight of this product.
622
+ * Gets the currently persisted designs.
816
623
  */
817
- weight?: number;
624
+ getSavedDesigns(): Promise<SavedDesign[]>;
818
625
  /**
819
- * When specified, represents a pre-rendered image of this product to be
820
- * displayed to customers while the 3D preview is loading.
626
+ * Search for a transaction that has been saved.
627
+ * @param transactionId The id to search for.
628
+ * @returns The transaction for the given id provided it has been saved. undefined if it doesn't exist.
821
629
  */
822
- preloadImageUrl?: string;
630
+ getSavedDesignByTransaction(transactionId: string): Promise<SavedDesign | undefined>;
823
631
  /**
824
- * When set the store owner has configured this product to prompt for
825
- * customer details. In hosted experience, we'll offer to collect this information from the customer. In
826
- * bespoke UIs created using the Core SDK you will need to check this flag and request the data accordingly.
827
- * See attachCustomerDetails on the WorkflowExperience for how to supply us with the details you collect.
632
+ * Saves a design to storage.
633
+ * @param design The design to save.
828
634
  */
829
- promptForCustomerDetails?: boolean;
635
+ addDesign(design: SavedDesign): Promise<void>;
830
636
  /**
831
- * Configuration for conversion. Optional.
637
+ * Change the user's name of the given saved design.
832
638
  */
833
- conversionConfiguration?: ConversionConfiguration;
834
- integrationProducts?: IntegrationProductResource[];
835
- productTags?: ProductTag[];
639
+ renameDesign(transactionId: string, title: string): Promise<void>;
836
640
  /**
837
- * The SKU of the product in the merchant's store.
641
+ * Removes a given design from storage.
642
+ * @param transactionId
838
643
  */
839
- sku?: string;
644
+ removeDesign(transactionId: string): Promise<void>;
645
+ private setDesigns;
646
+ }
647
+ declare const designService: DesignService;
648
+
649
+ /**
650
+ * A scene is a collection of steps that can be used to group steps together.
651
+ */
652
+ interface Scene {
840
653
  /**
841
- * The Spiff SKU code for the product.
654
+ * The unique identifier for the scene.
842
655
  */
843
- skuCode?: string;
656
+ id?: string;
844
657
  /**
845
- * Price breaks for this product when dealing with quantity.
658
+ * The name of the scene.
846
659
  */
847
- priceBreaks?: ProductPriceBreak[];
660
+ name: string;
661
+ /**
662
+ * The steps that are part of the scene. A list of ids. See getStepById.
663
+ */
664
+ stepIds: string[];
848
665
  }
849
666
  /**
850
- * A price break represents a minimum quantity of a product and the price that will be charged for that quantity.
851
- * This can be seen as an override for the base price of the product.
667
+ * State related to a workflow experience.
852
668
  */
853
- interface ProductPriceBreak {
669
+ interface ExperienceOptions {
670
+ product: Product;
671
+ transaction: Transaction;
672
+ workflow?: Workflow;
854
673
  /**
855
- * The id of this price break.
674
+ * @deprecated favor inject / eject functions.
856
675
  */
857
- id: string;
676
+ previewService?: ThreeDPreviewService;
677
+ modelContainer?: ModelContainer;
678
+ renderableContextService?: LayoutPreviewService;
679
+ layouts: ILayout[];
680
+ reloadedState?: LayoutsState;
858
681
  /**
859
- * The minimum quantity of this price break. A positive integer.
682
+ * When true the experience is intended to be immutable.
860
683
  */
861
- minQty: number;
684
+ readOnly?: boolean;
862
685
  /**
863
- * A percentage to apply to the overall price. A value between 0-1 where 1 retains 100% of the original price and 0 completely discounts it to free.
686
+ * A function that communicates state changes to the server.
864
687
  */
865
- percentage: number;
866
- }
867
- interface ProductTag {
868
- id: string;
869
- name: string;
870
- }
871
- interface ColorOption {
872
- id?: string;
873
- fill?: string;
874
- stroke?: string;
875
- variant?: VariantResource;
876
- colorProfileAssetKey?: string;
877
- }
878
- interface RegionElement {
879
- id: string;
880
- region?: Region;
881
- }
882
- interface FrameMetadata {
883
- image: string;
884
- }
885
- interface IllustrationMetadata {
886
- colors: string[];
887
- }
888
- interface ModuleMetadata {
889
- text: string;
890
- }
891
- interface TextMetadata {
892
- color?: string;
893
- text: string;
894
- fillImage?: string;
895
- }
896
- interface SelectionStorage {
897
- selectedVariants?: VariantResource[];
898
- }
899
- interface TextStepStorage extends SelectionStorage {
900
- color?: string;
901
- defaultCleared?: boolean;
902
- inputText?: string;
903
- text?: string;
904
- customiseAllText?: boolean;
905
- }
906
- type StepSelections = {
907
- [key: string]: SelectionStorage;
908
- };
909
- interface FrameData {
688
+ stateMutationFunc: StateMutationFunc;
910
689
  /**
911
- * The path data for a frame SVG
690
+ * Should be set to true when the experience is loaded from an existing transaction.
691
+ * FIXME: Wouldn't we know this from existance of reloadedState
912
692
  */
913
- path: string;
693
+ isReloadedTransaction?: boolean;
914
694
  /**
915
- * The viewbox width
695
+ * When true the system will treat steps with
696
+ * a single variant as renderable. False
697
+ * by default.
916
698
  */
917
- width: number;
699
+ singleVariantsRenderable?: boolean;
918
700
  /**
919
- * The viewbox height.
701
+ * When true, will delay syncing the workflow state until manually enabled.
920
702
  */
921
- height: number;
922
- }
923
- interface FrameThresholdSettings {
924
- useThreshold: boolean;
925
- invertThreshold: boolean;
926
- threshold: number;
927
- thresholdSaturation: number;
928
- }
929
- /**
930
- * Defines the different behaviors supported by the camera system
931
- * for control when viewing a product.
932
- */
933
- declare enum ProductCameraRig {
934
- Orbit = 0,
935
- Pan = 1
703
+ delayWorkflowStateSync?: boolean;
936
704
  }
937
705
  /**
938
- * Defines the locations at which a conversion attempt can take place.
706
+ * A Workflow experience encapsulates the workflow manager and command context. It
707
+ * provides a simplified interface for interacting with the workflow manager. You
708
+ * should get an instance of this class from a Client you have constructed previously.
939
709
  */
940
- declare enum ConversionLocation {
710
+ interface WorkflowExperience {
941
711
  /**
942
- * The client should expose a flow for allowing the user to optionally input details at any point.
712
+ * Get the bundle this experience is part of. May be undefined.
943
713
  */
944
- Manual = "Manual",
714
+ getBundle(): Bundle$1 | undefined;
945
715
  /**
946
- * The client should show the conversion flow at the beginning of a workflow.
716
+ * Set the bundle this experience is part of. Can be cleared using undefined.
947
717
  */
948
- OnStart = "OnStart",
718
+ setBundle(bundle: Bundle$1 | undefined): any;
949
719
  /**
950
- * The client should allow the user to input details just before quitting the experience.
720
+ * Returns the client that was responsible for spawning this experience.
951
721
  */
952
- OnQuit = "OnQuit",
722
+ getClient(): SpiffCommerceClient;
953
723
  /**
954
- * The client should ask the user for details prior to adding to cart.
724
+ * State related to the design of the user.
955
725
  */
956
- OnEnd = "OnEnd"
957
- }
958
- /**
959
- * The data configured to be requested.
960
- */
961
- declare enum ConversionDataType {
962
- Email = "Email",
963
- FirstName = "FirstName",
964
- LastName = "LastName",
965
- Phone = "Phone"
966
- }
967
- interface ConversionData {
968
- type: ConversionDataType;
969
- mandatory: boolean;
970
- }
971
- /**
972
- * The configuration for conversion, exposed on products currently.
973
- */
974
- interface ConversionConfiguration {
975
- id: string;
976
- name?: string;
977
- locations: ConversionLocation[];
978
- requestedData: ConversionDataType[];
979
- requestedDataItems: ConversionData[];
980
- mandatory?: boolean;
981
- }
982
- /**
983
- * Someone who has used a workflow experience and entered their contact details.
984
- */
985
- interface Customer {
986
- id?: string;
987
- emailAddress: string;
988
- firstName?: string;
989
- lastName?: string;
990
- phoneNumber?: string;
991
- loginToken?: string;
992
- partner?: Partner;
993
- stakeholders?: Stakeholder[];
994
- bundleStakeholders?: BundleStakeholder[];
995
- }
996
- interface CustomerDetailsInput {
997
- emailAddress: string;
998
- firstName?: string;
999
- lastName?: string;
1000
- phoneNumber?: string;
1001
- }
1002
- declare enum StakeholderType {
1003
- Owner = "Owner",
1004
- Approver = "Approver",
1005
- Editor = "Editor",
1006
- Viewer = "Viewer"
1007
- }
1008
- interface Stakeholder {
1009
- id: string;
1010
- type?: StakeholderType;
1011
- transaction?: Transaction;
1012
- customer?: Customer;
1013
- }
1014
- interface Bundle$1 {
1015
- id?: string;
1016
- bundleOwnerId?: string;
1017
- bundleStakeholders?: BundleStakeholder[];
1018
- bundleStateData?: string;
1019
- metadata?: {
1020
- key: string;
1021
- value: string;
1022
- }[];
1023
- name?: string;
1024
- partner?: Partner;
1025
- productCollection?: ProductCollectionResource;
1026
- transactions?: Transaction[];
1027
- }
1028
- interface BundleStakeholder {
1029
- id: string;
1030
- bundle?: Bundle$1;
1031
- customer?: Customer;
1032
- type?: StakeholderType;
1033
- }
1034
- interface BundleStakeholderInput {
1035
- type: StakeholderType;
1036
- customerDetails: CustomerDetailsInput;
1037
- }
1038
- type ProductCollectionResource = {
1039
- id: string;
1040
- globalPropertyConfiguration?: GlobalPropertyConfiguration;
1041
- productCollectionProducts?: ProductCollectionProductResource[];
1042
- name: string;
1043
- transformCollection?: TransformCollection$1;
1044
- };
1045
- type ProductCollectionProductResource = {
1046
- id: string;
1047
- productCollection?: ProductCollectionResource;
1048
- productCollectionId?: string;
1049
- product: Product;
1050
- productId: string;
1051
- workflowId?: string;
1052
- };
1053
- type GlobalPropertyState = {
1054
- id: string;
1055
- aspects: GlobalPropertyStateAspect[];
1056
- };
1057
- type GlobalPropertyStateAspect = {
1058
- name: string;
1059
- value: string;
1060
- type?: AspectType;
1061
- storage?: GlobalPropertyStateAspectStorage;
1062
- };
1063
- type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage;
1064
- type GlobalPropertyStateFileUploadStorage = {
1065
- originalAssetKey?: string;
1066
- backgroundRemovedAssetKey?: string;
1067
- useOriginalAsset?: boolean;
1068
- };
1069
- interface BundleStateTransform {
1070
- position: Vector3;
1071
- rotation: Vector3;
1072
- scale: Vector3;
1073
- }
1074
- interface Vector3 {
1075
- x: number;
1076
- y: number;
1077
- z: number;
1078
- }
1079
- interface TransformCollection$1 {
1080
- id: string;
1081
- name: string;
1082
- transforms: TransformCollectionTransform[];
1083
- }
1084
- interface TransformCollectionTransform {
1085
- id: string;
1086
- name: string;
1087
- position: Vector3;
1088
- rotation: Vector3;
1089
- scale: Vector3;
1090
- }
1091
- type Extendable<T> = T & {
1092
- [key: string]: any;
1093
- };
1094
-
1095
- /**
1096
- * An asset manager provides a way to create and
1097
- * manage assets on the Spiff Commerce Platform.
1098
- */
1099
- interface AssetManager {
726
+ getCommandContext(): CommandContext;
1100
727
  /**
1101
- * Uploads a file to the Spiff Commerce Platform.
728
+ * Returns true when the user may only view the design.
1102
729
  */
1103
- uploadFile: (file: File, onProgress: (val: number) => void) => Promise<Asset>;
730
+ getIsReadOnly(): boolean;
1104
731
  /**
1105
- * From an existing asset, generates a new asset that has the background replaced with transparency.
1106
- * This process is idempotent, i.e. it will only run once for a given asset.
1107
- * @param asset The existing asset to remove the background from.
1108
- * @returns A promise that resolves with a new asset.
732
+ * Get the low level workflow amanager instance for this experience. Don't touch this unless you're willing to break things.
1109
733
  */
1110
- removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
1111
- }
1112
- declare class AssetService implements AssetManager {
1113
- private cache;
1114
- private bgrmCache;
1115
- private materialCache;
734
+ getWorkflowManager(): WorkflowManager;
1116
735
  /**
1117
- * Allows for retrieving an asset, returns the option from a cache if possible.
736
+ * Returns the step matching a given name, undefined if not found.
737
+ * @param id The id the step must match.
1118
738
  */
1119
- getLocalOrFromServer(assetKey: string): Promise<Asset>;
739
+ getStepById(id: string): StepHandle<AnyStepData> | undefined;
1120
740
  /**
1121
- * Caches an asset if it doesn't already exist.
741
+ * Returns the step matching a given name, undefined if not found.
742
+ * @param name The name the step must match.
1122
743
  */
1123
- cacheAsset(asset: Asset): void;
744
+ getStepByName(name: string): StepHandle<AnyStepData> | undefined;
1124
745
  /**
1125
- * Caches a material if it doesn't already exist.
746
+ * Returns all steps matching a specific type in the workflow. These steps
747
+ * may be across multiple scenes and may or may not be active based on condition state.
1126
748
  */
1127
- cacheMaterial(material: MaterialResource): void;
749
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1128
750
  /**
1129
- * Allows for retrieving a material, returns the option from a cache if possible.
1130
- * @param id The option ID to be retrieved.
751
+ * Returns all steps that are children of a given scene.
752
+ * @param scene The scene you want the steps for.
1131
753
  */
1132
- getMaterialLocalOrFromServer(id: string): Promise<MaterialResource>;
754
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
1133
755
  /**
1134
- * Upload a user asset to the server. Using callbacks to notify important events.
1135
- * The asset will be stored via the persistence service for future access, if available.
756
+ * Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
1136
757
  */
1137
- uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
1138
- uploadAsset(file: FileInfo, assetType: AssetType, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
1139
- uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
1140
- removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
1141
- removePersistedAsset(assetKey: string): void;
1142
- getPersistedAssets(): PersistedAsset[];
758
+ getSteps(): StepHandle<AnyStepData>[];
1143
759
  /**
1144
- * Convert a File object for an image into a FileInfo.
760
+ * Returns a list of scenes that are configured in the workflow. Each scene
761
+ * contains a list of steps. See getStepsByScene to access these.
1145
762
  */
1146
- loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
763
+ getScenes(): Scene[];
1147
764
  /**
1148
- * Handles mimeType resolution & asset creation request
1149
- * @param file A file info object containing data about the file and its name
1150
- * @param assetType The type of asset we're expecting to upload
765
+ * Returns the total cost in subunits for all selections made on the design.
766
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1151
767
  */
1152
- private dispatchCreateAssetRequest;
1153
- private guessMIME;
1154
- }
1155
- interface PersistedAsset {
1156
- assetKey: string;
1157
- src: string;
1158
- }
1159
- declare const assetService: AssetService;
1160
-
1161
- interface StorageService {
768
+ getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
1162
769
  /**
1163
- * Get a value.
1164
- * @param key The key to lookup the value with.
770
+ * Returns the total cost in subunits for the base product.
771
+ * @param includeAdditionalProduct When true the additional product cost will be included in the total (if configured).
772
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1165
773
  */
1166
- get(key: string): string | undefined;
774
+ getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
1167
775
  /**
1168
- * Set a value.
1169
- * @param key The key to set.
1170
- * @param val The new value.
776
+ * If an additional product is configured, returns the base price of that product. Returns undefined otherwise.
777
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1171
778
  */
1172
- set(key: string, val: string): void;
779
+ getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
1173
780
  /**
1174
- * Remove a value.
1175
- * @param key The key to remove, does nothing if the key doesn't exist.
781
+ * A convenience function returning the sum of the selection and base price values.
782
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1176
783
  */
1177
- remove(key: string): void;
784
+ getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
1178
785
  /**
1179
- * Get a map from persistence.
1180
- * @param key The key to search by.
786
+ * The price break percentage that is expected to be applied in price calculations.
1181
787
  */
1182
- getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
788
+ priceBreakToBeApplied(): number;
1183
789
  /**
1184
- * St a map into persistence.
1185
- * @param key The key to set the map at.
1186
- * @param val The map to set.
790
+ * Calculates the price break and fires the "PriceBreakChanged" event if required.
791
+ * This function is primarily intended for internal use.
1187
792
  */
1188
- setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
1189
- }
1190
- declare const persistenceService: StorageService;
1191
-
1192
- /**
1193
- * A wrapping component that provides a simple interface for interacting with a variant.
1194
- */
1195
- declare class Variant {
1196
- private readonly variantData;
1197
- constructor(variant: VariantResource);
1198
- getType(): AssetType | undefined;
793
+ checkForPriceBreakChanges(): void;
1199
794
  /**
1200
- * @returns The unique identifier for the variant.
795
+ * Takes selections made by the user in another workflow and applies them to this workflow. For
796
+ * selections to be copied they must both have a matching global property configuration.
797
+ * @param experience The experience to take selections from.
798
+ * @param filter A list of steps to apply the selections to. If undefined all steps will be updated.
1201
799
  */
1202
- getId(): string;
800
+ copySelectionsViaGlobalConfiguration(bundle: Bundle$1, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1203
801
  /**
1204
- * @returns The configured name of the variant. Generally a human readable value.
802
+ * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
803
+ * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
804
+ * @param details The new customer details. Only email is supported.
805
+ * @deprecated Use assignCustomerDetails instead.
1205
806
  */
1206
- getName(): string;
807
+ attachCustomerDetails(details: {
808
+ /**
809
+ * An email used for things like sending a design to the user.
810
+ */
811
+ email: string;
812
+ }): Promise<void>;
1207
813
  /**
1208
- * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
814
+ * Attach specific details about the customer to the experience. This is useful for things like retargeting.
815
+ * From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
816
+ * @param details The new customer details.
1209
817
  */
1210
- getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
818
+ assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
1211
819
  /**
1212
- * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
1213
- * Presented in subunits of the currency of the option. For example, if the option is configured to use USD, the price modifier will be in cents.
820
+ * Attaches a listener to the scenes on a workflow experience. The scenes returned are a subset of the scenes configured in the
821
+ * workflow and are based on the current state of the experience. This is useful for building a navigation menu.
822
+ * @param cb The callback to be called when the scenes change. The new scenes are passed as an argument.
1214
823
  */
1215
- getPrice(): number;
824
+ attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1216
825
  /**
1217
- * @returns The URL for the base asset resource configured on this variant
826
+ * Detaches a listener from the scenes on a workflow experience.
1218
827
  */
1219
- getAsset(): string | undefined;
828
+ detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1220
829
  /**
1221
- * @returns The URL for the base asset resource configured on this variant
830
+ * Saves this experience to storage. This may be local or remote depending
831
+ * on configuration.
832
+ * @param title The title for the saved design.
1222
833
  */
1223
- getAssetResource(): Asset | undefined;
834
+ save(title: string): Promise<SavedDesign>;
1224
835
  /**
1225
- * @returns The URL for a thumbnail resource configured on this variant.
836
+ * Returns a copy of the currently loaded design as a new, seperated workflow experience with
837
+ * a fresh transaction.
1226
838
  */
1227
- getThumbnail(): string | undefined;
839
+ copy(): Promise<WorkflowExperience>;
1228
840
  /**
1229
- * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
1230
- * @deprecated To be removed in a future version, Please use getThumbnail() instead
841
+ * Creates a data URL preview for the current design.
1231
842
  */
1232
- getDisplayImage(): string | undefined;
843
+ createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
1233
844
  /**
1234
- * @returns When this variant is configured to have a color, this will return the hex value for that color.
845
+ * To be called when the workflow experience is considered completed by the user.
846
+ * @param onProgressUpdate Progress callback for finalizing the design. Optional
847
+ * @param capturePreviewImage When true a preview image will be generated for the design. Defaults to true.
1235
848
  */
1236
- getColor(): string | undefined;
849
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1237
850
  /**
1238
- * @returns True when the variant is the default for its containing option. False otherwise.
851
+ * Returns the metadata associated with this workflow experience.
852
+ * This is a combination of the metadata from the workflow, and the selections made by the user.
1239
853
  */
1240
- isDefault(): boolean;
854
+ getExportedData(): Map<string, {
855
+ [key: string]: string;
856
+ }>;
1241
857
  /**
1242
- * @returns The underlying variant resource. Generally not needed but made available just incase.
858
+ * Get the quantity of this WorkflowExperience's Transaction.
859
+ * @returns The amount that was, or will be, ordered.
1243
860
  */
1244
- getResource(): VariantResource;
861
+ getQuantity(): number;
1245
862
  /**
1246
- * @returns True when the variant is enabled. False otherwise.
863
+ * Sets the quantity of this WorkflowExperience's Transaction.
864
+ * @throws {Error} if the WorkflowExperience is read-only.
865
+ * @throws {RangeError} if the value is below 1.
866
+ * @param quantity The amount that was, or will be, ordered.
867
+ * @returns A promise that resolves when the Transaction has been updated on the server.
1247
868
  */
1248
- isEnabled(): boolean;
1249
- }
1250
-
1251
- /**
1252
- * A StepHandle allows for managing the state of a specific step in a workflow. This class
1253
- * abstracts away the complexities of dealing with a step directly and allows for using high level
1254
- * concepts instead of dealing with the underlying data structures.
1255
- */
1256
- declare abstract class StepHandle<T extends AnyStepData> {
1257
- /**
1258
- * Stores whether or not the step is currently updating.
1259
- */
1260
- private static readonly updateState;
869
+ setQuantity(quantity: number): Promise<void>;
1261
870
  /**
1262
- * Access to the workflow manager this step is contained by.
871
+ * Registers a callback function to be called when the specified event is raised.
872
+ * @param type The type of event to listen for.
873
+ * @param callback The function to call when the event occurs.
1263
874
  */
1264
- protected readonly manager: WorkflowManager;
875
+ addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
1265
876
  /**
1266
- * The step metadata, useful for determining logic based on configuration.
877
+ * Removes a previously registered callback.
878
+ * @param type The type of event.
879
+ * @param callback The function to remove.
1267
880
  */
1268
- protected readonly step: Step<T>;
1269
- constructor(manager: WorkflowManager, step: Step<T>);
881
+ removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
882
+ }
883
+ declare enum WorkflowExperienceEventType {
884
+ QuantityChanged = "QuantityChanged",
885
+ PriceBreakChanged = "PriceBreakChanged"
886
+ }
887
+ declare class WorkflowExperienceImpl implements WorkflowExperience {
888
+ readonly client: SpiffCommerceClient;
889
+ readonly commandContext: CommandContext;
890
+ readonly workflowManager: WorkflowManager;
891
+ readonly isReadOnly: boolean;
892
+ readonly cachedStepHandles: Map<string, StepHandle<any>>;
1270
893
  /**
1271
- * Set the current update state of this step. All step handles pointing to this step will
1272
- * see this value.
1273
- * @param value The new value
894
+ * Bundle this experience has been added to.
1274
895
  */
1275
- protected setUpdateState(value: boolean): void;
896
+ private bundle?;
897
+ private currentPriceBreak;
898
+ private renderableScenes;
899
+ private renderableSceneCallbacks;
900
+ private eventCallbacks;
901
+ constructor(client: SpiffCommerceClient, experienceOptions: ExperienceOptions);
902
+ getBundle(): Bundle$1 | undefined;
903
+ setBundle(bundle: Bundle$1): void;
904
+ getClient(): SpiffCommerceClient;
905
+ getIsReadOnly(): boolean;
906
+ getCommandContext(): CommandContext;
907
+ getWorkflowManager(): WorkflowManager;
908
+ createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
909
+ getStepById(id: string): StepHandle<any> | undefined;
910
+ getSteps(): StepHandle<AnyStepData>[];
911
+ getScenes(): Scene[];
912
+ getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
913
+ getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
914
+ getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
915
+ getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
916
+ private getPriceSubUnitsAfterPriceBreaks;
917
+ priceBreakToBeApplied(): number;
918
+ checkForPriceBreakChanges(): void;
919
+ private getMatchingExperiencesFromBundle;
920
+ private updatePriceBreak;
921
+ copySelectionsViaGlobalConfiguration(bundle: Bundle$1, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
922
+ getStepByName(name: string): TextStepHandle | FrameStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
923
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
924
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
925
+ attachCustomerDetails(details: {
926
+ email: string;
927
+ }): Promise<void>;
928
+ assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
929
+ attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
930
+ detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
931
+ debouncedSavedDesignUpdate: lodash.DebouncedFunc<() => Promise<void>>;
932
+ save(title?: string): Promise<SavedDesign>;
933
+ copy(): Promise<WorkflowExperience>;
934
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1276
935
  /**
1277
- * @returns Gets the current update state of this step. All step handles for this step will see this value.
936
+ * @param step The step to test against.
937
+ * @returns Returns true when a valid handle is implemented for a given step type. Certain steps don't support handles, such as silent illustrations.
1278
938
  */
1279
- protected getUpdateState(): boolean;
939
+ private stepHasHandle;
940
+ private getCanvasObjectURLAsync;
941
+ getExportedData(): Map<string, {
942
+ [key: string]: string;
943
+ }>;
944
+ getQuantity(): number;
945
+ setQuantity(quantity: number): Promise<void>;
946
+ addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
947
+ removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
948
+ private callEvent;
949
+ }
950
+
951
+ /**
952
+ * A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
953
+ * bundles can return a handle for any global properties associated to the collection.
954
+ */
955
+ declare abstract class GlobalPropertyHandle {
956
+ protected readonly bundle: Bundle$1;
957
+ protected readonly property: GlobalPropertyConfigurationAspect;
958
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
1280
959
  /**
1281
- * Gets the currently selected variant, or undefined if no variant is selected.
960
+ * @returns The name of the global property. This is the key used to store the property in the state.
1282
961
  */
1283
- getCurrentVariant(): Variant | undefined;
962
+ getName(): string;
1284
963
  /**
1285
- * @returns A list of valid variants for this step. Does not include disabled variants.
964
+ * @returns A human friendly title.
1286
965
  */
1287
- getAvailableVariants(): Variant[];
966
+ getTitle(): string;
1288
967
  /**
1289
- * @returns A list of all variants for this step, including disabled ones.
968
+ * @returns A human friendly description.
1290
969
  */
1291
- getAllVariants(): Variant[];
970
+ getDescription(): string;
1292
971
  /**
1293
- * Most step types have a base option type that variants can be selected for.
1294
- * Selects a specific variant for this step. This will execute all required changes to
1295
- * the design and update the metadata to include the new selection. Any conditions
1296
- * that would be triggered will also be executed.
972
+ * @returns The type of the global property. Use this to determine how to render the property.
1297
973
  */
1298
- abstract selectVariant(variant: Variant): Promise<void>;
974
+ getType(): AspectType;
1299
975
  /**
1300
- * @returns A unique identifier for this step within the workflow.
976
+ * @returns The underlying property data object.
1301
977
  */
1302
- getId(): string;
978
+ getRawProperty(): GlobalPropertyConfigurationAspect;
1303
979
  /**
1304
- * @returns The name of the step
980
+ * Applies the global state to all shared steps, if the state is set.
981
+ * @param targetExperiences Optionally filter the workflow experiences it should be applied to.
1305
982
  */
1306
- getName(): string;
983
+ abstract applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1307
984
  /**
1308
- * @returns A message that can accompany the step name in UI components. Used to describe the purpose of the step in more detail.
985
+ * Returns all steps that share this property.
986
+ * @param targetExperiences Optionally filter the steps to only those in the given experiences.
1309
987
  */
1310
- getHelpText(): string | undefined;
988
+ protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
989
+ protected getStateValue(): string | undefined;
990
+ }
991
+ /**
992
+ * A file upload global property allows for setting a frame image against all shared steps.
993
+ */
994
+ declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
995
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
1311
996
  /**
1312
- * @returns The type of the step handle.
997
+ * Select an image to be used for all shared steps.
998
+ * @param asset The asset to use.
999
+ * @returns A promise resolving when all affected steps have been updated.
1313
1000
  */
1314
- getType(): StepType;
1001
+ selectImage(asset: Asset): Promise<void>;
1002
+ canUseBackgroundRemover(): Promise<boolean>;
1315
1003
  /**
1316
- * @returns The underlying data for this step. Favor using the step handle methods instead of this.
1004
+ * Removes the background from an image, stores it in the state, and returns the new asset.
1005
+ * @param applyNewAsset Optionally applies the new asset to all shared steps. Default: `true`.
1006
+ * @returns A promise that resolves with the newly generated Asset.
1317
1007
  */
1318
- getRaw(): Step<T>;
1319
- getTags(): string[];
1320
- hasTag(tag: string): boolean;
1008
+ removeBackgroundFromImage(applyNewAsset?: boolean): Promise<Asset>;
1321
1009
  /**
1322
- * @param type The AspectType to fetch the value for.
1323
- * @returns A boolean indicating whether this step should override Global Properties.
1324
- * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
1325
- * and when this step is associated with one or more Global Property Aspects.
1010
+ * Returns `true` if the state has an image assigned, otherwise `false`.
1326
1011
  */
1327
- getOverrideGlobalPropertyConfiguration(type: AspectType): boolean;
1012
+ hasImage(): boolean;
1328
1013
  /**
1329
- * Sets whether or not this step should override Global Properties.
1330
- * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
1331
- * and when this step is associated with one or more Global Property Aspects.
1332
- * @param type The AspectType to override.
1014
+ * Retrieves the current image selection, if one exists.
1015
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1333
1016
  */
1334
- setOverrideGlobalPropertyConfiguration(type: AspectType, value: boolean): void;
1017
+ getImage(): Promise<Asset | undefined>;
1335
1018
  /**
1336
- * Retrieves the identifiers of all of the configured aspects for the specified Global Property Configuration.
1337
- * @param configurationId The ID of the Global Property Configuration. You can usually find this with `bundle.getGlobalPropertyConfiguration()?.id`
1338
- * @returns An array of strings matching the keys of all the Global Property Aspects in the Configuration that this step is configured to use.
1019
+ * Retrieves the original, unmodified image selection, if one exists.
1020
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1339
1021
  */
1340
- getGlobalPropertyAspects(configurationId: string): string[];
1022
+ getOriginalImage(): Promise<Asset | undefined>;
1341
1023
  /**
1342
- * Fires any configured animations on the 3D preview for this step.
1343
- * This includes camera & model animations. If the preview is unavailable
1344
- * this function will do nothing.
1024
+ * Retrieves the version of the image selection that has the background removed, if one exists.
1025
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1345
1026
  */
1346
- executeAnimations(): void;
1027
+ getBackgroundRemovedImage(): Promise<Asset | undefined>;
1028
+ getUseOriginalImage(): boolean;
1029
+ setUseOriginalImage(value: boolean): Promise<void>;
1030
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1031
+ private applyImageSelection;
1032
+ private updateSharedStepStorage;
1347
1033
  }
1348
-
1349
- declare const createDesign: (workflowManager: WorkflowManager, workflow: Workflow, layouts: ILayout[], getReducerState: () => CommandState, product: Product, transaction: Transaction, workflowSelections: WorkflowSelections, designName: string, onProgressUpdate: DesignCreationProgressUpdate, createPreviewImage: (shouldRender3D?: boolean, transactionId?: string) => Promise<string | undefined>, workflowMetadata?: WorkflowMetadata) => Promise<DesignCreationMessage>;
1350
- interface SavedDesign {
1351
- /**
1352
- * The user's name for this saved design.
1353
- */
1354
- title: string;
1355
- /**
1356
- * A URL pointing to an image of the design. Typically a data URL
1357
- */
1358
- thumbnail?: string;
1034
+ declare class TextGlobalPropertyHandle extends GlobalPropertyHandle {
1035
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
1359
1036
  /**
1360
- * The ID of the transaction relating to this design.
1037
+ * Gets the current text
1361
1038
  */
1362
- transactionId: string;
1039
+ getText(): string;
1363
1040
  /**
1364
- * The product ID for this transaction.
1041
+ * Set the text.
1365
1042
  */
1366
- productId: string;
1043
+ setText(text: string): Promise<void>;
1044
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1045
+ private applyTextSelection;
1046
+ }
1047
+ /**
1048
+ * An option property handle represents a property that can
1049
+ * affect the option of steps across multiple transactions.
1050
+ */
1051
+ declare class OptionGlobalPropertyHandle extends GlobalPropertyHandle {
1052
+ protected optionResource?: OptionResource;
1053
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1367
1054
  /**
1368
- * The integration product ID related to this order.
1055
+ * Gets the currently selected variant, or undefined if no variant is selected.
1369
1056
  */
1370
- integrationProductId: string;
1057
+ getCurrentVariant(): Variant | undefined;
1371
1058
  /**
1372
- * The name of the workflow annotated at time of save (may be different from current workflow name).
1059
+ * @returns A list of valid variants for this step. Does not include disabled variants.
1373
1060
  */
1374
- workflowName: string;
1061
+ getAvailableVariants(): Variant[];
1375
1062
  /**
1376
- * The ID of the workflow annotated at time of save.
1063
+ * @returns A list of all variants for this step, including disabled ones.
1377
1064
  */
1378
- workflowId: string;
1065
+ getAllVariants(): Variant[];
1379
1066
  /**
1380
- * The last edit that occured on this saved design.
1067
+ * Select a given variant on the option for all shared steps.
1068
+ * @param variant The variant to select.
1381
1069
  */
1382
- lastEdited: Date;
1070
+ selectVariant(variant: Variant): Promise<void>;
1071
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1072
+ private applyVariantSelection;
1383
1073
  }
1384
1074
  /**
1385
- * The design service exposes helper functionality wrapping important design management operations.
1386
- * NOTE: In the future this interface should allow for storing/pulling designs from the server.
1075
+ * A color option property handle represents a property that can
1076
+ * affect the option of steps across multiple transactions. This class is a specialization of the OptionGlobalPropertyHandle which includes functionality for
1077
+ * setting custom color values when a custom color variant is selected.
1387
1078
  */
1388
- declare class DesignService {
1389
- readonly localPersistenceKey = "designTransactions";
1390
- private storageMethod;
1391
- private designSavedListeners;
1392
- /**
1393
- * @param func The function to call when a design is saved.
1394
- */
1395
- attachSaveListener(func: (design: SavedDesign) => void): void;
1079
+ declare class ColorOptionGlobalPropertyHandle extends OptionGlobalPropertyHandle {
1080
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1396
1081
  /**
1397
- * @param func The function to remove from the list of listeners.
1082
+ * Sets a custom color on the global state.
1398
1083
  */
1399
- detachSaveListener(func: (design: SavedDesign) => void): void;
1084
+ setCustomColor(color: string): void;
1400
1085
  /**
1401
- * Gets the currently persisted designs.
1086
+ * Gets the custom color used by the global state.
1402
1087
  */
1403
- getSavedDesigns(): Promise<SavedDesign[]>;
1404
- /**
1405
- * Search for a transaction that has been saved.
1406
- * @param transactionId The id to search for.
1407
- * @returns The transaction for the given id provided it has been saved. undefined if it doesn't exist.
1408
- */
1409
- getSavedDesignByTransaction(transactionId: string): Promise<SavedDesign | undefined>;
1410
- /**
1411
- * Saves a design to storage.
1412
- * @param design The design to save.
1413
- */
1414
- addDesign(design: SavedDesign): Promise<void>;
1415
- /**
1416
- * Change the user's name of the given saved design.
1417
- */
1418
- renameDesign(transactionId: string, title: string): Promise<void>;
1088
+ getCustomColor(): string;
1089
+ }
1090
+
1091
+ interface GlobalPropertyStateManager {
1092
+ getInitializationPromise(): Promise<void>;
1093
+ getGlobalPropertyState(): GlobalPropertyState | undefined;
1094
+ getAspect(name: string): string | undefined;
1095
+ getAspectStorage(name: string): GlobalPropertyStateAspectStorage | undefined;
1419
1096
  /**
1420
- * Removes a given design from storage.
1421
- * @param transactionId
1097
+ * Updates the value of a named aspect in the state.
1098
+ * @param name The name (key) of the aspect. This must match the key in the associated Global Property Config
1099
+ * @param value The value, represented as a string.
1100
+ * @param storage Optional: Additional data storage for the aspect. Not specifying this parameter, or providing `undefined`, will not update the
1101
+ * storage (if it already exists). Providing `null` will clear the existing storage.
1422
1102
  */
1423
- removeDesign(transactionId: string): Promise<void>;
1424
- private setDesigns;
1103
+ setAspect(name: string, value: string, storage?: GlobalPropertyStateAspectStorage | null): Promise<void>;
1104
+ setAspectStorage(name: string, storage: GlobalPropertyStateAspectStorage | null): Promise<void>;
1105
+ setBundleOptions(bundleOptions?: BundleOptions): void;
1106
+ }
1107
+ interface BundleOptions {
1108
+ additionalHeaders?: {
1109
+ [key: string]: string;
1110
+ };
1425
1111
  }
1426
- declare const designService: DesignService;
1427
1112
 
1428
1113
  /**
1429
- * A scene is a collection of steps that can be used to group steps together.
1114
+ * A collection of products that can be used to form a bundle.
1430
1115
  */
1431
- interface Scene {
1116
+ declare class ProductCollection {
1117
+ private readonly collection;
1118
+ constructor(collection: ProductCollectionResource);
1432
1119
  /**
1433
- * The unique identifier for the scene.
1120
+ * The ID of the product collection.
1434
1121
  */
1435
- id?: string;
1122
+ getId(): string;
1436
1123
  /**
1437
- * The name of the scene.
1124
+ * The name of the collection.
1438
1125
  */
1439
- name: string;
1126
+ getName(): string;
1440
1127
  /**
1441
- * The steps that are part of the scene. A list of ids. See getStepById.
1128
+ * A list of products in this collections with useful helpers for interacting with them.
1442
1129
  */
1443
- stepIds: string[];
1130
+ getProducts(): CollectionProduct[];
1131
+ /**
1132
+ * A list of products in this collections with useful helpers for interacting with them.
1133
+ */
1134
+ fetchProducts(): Promise<CollectionProduct[]>;
1135
+ getTransformCollection(): TransformCollection$1 | undefined;
1136
+ /**
1137
+ * The raw collection resource. This is generally not needed and should be avoided.
1138
+ */
1139
+ getResource(): ProductCollectionResource;
1444
1140
  }
1445
1141
  /**
1446
- * State related to a workflow experience.
1142
+ * A collection product is a product within a ProductCollection. It provides a simple interface for interacting with the product.
1447
1143
  */
1448
- interface ExperienceOptions {
1449
- product: Product;
1450
- transaction: Transaction;
1451
- workflow?: Workflow;
1144
+ declare class CollectionProduct {
1145
+ private readonly product;
1146
+ private readonly productResource;
1147
+ constructor(productCollectionProduct: ProductCollectionProductResource);
1452
1148
  /**
1453
- * @deprecated favor inject / eject functions.
1149
+ * The ID of the product in SpiffCommerce.
1150
+ * @returns
1454
1151
  */
1455
- previewService?: ThreeDPreviewService;
1456
- modelContainer?: ModelContainer;
1457
- renderableContextService?: LayoutPreviewService;
1458
- layouts: ILayout[];
1459
- reloadedState?: LayoutsState;
1152
+ getId(): string;
1460
1153
  /**
1461
- * When true the experience is intended to be immutable.
1154
+ * The name of the product. Human readable.
1462
1155
  */
1463
- readOnly?: boolean;
1156
+ getName(): string;
1464
1157
  /**
1465
- * A function that communicates state changes to the server.
1158
+ * A helper function for getting integrations
1159
+ * @param type The type of integration you want.
1160
+ * @param externalId An external integration ID to further filter by. Otherwise we return the first encountered.
1161
+ * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
1466
1162
  */
1467
- stateMutationFunc: StateMutationFunc;
1163
+ getIntegrationByType(type: IntegrationType, externalId?: string): IntegrationProductResource;
1164
+ getCurrentIntegration(): IntegrationProductResource;
1468
1165
  /**
1469
- * Should be set to true when the experience is loaded from an existing transaction.
1470
- * FIXME: Wouldn't we know this from existance of reloadedState
1166
+ * A helper function for pulling the default workflow.
1471
1167
  */
1472
- isReloadedTransaction?: boolean;
1168
+ getDefaultWorkflow(): ProductWorkflow$1;
1473
1169
  /**
1474
- * When true the system will treat steps with
1475
- * a single variant as renderable. False
1476
- * by default.
1170
+ * @returns All workflows associated with this Product.
1477
1171
  */
1478
- singleVariantsRenderable?: boolean;
1172
+ getAllWorkflows(): ProductWorkflow$1[];
1479
1173
  /**
1480
- * When true, will delay syncing the workflow state until manually enabled.
1174
+ * A list of all integrations this product is connected to.
1481
1175
  */
1482
- delayWorkflowStateSync?: boolean;
1176
+ getIntegrations(): IntegrationProductResource[];
1177
+ /**
1178
+ * The raw product resource. This is generally not needed and should be avoided.
1179
+ */
1180
+ getResource(): Product;
1181
+ /**
1182
+ * Gets the base price of the product. Optionally include additional product pricing.
1183
+ * @param includeAdditionalProduct Optionally include additional product pricing. You must provide at least one of the fields on this object.
1184
+ * @returns
1185
+ */
1186
+ getBasePrice(includeAdditionalProduct?: {
1187
+ /**
1188
+ * The integration type to locate the additional product on.
1189
+ */
1190
+ integrationType?: IntegrationType;
1191
+ /**
1192
+ * The external ID of the integration to locate the additional product on.
1193
+ */
1194
+ externalId?: string;
1195
+ /**
1196
+ * The internal Spiff integration ID to locate the additional product on.
1197
+ */
1198
+ integrationId?: string;
1199
+ }): number;
1483
1200
  }
1484
1201
  /**
1485
- * A Workflow experience encapsulates the workflow manager and command context. It
1486
- * provides a simplified interface for interacting with the workflow manager. You
1487
- * should get an instance of this class from a Client you have constructed previously.
1202
+ * Represents a the relationship between a workflow and a product.
1488
1203
  */
1489
- interface WorkflowExperience {
1204
+ declare class ProductWorkflow$1 {
1205
+ private readonly workflow;
1206
+ constructor(workflow: ProductWorkflow);
1490
1207
  /**
1491
- * Get the bundle this experience is part of. May be undefined.
1208
+ * @returns The ID of this workflow, to be used when starting an experience.
1492
1209
  */
1493
- getBundle(): Bundle | undefined;
1210
+ getId(): string;
1494
1211
  /**
1495
- * Set the bundle this experience is part of. Can be cleared using undefined.
1212
+ * @returns The name of the workflow.
1496
1213
  */
1497
- setBundle(bundle: Bundle | undefined): any;
1214
+ getName(): string;
1498
1215
  /**
1499
- * Returns the client that was responsible for spawning this experience.
1216
+ * An image to be used to display this workflow in a UI to the customer.
1217
+ * @returns A resource URL.
1500
1218
  */
1501
- getClient(): SpiffCommerceClient;
1219
+ getThumbnail(): string;
1220
+ }
1221
+ /**
1222
+ * Represents a collection of transforms that can be applied inside a product collection.
1223
+ */
1224
+ declare class TransformCollection$1 {
1225
+ private readonly collection;
1226
+ constructor(collection: TransformCollection);
1502
1227
  /**
1503
- * State related to the design of the user.
1228
+ * @returns The ID of the transform collection.
1504
1229
  */
1505
- getCommandContext(): CommandContext;
1230
+ getId(): string;
1506
1231
  /**
1507
- * Returns true when the user may only view the design.
1232
+ * @returns The name of the transform collection.
1508
1233
  */
1509
- getIsReadOnly(): boolean;
1234
+ getName(): string;
1510
1235
  /**
1511
- * Get the low level workflow amanager instance for this experience. Don't touch this unless you're willing to break things.
1236
+ * @returns The transforms in this collection.
1512
1237
  */
1513
- getWorkflowManager(): WorkflowManager;
1238
+ getTransforms(): Transform[];
1239
+ }
1240
+ /**
1241
+ * Represents the translations, rotation & scale of a product in 3D space.
1242
+ */
1243
+ declare class Transform {
1244
+ private readonly transform;
1245
+ constructor(position: TransformCollectionTransform);
1514
1246
  /**
1515
- * Returns the step matching a given name, undefined if not found.
1516
- * @param id The id the step must match.
1247
+ * @returns The ID of the transform.
1517
1248
  */
1518
- getStepById(id: string): StepHandle<AnyStepData> | undefined;
1249
+ getId(): string;
1519
1250
  /**
1520
- * Returns the step matching a given name, undefined if not found.
1521
- * @param name The name the step must match.
1251
+ * @returns The name of the transform.
1522
1252
  */
1523
- getStepByName(name: string): StepHandle<AnyStepData> | undefined;
1253
+ getName(): string;
1524
1254
  /**
1525
- * Returns all steps matching a specific type in the workflow. These steps
1526
- * may be across multiple scenes and may or may not be active based on condition state.
1255
+ * @returns The transformation to be used to place the object.
1527
1256
  */
1528
- getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1257
+ get(): BundleStateTransform;
1258
+ }
1259
+
1260
+ /**
1261
+ * A bundle serves as a container for a set of workflow experience.
1262
+ */
1263
+ interface Bundle$1 {
1529
1264
  /**
1530
- * Returns all steps that are children of a given scene.
1531
- * @param scene The scene you want the steps for.
1265
+ * @returns The client that this bundle is associated with.
1532
1266
  */
1533
- getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
1267
+ getClient(): SpiffCommerceClient;
1534
1268
  /**
1535
- * Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
1269
+ * @returns The id of the bundle entity in the Spiff Commerce system.
1536
1270
  */
1537
- getSteps(): StepHandle<AnyStepData>[];
1271
+ getId(): string;
1538
1272
  /**
1539
- * Returns a list of scenes that are configured in the workflow. Each scene
1540
- * contains a list of steps. See getStepsByScene to access these.
1273
+ * @returns The name of the bundle.
1541
1274
  */
1542
- getScenes(): Scene[];
1275
+ getName(): string;
1543
1276
  /**
1544
- * Returns the total cost in subunits for all selections made on the design.
1545
- * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1277
+ * Set the name of the bundle.
1278
+ * @param name The new name for the bundle.
1279
+ * @returns A promise that resolves when the name has been updated in the Spiff Commerce system.
1546
1280
  */
1547
- getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
1281
+ setName(name: string): Promise<void>;
1548
1282
  /**
1549
- * Returns the total cost in subunits for the base product.
1550
- * @param includeAdditionalProduct When true the additional product cost will be included in the total (if configured).
1551
- * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1283
+ * @returns Custom metadata associated with this bundle.
1552
1284
  */
1553
- getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
1285
+ getMetadata(): Map<string, string>;
1554
1286
  /**
1555
- * If an additional product is configured, returns the base price of that product. Returns undefined otherwise.
1556
- * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1287
+ * Set custom metadata associated with this bundle.
1288
+ * @param metadata Updated map of metadata items.
1289
+ * @returns A promise that resolves when the metadata has been updated in the Spiff Commerce system.
1557
1290
  */
1558
- getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
1291
+ setMetadata(metadata: Map<string, string>): Promise<void>;
1559
1292
  /**
1560
- * A convenience function returning the sum of the selection and base price values.
1561
- * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
1293
+ * Set the name and metadata for this bundle.
1294
+ * @param name The new name for the bundle.
1295
+ * @param metadata Updated map of metadata items.
1296
+ * @returns A promise that resolves when the name and metadata have been updated in the Spiff Commerce system.
1562
1297
  */
1563
- getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
1298
+ setNameAndMetadata(name: string, metadata: Map<string, string>): Promise<void>;
1564
1299
  /**
1565
- * The price break percentage that is expected to be applied in price calculations.
1300
+ * Returns true if this bundle is associated with a Product Collection that is linked to a Global Property Configuration
1566
1301
  */
1567
- priceBreakToBeApplied(): number;
1302
+ hasGlobalProperties(): boolean;
1568
1303
  /**
1569
- * Calculates the price break and fires the "PriceBreakChanged" event if required.
1570
- * This function is primarily intended for internal use.
1304
+ * Get a handle to the global properties available within this bundle. Setting values
1305
+ * via this method will make selections on all bundles that share the property.
1571
1306
  */
1572
- checkForPriceBreakChanges(): void;
1307
+ getGlobalProperties(): Promise<GlobalPropertyHandle[]>;
1573
1308
  /**
1574
- * Takes selections made by the user in another workflow and applies them to this workflow. For
1575
- * selections to be copied they must both have a matching global property configuration.
1576
- * @param experience The experience to take selections from.
1577
- * @param filter A list of steps to apply the selections to. If undefined all steps will be updated.
1309
+ * Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
1578
1310
  */
1579
- copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1311
+ getGlobalPropertyStateManager(): GlobalPropertyStateManager;
1580
1312
  /**
1581
- * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
1582
- * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
1583
- * @param details The new customer details. Only email is supported.
1584
- * @deprecated Use assignCustomerDetails instead.
1313
+ * Get the total in subunits for all global properties in this bundle.
1585
1314
  */
1586
- attachCustomerDetails(details: {
1587
- /**
1588
- * An email used for things like sending a design to the user.
1589
- */
1590
- email: string;
1591
- }): Promise<void>;
1315
+ getGlobalPropertyTotalSubunits(): Promise<number>;
1592
1316
  /**
1593
- * Attach specific details about the customer to the experience. This is useful for things like retargeting.
1594
- * From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
1595
- * @param details The new customer details.
1317
+ * Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
1596
1318
  */
1597
- assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
1319
+ getTotalSubunits(): number;
1598
1320
  /**
1599
- * Attaches a listener to the scenes on a workflow experience. The scenes returned are a subset of the scenes configured in the
1600
- * workflow and are based on the current state of the experience. This is useful for building a navigation menu.
1601
- * @param cb The callback to be called when the scenes change. The new scenes are passed as an argument.
1321
+ * Retrieves the product collection associated with this bundle.
1322
+ * If the bundle is not associated with a product collection, this method will return undefined.
1602
1323
  */
1603
- attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1324
+ getProductCollection(): ProductCollection | undefined;
1604
1325
  /**
1605
- * Detaches a listener from the scenes on a workflow experience.
1326
+ * Add another workflow experience to this bundle.
1327
+ * @param experience The workflow experience to add to this bundle.
1606
1328
  */
1607
- detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1329
+ addWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1608
1330
  /**
1609
- * Saves this experience to storage. This may be local or remote depending
1610
- * on configuration.
1611
- * @param title The title for the saved design.
1331
+ * Adds multiple workflow experiences to this bundle.
1332
+ * @param experiences The workflow experiences to add to this bundle.
1612
1333
  */
1613
- save(title: string): Promise<SavedDesign>;
1334
+ addWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1614
1335
  /**
1615
- * Returns a copy of the currently loaded design as a new, seperated workflow experience with
1616
- * a fresh transaction.
1336
+ * Remove a workflow experience from this bundle.
1337
+ * @param experience The workflow experience to remove from this bundle.
1617
1338
  */
1618
- copy(): Promise<WorkflowExperience>;
1339
+ removeWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1619
1340
  /**
1620
- * Creates a data URL preview for the current design.
1341
+ * Removes multiple workflow experiences from this bundle.
1342
+ * @param experiences The workflow experiences to remove from this bundle.
1621
1343
  */
1622
- createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
1344
+ removeWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1623
1345
  /**
1624
- * To be called when the workflow experience is considered completed by the user.
1625
- * @param onProgressUpdate Progress callback for finalizing the design. Optional
1626
- * @param capturePreviewImage When true a preview image will be generated for the design. Defaults to true.
1346
+ * Remove a workflow experience from this bundle by transaction.
1347
+ * @param transaction The transaction to remove from this bundle.
1627
1348
  */
1628
- onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1349
+ removeWorkflowExperienceByTransaction(transaction: Transaction): Promise<void>;
1629
1350
  /**
1630
- * Returns the metadata associated with this workflow experience.
1631
- * This is a combination of the metadata from the workflow, and the selections made by the user.
1351
+ * Removes multiple workflow experiences from this bundle by their transactions.
1352
+ * @param transactions The transactions to remove from this bundle.
1632
1353
  */
1633
- getExportedData(): Map<string, {
1634
- [key: string]: string;
1635
- }>;
1354
+ removeWorkflowExperiencesByTransactions(transactions: Transaction[]): Promise<void>;
1636
1355
  /**
1637
- * Get the quantity of this WorkflowExperience's Transaction.
1638
- * @returns The amount that was, or will be, ordered.
1356
+ * Inserts the given workflow experience into the bundle at the given index.
1357
+ * NOTE: If you intend to insert a workflow experience at the end of the bundle, use `addWorkflowExperience` instead as it is more efficient.
1358
+ * @param experience The workflow experience to insert.
1359
+ * @param index The index to insert the workflow experience at.
1639
1360
  */
1640
- getQuantity(): number;
1361
+ insertWorkflowExperience(experience: WorkflowExperience, index: number): Promise<void>;
1641
1362
  /**
1642
- * Sets the quantity of this WorkflowExperience's Transaction.
1643
- * @throws {Error} if the WorkflowExperience is read-only.
1644
- * @throws {RangeError} if the value is below 1.
1645
- * @param quantity The amount that was, or will be, ordered.
1646
- * @returns A promise that resolves when the Transaction has been updated on the server.
1363
+ * Replaces a workflow experience at the given index with the given workflow experience. This essentially removes the old one and inserts the new one.
1364
+ * @param index The index to replace the workflow experience at.
1365
+ * @param experience The workflow experience to replace the old one with.
1647
1366
  */
1648
- setQuantity(quantity: number): Promise<void>;
1367
+ replaceWorkflowExperience(index: number, experience: WorkflowExperience): Promise<void>;
1649
1368
  /**
1650
- * Registers a callback function to be called when the specified event is raised.
1651
- * @param type The type of event to listen for.
1652
- * @param callback The function to call when the event occurs.
1369
+ * Swaps the workflow experiences at the given indices.
1653
1370
  */
1654
- addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
1371
+ swapWorkflowExperiences(a: number, b: number): Promise<void>;
1655
1372
  /**
1656
- * Removes a previously registered callback.
1657
- * @param type The type of event.
1658
- * @param callback The function to remove.
1373
+ * Returns all workflow experiences currently added to this bundle.
1659
1374
  */
1660
- removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
1661
- }
1662
- declare enum WorkflowExperienceEventType {
1663
- QuantityChanged = "QuantityChanged",
1664
- PriceBreakChanged = "PriceBreakChanged"
1665
- }
1666
- declare class WorkflowExperienceImpl implements WorkflowExperience {
1667
- readonly client: SpiffCommerceClient;
1668
- readonly commandContext: CommandContext;
1669
- readonly workflowManager: WorkflowManager;
1670
- readonly isReadOnly: boolean;
1671
- readonly cachedStepHandles: Map<string, StepHandle<any>>;
1375
+ getWorkflowExperiences(): WorkflowExperience[];
1672
1376
  /**
1673
- * Bundle this experience has been added to.
1377
+ * Sort the list of workflow experiences. The sorting is performed locally, and then the order is updated in the Spiff Commerce system.
1378
+ * @returns A promise that resolves when the re-ordering of the workflow experiences has been updated in the Spiff Commerce system.
1379
+ * The sorting will occur immediately, but the promise will not resolve until the Spiff Commerce system has been updated.
1674
1380
  */
1675
- private bundle?;
1676
- private currentPriceBreak;
1677
- private renderableScenes;
1678
- private renderableSceneCallbacks;
1679
- private eventCallbacks;
1680
- constructor(client: SpiffCommerceClient, experienceOptions: ExperienceOptions);
1681
- getBundle(): Bundle | undefined;
1682
- setBundle(bundle: Bundle): void;
1683
- getClient(): SpiffCommerceClient;
1684
- getIsReadOnly(): boolean;
1685
- getCommandContext(): CommandContext;
1686
- getWorkflowManager(): WorkflowManager;
1687
- createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
1688
- getStepById(id: string): StepHandle<any> | undefined;
1689
- getSteps(): StepHandle<AnyStepData>[];
1690
- getScenes(): Scene[];
1691
- getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
1692
- getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
1693
- getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
1694
- getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
1695
- private getPriceSubUnitsAfterPriceBreaks;
1696
- priceBreakToBeApplied(): number;
1697
- checkForPriceBreakChanges(): void;
1698
- private getMatchingExperiencesFromBundle;
1699
- private updatePriceBreak;
1700
- copySelectionsViaGlobalConfiguration(bundle: Bundle, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
1701
- getStepByName(name: string): TextStepHandle | FrameStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
1702
- getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1703
- getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
1704
- attachCustomerDetails(details: {
1705
- email: string;
1706
- }): Promise<void>;
1707
- assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
1708
- attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1709
- detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
1710
- debouncedSavedDesignUpdate: lodash.DebouncedFunc<() => Promise<void>>;
1711
- save(title?: string): Promise<SavedDesign>;
1712
- copy(): Promise<WorkflowExperience>;
1713
- onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1381
+ sortWorkflowExperiences(sortFunc: (expA: WorkflowExperience, expB: WorkflowExperience) => number): Promise<void>;
1714
1382
  /**
1715
- * @param step The step to test against.
1716
- * @returns Returns true when a valid handle is implemented for a given step type. Certain steps don't support handles, such as silent illustrations.
1383
+ * @returns The number of workflow experiences in this bundle.
1717
1384
  */
1718
- private stepHasHandle;
1719
- private getCanvasObjectURLAsync;
1720
- getExportedData(): Map<string, {
1721
- [key: string]: string;
1722
- }>;
1723
- getQuantity(): number;
1724
- setQuantity(quantity: number): Promise<void>;
1725
- addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
1726
- removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
1727
- private callEvent;
1728
- }
1729
-
1730
- /**
1731
- * A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
1732
- * bundles can return a handle for any global properties associated to the collection.
1733
- */
1734
- declare abstract class GlobalPropertyHandle {
1735
- protected readonly bundle: Bundle;
1736
- protected readonly property: GlobalPropertyConfigurationAspect;
1737
- constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect);
1385
+ getWorkflowExperienceCount(): number;
1738
1386
  /**
1739
- * @returns The name of the global property. This is the key used to store the property in the state.
1387
+ * Add a stakeholder to this bundle. If the stakeholder already exists, it will be updated. Write access to the bundle is required.
1388
+ * @param customerDetails The details of the customer to add. The emailAddress field is required.
1389
+ * @param stakeholderType The type of stakeholder to add. Defaults to Owner.
1740
1390
  */
1741
- getName(): string;
1391
+ addStakeholder(customerDetails: CustomerDetailsInput, stakeholderType?: StakeholderType): Promise<void>;
1742
1392
  /**
1743
- * @returns A human friendly title.
1393
+ * Removes a stakeholder from this bundle. Write access to the bundle is required.
1394
+ * @param emailAddress The email address of the stakeholder to remove.
1744
1395
  */
1745
- getTitle(): string;
1396
+ removeStakeholder(emailAddress: string): Promise<void>;
1746
1397
  /**
1747
- * @returns A human friendly description.
1398
+ * Updates all stakeholders associated with this bundle. Write access to the bundle is required.
1399
+ * @param stakeholders An array of stakeholders to update. Unknown stakeholders will be added, and absent stakeholders will be removed.
1748
1400
  */
1749
- getDescription(): string;
1401
+ updateStakeholders(stakeholders: BundleStakeholderInput[]): Promise<void>;
1750
1402
  /**
1751
- * @returns The type of the global property. Use this to determine how to render the property.
1403
+ * Retrieves all stakeholders associated with this bundle.
1752
1404
  */
1753
- getType(): AspectType;
1405
+ getAllStakeholders(): Promise<BundleStakeholder[]>;
1754
1406
  /**
1755
- * @returns The underlying property data object.
1407
+ * Finalizes all experiences within the bundle. This will return a promise that resolves when all experiences have been finalized.
1408
+ * The promise resolves with a list of messages that indicate the status of each experience including
1409
+ * helpful details like what product to add to cart on supported e-commerce platforms.
1410
+ * @param onProgressUpdate A callback that will be called when the progress of the finalization changes.
1411
+ * @param createPreviewImage A callback that will be called when a preview image is required. This is used to generate a preview image for the design.
1412
+ * If this callback is not provided, no preview image will be generated.
1413
+ * @returns {BundleDesignCreationMessage} An object containing an array of design messages, along with the Bundle's Id and the event type.
1756
1414
  */
1757
- getRawProperty(): GlobalPropertyConfigurationAspect;
1415
+ finish(onProgressUpdate?: DesignCreationProgressUpdate, createPreviewImage?: (workflowExperience: WorkflowExperience) => Promise<string | undefined>): Promise<BundleDesignCreationMessage>;
1758
1416
  /**
1759
- * Applies the global state to all shared steps, if the state is set.
1760
- * @param targetExperiences Optionally filter the workflow experiences it should be applied to.
1417
+ * Add an event listener to this bundle.
1418
+ * @param event The event to listen for. Currently only "conditional-global-properties-changed" is supported.
1419
+ * @param listener The listener to call when the event occurs.
1761
1420
  */
1762
- abstract applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1421
+ addEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
1763
1422
  /**
1764
- * Returns all steps that share this property.
1765
- * @param targetExperiences Optionally filter the steps to only those in the given experiences.
1423
+ * Remove a previously added event listener from this bundle.
1766
1424
  */
1767
- protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
1768
- protected getStateValue(): string | undefined;
1769
- }
1770
- /**
1771
- * A file upload global property allows for setting a frame image against all shared steps.
1772
- */
1773
- declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
1774
- constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect);
1425
+ removeEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
1775
1426
  /**
1776
- * Select an image to be used for all shared steps.
1777
- * @param asset The asset to use.
1778
- * @returns A promise resolving when all affected steps have been updated.
1427
+ * Retrieves the current preview service for this bundle, if one exists.
1428
+ * If a preview service was specified when calling client.getExistingBundle, this will return that service.
1429
+ * Call `setPreviewService` to update the preview service for this bundle.
1779
1430
  */
1780
- selectImage(asset: Asset): Promise<void>;
1431
+ getPreviewService(): ThreeDPreviewService | undefined;
1781
1432
  /**
1782
- * Removes the background from an image, stores it in the state, and returns the new asset.
1783
- * @param applyNewAsset Optionally applies the new asset to all shared steps. Default: `true`.
1784
- * @returns A promise that resolves with the newly generated Asset.
1433
+ * Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will
1434
+ * also automatically inject the preview service into any new workflow experiences that are added to this bundle.
1435
+ * If this method is called with no arguments or undefined, the preview service will be removed from this bundle.
1436
+ * @param previewService The preview service to use for this bundle.
1437
+ * @returns A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.
1785
1438
  */
1786
- removeBackgroundFromImage(applyNewAsset?: boolean): Promise<Asset>;
1439
+ setPreviewService(previewService?: ThreeDPreviewService): Promise<void>;
1787
1440
  /**
1788
- * Returns `true` if the state has an image assigned, otherwise `false`.
1441
+ * Returns a promise that resolves when the bundle has been initialized.
1442
+ * This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
1789
1443
  */
1790
- hasImage(): boolean;
1444
+ getInitializationPromise(): Promise<void>;
1791
1445
  /**
1792
- * Retrieves the current image selection, if one exists.
1793
- * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1446
+ * Sets the position, rotation, and scale of a named transform for a workflow experience within this bundle.
1447
+ * @param workflowExperience The workflow experience to update.
1448
+ * @param transformName The name of the transform.
1449
+ * @param transform An object containing `position`, `rotation`, and `scale` properties. Each property is an object with `x`, `y`, and `z` properties.
1794
1450
  */
1795
- getImage(): Promise<Asset | undefined>;
1451
+ updateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string, transform: BundleStateTransform): Promise<void>;
1796
1452
  /**
1797
- * Retrieves the original, unmodified image selection, if one exists.
1798
- * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1453
+ * Sets a transform of a workflow experience within this bundle to be the active one.
1454
+ * @param workflowExperience The workflow experience to update.
1455
+ * @param transform The name of the transform to make the active transform.
1799
1456
  */
1800
- getOriginalImage(): Promise<Asset | undefined>;
1457
+ activateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string): Promise<void>;
1801
1458
  /**
1802
- * Retrieves the version of the image selection that has the background removed, if one exists.
1803
- * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1459
+ * @returns The raw Global Property Configuration that is in use, otherwise `undefined`.
1804
1460
  */
1805
- getBackgroundRemovedImage(): Promise<Asset | undefined>;
1806
- getUseOriginalImage(): boolean;
1807
- setUseOriginalImage(value: boolean): Promise<void>;
1808
- applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1809
- private applyImageSelection;
1810
- private updateSharedStepStorage;
1461
+ getGlobalPropertyConfiguration(): GlobalPropertyConfiguration | undefined;
1462
+ setBundleOptions(bundleOptions?: BundleOptions): any;
1811
1463
  }
1812
- declare class TextGlobalPropertyHandle extends GlobalPropertyHandle {
1813
- constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect);
1814
- /**
1815
- * Gets the current text
1816
- */
1817
- getText(): string;
1818
- /**
1819
- * Set the text.
1820
- */
1821
- setText(text: string): Promise<void>;
1822
- applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1823
- private applyTextSelection;
1464
+ type BundleEventType = "conditional-global-properties-changed" | "workflow-experience-hover-enter" | "workflow-experience-hover-exit";
1465
+ type BundleEventData = ConditionalGlobalPropertiesChangedEventData | WorkflowExperienceHoverEventData;
1466
+ type BundleEvent = {
1467
+ bundle: Bundle$1;
1468
+ data: BundleEventData;
1469
+ event: BundleEventType;
1470
+ };
1471
+ interface ConditionalGlobalPropertiesChangedEventData {
1472
+ globalProperties: GlobalPropertyHandle[];
1824
1473
  }
1825
- /**
1826
- * An option property handle represents a property that can
1827
- * affect the option of steps across multiple transactions.
1828
- */
1829
- declare class OptionGlobalPropertyHandle extends GlobalPropertyHandle {
1830
- protected optionResource?: OptionResource;
1831
- constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1832
- /**
1833
- * Gets the currently selected variant, or undefined if no variant is selected.
1834
- */
1835
- getCurrentVariant(): Variant | undefined;
1836
- /**
1837
- * @returns A list of valid variants for this step. Does not include disabled variants.
1838
- */
1839
- getAvailableVariants(): Variant[];
1840
- /**
1841
- * @returns A list of all variants for this step, including disabled ones.
1842
- */
1843
- getAllVariants(): Variant[];
1844
- /**
1845
- * Select a given variant on the option for all shared steps.
1846
- * @param variant The variant to select.
1847
- */
1848
- selectVariant(variant: Variant): Promise<void>;
1849
- applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1850
- private applyVariantSelection;
1474
+ interface WorkflowExperienceHoverEventData {
1475
+ workflowExperience: WorkflowExperience;
1851
1476
  }
1477
+
1852
1478
  /**
1853
- * A color option property handle represents a property that can
1854
- * affect the option of steps across multiple transactions. This class is a specialization of the OptionGlobalPropertyHandle which includes functionality for
1855
- * setting custom color values when a custom color variant is selected.
1479
+ * A list of node types available in executions
1856
1480
  */
1857
- declare class ColorOptionGlobalPropertyHandle extends OptionGlobalPropertyHandle {
1858
- constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1859
- /**
1860
- * Sets a custom color on the global state.
1861
- */
1862
- setCustomColor(color: string): void;
1863
- /**
1864
- * Gets the custom color used by the global state.
1865
- */
1866
- getCustomColor(): string;
1481
+ declare enum NodeType {
1482
+ Split = "Split",
1483
+ TextJoin = "TextJoin",
1484
+ TextSlice = "TextSlice",
1485
+ TextUpper = "TextUpper",
1486
+ TextLower = "TextLower",
1487
+ ParseJson = "ParseJson",
1488
+ TextBuilder = "TextBuilder",
1489
+ Design = "Design",
1490
+ OverlayImage = "OverlayImage",
1491
+ OverlayText = "OverlayText",
1492
+ TableGenerator = "TableGenerator",
1493
+ QR = "QR",
1494
+ CSV = "CSV",
1495
+ PDF = "PDF",
1496
+ PNG = "PNG",
1497
+ Email = "Email",
1498
+ LocationDelivery = "LocationDelivery",
1499
+ TemplateEmail = "TemplateEmail",
1500
+ Map = "Map",
1501
+ Sort = "Sort",
1502
+ Group = "Group",
1503
+ InnerJoin = "InnerJoin",
1504
+ Contains = "Contains",
1505
+ Flatten = "Flatten",
1506
+ KeyValuePairs = "KeyValuePairs",
1507
+ ListConcatenate = "ListConcatenate",
1508
+ Repeat = "Repeat",
1509
+ Size = "Size",
1510
+ ListBuilder = "ListBuilder",
1511
+ MapBuilder = "MapBuilder",
1512
+ PairBuilder = "PairBuilder",
1513
+ AND = "AND",
1514
+ OR = "OR",
1515
+ NOT = "NOT",
1516
+ Equals = "Equals",
1517
+ Present = "Present",
1518
+ ManualOperation = "ManualOperation",
1519
+ Switch = "Switch",
1520
+ AssetMetadata = "AssetMetadata",
1521
+ DataSelect = "DataSelect",
1522
+ LayoutSelect = "LayoutSelect",
1523
+ TransactionMetadata = "TransactionMetadata",
1524
+ VariantSelection = "VariantSelection",
1525
+ StartTerminal = "StartTerminal",
1526
+ EndTerminal = "EndTerminal",
1527
+ MiscNote = "MiscNote",
1528
+ Assign = "Assign",
1529
+ CsvVlookup = "CsvVlookup",
1530
+ ProcessFlow = "ProcessFlow",
1531
+ TemporaryAssetUrl = "TemporaryAssetUrl",
1532
+ WebRequest = "WebRequest"
1867
1533
  }
1868
-
1869
- interface GlobalPropertyStateManager {
1870
- getInitializationPromise(): Promise<void>;
1871
- getGlobalPropertyState(): GlobalPropertyState | undefined;
1872
- getAspect(name: string): string | undefined;
1873
- getAspectStorage(name: string): GlobalPropertyStateAspectStorage | undefined;
1874
- /**
1875
- * Updates the value of a named aspect in the state.
1876
- * @param name The name (key) of the aspect. This must match the key in the associated Global Property Config
1877
- * @param value The value, represented as a string.
1878
- * @param storage Optional: Additional data storage for the aspect. Not specifying this parameter, or providing `undefined`, will not update the
1879
- * storage (if it already exists). Providing `null` will clear the existing storage.
1880
- */
1881
- setAspect(name: string, value: string, storage?: GlobalPropertyStateAspectStorage | null): Promise<void>;
1882
- setAspectStorage(name: string, storage: GlobalPropertyStateAspectStorage | null): Promise<void>;
1883
- setBundleOptions(bundleOptions?: BundleOptions): void;
1534
+ interface ExecutionNodeResponse {
1535
+ id: string;
1536
+ type: NodeType;
1537
+ artifacts: string;
1884
1538
  }
1885
- interface BundleOptions {
1886
- additionalHeaders?: {
1887
- [key: string]: string;
1888
- };
1539
+ interface ExecutionResponse {
1540
+ id: string;
1541
+ nodes: ExecutionNodeResponse[];
1542
+ completedAt?: string;
1543
+ failedAt?: string;
1889
1544
  }
1890
-
1891
1545
  /**
1892
- * A collection of products that can be used to form a bundle.
1546
+ * A service containing functionality for interacting with the Spiff Commerce API to execute and inspect the result of process flows.
1893
1547
  */
1894
- declare class ProductCollection {
1895
- private readonly collection;
1896
- constructor(collection: ProductCollectionResource);
1897
- /**
1898
- * The ID of the product collection.
1899
- */
1900
- getId(): string;
1901
- /**
1902
- * The name of the collection.
1903
- */
1904
- getName(): string;
1905
- /**
1906
- * A list of products in this collections with useful helpers for interacting with them.
1907
- */
1908
- getProducts(): CollectionProduct[];
1909
- /**
1910
- * A list of products in this collections with useful helpers for interacting with them.
1911
- */
1912
- fetchProducts(): Promise<CollectionProduct[]>;
1913
- getTransformCollection(): TransformCollection | undefined;
1548
+ declare class FlowService {
1914
1549
  /**
1915
- * The raw collection resource. This is generally not needed and should be avoided.
1550
+ *
1551
+ * @param id
1552
+ * @param inputs
1553
+ * @param options
1554
+ * @returns
1916
1555
  */
1917
- getResource(): ProductCollectionResource;
1556
+ execute(id: string, inputs: FlowExecutionInput[], options?: {
1557
+ sleepTime?: number;
1558
+ repeats?: number;
1559
+ }): Promise<FlowExecutionResult>;
1918
1560
  }
1919
1561
  /**
1920
- * A collection product is a product within a ProductCollection. It provides a simple interface for interacting with the product.
1562
+ * Handles preparing a flow input for transmission to the server.
1921
1563
  */
1922
- declare class CollectionProduct {
1923
- private readonly product;
1924
- private readonly productResource;
1925
- constructor(productCollectionProduct: ProductCollectionProductResource);
1926
- /**
1927
- * The ID of the product in SpiffCommerce.
1928
- * @returns
1929
- */
1930
- getId(): string;
1564
+ declare class FlowExecutionResult {
1565
+ protected readonly execution: ExecutionResponse;
1566
+ constructor(execution: ExecutionResponse);
1931
1567
  /**
1932
- * The name of the product. Human readable.
1568
+ * @returns The raw response from the server.
1933
1569
  */
1934
- getName(): string;
1570
+ getRaw(): ExecutionResponse;
1935
1571
  /**
1936
- * A helper function for getting integrations
1937
- * @param type The type of integration you want.
1938
- * @param externalId An external integration ID to further filter by. Otherwise we return the first encountered.
1939
- * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
1572
+ * @returns The nodes contained within the execution.
1940
1573
  */
1941
- getIntegrationByType(type: IntegrationType, externalId?: string): IntegrationProductResource;
1942
- getCurrentIntegration(): IntegrationProductResource;
1574
+ getNodes(): FlowExecutionNodeResult[];
1943
1575
  /**
1944
- * A helper function for pulling the default workflow.
1576
+ * @param type The type of node to return.
1577
+ * @returns A list of nodes matching the requested type.
1945
1578
  */
1946
- getDefaultWorkflow(): ProductWorkflow;
1579
+ getNodesByType(type: NodeType): FlowExecutionNodeResult[];
1947
1580
  /**
1948
- * @returns All workflows associated with this Product.
1581
+ * @returns A list of input nodes that exist in this execution.
1949
1582
  */
1950
- getAllWorkflows(): ProductWorkflow[];
1583
+ getInputs(): FlowExecutionNodeResult[];
1951
1584
  /**
1952
- * A list of all integrations this product is connected to.
1585
+ * @returns A list of out put nodes that exist in this execution.
1953
1586
  */
1954
- getIntegrations(): IntegrationProductResource[];
1587
+ getOutputs(): FlowExecutionNodeResult[];
1955
1588
  /**
1956
- * The raw product resource. This is generally not needed and should be avoided.
1589
+ * @returns A date object representing the point in time this execution completed.
1957
1590
  */
1958
- getResource(): Product;
1591
+ getCompletedAt(): Date | undefined;
1959
1592
  /**
1960
- * Gets the base price of the product. Optionally include additional product pricing.
1961
- * @param includeAdditionalProduct Optionally include additional product pricing. You must provide at least one of the fields on this object.
1962
- * @returns
1593
+ * @returns A date object representing the point in time this execution failed.
1963
1594
  */
1964
- getBasePrice(includeAdditionalProduct?: {
1965
- /**
1966
- * The integration type to locate the additional product on.
1967
- */
1968
- integrationType?: IntegrationType;
1969
- /**
1970
- * The external ID of the integration to locate the additional product on.
1971
- */
1972
- externalId?: string;
1973
- /**
1974
- * The internal Spiff integration ID to locate the additional product on.
1975
- */
1976
- integrationId?: string;
1977
- }): number;
1595
+ getFailedAt(): Date | undefined;
1978
1596
  }
1979
1597
  /**
1980
- * Represents a the relationship between a workflow and a product.
1598
+ * Handles preparing a flow input for transmission to the server.
1981
1599
  */
1982
- declare class ProductWorkflow {
1983
- private readonly workflow;
1984
- constructor(workflow: ProductWorkflow$1);
1985
- /**
1986
- * @returns The ID of this workflow, to be used when starting an experience.
1987
- */
1600
+ declare class FlowExecutionNodeResult {
1601
+ protected readonly node: ExecutionNodeResponse;
1602
+ constructor(node: ExecutionNodeResponse);
1988
1603
  getId(): string;
1989
- /**
1990
- * @returns The name of the workflow.
1991
- */
1992
- getName(): string;
1993
- /**
1994
- * An image to be used to display this workflow in a UI to the customer.
1995
- * @returns A resource URL.
1996
- */
1997
- getThumbnail(): string;
1604
+ getType(): NodeType;
1605
+ getArtifacts(): Map<string, any>;
1606
+ getArtifactByName<T>(name: string): T;
1998
1607
  }
1999
1608
  /**
2000
- * Represents a collection of transforms that can be applied inside a product collection.
1609
+ * Handles preparing a flow input for transmission to the server.
2001
1610
  */
2002
- declare class TransformCollection {
2003
- private readonly collection;
2004
- constructor(collection: TransformCollection$1);
2005
- /**
2006
- * @returns The ID of the transform collection.
2007
- */
1611
+ declare abstract class FlowExecutionInput {
1612
+ protected readonly value: string;
1613
+ constructor(value: string);
1614
+ getRaw(): string;
1615
+ getValueForTransmission(): string;
1616
+ }
1617
+ /**
1618
+ * Represents the type of object being referenced by the input.
1619
+ */
1620
+ declare const enum ObjectInputType {
1621
+ Transaction = "Transaction",
1622
+ Bundle = "Bundle",
1623
+ Product = "Product",
1624
+ Variant = "Variant",
1625
+ Option = "Option",
1626
+ LineItem = "LineItem",
1627
+ Asset = "Asset"
1628
+ }
1629
+ declare class TextInput extends FlowExecutionInput {
1630
+ constructor(input: string);
1631
+ }
1632
+ /**
1633
+ * Handles validation of spiffObject structure for transmission to the server.
1634
+ */
1635
+ declare class ObjectInput extends FlowExecutionInput {
1636
+ constructor(id: string, type: ObjectInputType);
1637
+ static validUUID(uuid: string): RegExpMatchArray | null;
1638
+ }
1639
+ /**
1640
+ * Handles validation of array input for transmission to the server.
1641
+ */
1642
+ declare class ArrayInput extends FlowExecutionInput {
1643
+ constructor(elements: FlowExecutionInput[]);
1644
+ }
1645
+
1646
+ declare class IntegrationProduct {
1647
+ private readonly integrationProduct;
1648
+ constructor(product: IntegrationProductResource);
2008
1649
  getId(): string;
1650
+ getResource(): IntegrationProductResource;
1651
+ getBasePrice(): number;
1652
+ getDefaultWorkflow(): ProductWorkflow$1;
1653
+ getAllWorkflows(): ProductWorkflow$1[];
1654
+ }
1655
+
1656
+ declare const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<Workflow[]>;
1657
+ declare const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<Workflow>;
1658
+ /**
1659
+ * Options that can be used during instantiation of the SpiffCommerce Javascript Client.
1660
+ * Please refer to the documentation for more information.
1661
+ */
1662
+ interface ClientOptions {
2009
1663
  /**
2010
- * @returns The name of the transform collection.
1664
+ * When provided, the client will use the provided application key to
1665
+ * authenticate with the SpiffCommerce API.
2011
1666
  */
2012
- getName(): string;
1667
+ applicationKey?: string;
1668
+ }
1669
+ interface GetBundleGraphqlAssetsOptions {
1670
+ metadata?: boolean;
1671
+ }
1672
+ interface GetBundleGraphqlProductCollectionOptions {
1673
+ eagerFetchProducts?: boolean;
1674
+ }
1675
+ interface GetBundleGraphqlOptions {
1676
+ productCollection?: GetBundleGraphqlProductCollectionOptions;
1677
+ assets?: GetBundleGraphqlAssetsOptions;
1678
+ additionalHeaders?: {
1679
+ [key: string]: string;
1680
+ };
1681
+ }
1682
+ interface GetBundleOptions {
2013
1683
  /**
2014
- * @returns The transforms in this collection.
1684
+ * Configuration for the graphQL request made for bundles. Allows for retrieval
1685
+ * of additional data.
2015
1686
  */
2016
- getTransforms(): Transform[];
1687
+ graphql?: GetBundleGraphqlOptions;
2017
1688
  }
2018
- /**
2019
- * Represents the translations, rotation & scale of a product in 3D space.
2020
- */
2021
- declare class Transform {
2022
- private readonly transform;
2023
- constructor(position: TransformCollectionTransform);
1689
+ interface GetWorkflowGraphqlAssetsOptions {
1690
+ metadata?: boolean;
1691
+ }
1692
+ interface GetWorkflowGraphqlOptions {
1693
+ assets?: GetWorkflowGraphqlAssetsOptions;
1694
+ }
1695
+ interface GetWorkflowOptionsBase {
2024
1696
  /**
2025
- * @returns The ID of the transform.
1697
+ * An existing preview service to use, instead of creating a new one.
2026
1698
  */
2027
- getId(): string;
1699
+ previewService?: ThreeDPreviewService;
2028
1700
  /**
2029
- * @returns The name of the transform.
1701
+ * Configuration related to the
1702
+ * workflow and how the system interprets it.
2030
1703
  */
2031
- getName(): string;
1704
+ workflowConfiguration?: {
1705
+ /**
1706
+ * False by default, when true the system will treat
1707
+ * steps with a single variant
1708
+ * as being renderable.
1709
+ */
1710
+ singleVariantsRenderable?: boolean;
1711
+ };
2032
1712
  /**
2033
- * @returns The transformation to be used to place the object.
1713
+ * Configuration for the graphQL request made for workflows. Allows for retrieval
1714
+ * of additional data.
2034
1715
  */
2035
- get(): BundleStateTransform;
1716
+ graphql?: GetWorkflowGraphqlOptions;
2036
1717
  }
2037
-
1718
+ interface GetWorkflowFromTransactionOptions extends GetWorkflowOptionsBase {
1719
+ /** The existing Transaction to use. */
1720
+ transactionId: string;
1721
+ /** If set to true, the workflow will display in a read-only mode. */
1722
+ readOnly?: boolean;
1723
+ /** An existing workflow state, if available. */
1724
+ workflowState?: string;
1725
+ type: "transaction";
1726
+ }
1727
+ interface GetWorkflowFromIntegrationProductOptions extends GetWorkflowOptionsBase {
1728
+ /** The workflow to load. */
1729
+ workflowId: string;
1730
+ integrationProductId: string;
1731
+ /** An existing workflow state, if available. */
1732
+ workflowState?: string;
1733
+ type: "integration";
1734
+ }
1735
+ interface GetWorkflowFromExternalProductOptions extends GetWorkflowOptionsBase {
1736
+ /** The workflow to load. */
1737
+ workflowId: string;
1738
+ /** The external ID associated with an integration. */
1739
+ externalIntegrationId: string;
1740
+ /** The ID of the product from the external system. */
1741
+ externalProductId: string;
1742
+ /** An existing workflow state, if available. */
1743
+ workflowState?: string;
1744
+ type: "external";
1745
+ }
1746
+ type GetNewWorkflowOptions = GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
1747
+ type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetNewWorkflowOptions;
2038
1748
  /**
2039
- * A bundle serves as a container for a set of workflow experience.
1749
+ * The Spiff Commerce Javascript Client. Required for
1750
+ * creating workflow experiences.
2040
1751
  */
2041
- interface Bundle {
1752
+ declare class SpiffCommerceClient {
1753
+ private options;
1754
+ private initialized;
1755
+ private currencyCode?;
1756
+ private customer?;
1757
+ private activeIntegration?;
2042
1758
  /**
2043
- * @returns The client that this bundle is associated with.
1759
+ * @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
1760
+ * Any functionality referencing this object will be removed in a future release.
2044
1761
  */
2045
- getClient(): SpiffCommerceClient;
1762
+ private experienceOptions?;
1763
+ constructor(options: ClientOptions);
2046
1764
  /**
2047
- * @returns The id of the bundle entity in the Spiff Commerce system.
1765
+ * @returns The asset manager allows for common operations related to assets
1766
+ * and the Spiff Commerce platform.
2048
1767
  */
2049
- getId(): string;
1768
+ getAssetManager(): AssetManager;
1769
+ getCurrencyCode(): string;
1770
+ getFlowService(): FlowService;
1771
+ getIntegration(): Promise<Integration>;
1772
+ canUseAddon(addonHandle: AddonHandle): Promise<boolean>;
2050
1773
  /**
2051
- * @returns The name of the bundle.
1774
+ * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
1775
+ * @param bundleId The ID of the bundle you intend to load.
1776
+ * @returns An object containing the success status of the authentication attempt, and the type of stakeholder when successful.
2052
1777
  */
2053
- getName(): string;
1778
+ authenticateBundleFromLocalStorage(bundleId: string): Promise<{
1779
+ stakeholderType?: StakeholderType;
1780
+ success: boolean;
1781
+ }>;
2054
1782
  /**
2055
- * Set the name of the bundle.
2056
- * @param name The new name for the bundle.
2057
- * @returns A promise that resolves when the name has been updated in the Spiff Commerce system.
1783
+ * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
1784
+ * @param transactionId The ID of the transaction that the user is attempting to load.
1785
+ * @returns An object containing the following:
1786
+ * - `customLogoLink`: A link to a custom logo to display in the header.
1787
+ * - `transactionReadOnly`: Whether or not the transaction is read-only. Shadow will not accept any changes to the transaction if this is set to true.
1788
+ * - `stakeholderType`: The type of stakeholder that the user is authenticated as.
1789
+ * - `success`: Whether or not the authentication was successful.
1790
+ * @throws An error if the transaction is not found.
2058
1791
  */
2059
- setName(name: string): Promise<void>;
1792
+ authenticateTransactionFromLocalStorage(transactionId: string): Promise<{
1793
+ customLogoLink?: string;
1794
+ transactionReadOnly?: boolean;
1795
+ stakeholderType?: StakeholderType;
1796
+ success: boolean;
1797
+ theme?: Theme;
1798
+ }>;
1799
+ clearCustomer(): void;
1800
+ clearCustomerForTransaction(transactionId: string): void;
1801
+ getStakeholderTypeForTransaction(transactionId: string): StakeholderType | undefined;
1802
+ getOrCreateCustomer(emailAddress: string): Promise<{
1803
+ customer: Customer;
1804
+ isAuthenticated: boolean;
1805
+ }>;
1806
+ private authenticateCustomerId;
2060
1807
  /**
2061
- * @returns Custom metadata associated with this bundle.
1808
+ * Generates a verification code for the given email address.
1809
+ * @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
2062
1810
  */
2063
- getMetadata(): Map<string, string>;
1811
+ generateVerificationCode(emailAddress: string): Promise<void>;
2064
1812
  /**
2065
- * Set custom metadata associated with this bundle.
2066
- * @param metadata Updated map of metadata items.
2067
- * @returns A promise that resolves when the metadata has been updated in the Spiff Commerce system.
1813
+ * Verifies the given email address with the given verification code.
1814
+ * @param emailAddress The email address to verify.
1815
+ * @param verificationCode The verification code to verify the email address with.
1816
+ * @returns True if the verification was successful, false otherwise.
2068
1817
  */
2069
- setMetadata(metadata: Map<string, string>): Promise<void>;
1818
+ verifyCode(emailAddress: string, verificationCode: string): Promise<boolean>;
2070
1819
  /**
2071
- * Set the name and metadata for this bundle.
2072
- * @param name The new name for the bundle.
2073
- * @param metadata Updated map of metadata items.
2074
- * @returns A promise that resolves when the name and metadata have been updated in the Spiff Commerce system.
1820
+ * @param collectionId Optional: The id of the product collection that the bundle can use.
1821
+ * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
2075
1822
  */
2076
- setNameAndMetadata(name: string, metadata: Map<string, string>): Promise<void>;
1823
+ getNewBundle(collectionId?: string, initialMetadata?: {
1824
+ [key: string]: string;
1825
+ }, options?: GetBundleOptions): Promise<Bundle$1>;
2077
1826
  /**
2078
- * Returns true if this bundle is associated with a Product Collection that is linked to a Global Property Configuration
1827
+ * Retrieves an existing bundle from the API, by id.
1828
+ * @param bundleId The id of the bundle to retrieve.
1829
+ * @param previewService Optional: A reference to an existing preview service to use. This can be assigned manually later.
1830
+ * @param graphqlOptions Optional: Options to configure loading the workflow.
1831
+ * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
2079
1832
  */
2080
- hasGlobalProperties(): boolean;
1833
+ getExistingBundle(bundleId: string, previewService?: ThreeDPreviewService,
2081
1834
  /**
2082
- * Get a handle to the global properties available within this bundle. Setting values
2083
- * via this method will make selections on all bundles that share the property.
1835
+ * @deprecated use GetBundleOptions instead. This attribute will be removed in the future.
2084
1836
  */
2085
- getGlobalProperties(): Promise<GlobalPropertyHandle[]>;
1837
+ graphqlOptions?: GetBundleGraphqlOptions, options?: GetBundleOptions): Promise<Bundle$1>;
2086
1838
  /**
2087
- * Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
1839
+ * Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
1840
+ * @returns An array of bundle stakeholders.
2088
1841
  */
2089
- getGlobalPropertyStateManager(): GlobalPropertyStateManager;
1842
+ getBundleStakeholders(): Promise<BundleStakeholder[]>;
2090
1843
  /**
2091
- * Get the total in subunits for all global properties in this bundle.
1844
+ * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
1845
+ * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
1846
+ * @param workflowState An existing workflow state if available. Deprecated: Provide options instead.
1847
+ * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
1848
+ * @param options Options to configure loading the transaction and workflow.
1849
+ * @returns A workflow experience configured as requested.
2092
1850
  */
2093
- getGlobalPropertyTotalSubunits(): Promise<number>;
2094
- /**
2095
- * Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
2096
- */
2097
- getTotalSubunits(): number;
1851
+ getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => ThreeDPreviewService, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
2098
1852
  /**
2099
- * Retrieves the product collection associated with this bundle.
2100
- * If the bundle is not associated with a product collection, this method will return undefined.
1853
+ * Gets multiple workflow experiences at once.
1854
+ * @param optionsArray An array of options to configure loading the transactions and workflows.
1855
+ * NOTE: The `previewService` field on the option is currently unsupported in this function, as loading multiple models at once will likely cause performance issues.
1856
+ * @param graphqlOptions Options to configure loading the workflows.
1857
+ * @returns An array of workflow experiences configured as requested.
2101
1858
  */
2102
- getProductCollection(): ProductCollection | undefined;
1859
+ getWorkflowExperiences(optionsArray: GetWorkflowOptions[], graphqlOptions?: GetWorkflowGraphqlOptions): Promise<WorkflowExperience[]>;
2103
1860
  /**
2104
- * Add another workflow experience to this bundle.
2105
- * @param experience The workflow experience to add to this bundle.
1861
+ * Initialize the client from an integration product.
1862
+ * @param integrationProductId The integration product to use.
1863
+ * @deprecated Use getWorkflowExperience to initialize the experience.
2106
1864
  */
2107
- addWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1865
+ initFromIntegrationProduct(integrationProductId: string): Promise<void>;
2108
1866
  /**
2109
- * Adds multiple workflow experiences to this bundle.
2110
- * @param experiences The workflow experiences to add to this bundle.
1867
+ * Initialize the client from an existing transaction.
1868
+ * @param transactionId The id of the transaction
1869
+ * @returns A promise resolving at initialization completion.
1870
+ * @deprecated Use getWorkflowExperience to initialize the experience.
2111
1871
  */
2112
- addWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1872
+ initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
2113
1873
  /**
2114
- * Remove a workflow experience from this bundle.
2115
- * @param experience The workflow experience to remove from this bundle.
1874
+ * @deprecated Remove when the initFrom functions are removed.
2116
1875
  */
2117
- removeWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1876
+ private getWorkflowExperienceDeprecated;
2118
1877
  /**
2119
- * Removes multiple workflow experiences from this bundle.
2120
- * @param experiences The workflow experiences to remove from this bundle.
1878
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
1879
+ * @returns The preview service that was provided during construction.
2121
1880
  */
2122
- removeWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1881
+ getPreviewService(): ThreeDPreviewService | undefined;
2123
1882
  /**
2124
- * Remove a workflow experience from this bundle by transaction.
2125
- * @param transaction The transaction to remove from this bundle.
1883
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
1884
+ * @returns The product associated with this client.
2126
1885
  */
2127
- removeWorkflowExperienceByTransaction(transaction: Transaction): Promise<void>;
1886
+ getProduct(): Product;
2128
1887
  /**
2129
- * Removes multiple workflow experiences from this bundle by their transactions.
2130
- * @param transactions The transactions to remove from this bundle.
1888
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
1889
+ * @returns The transaction associated with this client.
2131
1890
  */
2132
- removeWorkflowExperiencesByTransactions(transactions: Transaction[]): Promise<void>;
1891
+ getTransaction(): Transaction;
1892
+ configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
2133
1893
  /**
2134
- * Inserts the given workflow experience into the bundle at the given index.
2135
- * NOTE: If you intend to insert a workflow experience at the end of the bundle, use `addWorkflowExperience` instead as it is more efficient.
2136
- * @param experience The workflow experience to insert.
2137
- * @param index The index to insert the workflow experience at.
1894
+ * A function used to synchronize transaction state with the server.
1895
+ * @param options New state details. To be spread into the query.
1896
+ * @returns
2138
1897
  */
2139
- insertWorkflowExperience(experience: WorkflowExperience, index: number): Promise<void>;
1898
+ private updateTransactionState;
1899
+ storeCustomer(customer: Customer): void;
1900
+ getIntegrationProductById(integrationProductId: string): Promise<IntegrationProduct>;
1901
+ getIntegrationProductFromExternalIds(externalIntegrationId: string, externalProductId: string): Promise<IntegrationProduct>;
1902
+ getIntegrationProduct(options: Extendable<{
1903
+ type: "integration";
1904
+ integrationProductId: string;
1905
+ }> | Extendable<{
1906
+ type: "external";
1907
+ externalIntegrationId: string;
1908
+ externalProductId: string;
1909
+ }>): Promise<IntegrationProduct>;
1910
+ }
1911
+
1912
+ interface SilentIllustrationStepData extends SilentStepData, Placeable {
1913
+ }
1914
+ interface EditedSteps {
1915
+ [stepName: string]: boolean;
1916
+ }
1917
+ interface MandatorySteps {
1918
+ [stepName: string]: boolean;
1919
+ }
1920
+ type StepElements = {
1921
+ [key: string]: RegionElement[];
1922
+ };
1923
+ type StepInitialised = {
1924
+ [key: string]: boolean;
1925
+ };
1926
+ type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
1927
+ interface WorkflowStorage {
1928
+ [stepName: string]: StepStorage;
1929
+ }
1930
+ interface WorkflowMetadata {
1931
+ [stepName: string]: StepMetadata;
1932
+ }
1933
+ interface WorkflowSelections {
1934
+ [stepName: string]: {
1935
+ selections: VariantResource[];
1936
+ };
1937
+ }
1938
+ interface InformationResult {
1939
+ message: string;
1940
+ messageType: InformationMessageType;
1941
+ stepID: string;
1942
+ }
1943
+ declare enum InformationMessageType {
1944
+ Error = "Error",
1945
+ Warning = "Warning",
1946
+ Info = "Info"
1947
+ }
1948
+ /**
1949
+ * Services required for the operaiton of individual steps.
1950
+ */
1951
+ interface StepSpecificServices {
1952
+ frameService?: FrameService;
1953
+ module?: ModuleProduct;
1954
+ }
1955
+ type DesignCreationProgressUpdate = (message: string) => void;
1956
+ type ConfirmCallback = (isConfirmed: boolean) => void;
1957
+ type EditedCallback = (editedSteps: EditedSteps) => void;
1958
+ type ElementsCallback = (elements: StepElements) => void;
1959
+ type InformationResultCallback = (messages: InformationResult[]) => void;
1960
+ type InitCallback = (stepInitialised: StepInitialised) => void;
1961
+ type MakingAdjustmentsCallback = (makingAdjustments: string) => void;
1962
+ type MandatoryCallback = (mandatorySteps: MandatorySteps) => void;
1963
+ type MetadataCallback = (metadata: WorkflowMetadata) => void;
1964
+ type SelectionCallback = (callbackOptions: {
1965
+ selectionCost: number;
1966
+ selections: StepSelections;
1967
+ traversableScenes: WorkflowScene[];
1968
+ }) => void;
1969
+ type StepSpecificStorageCallback = (selections: StepStorage) => void;
1970
+ type StorageCallback = (storage: WorkflowStorage) => void;
1971
+ type StateMutationFunc = (options?: Omit<MutationOptions, "mutation">) => Promise<FetchResult<any, Record<string, any>, Record<string, any>>>;
1972
+ interface WorkflowManager {
1973
+ addPoller: (poller: Poller) => void;
1974
+ addConfirmCallback: (callback: ConfirmCallback) => void;
1975
+ addEditedCallback: (callback: EditedCallback) => void;
1976
+ addElementsCallback: (callback: ElementsCallback) => void;
1977
+ addInformationResultCallback: (callback: InformationResultCallback) => void;
1978
+ addInitCallback: (callback: InitCallback) => void;
1979
+ addMakingAdjustmentsCallback: (callback: MakingAdjustmentsCallback) => void;
1980
+ addMandatoryCallback: (callback: MandatoryCallback) => void;
1981
+ addMetadataCallback: (callback: MetadataCallback) => void;
1982
+ addSelectionCallback: (callback: SelectionCallback) => void;
1983
+ addStepSpecificStorageCallback: (callback: StepSpecificStorageCallback, stepName: string) => void;
1984
+ addStorageCallback: (callback: StorageCallback) => void;
1985
+ getCommandDispatcher: () => (command: CanvasCommand) => void;
1986
+ getCommandContext: () => CommandContext;
1987
+ getLayouts: () => ILayout[];
1988
+ getAllLayoutData: () => LayoutState[];
1989
+ getLayoutPreviewService: () => LayoutPreviewService | undefined;
1990
+ getPreviewService: () => ThreeDPreviewService | undefined;
1991
+ getProfanities: () => string[];
1992
+ getRegionElements: (stepName: string) => RegionElement[];
1993
+ getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
1994
+ getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
1995
+ getStepStorage: (stepName: string) => StepStorage | undefined;
1996
+ getMetadata: (stepName: string) => StepMetadata | undefined;
1997
+ getWorkflowMetadata: () => WorkflowMetadata;
1998
+ getInformationResults(): InformationResult[];
1999
+ getTransaction: () => Transaction;
2000
+ getTransactionCustomer: () => Customer | undefined;
2001
+ setTransactionCustomer: (customer: Customer) => void;
2140
2002
  /**
2141
- * Replaces a workflow experience at the given index with the given workflow experience. This essentially removes the old one and inserts the new one.
2142
- * @param index The index to replace the workflow experience at.
2143
- * @param experience The workflow experience to replace the old one with.
2003
+ * @deprecated Use setTransactionCustomer instead.
2144
2004
  */
2145
- replaceWorkflowExperience(index: number, experience: WorkflowExperience): Promise<void>;
2005
+ setTransactionCustomerDetails: (details: {
2006
+ email: string;
2007
+ }) => void;
2008
+ getWorkflow: () => Workflow;
2009
+ getWorkflowSelections: () => WorkflowSelections;
2010
+ getProduct: () => Product;
2146
2011
  /**
2147
- * Swaps the workflow experiences at the given indices.
2012
+ * A promise resolving when the initial state of the workflow has completed loading.
2148
2013
  */
2149
- swapWorkflowExperiences(a: number, b: number): Promise<void>;
2014
+ getInitializationPromise: () => Promise<void>;
2150
2015
  /**
2151
- * Returns all workflow experiences currently added to this bundle.
2016
+ * Returns true when the initial state of the workflow has been loaded and settled.
2152
2017
  */
2153
- getWorkflowExperiences(): WorkflowExperience[];
2018
+ isInitialized(): boolean;
2019
+ markStepsAsInitialised: (stepNames: string[]) => void;
2020
+ getUpdatesPending: () => boolean;
2021
+ markUpdateCompleted: (id: string) => void;
2022
+ markUpdatePending: () => string;
2023
+ outstandingRequestsPromise: () => Promise<void>;
2024
+ reset: () => Promise<void>;
2025
+ setCurrentAdjustingStepId: (stepId: string) => void;
2026
+ setEditedStatus: (stepName: string, status: boolean) => void;
2027
+ setInformationResults: (results: InformationResult[]) => void;
2028
+ setMandatoryFulfilled: (stepName: string, status: boolean) => void;
2029
+ setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
2030
+ toggleDesignConfirmed: () => void;
2031
+ updateMetadata: (stepName: string, update: any) => void;
2154
2032
  /**
2155
- * Sort the list of workflow experiences. The sorting is performed locally, and then the order is updated in the Spiff Commerce system.
2156
- * @returns A promise that resolves when the re-ordering of the workflow experiences has been updated in the Spiff Commerce system.
2157
- * The sorting will occur immediately, but the promise will not resolve until the Spiff Commerce system has been updated.
2033
+ * @deprecated State updates are being pulled internally. This function will be removed in the future.
2158
2034
  */
2159
- sortWorkflowExperiences(sortFunc: (expA: WorkflowExperience, expB: WorkflowExperience) => number): Promise<void>;
2035
+ updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
2036
+ updateStorage: (stepName: string, update: StepStorage) => void;
2037
+ getModelContainer: () => ModelContainer | undefined;
2038
+ setModelContainer: (container: ModelContainer) => void;
2160
2039
  /**
2161
- * @returns The number of workflow experiences in this bundle.
2040
+ * Injects the model of this product into the preview service.
2041
+ * This also overwrites the internal preview service.
2042
+ * @param previewService The preview service to inject into.
2043
+ * @param refocusCamera Optional: Run camera focus Defaults to `true`.
2162
2044
  */
2163
- getWorkflowExperienceCount(): number;
2045
+ injectIntoPreviewService(previewService: ThreeDPreviewService, refocusCamera?: boolean): Promise<void>;
2164
2046
  /**
2165
- * Add a stakeholder to this bundle. If the stakeholder already exists, it will be updated. Write access to the bundle is required.
2166
- * @param customerDetails The details of the customer to add. The emailAddress field is required.
2167
- * @param stakeholderType The type of stakeholder to add. Defaults to Owner.
2047
+ * Ejects the model of this product from the preview service. This also sets the internal preview service to undefined.
2168
2048
  */
2169
- addStakeholder(customerDetails: CustomerDetailsInput, stakeholderType?: StakeholderType): Promise<void>;
2049
+ ejectFromPreviewService(): void;
2170
2050
  /**
2171
- * Removes a stakeholder from this bundle. Write access to the bundle is required.
2172
- * @param emailAddress The email address of the stakeholder to remove.
2051
+ * Enables or disables uploading of workflow state to the server.
2052
+ * @param enabled When true, workflow state will be uploaded to the server.
2173
2053
  */
2174
- removeStakeholder(emailAddress: string): Promise<void>;
2054
+ setWorkflowStateSyncEnabled: (enabled: boolean) => void;
2175
2055
  /**
2176
- * Updates all stakeholders associated with this bundle. Write access to the bundle is required.
2177
- * @param stakeholders An array of stakeholders to update. Unknown stakeholders will be added, and absent stakeholders will be removed.
2056
+ * Returns the client that was responsible for spawning this manager.
2178
2057
  */
2179
- updateStakeholders(stakeholders: BundleStakeholderInput[]): Promise<void>;
2058
+ getClient(): SpiffCommerceClient;
2059
+ }
2060
+
2061
+ interface StepService<T extends AnyStepData> {
2180
2062
  /**
2181
- * Retrieves all stakeholders associated with this bundle.
2063
+ * Initialize the given step, or reload from serialized data if present.
2182
2064
  */
2183
- getAllStakeholders(): Promise<BundleStakeholder[]>;
2065
+ init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
2066
+ }
2067
+ interface FileInfo {
2184
2068
  /**
2185
- * Finalizes all experiences within the bundle. This will return a promise that resolves when all experiences have been finalized.
2186
- * The promise resolves with a list of messages that indicate the status of each experience including
2187
- * helpful details like what product to add to cart on supported e-commerce platforms.
2188
- * @param onProgressUpdate A callback that will be called when the progress of the finalization changes.
2189
- * @param createPreviewImage A callback that will be called when a preview image is required. This is used to generate a preview image for the design.
2190
- * If this callback is not provided, no preview image will be generated.
2191
- * @returns {BundleDesignCreationMessage} An object containing an array of design messages, along with the Bundle's Id and the event type.
2069
+ * The name of the file.
2192
2070
  */
2193
- finish(onProgressUpdate?: DesignCreationProgressUpdate, createPreviewImage?: (workflowExperience: WorkflowExperience) => Promise<string | undefined>): Promise<BundleDesignCreationMessage>;
2071
+ name: string;
2194
2072
  /**
2195
- * Add an event listener to this bundle.
2196
- * @param event The event to listen for. Currently only "conditional-global-properties-changed" is supported.
2197
- * @param listener The listener to call when the event occurs.
2073
+ * A blob object representing the
2074
+ * data of the file.
2198
2075
  */
2199
- addEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
2200
- /**
2201
- * Remove a previously added event listener from this bundle.
2076
+ blob: Blob;
2077
+ }
2078
+ /**
2079
+ * A command along with a function to run afterwards.
2080
+ */
2081
+ interface CommandWithFollowup {
2082
+ command?: CanvasCommand;
2083
+ followup?: () => Promise<void>;
2084
+ }
2085
+ /**
2086
+ * The variant selections of a completed step.
2087
+ */
2088
+ interface SelectedVariants {
2089
+ [stepName: string]: {
2090
+ id: string;
2091
+ name: string;
2092
+ priceModifier: number;
2093
+ }[];
2094
+ }
2095
+ interface ExportedData {
2096
+ [name: string]: {
2097
+ value: string;
2098
+ priceModifier: number;
2099
+ };
2100
+ }
2101
+ interface DesignCreationMessage {
2102
+ additionalExternalProductId?: string;
2103
+ additionalExternalVariantId?: string;
2104
+ baseCost?: number;
2105
+ designProductId?: string;
2106
+ designProductVariantId?: string;
2107
+ event: string;
2108
+ exportedData: ExportedData;
2109
+ externalCartProductId?: string;
2110
+ externalCartProductVariantId?: string;
2111
+ lineItemImageUrl: string;
2112
+ metadata?: {
2113
+ [stepName: string]: string;
2114
+ };
2115
+ optionsCost: number;
2116
+ processExecutionId?: string;
2117
+ quantity?: number;
2118
+ selectedVariants?: SelectedVariants;
2119
+ sku?: string;
2120
+ transactionId: string;
2121
+ transactionOwnerId?: string;
2122
+ weight?: number;
2123
+ workflowViewerLink: string;
2124
+ workflowViewerReadOnlyLink: string;
2125
+ }
2126
+ interface BundleDesignCreationMessage {
2127
+ bundleId: string;
2128
+ items: DesignCreationMessage[];
2129
+ }
2130
+ /**
2131
+ * Represents a transaction.
2132
+ */
2133
+ interface Transaction {
2134
+ /**
2135
+ * A unique identifier for this transaction. Useful for reloading and
2136
+ * modifying state of the transaction.
2202
2137
  */
2203
- removeEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
2138
+ id: string;
2204
2139
  /**
2205
- * Retrieves the current preview service for this bundle, if one exists.
2206
- * If a preview service was specified when calling client.getExistingBundle, this will return that service.
2207
- * Call `setPreviewService` to update the preview service for this bundle.
2140
+ * User-supplied name for the associated design.
2208
2141
  */
2209
- getPreviewService(): ThreeDPreviewService | undefined;
2142
+ designName?: string;
2210
2143
  /**
2211
- * Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will
2212
- * also automatically inject the preview service into any new workflow experiences that are added to this bundle.
2213
- * If this method is called with no arguments or undefined, the preview service will be removed from this bundle.
2214
- * @param previewService The preview service to use for this bundle.
2215
- * @returns A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.
2144
+ * The workflow associated with this transaction.
2216
2145
  */
2217
- setPreviewService(previewService?: ThreeDPreviewService): Promise<void>;
2146
+ workflowId?: string;
2218
2147
  /**
2219
- * Returns a promise that resolves when the bundle has been initialized.
2220
- * This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
2148
+ * Temporary ID that grants write permission to the transaction.
2221
2149
  */
2222
- getInitializationPromise(): Promise<void>;
2150
+ transactionOwnerId?: string;
2223
2151
  /**
2224
- * Sets the position, rotation, and scale of a named transform for a workflow experience within this bundle.
2225
- * @param workflowExperience The workflow experience to update.
2226
- * @param transformName The name of the transform.
2227
- * @param transform An object containing `position`, `rotation`, and `scale` properties. Each property is an object with `x`, `y`, and `z` properties.
2152
+ * The current state of the design.
2228
2153
  */
2229
- updateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string, transform: BundleStateTransform): Promise<void>;
2154
+ workflowState?: string;
2230
2155
  /**
2231
- * Sets a transform of a workflow experience within this bundle to be the active one.
2232
- * @param workflowExperience The workflow experience to update.
2233
- * @param transform The name of the transform to make the active transform.
2156
+ * URL to a partner-specific logo intended to display during the workflow experience.
2234
2157
  */
2235
- activateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string): Promise<void>;
2158
+ customLogoLink?: string;
2236
2159
  /**
2237
- * @returns The raw Global Property Configuration that is in use, otherwise `undefined`.
2160
+ * URL to a logo intended to display at the periphery of the workflow experience.
2238
2161
  */
2239
- getGlobalPropertyConfiguration(): GlobalPropertyConfiguration | undefined;
2240
- setBundleOptions(bundleOptions?: BundleOptions): any;
2241
- }
2242
- type BundleEventType = "conditional-global-properties-changed" | "workflow-experience-hover-enter" | "workflow-experience-hover-exit";
2243
- type BundleEventData = ConditionalGlobalPropertiesChangedEventData | WorkflowExperienceHoverEventData;
2244
- type BundleEvent = {
2245
- bundle: Bundle;
2246
- data: BundleEventData;
2247
- event: BundleEventType;
2248
- };
2249
- interface ConditionalGlobalPropertiesChangedEventData {
2250
- globalProperties: GlobalPropertyHandle[];
2251
- }
2252
- interface WorkflowExperienceHoverEventData {
2253
- workflowExperience: WorkflowExperience;
2254
- }
2255
-
2256
- /**
2257
- * A list of node types available in executions
2258
- */
2259
- declare enum NodeType {
2260
- Split = "Split",
2261
- TextJoin = "TextJoin",
2262
- TextSlice = "TextSlice",
2263
- TextUpper = "TextUpper",
2264
- TextLower = "TextLower",
2265
- ParseJson = "ParseJson",
2266
- TextBuilder = "TextBuilder",
2267
- Design = "Design",
2268
- OverlayImage = "OverlayImage",
2269
- OverlayText = "OverlayText",
2270
- TableGenerator = "TableGenerator",
2271
- QR = "QR",
2272
- CSV = "CSV",
2273
- PDF = "PDF",
2274
- PNG = "PNG",
2275
- Email = "Email",
2276
- LocationDelivery = "LocationDelivery",
2277
- TemplateEmail = "TemplateEmail",
2278
- Map = "Map",
2279
- Sort = "Sort",
2280
- Group = "Group",
2281
- InnerJoin = "InnerJoin",
2282
- Contains = "Contains",
2283
- Flatten = "Flatten",
2284
- KeyValuePairs = "KeyValuePairs",
2285
- ListConcatenate = "ListConcatenate",
2286
- Repeat = "Repeat",
2287
- Size = "Size",
2288
- ListBuilder = "ListBuilder",
2289
- MapBuilder = "MapBuilder",
2290
- PairBuilder = "PairBuilder",
2291
- AND = "AND",
2292
- OR = "OR",
2293
- NOT = "NOT",
2294
- Equals = "Equals",
2295
- Present = "Present",
2296
- ManualOperation = "ManualOperation",
2297
- Switch = "Switch",
2298
- AssetMetadata = "AssetMetadata",
2299
- DataSelect = "DataSelect",
2300
- LayoutSelect = "LayoutSelect",
2301
- TransactionMetadata = "TransactionMetadata",
2302
- VariantSelection = "VariantSelection",
2303
- StartTerminal = "StartTerminal",
2304
- EndTerminal = "EndTerminal",
2305
- MiscNote = "MiscNote",
2306
- Assign = "Assign",
2307
- CsvVlookup = "CsvVlookup",
2308
- ProcessFlow = "ProcessFlow",
2309
- TemporaryAssetUrl = "TemporaryAssetUrl",
2310
- WebRequest = "WebRequest"
2311
- }
2312
- interface ExecutionNodeResponse {
2313
- id: string;
2314
- type: NodeType;
2315
- artifacts: string;
2316
- }
2317
- interface ExecutionResponse {
2318
- id: string;
2319
- nodes: ExecutionNodeResponse[];
2320
- completedAt?: string;
2321
- failedAt?: string;
2322
- }
2323
- /**
2324
- * A service containing functionality for interacting with the Spiff Commerce API to execute and inspect the result of process flows.
2325
- */
2326
- declare class FlowService {
2162
+ workflowFooterLogoLink?: string;
2327
2163
  /**
2328
- *
2329
- * @param id
2330
- * @param inputs
2331
- * @param options
2332
- * @returns
2164
+ * URL to the corresponding integration in the REST API.
2333
2165
  */
2334
- execute(id: string, inputs: FlowExecutionInput[], options?: {
2335
- sleepTime?: number;
2336
- repeats?: number;
2337
- }): Promise<FlowExecutionResult>;
2338
- }
2339
- /**
2340
- * Handles preparing a flow input for transmission to the server.
2341
- */
2342
- declare class FlowExecutionResult {
2343
- protected readonly execution: ExecutionResponse;
2344
- constructor(execution: ExecutionResponse);
2166
+ restApiIntegrationLink?: string;
2345
2167
  /**
2346
- * @returns The raw response from the server.
2168
+ * URL to redirect to when a workflow is finished.
2347
2169
  */
2348
- getRaw(): ExecutionResponse;
2170
+ callbackUrl?: string;
2349
2171
  /**
2350
- * @returns The nodes contained within the execution.
2172
+ * Product that this transaction belongs to.
2351
2173
  */
2352
- getNodes(): FlowExecutionNodeResult[];
2174
+ product?: Product;
2353
2175
  /**
2354
- * @param type The type of node to return.
2355
- * @returns A list of nodes matching the requested type.
2176
+ * The integration product related to this lineitem.
2356
2177
  */
2357
- getNodesByType(type: NodeType): FlowExecutionNodeResult[];
2178
+ integrationProduct?: IntegrationProductResource;
2358
2179
  /**
2359
- * @returns A list of input nodes that exist in this execution.
2180
+ * Whether this transaction has previously been ordered.
2360
2181
  */
2361
- getInputs(): FlowExecutionNodeResult[];
2182
+ isOrdered?: boolean;
2362
2183
  /**
2363
- * @returns A list of out put nodes that exist in this execution.
2184
+ * @deprecated use isOrdered to check whether transaction has been ordered instead.
2364
2185
  */
2365
- getOutputs(): FlowExecutionNodeResult[];
2186
+ lineItem?: LineItem;
2366
2187
  /**
2367
- * @returns A date object representing the point in time this execution completed.
2188
+ * The external product variant ID representing the design product related
2189
+ * to this transaction, null unless the createDesignProduct flag was set
2190
+ * and the design was finalized using createDesign operation.
2368
2191
  */
2369
- getCompletedAt(): Date | undefined;
2192
+ /**@deprecated use externalCartProductVariantId instead of this moving forward */
2193
+ externalDesignProductVariantId?: string;
2370
2194
  /**
2371
- * @returns A date object representing the point in time this execution failed.
2195
+ * The external product id representing the design product related
2196
+ * to this transaction, null unless the createDesignProduct flag was set
2197
+ * and the design was finalized using createDesign operation.
2372
2198
  */
2373
- getFailedAt(): Date | undefined;
2374
- }
2375
- /**
2376
- * Handles preparing a flow input for transmission to the server.
2377
- */
2378
- declare class FlowExecutionNodeResult {
2379
- protected readonly node: ExecutionNodeResponse;
2380
- constructor(node: ExecutionNodeResponse);
2381
- getId(): string;
2382
- getType(): NodeType;
2383
- getArtifacts(): Map<string, any>;
2384
- getArtifactByName<T>(name: string): T;
2385
- }
2386
- /**
2387
- * Handles preparing a flow input for transmission to the server.
2388
- */
2389
- declare abstract class FlowExecutionInput {
2390
- protected readonly value: string;
2391
- constructor(value: string);
2392
- getRaw(): string;
2393
- getValueForTransmission(): string;
2199
+ /**@deprecated use externalCartProductId instead of this moving forward. */
2200
+ externalDesignProductId?: string;
2201
+ /**
2202
+ * The external product id representing the product related to the transaction.
2203
+ * This value can hold any type of transaction such as design and standard products.
2204
+ */
2205
+ externalCartProductId?: string;
2206
+ /**
2207
+ * The external product variant id representing the product related to the transaction.
2208
+ * This value can hold any type of transaction such as design and standard products.
2209
+ */
2210
+ externalCartProductVariantId?: string;
2211
+ priceModifierTotal?: number;
2212
+ /**
2213
+ * URL to open the transaction in the workflow viewer.
2214
+ */
2215
+ workflowViewerLink?: string;
2216
+ workflowViewerReadOnlyLink?: string;
2217
+ previewImageLink?: string;
2218
+ lastSyncedAt?: string;
2219
+ /**
2220
+ * The users who have access to this transaction.
2221
+ */
2222
+ stakeholders?: Stakeholder[];
2223
+ /**
2224
+ * The amount of this transaction that was, or will be, ordered
2225
+ */
2226
+ quantity?: number;
2227
+ printFileUrl1?: string;
2228
+ printFileUrl2?: string;
2229
+ printFileUrl3?: string;
2230
+ printFileUrl4?: string;
2231
+ printFileUrl5?: string;
2394
2232
  }
2395
2233
  /**
2396
- * Represents the type of object being referenced by the input.
2234
+ * An integration product represents the connection of a product in SpiffCommerce with
2235
+ * a product on a third party platform.
2397
2236
  */
2398
- declare const enum ObjectInputType {
2399
- Transaction = "Transaction",
2400
- Bundle = "Bundle",
2401
- Product = "Product",
2402
- Variant = "Variant",
2403
- Option = "Option",
2404
- LineItem = "LineItem",
2405
- Asset = "Asset"
2237
+ interface IntegrationProductResource {
2238
+ /**
2239
+ * The ID of the IntegrationProduct entity. Used internally by SpiffCommerce.
2240
+ */
2241
+ id: string;
2242
+ /**
2243
+ * The ID of the product on the third party platform. For example a Shopify product ID.
2244
+ */
2245
+ externalProductId?: string;
2246
+ /**
2247
+ * The integration that this product is associated with. For example a Shopify integration.
2248
+ */
2249
+ integration?: Integration;
2250
+ /**
2251
+ * The ID of an additional product (on the third party platform) that should be added to the cart.
2252
+ */
2253
+ additionalExternalProductId?: string;
2254
+ /**
2255
+ * A supplementary ID for the additional product. Shopify uses the variant ids to add products to the cart.
2256
+ */
2257
+ additionalExternalVariantId?: string;
2258
+ /**
2259
+ * When the additionalExternalProductId is set, this is the IntegrationProduct that is associated with it.
2260
+ * If no Spiff product has been associated with the additionalExternalProductId, this will be null.
2261
+ */
2262
+ additionalIntegrationProduct?: IntegrationProductResource;
2263
+ /**
2264
+ * The product that this integration product is associated with.
2265
+ */
2266
+ product?: Product;
2406
2267
  }
2407
- declare class TextInput extends FlowExecutionInput {
2408
- constructor(input: string);
2268
+ interface Integration {
2269
+ id: string;
2270
+ enabled: boolean;
2271
+ externalIntegrationId?: string;
2272
+ type?: IntegrationType;
2273
+ isCurrent?: boolean;
2274
+ theme: Theme;
2275
+ logo: string;
2276
+ partner: Partner;
2409
2277
  }
2410
- /**
2411
- * Handles validation of spiffObject structure for transmission to the server.
2412
- */
2413
- declare class ObjectInput extends FlowExecutionInput {
2414
- constructor(id: string, type: ObjectInputType);
2415
- static validUUID(uuid: string): RegExpMatchArray | null;
2278
+ declare enum IntegrationType {
2279
+ Hub = "Hub",
2280
+ Shopify = "Shopify"
2416
2281
  }
2417
2282
  /**
2418
- * Handles validation of array input for transmission to the server.
2283
+ * Fields found in a variant within a line item resource.
2419
2284
  */
2420
- declare class ArrayInput extends FlowExecutionInput {
2421
- constructor(elements: FlowExecutionInput[]);
2285
+ interface LineItemVariant {
2286
+ currencyCode: string;
2287
+ optionName: string;
2288
+ priceModifier: number;
2289
+ stepName: string;
2290
+ variantName: string;
2422
2291
  }
2423
-
2424
- declare class IntegrationProduct {
2425
- private readonly integrationProduct;
2426
- constructor(product: IntegrationProductResource);
2427
- getId(): string;
2428
- getResource(): IntegrationProductResource;
2429
- getBasePrice(): number;
2430
- getDefaultWorkflow(): ProductWorkflow;
2431
- getAllWorkflows(): ProductWorkflow[];
2292
+ interface LineItem {
2293
+ id: string;
2294
+ transactionId?: string;
2295
+ previewImageUrl?: string;
2296
+ product: Product;
2297
+ quantity: number;
2298
+ metadata?: LineItemMetadata[];
2299
+ variants: LineItemVariant[];
2432
2300
  }
2433
-
2434
- declare const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<Workflow[]>;
2435
- declare const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<Workflow>;
2436
- /**
2437
- * Options that can be used during instantiation of the SpiffCommerce Javascript Client.
2438
- * Please refer to the documentation for more information.
2439
- */
2440
- interface ClientOptions {
2441
- /**
2442
- * When provided, the client will use the provided application key to
2443
- * authenticate with the SpiffCommerce API.
2444
- */
2445
- applicationKey?: string;
2301
+ interface LineItemMetadata {
2302
+ stepName: string;
2303
+ metadata: string;
2446
2304
  }
2447
- interface GetBundleGraphqlAssetsOptions {
2448
- metadata?: boolean;
2305
+ interface ProductWorkflow {
2306
+ friendlyName: string;
2307
+ id: string;
2308
+ index?: number;
2309
+ present?: boolean;
2310
+ imageUrl: string;
2311
+ workflowName: string;
2449
2312
  }
2450
- interface GetBundleGraphqlProductCollectionOptions {
2451
- eagerFetchProducts?: boolean;
2313
+ interface Partner {
2314
+ id?: string;
2315
+ name?: string;
2316
+ currencyCode?: string;
2317
+ customerDetailsPromptMarkdown?: string;
2318
+ activeAddons?: AddonHandle[];
2452
2319
  }
2453
- interface GetBundleGraphqlOptions {
2454
- productCollection?: GetBundleGraphqlProductCollectionOptions;
2455
- assets?: GetBundleGraphqlAssetsOptions;
2456
- additionalHeaders?: {
2457
- [key: string]: string;
2458
- };
2320
+ declare enum AddonHandle {
2321
+ BackgroundRemover = "Background Remover",
2322
+ ConversionAccelerator = "Conversion Accelerator",
2323
+ ProcessBuilder = "ProcessBuilder"
2459
2324
  }
2460
- interface GetBundleOptions {
2325
+ interface Product {
2461
2326
  /**
2462
- * Configuration for the graphQL request made for bundles. Allows for retrieval
2463
- * of additional data.
2327
+ * ID of the partner owner.
2464
2328
  */
2465
- graphql?: GetBundleGraphqlOptions;
2466
- }
2467
- interface GetWorkflowGraphqlAssetsOptions {
2468
- metadata?: boolean;
2469
- }
2470
- interface GetWorkflowGraphqlOptions {
2471
- assets?: GetWorkflowGraphqlAssetsOptions;
2472
- }
2473
- interface GetWorkflowOptionsBase {
2329
+ partnerId?: string;
2330
+ partner?: Partner;
2474
2331
  /**
2475
- * An existing preview service to use, instead of creating a new one.
2332
+ * Whether a line item for this product is delivered as soon as the order is received.
2476
2333
  */
2477
- previewService?: ThreeDPreviewService;
2334
+ autoprint: boolean;
2478
2335
  /**
2479
- * Configuration related to the
2480
- * workflow and how the system interprets it.
2336
+ * Whether this product can be quickprinted.
2481
2337
  */
2482
- workflowConfiguration?: {
2483
- /**
2484
- * False by default, when true the system will treat
2485
- * steps with a single variant
2486
- * as being renderable.
2487
- */
2488
- singleVariantsRenderable?: boolean;
2489
- };
2338
+ canQuickprint?: boolean;
2490
2339
  /**
2491
- * Configuration for the graphQL request made for workflows. Allows for retrieval
2492
- * of additional data.
2340
+ * The internal identifier for this product.
2493
2341
  */
2494
- graphql?: GetWorkflowGraphqlOptions;
2495
- }
2496
- interface GetWorkflowFromTransactionOptions extends GetWorkflowOptionsBase {
2497
- /** The existing Transaction to use. */
2498
- transactionId: string;
2499
- /** If set to true, the workflow will display in a read-only mode. */
2500
- readOnly?: boolean;
2501
- /** An existing workflow state, if available. */
2502
- workflowState?: string;
2503
- type: "transaction";
2504
- }
2505
- interface GetWorkflowFromIntegrationProductOptions extends GetWorkflowOptionsBase {
2506
- /** The workflow to load. */
2507
- workflowId: string;
2508
- integrationProductId: string;
2509
- /** An existing workflow state, if available. */
2510
- workflowState?: string;
2511
- type: "integration";
2512
- }
2513
- interface GetWorkflowFromExternalProductOptions extends GetWorkflowOptionsBase {
2514
- /** The workflow to load. */
2515
- workflowId: string;
2516
- /** The external ID associated with an integration. */
2517
- externalIntegrationId: string;
2518
- /** The ID of the product from the external system. */
2519
- externalProductId: string;
2520
- /** An existing workflow state, if available. */
2521
- workflowState?: string;
2522
- type: "external";
2523
- }
2524
- type GetNewWorkflowOptions = GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
2525
- type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetNewWorkflowOptions;
2526
- /**
2527
- * The Spiff Commerce Javascript Client. Required for
2528
- * creating workflow experiences.
2529
- */
2530
- declare class SpiffCommerceClient {
2531
- private options;
2532
- private initialized;
2533
- private currencyCode?;
2534
- private customer?;
2342
+ id: string;
2535
2343
  /**
2536
- * @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
2537
- * Any functionality referencing this object will be removed in a future release.
2344
+ * The human friendly name of the product.
2538
2345
  */
2539
- private experienceOptions?;
2540
- constructor(options: ClientOptions);
2346
+ name: string;
2541
2347
  /**
2542
- * @returns The asset manager allows for common operations related to assets
2543
- * and the Spiff Commerce platform.
2348
+ * A URL to the image asset associated with this product.
2544
2349
  */
2545
- getAssetManager(): AssetManager;
2546
- getCurrencyCode(): string;
2547
- getFlowService(): FlowService;
2548
- getIntegration(): Promise<{
2350
+ imageUrl?: string;
2351
+ /**
2352
+ * A resource url for a 3D model used to represent this product
2353
+ * in the 3d editor. If not available we assume the product doesn't support 3D.
2354
+ */
2355
+ modelUrl?: string;
2356
+ /**
2357
+ * A URL for the image used as an overlay on any workflows
2358
+ * that incorporate a product overlay step.
2359
+ */
2360
+ overlayImageUrl?: string;
2361
+ /**
2362
+ * Words which can't be used in a workflow for this product.
2363
+ */
2364
+ profanities?: {
2549
2365
  id: string;
2550
- theme: Theme;
2551
- partner: Partner;
2552
- logo: string;
2553
- }>;
2366
+ createdAt: string;
2367
+ userId: string;
2368
+ word: string;
2369
+ }[];
2554
2370
  /**
2555
- * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
2556
- * @param bundleId The ID of the bundle you intend to load.
2557
- * @returns An object containing the success status of the authentication attempt, and the type of stakeholder when successful.
2371
+ * The max characters that can be typed for quickprint.
2558
2372
  */
2559
- authenticateBundleFromLocalStorage(bundleId: string): Promise<{
2560
- stakeholderType?: StakeholderType;
2561
- success: boolean;
2562
- }>;
2373
+ quickprintMaxLength?: number;
2563
2374
  /**
2564
- * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
2565
- * @param transactionId The ID of the transaction that the user is attempting to load.
2566
- * @returns An object containing the following:
2567
- * - `customLogoLink`: A link to a custom logo to display in the header.
2568
- * - `transactionReadOnly`: Whether or not the transaction is read-only. Shadow will not accept any changes to the transaction if this is set to true.
2569
- * - `stakeholderType`: The type of stakeholder that the user is authenticated as.
2570
- * - `success`: Whether or not the authentication was successful.
2571
- * @throws An error if the transaction is not found.
2375
+ * The name of the module to use for quickprint.
2572
2376
  */
2573
- authenticateTransactionFromLocalStorage(transactionId: string): Promise<{
2574
- customLogoLink?: string;
2575
- transactionReadOnly?: boolean;
2576
- stakeholderType?: StakeholderType;
2577
- success: boolean;
2578
- theme?: Theme;
2579
- }>;
2580
- clearCustomer(): void;
2581
- clearCustomerForTransaction(transactionId: string): void;
2582
- getStakeholderTypeForTransaction(transactionId: string): StakeholderType | undefined;
2583
- getOrCreateCustomer(emailAddress: string): Promise<{
2584
- customer: Customer;
2585
- isAuthenticated: boolean;
2586
- }>;
2587
- private authenticateCustomerId;
2377
+ quickprintModuleName?: string;
2588
2378
  /**
2589
- * Generates a verification code for the given email address.
2590
- * @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
2379
+ * If true, the product should be displayed in the client as if it is available.
2380
+ * Should be displayed as if it is unavailable otherwise.
2591
2381
  */
2592
- generateVerificationCode(emailAddress: string): Promise<void>;
2382
+ enabled: boolean;
2593
2383
  /**
2594
- * Verifies the given email address with the given verification code.
2595
- * @param emailAddress The email address to verify.
2596
- * @param verificationCode The verification code to verify the email address with.
2597
- * @returns True if the verification was successful, false otherwise.
2384
+ * Workflows which have been assigned to this product.
2598
2385
  */
2599
- verifyCode(emailAddress: string, verificationCode: string): Promise<boolean>;
2386
+ workflows?: ProductWorkflow[];
2600
2387
  /**
2601
- * @param collectionId Optional: The id of the product collection that the bundle can use.
2602
- * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
2388
+ * The base price of this product in sub units. Essentially the cost of the
2389
+ * product without any customisations applied.
2603
2390
  */
2604
- getNewBundle(collectionId?: string, initialMetadata?: {
2605
- [key: string]: string;
2606
- }, options?: GetBundleOptions): Promise<Bundle>;
2391
+ basePrice?: number;
2392
+ /**
2393
+ * The weight of this product.
2394
+ */
2395
+ weight?: number;
2396
+ /**
2397
+ * When specified, represents a pre-rendered image of this product to be
2398
+ * displayed to customers while the 3D preview is loading.
2399
+ */
2400
+ preloadImageUrl?: string;
2401
+ /**
2402
+ * When set the store owner has configured this product to prompt for
2403
+ * customer details. In hosted experience, we'll offer to collect this information from the customer. In
2404
+ * bespoke UIs created using the Core SDK you will need to check this flag and request the data accordingly.
2405
+ * See attachCustomerDetails on the WorkflowExperience for how to supply us with the details you collect.
2406
+ */
2407
+ promptForCustomerDetails?: boolean;
2408
+ /**
2409
+ * Configuration for conversion. Optional.
2410
+ */
2411
+ conversionConfiguration?: ConversionConfiguration;
2412
+ integrationProducts?: IntegrationProductResource[];
2413
+ productTags?: ProductTag[];
2414
+ /**
2415
+ * The SKU of the product in the merchant's store.
2416
+ */
2417
+ sku?: string;
2418
+ /**
2419
+ * The Spiff SKU code for the product.
2420
+ */
2421
+ skuCode?: string;
2422
+ /**
2423
+ * Price breaks for this product when dealing with quantity.
2424
+ */
2425
+ priceBreaks?: ProductPriceBreak[];
2426
+ }
2427
+ /**
2428
+ * A price break represents a minimum quantity of a product and the price that will be charged for that quantity.
2429
+ * This can be seen as an override for the base price of the product.
2430
+ */
2431
+ interface ProductPriceBreak {
2432
+ /**
2433
+ * The id of this price break.
2434
+ */
2435
+ id: string;
2436
+ /**
2437
+ * The minimum quantity of this price break. A positive integer.
2438
+ */
2439
+ minQty: number;
2440
+ /**
2441
+ * A percentage to apply to the overall price. A value between 0-1 where 1 retains 100% of the original price and 0 completely discounts it to free.
2442
+ */
2443
+ percentage: number;
2444
+ }
2445
+ interface ProductTag {
2446
+ id: string;
2447
+ name: string;
2448
+ }
2449
+ interface ColorOption {
2450
+ id?: string;
2451
+ fill?: string;
2452
+ stroke?: string;
2453
+ variant?: VariantResource;
2454
+ colorProfileAssetKey?: string;
2455
+ }
2456
+ interface RegionElement {
2457
+ id: string;
2458
+ region?: Region;
2459
+ }
2460
+ interface FrameMetadata {
2461
+ image: string;
2462
+ }
2463
+ interface IllustrationMetadata {
2464
+ colors: string[];
2465
+ }
2466
+ interface ModuleMetadata {
2467
+ text: string;
2468
+ }
2469
+ interface TextMetadata {
2470
+ color?: string;
2471
+ text: string;
2472
+ fillImage?: string;
2473
+ }
2474
+ interface SelectionStorage {
2475
+ selectedVariants?: VariantResource[];
2476
+ }
2477
+ interface TextStepStorage extends SelectionStorage {
2478
+ color?: string;
2479
+ defaultCleared?: boolean;
2480
+ inputText?: string;
2481
+ text?: string;
2482
+ customiseAllText?: boolean;
2483
+ }
2484
+ type StepSelections = {
2485
+ [key: string]: SelectionStorage;
2486
+ };
2487
+ interface FrameData {
2607
2488
  /**
2608
- * Retrieves an existing bundle from the API, by id.
2609
- * @param bundleId The id of the bundle to retrieve.
2610
- * @param previewService Optional: A reference to an existing preview service to use. This can be assigned manually later.
2611
- * @param graphqlOptions Optional: Options to configure loading the workflow.
2612
- * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
2489
+ * The path data for a frame SVG
2613
2490
  */
2614
- getExistingBundle(bundleId: string, previewService?: ThreeDPreviewService,
2491
+ path: string;
2615
2492
  /**
2616
- * @deprecated use GetBundleOptions instead. This attribute will be removed in the future.
2493
+ * The viewbox width
2617
2494
  */
2618
- graphqlOptions?: GetBundleGraphqlOptions, options?: GetBundleOptions): Promise<Bundle>;
2495
+ width: number;
2619
2496
  /**
2620
- * Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
2621
- * @returns An array of bundle stakeholders.
2497
+ * The viewbox height.
2622
2498
  */
2623
- getBundleStakeholders(): Promise<BundleStakeholder[]>;
2499
+ height: number;
2500
+ }
2501
+ interface FrameThresholdSettings {
2502
+ useThreshold: boolean;
2503
+ invertThreshold: boolean;
2504
+ threshold: number;
2505
+ thresholdSaturation: number;
2506
+ }
2507
+ /**
2508
+ * Defines the different behaviors supported by the camera system
2509
+ * for control when viewing a product.
2510
+ */
2511
+ declare enum ProductCameraRig {
2512
+ Orbit = 0,
2513
+ Pan = 1
2514
+ }
2515
+ /**
2516
+ * Defines the locations at which a conversion attempt can take place.
2517
+ */
2518
+ declare enum ConversionLocation {
2624
2519
  /**
2625
- * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
2626
- * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
2627
- * @param workflowState An existing workflow state if available. Deprecated: Provide options instead.
2628
- * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
2629
- * @param options Options to configure loading the transaction and workflow.
2630
- * @returns A workflow experience configured as requested.
2520
+ * The client should expose a flow for allowing the user to optionally input details at any point.
2631
2521
  */
2632
- getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => ThreeDPreviewService, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
2522
+ Manual = "Manual",
2633
2523
  /**
2634
- * Gets multiple workflow experiences at once.
2635
- * @param optionsArray An array of options to configure loading the transactions and workflows.
2636
- * NOTE: The `previewService` field on the option is currently unsupported in this function, as loading multiple models at once will likely cause performance issues.
2637
- * @param graphqlOptions Options to configure loading the workflows.
2638
- * @returns An array of workflow experiences configured as requested.
2524
+ * The client should show the conversion flow at the beginning of a workflow.
2639
2525
  */
2640
- getWorkflowExperiences(optionsArray: GetWorkflowOptions[], graphqlOptions?: GetWorkflowGraphqlOptions): Promise<WorkflowExperience[]>;
2526
+ OnStart = "OnStart",
2641
2527
  /**
2642
- * Initialize the client from an integration product.
2643
- * @param integrationProductId The integration product to use.
2644
- * @deprecated Use getWorkflowExperience to initialize the experience.
2528
+ * The client should allow the user to input details just before quitting the experience.
2645
2529
  */
2646
- initFromIntegrationProduct(integrationProductId: string): Promise<void>;
2530
+ OnQuit = "OnQuit",
2647
2531
  /**
2648
- * Initialize the client from an existing transaction.
2649
- * @param transactionId The id of the transaction
2650
- * @returns A promise resolving at initialization completion.
2651
- * @deprecated Use getWorkflowExperience to initialize the experience.
2532
+ * The client should ask the user for details prior to adding to cart.
2652
2533
  */
2653
- initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
2534
+ OnEnd = "OnEnd"
2535
+ }
2536
+ /**
2537
+ * The data configured to be requested.
2538
+ */
2539
+ declare enum ConversionDataType {
2540
+ Email = "Email",
2541
+ FirstName = "FirstName",
2542
+ LastName = "LastName",
2543
+ Phone = "Phone"
2544
+ }
2545
+ interface ConversionData {
2546
+ type: ConversionDataType;
2547
+ mandatory: boolean;
2548
+ }
2549
+ /**
2550
+ * The configuration for conversion, exposed on products currently.
2551
+ */
2552
+ interface ConversionConfiguration {
2553
+ id: string;
2554
+ name?: string;
2555
+ locations: ConversionLocation[];
2556
+ requestedData: ConversionDataType[];
2557
+ requestedDataItems: ConversionData[];
2558
+ mandatory?: boolean;
2559
+ }
2560
+ /**
2561
+ * Someone who has used a workflow experience and entered their contact details.
2562
+ */
2563
+ interface Customer {
2564
+ id?: string;
2565
+ emailAddress: string;
2566
+ firstName?: string;
2567
+ lastName?: string;
2568
+ phoneNumber?: string;
2569
+ loginToken?: string;
2570
+ partner?: Partner;
2571
+ stakeholders?: Stakeholder[];
2572
+ bundleStakeholders?: BundleStakeholder[];
2573
+ }
2574
+ interface CustomerDetailsInput {
2575
+ emailAddress: string;
2576
+ firstName?: string;
2577
+ lastName?: string;
2578
+ phoneNumber?: string;
2579
+ }
2580
+ declare enum StakeholderType {
2581
+ Owner = "Owner",
2582
+ Approver = "Approver",
2583
+ Editor = "Editor",
2584
+ Viewer = "Viewer"
2585
+ }
2586
+ interface Stakeholder {
2587
+ id: string;
2588
+ type?: StakeholderType;
2589
+ transaction?: Transaction;
2590
+ customer?: Customer;
2591
+ }
2592
+ interface Bundle {
2593
+ id?: string;
2594
+ bundleOwnerId?: string;
2595
+ bundleStakeholders?: BundleStakeholder[];
2596
+ bundleStateData?: string;
2597
+ metadata?: {
2598
+ key: string;
2599
+ value: string;
2600
+ }[];
2601
+ name?: string;
2602
+ partner?: Partner;
2603
+ productCollection?: ProductCollectionResource;
2604
+ transactions?: Transaction[];
2605
+ }
2606
+ interface BundleStakeholder {
2607
+ id: string;
2608
+ bundle?: Bundle;
2609
+ customer?: Customer;
2610
+ type?: StakeholderType;
2611
+ }
2612
+ interface BundleStakeholderInput {
2613
+ type: StakeholderType;
2614
+ customerDetails: CustomerDetailsInput;
2615
+ }
2616
+ type ProductCollectionResource = {
2617
+ id: string;
2618
+ globalPropertyConfiguration?: GlobalPropertyConfiguration;
2619
+ productCollectionProducts?: ProductCollectionProductResource[];
2620
+ name: string;
2621
+ transformCollection?: TransformCollection;
2622
+ };
2623
+ type ProductCollectionProductResource = {
2624
+ id: string;
2625
+ productCollection?: ProductCollectionResource;
2626
+ productCollectionId?: string;
2627
+ product: Product;
2628
+ productId: string;
2629
+ workflowId?: string;
2630
+ };
2631
+ type GlobalPropertyState = {
2632
+ id: string;
2633
+ aspects: GlobalPropertyStateAspect[];
2634
+ };
2635
+ type GlobalPropertyStateAspect = {
2636
+ name: string;
2637
+ value: string;
2638
+ type?: AspectType;
2639
+ storage?: GlobalPropertyStateAspectStorage;
2640
+ };
2641
+ type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage;
2642
+ type GlobalPropertyStateFileUploadStorage = {
2643
+ originalAssetKey?: string;
2644
+ backgroundRemovedAssetKey?: string;
2645
+ useOriginalAsset?: boolean;
2646
+ };
2647
+ interface BundleStateTransform {
2648
+ position: Vector3;
2649
+ rotation: Vector3;
2650
+ scale: Vector3;
2651
+ }
2652
+ interface Vector3 {
2653
+ x: number;
2654
+ y: number;
2655
+ z: number;
2656
+ }
2657
+ interface TransformCollection {
2658
+ id: string;
2659
+ name: string;
2660
+ transforms: TransformCollectionTransform[];
2661
+ }
2662
+ interface TransformCollectionTransform {
2663
+ id: string;
2664
+ name: string;
2665
+ position: Vector3;
2666
+ rotation: Vector3;
2667
+ scale: Vector3;
2668
+ }
2669
+ type Extendable<T> = T & {
2670
+ [key: string]: any;
2671
+ };
2672
+
2673
+ interface StorageService {
2654
2674
  /**
2655
- * @deprecated Remove when the initFrom functions are removed.
2675
+ * Get a value.
2676
+ * @param key The key to lookup the value with.
2656
2677
  */
2657
- private getWorkflowExperienceDeprecated;
2678
+ get(key: string): string | undefined;
2658
2679
  /**
2659
- * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
2660
- * @returns The preview service that was provided during construction.
2680
+ * Set a value.
2681
+ * @param key The key to set.
2682
+ * @param val The new value.
2661
2683
  */
2662
- getPreviewService(): ThreeDPreviewService | undefined;
2684
+ set(key: string, val: string): void;
2663
2685
  /**
2664
- * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
2665
- * @returns The product associated with this client.
2686
+ * Remove a value.
2687
+ * @param key The key to remove, does nothing if the key doesn't exist.
2666
2688
  */
2667
- getProduct(): Product;
2689
+ remove(key: string): void;
2668
2690
  /**
2669
- * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
2670
- * @returns The transaction associated with this client.
2691
+ * Get a map from persistence.
2692
+ * @param key The key to search by.
2671
2693
  */
2672
- getTransaction(): Transaction;
2673
- configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
2694
+ getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
2674
2695
  /**
2675
- * A function used to synchronize transaction state with the server.
2676
- * @param options New state details. To be spread into the query.
2677
- * @returns
2696
+ * St a map into persistence.
2697
+ * @param key The key to set the map at.
2698
+ * @param val The map to set.
2678
2699
  */
2679
- private updateTransactionState;
2680
- storeCustomer(customer: Customer): void;
2681
- getIntegrationProductById(integrationProductId: string): Promise<IntegrationProduct>;
2682
- getIntegrationProductFromExternalIds(externalIntegrationId: string, externalProductId: string): Promise<IntegrationProduct>;
2683
- getIntegrationProduct(options: Extendable<{
2684
- type: "integration";
2685
- integrationProductId: string;
2686
- }> | Extendable<{
2687
- type: "external";
2688
- externalIntegrationId: string;
2689
- externalProductId: string;
2690
- }>): Promise<IntegrationProduct>;
2700
+ setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
2691
2701
  }
2702
+ declare const persistenceService: StorageService;
2692
2703
 
2693
2704
  declare class Configuration {
2694
2705
  private readonly defaultServerUrl;
@@ -2915,6 +2926,9 @@ declare class DigitalContentStepService implements StepService<DigitalContentSte
2915
2926
  declare const digitalContentStepService: DigitalContentStepService;
2916
2927
 
2917
2928
  declare class MockWorkflowManager implements WorkflowManager {
2929
+ private client;
2930
+ getClient(): SpiffCommerceClient;
2931
+ setClient(client: SpiffCommerceClient): void;
2918
2932
  getInitializationPromise(): Promise<void>;
2919
2933
  getProduct: () => Product;
2920
2934
  isInitialized(): boolean;
@@ -3185,6 +3199,7 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
3185
3199
  * @param storeAsOriginal Optional: Store this asset as the original, unmodified version of the image. Default: `true`.
3186
3200
  */
3187
3201
  selectImage(asset: Asset, storeAsOriginal?: boolean): Promise<void>;
3202
+ canUseBackgroundRemover(): Promise<boolean>;
3188
3203
  /**
3189
3204
  * Removes the background from an image, stores it in the state, and returns the new asset.
3190
3205
  * @param applyNewAsset Optionally applies the new asset as the current image selection. Default: `true`.
@@ -3279,4 +3294,4 @@ declare class PromiseCache {
3279
3294
  }
3280
3295
  declare const promiseCache: PromiseCache;
3281
3296
 
3282
- export { ArrayInput, AssetNotFoundError, Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CollectionProduct, ColorOption, ColorOptionGlobalPropertyHandle, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
3297
+ export { AddonHandle, ArrayInput, AssetNotFoundError, Bundle$1 as Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CollectionProduct, ColorOption, ColorOptionGlobalPropertyHandle, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow$1 as ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };