@spiffcommerce/core 10.2.0 → 10.3.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, TextFillImage, 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";
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, TextFillImage, 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, Theme as _Theme1, 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, Theme } 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[];
@@ -699,6 +699,10 @@ export interface Transaction {
699
699
  bulkSourceUrl?: string;
700
700
  bulkEmailAddress?: string;
701
701
  lastSyncedAt?: string;
702
+ /**
703
+ * The users who have access to this transaction.
704
+ */
705
+ stakeholders?: Stakeholder[];
702
706
  }
703
707
  interface IntegrationProduct {
704
708
  id: string;
@@ -978,6 +982,9 @@ export interface Customer {
978
982
  firstName?: string;
979
983
  lastName?: string;
980
984
  phoneNumber?: string;
985
+ loginToken?: string;
986
+ partner?: Partner;
987
+ stakeholders?: Stakeholder[];
981
988
  }
982
989
  export interface CustomerDetailsInput {
983
990
  emailAddress: string;
@@ -985,7 +992,7 @@ export interface CustomerDetailsInput {
985
992
  lastName?: string;
986
993
  phoneNumber?: string;
987
994
  }
988
- enum StakeholderType {
995
+ export enum StakeholderType {
989
996
  Owner = "Owner",
990
997
  Approver = "Approver",
991
998
  Editor = "Editor",
@@ -1864,18 +1871,34 @@ export class SpiffCommerceClient {
1864
1871
  getAssetManager(): AssetManager;
1865
1872
  getCurrencyCode(): string;
1866
1873
  /**
1867
- * Initialize the client from an integration product.
1868
- * @param integrationProductId The integration product to use.
1869
- * @deprecated Use getWorkflowExperience to initialize the experience.
1874
+ * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
1875
+ * @param transactionId The ID of the transaction that the user is attempting to load.
1876
+ * @returns An object containing the success status of the authentication attempt, a custom logo link if available, the stakeholder type, and the theme of the workflow.
1877
+ * @throws An error if the transaction is not found.
1870
1878
  */
1871
- initFromIntegrationProduct(integrationProductId: string): Promise<void>;
1879
+ loadTransactionAuth(transactionId: string): Promise<{
1880
+ customLogoLink?: string;
1881
+ stakeholderType?: StakeholderType;
1882
+ success: boolean;
1883
+ theme?: _Theme1;
1884
+ }>;
1872
1885
  /**
1873
- * Initialize the client from an existing transaction.
1874
- * @param transactionId The id of the transaction
1875
- * @returns A promise resolving at initialization completion.
1876
- * @deprecated Use getWorkflowExperience to initialize the experience.
1886
+ * Generates a verification code for the given email address. An error will be thrown if the email address is not associated with the transaction.
1887
+ * @param transactionId The ID of the transaction that the user is attempting to load.
1888
+ * @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
1877
1889
  */
1878
- initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
1890
+ generateVerificationCode(transactionId: string, emailAddress: string): Promise<void>;
1891
+ /**
1892
+ * Verifies the given email address with the given verification code.
1893
+ * @param transactionId The ID of the transaction that the user is attempting to load.
1894
+ * @param emailAddress The email address to verify.
1895
+ * @param verificationCode The verification code to verify the email address with.
1896
+ * @returns An object containing the success status of the verification attempt, and a stakeholder type if the verification was successful.
1897
+ */
1898
+ verifyCode(transactionId: string, emailAddress: string, verificationCode: string): Promise<{
1899
+ success: boolean;
1900
+ stakeholderType?: StakeholderType;
1901
+ }>;
1879
1902
  /**
1880
1903
  * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
1881
1904
  * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
@@ -1885,6 +1908,19 @@ export class SpiffCommerceClient {
1885
1908
  * @returns A workflow experience configured as requested.
1886
1909
  */
1887
1910
  getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
1911
+ /**
1912
+ * Initialize the client from an integration product.
1913
+ * @param integrationProductId The integration product to use.
1914
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1915
+ */
1916
+ initFromIntegrationProduct(integrationProductId: string): Promise<void>;
1917
+ /**
1918
+ * Initialize the client from an existing transaction.
1919
+ * @param transactionId The id of the transaction
1920
+ * @returns A promise resolving at initialization completion.
1921
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1922
+ */
1923
+ initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
1888
1924
  /**
1889
1925
  * @returns The preview service that was provided during construction.
1890
1926
  */
@@ -1997,6 +2033,6 @@ export class FrameStepHandle extends StepHandle<_FrameStepData1> {
1997
2033
  export const TransformWrapper: React.FunctionComponent;
1998
2034
  export { CommandContext };
1999
2035
  export { AssetType, BringForwardCommand, BringToFrontCommand, BringToBackCommand, CanvasCommand, CreateElementCommand, CreateLayoutCommand, DeleteElementCommand, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, GroupCommand, LayoutElementFactory, LayoutElementType, MoveCommand, ResizeCommand, RotateCommand, SendBackwardsCommand, StepAspectType, StepType, TextChangeCommand, UnitOfMeasurement, dataUrlFromExternalUrl, findElement, frameDataCache, generate, getAxisAlignedBoundingBox, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, rehydrateSerializedLayout, getFrameData, getSvgElement, loadFontFromDataUrl, loadFontFromExternalUrl, determineCorrectFontSizeAndLines, patternImageDataCache, registerJSDOM };
2000
- export { Animatable, AnyStepData, Asset, BulkStepData, ColorProfileProps, ColorDefinition, CommandState, WorkflowPanel, DigitalContentStepData, FrameElement, FrameStepData, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, OptionResource, PictureStepData, QuestionStepData, ShapeStepData, Step, StepAspect, StepStorage, TextStepData, TextboxElement, VariantResource, Workflow };
2036
+ export { Animatable, AnyStepData, Asset, BulkStepData, ColorProfileProps, ColorDefinition, CommandState, WorkflowPanel, DigitalContentStepData, FrameElement, FrameStepData, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, OptionResource, PictureStepData, QuestionStepData, ShapeStepData, Step, StepAspect, StepStorage, TextStepData, TextboxElement, Theme, VariantResource, Workflow };
2001
2037
 
2002
2038
  //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "10.2.0",
3
+ "version": "10.3.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",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@apollo/client": "^3.7.0",
90
- "@spiffcommerce/papyrus": "^2.0.3",
90
+ "@spiffcommerce/papyrus": "^2.0.4",
91
91
  "cross-fetch": "^3.1.5",
92
92
  "graphql": "^16.6.0",
93
93
  "lodash.clonedeep": "^4.5.0",