@spiffcommerce/core 14.2.3-alpha.0 → 14.2.5-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{types.d.ts → index.d.mts} +795 -828
- package/dist/index.mjs +55485 -0
- package/dist/index.umd.js +2851 -0
- package/package.json +15 -57
- package/dist/main.js +0 -1357
- package/dist/module.js +0 -1357
|
@@ -1,11 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
|
|
2
|
+
import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, StepStorage, CanvasCommand, CommandContext, ILayout, LayoutState, SerializableStep, Workflow, CommandState, GlobalPropertyConfiguration, LayoutsState, Asset, MaterialResource, AssetType, StepType, GlobalPropertyConfigurationAspect, AspectType, Theme, StepAspect, FrameStepData, CreateElementCommand, FrameElement, IllustrationStepData, IllustrationElement, ColorDefinition, LayoutData, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, BulkStepData } from '@spiffcommerce/papyrus';
|
|
3
|
+
export { Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, BringToBackCommand, BringToFrontCommand, BulkStepData, CanvasCommand, ColorDefinition, ColorProfileProps, CommandContext, CommandState, CreateElementCommand, CreateLayoutCommand, 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, Theme, UnitOfMeasurement, VariantResource, Workflow, WorkflowPanel, dataUrlFromExternalUrl, determineCorrectFontSizeAndLines, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getAxisAlignedBoundingBox, getFrameData, getSvgElement, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, registerJSDOM, rehydrateSerializedLayout } from '@spiffcommerce/papyrus';
|
|
4
|
+
import { ApolloClient } from '@apollo/client/core';
|
|
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
|
+
|
|
5
30
|
/**
|
|
6
31
|
* A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
|
|
7
32
|
*/
|
|
8
|
-
|
|
33
|
+
interface RenderableScene {
|
|
9
34
|
/**
|
|
10
35
|
* The id of the scene.
|
|
11
36
|
*/
|
|
@@ -23,7 +48,7 @@ export interface RenderableScene {
|
|
|
23
48
|
* Information parsed froma workflow structure that is relevant
|
|
24
49
|
* to a given scene.
|
|
25
50
|
*/
|
|
26
|
-
|
|
51
|
+
interface WorkflowScene {
|
|
27
52
|
/**
|
|
28
53
|
* A unique identifier for the scene.
|
|
29
54
|
*/
|
|
@@ -36,18 +61,19 @@ export interface WorkflowScene {
|
|
|
36
61
|
* Steps which can display to the user.
|
|
37
62
|
* But may be conditionally hidden based on workflow logic
|
|
38
63
|
*/
|
|
39
|
-
renderableSteps:
|
|
64
|
+
renderableSteps: Step<AnyStepData>[];
|
|
40
65
|
/**
|
|
41
66
|
* Steps which don't display to the user.
|
|
42
67
|
* Their behavior is always silent & executed in the background.
|
|
43
68
|
*/
|
|
44
|
-
silentSteps:
|
|
69
|
+
silentSteps: Step<AnyStepData>[];
|
|
45
70
|
}
|
|
71
|
+
|
|
46
72
|
/**
|
|
47
73
|
* A queue promise is a container for a promise that can be
|
|
48
74
|
* executed at a later time.
|
|
49
75
|
*/
|
|
50
|
-
|
|
76
|
+
declare abstract class QueueablePromise {
|
|
51
77
|
readonly timestamp: number;
|
|
52
78
|
abstract execute(): Promise<any>;
|
|
53
79
|
}
|
|
@@ -56,7 +82,10 @@ export abstract class QueueablePromise {
|
|
|
56
82
|
* as quickly as possible in order. This is ideal in situations where a specific operation should be
|
|
57
83
|
* applied in an ordered way while still making.
|
|
58
84
|
*/
|
|
59
|
-
|
|
85
|
+
declare class PromiseQueue<T extends QueueablePromise> {
|
|
86
|
+
private queue;
|
|
87
|
+
private activePromise?;
|
|
88
|
+
private queueMaxSize;
|
|
60
89
|
/**
|
|
61
90
|
* Constructs a new promise queue.
|
|
62
91
|
* @param queueMaxSize An optional maximum size, when the max size is hit.
|
|
@@ -81,80 +110,13 @@ export class PromiseQueue<T extends QueueablePromise> {
|
|
|
81
110
|
* in the promise being extended.
|
|
82
111
|
*/
|
|
83
112
|
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;
|
|
84
118
|
}
|
|
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
|
-
}
|
|
119
|
+
|
|
158
120
|
/**
|
|
159
121
|
* Bounds the offsets for an image to the box, preventing
|
|
160
122
|
* the user from moving the image in a way that wouldn't be intended.
|
|
@@ -163,8 +125,14 @@ export class ParseError extends ImplementationError {
|
|
|
163
125
|
* @param borderWidth The width of the border added by the cropper.
|
|
164
126
|
* @param mustCover When true the image sgould be bounded in such a way that it covers the entire frame at all times.
|
|
165
127
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
128
|
+
declare function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
|
|
129
|
+
declare class FrameService {
|
|
130
|
+
private offsets;
|
|
131
|
+
private forceImageCover?;
|
|
132
|
+
private targetElements;
|
|
133
|
+
private imageData?;
|
|
134
|
+
private frameData?;
|
|
135
|
+
private readonly _debouncedUpdateFrameOffsets;
|
|
168
136
|
/**
|
|
169
137
|
* The calculated minimum zoom value, per frame.
|
|
170
138
|
*/
|
|
@@ -173,6 +141,10 @@ export class FrameService {
|
|
|
173
141
|
* The calculated maximum zoom value. Note: This is calculated based on the first frame.
|
|
174
142
|
*/
|
|
175
143
|
maxZoomScale: number[];
|
|
144
|
+
private onFrameDataChangeListeners;
|
|
145
|
+
private onZoomChangeListeners;
|
|
146
|
+
private workflowManager?;
|
|
147
|
+
private stepName?;
|
|
176
148
|
constructor(forceImageCover?: boolean);
|
|
177
149
|
/**
|
|
178
150
|
* When we want to connect a workflow manager to the state of the image cropper we
|
|
@@ -237,8 +209,33 @@ export class FrameService {
|
|
|
237
209
|
* @param newListener
|
|
238
210
|
*/
|
|
239
211
|
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;
|
|
240
228
|
}
|
|
229
|
+
|
|
241
230
|
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;
|
|
242
239
|
/**
|
|
243
240
|
* Constructs a new polling service.
|
|
244
241
|
* @param predicate An async function that returns true when polling has returned a successful result.
|
|
@@ -249,152 +246,7 @@ declare class Poller {
|
|
|
249
246
|
*/
|
|
250
247
|
constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
|
|
251
248
|
}
|
|
252
|
-
|
|
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;
|
|
249
|
+
|
|
398
250
|
declare abstract class ModuleProduct {
|
|
399
251
|
/**
|
|
400
252
|
* Name used by class. Usually product or brand name.
|
|
@@ -409,36 +261,37 @@ declare abstract class ModuleProduct {
|
|
|
409
261
|
*/
|
|
410
262
|
abstract svgPrint(text: string, region: Region): string;
|
|
411
263
|
}
|
|
412
|
-
|
|
264
|
+
|
|
265
|
+
interface EditedSteps {
|
|
413
266
|
[stepName: string]: boolean;
|
|
414
267
|
}
|
|
415
|
-
|
|
268
|
+
interface MandatorySteps {
|
|
416
269
|
[stepName: string]: boolean;
|
|
417
270
|
}
|
|
418
|
-
|
|
271
|
+
type StepElements = {
|
|
419
272
|
[key: string]: RegionElement[];
|
|
420
273
|
};
|
|
421
274
|
type StepInitialised = {
|
|
422
275
|
[key: string]: boolean;
|
|
423
276
|
};
|
|
424
277
|
type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
|
|
425
|
-
|
|
426
|
-
[stepName: string]:
|
|
278
|
+
interface WorkflowStorage {
|
|
279
|
+
[stepName: string]: StepStorage;
|
|
427
280
|
}
|
|
428
|
-
|
|
281
|
+
interface WorkflowMetadata {
|
|
429
282
|
[stepName: string]: StepMetadata;
|
|
430
283
|
}
|
|
431
|
-
|
|
284
|
+
interface WorkflowSelections {
|
|
432
285
|
[stepName: string]: {
|
|
433
|
-
selections:
|
|
286
|
+
selections: VariantResource[];
|
|
434
287
|
};
|
|
435
288
|
}
|
|
436
|
-
|
|
289
|
+
interface InformationResult {
|
|
437
290
|
message: string;
|
|
438
291
|
messageType: InformationMessageType;
|
|
439
292
|
stepID: string;
|
|
440
293
|
}
|
|
441
|
-
|
|
294
|
+
declare enum InformationMessageType {
|
|
442
295
|
Error = "Error",
|
|
443
296
|
Warning = "Warning",
|
|
444
297
|
Info = "Info"
|
|
@@ -450,7 +303,7 @@ interface StepSpecificServices {
|
|
|
450
303
|
frameService?: FrameService;
|
|
451
304
|
module?: ModuleProduct;
|
|
452
305
|
}
|
|
453
|
-
|
|
306
|
+
type DesignCreationProgressUpdate = (message: string) => void;
|
|
454
307
|
type ConfirmCallback = (isConfirmed: boolean) => void;
|
|
455
308
|
type EditedCallback = (editedSteps: EditedSteps) => void;
|
|
456
309
|
type ElementsCallback = (elements: StepElements) => void;
|
|
@@ -465,11 +318,11 @@ type SelectionCallback = (callbackOptions: {
|
|
|
465
318
|
selections: StepSelections;
|
|
466
319
|
traversableScenes: WorkflowScene[];
|
|
467
320
|
}) => void;
|
|
468
|
-
type StepSpecificStorageCallback = (selections:
|
|
321
|
+
type StepSpecificStorageCallback = (selections: StepStorage) => void;
|
|
469
322
|
type StorageCallback = (storage: WorkflowStorage) => void;
|
|
470
323
|
type CurrentVariationRecordCallback = (variationRecord: null | VariationRecord) => void;
|
|
471
324
|
type VariationRecordsCallback = (records: VariationRecord[]) => void;
|
|
472
|
-
|
|
325
|
+
interface WorkflowManager {
|
|
473
326
|
addPoller: (poller: Poller) => void;
|
|
474
327
|
addConfirmCallback: (callback: ConfirmCallback) => void;
|
|
475
328
|
addCurrentVariationCallback: (callback: CurrentVariationRecordCallback) => void;
|
|
@@ -485,11 +338,11 @@ export interface WorkflowManager {
|
|
|
485
338
|
addStorageCallback: (callback: StorageCallback) => void;
|
|
486
339
|
addVariationRecord: (variationRecord: Omit<VariationRecord, "recordNumber">) => VariationRecord;
|
|
487
340
|
addVariationRecordsCallback: (callback: VariationRecordsCallback) => void;
|
|
488
|
-
getCommandDispatcher: () => (command:
|
|
341
|
+
getCommandDispatcher: () => (command: CanvasCommand) => void;
|
|
489
342
|
getCurrentVariationRecord: () => VariationRecord | undefined;
|
|
490
343
|
getVariationRecords: () => VariationRecord[];
|
|
491
|
-
getCommandContext: () =>
|
|
492
|
-
getLayouts: () =>
|
|
344
|
+
getCommandContext: () => CommandContext;
|
|
345
|
+
getLayouts: () => ILayout[];
|
|
493
346
|
getAllLayoutData: () => LayoutState[];
|
|
494
347
|
getLayoutPreviewService: () => any | undefined;
|
|
495
348
|
getPreviewService: () => any | undefined;
|
|
@@ -497,7 +350,7 @@ export interface WorkflowManager {
|
|
|
497
350
|
getRegionElements: (stepName: string) => RegionElement[];
|
|
498
351
|
getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
|
|
499
352
|
getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
|
|
500
|
-
getStepStorage: (stepName: string) =>
|
|
353
|
+
getStepStorage: (stepName: string) => StepStorage | undefined;
|
|
501
354
|
getMetadata: (stepName: string) => StepMetadata | undefined;
|
|
502
355
|
getWorkflowMetadata: () => WorkflowMetadata;
|
|
503
356
|
getInformationResults(): InformationResult[];
|
|
@@ -510,7 +363,7 @@ export interface WorkflowManager {
|
|
|
510
363
|
setTransactionCustomerDetails: (details: {
|
|
511
364
|
email: string;
|
|
512
365
|
}) => void;
|
|
513
|
-
getWorkflow: () =>
|
|
366
|
+
getWorkflow: () => Workflow;
|
|
514
367
|
getWorkflowSelections: () => WorkflowSelections;
|
|
515
368
|
getProduct: () => Product;
|
|
516
369
|
/**
|
|
@@ -536,15 +389,15 @@ export interface WorkflowManager {
|
|
|
536
389
|
setEditedStatus: (stepName: string, status: boolean) => void;
|
|
537
390
|
setInformationResults: (results: InformationResult[]) => void;
|
|
538
391
|
setMandatoryFulfilled: (stepName: string, status: boolean) => void;
|
|
539
|
-
setSelectionsAndElements: (stepName: string, variants:
|
|
392
|
+
setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
|
|
540
393
|
setVariationRecords: (variationRecords: VariationRecord[]) => void;
|
|
541
394
|
toggleDesignConfirmed: () => void;
|
|
542
395
|
updateMetadata: (stepName: string, update: any) => void;
|
|
543
396
|
/**
|
|
544
397
|
* @deprecated State updates are being pulled internally. This function will be removed in the future.
|
|
545
398
|
*/
|
|
546
|
-
updateStateWithServerImmediate: (getReducerState: () =>
|
|
547
|
-
updateStorage: (stepName: string, update:
|
|
399
|
+
updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
|
|
400
|
+
updateStorage: (stepName: string, update: StepStorage) => Promise<void>;
|
|
548
401
|
getModelContainer: () => any | undefined;
|
|
549
402
|
setModelContainer: (container: any) => void;
|
|
550
403
|
/**
|
|
@@ -558,11 +411,12 @@ export interface WorkflowManager {
|
|
|
558
411
|
*/
|
|
559
412
|
ejectFromPreviewService(): void;
|
|
560
413
|
}
|
|
561
|
-
|
|
414
|
+
|
|
415
|
+
interface StepService<T extends AnyStepData> {
|
|
562
416
|
/**
|
|
563
417
|
* Initialize the given step, or reload from serialized data if present.
|
|
564
418
|
*/
|
|
565
|
-
init(stepData:
|
|
419
|
+
init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
|
|
566
420
|
}
|
|
567
421
|
interface FileInfo {
|
|
568
422
|
/**
|
|
@@ -579,7 +433,7 @@ interface FileInfo {
|
|
|
579
433
|
* A command along with a function to run afterwards.
|
|
580
434
|
*/
|
|
581
435
|
interface CommandWithFollowup {
|
|
582
|
-
command?:
|
|
436
|
+
command?: CanvasCommand;
|
|
583
437
|
followup?: () => Promise<void>;
|
|
584
438
|
}
|
|
585
439
|
/**
|
|
@@ -598,7 +452,7 @@ interface ExportedData {
|
|
|
598
452
|
priceModifier: number;
|
|
599
453
|
};
|
|
600
454
|
}
|
|
601
|
-
|
|
455
|
+
interface DesignCreationMessage {
|
|
602
456
|
baseCost?: number;
|
|
603
457
|
designProductId?: string;
|
|
604
458
|
designProductVariantId?: string;
|
|
@@ -623,7 +477,7 @@ export interface DesignCreationMessage {
|
|
|
623
477
|
/**
|
|
624
478
|
* Represents a transaction.
|
|
625
479
|
*/
|
|
626
|
-
|
|
480
|
+
interface Transaction {
|
|
627
481
|
/**
|
|
628
482
|
* A unique identifier for this transaction. Useful for reloading and
|
|
629
483
|
* modifying state of the transaction.
|
|
@@ -869,18 +723,18 @@ interface ProductTag {
|
|
|
869
723
|
id: string;
|
|
870
724
|
name: string;
|
|
871
725
|
}
|
|
872
|
-
|
|
726
|
+
interface ColorOption {
|
|
873
727
|
id?: string;
|
|
874
728
|
fill?: string;
|
|
875
729
|
stroke?: string;
|
|
876
|
-
variant?:
|
|
730
|
+
variant?: VariantResource;
|
|
877
731
|
colorProfileAssetKey?: string;
|
|
878
732
|
}
|
|
879
733
|
/**
|
|
880
734
|
* Represents a variation as seen in Google sheets.
|
|
881
735
|
* Record number = row# - 1
|
|
882
736
|
*/
|
|
883
|
-
|
|
737
|
+
interface VariationRecord {
|
|
884
738
|
recordNumber: number;
|
|
885
739
|
transactionId: string;
|
|
886
740
|
values: {
|
|
@@ -889,7 +743,7 @@ export interface VariationRecord {
|
|
|
889
743
|
value: string;
|
|
890
744
|
}[];
|
|
891
745
|
}
|
|
892
|
-
|
|
746
|
+
interface RegionElement {
|
|
893
747
|
id: string;
|
|
894
748
|
region?: Region;
|
|
895
749
|
}
|
|
@@ -907,10 +761,10 @@ interface TextMetadata {
|
|
|
907
761
|
text: string;
|
|
908
762
|
fillImage?: string;
|
|
909
763
|
}
|
|
910
|
-
|
|
911
|
-
selectedVariants?:
|
|
764
|
+
interface SelectionStorage {
|
|
765
|
+
selectedVariants?: VariantResource[];
|
|
912
766
|
}
|
|
913
|
-
|
|
767
|
+
interface TextStepStorage extends SelectionStorage {
|
|
914
768
|
color?: string;
|
|
915
769
|
defaultCleared?: boolean;
|
|
916
770
|
inputText?: string;
|
|
@@ -938,7 +792,7 @@ interface FrameData {
|
|
|
938
792
|
* Defines the different behaviors supported by the camera system
|
|
939
793
|
* for control when viewing a product.
|
|
940
794
|
*/
|
|
941
|
-
|
|
795
|
+
declare enum ProductCameraRig {
|
|
942
796
|
Orbit = 0,
|
|
943
797
|
Pan = 1
|
|
944
798
|
}
|
|
@@ -946,7 +800,7 @@ export enum ProductCameraRig {
|
|
|
946
800
|
* Defines the different strategies to use when calculating the total price
|
|
947
801
|
* when creating bulk designs.
|
|
948
802
|
*/
|
|
949
|
-
|
|
803
|
+
declare enum BulkPriceCalculationStrategy {
|
|
950
804
|
/** The total price should increase with the amount of variations. */
|
|
951
805
|
PerVariation = "PerVariation",
|
|
952
806
|
/** The total price should remain at the base price of the product. */
|
|
@@ -965,7 +819,7 @@ interface BulkConfiguration {
|
|
|
965
819
|
/**
|
|
966
820
|
* Defines the locations at which a conversion attempt can take place.
|
|
967
821
|
*/
|
|
968
|
-
|
|
822
|
+
declare enum ConversionLocation {
|
|
969
823
|
/**
|
|
970
824
|
* The client should expose a flow for allowing the user to optionally input details at any point.
|
|
971
825
|
*/
|
|
@@ -986,20 +840,20 @@ export enum ConversionLocation {
|
|
|
986
840
|
/**
|
|
987
841
|
* The data configured to be requested.
|
|
988
842
|
*/
|
|
989
|
-
|
|
843
|
+
declare enum ConversionDataType {
|
|
990
844
|
Email = "Email",
|
|
991
845
|
FirstName = "FirstName",
|
|
992
846
|
LastName = "LastName",
|
|
993
847
|
Phone = "Phone"
|
|
994
848
|
}
|
|
995
|
-
|
|
849
|
+
interface ConversionData {
|
|
996
850
|
type: ConversionDataType;
|
|
997
851
|
mandatory: boolean;
|
|
998
852
|
}
|
|
999
853
|
/**
|
|
1000
854
|
* The configuration for conversion, exposed on products currently.
|
|
1001
855
|
*/
|
|
1002
|
-
|
|
856
|
+
interface ConversionConfiguration {
|
|
1003
857
|
id: string;
|
|
1004
858
|
name?: string;
|
|
1005
859
|
locations: ConversionLocation[];
|
|
@@ -1010,7 +864,7 @@ export interface ConversionConfiguration {
|
|
|
1010
864
|
/**
|
|
1011
865
|
* Someone who has used a workflow experience and entered their contact details.
|
|
1012
866
|
*/
|
|
1013
|
-
|
|
867
|
+
interface Customer {
|
|
1014
868
|
id?: string;
|
|
1015
869
|
emailAddress: string;
|
|
1016
870
|
firstName?: string;
|
|
@@ -1021,25 +875,25 @@ export interface Customer {
|
|
|
1021
875
|
stakeholders?: Stakeholder[];
|
|
1022
876
|
bundleStakeholders?: BundleStakeholder[];
|
|
1023
877
|
}
|
|
1024
|
-
|
|
878
|
+
interface CustomerDetailsInput {
|
|
1025
879
|
emailAddress: string;
|
|
1026
880
|
firstName?: string;
|
|
1027
881
|
lastName?: string;
|
|
1028
882
|
phoneNumber?: string;
|
|
1029
883
|
}
|
|
1030
|
-
|
|
884
|
+
declare enum StakeholderType {
|
|
1031
885
|
Owner = "Owner",
|
|
1032
886
|
Approver = "Approver",
|
|
1033
887
|
Editor = "Editor",
|
|
1034
888
|
Viewer = "Viewer"
|
|
1035
889
|
}
|
|
1036
|
-
|
|
890
|
+
interface Stakeholder {
|
|
1037
891
|
id: string;
|
|
1038
892
|
type?: StakeholderType;
|
|
1039
893
|
transaction?: Transaction;
|
|
1040
894
|
customer?: Customer;
|
|
1041
895
|
}
|
|
1042
|
-
interface Bundle {
|
|
896
|
+
interface Bundle$1 {
|
|
1043
897
|
id?: string;
|
|
1044
898
|
bundleOwnerId?: string;
|
|
1045
899
|
bundleStakeholders?: BundleStakeholder[];
|
|
@@ -1054,7 +908,7 @@ interface Bundle {
|
|
|
1054
908
|
}
|
|
1055
909
|
interface BundleStakeholder {
|
|
1056
910
|
id: string;
|
|
1057
|
-
bundle?: Bundle;
|
|
911
|
+
bundle?: Bundle$1;
|
|
1058
912
|
customer?: Customer;
|
|
1059
913
|
type?: StakeholderType;
|
|
1060
914
|
}
|
|
@@ -1076,41 +930,7 @@ type GlobalPropertyStateAspect = {
|
|
|
1076
930
|
name: string;
|
|
1077
931
|
value: string;
|
|
1078
932
|
};
|
|
1079
|
-
|
|
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;
|
|
933
|
+
|
|
1114
934
|
/**
|
|
1115
935
|
* An asset manager provides a way to create and
|
|
1116
936
|
* manage assets on the Spiff Commerce Platform.
|
|
@@ -1119,13 +939,15 @@ interface AssetManager {
|
|
|
1119
939
|
/**
|
|
1120
940
|
* Uploads a file to the Spiff Commerce Platform.
|
|
1121
941
|
*/
|
|
1122
|
-
uploadFile: (file: File, onProgress: (val: number) => void) => Promise<
|
|
942
|
+
uploadFile: (file: File, onProgress: (val: number) => void) => Promise<Asset>;
|
|
1123
943
|
}
|
|
1124
944
|
declare class AssetService implements AssetManager {
|
|
945
|
+
private cache;
|
|
946
|
+
private materialCache;
|
|
1125
947
|
/**
|
|
1126
948
|
* Allows for retrieving an asset, returns the option from a cache if possible.
|
|
1127
949
|
*/
|
|
1128
|
-
getLocalOrFromServer(assetKey: string): Promise<
|
|
950
|
+
getLocalOrFromServer(assetKey: string): Promise<Asset>;
|
|
1129
951
|
/**
|
|
1130
952
|
* Allows for retrieving amaterial, returns the option from a cache if possible.
|
|
1131
953
|
* @param id The option ID to be retrieved.
|
|
@@ -1135,324 +957,123 @@ declare class AssetService implements AssetManager {
|
|
|
1135
957
|
* Upload a user asset to the server. Using callbacks to notify important events.
|
|
1136
958
|
* The asset will be stored via the persistence service for future access, if available.
|
|
1137
959
|
*/
|
|
1138
|
-
uploadAssetWithProgress(file: FileInfo, assetType:
|
|
1139
|
-
uploadFile(file: File, onProgress: (val: number) => void): Promise<
|
|
960
|
+
uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
|
|
961
|
+
uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
|
|
1140
962
|
removePersistedAsset(assetKey: string): void;
|
|
1141
963
|
getPersistedAssets(): PersistedAsset[];
|
|
1142
964
|
/**
|
|
1143
965
|
* Convert a File object for an image into a FileInfo.
|
|
1144
966
|
*/
|
|
1145
967
|
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;
|
|
1146
975
|
}
|
|
1147
976
|
interface PersistedAsset {
|
|
1148
977
|
assetKey: string;
|
|
1149
978
|
src: string;
|
|
1150
979
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
980
|
+
declare const assetService: AssetService;
|
|
981
|
+
|
|
982
|
+
interface StorageService {
|
|
1153
983
|
/**
|
|
1154
|
-
*
|
|
1155
|
-
* @param
|
|
984
|
+
* Get a value.
|
|
985
|
+
* @param key The key to lookup the value with.
|
|
1156
986
|
*/
|
|
1157
|
-
|
|
1158
|
-
getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
|
|
1159
|
-
getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
|
|
1160
|
-
getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
|
|
987
|
+
get(key: string): string | undefined;
|
|
1161
988
|
/**
|
|
1162
|
-
*
|
|
989
|
+
* Set a value.
|
|
990
|
+
* @param key The key to set.
|
|
991
|
+
* @param val The new value.
|
|
1163
992
|
*/
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
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 {
|
|
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;
|
|
999
|
+
/**
|
|
1000
|
+
* Get a map from persistence.
|
|
1001
|
+
* @param key The key to search by.
|
|
1002
|
+
*/
|
|
1003
|
+
getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
|
|
1004
|
+
/**
|
|
1005
|
+
* St a map into persistence.
|
|
1006
|
+
* @param key The key to set the map at.
|
|
1007
|
+
* @param val The map to set.
|
|
1008
|
+
*/
|
|
1009
|
+
setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
|
|
1229
1010
|
}
|
|
1011
|
+
declare const persistenceService: StorageService;
|
|
1012
|
+
|
|
1230
1013
|
/**
|
|
1231
|
-
*
|
|
1014
|
+
* A wrapping component that provides a simple interface for interacting with a variant.
|
|
1232
1015
|
*/
|
|
1233
|
-
|
|
1016
|
+
declare class Variant {
|
|
1017
|
+
private readonly variantData;
|
|
1018
|
+
constructor(variant: VariantResource);
|
|
1019
|
+
getType(): AssetType | undefined;
|
|
1234
1020
|
/**
|
|
1235
|
-
* The
|
|
1021
|
+
* @returns The unique identifier for the variant.
|
|
1236
1022
|
*/
|
|
1237
|
-
|
|
1023
|
+
getId(): string;
|
|
1238
1024
|
/**
|
|
1239
|
-
*
|
|
1025
|
+
* @returns The configured name of the variant. Generally a human readable value.
|
|
1240
1026
|
*/
|
|
1241
|
-
|
|
1027
|
+
getName(): string;
|
|
1242
1028
|
/**
|
|
1243
|
-
* The
|
|
1029
|
+
* @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
|
|
1244
1030
|
*/
|
|
1245
|
-
|
|
1031
|
+
getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
|
|
1246
1032
|
/**
|
|
1247
|
-
* The
|
|
1033
|
+
* @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
|
|
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.
|
|
1248
1035
|
*/
|
|
1249
|
-
|
|
1036
|
+
getPrice(): number;
|
|
1250
1037
|
/**
|
|
1251
|
-
* The
|
|
1038
|
+
* @returns The URL for the base asset resource configured on this variant
|
|
1252
1039
|
*/
|
|
1253
|
-
|
|
1040
|
+
getAsset(): string | undefined;
|
|
1254
1041
|
/**
|
|
1255
|
-
* The
|
|
1042
|
+
* @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.
|
|
1256
1043
|
*/
|
|
1257
|
-
|
|
1044
|
+
getThumbnail(): string | undefined;
|
|
1258
1045
|
/**
|
|
1259
|
-
* The
|
|
1046
|
+
* @returns The URL for the display image configured on this variant. Can be used for things like size charts.
|
|
1260
1047
|
*/
|
|
1261
|
-
|
|
1048
|
+
getDisplayImage(): string | undefined;
|
|
1262
1049
|
/**
|
|
1263
|
-
*
|
|
1050
|
+
* @returns When this variant is configured to have a color, this will return the hex value for that color.
|
|
1264
1051
|
*/
|
|
1265
|
-
|
|
1052
|
+
getColor(): string | undefined;
|
|
1266
1053
|
/**
|
|
1267
|
-
*
|
|
1054
|
+
* @returns True when the variant is the default for its containing option. False otherwise.
|
|
1268
1055
|
*/
|
|
1269
|
-
|
|
1056
|
+
isDefault(): boolean;
|
|
1270
1057
|
/**
|
|
1271
|
-
*
|
|
1058
|
+
* @returns The underlying variant resource. Generally not needed but made available just incase.
|
|
1272
1059
|
*/
|
|
1273
|
-
|
|
1060
|
+
getResource(): VariantResource;
|
|
1274
1061
|
/**
|
|
1275
|
-
*
|
|
1276
|
-
*/
|
|
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.
|
|
1062
|
+
* @returns True when the variant is enabled. False otherwise.
|
|
1447
1063
|
*/
|
|
1448
1064
|
isEnabled(): boolean;
|
|
1449
1065
|
}
|
|
1066
|
+
|
|
1450
1067
|
/**
|
|
1451
1068
|
* A StepHandle allows for managing the state of a specific step in a workflow. This class
|
|
1452
1069
|
* abstracts away the complexities of dealing with a step directly and allows for using high level
|
|
1453
1070
|
* concepts instead of dealing with the underlying data structures.
|
|
1454
1071
|
*/
|
|
1455
|
-
|
|
1072
|
+
declare abstract class StepHandle<T extends AnyStepData> {
|
|
1073
|
+
/**
|
|
1074
|
+
* Stores whether or not the step is currently updating.
|
|
1075
|
+
*/
|
|
1076
|
+
private static readonly updateState;
|
|
1456
1077
|
/**
|
|
1457
1078
|
* Access to the workflow manager this step is contained by.
|
|
1458
1079
|
*/
|
|
@@ -1460,8 +1081,8 @@ export abstract class StepHandle<T extends _AnyStepData1> {
|
|
|
1460
1081
|
/**
|
|
1461
1082
|
* The step metadata, useful for determining logic based on configuration.
|
|
1462
1083
|
*/
|
|
1463
|
-
protected readonly step:
|
|
1464
|
-
constructor(manager: WorkflowManager, step:
|
|
1084
|
+
protected readonly step: Step<T>;
|
|
1085
|
+
constructor(manager: WorkflowManager, step: Step<T>);
|
|
1465
1086
|
/**
|
|
1466
1087
|
* Set the current update state of this step. All step handles pointing to this step will
|
|
1467
1088
|
* see this value.
|
|
@@ -1506,11 +1127,11 @@ export abstract class StepHandle<T extends _AnyStepData1> {
|
|
|
1506
1127
|
/**
|
|
1507
1128
|
* @returns The type of the step handle.
|
|
1508
1129
|
*/
|
|
1509
|
-
getType():
|
|
1130
|
+
getType(): StepType;
|
|
1510
1131
|
/**
|
|
1511
1132
|
* @returns The underlying data for this step. Favor using the step handle methods instead of this.
|
|
1512
1133
|
*/
|
|
1513
|
-
getRaw():
|
|
1134
|
+
getRaw(): Step<T>;
|
|
1514
1135
|
/**
|
|
1515
1136
|
* Fires any configured animations on the 3D preview for this step.
|
|
1516
1137
|
* This includes camera & model animations. If the preview is unavailable
|
|
@@ -1518,169 +1139,9 @@ export abstract class StepHandle<T extends _AnyStepData1> {
|
|
|
1518
1139
|
*/
|
|
1519
1140
|
executeAnimations(): void;
|
|
1520
1141
|
}
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
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 {
|
|
1142
|
+
|
|
1143
|
+
declare const createDesign: (workflowManager: WorkflowManager, workflow: Workflow, layouts: ILayout[], getReducerState: () => CommandState, 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>;
|
|
1144
|
+
interface SavedDesign {
|
|
1684
1145
|
/**
|
|
1685
1146
|
* The user's name for this saved design.
|
|
1686
1147
|
*/
|
|
@@ -1720,6 +1181,8 @@ export interface SavedDesign {
|
|
|
1720
1181
|
*/
|
|
1721
1182
|
declare class DesignService {
|
|
1722
1183
|
readonly localPersistenceKey = "designTransactions";
|
|
1184
|
+
private storageMethod;
|
|
1185
|
+
private designSavedListeners;
|
|
1723
1186
|
/**
|
|
1724
1187
|
* @param func The function to call when a design is saved.
|
|
1725
1188
|
*/
|
|
@@ -1752,8 +1215,10 @@ declare class DesignService {
|
|
|
1752
1215
|
* @param transactionId
|
|
1753
1216
|
*/
|
|
1754
1217
|
removeDesign(transactionId: string): Promise<void>;
|
|
1218
|
+
private setDesigns;
|
|
1755
1219
|
}
|
|
1756
|
-
|
|
1220
|
+
declare const designService: DesignService;
|
|
1221
|
+
|
|
1757
1222
|
/**
|
|
1758
1223
|
* A scene is a collection of steps that can be used to group steps together.
|
|
1759
1224
|
*/
|
|
@@ -1776,7 +1241,7 @@ interface Scene {
|
|
|
1776
1241
|
* provides a simplified interface for interacting with the workflow manager. You
|
|
1777
1242
|
* should get an instance of this class from a Client you have constructed previously.
|
|
1778
1243
|
*/
|
|
1779
|
-
|
|
1244
|
+
interface WorkflowExperience {
|
|
1780
1245
|
/**
|
|
1781
1246
|
* Returns the client that was responsible for spawning this experience.
|
|
1782
1247
|
*/
|
|
@@ -1801,7 +1266,7 @@ export interface WorkflowExperience {
|
|
|
1801
1266
|
* Returns the step matching a given name, undefined if not found.
|
|
1802
1267
|
* @param id The id the step must match.
|
|
1803
1268
|
*/
|
|
1804
|
-
getStepById(id: string): StepHandle<
|
|
1269
|
+
getStepById(id: string): StepHandle<AnyStepData> | undefined;
|
|
1805
1270
|
/**
|
|
1806
1271
|
* Returns the bulk step, undefined if not found.
|
|
1807
1272
|
*/
|
|
@@ -1810,21 +1275,21 @@ export interface WorkflowExperience {
|
|
|
1810
1275
|
* Returns the step matching a given name, undefined if not found.
|
|
1811
1276
|
* @param name The name the step must match.
|
|
1812
1277
|
*/
|
|
1813
|
-
getStepByName(name: string): StepHandle<
|
|
1278
|
+
getStepByName(name: string): StepHandle<AnyStepData> | undefined;
|
|
1814
1279
|
/**
|
|
1815
1280
|
* Returns all steps matching a specific type in the workflow. These steps
|
|
1816
1281
|
* may be across multiple scenes and may or may not be active based on condition state.
|
|
1817
1282
|
*/
|
|
1818
|
-
getStepsByType(type:
|
|
1283
|
+
getStepsByType(type: StepType): StepHandle<AnyStepData>[];
|
|
1819
1284
|
/**
|
|
1820
1285
|
* Returns all steps that are children of a given scene.
|
|
1821
1286
|
* @param scene The scene you want the steps for.
|
|
1822
1287
|
*/
|
|
1823
|
-
getStepsByScene(scene: Scene): StepHandle<
|
|
1288
|
+
getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
|
|
1824
1289
|
/**
|
|
1825
1290
|
* Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
|
|
1826
1291
|
*/
|
|
1827
|
-
getSteps(): StepHandle<
|
|
1292
|
+
getSteps(): StepHandle<AnyStepData>[];
|
|
1828
1293
|
/**
|
|
1829
1294
|
* Returns a list of scenes that are configured in the workflow. Each scene
|
|
1830
1295
|
* contains a list of steps. See getStepsByScene to access these.
|
|
@@ -1898,32 +1363,15 @@ export interface WorkflowExperience {
|
|
|
1898
1363
|
[key: string]: string;
|
|
1899
1364
|
}>;
|
|
1900
1365
|
}
|
|
1901
|
-
|
|
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
|
-
}
|
|
1366
|
+
|
|
1919
1367
|
/**
|
|
1920
1368
|
* A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
|
|
1921
1369
|
* bundles can return a handle for any global properties associated to the collection.
|
|
1922
1370
|
*/
|
|
1923
1371
|
declare abstract class GlobalPropertyHandle {
|
|
1924
|
-
protected readonly bundle:
|
|
1372
|
+
protected readonly bundle: Bundle;
|
|
1925
1373
|
protected readonly property: GlobalPropertyConfigurationAspect;
|
|
1926
|
-
constructor(bundle:
|
|
1374
|
+
constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect);
|
|
1927
1375
|
/**
|
|
1928
1376
|
* @returns The name of the global property. This is the key used to store the property in the state.
|
|
1929
1377
|
*/
|
|
@@ -1953,17 +1401,19 @@ declare abstract class GlobalPropertyHandle {
|
|
|
1953
1401
|
* Returns all steps that share this property.
|
|
1954
1402
|
* @param targetExperiences Optionally filter the steps to only those in the given experiences.
|
|
1955
1403
|
*/
|
|
1956
|
-
protected getSharedSteps(targetExperiences?: WorkflowExperience[]):
|
|
1404
|
+
protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
|
|
1957
1405
|
}
|
|
1406
|
+
|
|
1958
1407
|
interface GlobalPropertyStateManager {
|
|
1959
1408
|
getGlobalPropertyState(): GlobalPropertyState | undefined;
|
|
1960
1409
|
getAspect(name: string): string | undefined;
|
|
1961
1410
|
setAspect(name: string, value: string): Promise<void>;
|
|
1962
1411
|
}
|
|
1412
|
+
|
|
1963
1413
|
/**
|
|
1964
1414
|
* A bundle serves as a container for a set of workflow experience.
|
|
1965
1415
|
*/
|
|
1966
|
-
interface
|
|
1416
|
+
interface Bundle {
|
|
1967
1417
|
/**
|
|
1968
1418
|
* @returns The client that this bundle is associated with.
|
|
1969
1419
|
*/
|
|
@@ -2082,6 +1532,7 @@ interface _Bundle1 {
|
|
|
2082
1532
|
removeEventListener(event: BundleEvent, listener: () => void): void;
|
|
2083
1533
|
}
|
|
2084
1534
|
type BundleEvent = "conditional-global-properties-changed";
|
|
1535
|
+
|
|
2085
1536
|
interface ExecutionResponse {
|
|
2086
1537
|
id: string;
|
|
2087
1538
|
completedAt?: string;
|
|
@@ -2107,7 +1558,7 @@ declare abstract class FlowExecutionInput {
|
|
|
2107
1558
|
/**
|
|
2108
1559
|
* Represents the type of object being referenced by the input.
|
|
2109
1560
|
*/
|
|
2110
|
-
|
|
1561
|
+
declare const enum ObjectInputType {
|
|
2111
1562
|
Transaction = "Transaction",
|
|
2112
1563
|
Bundle = "Bundle",
|
|
2113
1564
|
Product = "Product",
|
|
@@ -2119,17 +1570,18 @@ export const enum ObjectInputType {
|
|
|
2119
1570
|
/**
|
|
2120
1571
|
* Handles validation of spiffObject structure for transmission to the server.
|
|
2121
1572
|
*/
|
|
2122
|
-
|
|
1573
|
+
declare class ObjectInput extends FlowExecutionInput {
|
|
2123
1574
|
constructor(id: string, type: ObjectInputType);
|
|
2124
1575
|
static validUUID(uuid: string): RegExpMatchArray | null;
|
|
2125
1576
|
}
|
|
2126
1577
|
/**
|
|
2127
1578
|
* Handles validation of text input for transmission to the server.
|
|
2128
1579
|
*/
|
|
2129
|
-
|
|
1580
|
+
declare class TextInput extends FlowExecutionInput {
|
|
2130
1581
|
constructor(id: string);
|
|
2131
1582
|
}
|
|
2132
|
-
|
|
1583
|
+
|
|
1584
|
+
declare const getWorkflow: (id: string) => Promise<Workflow>;
|
|
2133
1585
|
/**
|
|
2134
1586
|
* Options that can be used during instantiation of the SpiffCommerce Javascript Client.
|
|
2135
1587
|
* Please refer to the documentation for more information.
|
|
@@ -2183,12 +1635,21 @@ interface GetWorkflowFromExternalProductOptions extends GetWorkflowOptionsBase {
|
|
|
2183
1635
|
bulk?: boolean;
|
|
2184
1636
|
type: "external";
|
|
2185
1637
|
}
|
|
2186
|
-
|
|
1638
|
+
type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
|
|
2187
1639
|
/**
|
|
2188
1640
|
* The Spiff Commerce Javascript Client. Required for
|
|
2189
1641
|
* creating workflow experiences.
|
|
2190
1642
|
*/
|
|
2191
|
-
|
|
1643
|
+
declare class SpiffCommerceClient {
|
|
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?;
|
|
2192
1653
|
constructor(options: ClientOptions);
|
|
2193
1654
|
/**
|
|
2194
1655
|
* @returns The asset manager allows for common operations related to assets
|
|
@@ -2221,7 +1682,7 @@ export class SpiffCommerceClient {
|
|
|
2221
1682
|
transactionReadOnly?: boolean;
|
|
2222
1683
|
stakeholderType?: StakeholderType;
|
|
2223
1684
|
success: boolean;
|
|
2224
|
-
theme?:
|
|
1685
|
+
theme?: Theme;
|
|
2225
1686
|
}>;
|
|
2226
1687
|
clearCustomer(): void;
|
|
2227
1688
|
clearCustomerForTransaction(transactionId: string): void;
|
|
@@ -2230,6 +1691,7 @@ export class SpiffCommerceClient {
|
|
|
2230
1691
|
customer: Customer;
|
|
2231
1692
|
isAuthenticated: boolean;
|
|
2232
1693
|
}>;
|
|
1694
|
+
private authenticateCustomerId;
|
|
2233
1695
|
/**
|
|
2234
1696
|
* Generates a verification code for the given email address.
|
|
2235
1697
|
* @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
|
|
@@ -2246,12 +1708,12 @@ export class SpiffCommerceClient {
|
|
|
2246
1708
|
* @param collectionId Optional: The id of the product collection that the bundle can use.
|
|
2247
1709
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
2248
1710
|
*/
|
|
2249
|
-
getNewBundle(collectionId?: string): Promise<
|
|
1711
|
+
getNewBundle(collectionId?: string): Promise<Bundle>;
|
|
2250
1712
|
/**
|
|
2251
1713
|
* Retrieves an existing bundle from the API, by id.
|
|
2252
1714
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
2253
1715
|
*/
|
|
2254
|
-
getExistingBundle(bundleId: string, previewServiceConstructor?: (workflow:
|
|
1716
|
+
getExistingBundle(bundleId: string, previewServiceConstructor?: (workflow: Workflow, transactionId: string) => any): Promise<Bundle>;
|
|
2255
1717
|
/**
|
|
2256
1718
|
* Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
|
|
2257
1719
|
* @returns An array of bundle stakeholders.
|
|
@@ -2265,7 +1727,7 @@ export class SpiffCommerceClient {
|
|
|
2265
1727
|
* @param options Options to configure loading the transaction and workflow.
|
|
2266
1728
|
* @returns A workflow experience configured as requested.
|
|
2267
1729
|
*/
|
|
2268
|
-
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow:
|
|
1730
|
+
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
|
|
2269
1731
|
/**
|
|
2270
1732
|
* Initialize the client from an integration product.
|
|
2271
1733
|
* @param integrationProductId The integration product to use.
|
|
@@ -2279,6 +1741,10 @@ export class SpiffCommerceClient {
|
|
|
2279
1741
|
* @deprecated Use getWorkflowExperience to initialize the experience.
|
|
2280
1742
|
*/
|
|
2281
1743
|
initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
|
|
1744
|
+
/**
|
|
1745
|
+
* @deprecated Remove when the initFrom functions are removed.
|
|
1746
|
+
*/
|
|
1747
|
+
private getWorkflowExperienceDeprecated;
|
|
2282
1748
|
/**
|
|
2283
1749
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
|
|
2284
1750
|
* @returns The preview service that was provided during construction.
|
|
@@ -2288,42 +1754,272 @@ export class SpiffCommerceClient {
|
|
|
2288
1754
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
|
|
2289
1755
|
* @returns The product associated with this client.
|
|
2290
1756
|
*/
|
|
2291
|
-
getProduct():
|
|
1757
|
+
getProduct(): Product;
|
|
2292
1758
|
/**
|
|
2293
1759
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
|
|
2294
1760
|
* @returns The transaction associated with this client.
|
|
2295
1761
|
*/
|
|
2296
1762
|
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;
|
|
2297
1769
|
}
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
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
|
+
}
|
|
1788
|
+
declare const spiffCoreConfiguration: Configuration;
|
|
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 {
|
|
1995
|
+
getInitializationPromise(): Promise<void>;
|
|
1996
|
+
getProduct: () => Product;
|
|
1997
|
+
isInitialized(): boolean;
|
|
1998
|
+
getCommandContext: () => CommandContext;
|
|
1999
|
+
getAllLayoutData: () => LayoutState[];
|
|
2000
|
+
getMetadata: (stepName: string) => StepMetadata | undefined;
|
|
2001
|
+
getWorkflowMetadata: () => WorkflowMetadata;
|
|
2002
|
+
getStepStorage: (stepName: string) => StepStorage | undefined;
|
|
2003
|
+
getInformationResults(): InformationResult[];
|
|
2004
|
+
getVariationRecords(): VariationRecord[];
|
|
2005
|
+
reset(): Promise<void>;
|
|
2006
|
+
updateStateWithServer(_getReducerState: () => CommandState): void;
|
|
2007
|
+
addVariationRecord(_variationRecord: Omit<VariationRecord, "recordNumber">): {
|
|
2008
|
+
recordNumber: number;
|
|
2009
|
+
transactionId: string;
|
|
2010
|
+
values: never[];
|
|
2011
|
+
};
|
|
2012
|
+
getCurrentVariationRecord(): undefined;
|
|
2013
|
+
removeVariationRecord(_recordNumber: number): never[];
|
|
2014
|
+
outstandingRequestsPromise(): Promise<void>;
|
|
2015
|
+
updateStateWithServerImmediate(_getReducerState: () => CommandState): Promise<void>;
|
|
2016
|
+
addPoller(_poller: Poller): void;
|
|
2017
|
+
addConfirmCallback(_callback: ConfirmCallback): void;
|
|
2018
|
+
addCurrentVariationCallback(_callback: CurrentVariationRecordCallback): void;
|
|
2019
|
+
addEditedCallback(_callback: EditedCallback): void;
|
|
2020
|
+
addElementsCallback(_callback: ElementsCallback): void;
|
|
2021
|
+
addInformationResultCallback(_callback: InformationResultCallback): void;
|
|
2022
|
+
addInitCallback(_callback: InitCallback): void;
|
|
2327
2023
|
addMakingAdjustmentsCallback(_callback: MakingAdjustmentsCallback): void;
|
|
2328
2024
|
addMandatoryCallback(_callback: MandatoryCallback): void;
|
|
2329
2025
|
addMetadataCallback(_callback: MetadataCallback): void;
|
|
@@ -2331,7 +2027,7 @@ export class MockWorkflowManager implements WorkflowManager {
|
|
|
2331
2027
|
addStepSpecificStorageCallback(_callback: StepSpecificStorageCallback, _stepName: string): void;
|
|
2332
2028
|
addStorageCallback(_callback: StorageCallback): void;
|
|
2333
2029
|
addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
|
|
2334
|
-
getCommandDispatcher(): (_command:
|
|
2030
|
+
getCommandDispatcher(): (_command: CanvasCommand) => void;
|
|
2335
2031
|
getLayouts(): never[];
|
|
2336
2032
|
getLayoutPreviewService(): {
|
|
2337
2033
|
getAll: () => Map<any, any>;
|
|
@@ -2369,17 +2065,288 @@ export class MockWorkflowManager implements WorkflowManager {
|
|
|
2369
2065
|
setEditedStatus(_stepName: string, _status: boolean): void;
|
|
2370
2066
|
setInformationResults(_results: InformationResult[]): void;
|
|
2371
2067
|
setMandatoryFulfilled(_stepName: string, _status: boolean): void;
|
|
2372
|
-
setSelectionsAndElements(_stepName: string, _variants:
|
|
2068
|
+
setSelectionsAndElements(_stepName: string, _variants: VariantResource[], _elements: RegionElement[]): Promise<void>;
|
|
2373
2069
|
setVariationRecords(_variationRecords: VariationRecord[]): void;
|
|
2374
2070
|
toggleDesignConfirmed(): void;
|
|
2375
2071
|
updateMetadata(_stepName: string, _update: any): void;
|
|
2376
|
-
updateStorage(_stepName: string, _update:
|
|
2072
|
+
updateStorage(_stepName: string, _update: StepStorage): Promise<void>;
|
|
2377
2073
|
injectIntoPreviewService(_previewService: any): Promise<void>;
|
|
2378
2074
|
ejectFromPreviewService(): void;
|
|
2379
2075
|
}
|
|
2380
|
-
export const TransformWrapper: React.FunctionComponent;
|
|
2381
|
-
export { CommandContext };
|
|
2382
|
-
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 };
|
|
2383
|
-
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 };
|
|
2384
2076
|
|
|
2385
|
-
|
|
2077
|
+
interface DesignInputStep {
|
|
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 };
|