@spiffcommerce/core 12.5.0 → 12.6.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, 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";
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, AspectType, GlobalPropertyConfigurationAspect, Theme as _Theme1, 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[];
@@ -1045,6 +1045,14 @@ type ProductCollection = {
1045
1045
  name: string;
1046
1046
  products: Product[];
1047
1047
  };
1048
+ type GlobalPropertyState = {
1049
+ id: string;
1050
+ aspects: GlobalPropertyStateAspect[];
1051
+ };
1052
+ type GlobalPropertyStateAspect = {
1053
+ name: string;
1054
+ value: string;
1055
+ };
1048
1056
  interface StorageService {
1049
1057
  /**
1050
1058
  * Get a value.
@@ -1476,6 +1484,10 @@ export abstract class StepHandle<T extends _AnyStepData1> {
1476
1484
  * @returns The type of the step handle.
1477
1485
  */
1478
1486
  getType(): _StepType1;
1487
+ /**
1488
+ * @returns The underlying data for this step. Favor using the step handle methods instead of this.
1489
+ */
1490
+ getRaw(): _Step1<T>;
1479
1491
  /**
1480
1492
  * Fires any configured animations on the 3D preview for this step.
1481
1493
  * This includes camera & model animations. If the preview is unavailable
@@ -1862,6 +1874,56 @@ export interface WorkflowExperience {
1862
1874
  [key: string]: string;
1863
1875
  }>;
1864
1876
  }
1877
+ export enum FrameStep {
1878
+ SelectFrame = "SelectFrame",
1879
+ SelectImage = "SelectImage",
1880
+ Position = "Position"
1881
+ }
1882
+ export class FrameStepHandle extends StepHandle<_FrameStepData1> {
1883
+ constructor(manager: WorkflowManager, step: _Step1<_FrameStepData1>);
1884
+ selectVariant(variant: Variant): Promise<void>;
1885
+ onFrameDataChanged(callback: (frameData: _FrameData1) => void): void;
1886
+ selectImage(asset: _Asset1): void;
1887
+ getImageData(): PatternImageData | undefined;
1888
+ getCurrentFrameStep(frameData: _FrameData1, uploading?: any, imageUploadComplete?: any, variants?: _VariantResource1[]): FrameStep;
1889
+ getFrameService(): FrameService | undefined;
1890
+ hasOverlayImageKey(): string | undefined;
1891
+ hasOverlayImageUrl(): any;
1892
+ hasVaryingUpload(): boolean | undefined;
1893
+ hasVaryingSelection(): boolean | undefined;
1894
+ }
1895
+ /**
1896
+ * TODO: Add GlobalPropertyState mutation & queries to bundle.
1897
+ * TODO: Optimize workflow experience state updates.
1898
+ */
1899
+ /**
1900
+ * A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
1901
+ * bundles can return a handle for any global properties associated to the collection.
1902
+ */
1903
+ declare abstract class GlobalPropertyHandle {
1904
+ protected readonly bundle: _Bundle1;
1905
+ protected readonly property: GlobalPropertyConfigurationAspect;
1906
+ constructor(bundle: _Bundle1, property: GlobalPropertyConfigurationAspect);
1907
+ /**
1908
+ * @returns The human friendly name of the property.
1909
+ */
1910
+ getName(): string;
1911
+ /**
1912
+ * @returns A human friendly description.
1913
+ */
1914
+ getDescription(): string;
1915
+ /**
1916
+ * @returns The type of the global property. Use this to determine how to render the property.
1917
+ */
1918
+ getType(): AspectType;
1919
+ /**
1920
+ * Returns all steps that share this property.
1921
+ */
1922
+ protected getSharedSteps(): import("stepHandles").StepHandle<import("@spiffcommerce/papyrus").AnyStepData>[];
1923
+ }
1924
+ interface GlobalPropertyStateManager {
1925
+ getGlobalPropertyState(): GlobalPropertyState | undefined;
1926
+ }
1865
1927
  /**
1866
1928
  * A bundle serves as a container for a set of workflow experience.
1867
1929
  */
@@ -1895,14 +1957,18 @@ interface _Bundle1 {
1895
1957
  */
1896
1958
  setMetadata(metadata: Map<string, string>): Promise<void>;
1897
1959
  /**
1898
- * Returns true when the bundle contains transactions with shared properties.
1960
+ * Returns true when the bundle contains products that share global properties.
1899
1961
  */
1900
- hasGlobalProperties(): boolean;
1962
+ hasGlobalProperties(): Promise<boolean>;
1901
1963
  /**
1902
1964
  * Get a handle to the global properties available within this bundle. Setting values
1903
1965
  * via this method will make selections on all bundles that share the property.
1904
1966
  */
1905
- getGlobalProperties(): any;
1967
+ getGlobalProperties(): Promise<GlobalPropertyHandle[]>;
1968
+ /**
1969
+ * Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
1970
+ */
1971
+ getGlobalPropertyStateManager(): GlobalPropertyStateManager;
1906
1972
  /**
1907
1973
  * Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
1908
1974
  */
@@ -1922,6 +1988,10 @@ interface _Bundle1 {
1922
1988
  * @param experience The workflow experience to remove from this bundle.
1923
1989
  */
1924
1990
  removeWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1991
+ /**
1992
+ * Returns all workflow experiences currently added to this bundle.
1993
+ */
1994
+ getWorkflowExperiences(): WorkflowExperience[];
1925
1995
  /**
1926
1996
  * Sort the list of workflow experiences.
1927
1997
  */
@@ -2177,24 +2247,6 @@ export class MockWorkflowManager implements WorkflowManager {
2177
2247
  updateMetadata(_stepName: string, _update: any): void;
2178
2248
  updateStorage(_stepName: string, _update: _StepStorage1): Promise<void>;
2179
2249
  }
2180
- export enum FrameStep {
2181
- SelectFrame = "SelectFrame",
2182
- SelectImage = "SelectImage",
2183
- Position = "Position"
2184
- }
2185
- export class FrameStepHandle extends StepHandle<_FrameStepData1> {
2186
- constructor(manager: WorkflowManager, step: _Step1<_FrameStepData1>);
2187
- selectVariant(variant: Variant): Promise<void>;
2188
- onFrameDataChanged(callback: (frameData: _FrameData1) => void): void;
2189
- selectImage(asset: _Asset1): void;
2190
- getImageData(): PatternImageData | undefined;
2191
- getCurrentFrameStep(frameData: _FrameData1, uploading?: any, imageUploadComplete?: any, variants?: _VariantResource1[]): FrameStep;
2192
- getFrameService(): FrameService | undefined;
2193
- hasOverlayImageKey(): string | undefined;
2194
- hasOverlayImageUrl(): any;
2195
- hasVaryingUpload(): boolean | undefined;
2196
- hasVaryingSelection(): boolean | undefined;
2197
- }
2198
2250
  export const TransformWrapper: React.FunctionComponent;
2199
2251
  export { CommandContext };
2200
2252
  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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "12.5.0",
3
+ "version": "12.6.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.5",
90
+ "@spiffcommerce/papyrus": "^2.0.9",
91
91
  "cross-fetch": "^3.1.5",
92
92
  "graphql": "^16.6.0",
93
93
  "lodash.clonedeep": "^4.5.0",