@spiffcommerce/core 0.0.0-a2ce672c-2d8f-54fc-934a-a5036bd9742e

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.
@@ -0,0 +1,3370 @@
1
+ import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
2
+ import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, Workflow, ILayout, LayoutsState, LayoutData, Asset, MaterialResource, AssetType, StepType, AspectType, CommandState, CommandContext, GlobalPropertyConfigurationAspect, GlobalPropertyConfiguration, Theme, SilentStepData, Placeable, StepStorage, CanvasCommand, LayoutState, SerializableStep, FrameStepData, CreateElementCommand, FrameElement, ColorDefinition, IllustrationStepData, IllustrationElement, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, InformationStepData } from '@spiffcommerce/papyrus';
3
+ export { Animatable, AnyStepData, AspectType, Asset, AssetType, BringForwardCommand, BringToBackCommand, BringToFrontCommand, 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, Placeable, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, Theme, UnitOfMeasurement, UpdateImageSourceCommand, VariantResource, Workflow, WorkflowPanel, dataUrlFromExternalUrl, determineCorrectFontSizeAndLines, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getAxisAlignedBoundingBox, getFrameData, getSvgElement, loadFont, patternImageDataCache, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout, setCanvasModule } from '@spiffcommerce/papyrus';
4
+ import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
5
+ import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
6
+ import * as lodash from 'lodash';
7
+
8
+ declare class OptionService {
9
+ /**
10
+ * Allows for retrieving an option, returns the option from a cache if possible.
11
+ * @param id The option ID to be retrieved.
12
+ */
13
+ getOption(id: string): Promise<undefined | OptionResource>;
14
+ getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
15
+ getDefaultVariant(option: OptionResource): VariantResource | undefined;
16
+ getDisplayImageSource: (variant?: VariantResource) => undefined | string;
17
+ /**
18
+ * Returns the first variant marked as selected. This is used by most steps.
19
+ */
20
+ getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
21
+ }
22
+ declare const optionService: OptionService;
23
+
24
+ declare const setBearerAuthenticationToken: (token: string) => void;
25
+ declare class GraphQlManager {
26
+ private shadowGraphqlClient;
27
+ constructor();
28
+ getShadowGraphqlClient(): ApolloClient<any>;
29
+ private constructShadowGraphqlClient;
30
+ }
31
+ declare const graphQlManager: GraphQlManager;
32
+
33
+ /**
34
+ * A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
35
+ */
36
+ interface RenderableScene {
37
+ /**
38
+ * The id of the scene.
39
+ */
40
+ id: string;
41
+ /**
42
+ * The title of the scene.
43
+ */
44
+ title: string;
45
+ /**
46
+ * The id of each step inside the scene that can be rendered. This is based on the workflow state.
47
+ */
48
+ renderableSteps: string[];
49
+ /**
50
+ * The WorkflowScene representation of this object. Provided for backwards compatibility.
51
+ * @deprecated
52
+ */
53
+ workflowScene: WorkflowScene;
54
+ }
55
+ /**
56
+ * Information parsed froma workflow structure that is relevant
57
+ * to a given scene.
58
+ */
59
+ interface WorkflowScene {
60
+ /**
61
+ * A unique identifier for the scene.
62
+ */
63
+ name: string;
64
+ /**
65
+ * A human-readable title for the scene.
66
+ */
67
+ title: string;
68
+ /**
69
+ * Steps which can display to the user.
70
+ * But may be conditionally hidden based on workflow logic
71
+ */
72
+ renderableSteps: Step<AnyStepData>[];
73
+ /**
74
+ * Steps which don't display to the user.
75
+ * Their behavior is always silent & executed in the background.
76
+ * @deprecated Silent steps are no longer handled seperately from normal steps.
77
+ */
78
+ silentSteps: Step<AnyStepData>[];
79
+ }
80
+
81
+ /**
82
+ * A queue promise is a container for a promise that can be
83
+ * executed at a later time.
84
+ */
85
+ declare abstract class QueueablePromise {
86
+ readonly timestamp: number;
87
+ abstract execute(): Promise<any>;
88
+ }
89
+ /**
90
+ * A promise queue contains any number of QueuePromise objects. These objects are stored within a PromiseQueue and executed
91
+ * as quickly as possible in order. This is ideal in situations where a specific operation should be
92
+ * applied in an ordered way while still making.
93
+ */
94
+ declare class PromiseQueue<T extends QueueablePromise> {
95
+ private queue;
96
+ private activePromise?;
97
+ private queueMaxSize;
98
+ private isEnabled;
99
+ /**
100
+ * Constructs a new promise queue.
101
+ * @param queueMaxSize An optional maximum size, when the max size is hit.
102
+ * The older promises will be discarded.
103
+ * @param enabled When false, the queue will not process any jobs. Assign `enabled` to true to start processing.
104
+ */
105
+ constructor(queueMaxSize?: number, enabled?: boolean);
106
+ /**
107
+ * Enqueue a new promise.
108
+ * @param promise A new promise to add to the queue.
109
+ */
110
+ enqueue(promise: T): void;
111
+ get enabled(): boolean;
112
+ /**
113
+ * Enable or disable the queue. When disabled, the queue will not process any jobs.
114
+ * Disabling processing will not cancel any active promises.
115
+ */
116
+ set enabled(value: boolean);
117
+ /**
118
+ * @returns Returns true when work is being actively processed by this queue.
119
+ */
120
+ hasActivePromise(): boolean;
121
+ /**
122
+ * @returns The number of unexecuted jobs remaining in the queue. Not including the active job.
123
+ */
124
+ getRemainingQueueSize(): number;
125
+ /**
126
+ * Finalize the queue, any jobs that come in while this is in progress will result
127
+ * in the promise being extended.
128
+ */
129
+ finalize(): Promise<void>;
130
+ /**
131
+ * Once called will recursively resolve the jobs in the
132
+ * queue until no more are available.
133
+ */
134
+ private dequeue;
135
+ }
136
+
137
+ /**
138
+ * Bounds the offsets for an image to the box, preventing
139
+ * the user from moving the image in a way that wouldn't be intended.
140
+ * @param newOffsets The new intended offsets for the image.
141
+ * @param frameData The current frame information
142
+ * @param borderWidth The width of the border added by the cropper.
143
+ * @param mustCover When true the image sgould be bounded in such a way that it covers the entire frame at all times.
144
+ */
145
+ declare function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
146
+ declare class FrameService {
147
+ private offsets;
148
+ private thresholdSettings;
149
+ private forceImageCover?;
150
+ private targetElements;
151
+ private imageData?;
152
+ private frameData?;
153
+ private readonly _debouncedUpdateFrameOffsets;
154
+ /**
155
+ * The calculated minimum zoom value, per frame.
156
+ */
157
+ minZoomScale: number[];
158
+ /**
159
+ * The calculated maximum zoom value. Note: This is calculated based on the first frame.
160
+ */
161
+ maxZoomScale: number[];
162
+ private onFrameDataChangeListeners;
163
+ private onZoomChangeListeners;
164
+ private workflowManager?;
165
+ private stepName?;
166
+ constructor(forceImageCover?: boolean);
167
+ /**
168
+ * When we want to connect a workflow manager to the state of the image cropper we
169
+ * can pass it to this function. Inside we'll attach any required event listeners.
170
+ * @param workflowManager The workflow manager to attach.
171
+ * @param stepName The specific step we want to attach to within the manager.
172
+ */
173
+ connectWorkflowManager(workflowManager: WorkflowManager, stepName?: string): void;
174
+ /**
175
+ * Sets the elements that should be update when changes are made to
176
+ * the cropper that owns this service.
177
+ * @param targetElements A list of element Ids to track
178
+ */
179
+ setTargetElements(targetElements: string[]): void;
180
+ /**
181
+ * Gets the current calculated frame data
182
+ * @returns A FrameData object or undefined if no frame has been set.
183
+ */
184
+ getFrameData(): FrameData[] | undefined;
185
+ /**
186
+ * Sets the current frame data. Note:
187
+ * @param paths The paths to lookup in our frame data cache.
188
+ */
189
+ setFrameData(paths: string[] | undefined): void;
190
+ /**
191
+ * Gets the currently set image of the frame..
192
+ * @returns A PatternImageData object, or undefined if no image is set.
193
+ */
194
+ getImageData(): PatternImageData | undefined;
195
+ /**
196
+ * Gets the current calculated offsets of the pattern within the frame.
197
+ * @returns A FrameOffsets object or undefined if no offsets are defined.
198
+ */
199
+ getOffsets(): FrameOffsets[] | undefined;
200
+ /**
201
+ * Updates the frame offsets explicitly.
202
+ */
203
+ setOffsets(offsets: FrameOffsets[]): void;
204
+ /**
205
+ * Sets the zoom of the cropper that owns this service.
206
+ * @param zoom The new zoom value, per frame.
207
+ * @param cX The center of zoom on x axis, per frame.
208
+ * @param cY The center of zoom on Y axis, per frame.
209
+ * @param onComplete A function to call when zoom changes have been completed
210
+ */
211
+ setZoom(zoom: number[], cX: number[], cY: number[], onComplete?: () => void): void;
212
+ /**
213
+ * Sets the image currently contained by this frame.
214
+ * @param value The new image as an ImageData property
215
+ * @param [recalculateOffsets=true] Optional: Enable/disable re-calculating of frame offsets. Default: `true`.
216
+ * Note: Will always calculate when offsets have not been calculated.
217
+ */
218
+ setPatternData(value: PatternImageData, recalculateOffsets?: boolean): void;
219
+ /**
220
+ * Modify the offsets of the frame.
221
+ * @param value The new FrameOffsets objects.
222
+ * @param onComplete A callback, called when the modification is complete
223
+ * @param forceUpdate When true the offsets will be updated even if they haven't changed.
224
+ */
225
+ updateOffsets(value: FrameOffsets[], onComplete?: () => void, forceUpdate?: boolean): void;
226
+ getThresholdSettings(): FrameThresholdSettings;
227
+ setThresholdSettings(settings: FrameThresholdSettings): void;
228
+ onFrameDataChanged(newListener: (frameData: FrameData[] | undefined) => void): void;
229
+ /**
230
+ * Append a new listener to zoom events on this frame.
231
+ * @param newListener
232
+ */
233
+ onZoom(newListener: (zoomValue: number[]) => void): void;
234
+ /**
235
+ * Updates the offsets of the frame
236
+ * @param newOffsets New offset object
237
+ * @param imageData The image data
238
+ * @param frameData The frame data
239
+ * @param targetElements A list of elements that need updating, by ID
240
+ * @param onComplete A callback when the operation is completed.
241
+ */
242
+ private updateFrameOffsets;
243
+ /**
244
+ * Determines limitations of zoom based on relative size of image and frame.
245
+ * @param imageData The image to include in calculations
246
+ * @param frameData The frame to include in calculations.
247
+ */
248
+ private recalculateZoomLimits;
249
+ private recalculateOffsets;
250
+ }
251
+
252
+ declare class Poller {
253
+ private pollingId;
254
+ private attempts;
255
+ private readonly interval;
256
+ private readonly maxAttempts;
257
+ private readonly predicate;
258
+ private readonly onSuccess;
259
+ private readonly onFailure;
260
+ private poll;
261
+ /**
262
+ * Constructs a new polling service.
263
+ * @param predicate An async function that returns true when polling has returned a successful result.
264
+ * @param onSuccess The callback to be called when polling has returned a successful result.
265
+ * @param onFailure The callback to be called when polling has returned a failed result.
266
+ * @param interval The number of milliseconds to wait between each poll.
267
+ * @param maxAttempts The maximum amount of times to check the condition.
268
+ */
269
+ constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
270
+ }
271
+
272
+ declare abstract class ModuleProduct {
273
+ /**
274
+ * Name used by class. Usually product or brand name.
275
+ */
276
+ abstract moduleName: string;
277
+ /**
278
+ * SVG with styled path positioned on a background image. To be displayed to user.
279
+ */
280
+ abstract svgPreview(text: string, region: Region): string;
281
+ /**
282
+ * SVG with styled path positioned on a background image. To be submitted for print.
283
+ */
284
+ abstract svgPrint(text: string, region: Region): string;
285
+ }
286
+
287
+ interface DesignInputStep {
288
+ data: DesignInputStepData;
289
+ name: string;
290
+ }
291
+ interface DesignInputStepData {
292
+ }
293
+
294
+ declare class LayoutPreviewService implements RenderableContextService {
295
+ private readonly layouts;
296
+ private handleCompleteRender;
297
+ constructor(layouts: ILayout[]);
298
+ setCompleteRenderCallback(handleCompleteRender: (layouts: LayoutPreviewBridge[]) => void): void;
299
+ onCompleteRender(): void;
300
+ getAll(): ReadonlyMap<string, LayoutPreviewBridge>;
301
+ }
302
+ /**
303
+ * The panel canvas class that stores both the main rendering canvas as well as rendering context
304
+ * for a rendering context
305
+ */
306
+ declare class LayoutPreviewBridge implements RenderableContext {
307
+ hasSetStaticContext: boolean;
308
+ private readonly id;
309
+ private readonly name;
310
+ private readonly panelSize;
311
+ private service;
312
+ private interactiveDirty;
313
+ private textureCtx?;
314
+ private staticCtxDirty;
315
+ private lastRequestedRenderArguments;
316
+ private lastCompletedStaticRender;
317
+ private renderQueue;
318
+ constructor(id: string, name: string, service: LayoutPreviewService, panelSize: {
319
+ width: number;
320
+ height: number;
321
+ });
322
+ getID(): string;
323
+ getName(): string;
324
+ getPanelSize(): {
325
+ width: number;
326
+ height: number;
327
+ };
328
+ getStaticContext(): CanvasRenderingContext2D | undefined;
329
+ /**
330
+ * Register canvas to be rendered to.
331
+ */
332
+ setStaticContext(ctx: CanvasRenderingContext2D): void;
333
+ getStaticContextDirty(): boolean;
334
+ setStaticContextDirty(dirty: boolean): void;
335
+ getInteractiveCanvasDirty(): boolean;
336
+ setInteractiveCanvasDirty(dirty: boolean): void;
337
+ markLastCompletedStaticRender(): void;
338
+ /**
339
+ * Returns a timestamp for the last time that this canvas rendered to its dynamic texture in the
340
+ * form of Date.now(). If this panel has never rendered undefined will be returned.
341
+ */
342
+ getLastCompletedStaticRender(): number | undefined;
343
+ /**
344
+ * Actions to perform when a static render event is fired for this canvas.
345
+ */
346
+ render(layouts: LayoutData[]): Promise<void>;
347
+ }
348
+ interface StepAspectValue {
349
+ stepName: string;
350
+ stepAspectType: string;
351
+ value?: string;
352
+ }
353
+ declare const stepAspectValuesToDesignInputSteps: (stepAspectValues: StepAspectValue[], workflow: Workflow) => DesignInputStep[];
354
+ declare const generateStateFromDesignInputSteps: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<LayoutsState>;
355
+
356
+ /**
357
+ * An asset manager provides a way to create and
358
+ * manage assets on the Spiff Commerce Platform.
359
+ */
360
+ interface AssetManager {
361
+ /**
362
+ * Uploads a file to the Spiff Commerce Platform.
363
+ */
364
+ uploadFile: (file: File, onProgress: (val: number) => void) => Promise<Asset>;
365
+ /**
366
+ * From an existing asset, generates a new asset that has the background replaced with transparency.
367
+ * This process is idempotent, i.e. it will only run once for a given asset.
368
+ * @param asset The existing asset to remove the background from.
369
+ * @returns A promise that resolves with a new asset.
370
+ */
371
+ removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
372
+ }
373
+ declare class AssetService implements AssetManager {
374
+ private cache;
375
+ /**
376
+ * Promise cache for BG removal processes. Values only present while process is active.
377
+ * Use BGRMStorage and the regular asset promise cache to cache the actual objects.
378
+ */
379
+ private bgrmProcessCache;
380
+ private materialCache;
381
+ /**
382
+ * Allows for retrieving an asset, returns the option from a cache if possible.
383
+ */
384
+ getLocalOrFromServer(assetKey: string): Promise<Asset>;
385
+ /**
386
+ * Retrieves the asset from the server, bypassing cache (but still writing the result to cache)
387
+ */
388
+ getFromServer(assetKey: string): Promise<Asset>;
389
+ keyFromURL(url: string): string | undefined;
390
+ /**
391
+ * Caches an asset if it doesn't already exist.
392
+ */
393
+ cacheAsset(asset: Asset): void;
394
+ /**
395
+ * Caches a material if it doesn't already exist.
396
+ */
397
+ cacheMaterial(material: MaterialResource): void;
398
+ /**
399
+ * Allows for retrieving a material, returns the option from a cache if possible.
400
+ * @param id The option ID to be retrieved.
401
+ */
402
+ getMaterialLocalOrFromServer(id: string): Promise<MaterialResource>;
403
+ /**
404
+ * Upload a user asset to the server. Using callbacks to notify important events.
405
+ * The asset will be stored via the persistence service for future access, if available.
406
+ */
407
+ uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
408
+ uploadAsset(file: FileInfo, assetType: AssetType, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
409
+ uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
410
+ removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
411
+ removePersistedAsset(assetKey: string): void;
412
+ getPersistedAssets(): PersistedAsset[];
413
+ registerPersistedAssetListener(callback: () => void): void;
414
+ unRegisterPersistedAssetListener(callback: () => void): void;
415
+ /**
416
+ * Convert a File object for an image into a FileInfo.
417
+ */
418
+ loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
419
+ /**
420
+ * Handles mimeType resolution & asset creation request
421
+ * @param file A file info object containing data about the file and its name
422
+ * @param assetType The type of asset we're expecting to upload
423
+ */
424
+ private dispatchCreateAssetRequest;
425
+ private guessMIME;
426
+ }
427
+ interface PersistedAsset {
428
+ assetKey: string;
429
+ src: string;
430
+ }
431
+ declare const assetService: AssetService;
432
+
433
+ /**
434
+ * A wrapping component that provides a simple interface for interacting with a variant.
435
+ */
436
+ declare class Variant {
437
+ private readonly variantData;
438
+ constructor(variant: VariantResource);
439
+ getType(): AssetType | undefined;
440
+ /**
441
+ * @returns The unique identifier for the variant.
442
+ */
443
+ getId(): string;
444
+ /**
445
+ * @returns The configured name of the variant. Generally a human readable value.
446
+ */
447
+ getName(): string;
448
+ /**
449
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
450
+ */
451
+ getPriceFormatted(locales?: Intl.LocalesArgument, options?: Intl.NumberFormatOptions | undefined): string;
452
+ /**
453
+ * @returns The price modifier for this variant. This is the amount that will be added to the base price of the product.
454
+ * 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.
455
+ */
456
+ getPrice(): number;
457
+ /**
458
+ * @returns The URL for the base asset resource configured on this variant
459
+ */
460
+ getAsset(): string | undefined;
461
+ /**
462
+ * @returns The URL for the base asset resource configured on this variant
463
+ */
464
+ getAssetResource(): Asset | undefined;
465
+ /**
466
+ * @returns The URL for a thumbnail resource configured on this variant.
467
+ */
468
+ getThumbnail(): string | undefined;
469
+ /**
470
+ * @returns The URL for the display image configured on this variant. Can be used for things like size charts.
471
+ * @deprecated To be removed in a future version, Please use getThumbnail() instead
472
+ */
473
+ getDisplayImage(): string | undefined;
474
+ /**
475
+ * @returns When this variant is configured to have a color, this will return the hex value for that color.
476
+ */
477
+ getColor(): string | undefined;
478
+ /**
479
+ * @returns True when the variant is the default for its containing option. False otherwise.
480
+ */
481
+ isDefault(): boolean;
482
+ /**
483
+ * @returns The underlying variant resource. Generally not needed but made available just incase.
484
+ */
485
+ getResource(): VariantResource;
486
+ /**
487
+ * @returns True when the variant is enabled. False otherwise.
488
+ */
489
+ isEnabled(): boolean;
490
+ }
491
+
492
+ /**
493
+ * A StepHandle allows for managing the state of a specific step in a workflow. This class
494
+ * abstracts away the complexities of dealing with a step directly and allows for using high level
495
+ * concepts instead of dealing with the underlying data structures.
496
+ */
497
+ declare abstract class StepHandle<T extends AnyStepData> {
498
+ /**
499
+ * Stores whether or not the step is currently updating.
500
+ */
501
+ private static readonly updateState;
502
+ /**
503
+ * Access to the workflow manager this step is contained by.
504
+ */
505
+ protected readonly manager: WorkflowManager;
506
+ /**
507
+ * The step metadata, useful for determining logic based on configuration.
508
+ */
509
+ protected readonly step: Step<T>;
510
+ constructor(manager: WorkflowManager, step: Step<T>);
511
+ /**
512
+ * Set the current update state of this step. All step handles pointing to this step will
513
+ * see this value.
514
+ * @param value The new value
515
+ */
516
+ protected setUpdateState(value: boolean): void;
517
+ /**
518
+ * @returns Gets the current update state of this step. All step handles for this step will see this value.
519
+ */
520
+ protected getUpdateState(): boolean;
521
+ /**
522
+ * Gets the currently selected variant, or undefined if no variant is selected.
523
+ */
524
+ getCurrentVariant(): Variant | undefined;
525
+ /**
526
+ * @returns A list of valid variants for this step. Does not include disabled variants.
527
+ */
528
+ getAvailableVariants(): Variant[];
529
+ /**
530
+ * @returns A list of all variants for this step, including disabled ones.
531
+ */
532
+ getAllVariants(): Variant[];
533
+ /**
534
+ * Most step types have a base option type that variants can be selected for.
535
+ * Selects a specific variant for this step. This will execute all required changes to
536
+ * the design and update the metadata to include the new selection. Any conditions
537
+ * that would be triggered will also be executed.
538
+ */
539
+ abstract selectVariant(variant: Variant): Promise<void>;
540
+ /**
541
+ * @returns A unique identifier for this step within the workflow.
542
+ */
543
+ getId(): string;
544
+ /**
545
+ * @returns The name of the step
546
+ */
547
+ getName(): string;
548
+ /**
549
+ * @returns A message that can accompany the step name in UI components. Used to describe the purpose of the step in more detail.
550
+ */
551
+ getHelpText(): string | undefined;
552
+ /**
553
+ * @returns The type of the step handle.
554
+ */
555
+ getType(): StepType;
556
+ /**
557
+ * @returns The underlying data for this step. Favor using the step handle methods instead of this.
558
+ */
559
+ getRaw(): Step<T>;
560
+ getTags(): string[];
561
+ hasTag(tag: string): boolean;
562
+ /**
563
+ * @param type The AspectType to fetch the value for.
564
+ * @returns A boolean indicating whether this step should override Global Properties.
565
+ * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
566
+ * and when this step is associated with one or more Global Property Aspects.
567
+ */
568
+ getOverrideGlobalPropertyConfiguration(type: AspectType): boolean;
569
+ /**
570
+ * Sets whether or not this step should override Global Properties.
571
+ * Only relevant when the Workflow Experience is associated with a Bundle that is using Global Properties,
572
+ * and when this step is associated with one or more Global Property Aspects.
573
+ * @param type The AspectType to override.
574
+ */
575
+ setOverrideGlobalPropertyConfiguration(type: AspectType, value: boolean): void;
576
+ /**
577
+ * Retrieves the identifiers of all of the configured aspects for the specified Global Property Configuration.
578
+ * @param configurationId The ID of the Global Property Configuration. You can usually find this with `bundle.getGlobalPropertyConfiguration()?.id`
579
+ * @returns An array of strings matching the keys of all the Global Property Aspects in the Configuration that this step is configured to use.
580
+ */
581
+ getGlobalPropertyAspects(configurationId: string): string[];
582
+ /**
583
+ * Fires any configured animations on the 3D preview for this step.
584
+ * This includes camera & model animations. If the preview is unavailable
585
+ * this function will do nothing.
586
+ */
587
+ executeAnimations(): void;
588
+ }
589
+
590
+ declare const createDesign: (workflowManager: WorkflowManager, workflow: Workflow, layouts: ILayout[], getReducerState: () => CommandState, product: Product, transaction: Transaction, workflowSelections: WorkflowSelections, designName: string, onProgressUpdate: DesignCreationProgressUpdate, createPreviewImage: (shouldRender3D?: boolean, transactionId?: string) => Promise<string | undefined>, workflowMetadata?: WorkflowMetadata) => Promise<DesignCreationMessage>;
591
+ interface SavedDesign {
592
+ /**
593
+ * The user's name for this saved design.
594
+ */
595
+ title: string;
596
+ /**
597
+ * A URL pointing to an image of the design. Typically a data URL
598
+ */
599
+ thumbnail?: string;
600
+ /**
601
+ * The ID of the transaction relating to this design.
602
+ */
603
+ transactionId: string;
604
+ /**
605
+ * The product ID for this transaction.
606
+ */
607
+ productId: string;
608
+ /**
609
+ * The integration product ID related to this order.
610
+ */
611
+ integrationProductId: string;
612
+ /**
613
+ * The name of the workflow annotated at time of save (may be different from current workflow name).
614
+ */
615
+ workflowName: string;
616
+ /**
617
+ * The ID of the workflow annotated at time of save.
618
+ */
619
+ workflowId: string;
620
+ /**
621
+ * The last edit that occured on this saved design.
622
+ */
623
+ lastEdited: Date;
624
+ }
625
+ /**
626
+ * The design service exposes helper functionality wrapping important design management operations.
627
+ * NOTE: In the future this interface should allow for storing/pulling designs from the server.
628
+ */
629
+ declare class DesignService {
630
+ readonly localPersistenceKey = "designTransactions";
631
+ private storageMethod;
632
+ private designSavedListeners;
633
+ /**
634
+ * @param func The function to call when a design is saved.
635
+ */
636
+ attachSaveListener(func: (design: SavedDesign) => void): void;
637
+ /**
638
+ * @param func The function to remove from the list of listeners.
639
+ */
640
+ detachSaveListener(func: (design: SavedDesign) => void): void;
641
+ /**
642
+ * Gets the currently persisted designs.
643
+ */
644
+ getSavedDesigns(): Promise<SavedDesign[]>;
645
+ /**
646
+ * Search for a transaction that has been saved.
647
+ * @param transactionId The id to search for.
648
+ * @returns The transaction for the given id provided it has been saved. undefined if it doesn't exist.
649
+ */
650
+ getSavedDesignByTransaction(transactionId: string): Promise<SavedDesign | undefined>;
651
+ /**
652
+ * Saves a design to storage.
653
+ * @param design The design to save.
654
+ */
655
+ addDesign(design: SavedDesign): Promise<void>;
656
+ /**
657
+ * Change the user's name of the given saved design.
658
+ */
659
+ renameDesign(transactionId: string, title: string): Promise<void>;
660
+ /**
661
+ * Removes a given design from storage.
662
+ * @param transactionId
663
+ */
664
+ removeDesign(transactionId: string): Promise<void>;
665
+ private setDesigns;
666
+ }
667
+ declare const designService: DesignService;
668
+
669
+ /**
670
+ * A scene is a collection of steps that can be used to group steps together.
671
+ */
672
+ interface Scene {
673
+ /**
674
+ * The unique identifier for the scene.
675
+ */
676
+ id?: string;
677
+ /**
678
+ * The name of the scene.
679
+ */
680
+ name: string;
681
+ /**
682
+ * The steps that are part of the scene. A list of ids. See getStepById.
683
+ */
684
+ stepIds: string[];
685
+ }
686
+ /**
687
+ * State related to a workflow experience.
688
+ */
689
+ interface ExperienceOptions {
690
+ product: Product;
691
+ transaction: Transaction;
692
+ workflow?: Workflow;
693
+ /**
694
+ * @deprecated favor inject / eject functions.
695
+ */
696
+ previewService?: ThreeDPreviewService;
697
+ modelContainer?: ModelContainer;
698
+ renderableContextService?: LayoutPreviewService;
699
+ layouts: ILayout[];
700
+ reloadedState?: LayoutsState;
701
+ /**
702
+ * When true the experience is intended to be immutable.
703
+ */
704
+ readOnly?: boolean;
705
+ /**
706
+ * A function that communicates state changes to the server.
707
+ */
708
+ stateMutationFunc: StateMutationFunc;
709
+ /**
710
+ * Should be set to true when the experience is loaded from an existing transaction.
711
+ * FIXME: Wouldn't we know this from existance of reloadedState
712
+ */
713
+ isReloadedTransaction?: boolean;
714
+ /**
715
+ * When true the system will treat steps with
716
+ * a single variant as renderable. False
717
+ * by default.
718
+ */
719
+ singleVariantsRenderable?: boolean;
720
+ /**
721
+ * When true, will delay syncing the workflow state until manually enabled.
722
+ */
723
+ delayWorkflowStateSync?: boolean;
724
+ }
725
+ /**
726
+ * A Workflow experience encapsulates the workflow manager and command context. It
727
+ * provides a simplified interface for interacting with the workflow manager. You
728
+ * should get an instance of this class from a Client you have constructed previously.
729
+ */
730
+ interface WorkflowExperience {
731
+ /**
732
+ * Get the bundle this experience is part of. May be undefined.
733
+ */
734
+ getBundle(): Bundle$1 | undefined;
735
+ /**
736
+ * Set the bundle this experience is part of. Can be cleared using undefined.
737
+ */
738
+ setBundle(bundle: Bundle$1 | undefined): any;
739
+ /**
740
+ * Returns the client that was responsible for spawning this experience.
741
+ */
742
+ getClient(): SpiffCommerceClient;
743
+ /**
744
+ * State related to the design of the user.
745
+ */
746
+ getCommandContext(): CommandContext;
747
+ /**
748
+ * Returns true when the user may only view the design.
749
+ */
750
+ getIsReadOnly(): boolean;
751
+ /**
752
+ * Get the low level workflow amanager instance for this experience. Don't touch this unless you're willing to break things.
753
+ */
754
+ getWorkflowManager(): WorkflowManager;
755
+ /**
756
+ * Returns the step matching a given name, undefined if not found.
757
+ * @param id The id the step must match.
758
+ */
759
+ getStepById(id: string): StepHandle<AnyStepData> | undefined;
760
+ /**
761
+ * Returns the step matching a given name, undefined if not found.
762
+ * @param name The name the step must match.
763
+ */
764
+ getStepByName(name: string): StepHandle<AnyStepData> | undefined;
765
+ /**
766
+ * Returns all steps matching a specific type in the workflow. These steps
767
+ * may be across multiple scenes and may or may not be active based on condition state.
768
+ */
769
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
770
+ /**
771
+ * Returns all steps that are children of a given scene.
772
+ * @param scene The scene you want the steps for.
773
+ */
774
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
775
+ /**
776
+ * Returns all steps in the workflow that are currently active. Ordered by scene and appearance within their respective scenes.
777
+ */
778
+ getSteps(): StepHandle<AnyStepData>[];
779
+ /**
780
+ * Returns a list of scenes that are configured in the workflow. Each scene
781
+ * contains a list of steps. See getStepsByScene to access these.
782
+ */
783
+ getScenes(): Scene[];
784
+ /**
785
+ * Returns the total cost in subunits for all selections made on the design.
786
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
787
+ */
788
+ getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
789
+ /**
790
+ * Returns the total cost in subunits for the base product.
791
+ * @param includeAdditionalProduct When true the additional product cost will be included in the total (if configured).
792
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
793
+ */
794
+ getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
795
+ /**
796
+ * If an additional product is configured, returns the base price of that product. Returns undefined otherwise.
797
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
798
+ */
799
+ getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
800
+ /**
801
+ * A convenience function returning the sum of the selection and base price values.
802
+ * @param disablePriceBreaks Whether to exclude price breaks from the calculation.
803
+ */
804
+ getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
805
+ /**
806
+ * The price break percentage that is expected to be applied in price calculations.
807
+ */
808
+ priceBreakToBeApplied(): number;
809
+ /**
810
+ * Calculates the price break and fires the "PriceBreakChanged" event if required.
811
+ * This function is primarily intended for internal use.
812
+ */
813
+ checkForPriceBreakChanges(): void;
814
+ /**
815
+ * Takes selections made by the user in another workflow and applies them to this workflow. For
816
+ * selections to be copied they must both have a matching global property configuration.
817
+ * @param experience The experience to take selections from.
818
+ * @param filter A list of steps to apply the selections to. If undefined all steps will be updated.
819
+ */
820
+ copySelectionsViaGlobalConfiguration(bundle: Bundle$1, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
821
+ /**
822
+ * Attach specific details about the customer to the experience. This is useful for things like retargeting. Currently only
823
+ * email is supported. From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
824
+ * @param details The new customer details. Only email is supported.
825
+ * @deprecated Use assignCustomerDetails instead.
826
+ */
827
+ attachCustomerDetails(details: {
828
+ /**
829
+ * An email used for things like sending a design to the user.
830
+ */
831
+ email: string;
832
+ }): Promise<void>;
833
+ /**
834
+ * Attach specific details about the customer to the experience. This is useful for things like retargeting.
835
+ * From SpiffCommerce hosted experiences these details will be attached whenever the customer has provided & given permission.
836
+ * @param details The new customer details.
837
+ */
838
+ assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
839
+ /**
840
+ * Attaches a listener to the scenes on a workflow experience. The scenes returned are a subset of the scenes configured in the
841
+ * workflow and are based on the current state of the experience. This is useful for building a navigation menu.
842
+ * @param cb The callback to be called when the scenes change. The new scenes are passed as an argument.
843
+ */
844
+ attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
845
+ /**
846
+ * Detaches a listener from the scenes on a workflow experience.
847
+ */
848
+ detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
849
+ /**
850
+ * Saves this experience to storage. This may be local or remote depending
851
+ * on configuration.
852
+ * @param title The title for the saved design.
853
+ */
854
+ save(title: string): Promise<SavedDesign>;
855
+ /**
856
+ * Returns a copy of the currently loaded design as a new, seperated workflow experience with
857
+ * a fresh transaction.
858
+ */
859
+ copy(): Promise<WorkflowExperience>;
860
+ /**
861
+ * Creates a data URL preview for the current design.
862
+ */
863
+ createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
864
+ /**
865
+ * To be called when the workflow experience is considered completed by the user.
866
+ * @param onProgressUpdate Progress callback for finalizing the design. Optional
867
+ * @param capturePreviewImage When true a preview image will be generated for the design. Defaults to true.
868
+ */
869
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
870
+ /**
871
+ * Returns the metadata associated with this workflow experience.
872
+ * This is a combination of the metadata from the workflow, and the selections made by the user.
873
+ */
874
+ getExportedData(): Map<string, {
875
+ [key: string]: string;
876
+ }>;
877
+ /**
878
+ * Get the quantity of this WorkflowExperience's Transaction.
879
+ * @returns The amount that was, or will be, ordered.
880
+ */
881
+ getQuantity(): number;
882
+ /**
883
+ * Sets the quantity of this WorkflowExperience's Transaction.
884
+ * @throws {Error} if the WorkflowExperience is read-only.
885
+ * @throws {RangeError} if the value is below 1.
886
+ * @param quantity The amount that was, or will be, ordered.
887
+ * @returns A promise that resolves when the Transaction has been updated on the server.
888
+ */
889
+ setQuantity(quantity: number): Promise<void>;
890
+ /**
891
+ * Registers a callback function to be called when the specified event is raised.
892
+ * @param type The type of event to listen for.
893
+ * @param callback The function to call when the event occurs.
894
+ */
895
+ addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
896
+ /**
897
+ * Removes a previously registered callback.
898
+ * @param type The type of event.
899
+ * @param callback The function to remove.
900
+ */
901
+ removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
902
+ }
903
+ declare enum WorkflowExperienceEventType {
904
+ QuantityChanged = "QuantityChanged",
905
+ PriceBreakChanged = "PriceBreakChanged"
906
+ }
907
+ declare class WorkflowExperienceImpl implements WorkflowExperience {
908
+ readonly client: SpiffCommerceClient;
909
+ readonly commandContext: CommandContext;
910
+ readonly workflowManager: WorkflowManager;
911
+ readonly isReadOnly: boolean;
912
+ readonly cachedStepHandles: Map<string, StepHandle<any>>;
913
+ /**
914
+ * Bundle this experience has been added to.
915
+ */
916
+ private bundle?;
917
+ private currentPriceBreak;
918
+ private renderableScenes;
919
+ private renderableSceneCallbacks;
920
+ private eventCallbacks;
921
+ constructor(client: SpiffCommerceClient, experienceOptions: ExperienceOptions);
922
+ getBundle(): Bundle$1 | undefined;
923
+ setBundle(bundle: Bundle$1): void;
924
+ getClient(): SpiffCommerceClient;
925
+ getIsReadOnly(): boolean;
926
+ getCommandContext(): CommandContext;
927
+ getWorkflowManager(): WorkflowManager;
928
+ createPreviewImage(isThreeD?: boolean, resolution?: number): Promise<string>;
929
+ getStepById(id: string): StepHandle<any> | undefined;
930
+ getSteps(): StepHandle<AnyStepData>[];
931
+ getScenes(): Scene[];
932
+ getSelectionPriceSubunits(disablePriceBreaks?: boolean): number;
933
+ getBasePriceSubunits(includeAdditionalProduct?: boolean, disablePriceBreaks?: boolean): number;
934
+ getAdditionalProductPriceSubunits(disablePriceBreaks?: boolean): number | undefined;
935
+ getTotalPriceSubunits(disablePriceBreaks?: boolean): number;
936
+ private getPriceSubUnitsAfterPriceBreaks;
937
+ priceBreakToBeApplied(): number;
938
+ checkForPriceBreakChanges(): void;
939
+ private getMatchingExperiencesFromBundle;
940
+ private updatePriceBreak;
941
+ copySelectionsViaGlobalConfiguration(bundle: Bundle$1, experience: WorkflowExperience, filter?: StepHandle<AnyStepData>[]): Promise<void>;
942
+ getStepByName(name: string): TextStepHandle | FrameStepHandle | ShapeStepHandle | InformationStepHandle | IllustrationStepHandle | MaterialStepHandle | ModelStepHandle | PictureStepHandle | QuestionStepHandle | undefined;
943
+ getStepsByType(type: StepType): StepHandle<AnyStepData>[];
944
+ getStepsByScene(scene: Scene): StepHandle<AnyStepData>[];
945
+ attachCustomerDetails(details: {
946
+ email: string;
947
+ }): Promise<void>;
948
+ assignCustomerDetails(details: CustomerDetailsInput): Promise<void>;
949
+ attachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
950
+ detachRenderableSceneListener(cb: (scenes: RenderableScene[]) => void): void;
951
+ debouncedSavedDesignUpdate: lodash.DebouncedFunc<() => Promise<void>>;
952
+ save(title?: string): Promise<SavedDesign>;
953
+ copy(): Promise<WorkflowExperience>;
954
+ onDesignFinished(onProgressUpdate?: DesignCreationProgressUpdate, capturePreviewImage?: boolean): Promise<DesignCreationMessage>;
955
+ /**
956
+ * @param step The step to test against.
957
+ * @returns Returns true when a valid handle is implemented for a given step type. Certain steps don't support handles, such as silent illustrations.
958
+ */
959
+ private stepHasHandle;
960
+ private getCanvasObjectURLAsync;
961
+ getExportedData(): Map<string, {
962
+ [key: string]: string;
963
+ }>;
964
+ getQuantity(): number;
965
+ setQuantity(quantity: number): Promise<void>;
966
+ addEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
967
+ removeEventListener(type: WorkflowExperienceEventType, callback: (workflowExperience: WorkflowExperience) => void): void;
968
+ private callEvent;
969
+ }
970
+
971
+ /**
972
+ * A GlobalPropertyHandle acts as an interface to global properties on our platform. Currently
973
+ * bundles can return a handle for any global properties associated to the collection.
974
+ */
975
+ declare abstract class GlobalPropertyHandle {
976
+ protected readonly bundle: Bundle$1;
977
+ protected readonly property: GlobalPropertyConfigurationAspect;
978
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
979
+ /**
980
+ * @returns The name of the global property. This is the key used to store the property in the state.
981
+ */
982
+ getName(): string;
983
+ /**
984
+ * @returns A human friendly title.
985
+ */
986
+ getTitle(): string;
987
+ /**
988
+ * @returns A human friendly description.
989
+ */
990
+ getDescription(): string;
991
+ /**
992
+ * @returns The type of the global property. Use this to determine how to render the property.
993
+ */
994
+ getType(): AspectType;
995
+ /**
996
+ * @returns The underlying property data object.
997
+ */
998
+ getRawProperty(): GlobalPropertyConfigurationAspect;
999
+ /**
1000
+ * Applies the global state to all shared steps, if the state is set.
1001
+ * @param targetExperiences Optionally filter the workflow experiences it should be applied to.
1002
+ */
1003
+ abstract applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1004
+ /**
1005
+ * Returns all steps that share this property.
1006
+ * @param targetExperiences Optionally filter the steps to only those in the given experiences.
1007
+ */
1008
+ protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
1009
+ protected getStateValue(): string | undefined;
1010
+ }
1011
+ /**
1012
+ * A file upload global property allows for setting a frame image against all shared steps.
1013
+ */
1014
+ declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
1015
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
1016
+ /**
1017
+ * Select an image to be used for all shared steps.
1018
+ * @param asset The asset to use.
1019
+ * @returns A promise resolving when all affected steps have been updated.
1020
+ */
1021
+ selectImage(asset: Asset): Promise<void>;
1022
+ canUseBackgroundRemover(): Promise<boolean>;
1023
+ /**
1024
+ * Removes the background from an image, stores it in the state, and returns the new asset.
1025
+ * @param applyNewAsset Optionally applies the new asset to all shared steps. Default: `true`.
1026
+ * @returns A promise that resolves with the newly generated Asset.
1027
+ */
1028
+ removeBackgroundFromImage(applyNewAsset?: boolean): Promise<Asset>;
1029
+ /**
1030
+ * Returns `true` if the state has an image assigned, otherwise `false`.
1031
+ */
1032
+ hasImage(): boolean;
1033
+ /**
1034
+ * Retrieves the current image selection, if one exists.
1035
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1036
+ */
1037
+ getImage(): Promise<Asset | undefined>;
1038
+ /**
1039
+ * Retrieves the original, unmodified image selection, if one exists.
1040
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1041
+ */
1042
+ getOriginalImage(): Promise<Asset | undefined>;
1043
+ /**
1044
+ * Retrieves the version of the image selection that has the background removed, if one exists.
1045
+ * @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
1046
+ */
1047
+ getBackgroundRemovedImage(): Promise<Asset | undefined>;
1048
+ getUseOriginalImage(): boolean;
1049
+ setUseOriginalImage(value: boolean): Promise<void>;
1050
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1051
+ private applyImageSelection;
1052
+ private updateSharedStepStorage;
1053
+ }
1054
+ declare class TextGlobalPropertyHandle extends GlobalPropertyHandle {
1055
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect);
1056
+ /**
1057
+ * Gets the current text
1058
+ */
1059
+ getText(): string;
1060
+ /**
1061
+ * Set the text.
1062
+ */
1063
+ setText(text: string): Promise<void>;
1064
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1065
+ private applyTextSelection;
1066
+ }
1067
+ /**
1068
+ * An option property handle represents a property that can
1069
+ * affect the option of steps across multiple transactions.
1070
+ */
1071
+ declare class OptionGlobalPropertyHandle extends GlobalPropertyHandle {
1072
+ protected optionResource?: OptionResource;
1073
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1074
+ /**
1075
+ * Gets the currently selected variant, or undefined if no variant is selected.
1076
+ */
1077
+ getCurrentVariant(): Variant | undefined;
1078
+ /**
1079
+ * @returns A list of valid variants for this step. Does not include disabled variants.
1080
+ */
1081
+ getAvailableVariants(): Variant[];
1082
+ /**
1083
+ * @returns A list of all variants for this step, including disabled ones.
1084
+ */
1085
+ getAllVariants(): Variant[];
1086
+ /**
1087
+ * Select a given variant on the option for all shared steps.
1088
+ * @param variant The variant to select.
1089
+ */
1090
+ selectVariant(variant: Variant): Promise<void>;
1091
+ applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
1092
+ private applyVariantSelection;
1093
+ }
1094
+ /**
1095
+ * A color option property handle represents a property that can
1096
+ * affect the option of steps across multiple transactions. This class is a specialization of the OptionGlobalPropertyHandle which includes functionality for
1097
+ * setting custom color values when a custom color variant is selected.
1098
+ */
1099
+ declare class ColorOptionGlobalPropertyHandle extends OptionGlobalPropertyHandle {
1100
+ constructor(bundle: Bundle$1, property: GlobalPropertyConfigurationAspect, optionResource: OptionResource | undefined);
1101
+ /**
1102
+ * Sets a custom color on the global state.
1103
+ */
1104
+ setCustomColor(color: string): void;
1105
+ /**
1106
+ * Gets the custom color used by the global state.
1107
+ */
1108
+ getCustomColor(): string;
1109
+ }
1110
+
1111
+ interface GlobalPropertyStateManager {
1112
+ getInitializationPromise(): Promise<void>;
1113
+ getGlobalPropertyState(): GlobalPropertyState | undefined;
1114
+ getAspect(name: string): string | undefined;
1115
+ getAspectStorage(name: string): GlobalPropertyStateAspectStorage | undefined;
1116
+ /**
1117
+ * Updates the value of a named aspect in the state.
1118
+ * @param name The name (key) of the aspect. This must match the key in the associated Global Property Config
1119
+ * @param value The value, represented as a string.
1120
+ * @param storage Optional: Additional data storage for the aspect. Not specifying this parameter, or providing `undefined`, will not update the
1121
+ * storage (if it already exists). Providing `null` will clear the existing storage.
1122
+ */
1123
+ setAspect(name: string, value: string, storage?: GlobalPropertyStateAspectStorage | null): Promise<void>;
1124
+ setAspectStorage(name: string, storage: GlobalPropertyStateAspectStorage | null): Promise<void>;
1125
+ setBundleOptions(bundleOptions?: BundleOptions): void;
1126
+ }
1127
+ interface BundleOptions {
1128
+ additionalHeaders?: {
1129
+ [key: string]: string;
1130
+ };
1131
+ }
1132
+
1133
+ /**
1134
+ * A collection of products that can be used to form a bundle.
1135
+ */
1136
+ declare class ProductCollection {
1137
+ private readonly collection;
1138
+ constructor(collection: ProductCollectionResource);
1139
+ /**
1140
+ * The ID of the product collection.
1141
+ */
1142
+ getId(): string;
1143
+ /**
1144
+ * The name of the collection.
1145
+ */
1146
+ getName(): string;
1147
+ /**
1148
+ * A list of products in this collections with useful helpers for interacting with them.
1149
+ */
1150
+ getProducts(): CollectionProduct[];
1151
+ /**
1152
+ * A list of products in this collections with useful helpers for interacting with them.
1153
+ */
1154
+ fetchProducts(): Promise<CollectionProduct[]>;
1155
+ getTransformCollection(): TransformCollection$1 | undefined;
1156
+ /**
1157
+ * The raw collection resource. This is generally not needed and should be avoided.
1158
+ */
1159
+ getResource(): ProductCollectionResource;
1160
+ }
1161
+ /**
1162
+ * A collection product is a product within a ProductCollection. It provides a simple interface for interacting with the product.
1163
+ */
1164
+ declare class CollectionProduct {
1165
+ private readonly product;
1166
+ private readonly productResource;
1167
+ constructor(productCollectionProduct: ProductCollectionProductResource);
1168
+ /**
1169
+ * The ID of the product in SpiffCommerce.
1170
+ * @returns
1171
+ */
1172
+ getId(): string;
1173
+ /**
1174
+ * The name of the product. Human readable.
1175
+ */
1176
+ getName(): string;
1177
+ /**
1178
+ * A helper function for getting integrations
1179
+ * @param type The type of integration you want.
1180
+ * @param externalId An external integration ID to further filter by. Otherwise we return the first encountered.
1181
+ * @returns The integration if found. Throws an error if not found as this data is typically a neccesity.
1182
+ */
1183
+ getIntegrationByType(type: IntegrationType, externalId?: string): IntegrationProductResource;
1184
+ getCurrentIntegration(): IntegrationProductResource;
1185
+ /**
1186
+ * A helper function for pulling the default workflow.
1187
+ */
1188
+ getDefaultWorkflow(): ProductWorkflow$1;
1189
+ /**
1190
+ * @returns All workflows associated with this Product.
1191
+ */
1192
+ getAllWorkflows(): ProductWorkflow$1[];
1193
+ /**
1194
+ * A list of all integrations this product is connected to.
1195
+ */
1196
+ getIntegrations(): IntegrationProductResource[];
1197
+ /**
1198
+ * The raw product resource. This is generally not needed and should be avoided.
1199
+ */
1200
+ getResource(): Product;
1201
+ /**
1202
+ * Gets the base price of the product. Optionally include additional product pricing.
1203
+ * @param includeAdditionalProduct Optionally include additional product pricing. You must provide at least one of the fields on this object.
1204
+ * @returns
1205
+ */
1206
+ getBasePrice(includeAdditionalProduct?: {
1207
+ /**
1208
+ * The integration type to locate the additional product on.
1209
+ */
1210
+ integrationType?: IntegrationType;
1211
+ /**
1212
+ * The external ID of the integration to locate the additional product on.
1213
+ */
1214
+ externalId?: string;
1215
+ /**
1216
+ * The internal Spiff integration ID to locate the additional product on.
1217
+ */
1218
+ integrationId?: string;
1219
+ }): number;
1220
+ }
1221
+ /**
1222
+ * Represents a the relationship between a workflow and a product.
1223
+ */
1224
+ declare class ProductWorkflow$1 {
1225
+ private readonly workflow;
1226
+ constructor(workflow: ProductWorkflow);
1227
+ /**
1228
+ * @returns The ID of this workflow, to be used when starting an experience.
1229
+ */
1230
+ getId(): string;
1231
+ /**
1232
+ * @returns The name of the workflow.
1233
+ */
1234
+ getName(): string;
1235
+ /**
1236
+ * An image to be used to display this workflow in a UI to the customer.
1237
+ * @returns A resource URL.
1238
+ */
1239
+ getThumbnail(): string;
1240
+ }
1241
+ /**
1242
+ * Represents a collection of transforms that can be applied inside a product collection.
1243
+ */
1244
+ declare class TransformCollection$1 {
1245
+ private readonly collection;
1246
+ constructor(collection: TransformCollection);
1247
+ /**
1248
+ * @returns The ID of the transform collection.
1249
+ */
1250
+ getId(): string;
1251
+ /**
1252
+ * @returns The name of the transform collection.
1253
+ */
1254
+ getName(): string;
1255
+ /**
1256
+ * @returns The transforms in this collection.
1257
+ */
1258
+ getTransforms(): Transform[];
1259
+ }
1260
+ /**
1261
+ * Represents the translations, rotation & scale of a product in 3D space.
1262
+ */
1263
+ declare class Transform {
1264
+ private readonly transform;
1265
+ constructor(position: TransformCollectionTransform);
1266
+ /**
1267
+ * @returns The ID of the transform.
1268
+ */
1269
+ getId(): string;
1270
+ /**
1271
+ * @returns The name of the transform.
1272
+ */
1273
+ getName(): string;
1274
+ /**
1275
+ * @returns The transformation to be used to place the object.
1276
+ */
1277
+ get(): BundleStateTransform;
1278
+ }
1279
+
1280
+ /**
1281
+ * A bundle serves as a container for a set of workflow experience.
1282
+ */
1283
+ interface Bundle$1 {
1284
+ /**
1285
+ * @returns The client that this bundle is associated with.
1286
+ */
1287
+ getClient(): SpiffCommerceClient;
1288
+ /**
1289
+ * @returns The id of the bundle entity in the Spiff Commerce system.
1290
+ */
1291
+ getId(): string;
1292
+ /**
1293
+ * @returns The name of the bundle.
1294
+ */
1295
+ getName(): string;
1296
+ /**
1297
+ * Set the name of the bundle.
1298
+ * @param name The new name for the bundle.
1299
+ * @returns A promise that resolves when the name has been updated in the Spiff Commerce system.
1300
+ */
1301
+ setName(name: string): Promise<void>;
1302
+ /**
1303
+ * @returns Custom metadata associated with this bundle.
1304
+ */
1305
+ getMetadata(): Map<string, string>;
1306
+ /**
1307
+ * Set custom metadata associated with this bundle.
1308
+ * @param metadata Updated map of metadata items.
1309
+ * @returns A promise that resolves when the metadata has been updated in the Spiff Commerce system.
1310
+ */
1311
+ setMetadata(metadata: Map<string, string>): Promise<void>;
1312
+ /**
1313
+ * Set the name and metadata for this bundle.
1314
+ * @param name The new name for the bundle.
1315
+ * @param metadata Updated map of metadata items.
1316
+ * @returns A promise that resolves when the name and metadata have been updated in the Spiff Commerce system.
1317
+ */
1318
+ setNameAndMetadata(name: string, metadata: Map<string, string>): Promise<void>;
1319
+ /**
1320
+ * Returns true if this bundle is associated with a Product Collection that is linked to a Global Property Configuration
1321
+ */
1322
+ hasGlobalProperties(): boolean;
1323
+ /**
1324
+ * Get a handle to the global properties available within this bundle. Setting values
1325
+ * via this method will make selections on all bundles that share the property.
1326
+ */
1327
+ getGlobalProperties(): Promise<GlobalPropertyHandle[]>;
1328
+ /**
1329
+ * Get the low level state manager for this bundle. Don't use this unless you know what you're doing.
1330
+ */
1331
+ getGlobalPropertyStateManager(): GlobalPropertyStateManager;
1332
+ /**
1333
+ * Get the total in subunits for all global properties in this bundle.
1334
+ */
1335
+ getGlobalPropertyTotalSubunits(): Promise<number>;
1336
+ /**
1337
+ * Return the total in subunits for this bundle. This is the sum of the total for all individual transactions.
1338
+ */
1339
+ getTotalSubunits(): number;
1340
+ /**
1341
+ * Retrieves the product collection associated with this bundle.
1342
+ * If the bundle is not associated with a product collection, this method will return undefined.
1343
+ */
1344
+ getProductCollection(): ProductCollection | undefined;
1345
+ /**
1346
+ * Add another workflow experience to this bundle.
1347
+ * @param experience The workflow experience to add to this bundle.
1348
+ */
1349
+ addWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1350
+ /**
1351
+ * Adds multiple workflow experiences to this bundle.
1352
+ * @param experiences The workflow experiences to add to this bundle.
1353
+ */
1354
+ addWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1355
+ /**
1356
+ * Remove a workflow experience from this bundle.
1357
+ * @param experience The workflow experience to remove from this bundle.
1358
+ */
1359
+ removeWorkflowExperience(experience: WorkflowExperience): Promise<void>;
1360
+ /**
1361
+ * Removes multiple workflow experiences from this bundle.
1362
+ * @param experiences The workflow experiences to remove from this bundle.
1363
+ */
1364
+ removeWorkflowExperiences(experiences: WorkflowExperience[]): Promise<void>;
1365
+ /**
1366
+ * Remove a workflow experience from this bundle by transaction.
1367
+ * @param transaction The transaction to remove from this bundle.
1368
+ */
1369
+ removeWorkflowExperienceByTransaction(transaction: Transaction): Promise<void>;
1370
+ /**
1371
+ * Removes multiple workflow experiences from this bundle by their transactions.
1372
+ * @param transactions The transactions to remove from this bundle.
1373
+ */
1374
+ removeWorkflowExperiencesByTransactions(transactions: Transaction[]): Promise<void>;
1375
+ /**
1376
+ * Inserts the given workflow experience into the bundle at the given index.
1377
+ * NOTE: If you intend to insert a workflow experience at the end of the bundle, use `addWorkflowExperience` instead as it is more efficient.
1378
+ * @param experience The workflow experience to insert.
1379
+ * @param index The index to insert the workflow experience at.
1380
+ */
1381
+ insertWorkflowExperience(experience: WorkflowExperience, index: number): Promise<void>;
1382
+ /**
1383
+ * Replaces a workflow experience at the given index with the given workflow experience. This essentially removes the old one and inserts the new one.
1384
+ * @param index The index to replace the workflow experience at.
1385
+ * @param experience The workflow experience to replace the old one with.
1386
+ */
1387
+ replaceWorkflowExperience(index: number, experience: WorkflowExperience): Promise<void>;
1388
+ /**
1389
+ * Swaps the workflow experiences at the given indices.
1390
+ */
1391
+ swapWorkflowExperiences(a: number, b: number): Promise<void>;
1392
+ /**
1393
+ * Returns all workflow experiences currently added to this bundle.
1394
+ */
1395
+ getWorkflowExperiences(): WorkflowExperience[];
1396
+ /**
1397
+ * Sort the list of workflow experiences. The sorting is performed locally, and then the order is updated in the Spiff Commerce system.
1398
+ * @returns A promise that resolves when the re-ordering of the workflow experiences has been updated in the Spiff Commerce system.
1399
+ * The sorting will occur immediately, but the promise will not resolve until the Spiff Commerce system has been updated.
1400
+ */
1401
+ sortWorkflowExperiences(sortFunc: (expA: WorkflowExperience, expB: WorkflowExperience) => number): Promise<void>;
1402
+ /**
1403
+ * @returns The number of workflow experiences in this bundle.
1404
+ */
1405
+ getWorkflowExperienceCount(): number;
1406
+ /**
1407
+ * Add a stakeholder to this bundle. If the stakeholder already exists, it will be updated. Write access to the bundle is required.
1408
+ * @param customerDetails The details of the customer to add. The emailAddress field is required.
1409
+ * @param stakeholderType The type of stakeholder to add. Defaults to Owner.
1410
+ */
1411
+ addStakeholder(customerDetails: CustomerDetailsInput, stakeholderType?: StakeholderType): Promise<void>;
1412
+ /**
1413
+ * Removes a stakeholder from this bundle. Write access to the bundle is required.
1414
+ * @param emailAddress The email address of the stakeholder to remove.
1415
+ */
1416
+ removeStakeholder(emailAddress: string): Promise<void>;
1417
+ /**
1418
+ * Updates all stakeholders associated with this bundle. Write access to the bundle is required.
1419
+ * @param stakeholders An array of stakeholders to update. Unknown stakeholders will be added, and absent stakeholders will be removed.
1420
+ */
1421
+ updateStakeholders(stakeholders: BundleStakeholderInput[]): Promise<void>;
1422
+ /**
1423
+ * Retrieves all stakeholders associated with this bundle.
1424
+ */
1425
+ getAllStakeholders(): Promise<BundleStakeholder[]>;
1426
+ /**
1427
+ * Finalizes all experiences within the bundle. This will return a promise that resolves when all experiences have been finalized.
1428
+ * The promise resolves with a list of messages that indicate the status of each experience including
1429
+ * helpful details like what product to add to cart on supported e-commerce platforms.
1430
+ * @param onProgressUpdate A callback that will be called when the progress of the finalization changes.
1431
+ * @param createPreviewImage A callback that will be called when a preview image is required. This is used to generate a preview image for the design.
1432
+ * If this callback is not provided, no preview image will be generated.
1433
+ * @returns {BundleDesignCreationMessage} An object containing an array of design messages, along with the Bundle's Id and the event type.
1434
+ */
1435
+ finish(onProgressUpdate?: DesignCreationProgressUpdate, createPreviewImage?: (workflowExperience: WorkflowExperience) => Promise<string | undefined>): Promise<BundleDesignCreationMessage>;
1436
+ /**
1437
+ * Add an event listener to this bundle.
1438
+ * @param event The event to listen for. Currently only "conditional-global-properties-changed" is supported.
1439
+ * @param listener The listener to call when the event occurs.
1440
+ */
1441
+ addEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
1442
+ /**
1443
+ * Remove a previously added event listener from this bundle.
1444
+ */
1445
+ removeEventListener(event: BundleEventType, listener: (e: BundleEvent) => void): void;
1446
+ /**
1447
+ * Retrieves the current preview service for this bundle, if one exists.
1448
+ * If a preview service was specified when calling client.getExistingBundle, this will return that service.
1449
+ * Call `setPreviewService` to update the preview service for this bundle.
1450
+ */
1451
+ getPreviewService(): ThreeDPreviewService | undefined;
1452
+ /**
1453
+ * Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will
1454
+ * also automatically inject the preview service into any new workflow experiences that are added to this bundle.
1455
+ * If this method is called with no arguments or undefined, the preview service will be removed from this bundle.
1456
+ * @param previewService The preview service to use for this bundle.
1457
+ * @returns A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.
1458
+ */
1459
+ setPreviewService(previewService?: ThreeDPreviewService): Promise<void>;
1460
+ /**
1461
+ * Returns a promise that resolves when the bundle has been initialized.
1462
+ * This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
1463
+ */
1464
+ getInitializationPromise(): Promise<void>;
1465
+ /**
1466
+ * Sets the position, rotation, and scale of a named transform for a workflow experience within this bundle.
1467
+ * @param workflowExperience The workflow experience to update.
1468
+ * @param transformName The name of the transform.
1469
+ * @param transform An object containing `position`, `rotation`, and `scale` properties. Each property is an object with `x`, `y`, and `z` properties.
1470
+ */
1471
+ updateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string, transform: BundleStateTransform): Promise<void>;
1472
+ /**
1473
+ * Sets a transform of a workflow experience within this bundle to be the active one.
1474
+ * @param workflowExperience The workflow experience to update.
1475
+ * @param transform The name of the transform to make the active transform.
1476
+ */
1477
+ activateWorkflowExperienceTransform(workflowExperience: WorkflowExperience, transformName: string): Promise<void>;
1478
+ /**
1479
+ * @returns The raw Global Property Configuration that is in use, otherwise `undefined`.
1480
+ */
1481
+ getGlobalPropertyConfiguration(): GlobalPropertyConfiguration | undefined;
1482
+ setBundleOptions(bundleOptions?: BundleOptions): any;
1483
+ }
1484
+ type BundleEventType = "conditional-global-properties-changed" | "workflow-experience-hover-enter" | "workflow-experience-hover-exit";
1485
+ type BundleEventData = ConditionalGlobalPropertiesChangedEventData | WorkflowExperienceHoverEventData;
1486
+ type BundleEvent = {
1487
+ bundle: Bundle$1;
1488
+ data: BundleEventData;
1489
+ event: BundleEventType;
1490
+ };
1491
+ interface ConditionalGlobalPropertiesChangedEventData {
1492
+ globalProperties: GlobalPropertyHandle[];
1493
+ }
1494
+ interface WorkflowExperienceHoverEventData {
1495
+ workflowExperience: WorkflowExperience;
1496
+ }
1497
+
1498
+ /**
1499
+ * A list of node types available in executions
1500
+ */
1501
+ declare enum NodeType {
1502
+ Split = "Split",
1503
+ TextJoin = "TextJoin",
1504
+ TextSlice = "TextSlice",
1505
+ TextUpper = "TextUpper",
1506
+ TextLower = "TextLower",
1507
+ ParseJson = "ParseJson",
1508
+ TextBuilder = "TextBuilder",
1509
+ Design = "Design",
1510
+ OverlayImage = "OverlayImage",
1511
+ OverlayText = "OverlayText",
1512
+ TableGenerator = "TableGenerator",
1513
+ QR = "QR",
1514
+ CSV = "CSV",
1515
+ PDF = "PDF",
1516
+ PNG = "PNG",
1517
+ Email = "Email",
1518
+ LocationDelivery = "LocationDelivery",
1519
+ TemplateEmail = "TemplateEmail",
1520
+ Map = "Map",
1521
+ Sort = "Sort",
1522
+ Group = "Group",
1523
+ InnerJoin = "InnerJoin",
1524
+ Contains = "Contains",
1525
+ Flatten = "Flatten",
1526
+ KeyValuePairs = "KeyValuePairs",
1527
+ ListConcatenate = "ListConcatenate",
1528
+ Repeat = "Repeat",
1529
+ Size = "Size",
1530
+ ListBuilder = "ListBuilder",
1531
+ MapBuilder = "MapBuilder",
1532
+ PairBuilder = "PairBuilder",
1533
+ AND = "AND",
1534
+ OR = "OR",
1535
+ NOT = "NOT",
1536
+ Equals = "Equals",
1537
+ Present = "Present",
1538
+ ManualOperation = "ManualOperation",
1539
+ Switch = "Switch",
1540
+ AssetMetadata = "AssetMetadata",
1541
+ DataSelect = "DataSelect",
1542
+ LayoutSelect = "LayoutSelect",
1543
+ TransactionMetadata = "TransactionMetadata",
1544
+ VariantSelection = "VariantSelection",
1545
+ StartTerminal = "StartTerminal",
1546
+ EndTerminal = "EndTerminal",
1547
+ MiscNote = "MiscNote",
1548
+ Assign = "Assign",
1549
+ CsvVlookup = "CsvVlookup",
1550
+ ProcessFlow = "ProcessFlow",
1551
+ TemporaryAssetUrl = "TemporaryAssetUrl",
1552
+ WebRequest = "WebRequest"
1553
+ }
1554
+ interface ExecutionNodeResponse {
1555
+ id: string;
1556
+ type: NodeType;
1557
+ artifacts: string;
1558
+ }
1559
+ interface ExecutionResponse {
1560
+ id: string;
1561
+ nodes: ExecutionNodeResponse[];
1562
+ completedAt?: string;
1563
+ failedAt?: string;
1564
+ }
1565
+ /**
1566
+ * A service containing functionality for interacting with the Spiff Commerce API to execute and inspect the result of process flows.
1567
+ */
1568
+ declare class FlowService {
1569
+ /**
1570
+ *
1571
+ * @param id
1572
+ * @param inputs
1573
+ * @param options
1574
+ * @returns
1575
+ */
1576
+ execute(id: string, inputs: FlowExecutionInput[], options?: {
1577
+ sleepTime?: number;
1578
+ repeats?: number;
1579
+ }): Promise<FlowExecutionResult>;
1580
+ }
1581
+ /**
1582
+ * Handles preparing a flow input for transmission to the server.
1583
+ */
1584
+ declare class FlowExecutionResult {
1585
+ protected readonly execution: ExecutionResponse;
1586
+ constructor(execution: ExecutionResponse);
1587
+ /**
1588
+ * @returns The raw response from the server.
1589
+ */
1590
+ getRaw(): ExecutionResponse;
1591
+ /**
1592
+ * @returns The nodes contained within the execution.
1593
+ */
1594
+ getNodes(): FlowExecutionNodeResult[];
1595
+ /**
1596
+ * @param type The type of node to return.
1597
+ * @returns A list of nodes matching the requested type.
1598
+ */
1599
+ getNodesByType(type: NodeType): FlowExecutionNodeResult[];
1600
+ /**
1601
+ * @returns A list of input nodes that exist in this execution.
1602
+ */
1603
+ getInputs(): FlowExecutionNodeResult[];
1604
+ /**
1605
+ * @returns A list of out put nodes that exist in this execution.
1606
+ */
1607
+ getOutputs(): FlowExecutionNodeResult[];
1608
+ /**
1609
+ * @returns A date object representing the point in time this execution completed.
1610
+ */
1611
+ getCompletedAt(): Date | undefined;
1612
+ /**
1613
+ * @returns A date object representing the point in time this execution failed.
1614
+ */
1615
+ getFailedAt(): Date | undefined;
1616
+ }
1617
+ /**
1618
+ * Handles preparing a flow input for transmission to the server.
1619
+ */
1620
+ declare class FlowExecutionNodeResult {
1621
+ protected readonly node: ExecutionNodeResponse;
1622
+ constructor(node: ExecutionNodeResponse);
1623
+ getId(): string;
1624
+ getType(): NodeType;
1625
+ getArtifacts(): Map<string, any>;
1626
+ getArtifactByName<T>(name: string): T;
1627
+ }
1628
+ /**
1629
+ * Handles preparing a flow input for transmission to the server.
1630
+ */
1631
+ declare abstract class FlowExecutionInput {
1632
+ protected readonly value: string;
1633
+ constructor(value: string);
1634
+ getRaw(): string;
1635
+ getValueForTransmission(): string;
1636
+ }
1637
+ /**
1638
+ * Represents the type of object being referenced by the input.
1639
+ */
1640
+ declare const enum ObjectInputType {
1641
+ Transaction = "Transaction",
1642
+ Bundle = "Bundle",
1643
+ Product = "Product",
1644
+ Variant = "Variant",
1645
+ Option = "Option",
1646
+ LineItem = "LineItem",
1647
+ Asset = "Asset"
1648
+ }
1649
+ declare class TextInput extends FlowExecutionInput {
1650
+ constructor(input: string);
1651
+ }
1652
+ /**
1653
+ * Handles validation of spiffObject structure for transmission to the server.
1654
+ */
1655
+ declare class ObjectInput extends FlowExecutionInput {
1656
+ constructor(id: string, type: ObjectInputType);
1657
+ static validUUID(uuid: string): RegExpMatchArray | null;
1658
+ }
1659
+ /**
1660
+ * Handles validation of array input for transmission to the server.
1661
+ */
1662
+ declare class ArrayInput extends FlowExecutionInput {
1663
+ constructor(elements: FlowExecutionInput[]);
1664
+ }
1665
+
1666
+ declare class IntegrationProduct {
1667
+ private readonly integrationProduct;
1668
+ constructor(product: IntegrationProductResource);
1669
+ getId(): string;
1670
+ getResource(): IntegrationProductResource;
1671
+ getBasePrice(): number;
1672
+ getDefaultWorkflow(): ProductWorkflow$1;
1673
+ getAllWorkflows(): ProductWorkflow$1[];
1674
+ }
1675
+
1676
+ declare const getWorkflows: (ids: string[], options?: GetWorkflowGraphqlOptions) => Promise<Workflow[]>;
1677
+ declare const getWorkflow: (id: string, options?: GetWorkflowGraphqlOptions) => Promise<Workflow>;
1678
+ /**
1679
+ * Options that can be used during instantiation of the SpiffCommerce Javascript Client.
1680
+ * Please refer to the documentation for more information.
1681
+ */
1682
+ interface ClientOptions {
1683
+ /**
1684
+ * When provided, the client will use the provided application key to
1685
+ * authenticate with the SpiffCommerce API.
1686
+ */
1687
+ applicationKey?: string;
1688
+ }
1689
+ interface GetBundleGraphqlAssetsOptions {
1690
+ metadata?: boolean;
1691
+ }
1692
+ interface GetBundleGraphqlProductCollectionOptions {
1693
+ eagerFetchProducts?: boolean;
1694
+ }
1695
+ interface GetBundleGraphqlOptions {
1696
+ productCollection?: GetBundleGraphqlProductCollectionOptions;
1697
+ assets?: GetBundleGraphqlAssetsOptions;
1698
+ additionalHeaders?: {
1699
+ [key: string]: string;
1700
+ };
1701
+ }
1702
+ interface GetBundleOptions {
1703
+ /**
1704
+ * Configuration for the graphQL request made for bundles. Allows for retrieval
1705
+ * of additional data.
1706
+ */
1707
+ graphql?: GetBundleGraphqlOptions;
1708
+ }
1709
+ interface GetWorkflowGraphqlAssetsOptions {
1710
+ metadata?: boolean;
1711
+ }
1712
+ interface GetWorkflowGraphqlOptions {
1713
+ assets?: GetWorkflowGraphqlAssetsOptions;
1714
+ }
1715
+ interface GetWorkflowOptionsBase {
1716
+ /**
1717
+ * An existing preview service to use, instead of creating a new one.
1718
+ */
1719
+ previewService?: ThreeDPreviewService;
1720
+ /**
1721
+ * Configuration related to the
1722
+ * workflow and how the system interprets it.
1723
+ */
1724
+ workflowConfiguration?: {
1725
+ /**
1726
+ * False by default, when true the system will treat
1727
+ * steps with a single variant
1728
+ * as being renderable.
1729
+ */
1730
+ singleVariantsRenderable?: boolean;
1731
+ };
1732
+ /**
1733
+ * Configuration for the graphQL request made for workflows. Allows for retrieval
1734
+ * of additional data.
1735
+ */
1736
+ graphql?: GetWorkflowGraphqlOptions;
1737
+ }
1738
+ interface GetWorkflowFromTransactionOptions extends GetWorkflowOptionsBase {
1739
+ /** The existing Transaction to use. */
1740
+ transactionId: string;
1741
+ /** If set to true, the workflow will display in a read-only mode. */
1742
+ readOnly?: boolean;
1743
+ /** An existing workflow state, if available. */
1744
+ workflowState?: string;
1745
+ type: "transaction";
1746
+ }
1747
+ interface GetNewWorkflowOptionsBase extends GetWorkflowOptionsBase {
1748
+ /** A name for the new transaction. */
1749
+ designName?: string;
1750
+ /** The workflow to load. */
1751
+ workflowId: string;
1752
+ /** An existing workflow state, if available. */
1753
+ workflowState?: string;
1754
+ }
1755
+ interface GetWorkflowFromIntegrationProductOptions extends GetNewWorkflowOptionsBase {
1756
+ integrationProductId: string;
1757
+ type: "integration";
1758
+ }
1759
+ interface GetWorkflowFromExternalProductOptions extends GetNewWorkflowOptionsBase {
1760
+ /** The external ID associated with an integration. */
1761
+ externalIntegrationId: string;
1762
+ /** The ID of the product from the external system. */
1763
+ externalProductId: string;
1764
+ type: "external";
1765
+ }
1766
+ type GetNewWorkflowOptions = GetWorkflowFromIntegrationProductOptions | GetWorkflowFromExternalProductOptions;
1767
+ type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetNewWorkflowOptions;
1768
+ /**
1769
+ * The Spiff Commerce Javascript Client. Required for
1770
+ * creating workflow experiences.
1771
+ */
1772
+ declare class SpiffCommerceClient {
1773
+ private options;
1774
+ private initialized;
1775
+ private currencyCode?;
1776
+ private customer?;
1777
+ private activeIntegration?;
1778
+ /**
1779
+ * @deprecated This object is passed to the WorkflowExperience constructor and is no longer needed on this object.
1780
+ * Any functionality referencing this object will be removed in a future release.
1781
+ */
1782
+ private experienceOptions?;
1783
+ constructor(options: ClientOptions);
1784
+ /**
1785
+ * @returns The asset manager allows for common operations related to assets
1786
+ * and the Spiff Commerce platform.
1787
+ */
1788
+ getAssetManager(): AssetManager;
1789
+ getCurrencyCode(): string;
1790
+ getFlowService(): FlowService;
1791
+ getIntegration(): Promise<Integration>;
1792
+ canUseAddon(addonHandle: AddonHandle): Promise<boolean>;
1793
+ /**
1794
+ * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
1795
+ * @param bundleId The ID of the bundle you intend to load.
1796
+ * @returns An object containing the success status of the authentication attempt, and the type of stakeholder when successful.
1797
+ */
1798
+ authenticateBundleFromLocalStorage(bundleId: string): Promise<{
1799
+ stakeholderType?: StakeholderType;
1800
+ success: boolean;
1801
+ }>;
1802
+ /**
1803
+ * Attempts to load persisted authentication information from local storage, and authenticate with the Spiff Commerce API.
1804
+ * @param transactionId The ID of the transaction that the user is attempting to load.
1805
+ * @returns An object containing the following:
1806
+ * - `customLogoLink`: A link to a custom logo to display in the header.
1807
+ * - `transactionReadOnly`: Whether or not the transaction is read-only. Shadow will not accept any changes to the transaction if this is set to true.
1808
+ * - `stakeholderType`: The type of stakeholder that the user is authenticated as.
1809
+ * - `success`: Whether or not the authentication was successful.
1810
+ * @throws An error if the transaction is not found.
1811
+ */
1812
+ authenticateTransactionFromLocalStorage(transactionId: string): Promise<{
1813
+ customLogoLink?: string;
1814
+ transactionReadOnly?: boolean;
1815
+ stakeholderType?: StakeholderType;
1816
+ success: boolean;
1817
+ theme?: Theme;
1818
+ }>;
1819
+ clearCustomer(): void;
1820
+ clearCustomerForTransaction(transactionId: string): void;
1821
+ getStakeholderTypeForTransaction(transactionId: string): StakeholderType | undefined;
1822
+ getOrCreateCustomer(emailAddress: string): Promise<{
1823
+ customer: Customer;
1824
+ isAuthenticated: boolean;
1825
+ }>;
1826
+ private authenticateCustomerId;
1827
+ /**
1828
+ * Generates a verification code for the given email address.
1829
+ * @param emailAddress The email address to generate a verification code for. The user will be sent an email with the verification code.
1830
+ */
1831
+ generateVerificationCode(emailAddress: string): Promise<void>;
1832
+ /**
1833
+ * Verifies the given email address with the given verification code.
1834
+ * @param emailAddress The email address to verify.
1835
+ * @param verificationCode The verification code to verify the email address with.
1836
+ * @returns True if the verification was successful, false otherwise.
1837
+ */
1838
+ verifyCode(emailAddress: string, verificationCode: string): Promise<boolean>;
1839
+ /**
1840
+ * @param collectionId Optional: The id of the product collection that the bundle can use.
1841
+ * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
1842
+ */
1843
+ getNewBundle(collectionId?: string, initialMetadata?: {
1844
+ [key: string]: string;
1845
+ }, options?: GetBundleOptions): Promise<Bundle$1>;
1846
+ /**
1847
+ * Retrieves an existing bundle from the API, by id.
1848
+ * @param bundleId The id of the bundle to retrieve.
1849
+ * @param previewService Optional: A reference to an existing preview service to use. This can be assigned manually later.
1850
+ * @param graphqlOptions Optional: Options to configure loading the workflow.
1851
+ * @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
1852
+ */
1853
+ getExistingBundle(bundleId: string, previewService?: ThreeDPreviewService,
1854
+ /**
1855
+ * @deprecated use GetBundleOptions instead. This attribute will be removed in the future.
1856
+ */
1857
+ graphqlOptions?: GetBundleGraphqlOptions, options?: GetBundleOptions): Promise<Bundle$1>;
1858
+ /**
1859
+ * Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
1860
+ * @returns An array of bundle stakeholders.
1861
+ */
1862
+ getBundleStakeholders(): Promise<BundleStakeholder[]>;
1863
+ /**
1864
+ * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
1865
+ * @param workflowId The id of the workflow to be run. Deprecated: Provide options instead.
1866
+ * @param workflowState An existing workflow state if available. Deprecated: Provide options instead.
1867
+ * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
1868
+ * @param options Options to configure loading the transaction and workflow.
1869
+ * @returns A workflow experience configured as requested.
1870
+ */
1871
+ getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => ThreeDPreviewService, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
1872
+ /**
1873
+ * Gets multiple workflow experiences at once.
1874
+ * @param optionsArray An array of options to configure loading the transactions and workflows.
1875
+ * NOTE: The `previewService` field on the option is currently unsupported in this function, as loading multiple models at once will likely cause performance issues.
1876
+ * @param graphqlOptions Options to configure loading the workflows.
1877
+ * @returns An array of workflow experiences configured as requested.
1878
+ */
1879
+ getWorkflowExperiences(optionsArray: GetWorkflowOptions[], graphqlOptions?: GetWorkflowGraphqlOptions): Promise<WorkflowExperience[]>;
1880
+ /**
1881
+ * Initialize the client from an integration product.
1882
+ * @param integrationProductId The integration product to use.
1883
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1884
+ */
1885
+ initFromIntegrationProduct(integrationProductId: string): Promise<void>;
1886
+ /**
1887
+ * Initialize the client from an existing transaction.
1888
+ * @param transactionId The id of the transaction
1889
+ * @returns A promise resolving at initialization completion.
1890
+ * @deprecated Use getWorkflowExperience to initialize the experience.
1891
+ */
1892
+ initFromTransaction(transactionId: string, readOnly?: boolean): Promise<void>;
1893
+ /**
1894
+ * @deprecated Remove when the initFrom functions are removed.
1895
+ */
1896
+ private getWorkflowExperienceDeprecated;
1897
+ /**
1898
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
1899
+ * @returns The preview service that was provided during construction.
1900
+ */
1901
+ getPreviewService(): ThreeDPreviewService | undefined;
1902
+ /**
1903
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
1904
+ * @returns The product associated with this client.
1905
+ */
1906
+ getProduct(): Product;
1907
+ /**
1908
+ * @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getTransaction()` instead.
1909
+ * @returns The transaction associated with this client.
1910
+ */
1911
+ getTransaction(): Transaction;
1912
+ configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
1913
+ /**
1914
+ * A function used to synchronize transaction state with the server.
1915
+ * @param options New state details. To be spread into the query.
1916
+ * @returns
1917
+ */
1918
+ private updateTransactionState;
1919
+ storeCustomer(customer: Customer): void;
1920
+ getIntegrationProductById(integrationProductId: string): Promise<IntegrationProduct>;
1921
+ getIntegrationProductFromExternalIds(externalIntegrationId: string, externalProductId: string): Promise<IntegrationProduct>;
1922
+ getIntegrationProduct(options: Extendable<{
1923
+ type: "integration";
1924
+ integrationProductId: string;
1925
+ }> | Extendable<{
1926
+ type: "external";
1927
+ externalIntegrationId: string;
1928
+ externalProductId: string;
1929
+ }>): Promise<IntegrationProduct>;
1930
+ getShareActionsForTransaction(transactionId: string): Promise<TransactionShareAction[] | undefined>;
1931
+ }
1932
+
1933
+ interface SilentIllustrationStepData extends SilentStepData, Placeable {
1934
+ }
1935
+ interface EditedSteps {
1936
+ [stepName: string]: boolean;
1937
+ }
1938
+ interface MandatorySteps {
1939
+ [stepName: string]: boolean;
1940
+ }
1941
+ type StepElements = {
1942
+ [key: string]: RegionElement[];
1943
+ };
1944
+ type StepInitialised = {
1945
+ [key: string]: boolean;
1946
+ };
1947
+ type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
1948
+ interface WorkflowStorage {
1949
+ [stepName: string]: StepStorage;
1950
+ }
1951
+ interface WorkflowMetadata {
1952
+ [stepName: string]: StepMetadata;
1953
+ }
1954
+ interface WorkflowSelections {
1955
+ [stepName: string]: {
1956
+ selections: VariantResource[];
1957
+ };
1958
+ }
1959
+ interface InformationResult {
1960
+ message: string;
1961
+ messageType: InformationMessageType;
1962
+ stepID: string;
1963
+ }
1964
+ declare enum InformationMessageType {
1965
+ Error = "Error",
1966
+ Warning = "Warning",
1967
+ Info = "Info"
1968
+ }
1969
+ /**
1970
+ * Services required for the operaiton of individual steps.
1971
+ */
1972
+ interface StepSpecificServices {
1973
+ frameService?: FrameService;
1974
+ module?: ModuleProduct;
1975
+ }
1976
+ type DesignCreationProgressUpdate = (message: string) => void;
1977
+ type ConfirmCallback = (isConfirmed: boolean) => void;
1978
+ type EditedCallback = (editedSteps: EditedSteps) => void;
1979
+ type ElementsCallback = (elements: StepElements) => void;
1980
+ type InformationResultCallback = (messages: InformationResult[]) => void;
1981
+ type InitCallback = (stepInitialised: StepInitialised) => void;
1982
+ type MakingAdjustmentsCallback = (makingAdjustments: string) => void;
1983
+ type MandatoryCallback = (mandatorySteps: MandatorySteps) => void;
1984
+ type MetadataCallback = (metadata: WorkflowMetadata) => void;
1985
+ type SelectionCallback = (callbackOptions: {
1986
+ selectionCost: number;
1987
+ selections: StepSelections;
1988
+ traversableScenes: WorkflowScene[];
1989
+ }) => void;
1990
+ type StepSpecificStorageCallback = (selections: StepStorage) => void;
1991
+ type StorageCallback = (storage: WorkflowStorage) => void;
1992
+ type StateMutationFunc = (options?: Omit<MutationOptions, "mutation">) => Promise<FetchResult<any, Record<string, any>, Record<string, any>>>;
1993
+ interface WorkflowManager {
1994
+ addPoller: (poller: Poller) => void;
1995
+ addConfirmCallback: (callback: ConfirmCallback) => void;
1996
+ addEditedCallback: (callback: EditedCallback) => void;
1997
+ addElementsCallback: (callback: ElementsCallback) => void;
1998
+ addInformationResultCallback: (callback: InformationResultCallback) => void;
1999
+ addInitCallback: (callback: InitCallback) => void;
2000
+ addMakingAdjustmentsCallback: (callback: MakingAdjustmentsCallback) => void;
2001
+ addMandatoryCallback: (callback: MandatoryCallback) => void;
2002
+ addMetadataCallback: (callback: MetadataCallback) => void;
2003
+ addSelectionCallback: (callback: SelectionCallback) => void;
2004
+ addStepSpecificStorageCallback: (callback: StepSpecificStorageCallback, stepName: string) => void;
2005
+ addStorageCallback: (callback: StorageCallback) => void;
2006
+ getCommandDispatcher: () => (command: CanvasCommand) => void;
2007
+ getCommandContext: () => CommandContext;
2008
+ getLayouts: () => ILayout[];
2009
+ getAllLayoutData: () => LayoutState[];
2010
+ getLayoutPreviewService: () => LayoutPreviewService | undefined;
2011
+ getPreviewService: () => ThreeDPreviewService | undefined;
2012
+ getProfanities: () => string[];
2013
+ getRegionElements: (stepName: string) => RegionElement[];
2014
+ getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
2015
+ getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
2016
+ getStepStorage: (stepName: string) => StepStorage | undefined;
2017
+ getMetadata: (stepName: string) => StepMetadata | undefined;
2018
+ getWorkflowMetadata: () => WorkflowMetadata;
2019
+ getInformationResults(): InformationResult[];
2020
+ getTransaction: () => Transaction;
2021
+ getTransactionCustomer: () => Customer | undefined;
2022
+ setTransactionCustomer: (customer: Customer) => void;
2023
+ /**
2024
+ * @deprecated Use setTransactionCustomer instead.
2025
+ */
2026
+ setTransactionCustomerDetails: (details: {
2027
+ email: string;
2028
+ }) => void;
2029
+ getWorkflow: () => Workflow;
2030
+ getWorkflowSelections: () => WorkflowSelections;
2031
+ getProduct: () => Product;
2032
+ /**
2033
+ * A promise resolving when the initial state of the workflow has completed loading.
2034
+ */
2035
+ getInitializationPromise: () => Promise<void>;
2036
+ /**
2037
+ * Returns true when the initial state of the workflow has been loaded and settled.
2038
+ */
2039
+ isInitialized(): boolean;
2040
+ markStepsAsInitialised: (stepNames: string[]) => void;
2041
+ getUpdatesPending: () => boolean;
2042
+ markUpdateCompleted: (id: string) => void;
2043
+ markUpdatePending: () => string;
2044
+ outstandingRequestsPromise: () => Promise<void>;
2045
+ reset: () => Promise<void>;
2046
+ setCurrentAdjustingStepId: (stepId: string) => void;
2047
+ setEditedStatus: (stepName: string, status: boolean) => void;
2048
+ setInformationResults: (results: InformationResult[]) => void;
2049
+ setMandatoryFulfilled: (stepName: string, status: boolean) => void;
2050
+ setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[], callback?: () => Promise<void>) => Promise<void>;
2051
+ toggleDesignConfirmed: () => void;
2052
+ updateMetadata: (stepName: string, update: any) => void;
2053
+ /**
2054
+ * @deprecated State updates are being pulled internally. This function will be removed in the future.
2055
+ */
2056
+ updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
2057
+ updateStorage: (stepName: string, update: StepStorage) => void;
2058
+ getModelContainer: () => ModelContainer | undefined;
2059
+ setModelContainer: (container: ModelContainer) => void;
2060
+ /**
2061
+ * Injects the model of this product into the preview service.
2062
+ * This also overwrites the internal preview service.
2063
+ * @param previewService The preview service to inject into.
2064
+ * @param refocusCamera Optional: Run camera focus Defaults to `true`.
2065
+ */
2066
+ injectIntoPreviewService(previewService: ThreeDPreviewService, refocusCamera?: boolean): Promise<void>;
2067
+ /**
2068
+ * Ejects the model of this product from the preview service. This also sets the internal preview service to undefined.
2069
+ */
2070
+ ejectFromPreviewService(): void;
2071
+ /**
2072
+ * Enables or disables uploading of workflow state to the server.
2073
+ * @param enabled When true, workflow state will be uploaded to the server.
2074
+ */
2075
+ setWorkflowStateSyncEnabled: (enabled: boolean) => void;
2076
+ /**
2077
+ * Returns the client that was responsible for spawning this manager.
2078
+ */
2079
+ getClient(): SpiffCommerceClient;
2080
+ /**
2081
+ * Re-fetches the transactionShareActions for this WorkflowManager's Transaction object.
2082
+ * The updated transactionShareActions overwrite the existing values on the Transaction object returned by `getTransaction()`.
2083
+ */
2084
+ updateTransactionShareActions(): Promise<void>;
2085
+ }
2086
+
2087
+ interface StepService<T extends AnyStepData> {
2088
+ /**
2089
+ * Initialize the given step, or reload from serialized data if present.
2090
+ */
2091
+ init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
2092
+ }
2093
+ interface FileInfo {
2094
+ /**
2095
+ * The name of the file.
2096
+ */
2097
+ name: string;
2098
+ /**
2099
+ * A blob object representing the
2100
+ * data of the file.
2101
+ */
2102
+ blob: Blob;
2103
+ }
2104
+ /**
2105
+ * A command along with a function to run afterwards.
2106
+ */
2107
+ interface CommandWithFollowup {
2108
+ command?: CanvasCommand;
2109
+ followup?: () => Promise<void>;
2110
+ }
2111
+ /**
2112
+ * The variant selections of a completed step.
2113
+ */
2114
+ interface SelectedVariants {
2115
+ [stepName: string]: {
2116
+ id: string;
2117
+ name: string;
2118
+ priceModifier: number;
2119
+ }[];
2120
+ }
2121
+ interface ExportedData {
2122
+ [name: string]: {
2123
+ value: string;
2124
+ priceModifier: number;
2125
+ };
2126
+ }
2127
+ interface DesignCreationMessage {
2128
+ additionalExternalProductId?: string;
2129
+ additionalExternalVariantId?: string;
2130
+ baseCost?: number;
2131
+ designExternalVariants?: DesignExternalVariant[];
2132
+ designProductId?: string;
2133
+ designProductVariantId?: string;
2134
+ event: string;
2135
+ exportedData: ExportedData;
2136
+ externalCartProductId?: string;
2137
+ externalCartProductVariantId?: string;
2138
+ lineItemImageUrl: string;
2139
+ metadata?: {
2140
+ [stepName: string]: string;
2141
+ };
2142
+ optionsCost: number;
2143
+ processExecutionId?: string;
2144
+ quantity?: number;
2145
+ selectedVariants?: SelectedVariants;
2146
+ sku?: string;
2147
+ transactionId: string;
2148
+ transactionOwnerId?: string;
2149
+ weight?: number;
2150
+ workflowViewerLink: string;
2151
+ workflowViewerReadOnlyLink: string;
2152
+ }
2153
+ interface BundleDesignCreationMessage {
2154
+ bundleId: string;
2155
+ items: DesignCreationMessage[];
2156
+ }
2157
+ /**
2158
+ * Represents a transaction.
2159
+ */
2160
+ interface Transaction {
2161
+ /**
2162
+ * A unique identifier for this transaction. Useful for reloading and
2163
+ * modifying state of the transaction.
2164
+ */
2165
+ id: string;
2166
+ /**
2167
+ * User-supplied name for the associated design.
2168
+ */
2169
+ designName?: string;
2170
+ /**
2171
+ * The workflow associated with this transaction.
2172
+ */
2173
+ workflowId?: string;
2174
+ /**
2175
+ * Temporary ID that grants write permission to the transaction.
2176
+ */
2177
+ transactionOwnerId?: string;
2178
+ /**
2179
+ * The current state of the design.
2180
+ */
2181
+ workflowState?: string;
2182
+ /**
2183
+ * URL to a partner-specific logo intended to display during the workflow experience.
2184
+ */
2185
+ customLogoLink?: string;
2186
+ /**
2187
+ * URL to a logo intended to display at the periphery of the workflow experience.
2188
+ */
2189
+ workflowFooterLogoLink?: string;
2190
+ /**
2191
+ * URL to the corresponding integration in the REST API.
2192
+ */
2193
+ restApiIntegrationLink?: string;
2194
+ /**
2195
+ * URL to redirect to when a workflow is finished.
2196
+ */
2197
+ callbackUrl?: string;
2198
+ /**
2199
+ * Product that this transaction belongs to.
2200
+ */
2201
+ product?: Product;
2202
+ /**
2203
+ * The integration product related to this lineitem.
2204
+ */
2205
+ integrationProduct?: IntegrationProductResource;
2206
+ /**
2207
+ * Whether this transaction has previously been ordered.
2208
+ */
2209
+ isOrdered?: boolean;
2210
+ /**
2211
+ * @deprecated use isOrdered to check whether transaction has been ordered instead.
2212
+ */
2213
+ lineItem?: LineItem;
2214
+ /**
2215
+ * The external product variant ID representing the design product related
2216
+ * to this transaction, null unless the createDesignProduct flag was set
2217
+ * and the design was finalized using createDesign operation.
2218
+ */
2219
+ /**@deprecated use externalCartProductVariantId or designExternalVariants[x].externalProductVariantId instead of this moving forward */
2220
+ externalDesignProductVariantId?: string;
2221
+ /**
2222
+ * The external product id representing the design product related
2223
+ * to this transaction, null unless the createDesignProduct flag was set
2224
+ * and the design was finalized using createDesign operation.
2225
+ */
2226
+ /**@deprecated use externalCartProductId or designExternalVariants[x].externalProductId instead of this moving forward. */
2227
+ externalDesignProductId?: string;
2228
+ /**
2229
+ * The external product id representing the product related to the transaction.
2230
+ * This value can hold any type of transaction such as design and standard products.
2231
+ */
2232
+ externalCartProductId?: string;
2233
+ /**
2234
+ * The external product variant id representing the product related to the transaction.
2235
+ * This value can hold any type of transaction such as design and standard products.
2236
+ */
2237
+ externalCartProductVariantId?: string;
2238
+ priceModifierTotal?: number;
2239
+ /**
2240
+ * URL to open the transaction in the workflow viewer.
2241
+ */
2242
+ workflowViewerLink?: string;
2243
+ workflowViewerReadOnlyLink?: string;
2244
+ previewImageLink?: string;
2245
+ lastSyncedAt?: string;
2246
+ /**
2247
+ * The users who have access to this transaction.
2248
+ */
2249
+ stakeholders?: Stakeholder[];
2250
+ /**
2251
+ * The amount of this transaction that was, or will be, ordered
2252
+ */
2253
+ quantity?: number;
2254
+ printFileUrl1?: string;
2255
+ printFileUrl2?: string;
2256
+ printFileUrl3?: string;
2257
+ printFileUrl4?: string;
2258
+ printFileUrl5?: string;
2259
+ printFileName1?: string;
2260
+ printFileName2?: string;
2261
+ printFileName3?: string;
2262
+ printFileName4?: string;
2263
+ printFileName5?: string;
2264
+ /**
2265
+ * An array of objects containing information on additional products to add to the cart.
2266
+ * Typically only available when being passed to {@link DesignCreationMessage}
2267
+ */
2268
+ designExternalVariants?: DesignExternalVariant[];
2269
+ transactionShareActions?: TransactionShareAction[];
2270
+ }
2271
+ interface TransactionShareAction {
2272
+ id: string;
2273
+ title?: string;
2274
+ precedence?: number;
2275
+ stakeholderType?: string;
2276
+ url?: string;
2277
+ }
2278
+ /**
2279
+ * An object containing ids for an external product/variant that should be added to the cart alongside the base product/variant.
2280
+ */
2281
+ interface DesignExternalVariant {
2282
+ id?: string;
2283
+ externalProductId?: string;
2284
+ externalProductVariantId?: string;
2285
+ skuCode?: string;
2286
+ }
2287
+ /**
2288
+ * An integration product represents the connection of a product in SpiffCommerce with
2289
+ * a product on a third party platform.
2290
+ */
2291
+ interface IntegrationProductResource {
2292
+ /**
2293
+ * The ID of the IntegrationProduct entity. Used internally by SpiffCommerce.
2294
+ */
2295
+ id: string;
2296
+ /**
2297
+ * The ID of the product on the third party platform. For example a Shopify product ID.
2298
+ */
2299
+ externalProductId?: string;
2300
+ /**
2301
+ * The integration that this product is associated with. For example a Shopify integration.
2302
+ */
2303
+ integration?: Integration;
2304
+ /**
2305
+ * The ID of an additional product (on the third party platform) that should be added to the cart.
2306
+ */
2307
+ additionalExternalProductId?: string;
2308
+ /**
2309
+ * A supplementary ID for the additional product. Shopify uses the variant ids to add products to the cart.
2310
+ */
2311
+ additionalExternalVariantId?: string;
2312
+ /**
2313
+ * When the additionalExternalProductId is set, this is the IntegrationProduct that is associated with it.
2314
+ * If no Spiff product has been associated with the additionalExternalProductId, this will be null.
2315
+ */
2316
+ additionalIntegrationProduct?: IntegrationProductResource;
2317
+ /**
2318
+ * The product that this integration product is associated with.
2319
+ */
2320
+ product?: Product;
2321
+ }
2322
+ interface Integration {
2323
+ id: string;
2324
+ enabled: boolean;
2325
+ externalIntegrationId?: string;
2326
+ type?: IntegrationType;
2327
+ isCurrent?: boolean;
2328
+ theme: Theme;
2329
+ logo: string;
2330
+ partner: Partner;
2331
+ }
2332
+ declare enum IntegrationType {
2333
+ Hub = "Hub",
2334
+ Shopify = "Shopify"
2335
+ }
2336
+ /**
2337
+ * Fields found in a variant within a line item resource.
2338
+ */
2339
+ interface LineItemVariant {
2340
+ currencyCode: string;
2341
+ optionName: string;
2342
+ priceModifier: number;
2343
+ stepName: string;
2344
+ variantName: string;
2345
+ }
2346
+ interface LineItem {
2347
+ id: string;
2348
+ transactionId?: string;
2349
+ previewImageUrl?: string;
2350
+ product: Product;
2351
+ quantity: number;
2352
+ metadata?: LineItemMetadata[];
2353
+ variants: LineItemVariant[];
2354
+ }
2355
+ interface LineItemMetadata {
2356
+ stepName: string;
2357
+ metadata: string;
2358
+ }
2359
+ interface ProductWorkflow {
2360
+ friendlyName: string;
2361
+ id: string;
2362
+ index?: number;
2363
+ present?: boolean;
2364
+ imageUrl: string;
2365
+ workflowName: string;
2366
+ }
2367
+ interface Partner {
2368
+ id?: string;
2369
+ name?: string;
2370
+ currencyCode?: string;
2371
+ customerDetailsPromptMarkdown?: string;
2372
+ activeAddons?: AddonHandle[];
2373
+ }
2374
+ declare enum AddonHandle {
2375
+ BackgroundRemover = "BackgroundRemover",
2376
+ ConversionAccelerator = "Conversion Accelerator",
2377
+ ProcessBuilder = "ProcessBuilder"
2378
+ }
2379
+ interface Product {
2380
+ /**
2381
+ * ID of the partner owner.
2382
+ */
2383
+ partnerId?: string;
2384
+ partner?: Partner;
2385
+ /**
2386
+ * Whether a line item for this product is delivered as soon as the order is received.
2387
+ */
2388
+ autoprint: boolean;
2389
+ /**
2390
+ * Whether this product can be quickprinted.
2391
+ */
2392
+ canQuickprint?: boolean;
2393
+ /**
2394
+ * The internal identifier for this product.
2395
+ */
2396
+ id: string;
2397
+ /**
2398
+ * The human friendly name of the product.
2399
+ */
2400
+ name: string;
2401
+ /**
2402
+ * A description of the Product, written in Markdown.
2403
+ */
2404
+ description: string;
2405
+ /**
2406
+ * A URL to the image asset associated with this product.
2407
+ */
2408
+ imageUrl?: string;
2409
+ /**
2410
+ * A resource url for a 3D model used to represent this product
2411
+ * in the 3d editor. If not available we assume the product doesn't support 3D.
2412
+ */
2413
+ modelUrl?: string;
2414
+ /**
2415
+ * A URL for the image used as an overlay on any workflows
2416
+ * that incorporate a product overlay step.
2417
+ */
2418
+ overlayImageUrl?: string;
2419
+ /**
2420
+ * Words which can't be used in a workflow for this product.
2421
+ */
2422
+ profanities?: {
2423
+ id: string;
2424
+ createdAt: string;
2425
+ userId: string;
2426
+ word: string;
2427
+ }[];
2428
+ /**
2429
+ * The max characters that can be typed for quickprint.
2430
+ */
2431
+ quickprintMaxLength?: number;
2432
+ /**
2433
+ * The name of the module to use for quickprint.
2434
+ */
2435
+ quickprintModuleName?: string;
2436
+ /**
2437
+ * If true, the product should be displayed in the client as if it is available.
2438
+ * Should be displayed as if it is unavailable otherwise.
2439
+ */
2440
+ enabled: boolean;
2441
+ /**
2442
+ * Workflows which have been assigned to this product.
2443
+ */
2444
+ workflows?: ProductWorkflow[];
2445
+ /**
2446
+ * The base price of this product in sub units. Essentially the cost of the
2447
+ * product without any customisations applied.
2448
+ */
2449
+ basePrice?: number;
2450
+ /**
2451
+ * The weight of this product.
2452
+ */
2453
+ weight?: number;
2454
+ /**
2455
+ * When specified, represents a pre-rendered image of this product to be
2456
+ * displayed to customers while the 3D preview is loading.
2457
+ */
2458
+ preloadImageUrl?: string;
2459
+ /**
2460
+ * When set the store owner has configured this product to prompt for
2461
+ * customer details. In hosted experience, we'll offer to collect this information from the customer. In
2462
+ * bespoke UIs created using the Core SDK you will need to check this flag and request the data accordingly.
2463
+ * See attachCustomerDetails on the WorkflowExperience for how to supply us with the details you collect.
2464
+ */
2465
+ promptForCustomerDetails?: boolean;
2466
+ /**
2467
+ * Configuration for conversion. Optional.
2468
+ */
2469
+ conversionConfiguration?: ConversionConfiguration;
2470
+ integrationProducts?: IntegrationProductResource[];
2471
+ productTags?: ProductTag[];
2472
+ productImages?: ProductImage[];
2473
+ /**
2474
+ * The SKU of the product in the merchant's store.
2475
+ */
2476
+ sku?: string;
2477
+ /**
2478
+ * The Spiff SKU code for the product.
2479
+ */
2480
+ skuCode?: string;
2481
+ /**
2482
+ * Price breaks for this product when dealing with quantity.
2483
+ */
2484
+ priceBreaks?: ProductPriceBreak[];
2485
+ }
2486
+ interface ProductImage {
2487
+ id: string;
2488
+ precedence?: number;
2489
+ asset: Asset;
2490
+ }
2491
+ /**
2492
+ * A price break represents a minimum quantity of a product and the price that will be charged for that quantity.
2493
+ * This can be seen as an override for the base price of the product.
2494
+ */
2495
+ interface ProductPriceBreak {
2496
+ /**
2497
+ * The id of this price break.
2498
+ */
2499
+ id: string;
2500
+ /**
2501
+ * The minimum quantity of this price break. A positive integer.
2502
+ */
2503
+ minQty: number;
2504
+ /**
2505
+ * A percentage to apply to the overall price. A value between 0-1 where 1 retains 100% of the original price and 0 completely discounts it to free.
2506
+ */
2507
+ percentage: number;
2508
+ }
2509
+ interface ProductTag {
2510
+ id: string;
2511
+ name: string;
2512
+ }
2513
+ interface ColorOption {
2514
+ id?: string;
2515
+ fill?: string;
2516
+ stroke?: string;
2517
+ variant?: VariantResource;
2518
+ colorProfileAssetKey?: string;
2519
+ }
2520
+ interface RegionElement {
2521
+ id: string;
2522
+ region?: Region;
2523
+ }
2524
+ interface FrameMetadata {
2525
+ image: string;
2526
+ }
2527
+ interface IllustrationMetadata {
2528
+ colors: string[];
2529
+ }
2530
+ interface ModuleMetadata {
2531
+ text: string;
2532
+ }
2533
+ interface TextMetadata {
2534
+ color?: string;
2535
+ text: string;
2536
+ fillImage?: string;
2537
+ }
2538
+ interface SelectionStorage {
2539
+ selectedVariants?: VariantResource[];
2540
+ }
2541
+ interface TextStepStorage extends SelectionStorage {
2542
+ color?: string;
2543
+ defaultCleared?: boolean;
2544
+ inputText?: string;
2545
+ text?: string;
2546
+ customiseAllText?: boolean;
2547
+ }
2548
+ type StepSelections = {
2549
+ [key: string]: SelectionStorage;
2550
+ };
2551
+ interface FrameData {
2552
+ /**
2553
+ * The path data for a frame SVG
2554
+ */
2555
+ path: string;
2556
+ /**
2557
+ * The viewbox width
2558
+ */
2559
+ width: number;
2560
+ /**
2561
+ * The viewbox height.
2562
+ */
2563
+ height: number;
2564
+ }
2565
+ interface FrameThresholdSettings {
2566
+ useThreshold: boolean;
2567
+ invertThreshold: boolean;
2568
+ threshold: number;
2569
+ thresholdSaturation: number;
2570
+ }
2571
+ /**
2572
+ * Defines the different behaviors supported by the camera system
2573
+ * for control when viewing a product.
2574
+ */
2575
+ declare enum ProductCameraRig {
2576
+ Orbit = 0,
2577
+ Pan = 1
2578
+ }
2579
+ /**
2580
+ * Defines the locations at which a conversion attempt can take place.
2581
+ */
2582
+ declare enum ConversionLocation {
2583
+ /**
2584
+ * The client should expose a flow for allowing the user to optionally input details at any point.
2585
+ */
2586
+ Manual = "Manual",
2587
+ /**
2588
+ * The client should show the conversion flow at the beginning of a workflow.
2589
+ */
2590
+ OnStart = "OnStart",
2591
+ /**
2592
+ * The client should allow the user to input details just before quitting the experience.
2593
+ */
2594
+ OnQuit = "OnQuit",
2595
+ /**
2596
+ * The client should ask the user for details prior to adding to cart.
2597
+ */
2598
+ OnEnd = "OnEnd"
2599
+ }
2600
+ /**
2601
+ * The data configured to be requested.
2602
+ */
2603
+ declare enum ConversionDataType {
2604
+ Email = "Email",
2605
+ FirstName = "FirstName",
2606
+ LastName = "LastName",
2607
+ Phone = "Phone"
2608
+ }
2609
+ interface ConversionData {
2610
+ type: ConversionDataType;
2611
+ mandatory: boolean;
2612
+ }
2613
+ /**
2614
+ * The configuration for conversion, exposed on products currently.
2615
+ */
2616
+ interface ConversionConfiguration {
2617
+ id: string;
2618
+ name?: string;
2619
+ locations: ConversionLocation[];
2620
+ requestedData: ConversionDataType[];
2621
+ requestedDataItems: ConversionData[];
2622
+ mandatory?: boolean;
2623
+ }
2624
+ /**
2625
+ * Someone who has used a workflow experience and entered their contact details.
2626
+ */
2627
+ interface Customer {
2628
+ id?: string;
2629
+ emailAddress: string;
2630
+ firstName?: string;
2631
+ lastName?: string;
2632
+ phoneNumber?: string;
2633
+ loginToken?: string;
2634
+ partner?: Partner;
2635
+ stakeholders?: Stakeholder[];
2636
+ bundleStakeholders?: BundleStakeholder[];
2637
+ }
2638
+ interface CustomerDetailsInput {
2639
+ emailAddress: string;
2640
+ firstName?: string;
2641
+ lastName?: string;
2642
+ phoneNumber?: string;
2643
+ }
2644
+ declare enum StakeholderType {
2645
+ Owner = "Owner",
2646
+ Approver = "Approver",
2647
+ Editor = "Editor",
2648
+ Viewer = "Viewer"
2649
+ }
2650
+ interface Stakeholder {
2651
+ id: string;
2652
+ type?: StakeholderType;
2653
+ transaction?: Transaction;
2654
+ customer?: Customer;
2655
+ }
2656
+ interface Bundle {
2657
+ id?: string;
2658
+ bundleOwnerId?: string;
2659
+ bundleStakeholders?: BundleStakeholder[];
2660
+ bundleStateData?: string;
2661
+ metadata?: {
2662
+ key: string;
2663
+ value: string;
2664
+ }[];
2665
+ name?: string;
2666
+ partner?: Partner;
2667
+ productCollection?: ProductCollectionResource;
2668
+ transactions?: Transaction[];
2669
+ }
2670
+ interface BundleStakeholder {
2671
+ id: string;
2672
+ bundle?: Bundle;
2673
+ customer?: Customer;
2674
+ type?: StakeholderType;
2675
+ }
2676
+ interface BundleStakeholderInput {
2677
+ type: StakeholderType;
2678
+ customerDetails: CustomerDetailsInput;
2679
+ }
2680
+ type ProductCollectionResource = {
2681
+ id: string;
2682
+ globalPropertyConfiguration?: GlobalPropertyConfiguration;
2683
+ productCollectionProducts?: ProductCollectionProductResource[];
2684
+ name: string;
2685
+ transformCollection?: TransformCollection;
2686
+ };
2687
+ type ProductCollectionProductResource = {
2688
+ id: string;
2689
+ productCollection?: ProductCollectionResource;
2690
+ productCollectionId?: string;
2691
+ product: Product;
2692
+ productId: string;
2693
+ workflowId?: string;
2694
+ };
2695
+ type GlobalPropertyState = {
2696
+ id: string;
2697
+ aspects: GlobalPropertyStateAspect[];
2698
+ };
2699
+ type GlobalPropertyStateAspect = {
2700
+ name: string;
2701
+ value: string;
2702
+ type?: AspectType;
2703
+ storage?: GlobalPropertyStateAspectStorage;
2704
+ };
2705
+ type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage;
2706
+ type GlobalPropertyStateFileUploadStorage = {
2707
+ originalAssetKey?: string;
2708
+ backgroundRemovedAssetKey?: string;
2709
+ useOriginalAsset?: boolean;
2710
+ };
2711
+ interface BundleStateTransform {
2712
+ position: Vector3;
2713
+ rotation: Vector3;
2714
+ scale: Vector3;
2715
+ }
2716
+ interface Vector3 {
2717
+ x: number;
2718
+ y: number;
2719
+ z: number;
2720
+ }
2721
+ interface TransformCollection {
2722
+ id: string;
2723
+ name: string;
2724
+ transforms: TransformCollectionTransform[];
2725
+ }
2726
+ interface TransformCollectionTransform {
2727
+ id: string;
2728
+ name: string;
2729
+ position: Vector3;
2730
+ rotation: Vector3;
2731
+ scale: Vector3;
2732
+ }
2733
+ type Extendable<T> = T & {
2734
+ [key: string]: any;
2735
+ };
2736
+
2737
+ interface StorageService {
2738
+ /**
2739
+ * Get a value.
2740
+ * @param key The key to lookup the value with.
2741
+ */
2742
+ get(key: string): string | undefined;
2743
+ /**
2744
+ * Set a value.
2745
+ * @param key The key to set.
2746
+ * @param val The new value.
2747
+ */
2748
+ set(key: string, val: string): void;
2749
+ /**
2750
+ * Remove a value.
2751
+ * @param key The key to remove, does nothing if the key doesn't exist.
2752
+ */
2753
+ remove(key: string): void;
2754
+ /**
2755
+ * Get a map from persistence.
2756
+ * @param key The key to search by.
2757
+ */
2758
+ getMap<K = any, V = any>(key: string): Map<K, V> | undefined;
2759
+ /**
2760
+ * St a map into persistence.
2761
+ * @param key The key to set the map at.
2762
+ * @param val The map to set.
2763
+ */
2764
+ setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
2765
+ }
2766
+ declare const persistenceService: StorageService;
2767
+
2768
+ declare class Configuration {
2769
+ private readonly defaultServerUrl;
2770
+ private readonly defaultServicesApiUrl;
2771
+ private readonly defaultHubUrl;
2772
+ private serverUrl;
2773
+ private servicesApiUrl;
2774
+ private hubUrl;
2775
+ private serverUrlCallbacks;
2776
+ constructor();
2777
+ getServerUrl(): string;
2778
+ getServicesApiUrl(): string;
2779
+ getHubUrl(): string;
2780
+ setServerUrl(serverUrl: string): void;
2781
+ setServicesApiUrl(servicesApiUrl: string): void;
2782
+ setHubUrl(hubUrl: string): void;
2783
+ addServerUrlCallback(callback: () => void): void;
2784
+ }
2785
+ declare const spiffCoreConfiguration: Configuration;
2786
+
2787
+ type ToastCallback = (callbackOptions: {
2788
+ toastMessage: null | string;
2789
+ toastType: InformationMessageType | null;
2790
+ }) => void;
2791
+ declare class Toast {
2792
+ private latestToast;
2793
+ private toastType;
2794
+ private toastCallbacks;
2795
+ constructor();
2796
+ addToastCallback(callback: ToastCallback): void;
2797
+ removeToastCallback(callback: ToastCallback): void;
2798
+ setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
2799
+ private onToastChange;
2800
+ }
2801
+ declare const toast: Toast;
2802
+
2803
+ interface FrameCreateOpts {
2804
+ stepName?: string;
2805
+ frameData: FrameData;
2806
+ disablePlaceholder?: boolean;
2807
+ focalBlur?: boolean;
2808
+ focalBlurStrength?: number;
2809
+ focalBlurRadius?: number;
2810
+ pattern?: any;
2811
+ }
2812
+ declare class FrameStepService implements StepService<FrameStepData> {
2813
+ init(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2814
+ private reload;
2815
+ selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager, recalculateOffsets?: boolean): Promise<void>;
2816
+ selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
2817
+ getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): CreateElementCommand<FrameElement>;
2818
+ loadPatternFromString(src: string, frameService: FrameService, recalculateOffsets?: boolean, colors?: {
2819
+ [key: string]: ColorDefinition;
2820
+ } | undefined): Promise<void>;
2821
+ getPatternColors(stepData: Step<FrameStepData>, workflowManager: WorkflowManager): Promise<{
2822
+ [key: string]: ColorDefinition;
2823
+ }>;
2824
+ changeColors(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, newFills: Map<string, string>): Promise<void>;
2825
+ private selectVariantCommand;
2826
+ private frameSourceSvg;
2827
+ /**
2828
+ * Grab the source to be used for a frame from the variant or throw otherwise.
2829
+ */
2830
+ private patternSource;
2831
+ private loadPatternFromAsset;
2832
+ }
2833
+ declare const frameStepService: FrameStepService;
2834
+
2835
+ interface SVGCreateOpts {
2836
+ stepName?: string;
2837
+ src: string;
2838
+ objectURL: string;
2839
+ svg: {
2840
+ svg: string;
2841
+ colors: {
2842
+ [key: string]: ColorDefinition;
2843
+ };
2844
+ };
2845
+ }
2846
+ declare class IllustrationStepService implements StepService<IllustrationStepData> {
2847
+ getIllustrationBody(src: string): Promise<string>;
2848
+ getCreateElementCommand(id: string, region: Region, layout: ILayout, options: SVGCreateOpts): CreateElementCommand<IllustrationElement>;
2849
+ getColors(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager): never[] | {
2850
+ [key: string]: ColorDefinition;
2851
+ };
2852
+ init(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2853
+ private reload;
2854
+ availableColors(stepData: Step<IllustrationStepData>, _workflowManager: WorkflowManager): Promise<{
2855
+ fill: string | undefined;
2856
+ stroke: string | undefined;
2857
+ variant: VariantResource;
2858
+ }[] | undefined>;
2859
+ changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<CanvasCommand>;
2860
+ changeColors(stepData: Step<IllustrationStepData>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => LayoutData[], newFills: Map<string, string>): Promise<void>;
2861
+ selectVariant(stepData: Step<IllustrationStepData>, variant: VariantResource, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
2862
+ private selectVariantCommand;
2863
+ }
2864
+ declare const illustrationStepService: IllustrationStepService;
2865
+
2866
+ declare class MaterialStepService implements StepService<MaterialStepData> {
2867
+ init(stepData: Step<MaterialStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<null | CommandWithFollowup>;
2868
+ private reload;
2869
+ selectVariant(step: Step<MaterialStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
2870
+ private selectVariantLambda;
2871
+ }
2872
+ declare const materialStepService: MaterialStepService;
2873
+
2874
+ declare class ModelStepService implements StepService<ModelStepData> {
2875
+ init(stepData: Step<ModelStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2876
+ private reload;
2877
+ selectVariant(step: Step<ModelStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): Promise<void>;
2878
+ private selectVariantLambda;
2879
+ }
2880
+ declare const modelStepService: ModelStepService;
2881
+
2882
+ interface TextFillSpotColor {
2883
+ profileName: string;
2884
+ namedColor: string;
2885
+ }
2886
+ interface TextUpdateResult {
2887
+ command?: GroupCommand;
2888
+ helperText: string;
2889
+ errors: TextError[];
2890
+ }
2891
+ interface TextError {
2892
+ localizationKey: string;
2893
+ }
2894
+ declare class TextStepService implements StepService<TextStepData> {
2895
+ private cachedColors;
2896
+ init(stepData: Step<TextStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2897
+ findLayoutElements(workflowManager: WorkflowManager, step: Step<TextStepData>): TextboxElement[];
2898
+ /**
2899
+ * Get the colors that can be used for a given text step.
2900
+ * @param stepData The text step to get colors for.
2901
+ * @returns A list of color objects containg fill, stroke and variant if available.
2902
+ */
2903
+ availableFillColors(stepData: Step<TextStepData>): ColorOption[];
2904
+ changeAlignment(stepData: Step<TextStepData>, alignment: "left" | "center" | "right", elements: RegionElement[], workflowManager: WorkflowManager): void;
2905
+ changeFillColor(stepData: Step<TextStepData>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2906
+ availableFillImages(stepData: Step<TextStepData>): Promise<TextFillImage[]>;
2907
+ changeFillImage(stepData: Step<TextStepData>, fillImage: TextFillImage, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2908
+ /**
2909
+ * Given an element and a string, filters any characters from the string that are
2910
+ * not supported by the font of the given element.
2911
+ * @param text The text string to filter.
2912
+ * @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.
2913
+ * @returns A new string representing the passed string with unsupported characters removed.
2914
+ */
2915
+ filterUnsupportedCharacters: (text: string, fontData?: FontData) => string;
2916
+ getProcessedInput(input: string, stepData: TextStepData, customiseAllText: boolean): string;
2917
+ updateInputText(input: string, elements: TextboxElement[], step: Step<TextStepData>, workflowManager: WorkflowManager): TextUpdateResult;
2918
+ selectVariant(step: Step<TextStepData>, variant: VariantResource, workflowManager: WorkflowManager, setError: (status: boolean) => void, setHelperText: (text: string) => void): Promise<void>;
2919
+ textAlign: (stepData: TextStepData) => string;
2920
+ createTextFillSpotColor(colorOption: OptionResource, variant: VariantResource): TextFillSpotColor | undefined;
2921
+ private reload;
2922
+ private getDefaultColorVariant;
2923
+ private getDefaultColor;
2924
+ private getDefaultImageFillVariant;
2925
+ /**
2926
+ * Validates a string of text based on step confoiguration.
2927
+ * @param text The text to validate
2928
+ * @param step The step providing configuration
2929
+ * @param workflowManager Workflow manager for access to workflow state
2930
+ * @returns A list of errors. Empty if the text passes validation.
2931
+ */
2932
+ private getErrorsForText;
2933
+ private fontDataFromVariant;
2934
+ private selectVariantCommand;
2935
+ /**
2936
+ * When a text step specifies replaceable text, the text input by the user will replace
2937
+ * a specific token within a larger string of text specified in the step configuration. Otherwise
2938
+ * this function will just return the text it's given when the feature is disabled.
2939
+ */
2940
+ private injectReplaceableText;
2941
+ private createTextboxRegions;
2942
+ private generateTextChangeCommandsForRegion;
2943
+ /**
2944
+ * @deprecated
2945
+ */
2946
+ private changeInputTextWithRegion;
2947
+ }
2948
+ declare const textStepService: TextStepService;
2949
+
2950
+ declare class PictureStepService implements StepService<PictureStepData> {
2951
+ init(stepData: Step<PictureStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2952
+ private reload;
2953
+ selectVariant(stepData: Step<PictureStepData>, variant: VariantResource, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): Promise<void>;
2954
+ private selectVariantCommand;
2955
+ }
2956
+ declare const pictureStepService: PictureStepService;
2957
+
2958
+ declare class QuestionStepService implements StepService<QuestionStepData> {
2959
+ init(stepData: Step<QuestionStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2960
+ private reload;
2961
+ selectVariant(stepData: Step<QuestionStepData>, variantId: string, workflowManager: WorkflowManager): Promise<void>;
2962
+ private selectVariantLambda;
2963
+ }
2964
+ declare const questionStepService: QuestionStepService;
2965
+
2966
+ declare class ShapeStepService implements StepService<ShapeStepData> {
2967
+ readonly shapeFillId = "spiff-fill-shape";
2968
+ availableColours(stepData: Step<ShapeStepData>): Promise<{
2969
+ fill: string | undefined;
2970
+ stroke: string | undefined;
2971
+ variant: VariantResource;
2972
+ }[]>;
2973
+ setCustomColor(color: string, stepData: Step<ShapeStepData>, manager: WorkflowManager): void;
2974
+ init(stepData: Step<ShapeStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2975
+ selectVariant(stepData: Step<ShapeStepData>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
2976
+ private reload;
2977
+ private selectVariantCommand;
2978
+ }
2979
+ declare const shapeStepService: ShapeStepService;
2980
+
2981
+ declare class ModuleStepService implements StepService<ModuleStepData> {
2982
+ init(stepData: Step<ModuleStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2983
+ private reload;
2984
+ changeText(stepData: Step<ModuleStepData>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): Promise<void>;
2985
+ private changeTextCommand;
2986
+ private validateInput;
2987
+ }
2988
+ declare const moduleStepService: ModuleStepService;
2989
+
2990
+ declare class DigitalContentStepService implements StepService<DigitalContentStepData> {
2991
+ init(stepData: Step<DigitalContentStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
2992
+ private reload;
2993
+ 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>;
2994
+ private regionElements;
2995
+ private command;
2996
+ }
2997
+ declare const digitalContentStepService: DigitalContentStepService;
2998
+
2999
+ declare class MockWorkflowManager implements WorkflowManager {
3000
+ private client;
3001
+ getClient(): SpiffCommerceClient;
3002
+ setClient(client: SpiffCommerceClient): void;
3003
+ getInitializationPromise(): Promise<void>;
3004
+ getProduct: () => Product;
3005
+ isInitialized(): boolean;
3006
+ getCommandContext: () => CommandContext;
3007
+ getAllLayoutData: () => LayoutState[];
3008
+ getMetadata: (stepName: string) => StepMetadata | undefined;
3009
+ getWorkflowMetadata: () => WorkflowMetadata;
3010
+ getStepStorage: (stepName: string) => StepStorage | undefined;
3011
+ getInformationResults(): InformationResult[];
3012
+ reset(): Promise<void>;
3013
+ updateStateWithServer(_getReducerState: () => CommandState): void;
3014
+ outstandingRequestsPromise(): Promise<void>;
3015
+ updateStateWithServerImmediate(_getReducerState: () => CommandState): Promise<void>;
3016
+ addPoller(_poller: Poller): void;
3017
+ addConfirmCallback(_callback: ConfirmCallback): void;
3018
+ addEditedCallback(_callback: EditedCallback): void;
3019
+ addElementsCallback(_callback: ElementsCallback): void;
3020
+ addInformationResultCallback(_callback: InformationResultCallback): void;
3021
+ addInitCallback(_callback: InitCallback): void;
3022
+ addMakingAdjustmentsCallback(_callback: MakingAdjustmentsCallback): void;
3023
+ addMandatoryCallback(_callback: MandatoryCallback): void;
3024
+ addMetadataCallback(_callback: MetadataCallback): void;
3025
+ addSelectionCallback(_callback: SelectionCallback): void;
3026
+ addStepSpecificStorageCallback(_callback: StepSpecificStorageCallback, _stepName: string): void;
3027
+ addStorageCallback(_callback: StorageCallback): void;
3028
+ getCommandDispatcher(): (_command: CanvasCommand) => void;
3029
+ getLayouts(): never[];
3030
+ getLayoutPreviewService(): any;
3031
+ getPreviewService(): undefined;
3032
+ setModelContainer: (container: any) => void;
3033
+ getModelContainer(): undefined;
3034
+ getProfanities(): never[];
3035
+ getRegionElements(_stepName: string): never[];
3036
+ getSerializedStep(_stepName: string, _serializedSteps: SerializableStep[]): undefined;
3037
+ getStepSpecificServices(_stepName: string): undefined;
3038
+ getTransaction(): {
3039
+ id: string;
3040
+ };
3041
+ getTransactionCustomer(): undefined;
3042
+ setTransactionCustomer(): void;
3043
+ setTransactionCustomerDetails(): void;
3044
+ getWorkflow(): {
3045
+ id: string;
3046
+ name: string;
3047
+ panels: never[];
3048
+ steps: never[];
3049
+ showModelOnFinishStep: boolean;
3050
+ allowProofDownload: boolean;
3051
+ introduction: string;
3052
+ stepGroups: never[];
3053
+ };
3054
+ markStepsAsInitialised(_stepNames: string[]): void;
3055
+ getUpdatesPending: () => boolean;
3056
+ markUpdateCompleted(_update: string): void;
3057
+ markUpdatePending(): string;
3058
+ getWorkflowSelections(): {};
3059
+ setCurrentAdjustingStepId(_stepId: string): void;
3060
+ setEditedStatus(_stepName: string, _status: boolean): void;
3061
+ setInformationResults(_results: InformationResult[]): void;
3062
+ setMandatoryFulfilled(_stepName: string, _status: boolean): void;
3063
+ setSelectionsAndElements(_stepName: string, _variants: VariantResource[], _elements: RegionElement[]): Promise<void>;
3064
+ toggleDesignConfirmed(): void;
3065
+ updateMetadata(_stepName: string, _update: any): void;
3066
+ updateStorage(_stepName: string, _update: StepStorage): Promise<void>;
3067
+ injectIntoPreviewService(_previewService: any): Promise<void>;
3068
+ ejectFromPreviewService(): void;
3069
+ setWorkflowStateSyncEnabled(_enabled: boolean): void;
3070
+ updateTransactionShareActions(): Promise<void>;
3071
+ }
3072
+
3073
+ declare const generateCommands: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<CanvasCommand[]>;
3074
+
3075
+ declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
3076
+ constructor(manager: WorkflowManager, step: Step<IllustrationStepData>);
3077
+ /**
3078
+ * Allows for select a vector from the available vectors configured on this steps base option.
3079
+ * @param variant The new vector variant to use for this step.
3080
+ * @returns A promise that can be awaited to know when the new vector asset has been updated on the design.
3081
+ */
3082
+ selectVariant(variant: Variant): Promise<void>;
3083
+ /**
3084
+ * Get colors for the illustration.
3085
+ * @returns A list of color definitions that are currently applied to the illustration.
3086
+ */
3087
+ getColors(): {
3088
+ [key: string]: _spiffcommerce_papyrus.ColorDefinition;
3089
+ } | undefined;
3090
+ /**
3091
+ * Set color for the illustration.
3092
+ */
3093
+ setColor(key: string, value: string): Promise<void>;
3094
+ getColorOption(): Promise<_spiffcommerce_papyrus.OptionResource | undefined>;
3095
+ getAvailableColors(): Promise<{
3096
+ fill: string | undefined;
3097
+ stroke: string | undefined;
3098
+ variant: _spiffcommerce_papyrus.VariantResource;
3099
+ }[] | undefined>;
3100
+ isColorPickerEnabled(): boolean | undefined;
3101
+ }
3102
+
3103
+ interface TextChangeResult {
3104
+ input: string;
3105
+ helperText?: string;
3106
+ errorText?: string;
3107
+ }
3108
+ declare class TextStepHandle extends StepHandle<TextStepData> {
3109
+ constructor(manager: WorkflowManager, step: Step<TextStepData>);
3110
+ /**
3111
+ * Allows for select a font from the available fonts configured on this steps base option.
3112
+ * @param variant The font variant to use.
3113
+ */
3114
+ selectVariant(variant: Variant): Promise<void>;
3115
+ /**
3116
+ * @returns A list of colors that can be used to fill the text.
3117
+ */
3118
+ getAvailableFillColors(): ColorOption[];
3119
+ /**
3120
+ * Changes the fill of text related to this step to the new fill value.
3121
+ * @param fill A new fill value to use.
3122
+ */
3123
+ setFillColor(fill: ColorOption): Promise<void>;
3124
+ /**
3125
+ * Gets the color currently applied to the element.
3126
+ */
3127
+ getFillColor(): string;
3128
+ getAvailableFillImages(): Promise<TextFillImage[]>;
3129
+ setFillImage(fillImage: TextFillImage): Promise<void>;
3130
+ getFillImage(): TextFillImage | undefined;
3131
+ getAlignment(): string | undefined;
3132
+ setAlignment(alignment: "left" | "center" | "right"): void;
3133
+ /**
3134
+ * When true & the step has replaceable text configured the user will be
3135
+ * abled to edit the entire text string including the non-replaceable text.
3136
+ * @param shouldCustomizeAll When true the user can configure the entire text string.
3137
+ */
3138
+ setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
3139
+ /**
3140
+ * Changes the text value of text related to this step to a new value.
3141
+ * @param userInput Input from the user.
3142
+ */
3143
+ setText(userInput: string): TextChangeResult;
3144
+ /**
3145
+ * Gets the text currently applied to the elements of this step.
3146
+ */
3147
+ getText(): string;
3148
+ isReplaceable(): boolean | undefined;
3149
+ /**
3150
+ * Inform the step that now is the time to
3151
+ * clear default text if it should do so.
3152
+ * Returns a text change rwsult if a clear occurred.
3153
+ */
3154
+ clearDefaultTextIfNecessary(): TextChangeResult | undefined;
3155
+ hasColorPicker(): boolean | undefined;
3156
+ getRegions(): _spiffcommerce_papyrus.Region[];
3157
+ /**
3158
+ * Return the maximum characters allowed for
3159
+ * this step, or undefined if there is no limit.
3160
+ */
3161
+ getCharacterLimit(): number | undefined;
3162
+ /**
3163
+ * Return the remaining amount of characters that
3164
+ * the user is allowed to add, or undefined if there is no limit.
3165
+ */
3166
+ getCharactersRemaining(): number | undefined;
3167
+ }
3168
+
3169
+ declare class PictureStepHandle extends StepHandle<PictureStepData> {
3170
+ constructor(manager: WorkflowManager, step: Step<PictureStepData>);
3171
+ /**
3172
+ * Allows the user to select an image variant from the available variants configured on this steps base option.
3173
+ * @param variant The new image variant to use.
3174
+ * @returns A promise that can be awaited to ensure the new image asset has been updated on the design.
3175
+ */
3176
+ selectVariant(variant: Variant): Promise<void>;
3177
+ }
3178
+
3179
+ /**
3180
+ * A generic base class for custom errors that assigns the name
3181
+ * of the error class automatically. All custom errors should extend this.
3182
+ */
3183
+ declare abstract class CustomError extends Error {
3184
+ constructor(message: any);
3185
+ }
3186
+ /**
3187
+ * A custom class for categorising errors related to workflow configuration.
3188
+ */
3189
+ declare abstract class ConfigurationError extends CustomError {
3190
+ constructor(message: any);
3191
+ }
3192
+ /**
3193
+ * Thrown when an option was expected but not found in the workflow configuration or
3194
+ * the server returned a 404 for an option we expected.
3195
+ */
3196
+ declare class OptionNotFoundError extends ConfigurationError {
3197
+ readonly optionId: string;
3198
+ constructor(step: Step<AnyStepData>);
3199
+ }
3200
+ /**
3201
+ * Thrown when a layout is not found for a given region entity. This
3202
+ * can occur when panels are deleted from a workflow but steps are still relying
3203
+ * on the layout being present.
3204
+ */
3205
+ declare class LayoutNotFoundError extends ConfigurationError {
3206
+ readonly panelId: string;
3207
+ constructor(region: Region);
3208
+ }
3209
+ /**
3210
+ * Thrown when an asset is not found on a specific variant. This can occur when
3211
+ * the asset wasn't configured in hub and the variant is loaded in a workflow.
3212
+ */
3213
+ declare class AssetNotFoundError extends ConfigurationError {
3214
+ readonly variant: VariantResource;
3215
+ constructor(variant: VariantResource);
3216
+ }
3217
+ /**
3218
+ * Thrown when a resource is not found linked to a specific asset. This
3219
+ * can occur when generation of a resource fails or hasn't completed. Or may be
3220
+ * a sign of a misconfiguration.
3221
+ */
3222
+ declare class ResourceNotFoundError extends ConfigurationError {
3223
+ readonly asset: Asset;
3224
+ constructor(asset: Asset);
3225
+ }
3226
+ /**
3227
+ * Thrown when configuration is missing when it was expected. More generic
3228
+ * to cover remaining cases outside of the more specific ones such as options, variants & assets.
3229
+ */
3230
+ declare class MisconfigurationError extends ConfigurationError {
3231
+ readonly step: Step<AnyStepData>;
3232
+ constructor(step: Step<AnyStepData>, message: string);
3233
+ }
3234
+ /**
3235
+ * A custom class for categorising errors related to implementation of core.
3236
+ */
3237
+ declare abstract class ImplementationError extends CustomError {
3238
+ constructor(message: any);
3239
+ }
3240
+ /**
3241
+ * Thrown when we hit a case that we didn't expect to happen
3242
+ */
3243
+ declare class UnhandledBehaviorError extends ImplementationError {
3244
+ constructor(message: string);
3245
+ }
3246
+ /**
3247
+ * Thrown when we fail to parse something that we expected to be valid
3248
+ */
3249
+ declare class ParseError extends ImplementationError {
3250
+ constructor(message: string);
3251
+ }
3252
+
3253
+ declare class ModelStepHandle extends StepHandle<ModelStepData> {
3254
+ constructor(manager: WorkflowManager, step: Step<ModelStepData>);
3255
+ selectVariant(variant: Variant): Promise<void>;
3256
+ }
3257
+
3258
+ declare enum FrameStep {
3259
+ SelectFrame = "SelectFrame",
3260
+ SelectImage = "SelectImage",
3261
+ Position = "Position"
3262
+ }
3263
+ declare class FrameStepHandle extends StepHandle<FrameStepData> {
3264
+ constructor(manager: WorkflowManager, step: Step<FrameStepData>);
3265
+ private frameService;
3266
+ selectVariant(variant: Variant): Promise<void>;
3267
+ onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
3268
+ /**
3269
+ * Updates the image selection inside the frame.
3270
+ * @param asset The asset to use.
3271
+ * @param storeAsOriginal Optional: Store this asset as the original, unmodified version of the image. Default: `true`.
3272
+ * @param [recalculateOffsets=true] Optional: Recalculates the offsets of the image inside the frame. Default: `true`.
3273
+ */
3274
+ selectImage(asset: Asset, storeAsOriginal?: boolean, recalculateOffsets?: boolean): Promise<void>;
3275
+ canUseBackgroundRemover(): Promise<boolean>;
3276
+ /**
3277
+ * Removes the background from an image, stores it in the state, and returns the new asset.
3278
+ * @param applyNewAsset Optionally applies the new asset as the current image selection. Default: `true`.
3279
+ * @returns A promise that resolves with the newly generated Asset.
3280
+ */
3281
+ removeBackgroundFromImageSelection(applyNewAsset?: boolean): Promise<Asset>;
3282
+ getImageData(): PatternImageData | undefined;
3283
+ getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
3284
+ getFrameService(): FrameService | undefined;
3285
+ hasOverlayImageKey(): string | undefined;
3286
+ hasOverlayImageUrl(): any;
3287
+ getOriginalImageSelection(): Promise<Asset | undefined>;
3288
+ getBackgroundRemovedImageSelection(): Promise<Asset | undefined>;
3289
+ hasBackgroundRemovedImageSelection(): boolean;
3290
+ getUseOriginalImageSelection(): boolean;
3291
+ setUseOriginalImageSelection(value: boolean): Promise<void>;
3292
+ private getFrameStepStorage;
3293
+ }
3294
+
3295
+ declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
3296
+ constructor(manager: WorkflowManager, step: Step<MaterialStepData>);
3297
+ selectVariant(variant: Variant): Promise<void>;
3298
+ }
3299
+
3300
+ declare class QuestionStepHandle extends StepHandle<QuestionStepData> {
3301
+ constructor(manager: WorkflowManager, step: Step<QuestionStepData>);
3302
+ selectVariant(variant: Variant): Promise<void>;
3303
+ /**
3304
+ * The way that this step expects to be rendered.
3305
+ */
3306
+ getDisplayType(): any;
3307
+ }
3308
+
3309
+ declare class ShapeStepHandle extends StepHandle<ShapeStepData> {
3310
+ constructor(manager: WorkflowManager, step: Step<ShapeStepData>);
3311
+ selectVariant(variant: Variant): Promise<void>;
3312
+ /**
3313
+ * Sets the color of the shape.
3314
+ * @param color The color option to use.
3315
+ * @returns A promise resolving when the color has changed in the design.
3316
+ * @deprecated The shape step can now pass through colors returned by getColors via selectVariant. Please swap setColor for selectVariant.
3317
+ */
3318
+ setColor(color: ColorOption): Promise<void>;
3319
+ /**
3320
+ * Get available colors for the shape.
3321
+ * @returns A list of color definitions that are currently applied to the illustration.
3322
+ */
3323
+ getColors(): Promise<{
3324
+ fill: string | undefined;
3325
+ stroke: string | undefined;
3326
+ variant: _spiffcommerce_papyrus.VariantResource;
3327
+ }[]>;
3328
+ /**
3329
+ * Allows for setting a custom color when the custom variant is selected. Will
3330
+ * throw when a non-custom variant is selected.
3331
+ */
3332
+ setCustomColor(color: string): void;
3333
+ getCustomColor(): string;
3334
+ }
3335
+
3336
+ declare const shortenUrl: (longUrl: string) => Promise<string>;
3337
+
3338
+ declare class InformationStepHandle extends StepHandle<InformationStepData> {
3339
+ constructor(manager: WorkflowManager, step: Step<InformationStepData>);
3340
+ selectVariant(): Promise<void>;
3341
+ /**
3342
+ * The way that this step expects to be rendered.
3343
+ */
3344
+ getContent(): string;
3345
+ }
3346
+
3347
+ /**
3348
+ * A simple cache for promises. Helpful to avoid making multiple requests for the same data.
3349
+ */
3350
+ declare class PromiseCache {
3351
+ private cache;
3352
+ private disabled;
3353
+ /**
3354
+ * Gets a promise from the cache, or undefined if it doesn't exist.
3355
+ */
3356
+ get(key: object): Promise<any> | undefined;
3357
+ /**
3358
+ * Sets a promise in the cache and returns it.
3359
+ */
3360
+ set(key: object, promise: Promise<any>): Promise<any>;
3361
+ /**
3362
+ * Some environments don't want workflows to be cached. An example is a server
3363
+ * that doesn't launch a fresh instance per request. This method allows disabling
3364
+ * caching in a transparent way.
3365
+ */
3366
+ disable(value: boolean): void;
3367
+ }
3368
+ declare const promiseCache: PromiseCache;
3369
+
3370
+ export { AddonHandle, ArrayInput, AssetNotFoundError, Bundle$1 as Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CollectionProduct, ColorOption, ColorOptionGlobalPropertyHandle, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow$1 as ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, ToastCallback, Transaction, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, setBearerAuthenticationToken, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };