@spiffcommerce/core 8.0.3 → 9.0.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, 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, 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[];
@@ -368,8 +368,10 @@ declare class TextStepService implements StepService<_TextStepData1> {
368
368
  * @param stepData The text step to get colors for.
369
369
  * @returns A list of color objects containg fill, stroke and variant if available.
370
370
  */
371
- availableColors(stepData: _Step1<_TextStepData1>): ColorOption[];
372
- changeFill(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
371
+ availableFillColors(stepData: _Step1<_TextStepData1>): ColorOption[];
372
+ changeFillColor(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
373
+ availableFillImages(stepData: _Step1<_TextStepData1>): Promise<TextFillImage[]>;
374
+ changeFillImage(stepData: _Step1<_TextStepData1>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
373
375
  /**
374
376
  * Given an element and a string, filters any characters from the string that are
375
377
  * not supported by the font of the given element.
@@ -865,6 +867,7 @@ interface ModuleMetadata {
865
867
  interface TextMetadata {
866
868
  color?: string;
867
869
  text: string;
870
+ fillImage?: string;
868
871
  }
869
872
  export interface SelectionStorage {
870
873
  selectedVariants?: _VariantResource1[];
@@ -1541,16 +1544,19 @@ export class TextStepHandle extends StepHandle<_TextStepData1> {
1541
1544
  /**
1542
1545
  * @returns A list of colors that can be used to fill the text.
1543
1546
  */
1544
- getAvailableColors(): ColorOption[];
1547
+ getAvailableFillColors(): ColorOption[];
1545
1548
  /**
1546
1549
  * Changes the fill of text related to this step to the new fill value.
1547
1550
  * @param fill A new fill value to use.
1548
1551
  */
1549
- setFill(fill: ColorOption): Promise<void>;
1552
+ setFillColor(fill: ColorOption): Promise<void>;
1550
1553
  /**
1551
1554
  * Gets the color currently applied to the element.
1552
1555
  */
1553
- getFill(): string;
1556
+ getFillColor(): string;
1557
+ getAvailableFillImages(): Promise<TextFillImage[]>;
1558
+ setFillImage(fillImage: TextFillImage): Promise<void>;
1559
+ getFillImage(): TextFillImage | undefined;
1554
1560
  /**
1555
1561
  * When true & the step has replaceable text configured the user will be
1556
1562
  * abled to edit the entire text string including the non-replaceable text.
@@ -1805,6 +1811,7 @@ interface ClientOptions {
1805
1811
  /**
1806
1812
  * When set to true, the client will treat the workflow as a bulk order
1807
1813
  * containing multiple variations of the base design.
1814
+ * @deprecated Specify when calling getWorkflowExperience instead.
1808
1815
  */
1809
1816
  bulk?: boolean;
1810
1817
  /**
@@ -1813,6 +1820,37 @@ interface ClientOptions {
1813
1820
  */
1814
1821
  applicationKey?: string;
1815
1822
  }
1823
+ interface GetWorkflowFromTransactionOptions {
1824
+ /** The existing Transaction to use. */
1825
+ transactionId: string;
1826
+ /** If set to true, the workflow will display in a read-only mode. */
1827
+ readOnly?: boolean;
1828
+ /** An existing workflow state, if available. */
1829
+ workflowState?: string;
1830
+ type: "transaction";
1831
+ }
1832
+ interface GetWorkflowFromIntegrationProductOptions {
1833
+ /** The workflow to load. */
1834
+ workflowId: string;
1835
+ integrationProductId: string;
1836
+ /** An existing workflow state, if available. */
1837
+ workflowState?: string;
1838
+ bulk?: boolean;
1839
+ type: "integration";
1840
+ }
1841
+ interface GetWorkflowFromExternalProductOptions {
1842
+ /** The workflow to load. */
1843
+ workflowId: string;
1844
+ /** The external ID associated with an integration. */
1845
+ externalIntegrationId: string;
1846
+ /** The ID of the product from the external system. */
1847
+ externalProductId: string;
1848
+ /** An existing workflow state, if available. */
1849
+ workflowState?: string;
1850
+ bulk?: boolean;
1851
+ type: "external";
1852
+ }
1853
+ export type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
1816
1854
  /**
1817
1855
  * The Spiff Commerce Javascript Client. Required for
1818
1856
  * creating workflow experiences.
@@ -1828,22 +1866,25 @@ export class SpiffCommerceClient {
1828
1866
  /**
1829
1867
  * Initialize the client from an integration product.
1830
1868
  * @param integrationProductId The integration product to use.
1869
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1831
1870
  */
1832
1871
  initFromIntegrationProduct(integrationProductId: string): Promise<void>;
1833
1872
  /**
1834
1873
  * Initialize the client from an existing transaction.
1835
1874
  * @param transactionId The id of the transaction
1836
1875
  * @returns A promise resolving at initialization completion.
1876
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1837
1877
  */
1838
1878
  initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
1839
1879
  /**
1840
1880
  * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
1841
- * @param workflowId The id of the workflow to be run.
1842
- * @param workflowState An existing workflow state if available.
1881
+ * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
1882
+ * @param workflowState An existing workflow state if available. Deprecated: Provide options instead.
1843
1883
  * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
1884
+ * @param options Options to configure loading the transaction and workflow.
1844
1885
  * @returns A workflow experience configured as requested.
1845
1886
  */
1846
- getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any): Promise<WorkflowExperience>;
1887
+ getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
1847
1888
  /**
1848
1889
  * @returns The preview service that was provided during construction.
1849
1890
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "8.0.3",
3
+ "version": "9.0.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",
@@ -86,7 +86,7 @@
86
86
  },
87
87
  "dependencies": {
88
88
  "@apollo/client": "^3.7.0",
89
- "@spiffcommerce/papyrus": "1.5.75",
89
+ "@spiffcommerce/papyrus": "1.5.77",
90
90
  "canvg": "https://github.com/spiffdev/canvg.git#03bcd151b12441e88ecb552bb658356f5bbe92c4",
91
91
  "cross-fetch": "^3.1.5",
92
92
  "graphql": "^16.6.0",