@spiffcommerce/core 0.10.115 → 0.10.117
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 +33 -44
- package/package.json +7 -9
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,
|
|
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, StepGroup, FrameData as _FrameData1, 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[];
|
|
@@ -238,6 +238,11 @@ declare class Poller {
|
|
|
238
238
|
*/
|
|
239
239
|
constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
|
|
240
240
|
}
|
|
241
|
+
declare class DigitalContentStepService implements StepService<_DigitalContentStepData1> {
|
|
242
|
+
init(stepData: _Step1<_DigitalContentStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
243
|
+
regenerateQRCode(elements: RegionElement[], uploading: boolean, assetKey: string, url: string, workflowManager: WorkflowManager, stepData: _Step1<_DigitalContentStepData1>, setUrl: (finalUrl: string) => void, commandDispatcher: (command: _CanvasCommand1) => void, setIsRegenerating: (state: boolean) => void): Promise<void>;
|
|
244
|
+
}
|
|
245
|
+
export const digitalContentStepService: DigitalContentStepService;
|
|
241
246
|
interface StorageService {
|
|
242
247
|
/**
|
|
243
248
|
* Get a value.
|
|
@@ -324,6 +329,23 @@ interface PersistedAsset {
|
|
|
324
329
|
src: string;
|
|
325
330
|
}
|
|
326
331
|
export const assetService: AssetService;
|
|
332
|
+
interface FrameCreateOpts {
|
|
333
|
+
stepName?: string;
|
|
334
|
+
frameData: FrameData;
|
|
335
|
+
disablePlaceholder?: boolean;
|
|
336
|
+
focalBlur?: boolean;
|
|
337
|
+
focalBlurStrength?: number;
|
|
338
|
+
focalBlurRadius?: number;
|
|
339
|
+
pattern?: any;
|
|
340
|
+
}
|
|
341
|
+
declare class FrameStepService implements StepService<_FrameStepData1> {
|
|
342
|
+
init(stepData: _Step1<_FrameStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
343
|
+
selectImage(stepData: _Step1<_FrameStepData1>, asset: IServerModel<_Asset1>, workflowManager: WorkflowManager): void;
|
|
344
|
+
selectVariant(stepData: _Step1<_FrameStepData1>, variant: _VariantResource1 | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
|
|
345
|
+
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: FrameCreateOpts): _CreateElementCommand1<_FrameElement1>;
|
|
346
|
+
loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
|
|
347
|
+
}
|
|
348
|
+
export const frameStepService: FrameStepService;
|
|
327
349
|
interface SVGCreateOpts {
|
|
328
350
|
stepName?: string;
|
|
329
351
|
src: string;
|
|
@@ -339,47 +361,16 @@ declare class IllustrationStepService implements StepService<_IllustrationStepDa
|
|
|
339
361
|
getIllustrationBody(src: string): Promise<string>;
|
|
340
362
|
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
|
|
341
363
|
init(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
342
|
-
availableColors(stepData: _Step1<_IllustrationStepData1
|
|
364
|
+
availableColors(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager): Promise<{
|
|
343
365
|
fill: string | undefined;
|
|
344
366
|
stroke: string | undefined;
|
|
345
367
|
variant: _VariantResource1;
|
|
346
|
-
}[] | {
|
|
347
|
-
fill: string;
|
|
348
|
-
stroke: string;
|
|
349
368
|
}[]>;
|
|
350
369
|
changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<_CanvasCommand1>;
|
|
351
370
|
changeColors(stepData: _Step1<_IllustrationStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
|
|
352
371
|
selectVariant(stepData: _Step1<_IllustrationStepData1>, variant: _VariantResource1, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
|
|
353
372
|
}
|
|
354
|
-
/**
|
|
355
|
-
* FIXME: This should be shifted to papyrus at some point
|
|
356
|
-
* @param svg The SVG to get an object URL for.
|
|
357
|
-
* @returns An object URL storing the cached image of this svg file.
|
|
358
|
-
*/
|
|
359
|
-
export const svgObjectURL: (svg: string) => Promise<string>;
|
|
360
373
|
export const illustrationStepService: IllustrationStepService;
|
|
361
|
-
declare class DigitalContentStepService implements StepService<_DigitalContentStepData1> {
|
|
362
|
-
init(stepData: _Step1<_DigitalContentStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
363
|
-
regenerateQRCode(elements: RegionElement[], uploading: boolean, assetKey: string, url: string, workflowManager: WorkflowManager, stepData: _Step1<_DigitalContentStepData1>, setUrl: (finalUrl: string) => void, commandDispatcher: (command: _CanvasCommand1) => void, setIsRegenerating: (state: boolean) => void): Promise<void>;
|
|
364
|
-
}
|
|
365
|
-
export const digitalContentStepService: DigitalContentStepService;
|
|
366
|
-
interface FrameCreateOpts {
|
|
367
|
-
stepName?: string;
|
|
368
|
-
frameData: FrameData;
|
|
369
|
-
disablePlaceholder?: boolean;
|
|
370
|
-
focalBlur?: boolean;
|
|
371
|
-
focalBlurStrength?: number;
|
|
372
|
-
focalBlurRadius?: number;
|
|
373
|
-
pattern?: any;
|
|
374
|
-
}
|
|
375
|
-
declare class FrameStepService implements StepService<_FrameStepData1> {
|
|
376
|
-
init(stepData: _Step1<_FrameStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
377
|
-
selectImage(stepData: _Step1<_FrameStepData1>, asset: IServerModel<_Asset1>, workflowManager: WorkflowManager): void;
|
|
378
|
-
selectVariant(stepData: _Step1<_FrameStepData1>, variant: _VariantResource1 | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
|
|
379
|
-
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: FrameCreateOpts): _CreateElementCommand1<_FrameElement1>;
|
|
380
|
-
loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
|
|
381
|
-
}
|
|
382
|
-
export const frameStepService: FrameStepService;
|
|
383
374
|
declare class MaterialStepService implements StepService<_MaterialStepData1> {
|
|
384
375
|
init(stepData: _Step1<_MaterialStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | CommandWithFollowup>;
|
|
385
376
|
selectVariant(step: _Step1<_MaterialStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
|
|
@@ -406,7 +397,7 @@ declare class QuestionStepService implements StepService<_QuestionStepData1> {
|
|
|
406
397
|
}
|
|
407
398
|
export const questionStepService: QuestionStepService;
|
|
408
399
|
declare class ShapeStepService implements StepService<_ShapeStepData1> {
|
|
409
|
-
availableColours(stepData: _Step1<_ShapeStepData1
|
|
400
|
+
availableColours(stepData: _Step1<_ShapeStepData1>, workflowManager: WorkflowManager): Promise<{
|
|
410
401
|
fill: string | undefined;
|
|
411
402
|
stroke: string | undefined;
|
|
412
403
|
variant: _VariantResource1;
|
|
@@ -445,7 +436,7 @@ declare class TextStepService implements StepService<_TextStepData1> {
|
|
|
445
436
|
* @param stepData The text step to get colors for.
|
|
446
437
|
* @returns A list of color objects containg fill, stroke and variant if available.
|
|
447
438
|
*/
|
|
448
|
-
availableColors(stepData: _Step1<_TextStepData1
|
|
439
|
+
availableColors(stepData: _Step1<_TextStepData1>, workflowManager: WorkflowManager): Promise<ColorOption[]>;
|
|
449
440
|
changeFill(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
450
441
|
/**
|
|
451
442
|
* Given an element and a string, filters any characters from the string that are
|
|
@@ -568,6 +559,7 @@ export interface WorkflowManager {
|
|
|
568
559
|
getMetadata: (stepName: string) => StepMetadata | undefined;
|
|
569
560
|
getWorkflowMetadata: () => WorkflowMetadata;
|
|
570
561
|
getInformationResults(): InformationResult[];
|
|
562
|
+
getServer(): ServerService;
|
|
571
563
|
getTransaction: () => Transaction;
|
|
572
564
|
getWorkflow: () => _Workflow1;
|
|
573
565
|
getWorkflowSelections: () => WorkflowSelections;
|
|
@@ -903,7 +895,7 @@ interface ServerResponse {
|
|
|
903
895
|
/**
|
|
904
896
|
* The body of the response containing any return data.
|
|
905
897
|
*/
|
|
906
|
-
body:
|
|
898
|
+
body: any;
|
|
907
899
|
headers: {
|
|
908
900
|
"content-type": string;
|
|
909
901
|
};
|
|
@@ -946,7 +938,7 @@ declare class OptionService {
|
|
|
946
938
|
* @param server The server service for making the request.
|
|
947
939
|
* @param id The option ID to be retrieved.
|
|
948
940
|
*/
|
|
949
|
-
getOption(server: ServerService, id: string): Promise<IServerModel<_OptionResource1
|
|
941
|
+
getOption(server: ServerService, id: string): Promise<undefined | IServerModel<_OptionResource1>>;
|
|
950
942
|
getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
|
|
951
943
|
getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
|
|
952
944
|
getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
|
|
@@ -964,7 +956,7 @@ declare class OptionService {
|
|
|
964
956
|
* @param step The step to find an option on.
|
|
965
957
|
* @returns An OptionResource in a promise.
|
|
966
958
|
*/
|
|
967
|
-
getOptionFromStep: (step: _Step1<_AnyStepData1
|
|
959
|
+
getOptionFromStep: (step: _Step1<_AnyStepData1>, server: ServerService) => Promise<IServerModel<_OptionResource1> | undefined>;
|
|
968
960
|
}
|
|
969
961
|
export const optionService: OptionService;
|
|
970
962
|
export const CommandContextContext: import("react").Context<_CommandContext1>;
|
|
@@ -1287,9 +1279,6 @@ export class IllustrationStepHandle extends StepHandle<_IllustrationStepData1> {
|
|
|
1287
1279
|
fill: string | undefined;
|
|
1288
1280
|
stroke: string | undefined;
|
|
1289
1281
|
variant: _VariantResource1;
|
|
1290
|
-
}[] | {
|
|
1291
|
-
fill: string;
|
|
1292
|
-
stroke: string;
|
|
1293
1282
|
}[]>;
|
|
1294
1283
|
hasVaryingSelection(): boolean | undefined;
|
|
1295
1284
|
hasVaryingColors(): boolean | undefined;
|
|
@@ -1437,7 +1426,7 @@ export interface DesignInputStep {
|
|
|
1437
1426
|
}
|
|
1438
1427
|
interface DesignInputStepData {
|
|
1439
1428
|
}
|
|
1440
|
-
export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
|
|
1429
|
+
export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], server: ServerService, productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
|
|
1441
1430
|
/**
|
|
1442
1431
|
* Options that can be used during instantiation of the SpiffCommerce Javascript Client.
|
|
1443
1432
|
* Please refer to the documentation for more information.
|
|
@@ -1470,7 +1459,6 @@ export class SpiffCommerceClient {
|
|
|
1470
1459
|
getSavedDesigns(): Promise<import("services/design").SavedDesign[]>;
|
|
1471
1460
|
/**
|
|
1472
1461
|
* Removes a design from storage. This will be a noop if the design isn't already saved.
|
|
1473
|
-
* @param experience The workflow experience to remove from storage.
|
|
1474
1462
|
*/
|
|
1475
1463
|
deleteDesign(transactionId: string): Promise<void>;
|
|
1476
1464
|
/**
|
|
@@ -1491,7 +1479,7 @@ export class SpiffCommerceClient {
|
|
|
1491
1479
|
* @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
|
|
1492
1480
|
* @returns A workflow experience configured as requested.
|
|
1493
1481
|
*/
|
|
1494
|
-
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any): Promise<WorkflowExperience>;
|
|
1482
|
+
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, server?: ServerService): Promise<WorkflowExperience>;
|
|
1495
1483
|
/**
|
|
1496
1484
|
* @returns The preview service that was provided during construction.
|
|
1497
1485
|
*/
|
|
@@ -1506,6 +1494,7 @@ export class SpiffCommerceClient {
|
|
|
1506
1494
|
getTransaction(): Transaction;
|
|
1507
1495
|
}
|
|
1508
1496
|
export class MockWorkflowManager implements WorkflowManager {
|
|
1497
|
+
getServer(): ServerService;
|
|
1509
1498
|
getInitializationPromise(): Promise<void>;
|
|
1510
1499
|
getProduct: () => Product;
|
|
1511
1500
|
isInitialized(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.117",
|
|
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",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "parcel build",
|
|
11
11
|
"dev": "ladle serve",
|
|
12
|
-
"test": "
|
|
12
|
+
"test": "tsc --noEmit --isolatedModules --skipLibCheck && jest",
|
|
13
13
|
"prepare": "yarn run build"
|
|
14
14
|
},
|
|
15
15
|
"targets": {
|
|
@@ -39,16 +39,15 @@
|
|
|
39
39
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
40
40
|
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
|
|
41
41
|
"@ladle/react": "^2.4.5",
|
|
42
|
-
"@parcel/packager-ts": "2.
|
|
43
|
-
"@parcel/transformer-typescript-tsc": "^2.
|
|
44
|
-
"@parcel/transformer-typescript-types": "
|
|
45
|
-
"@parcel/validator-typescript": "^2.
|
|
42
|
+
"@parcel/packager-ts": "2.8.0",
|
|
43
|
+
"@parcel/transformer-typescript-tsc": "^2.8.0",
|
|
44
|
+
"@parcel/transformer-typescript-types": "2.8.0",
|
|
45
|
+
"@parcel/validator-typescript": "^2.8.0",
|
|
46
46
|
"@types/enzyme": "^3.10.12",
|
|
47
47
|
"@types/jest": "^29.0.3",
|
|
48
48
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
49
49
|
"@types/lodash.debounce": "^4.0.7",
|
|
50
50
|
"@types/lodash.isequal": "^4.5.6",
|
|
51
|
-
"@types/opentype.js": "^0.7.2",
|
|
52
51
|
"@types/qrcode": "^1.3.5",
|
|
53
52
|
"@types/react": "^17.0.9",
|
|
54
53
|
"@types/react-dom": "^17.0.9",
|
|
@@ -80,14 +79,13 @@
|
|
|
80
79
|
},
|
|
81
80
|
"dependencies": {
|
|
82
81
|
"@apollo/client": "^3.7.0",
|
|
83
|
-
"@spiffcommerce/papyrus": "
|
|
82
|
+
"@spiffcommerce/papyrus": "1.5.38",
|
|
84
83
|
"canvg": "https://github.com/spiffdev/canvg.git#03bcd151b12441e88ecb552bb658356f5bbe92c4",
|
|
85
84
|
"cross-fetch": "^3.1.5",
|
|
86
85
|
"graphql": "^16.6.0",
|
|
87
86
|
"lodash.clonedeep": "^4.5.0",
|
|
88
87
|
"lodash.debounce": "^4.0.8",
|
|
89
88
|
"lodash.isequal": "^4.5.0",
|
|
90
|
-
"opentype.js": "^1.3.4",
|
|
91
89
|
"qrcode": "^1.5.1",
|
|
92
90
|
"svg-path-bbox": "^1.2.2",
|
|
93
91
|
"swagger-client": "3.18.5"
|