@spiffcommerce/core 14.2.5-alpha.0 → 14.3.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/main.js +1357 -0
- package/dist/module.js +1357 -0
- package/dist/{index.d.mts → types.d.ts} +827 -773
- package/package.json +57 -15
- package/dist/index.mjs +0 -55485
- package/dist/index.umd.js +0 -2851
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare class OptionService {
|
|
7
|
-
/**
|
|
8
|
-
* Allows for retrieving an option, returns the option from a cache if possible.
|
|
9
|
-
* @param id The option ID to be retrieved.
|
|
10
|
-
*/
|
|
11
|
-
getOption(id: string): Promise<undefined | OptionResource>;
|
|
12
|
-
getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
|
|
13
|
-
getDefaultVariant(option: OptionResource): VariantResource | undefined;
|
|
14
|
-
getDisplayImageSource: (variant?: VariantResource) => undefined | string;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the first variant marked as selected. This is used by most steps.
|
|
17
|
-
*/
|
|
18
|
-
getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
|
|
19
|
-
}
|
|
20
|
-
declare const optionService: OptionService;
|
|
21
|
-
|
|
22
|
-
declare class GraphQlManager {
|
|
23
|
-
private shadowGraphqlClient;
|
|
24
|
-
constructor();
|
|
25
|
-
getShadowGraphqlClient(): ApolloClient<any>;
|
|
26
|
-
private constructShadowGraphqlClient;
|
|
27
|
-
}
|
|
28
|
-
declare const graphQlManager: GraphQlManager;
|
|
29
|
-
|
|
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, GlobalPropertyConfiguration, 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
|
+
import { ApolloClient } from "@apollo/client";
|
|
3
|
+
import React, { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent } from "react";
|
|
4
|
+
export const gatherVaryingStepAspects: (workflow: _Workflow1) => _StepAspect1[];
|
|
30
5
|
/**
|
|
31
6
|
* A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
|
|
32
7
|
*/
|
|
33
|
-
interface RenderableScene {
|
|
8
|
+
export interface RenderableScene {
|
|
34
9
|
/**
|
|
35
10
|
* The id of the scene.
|
|
36
11
|
*/
|
|
@@ -48,7 +23,7 @@ interface RenderableScene {
|
|
|
48
23
|
* Information parsed froma workflow structure that is relevant
|
|
49
24
|
* to a given scene.
|
|
50
25
|
*/
|
|
51
|
-
interface WorkflowScene {
|
|
26
|
+
export interface WorkflowScene {
|
|
52
27
|
/**
|
|
53
28
|
* A unique identifier for the scene.
|
|
54
29
|
*/
|
|
@@ -61,19 +36,18 @@ interface WorkflowScene {
|
|
|
61
36
|
* Steps which can display to the user.
|
|
62
37
|
* But may be conditionally hidden based on workflow logic
|
|
63
38
|
*/
|
|
64
|
-
renderableSteps:
|
|
39
|
+
renderableSteps: _Step1<_AnyStepData1>[];
|
|
65
40
|
/**
|
|
66
41
|
* Steps which don't display to the user.
|
|
67
42
|
* Their behavior is always silent & executed in the background.
|
|
68
43
|
*/
|
|
69
|
-
silentSteps:
|
|
44
|
+
silentSteps: _Step1<_AnyStepData1>[];
|
|
70
45
|
}
|
|
71
|
-
|
|
72
46
|
/**
|
|
73
47
|
* A queue promise is a container for a promise that can be
|
|
74
48
|
* executed at a later time.
|
|
75
49
|
*/
|
|
76
|
-
|
|
50
|
+
export abstract class QueueablePromise {
|
|
77
51
|
readonly timestamp: number;
|
|
78
52
|
abstract execute(): Promise<any>;
|
|
79
53
|
}
|
|
@@ -82,10 +56,7 @@ declare abstract class QueueablePromise {
|
|
|
82
56
|
* as quickly as possible in order. This is ideal in situations where a specific operation should be
|
|
83
57
|
* applied in an ordered way while still making.
|
|
84
58
|
*/
|
|
85
|
-
|
|
86
|
-
private queue;
|
|
87
|
-
private activePromise?;
|
|
88
|
-
private queueMaxSize;
|
|
59
|
+
export class PromiseQueue<T extends QueueablePromise> {
|
|
89
60
|
/**
|
|
90
61
|
* Constructs a new promise queue.
|
|
91
62
|
* @param queueMaxSize An optional maximum size, when the max size is hit.
|
|
@@ -110,13 +81,80 @@ declare class PromiseQueue<T extends QueueablePromise> {
|
|
|
110
81
|
* in the promise being extended.
|
|
111
82
|
*/
|
|
112
83
|
finalize(): Promise<void>;
|
|
113
|
-
/**
|
|
114
|
-
* Once called will recursively resolve the jobs in the
|
|
115
|
-
* queue until no more are available.
|
|
116
|
-
*/
|
|
117
|
-
private dequeue;
|
|
118
84
|
}
|
|
119
|
-
|
|
85
|
+
/**
|
|
86
|
+
* A generic base class for custom errors that assigns the name
|
|
87
|
+
* of the error class automatically. All custom errors should extend this.
|
|
88
|
+
*/
|
|
89
|
+
declare abstract class CustomError extends Error {
|
|
90
|
+
constructor(message: any);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A custom class for categorising errors related to workflow configuration.
|
|
94
|
+
*/
|
|
95
|
+
declare abstract class ConfigurationError extends CustomError {
|
|
96
|
+
constructor(message: any);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Thrown when an option was expected but not found in the workflow configuration or
|
|
100
|
+
* the server returned a 404 for an option we expected.
|
|
101
|
+
*/
|
|
102
|
+
export class OptionNotFoundError extends ConfigurationError {
|
|
103
|
+
readonly optionId: string;
|
|
104
|
+
constructor(step: _Step1<_AnyStepData1>);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Thrown when a layout is not found for a given region entity. This
|
|
108
|
+
* can occur when panels are deleted from a workflow but steps are still relying
|
|
109
|
+
* on the layout being present.
|
|
110
|
+
*/
|
|
111
|
+
export class LayoutNotFoundError extends ConfigurationError {
|
|
112
|
+
readonly panelId: string;
|
|
113
|
+
constructor(region: Region);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Thrown when an asset is not found on a specific variant. This can occur when
|
|
117
|
+
* the asset wasn't configured in hub and the variant is loaded in a workflow.
|
|
118
|
+
*/
|
|
119
|
+
export class AssetNotFoundError extends ConfigurationError {
|
|
120
|
+
readonly variant: _VariantResource1;
|
|
121
|
+
constructor(variant: _VariantResource1);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Thrown when a resource is not found linked to a specific asset. This
|
|
125
|
+
* can occur when generation of a resource fails or hasn't completed. Or may be
|
|
126
|
+
* a sign of a misconfiguration.
|
|
127
|
+
*/
|
|
128
|
+
export class ResourceNotFoundError extends ConfigurationError {
|
|
129
|
+
readonly asset: _Asset1;
|
|
130
|
+
constructor(asset: _Asset1);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Thrown when configuration is missing when it was expected. More generic
|
|
134
|
+
* to cover remaining cases outside of the more specific ones such as options, variants & assets.
|
|
135
|
+
*/
|
|
136
|
+
export class MisconfigurationError extends ConfigurationError {
|
|
137
|
+
readonly step: _Step1<_AnyStepData1>;
|
|
138
|
+
constructor(step: _Step1<_AnyStepData1>, message: string);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A custom class for categorising errors related to implementation of core.
|
|
142
|
+
*/
|
|
143
|
+
declare abstract class ImplementationError extends CustomError {
|
|
144
|
+
constructor(message: any);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Thrown when we hit a case that we didn't expect to happen
|
|
148
|
+
*/
|
|
149
|
+
export class UnhandledBehaviorError extends ImplementationError {
|
|
150
|
+
constructor(message: string);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Thrown when we fail to parse something that we expected to be valid
|
|
154
|
+
*/
|
|
155
|
+
export class ParseError extends ImplementationError {
|
|
156
|
+
constructor(message: string);
|
|
157
|
+
}
|
|
120
158
|
/**
|
|
121
159
|
* Bounds the offsets for an image to the box, preventing
|
|
122
160
|
* the user from moving the image in a way that wouldn't be intended.
|
|
@@ -125,14 +163,8 @@ declare class PromiseQueue<T extends QueueablePromise> {
|
|
|
125
163
|
* @param borderWidth The width of the border added by the cropper.
|
|
126
164
|
* @param mustCover When true the image sgould be bounded in such a way that it covers the entire frame at all times.
|
|
127
165
|
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
private offsets;
|
|
131
|
-
private forceImageCover?;
|
|
132
|
-
private targetElements;
|
|
133
|
-
private imageData?;
|
|
134
|
-
private frameData?;
|
|
135
|
-
private readonly _debouncedUpdateFrameOffsets;
|
|
166
|
+
export function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
|
|
167
|
+
export class FrameService {
|
|
136
168
|
/**
|
|
137
169
|
* The calculated minimum zoom value, per frame.
|
|
138
170
|
*/
|
|
@@ -141,10 +173,6 @@ declare class FrameService {
|
|
|
141
173
|
* The calculated maximum zoom value. Note: This is calculated based on the first frame.
|
|
142
174
|
*/
|
|
143
175
|
maxZoomScale: number[];
|
|
144
|
-
private onFrameDataChangeListeners;
|
|
145
|
-
private onZoomChangeListeners;
|
|
146
|
-
private workflowManager?;
|
|
147
|
-
private stepName?;
|
|
148
176
|
constructor(forceImageCover?: boolean);
|
|
149
177
|
/**
|
|
150
178
|
* When we want to connect a workflow manager to the state of the image cropper we
|
|
@@ -209,33 +237,8 @@ declare class FrameService {
|
|
|
209
237
|
* @param newListener
|
|
210
238
|
*/
|
|
211
239
|
onZoom(newListener: (zoomValue: number[]) => void): void;
|
|
212
|
-
/**
|
|
213
|
-
* Updates the offsets of the frame
|
|
214
|
-
* @param newOffsets New offset object
|
|
215
|
-
* @param imageData The image data
|
|
216
|
-
* @param frameData The frame data
|
|
217
|
-
* @param targetElements A list of elements that need updating, by ID
|
|
218
|
-
* @param onComplete A callback when the operation is completed.
|
|
219
|
-
*/
|
|
220
|
-
private updateFrameOffsets;
|
|
221
|
-
/**
|
|
222
|
-
* Determines limitations of zoom based on relative size of image and frame.
|
|
223
|
-
* @param imageData The image to include in calculations
|
|
224
|
-
* @param frameData The frame to include in calculations.
|
|
225
|
-
*/
|
|
226
|
-
private recalculateZoomLimits;
|
|
227
|
-
private recalculateOffsets;
|
|
228
240
|
}
|
|
229
|
-
|
|
230
241
|
declare class Poller {
|
|
231
|
-
private pollingId;
|
|
232
|
-
private attempts;
|
|
233
|
-
private readonly interval;
|
|
234
|
-
private readonly maxAttempts;
|
|
235
|
-
private readonly predicate;
|
|
236
|
-
private readonly onSuccess;
|
|
237
|
-
private readonly onFailure;
|
|
238
|
-
private poll;
|
|
239
242
|
/**
|
|
240
243
|
* Constructs a new polling service.
|
|
241
244
|
* @param predicate An async function that returns true when polling has returned a successful result.
|
|
@@ -246,7 +249,152 @@ declare class Poller {
|
|
|
246
249
|
*/
|
|
247
250
|
constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
|
|
248
251
|
}
|
|
249
|
-
|
|
252
|
+
declare class Configuration {
|
|
253
|
+
constructor();
|
|
254
|
+
getServerUrl(): string;
|
|
255
|
+
getServicesApiUrl(): string;
|
|
256
|
+
getHubUrl(): string;
|
|
257
|
+
setServerUrl(serverUrl: string): void;
|
|
258
|
+
setServicesApiUrl(servicesApiUrl: string): void;
|
|
259
|
+
setHubUrl(hubUrl: string): void;
|
|
260
|
+
addServerUrlCallback(callback: () => void): void;
|
|
261
|
+
}
|
|
262
|
+
export const spiffCoreConfiguration: Configuration;
|
|
263
|
+
export const shortenUrl: (longUrl: string) => Promise<string>;
|
|
264
|
+
declare class DigitalContentStepService implements StepService<_DigitalContentStepData1> {
|
|
265
|
+
init(stepData: _Step1<_DigitalContentStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
266
|
+
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>;
|
|
267
|
+
}
|
|
268
|
+
export const digitalContentStepService: DigitalContentStepService;
|
|
269
|
+
interface FrameCreateOpts {
|
|
270
|
+
stepName?: string;
|
|
271
|
+
frameData: FrameData;
|
|
272
|
+
disablePlaceholder?: boolean;
|
|
273
|
+
focalBlur?: boolean;
|
|
274
|
+
focalBlurStrength?: number;
|
|
275
|
+
focalBlurRadius?: number;
|
|
276
|
+
pattern?: any;
|
|
277
|
+
}
|
|
278
|
+
declare class FrameStepService implements StepService<_FrameStepData1> {
|
|
279
|
+
init(stepData: _Step1<_FrameStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
280
|
+
selectImage(stepData: _Step1<_FrameStepData1>, asset: _Asset1, workflowManager: WorkflowManager): void;
|
|
281
|
+
selectVariant(stepData: _Step1<_FrameStepData1>, variant: _VariantResource1 | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
|
|
282
|
+
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: FrameCreateOpts): _CreateElementCommand1<_FrameElement1>;
|
|
283
|
+
loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
|
|
284
|
+
}
|
|
285
|
+
export const frameStepService: FrameStepService;
|
|
286
|
+
interface SVGCreateOpts {
|
|
287
|
+
stepName?: string;
|
|
288
|
+
src: string;
|
|
289
|
+
objectURL: string;
|
|
290
|
+
svg: {
|
|
291
|
+
svg: string;
|
|
292
|
+
colors: {
|
|
293
|
+
[key: string]: _ColorDefinition1;
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
declare class IllustrationStepService implements StepService<_IllustrationStepData1> {
|
|
298
|
+
getIllustrationBody(src: string): Promise<string>;
|
|
299
|
+
getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
|
|
300
|
+
getColors(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager): {
|
|
301
|
+
[key: string]: _ColorDefinition1;
|
|
302
|
+
} | never[];
|
|
303
|
+
init(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
304
|
+
availableColors(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager): Promise<{
|
|
305
|
+
fill: string | undefined;
|
|
306
|
+
stroke: string | undefined;
|
|
307
|
+
variant: _VariantResource1;
|
|
308
|
+
}[] | undefined>;
|
|
309
|
+
changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<_CanvasCommand1>;
|
|
310
|
+
changeColors(stepData: _Step1<_IllustrationStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
|
|
311
|
+
selectVariant(stepData: _Step1<_IllustrationStepData1>, variant: _VariantResource1, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
|
|
312
|
+
}
|
|
313
|
+
export const illustrationStepService: IllustrationStepService;
|
|
314
|
+
declare class MaterialStepService implements StepService<_MaterialStepData1> {
|
|
315
|
+
init(stepData: _Step1<_MaterialStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | CommandWithFollowup>;
|
|
316
|
+
selectVariant(step: _Step1<_MaterialStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
export const materialStepService: MaterialStepService;
|
|
319
|
+
declare class ModelStepService implements StepService<_ModelStepData1> {
|
|
320
|
+
init(stepData: _Step1<_ModelStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
321
|
+
selectVariant(step: _Step1<_ModelStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
|
|
322
|
+
}
|
|
323
|
+
export const modelStepService: ModelStepService;
|
|
324
|
+
declare class ModuleStepService implements StepService<_ModuleStepData1> {
|
|
325
|
+
init(stepData: _Step1<_ModuleStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
326
|
+
changeText(stepData: _Step1<_ModuleStepData1>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
|
|
327
|
+
}
|
|
328
|
+
export const moduleStepService: ModuleStepService;
|
|
329
|
+
declare class PictureStepService implements StepService<_PictureStepData1> {
|
|
330
|
+
init(stepData: _Step1<_PictureStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
331
|
+
selectVariant(stepData: _Step1<_PictureStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
export const pictureStepService: PictureStepService;
|
|
334
|
+
declare class QuestionStepService implements StepService<_QuestionStepData1> {
|
|
335
|
+
init(stepData: _Step1<_QuestionStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
336
|
+
selectVariant(stepData: _Step1<_QuestionStepData1>, variantId: string, workflowManager: WorkflowManager): Promise<void>;
|
|
337
|
+
}
|
|
338
|
+
export const questionStepService: QuestionStepService;
|
|
339
|
+
declare class ShapeStepService implements StepService<_ShapeStepData1> {
|
|
340
|
+
availableColours(stepData: _Step1<_ShapeStepData1>): Promise<{
|
|
341
|
+
fill: string | undefined;
|
|
342
|
+
stroke: string | undefined;
|
|
343
|
+
variant: _VariantResource1;
|
|
344
|
+
}[]>;
|
|
345
|
+
init(stepData: _Step1<_ShapeStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
346
|
+
selectVariant(stepData: _Step1<_ShapeStepData1>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
347
|
+
}
|
|
348
|
+
export const shapeStepService: ShapeStepService;
|
|
349
|
+
type ToastCallback = (callbackOptions: {
|
|
350
|
+
toastMessage: null | string;
|
|
351
|
+
toastType: InformationMessageType | null;
|
|
352
|
+
}) => void;
|
|
353
|
+
declare class Toast {
|
|
354
|
+
constructor();
|
|
355
|
+
addToastCallback(callback: ToastCallback): void;
|
|
356
|
+
setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
|
|
357
|
+
}
|
|
358
|
+
export const toast: Toast;
|
|
359
|
+
interface TextFillSpotColor {
|
|
360
|
+
profileName: string;
|
|
361
|
+
namedColor: string;
|
|
362
|
+
}
|
|
363
|
+
interface TextUpdateResult {
|
|
364
|
+
command?: _GroupCommand1;
|
|
365
|
+
helperText: string;
|
|
366
|
+
errors: TextError[];
|
|
367
|
+
}
|
|
368
|
+
interface TextError {
|
|
369
|
+
localizationKey: string;
|
|
370
|
+
}
|
|
371
|
+
declare class TextStepService implements StepService<_TextStepData1> {
|
|
372
|
+
init(stepData: _Step1<_TextStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
|
|
373
|
+
findLayoutElements(workflowManager: WorkflowManager, step: _Step1<_TextStepData1>): _TextboxElement1[];
|
|
374
|
+
/**
|
|
375
|
+
* Get the colors that can be used for a given text step.
|
|
376
|
+
* @param stepData The text step to get colors for.
|
|
377
|
+
* @returns A list of color objects containg fill, stroke and variant if available.
|
|
378
|
+
*/
|
|
379
|
+
availableFillColors(stepData: _Step1<_TextStepData1>): ColorOption[];
|
|
380
|
+
changeFillColor(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
381
|
+
availableFillImages(stepData: _Step1<_TextStepData1>): Promise<TextFillImage[]>;
|
|
382
|
+
changeFillImage(stepData: _Step1<_TextStepData1>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Given an element and a string, filters any characters from the string that are
|
|
385
|
+
* not supported by the font of the given element.
|
|
386
|
+
* @param text The text string to filter.
|
|
387
|
+
* @param fontData An optional fontData object, when provided, we use the font table to determine glyphs that aren't provided and additionally strip these out also.
|
|
388
|
+
* @returns A new string representing the passed string with unsupported characters removed.
|
|
389
|
+
*/
|
|
390
|
+
filterUnsupportedCharacters: (text: string, fontData?: FontData) => string;
|
|
391
|
+
getProcessedInput(input: string, stepData: _TextStepData1, customiseAllText: boolean): string;
|
|
392
|
+
updateInputText(input: string, elements: _TextboxElement1[], step: _Step1<_TextStepData1>, workflowManager: WorkflowManager): TextUpdateResult;
|
|
393
|
+
selectVariant(step: _Step1<_TextStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setError: (status: boolean) => void, setHelperText: (text: string) => void): Promise<void>;
|
|
394
|
+
textAlign: (stepData: _TextStepData1) => string;
|
|
395
|
+
createTextFillSpotColor(colorOption: _OptionResource1, variant: _VariantResource1): TextFillSpotColor | undefined;
|
|
396
|
+
}
|
|
397
|
+
export const textStepService: TextStepService;
|
|
250
398
|
declare abstract class ModuleProduct {
|
|
251
399
|
/**
|
|
252
400
|
* Name used by class. Usually product or brand name.
|
|
@@ -261,37 +409,36 @@ declare abstract class ModuleProduct {
|
|
|
261
409
|
*/
|
|
262
410
|
abstract svgPrint(text: string, region: Region): string;
|
|
263
411
|
}
|
|
264
|
-
|
|
265
|
-
interface EditedSteps {
|
|
412
|
+
export interface EditedSteps {
|
|
266
413
|
[stepName: string]: boolean;
|
|
267
414
|
}
|
|
268
|
-
interface MandatorySteps {
|
|
415
|
+
export interface MandatorySteps {
|
|
269
416
|
[stepName: string]: boolean;
|
|
270
417
|
}
|
|
271
|
-
type StepElements = {
|
|
418
|
+
export type StepElements = {
|
|
272
419
|
[key: string]: RegionElement[];
|
|
273
420
|
};
|
|
274
421
|
type StepInitialised = {
|
|
275
422
|
[key: string]: boolean;
|
|
276
423
|
};
|
|
277
424
|
type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
|
|
278
|
-
interface WorkflowStorage {
|
|
279
|
-
[stepName: string]:
|
|
425
|
+
export interface WorkflowStorage {
|
|
426
|
+
[stepName: string]: _StepStorage1;
|
|
280
427
|
}
|
|
281
|
-
interface WorkflowMetadata {
|
|
428
|
+
export interface WorkflowMetadata {
|
|
282
429
|
[stepName: string]: StepMetadata;
|
|
283
430
|
}
|
|
284
|
-
interface WorkflowSelections {
|
|
431
|
+
export interface WorkflowSelections {
|
|
285
432
|
[stepName: string]: {
|
|
286
|
-
selections:
|
|
433
|
+
selections: _VariantResource1[];
|
|
287
434
|
};
|
|
288
435
|
}
|
|
289
|
-
interface InformationResult {
|
|
436
|
+
export interface InformationResult {
|
|
290
437
|
message: string;
|
|
291
438
|
messageType: InformationMessageType;
|
|
292
439
|
stepID: string;
|
|
293
440
|
}
|
|
294
|
-
|
|
441
|
+
export enum InformationMessageType {
|
|
295
442
|
Error = "Error",
|
|
296
443
|
Warning = "Warning",
|
|
297
444
|
Info = "Info"
|
|
@@ -303,7 +450,7 @@ interface StepSpecificServices {
|
|
|
303
450
|
frameService?: FrameService;
|
|
304
451
|
module?: ModuleProduct;
|
|
305
452
|
}
|
|
306
|
-
type DesignCreationProgressUpdate = (message: string) => void;
|
|
453
|
+
export type DesignCreationProgressUpdate = (message: string) => void;
|
|
307
454
|
type ConfirmCallback = (isConfirmed: boolean) => void;
|
|
308
455
|
type EditedCallback = (editedSteps: EditedSteps) => void;
|
|
309
456
|
type ElementsCallback = (elements: StepElements) => void;
|
|
@@ -318,11 +465,11 @@ type SelectionCallback = (callbackOptions: {
|
|
|
318
465
|
selections: StepSelections;
|
|
319
466
|
traversableScenes: WorkflowScene[];
|
|
320
467
|
}) => void;
|
|
321
|
-
type StepSpecificStorageCallback = (selections:
|
|
468
|
+
type StepSpecificStorageCallback = (selections: _StepStorage1) => void;
|
|
322
469
|
type StorageCallback = (storage: WorkflowStorage) => void;
|
|
323
470
|
type CurrentVariationRecordCallback = (variationRecord: null | VariationRecord) => void;
|
|
324
471
|
type VariationRecordsCallback = (records: VariationRecord[]) => void;
|
|
325
|
-
interface WorkflowManager {
|
|
472
|
+
export interface WorkflowManager {
|
|
326
473
|
addPoller: (poller: Poller) => void;
|
|
327
474
|
addConfirmCallback: (callback: ConfirmCallback) => void;
|
|
328
475
|
addCurrentVariationCallback: (callback: CurrentVariationRecordCallback) => void;
|
|
@@ -338,11 +485,11 @@ interface WorkflowManager {
|
|
|
338
485
|
addStorageCallback: (callback: StorageCallback) => void;
|
|
339
486
|
addVariationRecord: (variationRecord: Omit<VariationRecord, "recordNumber">) => VariationRecord;
|
|
340
487
|
addVariationRecordsCallback: (callback: VariationRecordsCallback) => void;
|
|
341
|
-
getCommandDispatcher: () => (command:
|
|
488
|
+
getCommandDispatcher: () => (command: _CanvasCommand1) => void;
|
|
342
489
|
getCurrentVariationRecord: () => VariationRecord | undefined;
|
|
343
490
|
getVariationRecords: () => VariationRecord[];
|
|
344
|
-
getCommandContext: () =>
|
|
345
|
-
getLayouts: () =>
|
|
491
|
+
getCommandContext: () => _CommandContext1;
|
|
492
|
+
getLayouts: () => _ILayout1[];
|
|
346
493
|
getAllLayoutData: () => LayoutState[];
|
|
347
494
|
getLayoutPreviewService: () => any | undefined;
|
|
348
495
|
getPreviewService: () => any | undefined;
|
|
@@ -350,7 +497,7 @@ interface WorkflowManager {
|
|
|
350
497
|
getRegionElements: (stepName: string) => RegionElement[];
|
|
351
498
|
getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
|
|
352
499
|
getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
|
|
353
|
-
getStepStorage: (stepName: string) =>
|
|
500
|
+
getStepStorage: (stepName: string) => _StepStorage1 | undefined;
|
|
354
501
|
getMetadata: (stepName: string) => StepMetadata | undefined;
|
|
355
502
|
getWorkflowMetadata: () => WorkflowMetadata;
|
|
356
503
|
getInformationResults(): InformationResult[];
|
|
@@ -363,7 +510,7 @@ interface WorkflowManager {
|
|
|
363
510
|
setTransactionCustomerDetails: (details: {
|
|
364
511
|
email: string;
|
|
365
512
|
}) => void;
|
|
366
|
-
getWorkflow: () =>
|
|
513
|
+
getWorkflow: () => _Workflow1;
|
|
367
514
|
getWorkflowSelections: () => WorkflowSelections;
|
|
368
515
|
getProduct: () => Product;
|
|
369
516
|
/**
|
|
@@ -389,15 +536,15 @@ interface WorkflowManager {
|
|
|
389
536
|
setEditedStatus: (stepName: string, status: boolean) => void;
|
|
390
537
|
setInformationResults: (results: InformationResult[]) => void;
|
|
391
538
|
setMandatoryFulfilled: (stepName: string, status: boolean) => void;
|
|
392
|
-
setSelectionsAndElements: (stepName: string, variants:
|
|
539
|
+
setSelectionsAndElements: (stepName: string, variants: _VariantResource1[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
|
|
393
540
|
setVariationRecords: (variationRecords: VariationRecord[]) => void;
|
|
394
541
|
toggleDesignConfirmed: () => void;
|
|
395
542
|
updateMetadata: (stepName: string, update: any) => void;
|
|
396
543
|
/**
|
|
397
544
|
* @deprecated State updates are being pulled internally. This function will be removed in the future.
|
|
398
545
|
*/
|
|
399
|
-
updateStateWithServerImmediate: (getReducerState: () =>
|
|
400
|
-
updateStorage: (stepName: string, update:
|
|
546
|
+
updateStateWithServerImmediate: (getReducerState: () => _CommandState1) => Promise<void>;
|
|
547
|
+
updateStorage: (stepName: string, update: _StepStorage1) => Promise<void>;
|
|
401
548
|
getModelContainer: () => any | undefined;
|
|
402
549
|
setModelContainer: (container: any) => void;
|
|
403
550
|
/**
|
|
@@ -407,16 +554,15 @@ interface WorkflowManager {
|
|
|
407
554
|
*/
|
|
408
555
|
injectIntoPreviewService(previewService: any): Promise<void>;
|
|
409
556
|
/**
|
|
410
|
-
* Ejects the model of this product from the preview service.
|
|
557
|
+
* Ejects the model of this product from the preview service. This also sets the internal preview service to undefined.
|
|
411
558
|
*/
|
|
412
559
|
ejectFromPreviewService(): void;
|
|
413
560
|
}
|
|
414
|
-
|
|
415
|
-
interface StepService<T extends AnyStepData> {
|
|
561
|
+
interface StepService<T extends _AnyStepData1> {
|
|
416
562
|
/**
|
|
417
563
|
* Initialize the given step, or reload from serialized data if present.
|
|
418
564
|
*/
|
|
419
|
-
init(stepData:
|
|
565
|
+
init(stepData: _Step1<T>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<any>;
|
|
420
566
|
}
|
|
421
567
|
interface FileInfo {
|
|
422
568
|
/**
|
|
@@ -433,7 +579,7 @@ interface FileInfo {
|
|
|
433
579
|
* A command along with a function to run afterwards.
|
|
434
580
|
*/
|
|
435
581
|
interface CommandWithFollowup {
|
|
436
|
-
command?:
|
|
582
|
+
command?: _CanvasCommand1;
|
|
437
583
|
followup?: () => Promise<void>;
|
|
438
584
|
}
|
|
439
585
|
/**
|
|
@@ -452,7 +598,7 @@ interface ExportedData {
|
|
|
452
598
|
priceModifier: number;
|
|
453
599
|
};
|
|
454
600
|
}
|
|
455
|
-
interface DesignCreationMessage {
|
|
601
|
+
export interface DesignCreationMessage {
|
|
456
602
|
baseCost?: number;
|
|
457
603
|
designProductId?: string;
|
|
458
604
|
designProductVariantId?: string;
|
|
@@ -477,7 +623,7 @@ interface DesignCreationMessage {
|
|
|
477
623
|
/**
|
|
478
624
|
* Represents a transaction.
|
|
479
625
|
*/
|
|
480
|
-
interface Transaction {
|
|
626
|
+
export interface Transaction {
|
|
481
627
|
/**
|
|
482
628
|
* A unique identifier for this transaction. Useful for reloading and
|
|
483
629
|
* modifying state of the transaction.
|
|
@@ -723,18 +869,18 @@ interface ProductTag {
|
|
|
723
869
|
id: string;
|
|
724
870
|
name: string;
|
|
725
871
|
}
|
|
726
|
-
interface ColorOption {
|
|
872
|
+
export interface ColorOption {
|
|
727
873
|
id?: string;
|
|
728
874
|
fill?: string;
|
|
729
875
|
stroke?: string;
|
|
730
|
-
variant?:
|
|
876
|
+
variant?: _VariantResource1;
|
|
731
877
|
colorProfileAssetKey?: string;
|
|
732
878
|
}
|
|
733
879
|
/**
|
|
734
880
|
* Represents a variation as seen in Google sheets.
|
|
735
881
|
* Record number = row# - 1
|
|
736
882
|
*/
|
|
737
|
-
interface VariationRecord {
|
|
883
|
+
export interface VariationRecord {
|
|
738
884
|
recordNumber: number;
|
|
739
885
|
transactionId: string;
|
|
740
886
|
values: {
|
|
@@ -743,7 +889,7 @@ interface VariationRecord {
|
|
|
743
889
|
value: string;
|
|
744
890
|
}[];
|
|
745
891
|
}
|
|
746
|
-
interface RegionElement {
|
|
892
|
+
export interface RegionElement {
|
|
747
893
|
id: string;
|
|
748
894
|
region?: Region;
|
|
749
895
|
}
|
|
@@ -761,10 +907,10 @@ interface TextMetadata {
|
|
|
761
907
|
text: string;
|
|
762
908
|
fillImage?: string;
|
|
763
909
|
}
|
|
764
|
-
interface SelectionStorage {
|
|
765
|
-
selectedVariants?:
|
|
910
|
+
export interface SelectionStorage {
|
|
911
|
+
selectedVariants?: _VariantResource1[];
|
|
766
912
|
}
|
|
767
|
-
interface TextStepStorage extends SelectionStorage {
|
|
913
|
+
export interface TextStepStorage extends SelectionStorage {
|
|
768
914
|
color?: string;
|
|
769
915
|
defaultCleared?: boolean;
|
|
770
916
|
inputText?: string;
|
|
@@ -792,7 +938,7 @@ interface FrameData {
|
|
|
792
938
|
* Defines the different behaviors supported by the camera system
|
|
793
939
|
* for control when viewing a product.
|
|
794
940
|
*/
|
|
795
|
-
|
|
941
|
+
export enum ProductCameraRig {
|
|
796
942
|
Orbit = 0,
|
|
797
943
|
Pan = 1
|
|
798
944
|
}
|
|
@@ -800,7 +946,7 @@ declare enum ProductCameraRig {
|
|
|
800
946
|
* Defines the different strategies to use when calculating the total price
|
|
801
947
|
* when creating bulk designs.
|
|
802
948
|
*/
|
|
803
|
-
|
|
949
|
+
export enum BulkPriceCalculationStrategy {
|
|
804
950
|
/** The total price should increase with the amount of variations. */
|
|
805
951
|
PerVariation = "PerVariation",
|
|
806
952
|
/** The total price should remain at the base price of the product. */
|
|
@@ -819,7 +965,7 @@ interface BulkConfiguration {
|
|
|
819
965
|
/**
|
|
820
966
|
* Defines the locations at which a conversion attempt can take place.
|
|
821
967
|
*/
|
|
822
|
-
|
|
968
|
+
export enum ConversionLocation {
|
|
823
969
|
/**
|
|
824
970
|
* The client should expose a flow for allowing the user to optionally input details at any point.
|
|
825
971
|
*/
|
|
@@ -840,20 +986,20 @@ declare enum ConversionLocation {
|
|
|
840
986
|
/**
|
|
841
987
|
* The data configured to be requested.
|
|
842
988
|
*/
|
|
843
|
-
|
|
989
|
+
export enum ConversionDataType {
|
|
844
990
|
Email = "Email",
|
|
845
991
|
FirstName = "FirstName",
|
|
846
992
|
LastName = "LastName",
|
|
847
993
|
Phone = "Phone"
|
|
848
994
|
}
|
|
849
|
-
interface ConversionData {
|
|
995
|
+
export interface ConversionData {
|
|
850
996
|
type: ConversionDataType;
|
|
851
997
|
mandatory: boolean;
|
|
852
998
|
}
|
|
853
999
|
/**
|
|
854
1000
|
* The configuration for conversion, exposed on products currently.
|
|
855
1001
|
*/
|
|
856
|
-
interface ConversionConfiguration {
|
|
1002
|
+
export interface ConversionConfiguration {
|
|
857
1003
|
id: string;
|
|
858
1004
|
name?: string;
|
|
859
1005
|
locations: ConversionLocation[];
|
|
@@ -864,7 +1010,7 @@ interface ConversionConfiguration {
|
|
|
864
1010
|
/**
|
|
865
1011
|
* Someone who has used a workflow experience and entered their contact details.
|
|
866
1012
|
*/
|
|
867
|
-
interface Customer {
|
|
1013
|
+
export interface Customer {
|
|
868
1014
|
id?: string;
|
|
869
1015
|
emailAddress: string;
|
|
870
1016
|
firstName?: string;
|
|
@@ -875,25 +1021,25 @@ interface Customer {
|
|
|
875
1021
|
stakeholders?: Stakeholder[];
|
|
876
1022
|
bundleStakeholders?: BundleStakeholder[];
|
|
877
1023
|
}
|
|
878
|
-
interface CustomerDetailsInput {
|
|
1024
|
+
export interface CustomerDetailsInput {
|
|
879
1025
|
emailAddress: string;
|
|
880
1026
|
firstName?: string;
|
|
881
1027
|
lastName?: string;
|
|
882
1028
|
phoneNumber?: string;
|
|
883
1029
|
}
|
|
884
|
-
|
|
1030
|
+
export enum StakeholderType {
|
|
885
1031
|
Owner = "Owner",
|
|
886
1032
|
Approver = "Approver",
|
|
887
1033
|
Editor = "Editor",
|
|
888
1034
|
Viewer = "Viewer"
|
|
889
1035
|
}
|
|
890
|
-
interface Stakeholder {
|
|
1036
|
+
export interface Stakeholder {
|
|
891
1037
|
id: string;
|
|
892
1038
|
type?: StakeholderType;
|
|
893
1039
|
transaction?: Transaction;
|
|
894
1040
|
customer?: Customer;
|
|
895
1041
|
}
|
|
896
|
-
interface Bundle
|
|
1042
|
+
interface Bundle {
|
|
897
1043
|
id?: string;
|
|
898
1044
|
bundleOwnerId?: string;
|
|
899
1045
|
bundleStakeholders?: BundleStakeholder[];
|
|
@@ -908,7 +1054,7 @@ interface Bundle$1 {
|
|
|
908
1054
|
}
|
|
909
1055
|
interface BundleStakeholder {
|
|
910
1056
|
id: string;
|
|
911
|
-
bundle?: Bundle
|
|
1057
|
+
bundle?: Bundle;
|
|
912
1058
|
customer?: Customer;
|
|
913
1059
|
type?: StakeholderType;
|
|
914
1060
|
}
|
|
@@ -930,7 +1076,41 @@ type GlobalPropertyStateAspect = {
|
|
|
930
1076
|
name: string;
|
|
931
1077
|
value: string;
|
|
932
1078
|
};
|
|
933
|
-
|
|
1079
|
+
interface StorageService {
|
|
1080
|
+
/**
|
|
1081
|
+
* Get a value.
|
|
1082
|
+
* @param key The key to lookup the value with.
|
|
1083
|
+
*/
|
|
1084
|
+
get(key: string): string | undefined;
|
|
1085
|
+
/**
|
|
1086
|
+
* Set a value.
|
|
1087
|
+
* @param key The key to set.
|
|
1088
|
+
* @param val The new value.
|
|
1089
|
+
*/
|
|
1090
|
+
set(key: string, val: string): void;
|
|
1091
|
+
/**
|
|
1092
|
+
* Remove a value.
|
|
1093
|
+
* @param key The key to remove, does nothing if the key doesn't exist.
|
|
1094
|
+
*/
|
|
1095
|
+
remove(key: string): void;
|
|
1096
|
+
/**
|
|
1097
|
+
* Get a map from persistence.
|
|
1098
|
+
* @param key The key to search by.
|
|
1099
|
+
*/
|
|
1100
|
+
getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
|
|
1101
|
+
/**
|
|
1102
|
+
* St a map into persistence.
|
|
1103
|
+
* @param key The key to set the map at.
|
|
1104
|
+
* @param val The map to set.
|
|
1105
|
+
*/
|
|
1106
|
+
setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
|
|
1107
|
+
}
|
|
1108
|
+
export const persistenceService: StorageService;
|
|
1109
|
+
declare class GraphQlManager {
|
|
1110
|
+
constructor();
|
|
1111
|
+
getShadowGraphqlClient(): ApolloClient<any>;
|
|
1112
|
+
}
|
|
1113
|
+
export const graphQlManager: GraphQlManager;
|
|
934
1114
|
/**
|
|
935
1115
|
* An asset manager provides a way to create and
|
|
936
1116
|
* manage assets on the Spiff Commerce Platform.
|
|
@@ -939,15 +1119,13 @@ interface AssetManager {
|
|
|
939
1119
|
/**
|
|
940
1120
|
* Uploads a file to the Spiff Commerce Platform.
|
|
941
1121
|
*/
|
|
942
|
-
uploadFile: (file: File, onProgress: (val: number) => void) => Promise<
|
|
1122
|
+
uploadFile: (file: File, onProgress: (val: number) => void) => Promise<_Asset1>;
|
|
943
1123
|
}
|
|
944
1124
|
declare class AssetService implements AssetManager {
|
|
945
|
-
private cache;
|
|
946
|
-
private materialCache;
|
|
947
1125
|
/**
|
|
948
1126
|
* Allows for retrieving an asset, returns the option from a cache if possible.
|
|
949
1127
|
*/
|
|
950
|
-
getLocalOrFromServer(assetKey: string): Promise<
|
|
1128
|
+
getLocalOrFromServer(assetKey: string): Promise<_Asset1>;
|
|
951
1129
|
/**
|
|
952
1130
|
* Allows for retrieving amaterial, returns the option from a cache if possible.
|
|
953
1131
|
* @param id The option ID to be retrieved.
|
|
@@ -957,123 +1135,324 @@ declare class AssetService implements AssetManager {
|
|
|
957
1135
|
* Upload a user asset to the server. Using callbacks to notify important events.
|
|
958
1136
|
* The asset will be stored via the persistence service for future access, if available.
|
|
959
1137
|
*/
|
|
960
|
-
uploadAssetWithProgress(file: FileInfo, assetType:
|
|
961
|
-
uploadFile(file: File, onProgress: (val: number) => void): Promise<
|
|
1138
|
+
uploadAssetWithProgress(file: FileInfo, assetType: _AssetType1, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<_Asset1>;
|
|
1139
|
+
uploadFile(file: File, onProgress: (val: number) => void): Promise<_Asset1>;
|
|
962
1140
|
removePersistedAsset(assetKey: string): void;
|
|
963
1141
|
getPersistedAssets(): PersistedAsset[];
|
|
964
1142
|
/**
|
|
965
1143
|
* Convert a File object for an image into a FileInfo.
|
|
966
1144
|
*/
|
|
967
1145
|
loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
|
|
968
|
-
/**
|
|
969
|
-
* Handles mimeType resolution & asset creation request
|
|
970
|
-
* @param file A file info object containing data about the file and its name
|
|
971
|
-
* @param assetType The type of asset we're expecting to upload
|
|
972
|
-
*/
|
|
973
|
-
private dispatchCreateAssetRequest;
|
|
974
|
-
private guessMIME;
|
|
975
1146
|
}
|
|
976
1147
|
interface PersistedAsset {
|
|
977
1148
|
assetKey: string;
|
|
978
1149
|
src: string;
|
|
979
1150
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
interface StorageService {
|
|
983
|
-
/**
|
|
984
|
-
* Get a value.
|
|
985
|
-
* @param key The key to lookup the value with.
|
|
986
|
-
*/
|
|
987
|
-
get(key: string): string | undefined;
|
|
988
|
-
/**
|
|
989
|
-
* Set a value.
|
|
990
|
-
* @param key The key to set.
|
|
991
|
-
* @param val The new value.
|
|
992
|
-
*/
|
|
993
|
-
set(key: string, val: string): void;
|
|
994
|
-
/**
|
|
995
|
-
* Remove a value.
|
|
996
|
-
* @param key The key to remove, does nothing if the key doesn't exist.
|
|
997
|
-
*/
|
|
998
|
-
remove(key: string): void;
|
|
1151
|
+
export const assetService: AssetService;
|
|
1152
|
+
declare class OptionService {
|
|
999
1153
|
/**
|
|
1000
|
-
*
|
|
1001
|
-
* @param
|
|
1154
|
+
* Allows for retrieving an option, returns the option from a cache if possible.
|
|
1155
|
+
* @param id The option ID to be retrieved.
|
|
1002
1156
|
*/
|
|
1003
|
-
|
|
1157
|
+
getOption(id: string): Promise<undefined | _OptionResource1>;
|
|
1158
|
+
getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
|
|
1159
|
+
getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
|
|
1160
|
+
getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
|
|
1004
1161
|
/**
|
|
1005
|
-
*
|
|
1006
|
-
* @param key The key to set the map at.
|
|
1007
|
-
* @param val The map to set.
|
|
1162
|
+
* Returns the first variant marked as selected. This is used by most steps.
|
|
1008
1163
|
*/
|
|
1009
|
-
|
|
1164
|
+
getSelectedVariant: (option: _OptionResource1 | undefined, selectedVariantIds: string[]) => _VariantResource1 | undefined;
|
|
1165
|
+
}
|
|
1166
|
+
export const optionService: OptionService;
|
|
1167
|
+
export const CommandContextContext: import("react").Context<_CommandContext1>;
|
|
1168
|
+
export const useLayouts: () => {
|
|
1169
|
+
commandDispatcher: (command: _CanvasCommand1, leaveOffUndoStack: boolean) => void;
|
|
1170
|
+
getLayoutById: (id: string) => _LayoutData1;
|
|
1171
|
+
getAllLayouts: () => _LayoutData1[];
|
|
1172
|
+
getReducerState: () => _CommandState1;
|
|
1173
|
+
lastUpdated: Date;
|
|
1174
|
+
flattenSequence: (sequenceId: string, initialState: _LayoutsState1) => void;
|
|
1175
|
+
};
|
|
1176
|
+
export type CommandDispatcher = (command: _CanvasCommand1, leaveOffUndoStack: boolean) => void;
|
|
1177
|
+
export type LayoutGetter = (layoutId: string) => _LayoutData1;
|
|
1178
|
+
export type LayoutsGetter = () => _LayoutData1[];
|
|
1179
|
+
/**
|
|
1180
|
+
* Details about a guideline that can be drawn on the canvas.
|
|
1181
|
+
*/
|
|
1182
|
+
interface SnapPoint {
|
|
1183
|
+
type: "x" | "y" | "rotation";
|
|
1184
|
+
value: number;
|
|
1185
|
+
svgNode?: ReactNode;
|
|
1186
|
+
anchorPoint: number;
|
|
1187
|
+
guidelineCoordinates?: Point[];
|
|
1188
|
+
}
|
|
1189
|
+
export enum ElementEventType {
|
|
1190
|
+
Translate = "Translate",
|
|
1191
|
+
Rotate = "Rotate",
|
|
1192
|
+
Resize = "Resize"
|
|
1193
|
+
}
|
|
1194
|
+
export enum KeyEvent {
|
|
1195
|
+
ControlLeft = "ControlLeft",
|
|
1196
|
+
ControlRight = "ControlRight",
|
|
1197
|
+
Equal = "Equal",
|
|
1198
|
+
MetaLeft = "MetaLeft",
|
|
1199
|
+
MetaRight = "MetaRight",
|
|
1200
|
+
Minus = "Minus",
|
|
1201
|
+
ArrowLeft = "ArrowLeft",
|
|
1202
|
+
ArrowRight = "ArrowRight",
|
|
1203
|
+
ArrowUp = "ArrowUp",
|
|
1204
|
+
ArrowDown = "ArrowDown",
|
|
1205
|
+
AltLeft = "AltLeft",
|
|
1206
|
+
AltRight = "AltRight",
|
|
1207
|
+
Delete = "Delete",
|
|
1208
|
+
Backspace = "Backspace"
|
|
1209
|
+
}
|
|
1210
|
+
type ElementEvent = {
|
|
1211
|
+
type: ElementEventType.Translate;
|
|
1212
|
+
} | {
|
|
1213
|
+
type: ElementEventType.Rotate;
|
|
1214
|
+
} | {
|
|
1215
|
+
type: ElementEventType.Resize;
|
|
1216
|
+
relativeAxis: ScaleAxis;
|
|
1217
|
+
screenAxis: ScaleAxis;
|
|
1218
|
+
};
|
|
1219
|
+
export enum EditorSubMenu {
|
|
1220
|
+
None = "None",
|
|
1221
|
+
FrameAdjustment = "FrameAdjustment",
|
|
1222
|
+
Variations = "Variations",
|
|
1223
|
+
FinalizeDesign = "FinalizeDesign",
|
|
1224
|
+
SavedDesigns = "SavedDesigns",
|
|
1225
|
+
ThreeDPreview = "ThreeDPreview",
|
|
1226
|
+
Panels = "Panels"
|
|
1227
|
+
}
|
|
1228
|
+
interface UIState {
|
|
1010
1229
|
}
|
|
1011
|
-
declare const persistenceService: StorageService;
|
|
1012
|
-
|
|
1013
1230
|
/**
|
|
1014
|
-
*
|
|
1231
|
+
* This context stores global state for
|
|
1015
1232
|
*/
|
|
1016
|
-
|
|
1017
|
-
private readonly variantData;
|
|
1018
|
-
constructor(variant: VariantResource);
|
|
1019
|
-
getType(): AssetType | undefined;
|
|
1233
|
+
export interface AdvancedEditorState extends UIState {
|
|
1020
1234
|
/**
|
|
1021
|
-
*
|
|
1235
|
+
* The layout currently being displayed in the editor.
|
|
1022
1236
|
*/
|
|
1023
|
-
|
|
1237
|
+
layoutId: string;
|
|
1024
1238
|
/**
|
|
1025
|
-
*
|
|
1239
|
+
* Returns the id of the currently selected element. Or undefined if no element is selected.
|
|
1026
1240
|
*/
|
|
1027
|
-
|
|
1241
|
+
selectedElement?: string;
|
|
1028
1242
|
/**
|
|
1029
|
-
*
|
|
1243
|
+
* The current zoom level of the editor.
|
|
1030
1244
|
*/
|
|
1031
|
-
|
|
1245
|
+
zoom: number;
|
|
1032
1246
|
/**
|
|
1033
|
-
*
|
|
1034
|
-
* Presented in subunits of the currency of the option. For example, if the option is configured to use USD, the price modifier will be in cents.
|
|
1247
|
+
* The current x translation of the transform for the canvas.
|
|
1035
1248
|
*/
|
|
1036
|
-
|
|
1249
|
+
xTranslation: number;
|
|
1037
1250
|
/**
|
|
1038
|
-
*
|
|
1251
|
+
* The current y translation of the transform for the canvas.
|
|
1039
1252
|
*/
|
|
1040
|
-
|
|
1253
|
+
yTranslation: number;
|
|
1041
1254
|
/**
|
|
1042
|
-
*
|
|
1255
|
+
* The maxiumum zoom possible based on current canvas content.
|
|
1043
1256
|
*/
|
|
1044
|
-
|
|
1257
|
+
maxZoom: number;
|
|
1045
1258
|
/**
|
|
1046
|
-
*
|
|
1259
|
+
* The current measurement system used for display of coordinates and dimensions.
|
|
1047
1260
|
*/
|
|
1048
|
-
|
|
1261
|
+
units: _UnitOfMeasurement1;
|
|
1049
1262
|
/**
|
|
1050
|
-
*
|
|
1263
|
+
* The sub menu to be displayed to the user in place of the canvas.
|
|
1051
1264
|
*/
|
|
1052
|
-
|
|
1265
|
+
subMenu: EditorSubMenu;
|
|
1053
1266
|
/**
|
|
1054
|
-
*
|
|
1267
|
+
* Any modifier keys that are currently pressed
|
|
1055
1268
|
*/
|
|
1056
|
-
|
|
1269
|
+
activeModifierKeys: KeyEvent[];
|
|
1057
1270
|
/**
|
|
1058
|
-
*
|
|
1271
|
+
* WHether or not a meta key is pressed.
|
|
1059
1272
|
*/
|
|
1060
|
-
|
|
1273
|
+
metaPressed: boolean;
|
|
1061
1274
|
/**
|
|
1062
|
-
*
|
|
1275
|
+
* Any active element event.
|
|
1063
1276
|
*/
|
|
1064
|
-
|
|
1277
|
+
elementEvent?: ElementEvent;
|
|
1278
|
+
/**
|
|
1279
|
+
* If movement should assume that it's operating in a scrolled environment.
|
|
1280
|
+
* FIXME: Can we get rid of this somehow.
|
|
1281
|
+
*/
|
|
1282
|
+
scrolledMovement: boolean;
|
|
1283
|
+
}
|
|
1284
|
+
export const getDefaultState: (getLayouts: LayoutsGetter, defaultZoom: number) => AdvancedEditorState;
|
|
1285
|
+
export const commandReducer: (state: AdvancedEditorState, command: UICommand) => AdvancedEditorState;
|
|
1286
|
+
export const AdvancedEditorContext: import("react").Context<{
|
|
1287
|
+
uiDispatcher: Dispatch<UICommand>;
|
|
1288
|
+
state: AdvancedEditorState;
|
|
1289
|
+
}>;
|
|
1290
|
+
export const AdvancedEditorStateProvider: FunctionComponent<{
|
|
1291
|
+
defaultZoom?: number;
|
|
1292
|
+
children: ReactNode;
|
|
1293
|
+
}>;
|
|
1294
|
+
export class UICommand {
|
|
1295
|
+
constructor(changes: Partial<AdvancedEditorState>);
|
|
1296
|
+
apply(state: AdvancedEditorState): {
|
|
1297
|
+
layoutId: string;
|
|
1298
|
+
selectedElement?: string | undefined;
|
|
1299
|
+
zoom: number;
|
|
1300
|
+
xTranslation: number;
|
|
1301
|
+
yTranslation: number;
|
|
1302
|
+
maxZoom: number;
|
|
1303
|
+
units: _UnitOfMeasurement1;
|
|
1304
|
+
subMenu: EditorSubMenu;
|
|
1305
|
+
activeModifierKeys: KeyEvent[];
|
|
1306
|
+
metaPressed: boolean;
|
|
1307
|
+
elementEvent?: ElementEvent | undefined;
|
|
1308
|
+
scrolledMovement: boolean;
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
export const useEditorState: () => {
|
|
1312
|
+
uiDispatcher: Dispatch<UICommand>;
|
|
1313
|
+
state: AdvancedEditorState;
|
|
1314
|
+
};
|
|
1315
|
+
/**
|
|
1316
|
+
* The minimum zoom that can be applied to a canvas.
|
|
1317
|
+
*/
|
|
1318
|
+
export const minZoom = 0.5;
|
|
1319
|
+
export const useEditorInteraction: (editorRef: RefObject<SVGRectElement>, interactionRef: RefObject<HTMLDivElement>, zoomableElementRef: RefObject<HTMLDivElement>, defaultAdjustmentZoom: number | undefined, mode: "adjustment" | "advanced", canvasDispatcher: CommandDispatcher, breakpoint: string, guidelinePrimaryColor?: string, onSequenceComplete?: () => void) => {
|
|
1320
|
+
guidelines: SnapPoint[];
|
|
1321
|
+
scale: number;
|
|
1322
|
+
zoomableElementRef: RefObject<HTMLDivElement>;
|
|
1323
|
+
setElementEvent: (newEvent: ElementEvent | undefined) => void;
|
|
1324
|
+
handleZoom: (_event: any, value: any) => void;
|
|
1325
|
+
handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
|
|
1326
|
+
handleKeyUp: (event: KeyboardEvent) => void;
|
|
1327
|
+
handlePointerPressedBackground: (event: PointerEvent) => void;
|
|
1328
|
+
handlePointerReleased: () => void;
|
|
1329
|
+
handlePointerMove: (event: PointerEvent, adjustmentBoundary?: Region) => void;
|
|
1330
|
+
handleScroll: () => void;
|
|
1331
|
+
handleSequenceStart: () => void;
|
|
1332
|
+
};
|
|
1333
|
+
export const useShortcutCombination: (shortcutKeys: string[], onCombinationPressed: () => void, onCombinationReleased?: () => void) => void;
|
|
1334
|
+
export interface DesignInputStep {
|
|
1335
|
+
data: DesignInputStepData;
|
|
1336
|
+
name: string;
|
|
1337
|
+
}
|
|
1338
|
+
interface DesignInputStepData {
|
|
1339
|
+
}
|
|
1340
|
+
export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
|
|
1341
|
+
export const EditorCore: FunctionComponent<{
|
|
1342
|
+
isMobile: boolean;
|
|
1343
|
+
color?: string;
|
|
1344
|
+
outlineColor?: string;
|
|
1345
|
+
editorRef: RefObject<SVGRectElement>;
|
|
1346
|
+
zoomableElementRef: RefObject<HTMLDivElement>;
|
|
1347
|
+
interactionElementRef: RefObject<HTMLDivElement>;
|
|
1348
|
+
guidelines: SnapPoint[];
|
|
1349
|
+
isMakingAdjustments?: boolean;
|
|
1350
|
+
outlineArea?: {
|
|
1351
|
+
x?: number;
|
|
1352
|
+
y?: number;
|
|
1353
|
+
height?: number;
|
|
1354
|
+
width?: number;
|
|
1355
|
+
hidden?: boolean;
|
|
1356
|
+
};
|
|
1357
|
+
visibleLayoutId: string;
|
|
1358
|
+
xTranslation: number;
|
|
1359
|
+
yTranslation: number;
|
|
1360
|
+
targetedElements?: string[];
|
|
1361
|
+
borderRadius?: number;
|
|
1362
|
+
canvasFilter?: string;
|
|
1363
|
+
handleContextMenu?: (e: any) => void;
|
|
1364
|
+
onMouseMove?: (event: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
|
|
1365
|
+
onContextMenuHandlePointerDown?: (event: PointerEvent) => void;
|
|
1366
|
+
handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
|
|
1367
|
+
handleKeyUp: (event: KeyboardEvent) => void;
|
|
1368
|
+
handlePointerMove: (e: PointerEvent, adjustmentBoundary?: Region) => void;
|
|
1369
|
+
handlePointerPressedBackground: (event: PointerEvent) => void;
|
|
1370
|
+
handlePointerReleased: () => void;
|
|
1371
|
+
handleScroll: () => void;
|
|
1372
|
+
onSequenceStart: () => void;
|
|
1373
|
+
setElementEvent: (e: ElementEvent | undefined) => void;
|
|
1374
|
+
onElementSelected: (elementId: string | undefined, event: PointerEvent) => void;
|
|
1375
|
+
variationRecord: null | VariationRecord;
|
|
1376
|
+
workflow: _Workflow1;
|
|
1377
|
+
}>;
|
|
1378
|
+
/**
|
|
1379
|
+
* The advanced editor encapsulates the logic required to allow users to manipulate a design
|
|
1380
|
+
* with more granular control such as toolbars, direct element manipulation, and more.
|
|
1381
|
+
*/
|
|
1382
|
+
export const AdvancedEditor: FunctionComponent<{
|
|
1383
|
+
borderRadius?: number;
|
|
1384
|
+
canvasFilter?: string;
|
|
1385
|
+
color?: string;
|
|
1386
|
+
guidelineColor?: string;
|
|
1387
|
+
handleContextMenu?: (event: React.MouseEvent) => void;
|
|
1388
|
+
hideEditableAreaRect?: boolean;
|
|
1389
|
+
isMobile: boolean;
|
|
1390
|
+
onContextMenuHandlePointerDown?: (event: PointerEvent) => void;
|
|
1391
|
+
onDragEnd?: () => void;
|
|
1392
|
+
onElementSelected?: (id: string | undefined, element: PointerEvent) => void;
|
|
1393
|
+
onMouseMove?: (event: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
|
|
1394
|
+
outlineColor?: string;
|
|
1395
|
+
variationRecord: null | VariationRecord;
|
|
1396
|
+
workflow: _Workflow1;
|
|
1397
|
+
}>;
|
|
1398
|
+
/**
|
|
1399
|
+
* A wrapping component that provides a simple interface for interacting with a variant.
|
|
1400
|
+
*/
|
|
1401
|
+
export class Variant {
|
|
1402
|
+
constructor(variant: _VariantResource1);
|
|
1403
|
+
getType(): _AssetType1 | undefined;
|
|
1404
|
+
/**
|
|
1405
|
+
* @returns The unique identifier for the variant.
|
|
1406
|
+
*/
|
|
1407
|
+
getId(): string;
|
|
1408
|
+
/**
|
|
1409
|
+
* @returns The configured name of the variant. Generally a human readable value.
|
|
1410
|
+
*/
|
|
1411
|
+
getName(): string;
|
|
1412
|
+
/**
|
|
1413
|
+
* @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
|
|
1414
|
+
*/
|
|
1415
|
+
getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
|
|
1416
|
+
/**
|
|
1417
|
+
* @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
|
|
1418
|
+
* Presented in subunits of the currency of the option. For example, if the option is configured to use USD, the price modifier will be in cents.
|
|
1419
|
+
*/
|
|
1420
|
+
getPrice(): number;
|
|
1421
|
+
/**
|
|
1422
|
+
* @returns The URL for the base asset resource configured on this variant
|
|
1423
|
+
*/
|
|
1424
|
+
getAsset(): string | undefined;
|
|
1425
|
+
/**
|
|
1426
|
+
* @returns The URL for a thumbnail resource configured on this variant. When no thumbnail is configured explicitly we fall back to the base asset and see if a thumbnail is genererated for that.
|
|
1427
|
+
*/
|
|
1428
|
+
getThumbnail(): string | undefined;
|
|
1429
|
+
/**
|
|
1430
|
+
* @returns The URL for the display image configured on this variant. Can be used for things like size charts.
|
|
1431
|
+
*/
|
|
1432
|
+
getDisplayImage(): string | undefined;
|
|
1433
|
+
/**
|
|
1434
|
+
* @returns When this variant is configured to have a color, this will return the hex value for that color.
|
|
1435
|
+
*/
|
|
1436
|
+
getColor(): string | undefined;
|
|
1437
|
+
/**
|
|
1438
|
+
* @returns True when the variant is the default for its containing option. False otherwise.
|
|
1439
|
+
*/
|
|
1440
|
+
isDefault(): boolean;
|
|
1441
|
+
/**
|
|
1442
|
+
* @returns The underlying variant resource. Generally not needed but made available just incase.
|
|
1443
|
+
*/
|
|
1444
|
+
getResource(): _VariantResource1;
|
|
1445
|
+
/**
|
|
1446
|
+
* @returns True when the variant is enabled. False otherwise.
|
|
1447
|
+
*/
|
|
1448
|
+
isEnabled(): boolean;
|
|
1065
1449
|
}
|
|
1066
|
-
|
|
1067
1450
|
/**
|
|
1068
1451
|
* A StepHandle allows for managing the state of a specific step in a workflow. This class
|
|
1069
1452
|
* abstracts away the complexities of dealing with a step directly and allows for using high level
|
|
1070
1453
|
* concepts instead of dealing with the underlying data structures.
|
|
1071
1454
|
*/
|
|
1072
|
-
|
|
1073
|
-
/**
|
|
1074
|
-
* Stores whether or not the step is currently updating.
|
|
1075
|
-
*/
|
|
1076
|
-
private static readonly updateState;
|
|
1455
|
+
export abstract class StepHandle<T extends _AnyStepData1> {
|
|
1077
1456
|
/**
|
|
1078
1457
|
* Access to the workflow manager this step is contained by.
|
|
1079
1458
|
*/
|
|
@@ -1081,8 +1460,8 @@ declare abstract class StepHandle<T extends AnyStepData> {
|
|
|
1081
1460
|
/**
|
|
1082
1461
|
* The step metadata, useful for determining logic based on configuration.
|
|
1083
1462
|
*/
|
|
1084
|
-
protected readonly step:
|
|
1085
|
-
constructor(manager: WorkflowManager, step:
|
|
1463
|
+
protected readonly step: _Step1<T>;
|
|
1464
|
+
constructor(manager: WorkflowManager, step: _Step1<T>);
|
|
1086
1465
|
/**
|
|
1087
1466
|
* Set the current update state of this step. All step handles pointing to this step will
|
|
1088
1467
|
* see this value.
|
|
@@ -1127,11 +1506,11 @@ declare abstract class StepHandle<T extends AnyStepData> {
|
|
|
1127
1506
|
/**
|
|
1128
1507
|
* @returns The type of the step handle.
|
|
1129
1508
|
*/
|
|
1130
|
-
getType():
|
|
1509
|
+
getType(): _StepType1;
|
|
1131
1510
|
/**
|
|
1132
1511
|
* @returns The underlying data for this step. Favor using the step handle methods instead of this.
|
|
1133
1512
|
*/
|
|
1134
|
-
getRaw():
|
|
1513
|
+
getRaw(): _Step1<T>;
|
|
1135
1514
|
/**
|
|
1136
1515
|
* Fires any configured animations on the 3D preview for this step.
|
|
1137
1516
|
* This includes camera & model animations. If the preview is unavailable
|
|
@@ -1139,9 +1518,169 @@ declare abstract class StepHandle<T extends AnyStepData> {
|
|
|
1139
1518
|
*/
|
|
1140
1519
|
executeAnimations(): void;
|
|
1141
1520
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1521
|
+
export class BulkStepHandle extends StepHandle<_BulkStepData1> {
|
|
1522
|
+
constructor(manager: WorkflowManager, step: _Step1<_BulkStepData1>);
|
|
1523
|
+
selectVariant(): Promise<void>;
|
|
1524
|
+
setDesignName(designName: string): Promise<void>;
|
|
1525
|
+
addVariationRecord(): VariationRecord;
|
|
1526
|
+
updateBulkIsConnected(bulkIsConnected: boolean): void;
|
|
1527
|
+
/**
|
|
1528
|
+
* Opens the bulk source in a seperate tab. This bulk source could be a google sheet or a csv file.
|
|
1529
|
+
*/
|
|
1530
|
+
openBulkSourceUrl(): void;
|
|
1531
|
+
sendGoogleSheetLinkToEmail(email: string): Promise<void>;
|
|
1532
|
+
/**
|
|
1533
|
+
* Removes a variation from the bulk step.
|
|
1534
|
+
* @param recordNumber The record number of the variation to remove.
|
|
1535
|
+
*/
|
|
1536
|
+
deleteVariationRecord(recordNumber: number): void;
|
|
1537
|
+
/**
|
|
1538
|
+
* @returns The aspects of each step that are modifiable from the bulk handle. These are configured in the workflow.
|
|
1539
|
+
*/
|
|
1540
|
+
getAspects(): import("@spiffcommerce/papyrus").StepAspect[];
|
|
1541
|
+
}
|
|
1542
|
+
export class IllustrationStepHandle extends StepHandle<_IllustrationStepData1> {
|
|
1543
|
+
constructor(manager: WorkflowManager, step: _Step1<_IllustrationStepData1>);
|
|
1544
|
+
/**
|
|
1545
|
+
* Allows for select a vector from the available vectors configured on this steps base option.
|
|
1546
|
+
* @param variant The new vector variant to use for this step.
|
|
1547
|
+
* @returns A promise that can be awaited to know when the new vector asset has been updated on the design.
|
|
1548
|
+
*/
|
|
1549
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Get colors for the illustration.
|
|
1552
|
+
* @returns A list of color definitions that are currently applied to the illustration.
|
|
1553
|
+
*/
|
|
1554
|
+
getColors(): {
|
|
1555
|
+
[key: string]: import("@spiffcommerce/papyrus").ColorDefinition;
|
|
1556
|
+
} | undefined;
|
|
1557
|
+
/**
|
|
1558
|
+
* Set color for the illustration.
|
|
1559
|
+
*/
|
|
1560
|
+
setColor(key: string, value: string): Promise<void>;
|
|
1561
|
+
getColorOption(): Promise<import("@spiffcommerce/papyrus").OptionResource | undefined>;
|
|
1562
|
+
getAvailableColors(): Promise<{
|
|
1563
|
+
fill: string | undefined;
|
|
1564
|
+
stroke: string | undefined;
|
|
1565
|
+
variant: import("@spiffcommerce/papyrus").VariantResource;
|
|
1566
|
+
}[] | undefined>;
|
|
1567
|
+
hasVaryingSelection(): boolean | undefined;
|
|
1568
|
+
hasVaryingColors(): boolean | undefined;
|
|
1569
|
+
isColorPickerEnabled(): boolean | undefined;
|
|
1570
|
+
}
|
|
1571
|
+
export class MaterialStepHandle extends StepHandle<_MaterialStepData1> {
|
|
1572
|
+
constructor(manager: WorkflowManager, step: _Step1<_MaterialStepData1>);
|
|
1573
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1574
|
+
}
|
|
1575
|
+
export class ModelStepHandle extends StepHandle<_ModelStepData1> {
|
|
1576
|
+
constructor(manager: WorkflowManager, step: _Step1<_ModelStepData1>);
|
|
1577
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1578
|
+
}
|
|
1579
|
+
export class PictureStepHandle extends StepHandle<_PictureStepData1> {
|
|
1580
|
+
constructor(manager: WorkflowManager, step: _Step1<_PictureStepData1>);
|
|
1581
|
+
/**
|
|
1582
|
+
* Allows the user to select an image variant from the available variants configured on this steps base option.
|
|
1583
|
+
* @param variant The new image variant to use.
|
|
1584
|
+
* @returns A promise that can be awaited to ensure the new image asset has been updated on the design.
|
|
1585
|
+
*/
|
|
1586
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1587
|
+
}
|
|
1588
|
+
export class QuestionStepHandle extends StepHandle<_QuestionStepData1> {
|
|
1589
|
+
constructor(manager: WorkflowManager, step: _Step1<_QuestionStepData1>);
|
|
1590
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1591
|
+
/**
|
|
1592
|
+
* The way that this step expects to be rendered.
|
|
1593
|
+
*/
|
|
1594
|
+
getDisplayType(): string | undefined;
|
|
1595
|
+
}
|
|
1596
|
+
export class ShapeStepHandle extends StepHandle<_ShapeStepData1> {
|
|
1597
|
+
constructor(manager: WorkflowManager, step: _Step1<_ShapeStepData1>);
|
|
1598
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Sets the color of the shape.
|
|
1601
|
+
* @param color The color option to use.
|
|
1602
|
+
* @returns A promise resolving when the color has changed in the design.
|
|
1603
|
+
* @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
|
|
1604
|
+
*/
|
|
1605
|
+
setColor(color: ColorOption): Promise<void>;
|
|
1606
|
+
/**
|
|
1607
|
+
* Get available colors for the shape.
|
|
1608
|
+
* @returns A list of color definitions that are currently applied to the illustration.
|
|
1609
|
+
*/
|
|
1610
|
+
getColors(): Promise<{
|
|
1611
|
+
fill: string | undefined;
|
|
1612
|
+
stroke: string | undefined;
|
|
1613
|
+
variant: import("@spiffcommerce/papyrus").VariantResource;
|
|
1614
|
+
}[]>;
|
|
1615
|
+
}
|
|
1616
|
+
interface TextChangeResult {
|
|
1617
|
+
input: string;
|
|
1618
|
+
helperText?: string;
|
|
1619
|
+
errorText?: string;
|
|
1620
|
+
}
|
|
1621
|
+
export class TextStepHandle extends StepHandle<_TextStepData1> {
|
|
1622
|
+
constructor(manager: WorkflowManager, step: _Step1<_TextStepData1>);
|
|
1623
|
+
/**
|
|
1624
|
+
* Allows for select a font from the available fonts configured on this steps base option.
|
|
1625
|
+
* @param variant The font variant to use.
|
|
1626
|
+
*/
|
|
1627
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1628
|
+
/**
|
|
1629
|
+
* @returns A list of colors that can be used to fill the text.
|
|
1630
|
+
*/
|
|
1631
|
+
getAvailableFillColors(): ColorOption[];
|
|
1632
|
+
/**
|
|
1633
|
+
* Changes the fill of text related to this step to the new fill value.
|
|
1634
|
+
* @param fill A new fill value to use.
|
|
1635
|
+
*/
|
|
1636
|
+
setFillColor(fill: ColorOption): Promise<void>;
|
|
1637
|
+
/**
|
|
1638
|
+
* Gets the color currently applied to the element.
|
|
1639
|
+
*/
|
|
1640
|
+
getFillColor(): string;
|
|
1641
|
+
getAvailableFillImages(): Promise<TextFillImage[]>;
|
|
1642
|
+
setFillImage(fillImage: TextFillImage): Promise<void>;
|
|
1643
|
+
getFillImage(): TextFillImage | undefined;
|
|
1644
|
+
/**
|
|
1645
|
+
* When true & the step has replaceable text configured the user will be
|
|
1646
|
+
* abled to edit the entire text string including the non-replaceable text.
|
|
1647
|
+
* @param shouldCustomizeAll When true the user can configure the entire text string.
|
|
1648
|
+
*/
|
|
1649
|
+
setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
|
|
1650
|
+
/**
|
|
1651
|
+
* Changes the text value of text related to this step to a new value.
|
|
1652
|
+
* @param userInput Input from the user.
|
|
1653
|
+
*/
|
|
1654
|
+
setText(userInput: string): TextChangeResult;
|
|
1655
|
+
/**
|
|
1656
|
+
* Gets the text currently applied to the elements of this step.
|
|
1657
|
+
*/
|
|
1658
|
+
getText(): string;
|
|
1659
|
+
isReplaceable(): boolean | undefined;
|
|
1660
|
+
/**
|
|
1661
|
+
* Inform the step that now is the time to
|
|
1662
|
+
* clear default text if it should do so.
|
|
1663
|
+
* Returns a text change rwsult if a clear occurred.
|
|
1664
|
+
*/
|
|
1665
|
+
clearDefaultTextIfNecessary(): TextChangeResult | undefined;
|
|
1666
|
+
hasVaryingText(): boolean | undefined;
|
|
1667
|
+
hasVaryingColor(): boolean | undefined;
|
|
1668
|
+
hasVaryingSelection(): boolean | undefined;
|
|
1669
|
+
hasColorPicker(): boolean | undefined;
|
|
1670
|
+
getRegions(): import("@spiffcommerce/papyrus").Region[];
|
|
1671
|
+
/**
|
|
1672
|
+
* Return the maximum characters allowed for
|
|
1673
|
+
* this step, or undefined if there is no limit.
|
|
1674
|
+
*/
|
|
1675
|
+
getCharacterLimit(): number | undefined;
|
|
1676
|
+
/**
|
|
1677
|
+
* Return the remaining amount of characters that
|
|
1678
|
+
* the user is allowed to add, or undefined if there is no limit.
|
|
1679
|
+
*/
|
|
1680
|
+
getCharactersRemaining(): number | undefined;
|
|
1681
|
+
}
|
|
1682
|
+
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>;
|
|
1683
|
+
export interface SavedDesign {
|
|
1145
1684
|
/**
|
|
1146
1685
|
* The user's name for this saved design.
|
|
1147
1686
|
*/
|
|
@@ -1181,8 +1720,6 @@ interface SavedDesign {
|
|
|
1181
1720
|
*/
|
|
1182
1721
|
declare class DesignService {
|
|
1183
1722
|
readonly localPersistenceKey = "designTransactions";
|
|
1184
|
-
private storageMethod;
|
|
1185
|
-
private designSavedListeners;
|
|
1186
1723
|
/**
|
|
1187
1724
|
* @param func The function to call when a design is saved.
|
|
1188
1725
|
*/
|
|
@@ -1215,10 +1752,8 @@ declare class DesignService {
|
|
|
1215
1752
|
* @param transactionId
|
|
1216
1753
|
*/
|
|
1217
1754
|
removeDesign(transactionId: string): Promise<void>;
|
|
1218
|
-
private setDesigns;
|
|
1219
1755
|
}
|
|
1220
|
-
|
|
1221
|
-
|
|
1756
|
+
export const designService: DesignService;
|
|
1222
1757
|
/**
|
|
1223
1758
|
* A scene is a collection of steps that can be used to group steps together.
|
|
1224
1759
|
*/
|
|
@@ -1241,7 +1776,7 @@ interface Scene {
|
|
|
1241
1776
|
* provides a simplified interface for interacting with the workflow manager. You
|
|
1242
1777
|
* should get an instance of this class from a Client you have constructed previously.
|
|
1243
1778
|
*/
|
|
1244
|
-
interface WorkflowExperience {
|
|
1779
|
+
export interface WorkflowExperience {
|
|
1245
1780
|
/**
|
|
1246
1781
|
* Returns the client that was responsible for spawning this experience.
|
|
1247
1782
|
*/
|
|
@@ -1266,7 +1801,7 @@ interface WorkflowExperience {
|
|
|
1266
1801
|
* Returns the step matching a given name, undefined if not found.
|
|
1267
1802
|
* @param id The id the step must match.
|
|
1268
1803
|
*/
|
|
1269
|
-
getStepById(id: string): StepHandle<
|
|
1804
|
+
getStepById(id: string): StepHandle<_AnyStepData1> | undefined;
|
|
1270
1805
|
/**
|
|
1271
1806
|
* Returns the bulk step, undefined if not found.
|
|
1272
1807
|
*/
|
|
@@ -1275,21 +1810,21 @@ interface WorkflowExperience {
|
|
|
1275
1810
|
* Returns the step matching a given name, undefined if not found.
|
|
1276
1811
|
* @param name The name the step must match.
|
|
1277
1812
|
*/
|
|
1278
|
-
getStepByName(name: string): StepHandle<
|
|
1813
|
+
getStepByName(name: string): StepHandle<_AnyStepData1> | undefined;
|
|
1279
1814
|
/**
|
|
1280
1815
|
* Returns all steps matching a specific type in the workflow. These steps
|
|
1281
1816
|
* may be across multiple scenes and may or may not be active based on condition state.
|
|
1282
1817
|
*/
|
|
1283
|
-
getStepsByType(type:
|
|
1818
|
+
getStepsByType(type: _StepType1): StepHandle<_AnyStepData1>[];
|
|
1284
1819
|
/**
|
|
1285
1820
|
* Returns all steps that are children of a given scene.
|
|
1286
1821
|
* @param scene The scene you want the steps for.
|
|
1287
1822
|
*/
|
|
1288
|
-
getStepsByScene(scene: Scene): StepHandle<
|
|
1823
|
+
getStepsByScene(scene: Scene): StepHandle<_AnyStepData1>[];
|
|
1289
1824
|
/**
|
|
1290
1825
|
* Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
|
|
1291
1826
|
*/
|
|
1292
|
-
getSteps(): StepHandle<
|
|
1827
|
+
getSteps(): StepHandle<_AnyStepData1>[];
|
|
1293
1828
|
/**
|
|
1294
1829
|
* Returns a list of scenes that are configured in the workflow. Each scene
|
|
1295
1830
|
* contains a list of steps. See getStepsByScene to access these.
|
|
@@ -1363,15 +1898,32 @@ interface WorkflowExperience {
|
|
|
1363
1898
|
[key: string]: string;
|
|
1364
1899
|
}>;
|
|
1365
1900
|
}
|
|
1366
|
-
|
|
1901
|
+
export enum FrameStep {
|
|
1902
|
+
SelectFrame = "SelectFrame",
|
|
1903
|
+
SelectImage = "SelectImage",
|
|
1904
|
+
Position = "Position"
|
|
1905
|
+
}
|
|
1906
|
+
export class FrameStepHandle extends StepHandle<_FrameStepData1> {
|
|
1907
|
+
constructor(manager: WorkflowManager, step: _Step1<_FrameStepData1>);
|
|
1908
|
+
selectVariant(variant: Variant): Promise<void>;
|
|
1909
|
+
onFrameDataChanged(callback: (frameData: _FrameData1[]) => void): void;
|
|
1910
|
+
selectImage(asset: _Asset1): void;
|
|
1911
|
+
getImageData(): PatternImageData | undefined;
|
|
1912
|
+
getCurrentFrameStep(frameData: _FrameData1, uploading?: any, imageUploadComplete?: any, variants?: _VariantResource1[]): FrameStep;
|
|
1913
|
+
getFrameService(): FrameService | undefined;
|
|
1914
|
+
hasOverlayImageKey(): string | undefined;
|
|
1915
|
+
hasOverlayImageUrl(): any;
|
|
1916
|
+
hasVaryingUpload(): boolean | undefined;
|
|
1917
|
+
hasVaryingSelection(): boolean | undefined;
|
|
1918
|
+
}
|
|
1367
1919
|
/**
|
|
1368
1920
|
* A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
|
|
1369
1921
|
* bundles can return a handle for any global properties associated to the collection.
|
|
1370
1922
|
*/
|
|
1371
1923
|
declare abstract class GlobalPropertyHandle {
|
|
1372
|
-
protected readonly bundle:
|
|
1924
|
+
protected readonly bundle: _Bundle1;
|
|
1373
1925
|
protected readonly property: GlobalPropertyConfigurationAspect;
|
|
1374
|
-
constructor(bundle:
|
|
1926
|
+
constructor(bundle: _Bundle1, property: GlobalPropertyConfigurationAspect);
|
|
1375
1927
|
/**
|
|
1376
1928
|
* @returns The name of the global property. This is the key used to store the property in the state.
|
|
1377
1929
|
*/
|
|
@@ -1401,19 +1953,17 @@ declare abstract class GlobalPropertyHandle {
|
|
|
1401
1953
|
* Returns all steps that share this property.
|
|
1402
1954
|
* @param targetExperiences Optionally filter the steps to only those in the given experiences.
|
|
1403
1955
|
*/
|
|
1404
|
-
protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<
|
|
1956
|
+
protected getSharedSteps(targetExperiences?: WorkflowExperience[]): import("stepHandles").StepHandle<import("index").AnyStepData>[];
|
|
1405
1957
|
}
|
|
1406
|
-
|
|
1407
1958
|
interface GlobalPropertyStateManager {
|
|
1408
1959
|
getGlobalPropertyState(): GlobalPropertyState | undefined;
|
|
1409
1960
|
getAspect(name: string): string | undefined;
|
|
1410
1961
|
setAspect(name: string, value: string): Promise<void>;
|
|
1411
1962
|
}
|
|
1412
|
-
|
|
1413
1963
|
/**
|
|
1414
1964
|
* A bundle serves as a container for a set of workflow experience.
|
|
1415
1965
|
*/
|
|
1416
|
-
interface
|
|
1966
|
+
interface _Bundle1 {
|
|
1417
1967
|
/**
|
|
1418
1968
|
* @returns The client that this bundle is associated with.
|
|
1419
1969
|
*/
|
|
@@ -1530,9 +2080,27 @@ interface Bundle {
|
|
|
1530
2080
|
* Remove a previously added event listener from this bundle.
|
|
1531
2081
|
*/
|
|
1532
2082
|
removeEventListener(event: BundleEvent, listener: () => void): void;
|
|
2083
|
+
/**
|
|
2084
|
+
* Retrieves the current preview service for this bundle, if one exists.
|
|
2085
|
+
* If a preview service was specified when calling client.getExistingBundle, this will return that service.
|
|
2086
|
+
* Call `setPreviewService` to update the preview service for this bundle.
|
|
2087
|
+
*/
|
|
2088
|
+
getPreviewService(): any | undefined;
|
|
2089
|
+
/**
|
|
2090
|
+
* Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will
|
|
2091
|
+
* also automatically inject the preview service into any new workflow experiences that are added to this bundle.
|
|
2092
|
+
* If this method is called with no arguments or undefined, the preview service will be removed from this bundle.
|
|
2093
|
+
* @param previewService The preview service to use for this bundle.
|
|
2094
|
+
* @returns A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.
|
|
2095
|
+
*/
|
|
2096
|
+
setPreviewService(previewService?: any): Promise<void>;
|
|
2097
|
+
/**
|
|
2098
|
+
* Returns a promise that resolves when the bundle has been initialized.
|
|
2099
|
+
* This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
|
|
2100
|
+
*/
|
|
2101
|
+
getInitializationPromise(): Promise<void>;
|
|
1533
2102
|
}
|
|
1534
2103
|
type BundleEvent = "conditional-global-properties-changed";
|
|
1535
|
-
|
|
1536
2104
|
interface ExecutionResponse {
|
|
1537
2105
|
id: string;
|
|
1538
2106
|
completedAt?: string;
|
|
@@ -1558,7 +2126,7 @@ declare abstract class FlowExecutionInput {
|
|
|
1558
2126
|
/**
|
|
1559
2127
|
* Represents the type of object being referenced by the input.
|
|
1560
2128
|
*/
|
|
1561
|
-
|
|
2129
|
+
export const enum ObjectInputType {
|
|
1562
2130
|
Transaction = "Transaction",
|
|
1563
2131
|
Bundle = "Bundle",
|
|
1564
2132
|
Product = "Product",
|
|
@@ -1570,18 +2138,17 @@ declare const enum ObjectInputType {
|
|
|
1570
2138
|
/**
|
|
1571
2139
|
* Handles validation of spiffObject structure for transmission to the server.
|
|
1572
2140
|
*/
|
|
1573
|
-
|
|
2141
|
+
export class ObjectInput extends FlowExecutionInput {
|
|
1574
2142
|
constructor(id: string, type: ObjectInputType);
|
|
1575
2143
|
static validUUID(uuid: string): RegExpMatchArray | null;
|
|
1576
2144
|
}
|
|
1577
2145
|
/**
|
|
1578
2146
|
* Handles validation of text input for transmission to the server.
|
|
1579
2147
|
*/
|
|
1580
|
-
|
|
2148
|
+
export class TextInput extends FlowExecutionInput {
|
|
1581
2149
|
constructor(id: string);
|
|
1582
2150
|
}
|
|
1583
|
-
|
|
1584
|
-
declare const getWorkflow: (id: string) => Promise<Workflow>;
|
|
2151
|
+
export const getWorkflow: (id: string) => Promise<_Workflow1>;
|
|
1585
2152
|
/**
|
|
1586
2153
|
* Options that can be used during instantiation of the SpiffCommerce Javascript Client.
|
|
1587
2154
|
* Please refer to the documentation for more information.
|
|
@@ -1635,21 +2202,12 @@ interface GetWorkflowFromExternalProductOptions extends GetWorkflowOptionsBase {
|
|
|
1635
2202
|
bulk?: boolean;
|
|
1636
2203
|
type: "external";
|
|
1637
2204
|
}
|
|
1638
|
-
type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
|
|
2205
|
+
export type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
|
|
1639
2206
|
/**
|
|
1640
2207
|
* The Spiff Commerce Javascript Client. Required for
|
|
1641
2208
|
* creating workflow experiences.
|
|
1642
2209
|
*/
|
|
1643
|
-
|
|
1644
|
-
private options;
|
|
1645
|
-
private initialized;
|
|
1646
|
-
private currencyCode?;
|
|
1647
|
-
private customer?;
|
|
1648
|
-
/**
|
|
1649
|
-
* @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
|
|
1650
|
-
* Any functionality referencing this object will be removed in a future release.
|
|
1651
|
-
*/
|
|
1652
|
-
private experienceOptions?;
|
|
2210
|
+
export class SpiffCommerceClient {
|
|
1653
2211
|
constructor(options: ClientOptions);
|
|
1654
2212
|
/**
|
|
1655
2213
|
* @returns The asset manager allows for common operations related to assets
|
|
@@ -1682,7 +2240,7 @@ declare class SpiffCommerceClient {
|
|
|
1682
2240
|
transactionReadOnly?: boolean;
|
|
1683
2241
|
stakeholderType?: StakeholderType;
|
|
1684
2242
|
success: boolean;
|
|
1685
|
-
theme?:
|
|
2243
|
+
theme?: _Theme1;
|
|
1686
2244
|
}>;
|
|
1687
2245
|
clearCustomer(): void;
|
|
1688
2246
|
clearCustomerForTransaction(transactionId: string): void;
|
|
@@ -1691,7 +2249,6 @@ declare class SpiffCommerceClient {
|
|
|
1691
2249
|
customer: Customer;
|
|
1692
2250
|
isAuthenticated: boolean;
|
|
1693
2251
|
}>;
|
|
1694
|
-
private authenticateCustomerId;
|
|
1695
2252
|
/**
|
|
1696
2253
|
* Generates a verification code for the given email address.
|
|
1697
2254
|
* @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
|
|
@@ -1708,12 +2265,14 @@ declare class SpiffCommerceClient {
|
|
|
1708
2265
|
* @param collectionId Optional: The id of the product collection that the bundle can use.
|
|
1709
2266
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
1710
2267
|
*/
|
|
1711
|
-
getNewBundle(collectionId?: string): Promise<
|
|
2268
|
+
getNewBundle(collectionId?: string): Promise<_Bundle1>;
|
|
1712
2269
|
/**
|
|
1713
2270
|
* Retrieves an existing bundle from the API, by id.
|
|
2271
|
+
* @param bundleId The id of the bundle to retrieve.
|
|
2272
|
+
* @param previewService Optional: A reference to an existing preview service to use. This can be assigned manually later.
|
|
1714
2273
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
1715
2274
|
*/
|
|
1716
|
-
getExistingBundle(bundleId: string,
|
|
2275
|
+
getExistingBundle(bundleId: string, previewService?: any): Promise<_Bundle1>;
|
|
1717
2276
|
/**
|
|
1718
2277
|
* Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
|
|
1719
2278
|
* @returns An array of bundle stakeholders.
|
|
@@ -1727,7 +2286,7 @@ declare class SpiffCommerceClient {
|
|
|
1727
2286
|
* @param options Options to configure loading the transaction and workflow.
|
|
1728
2287
|
* @returns A workflow experience configured as requested.
|
|
1729
2288
|
*/
|
|
1730
|
-
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow:
|
|
2289
|
+
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
|
|
1731
2290
|
/**
|
|
1732
2291
|
* Initialize the client from an integration product.
|
|
1733
2292
|
* @param integrationProductId The integration product to use.
|
|
@@ -1741,10 +2300,6 @@ declare class SpiffCommerceClient {
|
|
|
1741
2300
|
* @deprecated Use getWorkflowExperience to initialize the experience.
|
|
1742
2301
|
*/
|
|
1743
2302
|
initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
|
|
1744
|
-
/**
|
|
1745
|
-
* @deprecated Remove when the initFrom functions are removed.
|
|
1746
|
-
*/
|
|
1747
|
-
private getWorkflowExperienceDeprecated;
|
|
1748
2303
|
/**
|
|
1749
2304
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
|
|
1750
2305
|
* @returns The preview service that was provided during construction.
|
|
@@ -1754,256 +2309,26 @@ declare class SpiffCommerceClient {
|
|
|
1754
2309
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
|
|
1755
2310
|
* @returns The product associated with this client.
|
|
1756
2311
|
*/
|
|
1757
|
-
getProduct(): Product;
|
|
2312
|
+
getProduct(): import("types").Product;
|
|
1758
2313
|
/**
|
|
1759
2314
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
|
|
1760
2315
|
* @returns The transaction associated with this client.
|
|
1761
2316
|
*/
|
|
1762
2317
|
getTransaction(): Transaction;
|
|
1763
|
-
/**
|
|
1764
|
-
* A function used to synchronize transaction state with the server.
|
|
1765
|
-
* @param options New state details. To be spread into the query.
|
|
1766
|
-
* @returns
|
|
1767
|
-
*/
|
|
1768
|
-
private updateTransactionState;
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
declare class Configuration {
|
|
1772
|
-
private readonly defaultServerUrl;
|
|
1773
|
-
private readonly defaultServicesApiUrl;
|
|
1774
|
-
private readonly defaultHubUrl;
|
|
1775
|
-
private serverUrl;
|
|
1776
|
-
private servicesApiUrl;
|
|
1777
|
-
private hubUrl;
|
|
1778
|
-
private serverUrlCallbacks;
|
|
1779
|
-
constructor();
|
|
1780
|
-
getServerUrl(): string;
|
|
1781
|
-
getServicesApiUrl(): string;
|
|
1782
|
-
getHubUrl(): string;
|
|
1783
|
-
setServerUrl(serverUrl: string): void;
|
|
1784
|
-
setServicesApiUrl(servicesApiUrl: string): void;
|
|
1785
|
-
setHubUrl(hubUrl: string): void;
|
|
1786
|
-
addServerUrlCallback(callback: () => void): void;
|
|
1787
2318
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
declare const gatherVaryingStepAspects: (workflow: Workflow) => StepAspect[];
|
|
1791
|
-
|
|
1792
|
-
type ToastCallback = (callbackOptions: {
|
|
1793
|
-
toastMessage: null | string;
|
|
1794
|
-
toastType: InformationMessageType | null;
|
|
1795
|
-
}) => void;
|
|
1796
|
-
declare class Toast {
|
|
1797
|
-
private latestToast;
|
|
1798
|
-
private toastType;
|
|
1799
|
-
private toastCallbacks;
|
|
1800
|
-
constructor();
|
|
1801
|
-
addToastCallback(callback: ToastCallback): void;
|
|
1802
|
-
setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
|
|
1803
|
-
private onToastChange;
|
|
1804
|
-
}
|
|
1805
|
-
declare const toast: Toast;
|
|
1806
|
-
|
|
1807
|
-
interface FrameCreateOpts {
|
|
1808
|
-
stepName?: string;
|
|
1809
|
-
frameData: FrameData;
|
|
1810
|
-
disablePlaceholder?: boolean;
|
|
1811
|
-
focalBlur?: boolean;
|
|
1812
|
-
focalBlurStrength?: number;
|
|
1813
|
-
focalBlurRadius?: number;
|
|
1814
|
-
pattern?: any;
|
|
1815
|
-
}
|
|
1816
|
-
declare class FrameStepService implements StepService<FrameStepData> {
|
|
1817
|
-
init(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1818
|
-
private reload;
|
|
1819
|
-
selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager): void;
|
|
1820
|
-
selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
|
|
1821
|
-
getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): CreateElementCommand<FrameElement>;
|
|
1822
|
-
loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
|
|
1823
|
-
private selectVariantCommand;
|
|
1824
|
-
private frameSourceSvg;
|
|
1825
|
-
/**
|
|
1826
|
-
* Grab the source to be used for a frame from the variant or throw otherwise.
|
|
1827
|
-
*/
|
|
1828
|
-
private patternSource;
|
|
1829
|
-
private loadPatternFromAsset;
|
|
1830
|
-
}
|
|
1831
|
-
declare const frameStepService: FrameStepService;
|
|
1832
|
-
|
|
1833
|
-
interface SVGCreateOpts {
|
|
1834
|
-
stepName?: string;
|
|
1835
|
-
src: string;
|
|
1836
|
-
objectURL: string;
|
|
1837
|
-
svg: {
|
|
1838
|
-
svg: string;
|
|
1839
|
-
colors: {
|
|
1840
|
-
[key: string]: ColorDefinition;
|
|
1841
|
-
};
|
|
1842
|
-
};
|
|
1843
|
-
}
|
|
1844
|
-
declare class IllustrationStepService implements StepService<IllustrationStepData> {
|
|
1845
|
-
getIllustrationBody(src: string): Promise<string>;
|
|
1846
|
-
getCreateElementCommand(id: string, region: Region, layout: ILayout, options: SVGCreateOpts): CreateElementCommand<IllustrationElement>;
|
|
1847
|
-
getColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): never[] | {
|
|
1848
|
-
[key: string]: ColorDefinition;
|
|
1849
|
-
};
|
|
1850
|
-
init(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1851
|
-
private reload;
|
|
1852
|
-
availableColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): Promise<{
|
|
1853
|
-
fill: string | undefined;
|
|
1854
|
-
stroke: string | undefined;
|
|
1855
|
-
variant: VariantResource;
|
|
1856
|
-
}[] | undefined>;
|
|
1857
|
-
changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<CanvasCommand>;
|
|
1858
|
-
changeColors(stepData: Step<IllustrationStepData>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => LayoutData[], newFills: Map<string, string>): Promise<void>;
|
|
1859
|
-
selectVariant(stepData: Step<IllustrationStepData>, variant: VariantResource, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
|
|
1860
|
-
private selectVariantCommand;
|
|
1861
|
-
}
|
|
1862
|
-
declare const illustrationStepService: IllustrationStepService;
|
|
1863
|
-
|
|
1864
|
-
declare class MaterialStepService implements StepService<MaterialStepData> {
|
|
1865
|
-
init(stepData: Step<MaterialStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<null | CommandWithFollowup>;
|
|
1866
|
-
private reload;
|
|
1867
|
-
selectVariant(step: Step<MaterialStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
|
|
1868
|
-
private selectVariantLambda;
|
|
1869
|
-
}
|
|
1870
|
-
declare const materialStepService: MaterialStepService;
|
|
1871
|
-
|
|
1872
|
-
declare class ModelStepService implements StepService<ModelStepData> {
|
|
1873
|
-
init(stepData: Step<ModelStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1874
|
-
private reload;
|
|
1875
|
-
selectVariant(step: Step<ModelStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
|
|
1876
|
-
private selectVariantLambda;
|
|
1877
|
-
}
|
|
1878
|
-
declare const modelStepService: ModelStepService;
|
|
1879
|
-
|
|
1880
|
-
interface TextFillSpotColor {
|
|
1881
|
-
profileName: string;
|
|
1882
|
-
namedColor: string;
|
|
1883
|
-
}
|
|
1884
|
-
interface TextUpdateResult {
|
|
1885
|
-
command?: GroupCommand;
|
|
1886
|
-
helperText: string;
|
|
1887
|
-
errors: TextError[];
|
|
1888
|
-
}
|
|
1889
|
-
interface TextError {
|
|
1890
|
-
localizationKey: string;
|
|
1891
|
-
}
|
|
1892
|
-
declare class TextStepService implements StepService<TextStepData> {
|
|
1893
|
-
private cachedColors;
|
|
1894
|
-
init(stepData: Step<TextStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1895
|
-
findLayoutElements(workflowManager: WorkflowManager, step: Step<TextStepData>): TextboxElement[];
|
|
1896
|
-
/**
|
|
1897
|
-
* Get the colors that can be used for a given text step.
|
|
1898
|
-
* @param stepData The text step to get colors for.
|
|
1899
|
-
* @returns A list of color objects containg fill, stroke and variant if available.
|
|
1900
|
-
*/
|
|
1901
|
-
availableFillColors(stepData: Step<TextStepData>): ColorOption[];
|
|
1902
|
-
changeFillColor(stepData: Step<TextStepData>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
1903
|
-
availableFillImages(stepData: Step<TextStepData>): Promise<TextFillImage[]>;
|
|
1904
|
-
changeFillImage(stepData: Step<TextStepData>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
1905
|
-
/**
|
|
1906
|
-
* Given an element and a string, filters any characters from the string that are
|
|
1907
|
-
* not supported by the font of the given element.
|
|
1908
|
-
* @param text The text string to filter.
|
|
1909
|
-
* @param fontData An optional fontData object, when provided, we use the font table to determine glyphs that aren't provided and additionally strip these out also.
|
|
1910
|
-
* @returns A new string representing the passed string with unsupported characters removed.
|
|
1911
|
-
*/
|
|
1912
|
-
filterUnsupportedCharacters: (text: string, fontData?: FontData) => string;
|
|
1913
|
-
getProcessedInput(input: string, stepData: TextStepData, customiseAllText: boolean): string;
|
|
1914
|
-
updateInputText(input: string, elements: TextboxElement[], step: Step<TextStepData>, workflowManager: WorkflowManager): TextUpdateResult;
|
|
1915
|
-
selectVariant(step: Step<TextStepData>, variant: VariantResource, workflowManager: WorkflowManager, setError: (status: boolean) => void, setHelperText: (text: string) => void): Promise<void>;
|
|
1916
|
-
textAlign: (stepData: TextStepData) => string;
|
|
1917
|
-
createTextFillSpotColor(colorOption: OptionResource, variant: VariantResource): TextFillSpotColor | undefined;
|
|
1918
|
-
private reload;
|
|
1919
|
-
private getDefaultColorVariant;
|
|
1920
|
-
private getDefaultColor;
|
|
1921
|
-
private getDefaultImageFillVariant;
|
|
1922
|
-
/**
|
|
1923
|
-
* Validates a string of text based on step confoiguration.
|
|
1924
|
-
* @param text The text to validate
|
|
1925
|
-
* @param step The step providing configuration
|
|
1926
|
-
* @param workflowManager Workflow manager for access to workflow state
|
|
1927
|
-
* @returns A list of errors. Empty if the text passes validation.
|
|
1928
|
-
*/
|
|
1929
|
-
private getErrorsForText;
|
|
1930
|
-
private fontDataFromVariant;
|
|
1931
|
-
private selectVariantCommand;
|
|
1932
|
-
/**
|
|
1933
|
-
* When a text step specifies replaceable text, the text input by the user will replace
|
|
1934
|
-
* a specific token within a larger string of text specified in the step configuration. Otherwise
|
|
1935
|
-
* this function will just return the text it's given when the feature is disabled.
|
|
1936
|
-
*/
|
|
1937
|
-
private injectReplaceableText;
|
|
1938
|
-
private createTextboxRegions;
|
|
1939
|
-
private generateTextChangeCommandsForRegion;
|
|
1940
|
-
/**
|
|
1941
|
-
* @deprecated
|
|
1942
|
-
*/
|
|
1943
|
-
private changeInputTextWithRegion;
|
|
1944
|
-
}
|
|
1945
|
-
declare const textStepService: TextStepService;
|
|
1946
|
-
|
|
1947
|
-
declare class PictureStepService implements StepService<PictureStepData> {
|
|
1948
|
-
init(stepData: Step<PictureStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1949
|
-
private reload;
|
|
1950
|
-
selectVariant(stepData: Step<PictureStepData>, variant: VariantResource, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
|
|
1951
|
-
private selectVariantCommand;
|
|
1952
|
-
}
|
|
1953
|
-
declare const pictureStepService: PictureStepService;
|
|
1954
|
-
|
|
1955
|
-
declare class QuestionStepService implements StepService<QuestionStepData> {
|
|
1956
|
-
init(stepData: Step<QuestionStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1957
|
-
private reload;
|
|
1958
|
-
selectVariant(stepData: Step<QuestionStepData>, variantId: string, workflowManager: WorkflowManager): Promise<void>;
|
|
1959
|
-
private selectVariantLambda;
|
|
1960
|
-
}
|
|
1961
|
-
declare const questionStepService: QuestionStepService;
|
|
1962
|
-
|
|
1963
|
-
declare class ShapeStepService implements StepService<ShapeStepData> {
|
|
1964
|
-
availableColours(stepData: Step<ShapeStepData>): Promise<{
|
|
1965
|
-
fill: string | undefined;
|
|
1966
|
-
stroke: string | undefined;
|
|
1967
|
-
variant: VariantResource;
|
|
1968
|
-
}[]>;
|
|
1969
|
-
init(stepData: Step<ShapeStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1970
|
-
private reload;
|
|
1971
|
-
selectVariant(stepData: Step<ShapeStepData>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
|
|
1972
|
-
private selectVariantCommand;
|
|
1973
|
-
}
|
|
1974
|
-
declare const shapeStepService: ShapeStepService;
|
|
1975
|
-
|
|
1976
|
-
declare class ModuleStepService implements StepService<ModuleStepData> {
|
|
1977
|
-
init(stepData: Step<ModuleStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1978
|
-
private reload;
|
|
1979
|
-
changeText(stepData: Step<ModuleStepData>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
|
|
1980
|
-
private changeTextCommand;
|
|
1981
|
-
private validateInput;
|
|
1982
|
-
}
|
|
1983
|
-
declare const moduleStepService: ModuleStepService;
|
|
1984
|
-
|
|
1985
|
-
declare class DigitalContentStepService implements StepService<DigitalContentStepData> {
|
|
1986
|
-
init(stepData: Step<DigitalContentStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
1987
|
-
private reload;
|
|
1988
|
-
regenerateQRCode(elements: RegionElement[], uploading: boolean, assetKey: string, url: string, workflowManager: WorkflowManager, stepData: Step<DigitalContentStepData>, setUrl: (finalUrl: string) => void, commandDispatcher: (command: CanvasCommand) => void, setIsRegenerating: (state: boolean) => void): Promise<void>;
|
|
1989
|
-
private regionElements;
|
|
1990
|
-
private command;
|
|
1991
|
-
}
|
|
1992
|
-
declare const digitalContentStepService: DigitalContentStepService;
|
|
1993
|
-
|
|
1994
|
-
declare class MockWorkflowManager implements WorkflowManager {
|
|
2319
|
+
export class MockWorkflowManager implements WorkflowManager {
|
|
1995
2320
|
getInitializationPromise(): Promise<void>;
|
|
1996
2321
|
getProduct: () => Product;
|
|
1997
2322
|
isInitialized(): boolean;
|
|
1998
|
-
getCommandContext: () =>
|
|
2323
|
+
getCommandContext: () => _CommandContext1;
|
|
1999
2324
|
getAllLayoutData: () => LayoutState[];
|
|
2000
2325
|
getMetadata: (stepName: string) => StepMetadata | undefined;
|
|
2001
2326
|
getWorkflowMetadata: () => WorkflowMetadata;
|
|
2002
|
-
getStepStorage: (stepName: string) =>
|
|
2327
|
+
getStepStorage: (stepName: string) => _StepStorage1 | undefined;
|
|
2003
2328
|
getInformationResults(): InformationResult[];
|
|
2004
2329
|
getVariationRecords(): VariationRecord[];
|
|
2005
2330
|
reset(): Promise<void>;
|
|
2006
|
-
updateStateWithServer(_getReducerState: () =>
|
|
2331
|
+
updateStateWithServer(_getReducerState: () => _CommandState1): void;
|
|
2007
2332
|
addVariationRecord(_variationRecord: Omit<VariationRecord, "recordNumber">): {
|
|
2008
2333
|
recordNumber: number;
|
|
2009
2334
|
transactionId: string;
|
|
@@ -2012,7 +2337,7 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
2012
2337
|
getCurrentVariationRecord(): undefined;
|
|
2013
2338
|
removeVariationRecord(_recordNumber: number): never[];
|
|
2014
2339
|
outstandingRequestsPromise(): Promise<void>;
|
|
2015
|
-
updateStateWithServerImmediate(_getReducerState: () =>
|
|
2340
|
+
updateStateWithServerImmediate(_getReducerState: () => _CommandState1): Promise<void>;
|
|
2016
2341
|
addPoller(_poller: Poller): void;
|
|
2017
2342
|
addConfirmCallback(_callback: ConfirmCallback): void;
|
|
2018
2343
|
addCurrentVariationCallback(_callback: CurrentVariationRecordCallback): void;
|
|
@@ -2027,7 +2352,7 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
2027
2352
|
addStepSpecificStorageCallback(_callback: StepSpecificStorageCallback, _stepName: string): void;
|
|
2028
2353
|
addStorageCallback(_callback: StorageCallback): void;
|
|
2029
2354
|
addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
|
|
2030
|
-
getCommandDispatcher(): (_command:
|
|
2355
|
+
getCommandDispatcher(): (_command: _CanvasCommand1) => void;
|
|
2031
2356
|
getLayouts(): never[];
|
|
2032
2357
|
getLayoutPreviewService(): {
|
|
2033
2358
|
getAll: () => Map<any, any>;
|
|
@@ -2065,288 +2390,17 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
2065
2390
|
setEditedStatus(_stepName: string, _status: boolean): void;
|
|
2066
2391
|
setInformationResults(_results: InformationResult[]): void;
|
|
2067
2392
|
setMandatoryFulfilled(_stepName: string, _status: boolean): void;
|
|
2068
|
-
setSelectionsAndElements(_stepName: string, _variants:
|
|
2393
|
+
setSelectionsAndElements(_stepName: string, _variants: _VariantResource1[], _elements: RegionElement[]): Promise<void>;
|
|
2069
2394
|
setVariationRecords(_variationRecords: VariationRecord[]): void;
|
|
2070
2395
|
toggleDesignConfirmed(): void;
|
|
2071
2396
|
updateMetadata(_stepName: string, _update: any): void;
|
|
2072
|
-
updateStorage(_stepName: string, _update:
|
|
2397
|
+
updateStorage(_stepName: string, _update: _StepStorage1): Promise<void>;
|
|
2073
2398
|
injectIntoPreviewService(_previewService: any): Promise<void>;
|
|
2074
2399
|
ejectFromPreviewService(): void;
|
|
2075
2400
|
}
|
|
2401
|
+
export const TransformWrapper: React.FunctionComponent;
|
|
2402
|
+
export { CommandContext };
|
|
2403
|
+
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 };
|
|
2404
|
+
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, Theme, VariantResource, Workflow };
|
|
2076
2405
|
|
|
2077
|
-
|
|
2078
|
-
data: DesignInputStepData;
|
|
2079
|
-
name: string;
|
|
2080
|
-
}
|
|
2081
|
-
interface DesignInputStepData {
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
declare const generateCommands: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<CanvasCommand[]>;
|
|
2085
|
-
|
|
2086
|
-
declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
|
|
2087
|
-
constructor(manager: WorkflowManager, step: Step<IllustrationStepData>);
|
|
2088
|
-
/**
|
|
2089
|
-
* Allows for select a vector from the available vectors configured on this steps base option.
|
|
2090
|
-
* @param variant The new vector variant to use for this step.
|
|
2091
|
-
* @returns A promise that can be awaited to know when the new vector asset has been updated on the design.
|
|
2092
|
-
*/
|
|
2093
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2094
|
-
/**
|
|
2095
|
-
* Get colors for the illustration.
|
|
2096
|
-
* @returns A list of color definitions that are currently applied to the illustration.
|
|
2097
|
-
*/
|
|
2098
|
-
getColors(): {
|
|
2099
|
-
[key: string]: _spiffcommerce_papyrus.ColorDefinition;
|
|
2100
|
-
} | undefined;
|
|
2101
|
-
/**
|
|
2102
|
-
* Set color for the illustration.
|
|
2103
|
-
*/
|
|
2104
|
-
setColor(key: string, value: string): Promise<void>;
|
|
2105
|
-
getColorOption(): Promise<_spiffcommerce_papyrus.OptionResource | undefined>;
|
|
2106
|
-
getAvailableColors(): Promise<{
|
|
2107
|
-
fill: string | undefined;
|
|
2108
|
-
stroke: string | undefined;
|
|
2109
|
-
variant: _spiffcommerce_papyrus.VariantResource;
|
|
2110
|
-
}[] | undefined>;
|
|
2111
|
-
hasVaryingSelection(): boolean | undefined;
|
|
2112
|
-
hasVaryingColors(): boolean | undefined;
|
|
2113
|
-
isColorPickerEnabled(): boolean | undefined;
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2116
|
-
interface TextChangeResult {
|
|
2117
|
-
input: string;
|
|
2118
|
-
helperText?: string;
|
|
2119
|
-
errorText?: string;
|
|
2120
|
-
}
|
|
2121
|
-
declare class TextStepHandle extends StepHandle<TextStepData> {
|
|
2122
|
-
constructor(manager: WorkflowManager, step: Step<TextStepData>);
|
|
2123
|
-
/**
|
|
2124
|
-
* Allows for select a font from the available fonts configured on this steps base option.
|
|
2125
|
-
* @param variant The font variant to use.
|
|
2126
|
-
*/
|
|
2127
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2128
|
-
/**
|
|
2129
|
-
* @returns A list of colors that can be used to fill the text.
|
|
2130
|
-
*/
|
|
2131
|
-
getAvailableFillColors(): ColorOption[];
|
|
2132
|
-
/**
|
|
2133
|
-
* Changes the fill of text related to this step to the new fill value.
|
|
2134
|
-
* @param fill A new fill value to use.
|
|
2135
|
-
*/
|
|
2136
|
-
setFillColor(fill: ColorOption): Promise<void>;
|
|
2137
|
-
/**
|
|
2138
|
-
* Gets the color currently applied to the element.
|
|
2139
|
-
*/
|
|
2140
|
-
getFillColor(): string;
|
|
2141
|
-
getAvailableFillImages(): Promise<TextFillImage[]>;
|
|
2142
|
-
setFillImage(fillImage: TextFillImage): Promise<void>;
|
|
2143
|
-
getFillImage(): TextFillImage | undefined;
|
|
2144
|
-
/**
|
|
2145
|
-
* When true & the step has replaceable text configured the user will be
|
|
2146
|
-
* abled to edit the entire text string including the non-replaceable text.
|
|
2147
|
-
* @param shouldCustomizeAll When true the user can configure the entire text string.
|
|
2148
|
-
*/
|
|
2149
|
-
setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
|
|
2150
|
-
/**
|
|
2151
|
-
* Changes the text value of text related to this step to a new value.
|
|
2152
|
-
* @param userInput Input from the user.
|
|
2153
|
-
*/
|
|
2154
|
-
setText(userInput: string): TextChangeResult;
|
|
2155
|
-
/**
|
|
2156
|
-
* Gets the text currently applied to the elements of this step.
|
|
2157
|
-
*/
|
|
2158
|
-
getText(): string;
|
|
2159
|
-
isReplaceable(): boolean | undefined;
|
|
2160
|
-
/**
|
|
2161
|
-
* Inform the step that now is the time to
|
|
2162
|
-
* clear default text if it should do so.
|
|
2163
|
-
* Returns a text change rwsult if a clear occurred.
|
|
2164
|
-
*/
|
|
2165
|
-
clearDefaultTextIfNecessary(): TextChangeResult | undefined;
|
|
2166
|
-
hasVaryingText(): boolean | undefined;
|
|
2167
|
-
hasVaryingColor(): boolean | undefined;
|
|
2168
|
-
hasVaryingSelection(): boolean | undefined;
|
|
2169
|
-
hasColorPicker(): boolean | undefined;
|
|
2170
|
-
getRegions(): _spiffcommerce_papyrus.Region[];
|
|
2171
|
-
/**
|
|
2172
|
-
* Return the maximum characters allowed for
|
|
2173
|
-
* this step, or undefined if there is no limit.
|
|
2174
|
-
*/
|
|
2175
|
-
getCharacterLimit(): number | undefined;
|
|
2176
|
-
/**
|
|
2177
|
-
* Return the remaining amount of characters that
|
|
2178
|
-
* the user is allowed to add, or undefined if there is no limit.
|
|
2179
|
-
*/
|
|
2180
|
-
getCharactersRemaining(): number | undefined;
|
|
2181
|
-
}
|
|
2182
|
-
|
|
2183
|
-
declare class PictureStepHandle extends StepHandle<PictureStepData> {
|
|
2184
|
-
constructor(manager: WorkflowManager, step: Step<PictureStepData>);
|
|
2185
|
-
/**
|
|
2186
|
-
* Allows the user to select an image variant from the available variants configured on this steps base option.
|
|
2187
|
-
* @param variant The new image variant to use.
|
|
2188
|
-
* @returns A promise that can be awaited to ensure the new image asset has been updated on the design.
|
|
2189
|
-
*/
|
|
2190
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
/**
|
|
2194
|
-
* A generic base class for custom errors that assigns the name
|
|
2195
|
-
* of the error class automatically. All custom errors should extend this.
|
|
2196
|
-
*/
|
|
2197
|
-
declare abstract class CustomError extends Error {
|
|
2198
|
-
constructor(message: any);
|
|
2199
|
-
}
|
|
2200
|
-
/**
|
|
2201
|
-
* A custom class for categorising errors related to workflow configuration.
|
|
2202
|
-
*/
|
|
2203
|
-
declare abstract class ConfigurationError extends CustomError {
|
|
2204
|
-
constructor(message: any);
|
|
2205
|
-
}
|
|
2206
|
-
/**
|
|
2207
|
-
* Thrown when an option was expected but not found in the workflow configuration or
|
|
2208
|
-
* the server returned a 404 for an option we expected.
|
|
2209
|
-
*/
|
|
2210
|
-
declare class OptionNotFoundError extends ConfigurationError {
|
|
2211
|
-
readonly optionId: string;
|
|
2212
|
-
constructor(step: Step<AnyStepData>);
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Thrown when a layout is not found for a given region entity. This
|
|
2216
|
-
* can occur when panels are deleted from a workflow but steps are still relying
|
|
2217
|
-
* on the layout being present.
|
|
2218
|
-
*/
|
|
2219
|
-
declare class LayoutNotFoundError extends ConfigurationError {
|
|
2220
|
-
readonly panelId: string;
|
|
2221
|
-
constructor(region: Region);
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* Thrown when an asset is not found on a specific variant. This can occur when
|
|
2225
|
-
* the asset wasn't configured in hub and the variant is loaded in a workflow.
|
|
2226
|
-
*/
|
|
2227
|
-
declare class AssetNotFoundError extends ConfigurationError {
|
|
2228
|
-
readonly variant: VariantResource;
|
|
2229
|
-
constructor(variant: VariantResource);
|
|
2230
|
-
}
|
|
2231
|
-
/**
|
|
2232
|
-
* Thrown when a resource is not found linked to a specific asset. This
|
|
2233
|
-
* can occur when generation of a resource fails or hasn't completed. Or may be
|
|
2234
|
-
* a sign of a misconfiguration.
|
|
2235
|
-
*/
|
|
2236
|
-
declare class ResourceNotFoundError extends ConfigurationError {
|
|
2237
|
-
readonly asset: Asset;
|
|
2238
|
-
constructor(asset: Asset);
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Thrown when configuration is missing when it was expected. More generic
|
|
2242
|
-
* to cover remaining cases outside of the more specific ones such as options, variants & assets.
|
|
2243
|
-
*/
|
|
2244
|
-
declare class MisconfigurationError extends ConfigurationError {
|
|
2245
|
-
readonly step: Step<AnyStepData>;
|
|
2246
|
-
constructor(step: Step<AnyStepData>, message: string);
|
|
2247
|
-
}
|
|
2248
|
-
/**
|
|
2249
|
-
* A custom class for categorising errors related to implementation of core.
|
|
2250
|
-
*/
|
|
2251
|
-
declare abstract class ImplementationError extends CustomError {
|
|
2252
|
-
constructor(message: any);
|
|
2253
|
-
}
|
|
2254
|
-
/**
|
|
2255
|
-
* Thrown when we hit a case that we didn't expect to happen
|
|
2256
|
-
*/
|
|
2257
|
-
declare class UnhandledBehaviorError extends ImplementationError {
|
|
2258
|
-
constructor(message: string);
|
|
2259
|
-
}
|
|
2260
|
-
/**
|
|
2261
|
-
* Thrown when we fail to parse something that we expected to be valid
|
|
2262
|
-
*/
|
|
2263
|
-
declare class ParseError extends ImplementationError {
|
|
2264
|
-
constructor(message: string);
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
declare class ModelStepHandle extends StepHandle<ModelStepData> {
|
|
2268
|
-
constructor(manager: WorkflowManager, step: Step<ModelStepData>);
|
|
2269
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2270
|
-
}
|
|
2271
|
-
|
|
2272
|
-
declare enum FrameStep {
|
|
2273
|
-
SelectFrame = "SelectFrame",
|
|
2274
|
-
SelectImage = "SelectImage",
|
|
2275
|
-
Position = "Position"
|
|
2276
|
-
}
|
|
2277
|
-
declare class FrameStepHandle extends StepHandle<FrameStepData> {
|
|
2278
|
-
constructor(manager: WorkflowManager, step: Step<FrameStepData>);
|
|
2279
|
-
private frameService;
|
|
2280
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2281
|
-
onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
|
|
2282
|
-
selectImage(asset: Asset): void;
|
|
2283
|
-
getImageData(): PatternImageData | undefined;
|
|
2284
|
-
getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
|
|
2285
|
-
getFrameService(): FrameService | undefined;
|
|
2286
|
-
hasOverlayImageKey(): string | undefined;
|
|
2287
|
-
hasOverlayImageUrl(): any;
|
|
2288
|
-
hasVaryingUpload(): boolean | undefined;
|
|
2289
|
-
hasVaryingSelection(): boolean | undefined;
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
|
|
2293
|
-
constructor(manager: WorkflowManager, step: Step<MaterialStepData>);
|
|
2294
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
declare class QuestionStepHandle extends StepHandle<QuestionStepData> {
|
|
2298
|
-
constructor(manager: WorkflowManager, step: Step<QuestionStepData>);
|
|
2299
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2300
|
-
/**
|
|
2301
|
-
* The way that this step expects to be rendered.
|
|
2302
|
-
*/
|
|
2303
|
-
getDisplayType(): string | undefined;
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
declare class ShapeStepHandle extends StepHandle<ShapeStepData> {
|
|
2307
|
-
constructor(manager: WorkflowManager, step: Step<ShapeStepData>);
|
|
2308
|
-
selectVariant(variant: Variant): Promise<void>;
|
|
2309
|
-
/**
|
|
2310
|
-
* Sets the color of the shape.
|
|
2311
|
-
* @param color The color option to use.
|
|
2312
|
-
* @returns A promise resolving when the color has changed in the design.
|
|
2313
|
-
* @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
|
|
2314
|
-
*/
|
|
2315
|
-
setColor(color: ColorOption): Promise<void>;
|
|
2316
|
-
/**
|
|
2317
|
-
* Get available colors for the shape.
|
|
2318
|
-
* @returns A list of color definitions that are currently applied to the illustration.
|
|
2319
|
-
*/
|
|
2320
|
-
getColors(): Promise<{
|
|
2321
|
-
fill: string | undefined;
|
|
2322
|
-
stroke: string | undefined;
|
|
2323
|
-
variant: _spiffcommerce_papyrus.VariantResource;
|
|
2324
|
-
}[]>;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
declare class BulkStepHandle extends StepHandle<BulkStepData> {
|
|
2328
|
-
constructor(manager: WorkflowManager, step: Step<BulkStepData>);
|
|
2329
|
-
private transaction;
|
|
2330
|
-
selectVariant(): Promise<void>;
|
|
2331
|
-
setDesignName(designName: string): Promise<void>;
|
|
2332
|
-
addVariationRecord(): VariationRecord;
|
|
2333
|
-
updateBulkIsConnected(bulkIsConnected: boolean): void;
|
|
2334
|
-
/**
|
|
2335
|
-
* Opens the bulk source in a seperate tab. This bulk source could be a google sheet or a csv file.
|
|
2336
|
-
*/
|
|
2337
|
-
openBulkSourceUrl(): void;
|
|
2338
|
-
sendGoogleSheetLinkToEmail(email: string): Promise<void>;
|
|
2339
|
-
/**
|
|
2340
|
-
* Removes a variation from the bulk step.
|
|
2341
|
-
* @param recordNumber The record number of the variation to remove.
|
|
2342
|
-
*/
|
|
2343
|
-
deleteVariationRecord(recordNumber: number): void;
|
|
2344
|
-
/**
|
|
2345
|
-
* @returns The aspects of each step that are modifiable from the bulk handle. These are configured in the workflow.
|
|
2346
|
-
*/
|
|
2347
|
-
getAspects(): _spiffcommerce_papyrus.StepAspect[];
|
|
2348
|
-
}
|
|
2349
|
-
|
|
2350
|
-
declare const shortenUrl: (longUrl: string) => Promise<string>;
|
|
2351
|
-
|
|
2352
|
-
export { AssetNotFoundError, BulkPriceCalculationStrategy, BulkStepHandle, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FrameService, FrameStep, FrameStepHandle, GetWorkflowOptions, IllustrationStepHandle, InformationMessageType, InformationResult, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, ProductCameraRig, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SpiffCommerceClient, Stakeholder, StakeholderType, StepElements, StepHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, UnhandledBehaviorError, Variant, VariationRecord, WorkflowExperience, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, gatherVaryingStepAspects, generateCommands, getBoundedOffsets, getWorkflow, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, textStepService, toast };
|
|
2406
|
+
//# sourceMappingURL=types.d.ts.map
|