@spiffcommerce/core 14.13.1 → 15.0.0-beta.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.
@@ -1,14 +1,37 @@
1
- import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, AnyStepData as _AnyStepData1, Asset as _Asset1, Region, VariantResource as _VariantResource1, FrameOffsets, PatternImageData, DigitalContentStepData as _DigitalContentStepData1, LayoutsState as _LayoutsState1, CanvasCommand as _CanvasCommand1, FrameStepData as _FrameStepData1, ILayout as _ILayout1, CreateElementCommand as _CreateElementCommand1, FrameElement as _FrameElement1, ColorDefinition as _ColorDefinition1, IllustrationStepData as _IllustrationStepData1, IllustrationElement as _IllustrationElement1, LayoutData as _LayoutData1, MaterialStepData as _MaterialStepData1, ModelStepData as _ModelStepData1, ModuleStepData as _ModuleStepData1, PictureStepData as _PictureStepData1, QuestionStepData as _QuestionStepData1, ShapeStepData as _ShapeStepData1, FontData, GroupCommand as _GroupCommand1, OptionResource as _OptionResource1, TextboxElement as _TextboxElement1, TextFillImage, TextStepData as _TextStepData1, SilentStepData, Placeable, StepStorage as _StepStorage1, SerializableStep, CommandState as _CommandState1, CommandContext as _CommandContext1, LayoutState, GlobalPropertyConfiguration, MaterialResource, AssetType as _AssetType1, Point, ScaleAxis, UnitOfMeasurement as _UnitOfMeasurement1, StepType as _StepType1, BulkStepData as _BulkStepData1, FrameData as _FrameData1, AspectType, GlobalPropertyConfigurationAspect, Theme as _Theme1, Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, BringToFrontCommand, BringToBackCommand, BulkStepData, CanvasCommand, ColorDefinition, CommandContext, CommandState, CreateElementCommand, DeleteElementCommand, DigitalContentStepData, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, FrameElement, FrameStepData, GroupCommand, ILayout, IllustrationElement, IllustrationStepData, ImageElement, LayoutData, LayoutElement, LayoutElementFactory, LayoutElementType, LayoutsState, MaterialStepData, ModelStepData, ModuleStepData, MoveCommand, OptionResource, PictureStepData, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, UnitOfMeasurement, VariantResource, Workflow, dataUrlFromExternalUrl, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getFrameData, getSvgElement, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, CreateLayoutCommand, rehydrateSerializedLayout, ColorProfileProps, WorkflowPanel, determineCorrectFontSizeAndLines, registerJSDOM, getAxisAlignedBoundingBox, Theme } from "@spiffcommerce/papyrus";
2
- import { DefaultContext, OperationVariables } from "@apollo/client/core/types";
3
- import { MutationFunctionOptions } from "@apollo/client/react/types/types";
4
- import { ApolloCache, FetchResult } from "@apollo/client/core";
5
- import { ApolloClient } from "@apollo/client";
6
- import React, { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent } from "react";
7
- export const gatherVaryingStepAspects: (workflow: _Workflow1) => _StepAspect1[];
1
+ import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
2
+ import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, SilentStepData, Placeable, 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, InformationStepData } 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, InformationStepData, 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, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout } from '@spiffcommerce/papyrus';
4
+ import { ApolloClient, FetchResult } from '@apollo/client/core';
5
+ import * as lodash from 'lodash';
6
+
7
+ declare class OptionService {
8
+ /**
9
+ * Allows for retrieving an option, returns the option from a cache if possible.
10
+ * @param id The option ID to be retrieved.
11
+ */
12
+ getOption(id: string): Promise<undefined | OptionResource>;
13
+ getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
14
+ getDefaultVariant(option: OptionResource): VariantResource | undefined;
15
+ getDisplayImageSource: (variant?: VariantResource) => undefined | string;
16
+ /**
17
+ * Returns the first variant marked as selected. This is used by most steps.
18
+ */
19
+ getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
20
+ }
21
+ declare const optionService: OptionService;
22
+
23
+ declare class GraphQlManager {
24
+ private shadowGraphqlClient;
25
+ constructor();
26
+ getShadowGraphqlClient(): ApolloClient<any>;
27
+ private constructShadowGraphqlClient;
28
+ }
29
+ declare const graphQlManager: GraphQlManager;
30
+
8
31
  /**
9
32
  * A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
10
33
  */
11
- export interface RenderableScene {
34
+ interface RenderableScene {
12
35
  /**
13
36
  * The id of the scene.
14
37
  */
@@ -26,7 +49,7 @@ export interface RenderableScene {
26
49
  * Information parsed froma workflow structure that is relevant
27
50
  * to a given scene.
28
51
  */
29
- export interface WorkflowScene {
52
+ interface WorkflowScene {
30
53
  /**
31
54
  * A unique identifier for the scene.
32
55
  */
@@ -39,18 +62,19 @@ export interface WorkflowScene {
39
62
  * Steps which can display to the user.
40
63
  * But may be conditionally hidden based on workflow logic
41
64
  */
42
- renderableSteps: _Step1<_AnyStepData1>[];
65
+ renderableSteps: Step<AnyStepData>[];
43
66
  /**
44
67
  * Steps which don't display to the user.
45
68
  * Their behavior is always silent & executed in the background.
46
69
  */
47
- silentSteps: _Step1<_AnyStepData1>[];
70
+ silentSteps: Step<AnyStepData>[];
48
71
  }
72
+
49
73
  /**
50
74
  * A queue promise is a container for a promise that can be
51
75
  * executed at a later time.
52
76
  */
53
- export abstract class QueueablePromise {
77
+ declare abstract class QueueablePromise {
54
78
  readonly timestamp: number;
55
79
  abstract execute(): Promise<any>;
56
80
  }
@@ -59,7 +83,10 @@ export abstract class QueueablePromise {
59
83
  * as quickly as possible in order. This is ideal in situations where a specific operation should be
60
84
  * applied in an ordered way while still making.
61
85
  */
62
- export class PromiseQueue<T extends QueueablePromise> {
86
+ declare class PromiseQueue<T extends QueueablePromise> {
87
+ private queue;
88
+ private activePromise?;
89
+ private queueMaxSize;
63
90
  /**
64
91
  * Constructs a new promise queue.
65
92
  * @param queueMaxSize An optional maximum size, when the max size is hit.
@@ -84,80 +111,13 @@ export class PromiseQueue<T extends QueueablePromise> {
84
111
  * in the promise being extended.
85
112
  */
86
113
  finalize(): Promise<void>;
114
+ /**
115
+ * Once called will recursively resolve the jobs in the
116
+ * queue until no more are available.
117
+ */
118
+ private dequeue;
87
119
  }
88
- /**
89
- * A generic base class for custom errors that assigns the name
90
- * of the error class automatically. All custom errors should extend this.
91
- */
92
- declare abstract class CustomError extends Error {
93
- constructor(message: any);
94
- }
95
- /**
96
- * A custom class for categorising errors related to workflow configuration.
97
- */
98
- declare abstract class ConfigurationError extends CustomError {
99
- constructor(message: any);
100
- }
101
- /**
102
- * Thrown when an option was expected but not found in the workflow configuration or
103
- * the server returned a 404 for an option we expected.
104
- */
105
- export class OptionNotFoundError extends ConfigurationError {
106
- readonly optionId: string;
107
- constructor(step: _Step1<_AnyStepData1>);
108
- }
109
- /**
110
- * Thrown when a layout is not found for a given region entity. This
111
- * can occur when panels are deleted from a workflow but steps are still relying
112
- * on the layout being present.
113
- */
114
- export class LayoutNotFoundError extends ConfigurationError {
115
- readonly panelId: string;
116
- constructor(region: Region);
117
- }
118
- /**
119
- * Thrown when an asset is not found on a specific variant. This can occur when
120
- * the asset wasn't configured in hub and the variant is loaded in a workflow.
121
- */
122
- export class AssetNotFoundError extends ConfigurationError {
123
- readonly variant: _VariantResource1;
124
- constructor(variant: _VariantResource1);
125
- }
126
- /**
127
- * Thrown when a resource is not found linked to a specific asset. This
128
- * can occur when generation of a resource fails or hasn't completed. Or may be
129
- * a sign of a misconfiguration.
130
- */
131
- export class ResourceNotFoundError extends ConfigurationError {
132
- readonly asset: _Asset1;
133
- constructor(asset: _Asset1);
134
- }
135
- /**
136
- * Thrown when configuration is missing when it was expected. More generic
137
- * to cover remaining cases outside of the more specific ones such as options, variants & assets.
138
- */
139
- export class MisconfigurationError extends ConfigurationError {
140
- readonly step: _Step1<_AnyStepData1>;
141
- constructor(step: _Step1<_AnyStepData1>, message: string);
142
- }
143
- /**
144
- * A custom class for categorising errors related to implementation of core.
145
- */
146
- declare abstract class ImplementationError extends CustomError {
147
- constructor(message: any);
148
- }
149
- /**
150
- * Thrown when we hit a case that we didn't expect to happen
151
- */
152
- export class UnhandledBehaviorError extends ImplementationError {
153
- constructor(message: string);
154
- }
155
- /**
156
- * Thrown when we fail to parse something that we expected to be valid
157
- */
158
- export class ParseError extends ImplementationError {
159
- constructor(message: string);
160
- }
120
+
161
121
  /**
162
122
  * Bounds the offsets for an image to the box, preventing
163
123
  * the user from moving the image in a way that wouldn't be intended.
@@ -166,8 +126,14 @@ export class ParseError extends ImplementationError {
166
126
  * @param borderWidth The width of the border added by the cropper.
167
127
  * @param mustCover When true the image sgould be bounded in such a way that it covers the entire frame at all times.
168
128
  */
169
- export function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
170
- export class FrameService {
129
+ declare function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
130
+ declare class FrameService {
131
+ private offsets;
132
+ private forceImageCover?;
133
+ private targetElements;
134
+ private imageData?;
135
+ private frameData?;
136
+ private readonly _debouncedUpdateFrameOffsets;
171
137
  /**
172
138
  * The calculated minimum zoom value, per frame.
173
139
  */
@@ -176,6 +142,10 @@ export class FrameService {
176
142
  * The calculated maximum zoom value. Note: This is calculated based on the first frame.
177
143
  */
178
144
  maxZoomScale: number[];
145
+ private onFrameDataChangeListeners;
146
+ private onZoomChangeListeners;
147
+ private workflowManager?;
148
+ private stepName?;
179
149
  constructor(forceImageCover?: boolean);
180
150
  /**
181
151
  * When we want to connect a workflow manager to the state of the image cropper we
@@ -240,8 +210,33 @@ export class FrameService {
240
210
  * @param newListener
241
211
  */
242
212
  onZoom(newListener: (zoomValue: number[]) => void): void;
213
+ /**
214
+ * Updates the offsets of the frame
215
+ * @param newOffsets New offset object
216
+ * @param imageData The image data
217
+ * @param frameData The frame data
218
+ * @param targetElements A list of elements that need updating, by ID
219
+ * @param onComplete A callback when the operation is completed.
220
+ */
221
+ private updateFrameOffsets;
222
+ /**
223
+ * Determines limitations of zoom based on relative size of image and frame.
224
+ * @param imageData The image to include in calculations
225
+ * @param frameData The frame to include in calculations.
226
+ */
227
+ private recalculateZoomLimits;
228
+ private recalculateOffsets;
243
229
  }
230
+
244
231
  declare class Poller {
232
+ private pollingId;
233
+ private attempts;
234
+ private readonly interval;
235
+ private readonly maxAttempts;
236
+ private readonly predicate;
237
+ private readonly onSuccess;
238
+ private readonly onFailure;
239
+ private poll;
245
240
  /**
246
241
  * Constructs a new polling service.
247
242
  * @param predicate An async function that returns true when polling has returned a successful result.
@@ -252,154 +247,7 @@ declare class Poller {
252
247
  */
253
248
  constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
254
249
  }
255
- declare class Configuration {
256
- constructor();
257
- getServerUrl(): string;
258
- getServicesApiUrl(): string;
259
- getHubUrl(): string;
260
- setServerUrl(serverUrl: string): void;
261
- setServicesApiUrl(servicesApiUrl: string): void;
262
- setHubUrl(hubUrl: string): void;
263
- addServerUrlCallback(callback: () => void): void;
264
- }
265
- export const spiffCoreConfiguration: Configuration;
266
- export const shortenUrl: (longUrl: string) => Promise<string>;
267
- declare class DigitalContentStepService implements StepService<_DigitalContentStepData1> {
268
- init(stepData: _Step1<_DigitalContentStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
269
- 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>;
270
- }
271
- export const digitalContentStepService: DigitalContentStepService;
272
- interface FrameCreateOpts {
273
- stepName?: string;
274
- frameData: FrameData;
275
- disablePlaceholder?: boolean;
276
- focalBlur?: boolean;
277
- focalBlurStrength?: number;
278
- focalBlurRadius?: number;
279
- pattern?: any;
280
- }
281
- declare class FrameStepService implements StepService<_FrameStepData1> {
282
- init(stepData: _Step1<_FrameStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
283
- selectImage(stepData: _Step1<_FrameStepData1>, asset: _Asset1, workflowManager: WorkflowManager): void;
284
- selectVariant(stepData: _Step1<_FrameStepData1>, variant: _VariantResource1 | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
285
- getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: FrameCreateOpts): _CreateElementCommand1<_FrameElement1>;
286
- loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
287
- }
288
- export const frameStepService: FrameStepService;
289
- interface SVGCreateOpts {
290
- stepName?: string;
291
- src: string;
292
- objectURL: string;
293
- svg: {
294
- svg: string;
295
- colors: {
296
- [key: string]: _ColorDefinition1;
297
- };
298
- };
299
- }
300
- declare class IllustrationStepService implements StepService<_IllustrationStepData1> {
301
- getIllustrationBody(src: string): Promise<string>;
302
- getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
303
- getColors(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager): {
304
- [key: string]: _ColorDefinition1;
305
- } | never[];
306
- init(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
307
- availableColors(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager): Promise<{
308
- fill: string | undefined;
309
- stroke: string | undefined;
310
- variant: _VariantResource1;
311
- }[] | undefined>;
312
- changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<_CanvasCommand1>;
313
- changeColors(stepData: _Step1<_IllustrationStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
314
- selectVariant(stepData: _Step1<_IllustrationStepData1>, variant: _VariantResource1, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
315
- }
316
- export const illustrationStepService: IllustrationStepService;
317
- declare class MaterialStepService implements StepService<_MaterialStepData1> {
318
- init(stepData: _Step1<_MaterialStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | CommandWithFollowup>;
319
- selectVariant(step: _Step1<_MaterialStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
320
- }
321
- export const materialStepService: MaterialStepService;
322
- declare class ModelStepService implements StepService<_ModelStepData1> {
323
- init(stepData: _Step1<_ModelStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
324
- selectVariant(step: _Step1<_ModelStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
325
- }
326
- export const modelStepService: ModelStepService;
327
- declare class ModuleStepService implements StepService<_ModuleStepData1> {
328
- init(stepData: _Step1<_ModuleStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
329
- changeText(stepData: _Step1<_ModuleStepData1>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
330
- }
331
- export const moduleStepService: ModuleStepService;
332
- declare class PictureStepService implements StepService<_PictureStepData1> {
333
- init(stepData: _Step1<_PictureStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
334
- selectVariant(stepData: _Step1<_PictureStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
335
- }
336
- export const pictureStepService: PictureStepService;
337
- declare class QuestionStepService implements StepService<_QuestionStepData1> {
338
- init(stepData: _Step1<_QuestionStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
339
- selectVariant(stepData: _Step1<_QuestionStepData1>, variantId: string, workflowManager: WorkflowManager): Promise<void>;
340
- }
341
- export const questionStepService: QuestionStepService;
342
- declare class ShapeStepService implements StepService<_ShapeStepData1> {
343
- readonly shapeFillId = "spiff-fill-shape";
344
- availableColours(stepData: _Step1<_ShapeStepData1>): Promise<{
345
- fill: string | undefined;
346
- stroke: string | undefined;
347
- variant: _VariantResource1;
348
- }[]>;
349
- setCustomColor(color: string, stepData: _Step1<_ShapeStepData1>, manager: WorkflowManager): void;
350
- init(stepData: _Step1<_ShapeStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
351
- selectVariant(stepData: _Step1<_ShapeStepData1>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
352
- }
353
- export const shapeStepService: ShapeStepService;
354
- type ToastCallback = (callbackOptions: {
355
- toastMessage: null | string;
356
- toastType: InformationMessageType | null;
357
- }) => void;
358
- declare class Toast {
359
- constructor();
360
- addToastCallback(callback: ToastCallback): void;
361
- setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
362
- }
363
- export const toast: Toast;
364
- interface TextFillSpotColor {
365
- profileName: string;
366
- namedColor: string;
367
- }
368
- interface TextUpdateResult {
369
- command?: _GroupCommand1;
370
- helperText: string;
371
- errors: TextError[];
372
- }
373
- interface TextError {
374
- localizationKey: string;
375
- }
376
- declare class TextStepService implements StepService<_TextStepData1> {
377
- init(stepData: _Step1<_TextStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
378
- findLayoutElements(workflowManager: WorkflowManager, step: _Step1<_TextStepData1>): _TextboxElement1[];
379
- /**
380
- * Get the colors that can be used for a given text step.
381
- * @param stepData The text step to get colors for.
382
- * @returns A list of color objects containg fill, stroke and variant if available.
383
- */
384
- availableFillColors(stepData: _Step1<_TextStepData1>): ColorOption[];
385
- changeFillColor(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
386
- availableFillImages(stepData: _Step1<_TextStepData1>): Promise<TextFillImage[]>;
387
- changeFillImage(stepData: _Step1<_TextStepData1>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
388
- /**
389
- * Given an element and a string, filters any characters from the string that are
390
- * not supported by the font of the given element.
391
- * @param text The text string to filter.
392
- * @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.
393
- * @returns A new string representing the passed string with unsupported characters removed.
394
- */
395
- filterUnsupportedCharacters: (text: string, fontData?: FontData) => string;
396
- getProcessedInput(input: string, stepData: _TextStepData1, customiseAllText: boolean): string;
397
- updateInputText(input: string, elements: _TextboxElement1[], step: _Step1<_TextStepData1>, workflowManager: WorkflowManager): TextUpdateResult;
398
- selectVariant(step: _Step1<_TextStepData1>, variant: _VariantResource1, workflowManager: WorkflowManager, setError: (status: boolean) => void, setHelperText: (text: string) => void): Promise<void>;
399
- textAlign: (stepData: _TextStepData1) => string;
400
- createTextFillSpotColor(colorOption: _OptionResource1, variant: _VariantResource1): TextFillSpotColor | undefined;
401
- }
402
- export const textStepService: TextStepService;
250
+
403
251
  declare abstract class ModuleProduct {
404
252
  /**
405
253
  * Name used by class. Usually product or brand name.
@@ -414,38 +262,39 @@ declare abstract class ModuleProduct {
414
262
  */
415
263
  abstract svgPrint(text: string, region: Region): string;
416
264
  }
417
- export interface SilentIllustrationStepData extends SilentStepData, Placeable {
265
+
266
+ interface SilentIllustrationStepData extends SilentStepData, Placeable {
418
267
  }
419
- export interface EditedSteps {
268
+ interface EditedSteps {
420
269
  [stepName: string]: boolean;
421
270
  }
422
- export interface MandatorySteps {
271
+ interface MandatorySteps {
423
272
  [stepName: string]: boolean;
424
273
  }
425
- export type StepElements = {
274
+ type StepElements = {
426
275
  [key: string]: RegionElement[];
427
276
  };
428
277
  type StepInitialised = {
429
278
  [key: string]: boolean;
430
279
  };
431
280
  type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
432
- export interface WorkflowStorage {
433
- [stepName: string]: _StepStorage1;
281
+ interface WorkflowStorage {
282
+ [stepName: string]: StepStorage;
434
283
  }
435
- export interface WorkflowMetadata {
284
+ interface WorkflowMetadata {
436
285
  [stepName: string]: StepMetadata;
437
286
  }
438
- export interface WorkflowSelections {
287
+ interface WorkflowSelections {
439
288
  [stepName: string]: {
440
- selections: _VariantResource1[];
289
+ selections: VariantResource[];
441
290
  };
442
291
  }
443
- export interface InformationResult {
292
+ interface InformationResult {
444
293
  message: string;
445
294
  messageType: InformationMessageType;
446
295
  stepID: string;
447
296
  }
448
- export enum InformationMessageType {
297
+ declare enum InformationMessageType {
449
298
  Error = "Error",
450
299
  Warning = "Warning",
451
300
  Info = "Info"
@@ -457,7 +306,7 @@ interface StepSpecificServices {
457
306
  frameService?: FrameService;
458
307
  module?: ModuleProduct;
459
308
  }
460
- export type DesignCreationProgressUpdate = (message: string) => void;
309
+ type DesignCreationProgressUpdate = (message: string) => void;
461
310
  type ConfirmCallback = (isConfirmed: boolean) => void;
462
311
  type EditedCallback = (editedSteps: EditedSteps) => void;
463
312
  type ElementsCallback = (elements: StepElements) => void;
@@ -472,12 +321,12 @@ type SelectionCallback = (callbackOptions: {
472
321
  selections: StepSelections;
473
322
  traversableScenes: WorkflowScene[];
474
323
  }) => void;
475
- type StepSpecificStorageCallback = (selections: _StepStorage1) => void;
324
+ type StepSpecificStorageCallback = (selections: StepStorage) => void;
476
325
  type StorageCallback = (storage: WorkflowStorage) => void;
477
326
  type CurrentVariationRecordCallback = (variationRecord: null | VariationRecord) => void;
478
327
  type VariationRecordsCallback = (records: VariationRecord[]) => void;
479
- export type StateMutationFunc = (options?: MutationFunctionOptions<any, OperationVariables, DefaultContext, ApolloCache<any>> | undefined) => Promise<FetchResult<any, Record<string, any>, Record<string, any>>>;
480
- export interface WorkflowManager {
328
+ type StateMutationFunc = (options?: any) => Promise<FetchResult<any, Record<string, any>, Record<string, any>>>;
329
+ interface WorkflowManager {
481
330
  addPoller: (poller: Poller) => void;
482
331
  addConfirmCallback: (callback: ConfirmCallback) => void;
483
332
  addCurrentVariationCallback: (callback: CurrentVariationRecordCallback) => void;
@@ -493,11 +342,11 @@ export interface WorkflowManager {
493
342
  addStorageCallback: (callback: StorageCallback) => void;
494
343
  addVariationRecord: (variationRecord: Omit<VariationRecord, "recordNumber">) => VariationRecord;
495
344
  addVariationRecordsCallback: (callback: VariationRecordsCallback) => void;
496
- getCommandDispatcher: () => (command: _CanvasCommand1) => void;
345
+ getCommandDispatcher: () => (command: CanvasCommand) => void;
497
346
  getCurrentVariationRecord: () => VariationRecord | undefined;
498
347
  getVariationRecords: () => VariationRecord[];
499
- getCommandContext: () => _CommandContext1;
500
- getLayouts: () => _ILayout1[];
348
+ getCommandContext: () => CommandContext;
349
+ getLayouts: () => ILayout[];
501
350
  getAllLayoutData: () => LayoutState[];
502
351
  getLayoutPreviewService: () => any | undefined;
503
352
  getPreviewService: () => any | undefined;
@@ -505,7 +354,7 @@ export interface WorkflowManager {
505
354
  getRegionElements: (stepName: string) => RegionElement[];
506
355
  getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
507
356
  getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
508
- getStepStorage: (stepName: string) => _StepStorage1 | undefined;
357
+ getStepStorage: (stepName: string) => StepStorage | undefined;
509
358
  getMetadata: (stepName: string) => StepMetadata | undefined;
510
359
  getWorkflowMetadata: () => WorkflowMetadata;
511
360
  getInformationResults(): InformationResult[];
@@ -518,7 +367,7 @@ export interface WorkflowManager {
518
367
  setTransactionCustomerDetails: (details: {
519
368
  email: string;
520
369
  }) => void;
521
- getWorkflow: () => _Workflow1;
370
+ getWorkflow: () => Workflow;
522
371
  getWorkflowSelections: () => WorkflowSelections;
523
372
  getProduct: () => Product;
524
373
  /**
@@ -544,15 +393,15 @@ export interface WorkflowManager {
544
393
  setEditedStatus: (stepName: string, status: boolean) => void;
545
394
  setInformationResults: (results: InformationResult[]) => void;
546
395
  setMandatoryFulfilled: (stepName: string, status: boolean) => void;
547
- setSelectionsAndElements: (stepName: string, variants: _VariantResource1[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
396
+ setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
548
397
  setVariationRecords: (variationRecords: VariationRecord[]) => void;
549
398
  toggleDesignConfirmed: () => void;
550
399
  updateMetadata: (stepName: string, update: any) => void;
551
400
  /**
552
401
  * @deprecated State updates are being pulled internally. This function will be removed in the future.
553
402
  */
554
- updateStateWithServerImmediate: (getReducerState: () => _CommandState1) => Promise<void>;
555
- updateStorage: (stepName: string, update: _StepStorage1) => void;
403
+ updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
404
+ updateStorage: (stepName: string, update: StepStorage) => void;
556
405
  getModelContainer: () => any | undefined;
557
406
  setModelContainer: (container: any) => void;
558
407
  /**
@@ -566,11 +415,12 @@ export interface WorkflowManager {
566
415
  */
567
416
  ejectFromPreviewService(): void;
568
417
  }
569
- interface StepService<T extends _AnyStepData1> {
418
+
419
+ interface StepService<T extends AnyStepData> {
570
420
  /**
571
421
  * Initialize the given step, or reload from serialized data if present.
572
422
  */
573
- init(stepData: _Step1<T>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<any>;
423
+ init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
574
424
  }
575
425
  interface FileInfo {
576
426
  /**
@@ -587,7 +437,7 @@ interface FileInfo {
587
437
  * A command along with a function to run afterwards.
588
438
  */
589
439
  interface CommandWithFollowup {
590
- command?: _CanvasCommand1;
440
+ command?: CanvasCommand;
591
441
  followup?: () => Promise<void>;
592
442
  }
593
443
  /**
@@ -606,7 +456,7 @@ interface ExportedData {
606
456
  priceModifier: number;
607
457
  };
608
458
  }
609
- export interface DesignCreationMessage {
459
+ interface DesignCreationMessage {
610
460
  baseCost?: number;
611
461
  designProductId?: string;
612
462
  designProductVariantId?: string;
@@ -631,7 +481,7 @@ export interface DesignCreationMessage {
631
481
  /**
632
482
  * Represents a transaction.
633
483
  */
634
- export interface Transaction {
484
+ interface Transaction {
635
485
  /**
636
486
  * A unique identifier for this transaction. Useful for reloading and
637
487
  * modifying state of the transaction.
@@ -733,15 +583,33 @@ export interface Transaction {
733
583
  */
734
584
  stakeholders?: Stakeholder[];
735
585
  }
586
+ /**
587
+ * An integration product represents the connection of a product in SpiffCommerce with
588
+ * a product on a third party platform.
589
+ */
736
590
  interface IntegrationProduct {
591
+ /**
592
+ * The ID of the IntegrationProduct entity. Used internally by SpiffCommerce.
593
+ */
737
594
  id: string;
595
+ /**
596
+ * The ID of the product on the third party platform. For example a Shopify product ID.
597
+ */
738
598
  externalProductId?: string;
599
+ /**
600
+ * The integration that this product is associated with. For example a Shopify integration.
601
+ */
739
602
  integration?: Integration;
740
603
  }
741
604
  interface Integration {
742
605
  id: string;
743
606
  enabled: boolean;
744
607
  externalIntegrationId?: string;
608
+ type?: IntegrationType;
609
+ }
610
+ declare enum IntegrationType {
611
+ Hub = "Hub",
612
+ Shopify = "Shopify"
745
613
  }
746
614
  /**
747
615
  * Fields found in a variant within a line item resource.
@@ -779,7 +647,7 @@ interface Partner {
779
647
  currencyCode?: string;
780
648
  customerDetailsPromptMarkdown?: string;
781
649
  }
782
- export interface Product {
650
+ interface Product {
783
651
  /**
784
652
  * ID of the partner owner.
785
653
  */
@@ -877,18 +745,18 @@ interface ProductTag {
877
745
  id: string;
878
746
  name: string;
879
747
  }
880
- export interface ColorOption {
748
+ interface ColorOption {
881
749
  id?: string;
882
750
  fill?: string;
883
751
  stroke?: string;
884
- variant?: _VariantResource1;
752
+ variant?: VariantResource;
885
753
  colorProfileAssetKey?: string;
886
754
  }
887
755
  /**
888
756
  * Represents a variation as seen in Google sheets.
889
757
  * Record number = row# - 1
890
758
  */
891
- export interface VariationRecord {
759
+ interface VariationRecord {
892
760
  recordNumber: number;
893
761
  transactionId: string;
894
762
  values: {
@@ -897,7 +765,7 @@ export interface VariationRecord {
897
765
  value: string;
898
766
  }[];
899
767
  }
900
- export interface RegionElement {
768
+ interface RegionElement {
901
769
  id: string;
902
770
  region?: Region;
903
771
  }
@@ -915,10 +783,10 @@ interface TextMetadata {
915
783
  text: string;
916
784
  fillImage?: string;
917
785
  }
918
- export interface SelectionStorage {
919
- selectedVariants?: _VariantResource1[];
786
+ interface SelectionStorage {
787
+ selectedVariants?: VariantResource[];
920
788
  }
921
- export interface TextStepStorage extends SelectionStorage {
789
+ interface TextStepStorage extends SelectionStorage {
922
790
  color?: string;
923
791
  defaultCleared?: boolean;
924
792
  inputText?: string;
@@ -946,7 +814,7 @@ interface FrameData {
946
814
  * Defines the different behaviors supported by the camera system
947
815
  * for control when viewing a product.
948
816
  */
949
- export enum ProductCameraRig {
817
+ declare enum ProductCameraRig {
950
818
  Orbit = 0,
951
819
  Pan = 1
952
820
  }
@@ -954,7 +822,7 @@ export enum ProductCameraRig {
954
822
  * Defines the different strategies to use when calculating the total price
955
823
  * when creating bulk designs.
956
824
  */
957
- export enum BulkPriceCalculationStrategy {
825
+ declare enum BulkPriceCalculationStrategy {
958
826
  /** The total price should increase with the amount of variations. */
959
827
  PerVariation = "PerVariation",
960
828
  /** The total price should remain at the base price of the product. */
@@ -973,7 +841,7 @@ interface BulkConfiguration {
973
841
  /**
974
842
  * Defines the locations at which a conversion attempt can take place.
975
843
  */
976
- export enum ConversionLocation {
844
+ declare enum ConversionLocation {
977
845
  /**
978
846
  * The client should expose a flow for allowing the user to optionally input details at any point.
979
847
  */
@@ -994,20 +862,20 @@ export enum ConversionLocation {
994
862
  /**
995
863
  * The data configured to be requested.
996
864
  */
997
- export enum ConversionDataType {
865
+ declare enum ConversionDataType {
998
866
  Email = "Email",
999
867
  FirstName = "FirstName",
1000
868
  LastName = "LastName",
1001
869
  Phone = "Phone"
1002
870
  }
1003
- export interface ConversionData {
871
+ interface ConversionData {
1004
872
  type: ConversionDataType;
1005
873
  mandatory: boolean;
1006
874
  }
1007
875
  /**
1008
876
  * The configuration for conversion, exposed on products currently.
1009
877
  */
1010
- export interface ConversionConfiguration {
878
+ interface ConversionConfiguration {
1011
879
  id: string;
1012
880
  name?: string;
1013
881
  locations: ConversionLocation[];
@@ -1018,7 +886,7 @@ export interface ConversionConfiguration {
1018
886
  /**
1019
887
  * Someone who has used a workflow experience and entered their contact details.
1020
888
  */
1021
- export interface Customer {
889
+ interface Customer {
1022
890
  id?: string;
1023
891
  emailAddress: string;
1024
892
  firstName?: string;
@@ -1029,25 +897,25 @@ export interface Customer {
1029
897
  stakeholders?: Stakeholder[];
1030
898
  bundleStakeholders?: BundleStakeholder[];
1031
899
  }
1032
- export interface CustomerDetailsInput {
900
+ interface CustomerDetailsInput {
1033
901
  emailAddress: string;
1034
902
  firstName?: string;
1035
903
  lastName?: string;
1036
904
  phoneNumber?: string;
1037
905
  }
1038
- export enum StakeholderType {
906
+ declare enum StakeholderType {
1039
907
  Owner = "Owner",
1040
908
  Approver = "Approver",
1041
909
  Editor = "Editor",
1042
910
  Viewer = "Viewer"
1043
911
  }
1044
- export interface Stakeholder {
912
+ interface Stakeholder {
1045
913
  id: string;
1046
914
  type?: StakeholderType;
1047
915
  transaction?: Transaction;
1048
916
  customer?: Customer;
1049
917
  }
1050
- interface _Bundle1 {
918
+ interface Bundle$1 {
1051
919
  id?: string;
1052
920
  bundleOwnerId?: string;
1053
921
  bundleStakeholders?: BundleStakeholder[];
@@ -1058,12 +926,12 @@ interface _Bundle1 {
1058
926
  }[];
1059
927
  name?: string;
1060
928
  partner?: Partner;
1061
- productCollection?: ProductCollection;
929
+ productCollection?: ProductCollectionResource;
1062
930
  transactions?: Transaction[];
1063
931
  }
1064
932
  interface BundleStakeholder {
1065
933
  id: string;
1066
- bundle?: _Bundle1;
934
+ bundle?: Bundle$1;
1067
935
  customer?: Customer;
1068
936
  type?: StakeholderType;
1069
937
  }
@@ -1071,7 +939,7 @@ interface BundleStakeholderInput {
1071
939
  type: StakeholderType;
1072
940
  customerDetails: CustomerDetailsInput;
1073
941
  }
1074
- type ProductCollection = {
942
+ type ProductCollectionResource = {
1075
943
  id: string;
1076
944
  globalPropertyConfiguration?: GlobalPropertyConfiguration;
1077
945
  name: string;
@@ -1108,41 +976,7 @@ interface TransformCollectionTransform {
1108
976
  rotation: Vector3;
1109
977
  scale: Vector3;
1110
978
  }
1111
- interface StorageService {
1112
- /**
1113
- * Get a value.
1114
- * @param key The key to lookup the value with.
1115
- */
1116
- get(key: string): string | undefined;
1117
- /**
1118
- * Set a value.
1119
- * @param key The key to set.
1120
- * @param val The new value.
1121
- */
1122
- set(key: string, val: string): void;
1123
- /**
1124
- * Remove a value.
1125
- * @param key The key to remove, does nothing if the key doesn't exist.
1126
- */
1127
- remove(key: string): void;
1128
- /**
1129
- * Get a map from persistence.
1130
- * @param key The key to search by.
1131
- */
1132
- getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
1133
- /**
1134
- * St a map into persistence.
1135
- * @param key The key to set the map at.
1136
- * @param val The map to set.
1137
- */
1138
- setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
1139
- }
1140
- export const persistenceService: StorageService;
1141
- declare class GraphQlManager {
1142
- constructor();
1143
- getShadowGraphqlClient(): ApolloClient<any>;
1144
- }
1145
- export const graphQlManager: GraphQlManager;
979
+
1146
980
  /**
1147
981
  * An asset manager provides a way to create and
1148
982
  * manage assets on the Spiff Commerce Platform.
@@ -1151,17 +985,19 @@ interface AssetManager {
1151
985
  /**
1152
986
  * Uploads a file to the Spiff Commerce Platform.
1153
987
  */
1154
- uploadFile: (file: File, onProgress: (val: number) => void) => Promise<_Asset1>;
988
+ uploadFile: (file: File, onProgress: (val: number) => void) => Promise<Asset>;
1155
989
  }
1156
990
  declare class AssetService implements AssetManager {
991
+ private cache;
992
+ private materialCache;
1157
993
  /**
1158
994
  * Allows for retrieving an asset, returns the option from a cache if possible.
1159
995
  */
1160
- getLocalOrFromServer(assetKey: string): Promise<_Asset1>;
996
+ getLocalOrFromServer(assetKey: string): Promise<Asset>;
1161
997
  /**
1162
998
  * Caches an asset if it doesn't already exist.
1163
999
  */
1164
- cacheAsset(asset: _Asset1): void;
1000
+ cacheAsset(asset: Asset): void;
1165
1001
  /**
1166
1002
  * Caches a material if it doesn't already exist.
1167
1003
  */
@@ -1175,299 +1011,98 @@ declare class AssetService implements AssetManager {
1175
1011
  * Upload a user asset to the server. Using callbacks to notify important events.
1176
1012
  * The asset will be stored via the persistence service for future access, if available.
1177
1013
  */
1178
- uploadAssetWithProgress(file: FileInfo, assetType: _AssetType1, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<_Asset1>;
1179
- uploadFile(file: File, onProgress: (val: number) => void): Promise<_Asset1>;
1014
+ uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
1015
+ uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
1180
1016
  removePersistedAsset(assetKey: string): void;
1181
1017
  getPersistedAssets(): PersistedAsset[];
1182
1018
  /**
1183
1019
  * Convert a File object for an image into a FileInfo.
1184
1020
  */
1185
1021
  loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
1022
+ /**
1023
+ * Handles mimeType resolution & asset creation request
1024
+ * @param file A file info object containing data about the file and its name
1025
+ * @param assetType The type of asset we're expecting to upload
1026
+ */
1027
+ private dispatchCreateAssetRequest;
1028
+ private guessMIME;
1186
1029
  }
1187
1030
  interface PersistedAsset {
1188
1031
  assetKey: string;
1189
1032
  src: string;
1190
1033
  }
1191
- export const assetService: AssetService;
1192
- declare class OptionService {
1034
+ declare const assetService: AssetService;
1035
+
1036
+ interface StorageService {
1193
1037
  /**
1194
- * Allows for retrieving an option, returns the option from a cache if possible.
1195
- * @param id The option ID to be retrieved.
1038
+ * Get a value.
1039
+ * @param key The key to lookup the value with.
1196
1040
  */
1197
- getOption(id: string): Promise<undefined | _OptionResource1>;
1198
- getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
1199
- getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
1200
- getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
1041
+ get(key: string): string | undefined;
1201
1042
  /**
1202
- * Returns the first variant marked as selected. This is used by most steps.
1043
+ * Set a value.
1044
+ * @param key The key to set.
1045
+ * @param val The new value.
1203
1046
  */
1204
- getSelectedVariant: (option: _OptionResource1 | undefined, selectedVariantIds: string[]) => _VariantResource1 | undefined;
1205
- }
1206
- export const optionService: OptionService;
1207
- export const CommandContextContext: import("react").Context<_CommandContext1>;
1208
- export const useLayouts: () => {
1209
- commandDispatcher: (command: _CanvasCommand1, leaveOffUndoStack: boolean) => void;
1210
- getLayoutById: (id: string) => _LayoutData1;
1211
- getAllLayouts: () => _LayoutData1[];
1212
- getReducerState: () => _CommandState1;
1213
- lastUpdated: Date;
1214
- flattenSequence: (sequenceId: string, initialState: _LayoutsState1) => void;
1215
- };
1216
- export type CommandDispatcher = (command: _CanvasCommand1, leaveOffUndoStack: boolean) => void;
1217
- export type LayoutGetter = (layoutId: string) => _LayoutData1;
1218
- export type LayoutsGetter = () => _LayoutData1[];
1219
- /**
1220
- * Details about a guideline that can be drawn on the canvas.
1221
- */
1222
- interface SnapPoint {
1223
- type: "x" | "y" | "rotation";
1224
- value: number;
1225
- svgNode?: ReactNode;
1226
- anchorPoint: number;
1227
- guidelineCoordinates?: Point[];
1228
- }
1229
- export enum ElementEventType {
1230
- Translate = "Translate",
1231
- Rotate = "Rotate",
1232
- Resize = "Resize"
1233
- }
1234
- export enum KeyEvent {
1235
- ControlLeft = "ControlLeft",
1236
- ControlRight = "ControlRight",
1237
- Equal = "Equal",
1238
- MetaLeft = "MetaLeft",
1239
- MetaRight = "MetaRight",
1240
- Minus = "Minus",
1241
- ArrowLeft = "ArrowLeft",
1242
- ArrowRight = "ArrowRight",
1243
- ArrowUp = "ArrowUp",
1244
- ArrowDown = "ArrowDown",
1245
- AltLeft = "AltLeft",
1246
- AltRight = "AltRight",
1247
- Delete = "Delete",
1248
- Backspace = "Backspace"
1249
- }
1250
- type ElementEvent = {
1251
- type: ElementEventType.Translate;
1252
- } | {
1253
- type: ElementEventType.Rotate;
1254
- } | {
1255
- type: ElementEventType.Resize;
1256
- relativeAxis: ScaleAxis;
1257
- screenAxis: ScaleAxis;
1258
- };
1259
- export enum EditorSubMenu {
1260
- None = "None",
1261
- FrameAdjustment = "FrameAdjustment",
1262
- Variations = "Variations",
1263
- FinalizeDesign = "FinalizeDesign",
1264
- SavedDesigns = "SavedDesigns",
1265
- ThreeDPreview = "ThreeDPreview",
1266
- Panels = "Panels"
1267
- }
1268
- interface UIState {
1269
- }
1270
- /**
1271
- * This context stores global state for
1272
- */
1273
- export interface AdvancedEditorState extends UIState {
1047
+ set(key: string, val: string): void;
1274
1048
  /**
1275
- * The layout currently being displayed in the editor.
1049
+ * Remove a value.
1050
+ * @param key The key to remove, does nothing if the key doesn't exist.
1276
1051
  */
1277
- layoutId: string;
1052
+ remove(key: string): void;
1278
1053
  /**
1279
- * Returns the id of the currently selected element. Or undefined if no element is selected.
1054
+ * Get a map from persistence.
1055
+ * @param key The key to search by.
1280
1056
  */
1281
- selectedElement?: string;
1057
+ getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
1282
1058
  /**
1283
- * The current zoom level of the editor.
1059
+ * St a map into persistence.
1060
+ * @param key The key to set the map at.
1061
+ * @param val The map to set.
1284
1062
  */
1285
- zoom: number;
1063
+ setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
1064
+ }
1065
+ declare const persistenceService: StorageService;
1066
+
1067
+ /**
1068
+ * A wrapping component that provides a simple interface for interacting with a variant.
1069
+ */
1070
+ declare class Variant {
1071
+ private readonly variantData;
1072
+ constructor(variant: VariantResource);
1073
+ getType(): AssetType | undefined;
1286
1074
  /**
1287
- * The current x translation of the transform for the canvas.
1075
+ * @returns The unique identifier for the variant.
1288
1076
  */
1289
- xTranslation: number;
1077
+ getId(): string;
1290
1078
  /**
1291
- * The current y translation of the transform for the canvas.
1079
+ * @returns The configured name of the variant. Generally a human readable value.
1292
1080
  */
1293
- yTranslation: number;
1081
+ getName(): string;
1294
1082
  /**
1295
- * The maxiumum zoom possible based on current canvas content.
1083
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
1296
1084
  */
1297
- maxZoom: number;
1085
+ getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
1298
1086
  /**
1299
- * The current measurement system used for display of coordinates and dimensions.
1087
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
1088
+ * 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.
1300
1089
  */
1301
- units: _UnitOfMeasurement1;
1090
+ getPrice(): number;
1302
1091
  /**
1303
- * The sub menu to be displayed to the user in place of the canvas.
1092
+ * @returns The URL for the base asset resource configured on this variant
1304
1093
  */
1305
- subMenu: EditorSubMenu;
1094
+ getAsset(): string | undefined;
1306
1095
  /**
1307
- * Any modifier keys that are currently pressed
1096
+ * @returns The URL for the base asset resource configured on this variant
1308
1097
  */
1309
- activeModifierKeys: KeyEvent[];
1098
+ getAssetResource(): Asset | undefined;
1310
1099
  /**
1311
- * WHether or not a meta key is pressed.
1312
- */
1313
- metaPressed: boolean;
1314
- /**
1315
- * Any active element event.
1316
- */
1317
- elementEvent?: ElementEvent;
1318
- /**
1319
- * If movement should assume that it's operating in a scrolled environment.
1320
- * FIXME: Can we get rid of this somehow.
1321
- */
1322
- scrolledMovement: boolean;
1323
- }
1324
- export const getDefaultState: (getLayouts: LayoutsGetter, defaultZoom: number) => AdvancedEditorState;
1325
- export const commandReducer: (state: AdvancedEditorState, command: UICommand) => AdvancedEditorState;
1326
- export const AdvancedEditorContext: import("react").Context<{
1327
- uiDispatcher: Dispatch<UICommand>;
1328
- state: AdvancedEditorState;
1329
- }>;
1330
- export const AdvancedEditorStateProvider: FunctionComponent<{
1331
- defaultZoom?: number;
1332
- children: ReactNode;
1333
- }>;
1334
- export class UICommand {
1335
- constructor(changes: Partial<AdvancedEditorState>);
1336
- apply(state: AdvancedEditorState): {
1337
- layoutId: string;
1338
- selectedElement?: string | undefined;
1339
- zoom: number;
1340
- xTranslation: number;
1341
- yTranslation: number;
1342
- maxZoom: number;
1343
- units: _UnitOfMeasurement1;
1344
- subMenu: EditorSubMenu;
1345
- activeModifierKeys: KeyEvent[];
1346
- metaPressed: boolean;
1347
- elementEvent?: ElementEvent | undefined;
1348
- scrolledMovement: boolean;
1349
- };
1350
- }
1351
- export const useEditorState: () => {
1352
- uiDispatcher: Dispatch<UICommand>;
1353
- state: AdvancedEditorState;
1354
- };
1355
- /**
1356
- * The minimum zoom that can be applied to a canvas.
1357
- */
1358
- export const minZoom = 0.5;
1359
- 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) => {
1360
- guidelines: SnapPoint[];
1361
- scale: number;
1362
- zoomableElementRef: RefObject<HTMLDivElement>;
1363
- setElementEvent: (newEvent: ElementEvent | undefined) => void;
1364
- handleZoom: (_event: any, value: any) => void;
1365
- handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
1366
- handleKeyUp: (event: KeyboardEvent) => void;
1367
- handlePointerPressedBackground: (event: PointerEvent) => void;
1368
- handlePointerReleased: () => void;
1369
- handlePointerMove: (event: PointerEvent, adjustmentBoundary?: Region) => void;
1370
- handleScroll: () => void;
1371
- handleSequenceStart: () => void;
1372
- };
1373
- export const useShortcutCombination: (shortcutKeys: string[], onCombinationPressed: () => void, onCombinationReleased?: () => void) => void;
1374
- export interface DesignInputStep {
1375
- data: DesignInputStepData;
1376
- name: string;
1377
- }
1378
- interface DesignInputStepData {
1379
- }
1380
- export const generateCommands: (designInputSteps: DesignInputStep[], workflow: _Workflow1, layouts: _ILayout1[], productOverlayImageUrl?: string) => Promise<_CanvasCommand1[]>;
1381
- export const EditorCore: FunctionComponent<{
1382
- isMobile: boolean;
1383
- color?: string;
1384
- outlineColor?: string;
1385
- editorRef: RefObject<SVGRectElement>;
1386
- zoomableElementRef: RefObject<HTMLDivElement>;
1387
- interactionElementRef: RefObject<HTMLDivElement>;
1388
- guidelines: SnapPoint[];
1389
- isMakingAdjustments?: boolean;
1390
- outlineArea?: {
1391
- x?: number;
1392
- y?: number;
1393
- height?: number;
1394
- width?: number;
1395
- hidden?: boolean;
1396
- };
1397
- visibleLayoutId: string;
1398
- xTranslation: number;
1399
- yTranslation: number;
1400
- targetedElements?: string[];
1401
- borderRadius?: number;
1402
- canvasFilter?: string;
1403
- handleContextMenu?: (e: any) => void;
1404
- onMouseMove?: (event: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
1405
- onContextMenuHandlePointerDown?: (event: PointerEvent) => void;
1406
- handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
1407
- handleKeyUp: (event: KeyboardEvent) => void;
1408
- handlePointerMove: (e: PointerEvent, adjustmentBoundary?: Region) => void;
1409
- handlePointerPressedBackground: (event: PointerEvent) => void;
1410
- handlePointerReleased: () => void;
1411
- handleScroll: () => void;
1412
- onSequenceStart: () => void;
1413
- setElementEvent: (e: ElementEvent | undefined) => void;
1414
- onElementSelected: (elementId: string | undefined, event: PointerEvent) => void;
1415
- variationRecord: null | VariationRecord;
1416
- workflow: _Workflow1;
1417
- }>;
1418
- /**
1419
- * The advanced editor encapsulates the logic required to allow users to manipulate a design
1420
- * with more granular control such as toolbars, direct element manipulation, and more.
1421
- */
1422
- export const AdvancedEditor: FunctionComponent<{
1423
- borderRadius?: number;
1424
- canvasFilter?: string;
1425
- color?: string;
1426
- guidelineColor?: string;
1427
- handleContextMenu?: (event: React.MouseEvent) => void;
1428
- hideEditableAreaRect?: boolean;
1429
- isMobile: boolean;
1430
- onContextMenuHandlePointerDown?: (event: PointerEvent) => void;
1431
- onDragEnd?: () => void;
1432
- onElementSelected?: (id: string | undefined, element: PointerEvent) => void;
1433
- onMouseMove?: (event: React.MouseEvent<SVGRectElement, MouseEvent>) => void;
1434
- outlineColor?: string;
1435
- variationRecord: null | VariationRecord;
1436
- workflow: _Workflow1;
1437
- }>;
1438
- /**
1439
- * A wrapping component that provides a simple interface for interacting with a variant.
1440
- */
1441
- export class Variant {
1442
- constructor(variant: _VariantResource1);
1443
- getType(): _AssetType1 | undefined;
1444
- /**
1445
- * @returns The unique identifier for the variant.
1446
- */
1447
- getId(): string;
1448
- /**
1449
- * @returns The configured name of the variant. Generally a human readable value.
1450
- */
1451
- getName(): string;
1452
- /**
1453
- * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
1454
- */
1455
- getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
1456
- /**
1457
- * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
1458
- * 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.
1459
- */
1460
- getPrice(): number;
1461
- /**
1462
- * @returns The URL for the base asset resource configured on this variant
1463
- */
1464
- getAsset(): string | undefined;
1465
- /**
1466
- * @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.
1100
+ * @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.
1467
1101
  */
1468
1102
  getThumbnail(): string | undefined;
1469
1103
  /**
1470
1104
  * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
1105
+ * @deprecated To be removed in a future version
1471
1106
  */
1472
1107
  getDisplayImage(): string | undefined;
1473
1108
  /**
@@ -1481,18 +1116,23 @@ export class Variant {
1481
1116
  /**
1482
1117
  * @returns The underlying variant resource. Generally not needed but made available just incase.
1483
1118
  */
1484
- getResource(): _VariantResource1;
1119
+ getResource(): VariantResource;
1485
1120
  /**
1486
1121
  * @returns True when the variant is enabled. False otherwise.
1487
1122
  */
1488
1123
  isEnabled(): boolean;
1489
1124
  }
1125
+
1490
1126
  /**
1491
1127
  * A StepHandle allows for managing the state of a specific step in a workflow. This class
1492
1128
  * abstracts away the complexities of dealing with a step directly and allows for using high level
1493
1129
  * concepts instead of dealing with the underlying data structures.
1494
1130
  */
1495
- export abstract class StepHandle<T extends _AnyStepData1> {
1131
+ declare abstract class StepHandle<T extends AnyStepData> {
1132
+ /**
1133
+ * Stores whether or not the step is currently updating.
1134
+ */
1135
+ private static readonly updateState;
1496
1136
  /**
1497
1137
  * Access to the workflow manager this step is contained by.
1498
1138
  */
@@ -1500,8 +1140,8 @@ export abstract class StepHandle<T extends _AnyStepData1> {
1500
1140
  /**
1501
1141
  * The step metadata, useful for determining logic based on configuration.
1502
1142
  */
1503
- protected readonly step: _Step1<T>;
1504
- constructor(manager: WorkflowManager, step: _Step1<T>);
1143
+ protected readonly step: Step<T>;
1144
+ constructor(manager: WorkflowManager, step: Step<T>);
1505
1145
  /**
1506
1146
  * Set the current update state of this step. All step handles pointing to this step will
1507
1147
  * see this value.
@@ -1546,11 +1186,11 @@ export abstract class StepHandle<T extends _AnyStepData1> {
1546
1186
  /**
1547
1187
  * @returns The type of the step handle.
1548
1188
  */
1549
- getType(): _StepType1;
1189
+ getType(): StepType;
1550
1190
  /**
1551
1191
  * @returns The underlying data for this step. Favor using the step handle methods instead of this.
1552
1192
  */
1553
- getRaw(): _Step1<T>;
1193
+ getRaw(): Step<T>;
1554
1194
  getTags(): string[];
1555
1195
  hasTag(tag: string): boolean;
1556
1196
  /**
@@ -1560,175 +1200,9 @@ export abstract class StepHandle<T extends _AnyStepData1> {
1560
1200
  */
1561
1201
  executeAnimations(): void;
1562
1202
  }
1563
- export class BulkStepHandle extends StepHandle<_BulkStepData1> {
1564
- constructor(manager: WorkflowManager, step: _Step1<_BulkStepData1>);
1565
- selectVariant(): Promise<void>;
1566
- setDesignName(designName: string): Promise<void>;
1567
- addVariationRecord(): VariationRecord;
1568
- updateBulkIsConnected(bulkIsConnected: boolean): void;
1569
- /**
1570
- * Opens the bulk source in a seperate tab. This bulk source could be a google sheet or a csv file.
1571
- */
1572
- openBulkSourceUrl(): void;
1573
- sendGoogleSheetLinkToEmail(email: string): Promise<void>;
1574
- /**
1575
- * Removes a variation from the bulk step.
1576
- * @param recordNumber The record number of the variation to remove.
1577
- */
1578
- deleteVariationRecord(recordNumber: number): void;
1579
- /**
1580
- * @returns The aspects of each step that are modifiable from the bulk handle. These are configured in the workflow.
1581
- */
1582
- getAspects(): import("@spiffcommerce/papyrus").StepAspect[];
1583
- }
1584
- export class IllustrationStepHandle extends StepHandle<_IllustrationStepData1> {
1585
- constructor(manager: WorkflowManager, step: _Step1<_IllustrationStepData1>);
1586
- /**
1587
- * Allows for select a vector from the available vectors configured on this steps base option.
1588
- * @param variant The new vector variant to use for this step.
1589
- * @returns A promise that can be awaited to know when the new vector asset has been updated on the design.
1590
- */
1591
- selectVariant(variant: Variant): Promise<void>;
1592
- /**
1593
- * Get colors for the illustration.
1594
- * @returns A list of color definitions that are currently applied to the illustration.
1595
- */
1596
- getColors(): {
1597
- [key: string]: import("@spiffcommerce/papyrus").ColorDefinition;
1598
- } | undefined;
1599
- /**
1600
- * Set color for the illustration.
1601
- */
1602
- setColor(key: string, value: string): Promise<void>;
1603
- getColorOption(): Promise<import("@spiffcommerce/papyrus").OptionResource | undefined>;
1604
- getAvailableColors(): Promise<{
1605
- fill: string | undefined;
1606
- stroke: string | undefined;
1607
- variant: import("@spiffcommerce/papyrus").VariantResource;
1608
- }[] | undefined>;
1609
- hasVaryingSelection(): boolean | undefined;
1610
- hasVaryingColors(): boolean | undefined;
1611
- isColorPickerEnabled(): boolean | undefined;
1612
- }
1613
- export class MaterialStepHandle extends StepHandle<_MaterialStepData1> {
1614
- constructor(manager: WorkflowManager, step: _Step1<_MaterialStepData1>);
1615
- selectVariant(variant: Variant): Promise<void>;
1616
- }
1617
- export class ModelStepHandle extends StepHandle<_ModelStepData1> {
1618
- constructor(manager: WorkflowManager, step: _Step1<_ModelStepData1>);
1619
- selectVariant(variant: Variant): Promise<void>;
1620
- }
1621
- export class PictureStepHandle extends StepHandle<_PictureStepData1> {
1622
- constructor(manager: WorkflowManager, step: _Step1<_PictureStepData1>);
1623
- /**
1624
- * Allows the user to select an image variant from the available variants configured on this steps base option.
1625
- * @param variant The new image variant to use.
1626
- * @returns A promise that can be awaited to ensure the new image asset has been updated on the design.
1627
- */
1628
- selectVariant(variant: Variant): Promise<void>;
1629
- }
1630
- export class QuestionStepHandle extends StepHandle<_QuestionStepData1> {
1631
- constructor(manager: WorkflowManager, step: _Step1<_QuestionStepData1>);
1632
- selectVariant(variant: Variant): Promise<void>;
1633
- /**
1634
- * The way that this step expects to be rendered.
1635
- */
1636
- getDisplayType(): string | undefined;
1637
- }
1638
- export class ShapeStepHandle extends StepHandle<_ShapeStepData1> {
1639
- constructor(manager: WorkflowManager, step: _Step1<_ShapeStepData1>);
1640
- selectVariant(variant: Variant): Promise<void>;
1641
- /**
1642
- * Sets the color of the shape.
1643
- * @param color The color option to use.
1644
- * @returns A promise resolving when the color has changed in the design.
1645
- * @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
1646
- */
1647
- setColor(color: ColorOption): Promise<void>;
1648
- /**
1649
- * Get available colors for the shape.
1650
- * @returns A list of color definitions that are currently applied to the illustration.
1651
- */
1652
- getColors(): Promise<{
1653
- fill: string | undefined;
1654
- stroke: string | undefined;
1655
- variant: import("@spiffcommerce/papyrus").VariantResource;
1656
- }[]>;
1657
- /**
1658
- * Allows for setting a custom color when the custom variant is selected. Will
1659
- * throw when a non-custom variant is selected.
1660
- */
1661
- setCustomColor(color: string): void;
1662
- getCustomColor(): string;
1663
- }
1664
- interface TextChangeResult {
1665
- input: string;
1666
- helperText?: string;
1667
- errorText?: string;
1668
- }
1669
- export class TextStepHandle extends StepHandle<_TextStepData1> {
1670
- constructor(manager: WorkflowManager, step: _Step1<_TextStepData1>);
1671
- /**
1672
- * Allows for select a font from the available fonts configured on this steps base option.
1673
- * @param variant The font variant to use.
1674
- */
1675
- selectVariant(variant: Variant): Promise<void>;
1676
- /**
1677
- * @returns A list of colors that can be used to fill the text.
1678
- */
1679
- getAvailableFillColors(): ColorOption[];
1680
- /**
1681
- * Changes the fill of text related to this step to the new fill value.
1682
- * @param fill A new fill value to use.
1683
- */
1684
- setFillColor(fill: ColorOption): Promise<void>;
1685
- /**
1686
- * Gets the color currently applied to the element.
1687
- */
1688
- getFillColor(): string;
1689
- getAvailableFillImages(): Promise<TextFillImage[]>;
1690
- setFillImage(fillImage: TextFillImage): Promise<void>;
1691
- getFillImage(): TextFillImage | undefined;
1692
- /**
1693
- * When true & the step has replaceable text configured the user will be
1694
- * abled to edit the entire text string including the non-replaceable text.
1695
- * @param shouldCustomizeAll When true the user can configure the entire text string.
1696
- */
1697
- setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
1698
- /**
1699
- * Changes the text value of text related to this step to a new value.
1700
- * @param userInput Input from the user.
1701
- */
1702
- setText(userInput: string): TextChangeResult;
1703
- /**
1704
- * Gets the text currently applied to the elements of this step.
1705
- */
1706
- getText(): string;
1707
- isReplaceable(): boolean | undefined;
1708
- /**
1709
- * Inform the step that now is the time to
1710
- * clear default text if it should do so.
1711
- * Returns a text change rwsult if a clear occurred.
1712
- */
1713
- clearDefaultTextIfNecessary(): TextChangeResult | undefined;
1714
- hasVaryingText(): boolean | undefined;
1715
- hasVaryingColor(): boolean | undefined;
1716
- hasVaryingSelection(): boolean | undefined;
1717
- hasColorPicker(): boolean | undefined;
1718
- getRegions(): import("@spiffcommerce/papyrus").Region[];
1719
- /**
1720
- * Return the maximum characters allowed for
1721
- * this step, or undefined if there is no limit.
1722
- */
1723
- getCharacterLimit(): number | undefined;
1724
- /**
1725
- * Return the remaining amount of characters that
1726
- * the user is allowed to add, or undefined if there is no limit.
1727
- */
1728
- getCharactersRemaining(): number | undefined;
1729
- }
1730
- 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>;
1731
- export interface SavedDesign {
1203
+
1204
+ 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 | undefined>, workflowMetadata?: WorkflowMetadata) => Promise<DesignCreationMessage>;
1205
+ interface SavedDesign {
1732
1206
  /**
1733
1207
  * The user's name for this saved design.
1734
1208
  */
@@ -1768,6 +1242,8 @@ export interface SavedDesign {
1768
1242
  */
1769
1243
  declare class DesignService {
1770
1244
  readonly localPersistenceKey = "designTransactions";
1245
+ private storageMethod;
1246
+ private designSavedListeners;
1771
1247
  /**
1772
1248
  * @param func The function to call when a design is saved.
1773
1249
  */
@@ -1800,8 +1276,10 @@ declare class DesignService {
1800
1276
  * @param transactionId
1801
1277
  */
1802
1278
  removeDesign(transactionId: string): Promise<void>;
1279
+ private setDesigns;
1803
1280
  }
1804
- export const designService: DesignService;
1281
+ declare const designService: DesignService;
1282
+
1805
1283
  /**
1806
1284
  * A scene is a collection of steps that can be used to group steps together.
1807
1285
  */
@@ -1825,11 +1303,11 @@ interface Scene {
1825
1303
  interface ExperienceOptions {
1826
1304
  product: Product;
1827
1305
  transaction: Transaction;
1828
- workflow?: _Workflow1;
1306
+ workflow?: Workflow;
1829
1307
  previewService?: any;
1830
1308
  modelContainer?: any;
1831
1309
  renderableContextService?: any;
1832
- layouts: _ILayout1[];
1310
+ layouts: ILayout[];
1833
1311
  reloadedState?: LayoutsState;
1834
1312
  /**
1835
1313
  * When true the experience is intended to be immutable.
@@ -1849,7 +1327,7 @@ interface ExperienceOptions {
1849
1327
  * provides a simplified interface for interacting with the workflow manager. You
1850
1328
  * should get an instance of this class from a Client you have constructed previously.
1851
1329
  */
1852
- export interface WorkflowExperience {
1330
+ interface WorkflowExperience {
1853
1331
  /**
1854
1332
  * Returns the client that was responsible for spawning this experience.
1855
1333
  */
@@ -1874,7 +1352,7 @@ export interface WorkflowExperience {
1874
1352
  * Returns the step matching a given name, undefined if not found.
1875
1353
  * @param id The id the step must match.
1876
1354
  */
1877
- getStepById(id: string): StepHandle<_AnyStepData1> | undefined;
1355
+ getStepById(id: string): StepHandle<AnyStepData> | undefined;
1878
1356
  /**
1879
1357
  * Returns the bulk step, undefined if not found.
1880
1358
  */
@@ -1883,21 +1361,21 @@ export interface WorkflowExperience {
1883
1361
  * Returns the step matching a given name, undefined if not found.
1884
1362
  * @param name The name the step must match.
1885
1363
  */
1886
- getStepByName(name: string): StepHandle<_AnyStepData1> | undefined;
1364
+ getStepByName(name: string): StepHandle<AnyStepData> | undefined;
1887
1365
  /**
1888
1366
  * Returns all steps matching a specific type in the workflow. These steps
1889
1367
  * may be across multiple scenes and may or may not be active based on condition state.
1890
1368
  */
1891
- getStepsByType(type: _StepType1): StepHandle<_AnyStepData1>[];
1369
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1892
1370
  /**
1893
1371
  * Returns all steps that are children of a given scene.
1894
1372
  * @param scene The scene you want the steps for.
1895
1373
  */
1896
- getStepsByScene(scene: Scene): StepHandle<_AnyStepData1>[];
1374
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
1897
1375
  /**
1898
1376
  * Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
1899
1377
  */
1900
- getSteps(): StepHandle<_AnyStepData1>[];
1378
+ getSteps(): StepHandle<AnyStepData>[];
1901
1379
  /**
1902
1380
  * Returns a list of scenes that are configured in the workflow. Each scene
1903
1381
  * contains a list of steps. See getStepsByScene to access these.
@@ -1961,8 +1439,9 @@ export interface WorkflowExperience {
1961
1439
  /**
1962
1440
  * To be called when the workflow experience is considered completed by the user.
1963
1441
  * @param onProgressUpdate Progress callback for finalizing the design. Optional
1442
+ * @param capturePreviewImage When true a preview image will be generated for the design. Defaults to true.
1964
1443
  */
1965
- onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate): Promise<DesignCreationMessage>;
1444
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1966
1445
  /**
1967
1446
  * Returns the metadata associated with this workflow experience.
1968
1447
  * This is a combination of the metadata from the workflow, and the selections made by the user.
@@ -1971,11 +1450,13 @@ export interface WorkflowExperience {
1971
1450
  [key: string]: string;
1972
1451
  }>;
1973
1452
  }
1974
- export class WorkflowExperienceImpl implements WorkflowExperience {
1453
+ declare class WorkflowExperienceImpl implements WorkflowExperience {
1975
1454
  readonly client: SpiffCommerceClient;
1976
1455
  readonly commandContext: CommandContext;
1977
1456
  readonly workflowManager: WorkflowManager;
1978
1457
  readonly isReadOnly: boolean;
1458
+ private renderableScenes;
1459
+ private renderableSceneCallbacks;
1979
1460
  constructor(client: SpiffCommerceClient, experienceOptions: ExperienceOptions);
1980
1461
  getClient(): SpiffCommerceClient;
1981
1462
  getIsReadOnly(): boolean;
@@ -1983,48 +1464,37 @@ export class WorkflowExperienceImpl implements WorkflowExperience {
1983
1464
  getWorkflowManager(): WorkflowManager;
1984
1465
  updateVariationRecords(variationRecords: VariationRecord[]): Promise<void>;
1985
1466
  createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
1986
- getStepById(id: string): BulkStepHandle | import("index").IllustrationStepHandle | import("index").MaterialStepHandle | import("index").ModelStepHandle | import("index").PictureStepHandle | import("index").QuestionStepHandle | import("index").ShapeStepHandle | import("index").TextStepHandle | import("index").FrameStepHandle | undefined;
1987
- getSteps(): StepHandle<_AnyStepData1>[];
1467
+ getStepById(id: string): TextStepHandle | FrameStepHandle | BulkStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
1468
+ getSteps(): StepHandle<AnyStepData>[];
1988
1469
  getScenes(): Scene[];
1989
1470
  getSelectionPriceSubunits(): number;
1990
1471
  getBasePriceSubunits(): number;
1991
1472
  getTotalPriceSubunits(): number;
1992
1473
  getBulkStep(): BulkStepHandle | undefined;
1993
- getStepByName(name: string): BulkStepHandle | import("index").IllustrationStepHandle | import("index").MaterialStepHandle | import("index").ModelStepHandle | import("index").PictureStepHandle | import("index").QuestionStepHandle | import("index").ShapeStepHandle | import("index").TextStepHandle | import("index").FrameStepHandle | undefined;
1994
- getStepsByType(type: _StepType1): StepHandle<_AnyStepData1>[];
1995
- getStepsByScene(scene: Scene): StepHandle<_AnyStepData1>[];
1474
+ getStepByName(name: string): TextStepHandle | FrameStepHandle | BulkStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
1475
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
1476
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
1996
1477
  attachCustomerDetails(details: {
1997
1478
  email: string;
1998
1479
  }): Promise<void>;
1999
1480
  assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
2000
1481
  attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
2001
1482
  detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
2002
- debouncedSavedDesignUpdate: import("lodash").DebouncedFunc<() => Promise<void>>;
1483
+ debouncedSavedDesignUpdate: lodash.DebouncedFunc<() => Promise<void>>;
2003
1484
  save(title?: string): Promise<SavedDesign>;
2004
1485
  copy(): Promise<WorkflowExperience>;
2005
- onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate): Promise<DesignCreationMessage>;
1486
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
1487
+ /**
1488
+ * @param step The step to test against.
1489
+ * @returns Returns true when a valid handle is implemented for a given step type. Certain steps don't support handles, such as silent illustrations.
1490
+ */
1491
+ private stepHasHandle;
1492
+ private getCanvasObjectURLAsync;
2006
1493
  getExportedData(): Map<string, {
2007
1494
  [key: string]: string;
2008
1495
  }>;
2009
1496
  }
2010
- export enum FrameStep {
2011
- SelectFrame = "SelectFrame",
2012
- SelectImage = "SelectImage",
2013
- Position = "Position"
2014
- }
2015
- export class FrameStepHandle extends StepHandle<_FrameStepData1> {
2016
- constructor(manager: WorkflowManager, step: _Step1<_FrameStepData1>);
2017
- selectVariant(variant: Variant): Promise<void>;
2018
- onFrameDataChanged(callback: (frameData: _FrameData1[]) => void): void;
2019
- selectImage(asset: _Asset1): void;
2020
- getImageData(): PatternImageData | undefined;
2021
- getCurrentFrameStep(frameData: _FrameData1, uploading?: any, imageUploadComplete?: any, variants?: _VariantResource1[]): FrameStep;
2022
- getFrameService(): FrameService | undefined;
2023
- hasOverlayImageKey(): string | undefined;
2024
- hasOverlayImageUrl(): any;
2025
- hasVaryingUpload(): boolean | undefined;
2026
- hasVaryingSelection(): boolean | undefined;
2027
- }
1497
+
2028
1498
  /**
2029
1499
  * A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
2030
1500
  * bundles can return a handle for any global properties associated to the collection.
@@ -2062,17 +1532,73 @@ declare abstract class GlobalPropertyHandle {
2062
1532
  * Returns all steps that share this property.
2063
1533
  * @param targetExperiences Optionally filter the steps to only those in the given experiences.
2064
1534
  */
2065
- protected getSharedSteps(targetExperiences?: WorkflowExperience[]): import("stepHandles").StepHandle<import("index").AnyStepData>[];
1535
+ protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
2066
1536
  }
1537
+
2067
1538
  interface GlobalPropertyStateManager {
2068
1539
  getGlobalPropertyState(): GlobalPropertyState | undefined;
2069
1540
  getAspect(name: string): string | undefined;
2070
1541
  setAspect(name: string, value: string): Promise<void>;
2071
1542
  }
1543
+
1544
+ /**
1545
+ * A collection of products that can be used to form a bundle.
1546
+ */
1547
+ declare class ProductCollection {
1548
+ private readonly collection;
1549
+ constructor(collection: ProductCollectionResource);
1550
+ /**
1551
+ * The ID of the product collection.
1552
+ */
1553
+ getId(): string;
1554
+ /**
1555
+ * The name of the collection.
1556
+ */
1557
+ getName(): string;
1558
+ /**
1559
+ * A list of products in this collections with useful helpers for interacting with them.
1560
+ */
1561
+ getProducts(): CollectionProduct[];
1562
+ /**
1563
+ * The raw collection resource. This is generally not needed and should be avoided.
1564
+ */
1565
+ getResource(): ProductCollectionResource;
1566
+ }
1567
+ /**
1568
+ * A collection product is a product within a ProductCollection. It provides a simple interface for interacting with the product.
1569
+ */
1570
+ declare class CollectionProduct {
1571
+ private readonly product;
1572
+ constructor(product: Product);
1573
+ /**
1574
+ * The ID of the product in SpiffCommerce.
1575
+ * @returns
1576
+ */
1577
+ getId(): string;
1578
+ /**
1579
+ * The name of the product. Human readable.
1580
+ */
1581
+ getName(): string;
1582
+ /**
1583
+ * A helper function for getting integrations
1584
+ * @param type The type of integration you want.
1585
+ * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
1586
+ */
1587
+ getIntegrationByType(type: IntegrationType): IntegrationProduct;
1588
+ /**
1589
+ * A list of all integrations this product is connected to.
1590
+ */
1591
+ getIntegrations(): IntegrationProduct[];
1592
+ /**
1593
+ * The raw product resource. This is generally not needed and should be avoided.
1594
+ */
1595
+ getResource(): Product;
1596
+ }
1597
+
2072
1598
  /**
2073
1599
  * A bundle serves as a container for a set of workflow experience.
2074
1600
  */
2075
- export interface Bundle {
1601
+ interface Bundle {
2076
1602
  /**
2077
1603
  * @returns The client that this bundle is associated with.
2078
1604
  */
@@ -2214,8 +1740,9 @@ export interface Bundle {
2214
1740
  * Finalizes all experiences within the bundle. This will return a promise that resolves when all experiences have been finalized.
2215
1741
  * The promise resolves with a list of messages that indicate the status of each experience including
2216
1742
  * helpful details like what product to add to cart on supported e-commerce platforms.
1743
+ * @param onProgressUpdate A callback that will be called when the progress of the finalization changes.
2217
1744
  */
2218
- finish(): Promise<DesignCreationMessage[]>;
1745
+ finish(onProgressUpdate?: DesignCreationProgressUpdate): Promise<DesignCreationMessage[]>;
2219
1746
  /**
2220
1747
  * Add an event listener to this bundle.
2221
1748
  * @param event The event to listen for. Currently only "conditional-global-properties-changed" is supported.
@@ -2265,6 +1792,7 @@ interface ConditionalGlobalPropertiesChangedEventData {
2265
1792
  interface WorkflowExperienceHoverEventData {
2266
1793
  workflowExperience: WorkflowExperience;
2267
1794
  }
1795
+
2268
1796
  interface ExecutionResponse {
2269
1797
  id: string;
2270
1798
  completedAt?: string;
@@ -2290,7 +1818,7 @@ declare abstract class FlowExecutionInput {
2290
1818
  /**
2291
1819
  * Represents the type of object being referenced by the input.
2292
1820
  */
2293
- export const enum ObjectInputType {
1821
+ declare const enum ObjectInputType {
2294
1822
  Transaction = "Transaction",
2295
1823
  Bundle = "Bundle",
2296
1824
  Product = "Product",
@@ -2302,18 +1830,19 @@ export const enum ObjectInputType {
2302
1830
  /**
2303
1831
  * Handles validation of spiffObject structure for transmission to the server.
2304
1832
  */
2305
- export class ObjectInput extends FlowExecutionInput {
1833
+ declare class ObjectInput extends FlowExecutionInput {
2306
1834
  constructor(id: string, type: ObjectInputType);
2307
1835
  static validUUID(uuid: string): RegExpMatchArray | null;
2308
1836
  }
2309
1837
  /**
2310
1838
  * Handles validation of text input for transmission to the server.
2311
1839
  */
2312
- export class TextInput extends FlowExecutionInput {
1840
+ declare class TextInput extends FlowExecutionInput {
2313
1841
  constructor(id: string);
2314
1842
  }
2315
- export const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<_Workflow1[]>;
2316
- export const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<_Workflow1>;
1843
+
1844
+ declare const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<Workflow[]>;
1845
+ declare const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<Workflow>;
2317
1846
  /**
2318
1847
  * Options that can be used during instantiation of the SpiffCommerce Javascript Client.
2319
1848
  * Please refer to the documentation for more information.
@@ -2374,12 +1903,21 @@ interface GetWorkflowFromExternalProductOptions extends GetWorkflowOptionsBase {
2374
1903
  bulk?: boolean;
2375
1904
  type: "external";
2376
1905
  }
2377
- export type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
1906
+ type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
2378
1907
  /**
2379
1908
  * The Spiff Commerce Javascript Client. Required for
2380
1909
  * creating workflow experiences.
2381
1910
  */
2382
- export class SpiffCommerceClient {
1911
+ declare class SpiffCommerceClient {
1912
+ private options;
1913
+ private initialized;
1914
+ private currencyCode?;
1915
+ private customer?;
1916
+ /**
1917
+ * @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
1918
+ * Any functionality referencing this object will be removed in a future release.
1919
+ */
1920
+ private experienceOptions?;
2383
1921
  constructor(options: ClientOptions);
2384
1922
  /**
2385
1923
  * @returns The asset manager allows for common operations related to assets
@@ -2412,7 +1950,7 @@ export class SpiffCommerceClient {
2412
1950
  transactionReadOnly?: boolean;
2413
1951
  stakeholderType?: StakeholderType;
2414
1952
  success: boolean;
2415
- theme?: _Theme1;
1953
+ theme?: Theme;
2416
1954
  }>;
2417
1955
  clearCustomer(): void;
2418
1956
  clearCustomerForTransaction(transactionId: string): void;
@@ -2421,6 +1959,7 @@ export class SpiffCommerceClient {
2421
1959
  customer: Customer;
2422
1960
  isAuthenticated: boolean;
2423
1961
  }>;
1962
+ private authenticateCustomerId;
2424
1963
  /**
2425
1964
  * Generates a verification code for the given email address.
2426
1965
  * @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
@@ -2459,7 +1998,7 @@ export class SpiffCommerceClient {
2459
1998
  * @param options Options to configure loading the transaction and workflow.
2460
1999
  * @returns A workflow experience configured as requested.
2461
2000
  */
2462
- getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: _Workflow1) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
2001
+ getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => any, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
2463
2002
  /**
2464
2003
  * Gets multiple workflow experiences at once.
2465
2004
  * @param optionsArray An array of options to configure loading the transactions and workflows.
@@ -2481,6 +2020,10 @@ export class SpiffCommerceClient {
2481
2020
  * @deprecated Use getWorkflowExperience to initialize the experience.
2482
2021
  */
2483
2022
  initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
2023
+ /**
2024
+ * @deprecated Remove when the initFrom functions are removed.
2025
+ */
2026
+ private getWorkflowExperienceDeprecated;
2484
2027
  /**
2485
2028
  * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
2486
2029
  * @returns The preview service that was provided during construction.
@@ -2490,26 +2033,259 @@ export class SpiffCommerceClient {
2490
2033
  * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
2491
2034
  * @returns The product associated with this client.
2492
2035
  */
2493
- getProduct(): import("types").Product;
2036
+ getProduct(): Product;
2494
2037
  /**
2495
2038
  * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
2496
2039
  * @returns The transaction associated with this client.
2497
2040
  */
2498
2041
  getTransaction(): Transaction;
2042
+ /**
2043
+ * A function used to synchronize transaction state with the server.
2044
+ * @param options New state details. To be spread into the query.
2045
+ * @returns
2046
+ */
2047
+ private updateTransactionState;
2048
+ storeCustomer(customer: Customer): void;
2499
2049
  }
2500
- export class MockWorkflowManager implements WorkflowManager {
2501
- getInitializationPromise(): Promise<void>;
2502
- getProduct: () => Product;
2503
- isInitialized(): boolean;
2504
- getCommandContext: () => _CommandContext1;
2505
- getAllLayoutData: () => LayoutState[];
2050
+
2051
+ declare class Configuration {
2052
+ private readonly defaultServerUrl;
2053
+ private readonly defaultServicesApiUrl;
2054
+ private readonly defaultHubUrl;
2055
+ private serverUrl;
2056
+ private servicesApiUrl;
2057
+ private hubUrl;
2058
+ private serverUrlCallbacks;
2059
+ constructor();
2060
+ getServerUrl(): string;
2061
+ getServicesApiUrl(): string;
2062
+ getHubUrl(): string;
2063
+ setServerUrl(serverUrl: string): void;
2064
+ setServicesApiUrl(servicesApiUrl: string): void;
2065
+ setHubUrl(hubUrl: string): void;
2066
+ addServerUrlCallback(callback: () => void): void;
2067
+ }
2068
+ declare const spiffCoreConfiguration: Configuration;
2069
+
2070
+ declare const gatherVaryingStepAspects: (workflow: Workflow) => StepAspect[];
2071
+
2072
+ type ToastCallback = (callbackOptions: {
2073
+ toastMessage: null | string;
2074
+ toastType: InformationMessageType | null;
2075
+ }) => void;
2076
+ declare class Toast {
2077
+ private latestToast;
2078
+ private toastType;
2079
+ private toastCallbacks;
2080
+ constructor();
2081
+ addToastCallback(callback: ToastCallback): void;
2082
+ setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
2083
+ private onToastChange;
2084
+ }
2085
+ declare const toast: Toast;
2086
+
2087
+ interface FrameCreateOpts {
2088
+ stepName?: string;
2089
+ frameData: FrameData;
2090
+ disablePlaceholder?: boolean;
2091
+ focalBlur?: boolean;
2092
+ focalBlurStrength?: number;
2093
+ focalBlurRadius?: number;
2094
+ pattern?: any;
2095
+ }
2096
+ declare class FrameStepService implements StepService<FrameStepData> {
2097
+ init(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2098
+ private reload;
2099
+ selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager): void;
2100
+ selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
2101
+ getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): CreateElementCommand<FrameElement>;
2102
+ loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
2103
+ private selectVariantCommand;
2104
+ private frameSourceSvg;
2105
+ /**
2106
+ * Grab the source to be used for a frame from the variant or throw otherwise.
2107
+ */
2108
+ private patternSource;
2109
+ private loadPatternFromAsset;
2110
+ }
2111
+ declare const frameStepService: FrameStepService;
2112
+
2113
+ interface SVGCreateOpts {
2114
+ stepName?: string;
2115
+ src: string;
2116
+ objectURL: string;
2117
+ svg: {
2118
+ svg: string;
2119
+ colors: {
2120
+ [key: string]: ColorDefinition;
2121
+ };
2122
+ };
2123
+ }
2124
+ declare class IllustrationStepService implements StepService<IllustrationStepData> {
2125
+ getIllustrationBody(src: string): Promise<string>;
2126
+ getCreateElementCommand(id: string, region: Region, layout: ILayout, options: SVGCreateOpts): CreateElementCommand<IllustrationElement>;
2127
+ getColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): never[] | {
2128
+ [key: string]: ColorDefinition;
2129
+ };
2130
+ init(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2131
+ private reload;
2132
+ availableColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): Promise<{
2133
+ fill: string | undefined;
2134
+ stroke: string | undefined;
2135
+ variant: VariantResource;
2136
+ }[] | undefined>;
2137
+ changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<CanvasCommand>;
2138
+ changeColors(stepData: Step<IllustrationStepData>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => LayoutData[], newFills: Map<string, string>): Promise<void>;
2139
+ selectVariant(stepData: Step<IllustrationStepData>, variant: VariantResource, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
2140
+ private selectVariantCommand;
2141
+ }
2142
+ declare const illustrationStepService: IllustrationStepService;
2143
+
2144
+ declare class MaterialStepService implements StepService<MaterialStepData> {
2145
+ init(stepData: Step<MaterialStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<null | CommandWithFollowup>;
2146
+ private reload;
2147
+ selectVariant(step: Step<MaterialStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
2148
+ private selectVariantLambda;
2149
+ }
2150
+ declare const materialStepService: MaterialStepService;
2151
+
2152
+ declare class ModelStepService implements StepService<ModelStepData> {
2153
+ init(stepData: Step<ModelStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2154
+ private reload;
2155
+ selectVariant(step: Step<ModelStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
2156
+ private selectVariantLambda;
2157
+ }
2158
+ declare const modelStepService: ModelStepService;
2159
+
2160
+ interface TextFillSpotColor {
2161
+ profileName: string;
2162
+ namedColor: string;
2163
+ }
2164
+ interface TextUpdateResult {
2165
+ command?: GroupCommand;
2166
+ helperText: string;
2167
+ errors: TextError[];
2168
+ }
2169
+ interface TextError {
2170
+ localizationKey: string;
2171
+ }
2172
+ declare class TextStepService implements StepService<TextStepData> {
2173
+ private cachedColors;
2174
+ init(stepData: Step<TextStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2175
+ findLayoutElements(workflowManager: WorkflowManager, step: Step<TextStepData>): TextboxElement[];
2176
+ /**
2177
+ * Get the colors that can be used for a given text step.
2178
+ * @param stepData The text step to get colors for.
2179
+ * @returns A list of color objects containg fill, stroke and variant if available.
2180
+ */
2181
+ availableFillColors(stepData: Step<TextStepData>): ColorOption[];
2182
+ changeFillColor(stepData: Step<TextStepData>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2183
+ availableFillImages(stepData: Step<TextStepData>): Promise<TextFillImage[]>;
2184
+ changeFillImage(stepData: Step<TextStepData>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2185
+ /**
2186
+ * Given an element and a string, filters any characters from the string that are
2187
+ * not supported by the font of the given element.
2188
+ * @param text The text string to filter.
2189
+ * @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.
2190
+ * @returns A new string representing the passed string with unsupported characters removed.
2191
+ */
2192
+ filterUnsupportedCharacters: (text: string, fontData?: FontData) => string;
2193
+ getProcessedInput(input: string, stepData: TextStepData, customiseAllText: boolean): string;
2194
+ updateInputText(input: string, elements: TextboxElement[], step: Step<TextStepData>, workflowManager: WorkflowManager): TextUpdateResult;
2195
+ selectVariant(step: Step<TextStepData>, variant: VariantResource, workflowManager: WorkflowManager, setError: (status: boolean) => void, setHelperText: (text: string) => void): Promise<void>;
2196
+ textAlign: (stepData: TextStepData) => string;
2197
+ createTextFillSpotColor(colorOption: OptionResource, variant: VariantResource): TextFillSpotColor | undefined;
2198
+ private reload;
2199
+ private getDefaultColorVariant;
2200
+ private getDefaultColor;
2201
+ private getDefaultImageFillVariant;
2202
+ /**
2203
+ * Validates a string of text based on step confoiguration.
2204
+ * @param text The text to validate
2205
+ * @param step The step providing configuration
2206
+ * @param workflowManager Workflow manager for access to workflow state
2207
+ * @returns A list of errors. Empty if the text passes validation.
2208
+ */
2209
+ private getErrorsForText;
2210
+ private fontDataFromVariant;
2211
+ private selectVariantCommand;
2212
+ /**
2213
+ * When a text step specifies replaceable text, the text input by the user will replace
2214
+ * a specific token within a larger string of text specified in the step configuration. Otherwise
2215
+ * this function will just return the text it's given when the feature is disabled.
2216
+ */
2217
+ private injectReplaceableText;
2218
+ private createTextboxRegions;
2219
+ private generateTextChangeCommandsForRegion;
2220
+ /**
2221
+ * @deprecated
2222
+ */
2223
+ private changeInputTextWithRegion;
2224
+ }
2225
+ declare const textStepService: TextStepService;
2226
+
2227
+ declare class PictureStepService implements StepService<PictureStepData> {
2228
+ init(stepData: Step<PictureStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2229
+ private reload;
2230
+ selectVariant(stepData: Step<PictureStepData>, variant: VariantResource, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
2231
+ private selectVariantCommand;
2232
+ }
2233
+ declare const pictureStepService: PictureStepService;
2234
+
2235
+ declare class QuestionStepService implements StepService<QuestionStepData> {
2236
+ init(stepData: Step<QuestionStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2237
+ private reload;
2238
+ selectVariant(stepData: Step<QuestionStepData>, variantId: string, workflowManager: WorkflowManager): Promise<void>;
2239
+ private selectVariantLambda;
2240
+ }
2241
+ declare const questionStepService: QuestionStepService;
2242
+
2243
+ declare class ShapeStepService implements StepService<ShapeStepData> {
2244
+ readonly shapeFillId = "spiff-fill-shape";
2245
+ availableColours(stepData: Step<ShapeStepData>): Promise<{
2246
+ fill: string | undefined;
2247
+ stroke: string | undefined;
2248
+ variant: VariantResource;
2249
+ }[]>;
2250
+ setCustomColor(color: string, stepData: Step<ShapeStepData>, manager: WorkflowManager): void;
2251
+ init(stepData: Step<ShapeStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2252
+ selectVariant(stepData: Step<ShapeStepData>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2253
+ private reload;
2254
+ private selectVariantCommand;
2255
+ }
2256
+ declare const shapeStepService: ShapeStepService;
2257
+
2258
+ declare class ModuleStepService implements StepService<ModuleStepData> {
2259
+ init(stepData: Step<ModuleStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2260
+ private reload;
2261
+ changeText(stepData: Step<ModuleStepData>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
2262
+ private changeTextCommand;
2263
+ private validateInput;
2264
+ }
2265
+ declare const moduleStepService: ModuleStepService;
2266
+
2267
+ declare class DigitalContentStepService implements StepService<DigitalContentStepData> {
2268
+ init(stepData: Step<DigitalContentStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2269
+ private reload;
2270
+ 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>;
2271
+ private regionElements;
2272
+ private command;
2273
+ }
2274
+ declare const digitalContentStepService: DigitalContentStepService;
2275
+
2276
+ declare class MockWorkflowManager implements WorkflowManager {
2277
+ getInitializationPromise(): Promise<void>;
2278
+ getProduct: () => Product;
2279
+ isInitialized(): boolean;
2280
+ getCommandContext: () => CommandContext;
2281
+ getAllLayoutData: () => LayoutState[];
2506
2282
  getMetadata: (stepName: string) => StepMetadata | undefined;
2507
2283
  getWorkflowMetadata: () => WorkflowMetadata;
2508
- getStepStorage: (stepName: string) => _StepStorage1 | undefined;
2284
+ getStepStorage: (stepName: string) => StepStorage | undefined;
2509
2285
  getInformationResults(): InformationResult[];
2510
2286
  getVariationRecords(): VariationRecord[];
2511
2287
  reset(): Promise<void>;
2512
- updateStateWithServer(_getReducerState: () => _CommandState1): void;
2288
+ updateStateWithServer(_getReducerState: () => CommandState): void;
2513
2289
  addVariationRecord(_variationRecord: Omit<VariationRecord, "recordNumber">): {
2514
2290
  recordNumber: number;
2515
2291
  transactionId: string;
@@ -2518,7 +2294,7 @@ export class MockWorkflowManager implements WorkflowManager {
2518
2294
  getCurrentVariationRecord(): undefined;
2519
2295
  removeVariationRecord(_recordNumber: number): never[];
2520
2296
  outstandingRequestsPromise(): Promise<void>;
2521
- updateStateWithServerImmediate(_getReducerState: () => _CommandState1): Promise<void>;
2297
+ updateStateWithServerImmediate(_getReducerState: () => CommandState): Promise<void>;
2522
2298
  addPoller(_poller: Poller): void;
2523
2299
  addConfirmCallback(_callback: ConfirmCallback): void;
2524
2300
  addCurrentVariationCallback(_callback: CurrentVariationRecordCallback): void;
@@ -2533,7 +2309,7 @@ export class MockWorkflowManager implements WorkflowManager {
2533
2309
  addStepSpecificStorageCallback(_callback: StepSpecificStorageCallback, _stepName: string): void;
2534
2310
  addStorageCallback(_callback: StorageCallback): void;
2535
2311
  addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
2536
- getCommandDispatcher(): (_command: _CanvasCommand1) => void;
2312
+ getCommandDispatcher(): (_command: CanvasCommand) => void;
2537
2313
  getLayouts(): never[];
2538
2314
  getLayoutPreviewService(): {
2539
2315
  getAll: () => Map<any, any>;
@@ -2571,17 +2347,311 @@ export class MockWorkflowManager implements WorkflowManager {
2571
2347
  setEditedStatus(_stepName: string, _status: boolean): void;
2572
2348
  setInformationResults(_results: InformationResult[]): void;
2573
2349
  setMandatoryFulfilled(_stepName: string, _status: boolean): void;
2574
- setSelectionsAndElements(_stepName: string, _variants: _VariantResource1[], _elements: RegionElement[]): Promise<void>;
2350
+ setSelectionsAndElements(_stepName: string, _variants: VariantResource[], _elements: RegionElement[]): Promise<void>;
2575
2351
  setVariationRecords(_variationRecords: VariationRecord[]): void;
2576
2352
  toggleDesignConfirmed(): void;
2577
2353
  updateMetadata(_stepName: string, _update: any): void;
2578
- updateStorage(_stepName: string, _update: _StepStorage1): Promise<void>;
2354
+ updateStorage(_stepName: string, _update: StepStorage): Promise<void>;
2579
2355
  injectIntoPreviewService(_previewService: any): Promise<void>;
2580
2356
  ejectFromPreviewService(): void;
2581
2357
  }
2582
- export const TransformWrapper: React.FunctionComponent;
2583
- export { CommandContext };
2584
- 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 };
2585
- 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 };
2586
2358
 
2587
- //# sourceMappingURL=types.d.ts.map
2359
+ interface DesignInputStep {
2360
+ data: DesignInputStepData;
2361
+ name: string;
2362
+ }
2363
+ interface DesignInputStepData {
2364
+ }
2365
+
2366
+ declare const generateCommands: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<CanvasCommand[]>;
2367
+
2368
+ declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
2369
+ constructor(manager: WorkflowManager, step: Step<IllustrationStepData>);
2370
+ /**
2371
+ * Allows for select a vector from the available vectors configured on this steps base option.
2372
+ * @param variant The new vector variant to use for this step.
2373
+ * @returns A promise that can be awaited to know when the new vector asset has been updated on the design.
2374
+ */
2375
+ selectVariant(variant: Variant): Promise<void>;
2376
+ /**
2377
+ * Get colors for the illustration.
2378
+ * @returns A list of color definitions that are currently applied to the illustration.
2379
+ */
2380
+ getColors(): {
2381
+ [key: string]: _spiffcommerce_papyrus.ColorDefinition;
2382
+ } | undefined;
2383
+ /**
2384
+ * Set color for the illustration.
2385
+ */
2386
+ setColor(key: string, value: string): Promise<void>;
2387
+ getColorOption(): Promise<_spiffcommerce_papyrus.OptionResource | undefined>;
2388
+ getAvailableColors(): Promise<{
2389
+ fill: string | undefined;
2390
+ stroke: string | undefined;
2391
+ variant: _spiffcommerce_papyrus.VariantResource;
2392
+ }[] | undefined>;
2393
+ hasVaryingSelection(): boolean | undefined;
2394
+ hasVaryingColors(): boolean | undefined;
2395
+ isColorPickerEnabled(): boolean | undefined;
2396
+ }
2397
+
2398
+ interface TextChangeResult {
2399
+ input: string;
2400
+ helperText?: string;
2401
+ errorText?: string;
2402
+ }
2403
+ declare class TextStepHandle extends StepHandle<TextStepData> {
2404
+ constructor(manager: WorkflowManager, step: Step<TextStepData>);
2405
+ /**
2406
+ * Allows for select a font from the available fonts configured on this steps base option.
2407
+ * @param variant The font variant to use.
2408
+ */
2409
+ selectVariant(variant: Variant): Promise<void>;
2410
+ /**
2411
+ * @returns A list of colors that can be used to fill the text.
2412
+ */
2413
+ getAvailableFillColors(): ColorOption[];
2414
+ /**
2415
+ * Changes the fill of text related to this step to the new fill value.
2416
+ * @param fill A new fill value to use.
2417
+ */
2418
+ setFillColor(fill: ColorOption): Promise<void>;
2419
+ /**
2420
+ * Gets the color currently applied to the element.
2421
+ */
2422
+ getFillColor(): string;
2423
+ getAvailableFillImages(): Promise<TextFillImage[]>;
2424
+ setFillImage(fillImage: TextFillImage): Promise<void>;
2425
+ getFillImage(): TextFillImage | undefined;
2426
+ /**
2427
+ * When true & the step has replaceable text configured the user will be
2428
+ * abled to edit the entire text string including the non-replaceable text.
2429
+ * @param shouldCustomizeAll When true the user can configure the entire text string.
2430
+ */
2431
+ setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
2432
+ /**
2433
+ * Changes the text value of text related to this step to a new value.
2434
+ * @param userInput Input from the user.
2435
+ */
2436
+ setText(userInput: string): TextChangeResult;
2437
+ /**
2438
+ * Gets the text currently applied to the elements of this step.
2439
+ */
2440
+ getText(): string;
2441
+ isReplaceable(): boolean | undefined;
2442
+ /**
2443
+ * Inform the step that now is the time to
2444
+ * clear default text if it should do so.
2445
+ * Returns a text change rwsult if a clear occurred.
2446
+ */
2447
+ clearDefaultTextIfNecessary(): TextChangeResult | undefined;
2448
+ hasVaryingText(): boolean | undefined;
2449
+ hasVaryingColor(): boolean | undefined;
2450
+ hasVaryingSelection(): boolean | undefined;
2451
+ hasColorPicker(): boolean | undefined;
2452
+ getRegions(): _spiffcommerce_papyrus.Region[];
2453
+ /**
2454
+ * Return the maximum characters allowed for
2455
+ * this step, or undefined if there is no limit.
2456
+ */
2457
+ getCharacterLimit(): number | undefined;
2458
+ /**
2459
+ * Return the remaining amount of characters that
2460
+ * the user is allowed to add, or undefined if there is no limit.
2461
+ */
2462
+ getCharactersRemaining(): number | undefined;
2463
+ }
2464
+
2465
+ declare class PictureStepHandle extends StepHandle<PictureStepData> {
2466
+ constructor(manager: WorkflowManager, step: Step<PictureStepData>);
2467
+ /**
2468
+ * Allows the user to select an image variant from the available variants configured on this steps base option.
2469
+ * @param variant The new image variant to use.
2470
+ * @returns A promise that can be awaited to ensure the new image asset has been updated on the design.
2471
+ */
2472
+ selectVariant(variant: Variant): Promise<void>;
2473
+ }
2474
+
2475
+ /**
2476
+ * A generic base class for custom errors that assigns the name
2477
+ * of the error class automatically. All custom errors should extend this.
2478
+ */
2479
+ declare abstract class CustomError extends Error {
2480
+ constructor(message: any);
2481
+ }
2482
+ /**
2483
+ * A custom class for categorising errors related to workflow configuration.
2484
+ */
2485
+ declare abstract class ConfigurationError extends CustomError {
2486
+ constructor(message: any);
2487
+ }
2488
+ /**
2489
+ * Thrown when an option was expected but not found in the workflow configuration or
2490
+ * the server returned a 404 for an option we expected.
2491
+ */
2492
+ declare class OptionNotFoundError extends ConfigurationError {
2493
+ readonly optionId: string;
2494
+ constructor(step: Step<AnyStepData>);
2495
+ }
2496
+ /**
2497
+ * Thrown when a layout is not found for a given region entity. This
2498
+ * can occur when panels are deleted from a workflow but steps are still relying
2499
+ * on the layout being present.
2500
+ */
2501
+ declare class LayoutNotFoundError extends ConfigurationError {
2502
+ readonly panelId: string;
2503
+ constructor(region: Region);
2504
+ }
2505
+ /**
2506
+ * Thrown when an asset is not found on a specific variant. This can occur when
2507
+ * the asset wasn't configured in hub and the variant is loaded in a workflow.
2508
+ */
2509
+ declare class AssetNotFoundError extends ConfigurationError {
2510
+ readonly variant: VariantResource;
2511
+ constructor(variant: VariantResource);
2512
+ }
2513
+ /**
2514
+ * Thrown when a resource is not found linked to a specific asset. This
2515
+ * can occur when generation of a resource fails or hasn't completed. Or may be
2516
+ * a sign of a misconfiguration.
2517
+ */
2518
+ declare class ResourceNotFoundError extends ConfigurationError {
2519
+ readonly asset: Asset;
2520
+ constructor(asset: Asset);
2521
+ }
2522
+ /**
2523
+ * Thrown when configuration is missing when it was expected. More generic
2524
+ * to cover remaining cases outside of the more specific ones such as options, variants & assets.
2525
+ */
2526
+ declare class MisconfigurationError extends ConfigurationError {
2527
+ readonly step: Step<AnyStepData>;
2528
+ constructor(step: Step<AnyStepData>, message: string);
2529
+ }
2530
+ /**
2531
+ * A custom class for categorising errors related to implementation of core.
2532
+ */
2533
+ declare abstract class ImplementationError extends CustomError {
2534
+ constructor(message: any);
2535
+ }
2536
+ /**
2537
+ * Thrown when we hit a case that we didn't expect to happen
2538
+ */
2539
+ declare class UnhandledBehaviorError extends ImplementationError {
2540
+ constructor(message: string);
2541
+ }
2542
+ /**
2543
+ * Thrown when we fail to parse something that we expected to be valid
2544
+ */
2545
+ declare class ParseError extends ImplementationError {
2546
+ constructor(message: string);
2547
+ }
2548
+
2549
+ declare class ModelStepHandle extends StepHandle<ModelStepData> {
2550
+ constructor(manager: WorkflowManager, step: Step<ModelStepData>);
2551
+ selectVariant(variant: Variant): Promise<void>;
2552
+ }
2553
+
2554
+ declare enum FrameStep {
2555
+ SelectFrame = "SelectFrame",
2556
+ SelectImage = "SelectImage",
2557
+ Position = "Position"
2558
+ }
2559
+ declare class FrameStepHandle extends StepHandle<FrameStepData> {
2560
+ constructor(manager: WorkflowManager, step: Step<FrameStepData>);
2561
+ private frameService;
2562
+ selectVariant(variant: Variant): Promise<void>;
2563
+ onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
2564
+ selectImage(asset: Asset): void;
2565
+ getImageData(): PatternImageData | undefined;
2566
+ getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
2567
+ getFrameService(): FrameService | undefined;
2568
+ hasOverlayImageKey(): string | undefined;
2569
+ hasOverlayImageUrl(): any;
2570
+ hasVaryingUpload(): boolean | undefined;
2571
+ hasVaryingSelection(): boolean | undefined;
2572
+ }
2573
+
2574
+ declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
2575
+ constructor(manager: WorkflowManager, step: Step<MaterialStepData>);
2576
+ selectVariant(variant: Variant): Promise<void>;
2577
+ }
2578
+
2579
+ declare class QuestionStepHandle extends StepHandle<QuestionStepData> {
2580
+ constructor(manager: WorkflowManager, step: Step<QuestionStepData>);
2581
+ selectVariant(variant: Variant): Promise<void>;
2582
+ /**
2583
+ * The way that this step expects to be rendered.
2584
+ */
2585
+ getDisplayType(): string | undefined;
2586
+ }
2587
+
2588
+ declare class ShapeStepHandle extends StepHandle<ShapeStepData> {
2589
+ constructor(manager: WorkflowManager, step: Step<ShapeStepData>);
2590
+ selectVariant(variant: Variant): Promise<void>;
2591
+ /**
2592
+ * Sets the color of the shape.
2593
+ * @param color The color option to use.
2594
+ * @returns A promise resolving when the color has changed in the design.
2595
+ * @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
2596
+ */
2597
+ setColor(color: ColorOption): Promise<void>;
2598
+ /**
2599
+ * Get available colors for the shape.
2600
+ * @returns A list of color definitions that are currently applied to the illustration.
2601
+ */
2602
+ getColors(): Promise<{
2603
+ fill: string | undefined;
2604
+ stroke: string | undefined;
2605
+ variant: _spiffcommerce_papyrus.VariantResource;
2606
+ }[]>;
2607
+ /**
2608
+ * Allows for setting a custom color when the custom variant is selected. Will
2609
+ * throw when a non-custom variant is selected.
2610
+ */
2611
+ setCustomColor(color: string): void;
2612
+ getCustomColor(): string;
2613
+ }
2614
+
2615
+ declare class BulkStepHandle extends StepHandle<BulkStepData> {
2616
+ constructor(manager: WorkflowManager, step: Step<BulkStepData>);
2617
+ private transaction;
2618
+ selectVariant(): Promise<void>;
2619
+ setDesignName(designName: string): Promise<void>;
2620
+ addVariationRecord(): VariationRecord;
2621
+ updateBulkIsConnected(bulkIsConnected: boolean): void;
2622
+ /**
2623
+ * Opens the bulk source in a seperate tab. This bulk source could be a google sheet or a csv file.
2624
+ */
2625
+ openBulkSourceUrl(): void;
2626
+ sendGoogleSheetLinkToEmail(email: string): Promise<void>;
2627
+ /**
2628
+ * Removes a variation from the bulk step.
2629
+ * @param recordNumber The record number of the variation to remove.
2630
+ */
2631
+ deleteVariationRecord(recordNumber: number): void;
2632
+ /**
2633
+ * @returns The aspects of each step that are modifiable from the bulk handle. These are configured in the workflow.
2634
+ */
2635
+ getAspects(): _spiffcommerce_papyrus.StepAspect[];
2636
+ }
2637
+
2638
+ declare const shortenUrl: (longUrl: string) => Promise<string>;
2639
+
2640
+ declare class InformationStepHandle extends StepHandle<InformationStepData> {
2641
+ constructor(manager: WorkflowManager, step: Step<InformationStepData>);
2642
+ selectVariant(): Promise<void>;
2643
+ /**
2644
+ * The way that this step expects to be rendered.
2645
+ */
2646
+ getContent(): string;
2647
+ }
2648
+
2649
+ interface StepAspectValue {
2650
+ stepName: string;
2651
+ stepAspectType: string;
2652
+ value?: string;
2653
+ }
2654
+ declare const stepAspectValuesToDesignInputSteps: (stepAspectValues: StepAspectValue[], workflow: Workflow) => DesignInputStep[];
2655
+ declare const generateStateFromDesignInputSteps: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<LayoutsState>;
2656
+
2657
+ export { AssetNotFoundError, BulkPriceCalculationStrategy, BulkStepHandle, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FrameService, FrameStep, FrameStepHandle, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, UnhandledBehaviorError, Variant, VariationRecord, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, gatherVaryingStepAspects, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };