@spiffcommerce/core 0.10.183 → 0.10.185
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/main.js +13 -13
- package/dist/module.js +11 -11
- package/dist/types.d.ts +41 -11
- package/package.json +9 -3
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, IServerModel, MaterialResource, AssetType as _AssetType1, 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, 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,
|
|
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, IServerModel, MaterialResource, AssetType as _AssetType1, 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, 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";
|
|
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[];
|
|
@@ -24,6 +24,23 @@ declare class GraphQlManager {
|
|
|
24
24
|
getShadowGraphqlClient(): ApolloClient<any>;
|
|
25
25
|
}
|
|
26
26
|
export const graphQlManager: GraphQlManager;
|
|
27
|
+
/**
|
|
28
|
+
* A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
|
|
29
|
+
*/
|
|
30
|
+
export interface RenderableScene {
|
|
31
|
+
/**
|
|
32
|
+
* The id of the scene.
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* The title of the scene.
|
|
37
|
+
*/
|
|
38
|
+
title: string;
|
|
39
|
+
/**
|
|
40
|
+
* The id of each step inside the scene that can be rendered. This is based on the workflow state.
|
|
41
|
+
*/
|
|
42
|
+
renderableSteps: string[];
|
|
43
|
+
}
|
|
27
44
|
/**
|
|
28
45
|
* Information parsed froma workflow structure that is relevant
|
|
29
46
|
* to a given scene.
|
|
@@ -1136,6 +1153,13 @@ export const useEditorInteraction: (editorRef: RefObject<SVGRectElement>, intera
|
|
|
1136
1153
|
handleSequenceStart: () => void;
|
|
1137
1154
|
};
|
|
1138
1155
|
export const useShortcutCombination: (shortcutKeys: string[], onCombinationPressed: () => void, onCombinationReleased?: () => void) => void;
|
|
1156
|
+
export interface DesignInputStep {
|
|
1157
|
+
data: DesignInputStepData;
|
|
1158
|
+
name: string;
|
|
1159
|
+
}
|
|
1160
|
+
interface DesignInputStepData {
|
|
1161
|
+
}
|
|
1162
|
+
export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], server: ServerService, productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
|
|
1139
1163
|
export const EditorCore: FunctionComponent<{
|
|
1140
1164
|
isMobile: boolean;
|
|
1141
1165
|
color?: string;
|
|
@@ -1170,6 +1194,8 @@ export const EditorCore: FunctionComponent<{
|
|
|
1170
1194
|
onSequenceStart: () => void;
|
|
1171
1195
|
setElementEvent: (e: ElementEvent | undefined) => void;
|
|
1172
1196
|
onElementSelected: (elementId: string | undefined, event: PointerEvent) => void;
|
|
1197
|
+
variationRecord: null | VariationRecord;
|
|
1198
|
+
workflow: _Workflow1;
|
|
1173
1199
|
}>;
|
|
1174
1200
|
/**
|
|
1175
1201
|
* The advanced editor encapsulates the logic required to allow users to manipulate a design
|
|
@@ -1188,6 +1214,8 @@ export const AdvancedEditor: FunctionComponent<{
|
|
|
1188
1214
|
onContextMenuHandlePointerDown?: (event: PointerEvent) => void;
|
|
1189
1215
|
onElementSelected?: (id: string | undefined, element: PointerEvent) => void;
|
|
1190
1216
|
onDragEnd?: () => void;
|
|
1217
|
+
variationRecord: null | VariationRecord;
|
|
1218
|
+
workflow: _Workflow1;
|
|
1191
1219
|
}>;
|
|
1192
1220
|
/**
|
|
1193
1221
|
* A StepHandle allows for managing the state of a specific step in a workflow. This class
|
|
@@ -1245,7 +1273,7 @@ export class BulkStepHandle extends StepHandle<_BulkStepData1> {
|
|
|
1245
1273
|
/**
|
|
1246
1274
|
* @param variant The variant to select. This is not supported in the bulk step.
|
|
1247
1275
|
*/
|
|
1248
|
-
selectVariant(
|
|
1276
|
+
selectVariant(): Promise<void>;
|
|
1249
1277
|
setDesignName(designName: string): Promise<void>;
|
|
1250
1278
|
addVariationRecord(): VariationRecord;
|
|
1251
1279
|
updateBulkIsConnected(bulkIsConnected: boolean): void;
|
|
@@ -1510,11 +1538,20 @@ export interface WorkflowExperience {
|
|
|
1510
1538
|
* @param scene The scene you want the steps for.
|
|
1511
1539
|
*/
|
|
1512
1540
|
getStepsByScene(scene: StepGroup): StepHandle<_AnyStepData1>[];
|
|
1541
|
+
/**
|
|
1542
|
+
* Attaches a listener to the scenes on a workflow experience. The scenes returned are a subset of the scenes configured in the
|
|
1543
|
+
* workflow and are based on the current state of the experience. This is useful for building a navigation menu.
|
|
1544
|
+
* @param cb The callback to be called when the scenes change. The new scenes are passed as an argument.
|
|
1545
|
+
*/
|
|
1546
|
+
attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
|
|
1547
|
+
/**
|
|
1548
|
+
* Detaches a listener from the scenes on a workflow experience.
|
|
1549
|
+
*/
|
|
1550
|
+
detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
|
|
1513
1551
|
/**
|
|
1514
1552
|
* Saves this experience to storage. This may be local or remote depending
|
|
1515
1553
|
* on configuration.
|
|
1516
1554
|
* @param title The title for the saved design.
|
|
1517
|
-
* @param thumbnail An optional thumbnail for the saved design. If none is provided this field will be saved blank.
|
|
1518
1555
|
*/
|
|
1519
1556
|
save(title: string): Promise<SavedDesign>;
|
|
1520
1557
|
/**
|
|
@@ -1535,13 +1572,6 @@ export interface WorkflowExperience {
|
|
|
1535
1572
|
*/
|
|
1536
1573
|
onDesignFinished(product: Product, onProgressUpdate: DesignCreationProgressUpdate, selections: WorkflowSelections, metadata?: WorkflowMetadata | undefined): Promise<DesignCreationMessage>;
|
|
1537
1574
|
}
|
|
1538
|
-
export interface DesignInputStep {
|
|
1539
|
-
data: DesignInputStepData;
|
|
1540
|
-
name: string;
|
|
1541
|
-
}
|
|
1542
|
-
interface DesignInputStepData {
|
|
1543
|
-
}
|
|
1544
|
-
export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], server: ServerService, productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
|
|
1545
1575
|
/**
|
|
1546
1576
|
* Options that can be used during instantiation of the SpiffCommerce Javascript Client.
|
|
1547
1577
|
* Please refer to the documentation for more information.
|
|
@@ -1695,7 +1725,7 @@ export class FrameStepHandle extends StepHandle<_FrameStepData1> {
|
|
|
1695
1725
|
}
|
|
1696
1726
|
export const TransformWrapper: React.FunctionComponent;
|
|
1697
1727
|
export { CommandContext };
|
|
1698
|
-
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,
|
|
1728
|
+
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 };
|
|
1699
1729
|
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 };
|
|
1700
1730
|
|
|
1701
1731
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.185",
|
|
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",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"build": "parcel build",
|
|
11
11
|
"dev": "ladle serve",
|
|
12
12
|
"test": "tsc --noEmit --isolatedModules --skipLibCheck && jest",
|
|
13
|
-
"prepare": "yarn run build"
|
|
13
|
+
"prepare": "yarn run build",
|
|
14
|
+
"lint": "npx eslint src"
|
|
14
15
|
},
|
|
15
16
|
"targets": {
|
|
16
17
|
"main": {
|
|
@@ -51,11 +52,16 @@
|
|
|
51
52
|
"@types/qrcode": "^1.3.5",
|
|
52
53
|
"@types/react": "^17.0.9",
|
|
53
54
|
"@types/react-dom": "^17.0.9",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^5.43.0",
|
|
56
|
+
"@typescript-eslint/parser": "^5.43.0",
|
|
54
57
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
|
55
58
|
"agent-base": "^6.0.2",
|
|
56
59
|
"assert": "^2.0.0",
|
|
57
60
|
"buffer": "^6.0.3",
|
|
58
61
|
"enzyme": "^3.11.0",
|
|
62
|
+
"eslint": "^8.28.0",
|
|
63
|
+
"eslint-plugin-react": "^7.31.11",
|
|
64
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
59
65
|
"events": "^3.3.0",
|
|
60
66
|
"https-browserify": "^1.0.0",
|
|
61
67
|
"husky": "^8.0.1",
|
|
@@ -79,7 +85,7 @@
|
|
|
79
85
|
},
|
|
80
86
|
"dependencies": {
|
|
81
87
|
"@apollo/client": "^3.7.0",
|
|
82
|
-
"@spiffcommerce/papyrus": "^1.5.
|
|
88
|
+
"@spiffcommerce/papyrus": "^1.5.59",
|
|
83
89
|
"canvg": "https://github.com/spiffdev/canvg.git#03bcd151b12441e88ecb552bb658356f5bbe92c4",
|
|
84
90
|
"cross-fetch": "^3.1.5",
|
|
85
91
|
"graphql": "^16.6.0",
|