@spiffcommerce/core 0.10.73 → 0.10.75
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 +9 -9
- package/dist/module.js +9 -9
- package/dist/types.d.ts +39 -37
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, AnyStepData as _AnyStepData1, FrameOffsets, PatternImageData, IServerModel, Asset as _Asset1, MaterialResource, AssetType as _AssetType1, VariantResource as _VariantResource1, ColorDefinition as _ColorDefinition1, IllustrationStepData as _IllustrationStepData1, Region, ILayout as _ILayout1, CreateElementCommand as _CreateElementCommand1, IllustrationElement as _IllustrationElement1, LayoutsState as _LayoutsState1, CanvasCommand as _CanvasCommand1, LayoutData as _LayoutData1, DigitalContentStepData as _DigitalContentStepData1, FrameStepData as _FrameStepData1, FrameElement as _FrameElement1, MaterialStepData as _MaterialStepData1, ModelStepData as _ModelStepData1, ModuleStepData as _ModuleStepData1,
|
|
1
|
+
import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, AnyStepData as _AnyStepData1, FrameOffsets, PatternImageData, IServerModel, Asset as _Asset1, MaterialResource, AssetType as _AssetType1, VariantResource as _VariantResource1, ColorDefinition as _ColorDefinition1, IllustrationStepData as _IllustrationStepData1, Region, ILayout as _ILayout1, CreateElementCommand as _CreateElementCommand1, IllustrationElement as _IllustrationElement1, LayoutsState as _LayoutsState1, CanvasCommand as _CanvasCommand1, LayoutData as _LayoutData1, DigitalContentStepData as _DigitalContentStepData1, FrameStepData as _FrameStepData1, FrameElement as _FrameElement1, 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, StepGroup, Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, 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, getSvgString, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, CreateLayoutCommand, rehydrateSerializedLayout, ColorProfileProps, WorkflowPanel, determineCorrectFontSizeAndLines, registerJSDOM } from "@spiffcommerce/papyrus";
|
|
2
2
|
import { ApolloClient } from "@apollo/client";
|
|
3
3
|
import { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent } from "react";
|
|
4
4
|
export const gatherVaryingStepAspects: (workflow: _Workflow1) => _StepAspect1[];
|
|
@@ -249,6 +249,10 @@ declare class IllustrationStepService implements StepService<_IllustrationStepDa
|
|
|
249
249
|
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
|
|
250
250
|
init(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
251
251
|
availableColors(stepData: _Step1<_IllustrationStepData1>): Promise<{
|
|
252
|
+
fill: string | undefined;
|
|
253
|
+
stroke: string | undefined;
|
|
254
|
+
variant: _VariantResource1;
|
|
255
|
+
}[] | {
|
|
252
256
|
fill: string;
|
|
253
257
|
stroke: string;
|
|
254
258
|
}[]>;
|
|
@@ -256,6 +260,11 @@ declare class IllustrationStepService implements StepService<_IllustrationStepDa
|
|
|
256
260
|
changeColors(stepData: _Step1<_IllustrationStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
|
|
257
261
|
selectVariant(stepData: _Step1<_IllustrationStepData1>, variant: _VariantResource1, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
|
|
258
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* FIXME: This should be shifted to papyrus at some point
|
|
265
|
+
* @param svg The SVG to get an object URL for.
|
|
266
|
+
* @returns An object URL storing the cached image of this svg file.
|
|
267
|
+
*/
|
|
259
268
|
export const svgObjectURL: (svg: string) => Promise<string>;
|
|
260
269
|
export const illustrationStepService: IllustrationStepService;
|
|
261
270
|
declare class DigitalContentStepService implements StepService<_DigitalContentStepData1> {
|
|
@@ -295,17 +304,6 @@ declare class ModuleStepService implements StepService<_ModuleStepData1> {
|
|
|
295
304
|
changeText(stepData: _Step1<_ModuleStepData1>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
|
|
296
305
|
}
|
|
297
306
|
export const moduleStepService: ModuleStepService;
|
|
298
|
-
declare class PatchworkStepService implements StepService<_PatchworkStepData1> {
|
|
299
|
-
init(stepData: _Step1<_PatchworkStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
300
|
-
recalculate(stepData: _Step1<_PatchworkStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, setIsCalculating: (status: boolean) => void): void;
|
|
301
|
-
selectVariant(stepData: _Step1<_PatchworkStepData1>, variant: _VariantResource1, elements: RegionElement[], workflowManager: WorkflowManager, setIsCalculating: (status: boolean) => void): Promise<void>;
|
|
302
|
-
/**
|
|
303
|
-
* Constructs a preview SVG for a patchwork. Based on the configuration
|
|
304
|
-
* of the given element.
|
|
305
|
-
*/
|
|
306
|
-
constructPreviewSvg(stepData: _Step1<_PatchworkStepData1>, elements: RegionElement[], getAllLayouts: () => _LayoutData1[], offsets?: _PatchworkOffsets1): null | string;
|
|
307
|
-
}
|
|
308
|
-
export const patchworkStepService: PatchworkStepService;
|
|
309
307
|
declare class PictureStepService implements StepService<_PictureStepData1> {
|
|
310
308
|
init(stepData: _Step1<_PictureStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
311
309
|
selectVariant(stepData: _Step1<_PictureStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
|
|
@@ -318,6 +316,10 @@ declare class QuestionStepService implements StepService<_QuestionStepData1> {
|
|
|
318
316
|
export const questionStepService: QuestionStepService;
|
|
319
317
|
declare class ShapeStepService implements StepService<_ShapeStepData1> {
|
|
320
318
|
availableColours(stepData: _Step1<_ShapeStepData1>): Promise<{
|
|
319
|
+
fill: string | undefined;
|
|
320
|
+
stroke: string | undefined;
|
|
321
|
+
variant: _VariantResource1;
|
|
322
|
+
}[] | {
|
|
321
323
|
fill: string;
|
|
322
324
|
stroke: string;
|
|
323
325
|
}[]>;
|
|
@@ -846,7 +848,7 @@ declare class OptionService {
|
|
|
846
848
|
* @param server The server service for making the request.
|
|
847
849
|
* @param id The option ID to be retrieved.
|
|
848
850
|
*/
|
|
849
|
-
getOption(server: ServerService, id: string): Promise<IServerModel<_OptionResource1
|
|
851
|
+
getOption(server: ServerService, id: string): Promise<IServerModel<_OptionResource1> | undefined>;
|
|
850
852
|
getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
|
|
851
853
|
getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
|
|
852
854
|
getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
|
|
@@ -864,7 +866,7 @@ declare class OptionService {
|
|
|
864
866
|
* @param step The step to find an option on.
|
|
865
867
|
* @returns An OptionResource in a promise.
|
|
866
868
|
*/
|
|
867
|
-
getOptionFromStep: (step: _Step1<_AnyStepData1>) => Promise<IServerModel<_OptionResource1
|
|
869
|
+
getOptionFromStep: (step: _Step1<_AnyStepData1>) => Promise<IServerModel<_OptionResource1> | undefined>;
|
|
868
870
|
}
|
|
869
871
|
export const optionService: OptionService;
|
|
870
872
|
export const CommandContextContext: import("react").Context<_CommandContext1>;
|
|
@@ -974,14 +976,14 @@ export interface AdvancedEditorState extends UIState {
|
|
|
974
976
|
}
|
|
975
977
|
export const getDefaultState: (getLayouts: LayoutsGetter, defaultZoom: number) => {
|
|
976
978
|
layoutId: string;
|
|
977
|
-
selectedElement:
|
|
979
|
+
selectedElement: undefined;
|
|
978
980
|
zoom: number;
|
|
979
981
|
maxZoom: number;
|
|
980
982
|
units: _UnitOfMeasurement1;
|
|
981
983
|
subMenu: EditorSubMenu;
|
|
982
|
-
activeModifierKeys:
|
|
984
|
+
activeModifierKeys: never[];
|
|
983
985
|
metaPressed: boolean;
|
|
984
|
-
elementEvent:
|
|
986
|
+
elementEvent: undefined;
|
|
985
987
|
scrolledMovement: boolean;
|
|
986
988
|
};
|
|
987
989
|
export const commandReducer: (state: AdvancedEditorState, command: UICommand) => AdvancedEditorState;
|
|
@@ -997,14 +999,14 @@ export class UICommand {
|
|
|
997
999
|
constructor(changes: Partial<AdvancedEditorState>);
|
|
998
1000
|
apply(state: AdvancedEditorState): {
|
|
999
1001
|
layoutId: string;
|
|
1000
|
-
selectedElement?: string;
|
|
1002
|
+
selectedElement?: string | undefined;
|
|
1001
1003
|
zoom: number;
|
|
1002
1004
|
maxZoom: number;
|
|
1003
1005
|
units: _UnitOfMeasurement1;
|
|
1004
1006
|
subMenu: EditorSubMenu;
|
|
1005
1007
|
activeModifierKeys: KeyEvent[];
|
|
1006
1008
|
metaPressed: boolean;
|
|
1007
|
-
elementEvent?: ElementEvent;
|
|
1009
|
+
elementEvent?: ElementEvent | undefined;
|
|
1008
1010
|
scrolledMovement: boolean;
|
|
1009
1011
|
};
|
|
1010
1012
|
}
|
|
@@ -1137,7 +1139,7 @@ export class IllustrationStepHandle extends StepHandle<_IllustrationStepData1> {
|
|
|
1137
1139
|
*/
|
|
1138
1140
|
getColors(): {
|
|
1139
1141
|
[key: string]: import("@spiffcommerce/papyrus").ColorDefinition;
|
|
1140
|
-
};
|
|
1142
|
+
} | undefined;
|
|
1141
1143
|
}
|
|
1142
1144
|
export class PictureStepHandle extends StepHandle<_PictureStepData1> {
|
|
1143
1145
|
constructor(manager: WorkflowManager, step: _Step1<_PictureStepData1>);
|
|
@@ -1188,16 +1190,16 @@ export class TextStepHandle extends StepHandle<_TextStepData1> {
|
|
|
1188
1190
|
* Gets the text currently applied to the elements of this step.
|
|
1189
1191
|
*/
|
|
1190
1192
|
getText(): string;
|
|
1191
|
-
isReplaceable(): boolean;
|
|
1193
|
+
isReplaceable(): boolean | undefined;
|
|
1192
1194
|
/**
|
|
1193
1195
|
* Inform the step that now is the time to
|
|
1194
1196
|
* clear default text if it should do so.
|
|
1195
1197
|
* Returns a text change rwsult if a clear occurred.
|
|
1196
1198
|
*/
|
|
1197
1199
|
clearDefaultTextIfNecessary(): TextChangeResult | undefined;
|
|
1198
|
-
hasVaryingText(): boolean;
|
|
1199
|
-
hasVaryingColor(): boolean;
|
|
1200
|
-
hasVaryingSelection(): boolean;
|
|
1200
|
+
hasVaryingText(): boolean | undefined;
|
|
1201
|
+
hasVaryingColor(): boolean | undefined;
|
|
1202
|
+
hasVaryingSelection(): boolean | undefined;
|
|
1201
1203
|
getRegions(): import("@spiffcommerce/papyrus").Region[];
|
|
1202
1204
|
}
|
|
1203
1205
|
export const createDesign: (workflowManager: WorkflowManager, workflow: _Workflow1, layouts: _ILayout1[], getReducerState: () => _CommandState1, product: Product, transaction: Transaction, workflowSelections: WorkflowSelections, designName: string, onProgressUpdate: DesignCreationProgressUpdate, updateVariationRecords: (variationRecords: VariationRecord[]) => Promise<void>, variationRecords: VariationRecord[], createPreviewImage: (shouldRender3D?: boolean) => Promise<string>, workflowMetadata?: WorkflowMetadata) => Promise<DesignCreationMessage>;
|
|
@@ -1331,10 +1333,10 @@ export class MockWorkflowManager implements WorkflowManager {
|
|
|
1331
1333
|
addVariationRecord(_variationRecord: Omit<VariationRecord, "recordNumber">): {
|
|
1332
1334
|
recordNumber: number;
|
|
1333
1335
|
transactionId: string;
|
|
1334
|
-
values:
|
|
1336
|
+
values: never[];
|
|
1335
1337
|
};
|
|
1336
|
-
getCurrentVariationRecord():
|
|
1337
|
-
removeVariationRecord(_recordNumber: number):
|
|
1338
|
+
getCurrentVariationRecord(): undefined;
|
|
1339
|
+
removeVariationRecord(_recordNumber: number): never[];
|
|
1338
1340
|
outstandingRequestsPromise(): Promise<void>;
|
|
1339
1341
|
updateStateWithServerImmediate(_getReducerState: () => _CommandState1): Promise<void>;
|
|
1340
1342
|
addPoller(_poller: Poller): void;
|
|
@@ -1352,27 +1354,27 @@ export class MockWorkflowManager implements WorkflowManager {
|
|
|
1352
1354
|
addStorageCallback(_callback: StorageCallback): void;
|
|
1353
1355
|
addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
|
|
1354
1356
|
getCommandDispatcher(): (_command: _CanvasCommand1) => void;
|
|
1355
|
-
getLayouts():
|
|
1357
|
+
getLayouts(): never[];
|
|
1356
1358
|
getLayoutPreviewService(): {
|
|
1357
1359
|
getAll: () => Map<any, any>;
|
|
1358
1360
|
};
|
|
1359
|
-
getPreviewService():
|
|
1360
|
-
getProfanities():
|
|
1361
|
-
getRegionElements(_stepName: string):
|
|
1362
|
-
getSerializedStep(_stepName: string, _serializedSteps: SerializableStep[]):
|
|
1363
|
-
getStepSpecificServices(_stepName: string):
|
|
1361
|
+
getPreviewService(): undefined;
|
|
1362
|
+
getProfanities(): never[];
|
|
1363
|
+
getRegionElements(_stepName: string): never[];
|
|
1364
|
+
getSerializedStep(_stepName: string, _serializedSteps: SerializableStep[]): undefined;
|
|
1365
|
+
getStepSpecificServices(_stepName: string): undefined;
|
|
1364
1366
|
getTransaction(): {
|
|
1365
1367
|
id: string;
|
|
1366
1368
|
};
|
|
1367
1369
|
getWorkflow(): {
|
|
1368
1370
|
id: string;
|
|
1369
1371
|
name: string;
|
|
1370
|
-
panels:
|
|
1371
|
-
steps:
|
|
1372
|
+
panels: never[];
|
|
1373
|
+
steps: never[];
|
|
1372
1374
|
showModelOnFinishStep: boolean;
|
|
1373
1375
|
allowProofDownload: boolean;
|
|
1374
1376
|
introduction: string;
|
|
1375
|
-
stepGroups:
|
|
1377
|
+
stepGroups: never[];
|
|
1376
1378
|
};
|
|
1377
1379
|
markStepsAsInitialised(_stepNames: string[]): void;
|
|
1378
1380
|
getUpdatesPending: () => boolean;
|
|
@@ -1392,6 +1394,6 @@ export class MockWorkflowManager implements WorkflowManager {
|
|
|
1392
1394
|
}
|
|
1393
1395
|
export { CommandContext };
|
|
1394
1396
|
export { AssetType, BringForwardCommand, CanvasCommand, CreateElementCommand, CreateLayoutCommand, DeleteElementCommand, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, GroupCommand, LayoutElementFactory, LayoutElementType, MoveCommand, ResizeCommand, RotateCommand, SendBackwardsCommand, StepAspectType, StepType, TextChangeCommand, UnitOfMeasurement, dataUrlFromExternalUrl, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, rehydrateSerializedLayout, getFrameData, getSvgString, loadFontFromDataUrl, loadFontFromExternalUrl, determineCorrectFontSizeAndLines, patternImageDataCache, registerJSDOM };
|
|
1395
|
-
export { Animatable, AnyStepData, Asset, BulkStepData, ColorProfileProps, ColorDefinition, CommandState, WorkflowPanel, DigitalContentStepData, FrameElement, FrameStepData, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, OptionResource,
|
|
1397
|
+
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 };
|
|
1396
1398
|
|
|
1397
1399
|
//# 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.75",
|
|
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",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@apollo/client": "^3.7.0",
|
|
83
|
-
"@spiffcommerce/papyrus": "^1.5.
|
|
83
|
+
"@spiffcommerce/papyrus": "^1.5.30",
|
|
84
84
|
"canvg": "https://github.com/spiffdev/canvg.git#03bcd151b12441e88ecb552bb658356f5bbe92c4",
|
|
85
85
|
"cross-fetch": "^3.1.5",
|
|
86
86
|
"graphql": "^16.6.0",
|