@spiffcommerce/core 0.10.255 → 1.1.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/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, AnyStepData as _AnyStepData1, Asset as _Asset1, Region, VariantResource as _VariantResource1, FrameOffsets, PatternImageData, DigitalContentStepData as _DigitalContentStepData1, LayoutsState as _LayoutsState1, CanvasCommand as _CanvasCommand1, FrameStepData as _FrameStepData1, ILayout as _ILayout1, CreateElementCommand as _CreateElementCommand1, FrameElement as _FrameElement1, ColorDefinition as _ColorDefinition1, IllustrationStepData as _IllustrationStepData1, IllustrationElement as _IllustrationElement1, LayoutData as _LayoutData1, MaterialStepData as _MaterialStepData1, ModelStepData as _ModelStepData1, ModuleStepData as _ModuleStepData1, PictureStepData as _PictureStepData1, QuestionStepData as _QuestionStepData1, ShapeStepData as _ShapeStepData1, FontData, GroupCommand as _GroupCommand1, OptionResource as _OptionResource1, TextboxElement as _TextboxElement1, TextStepData as _TextStepData1, StepStorage as _StepStorage1, SerializableStep, CommandState as _CommandState1, CommandContext as _CommandContext1, LayoutState, MaterialResource, AssetType as _AssetType1, Point, ScaleAxis, UnitOfMeasurement as _UnitOfMeasurement1, StepType as _StepType1, BulkStepData as _BulkStepData1, StepGroup, FrameData as _FrameData1, Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, BringToFrontCommand, BringToBackCommand, BulkStepData, CanvasCommand, ColorDefinition, CommandContext, CommandState, CreateElementCommand, DeleteElementCommand, DigitalContentStepData, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, FrameElement, FrameStepData, GroupCommand, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutElementFactory, LayoutElementType, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, MoveCommand, OptionResource, PictureStepData, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, UnitOfMeasurement, VariantResource, Workflow, dataUrlFromExternalUrl, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getFrameData, getSvgElement, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, CreateLayoutCommand, rehydrateSerializedLayout, ColorProfileProps, WorkflowPanel, determineCorrectFontSizeAndLines, registerJSDOM, getAxisAlignedBoundingBox } from "@spiffcommerce/papyrus";
1
+ import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, AnyStepData as _AnyStepData1, Asset as _Asset1, Region, VariantResource as _VariantResource1, FrameOffsets, PatternImageData, DigitalContentStepData as _DigitalContentStepData1, LayoutsState as _LayoutsState1, CanvasCommand as _CanvasCommand1, FrameStepData as _FrameStepData1, ILayout as _ILayout1, CreateElementCommand as _CreateElementCommand1, FrameElement as _FrameElement1, ColorDefinition as _ColorDefinition1, IllustrationStepData as _IllustrationStepData1, IllustrationElement as _IllustrationElement1, LayoutData as _LayoutData1, MaterialStepData as _MaterialStepData1, ModelStepData as _ModelStepData1, ModuleStepData as _ModuleStepData1, PictureStepData as _PictureStepData1, QuestionStepData as _QuestionStepData1, ShapeStepData as _ShapeStepData1, FontData, GroupCommand as _GroupCommand1, OptionResource as _OptionResource1, TextboxElement as _TextboxElement1, TextStepData as _TextStepData1, StepStorage as _StepStorage1, SerializableStep, CommandState as _CommandState1, CommandContext as _CommandContext1, LayoutState, MaterialResource, AssetType as _AssetType1, Point, ScaleAxis, UnitOfMeasurement as _UnitOfMeasurement1, StepType as _StepType1, BulkStepData as _BulkStepData1, FrameData as _FrameData1, Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, BringToFrontCommand, BringToBackCommand, BulkStepData, CanvasCommand, ColorDefinition, CommandContext, CommandState, CreateElementCommand, DeleteElementCommand, DigitalContentStepData, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, FrameElement, FrameStepData, GroupCommand, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutElementFactory, LayoutElementType, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, MoveCommand, OptionResource, PictureStepData, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, UnitOfMeasurement, VariantResource, Workflow, dataUrlFromExternalUrl, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getFrameData, getSvgElement, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, CreateLayoutCommand, rehydrateSerializedLayout, ColorProfileProps, WorkflowPanel, determineCorrectFontSizeAndLines, registerJSDOM, getAxisAlignedBoundingBox } from "@spiffcommerce/papyrus";
2
2
  import { ApolloClient } from "@apollo/client";
3
3
  import React, { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent } from "react";
4
4
  export const gatherVaryingStepAspects: (workflow: _Workflow1) => _StepAspect1[];
@@ -492,6 +492,11 @@ export interface WorkflowManager {
492
492
  getWorkflowMetadata: () => WorkflowMetadata;
493
493
  getInformationResults(): InformationResult[];
494
494
  getTransaction: () => Transaction;
495
+ getTransactionCustomer: () => Customer | undefined;
496
+ setTransactionCustomer: (customer: Customer) => void;
497
+ /**
498
+ * @deprecated Use setTransactionCustomer instead.
499
+ */
495
500
  setTransactionCustomerDetails: (details: {
496
501
  email: string;
497
502
  }) => void;
@@ -935,8 +940,15 @@ export enum ConversionLocation {
935
940
  /**
936
941
  * The data configured to be requested.
937
942
  */
938
- export enum ConversionData {
939
- Email = "Email"
943
+ export enum ConversionDataType {
944
+ Email = "Email",
945
+ FirstName = "FirstName",
946
+ LastName = "LastName",
947
+ Phone = "Phone"
948
+ }
949
+ export interface ConversionData {
950
+ type: ConversionDataType;
951
+ mandatory: boolean;
940
952
  }
941
953
  /**
942
954
  * The configuration for conversion, exposed on products currently.
@@ -948,6 +960,34 @@ export interface ConversionConfiguration {
948
960
  requestedData: ConversionData[];
949
961
  mandatory?: boolean;
950
962
  }
963
+ /**
964
+ * Someone who has used a workflow experience and entered their contact details.
965
+ */
966
+ export interface Customer {
967
+ id?: string;
968
+ emailAddress: string;
969
+ firstName?: string;
970
+ lastName?: string;
971
+ phoneNumber?: string;
972
+ }
973
+ export interface CustomerDetailsInput {
974
+ emailAddress: string;
975
+ firstName?: string;
976
+ lastName?: string;
977
+ phoneNumber?: string;
978
+ }
979
+ enum StakeholderType {
980
+ Owner = "Owner",
981
+ Approver = "Approver",
982
+ Editor = "Editor",
983
+ Viewer = "Viewer"
984
+ }
985
+ export interface Stakeholder {
986
+ id: string;
987
+ type?: StakeholderType;
988
+ transaction?: Transaction;
989
+ customer?: Customer;
990
+ }
951
991
  interface StorageService {
952
992
  /**
953
993
  * Get a value.
@@ -1536,6 +1576,23 @@ declare class DesignService {
1536
1576
  removeDesign(transactionId: string): Promise<void>;
1537
1577
  }
1538
1578
  export const designService: DesignService;
1579
+ /**
1580
+ * A scene is a collection of steps that can be used to group steps together.
1581
+ */
1582
+ interface Scene {
1583
+ /**
1584
+ * The unique identifier for the scene.
1585
+ */
1586
+ id?: string;
1587
+ /**
1588
+ * The name of the scene.
1589
+ */
1590
+ name: string;
1591
+ /**
1592
+ * The steps that are part of the scene. A list of ids. See getStepById.
1593
+ */
1594
+ stepIds: string[];
1595
+ }
1539
1596
  /**
1540
1597
  * A Workflow experience encapsulates the workflow manager and command context. It
1541
1598
  * provides a simplified interface for interacting with the workflow manager. You
@@ -1585,15 +1642,21 @@ export interface WorkflowExperience {
1585
1642
  * Returns all steps that are children of a given scene.
1586
1643
  * @param scene The scene you want the steps for.
1587
1644
  */
1588
- getStepsByScene(scene: StepGroup): StepHandle<_AnyStepData1>[];
1645
+ getStepsByScene(scene: Scene): StepHandle<_AnyStepData1>[];
1589
1646
  /**
1590
1647
  * Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
1591
1648
  */
1592
1649
  getSteps(): StepHandle<_AnyStepData1>[];
1650
+ /**
1651
+ * Returns a list of scenes that are configured in the workflow. Each scene
1652
+ * contains a list of steps. See getStepsByScene to access these.
1653
+ */
1654
+ getScenes(): Scene[];
1593
1655
  /**
1594
1656
  * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
1595
1657
  * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
1596
1658
  * @param details The new customer details. Only email is supported.
1659
+ * @deprecated Use assignCustomerDetails instead.
1597
1660
  */
1598
1661
  attachCustomerDetails(details: {
1599
1662
  /**
@@ -1601,6 +1664,12 @@ export interface WorkflowExperience {
1601
1664
  */
1602
1665
  email: string;
1603
1666
  }): Promise<void>;
1667
+ /**
1668
+ * Attach specific details about the customer to the experience. This is useful for things like retargeting.
1669
+ * From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
1670
+ * @param details The new customer details.
1671
+ */
1672
+ assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
1604
1673
  /**
1605
1674
  * Attaches a listener to the scenes on a workflow experience. The scenes returned are a subset of the scenes configured in the
1606
1675
  * workflow and are based on the current state of the experience. This is useful for building a navigation menu.
@@ -1740,6 +1809,8 @@ export class MockWorkflowManager implements WorkflowManager {
1740
1809
  getTransaction(): {
1741
1810
  id: string;
1742
1811
  };
1812
+ getTransactionCustomer(): undefined;
1813
+ setTransactionCustomer(): void;
1743
1814
  setTransactionCustomerDetails(): void;
1744
1815
  getWorkflow(): {
1745
1816
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "0.10.255",
3
+ "version": "1.1.0",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",