@spiffcommerce/core 23.0.5 → 24.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,35 +1,10 @@
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, svgToDataUrl } from '@spiffcommerce/papyrus';
4
- import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
1
+ import { FunctionComponent, ReactNode } from 'preact/compat';
2
+ import { MutationOptions, FetchResult, ApolloClient } from '@apollo/client/core';
5
3
  import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
6
4
  import * as lodash from 'lodash';
7
5
  import { ThemeInstallConfigurationGraphQl } from '@spiffcommerce/theme-bridge';
8
6
  import { FuseResult } from 'fuse.js';
9
-
10
- declare class OptionService {
11
- /**
12
- * Allows for retrieving an option, returns the option from a cache if possible.
13
- * @param id The option ID to be retrieved.
14
- */
15
- getOption(id: string): Promise<undefined | OptionResource>;
16
- getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
17
- getDefaultVariant(option: OptionResource): VariantResource | undefined;
18
- /**
19
- * Returns the first variant marked as selected. This is used by most steps.
20
- */
21
- getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
22
- }
23
- declare const optionService: OptionService;
24
-
25
- declare const setBearerAuthenticationToken: (token: string) => void;
26
- declare class GraphQlManager {
27
- private shadowGraphqlClient;
28
- constructor();
29
- getShadowGraphqlClient(): ApolloClient<any>;
30
- private constructShadowGraphqlClient;
31
- }
32
- declare const graphQlManager: GraphQlManager;
7
+ import { Font } from 'opentype.js';
33
8
 
34
9
  /**
35
10
  * A renderable scene is a scene that can be displayed to the user. This is based on the workflow state.
@@ -148,6 +123,7 @@ declare class FrameService {
148
123
  private offsets;
149
124
  private thresholdSettings;
150
125
  private forceImageCover?;
126
+ private initialZoom?;
151
127
  private targetElements;
152
128
  private imageData?;
153
129
  private frameData?;
@@ -164,7 +140,7 @@ declare class FrameService {
164
140
  private onZoomChangeListeners;
165
141
  private workflowManager?;
166
142
  private stepName?;
167
- constructor(forceImageCover?: boolean);
143
+ constructor(forceImageCover?: boolean, initialZoom?: number);
168
144
  /**
169
145
  * When we want to connect a workflow manager to the state of the image cropper we
170
146
  * can pass it to this function. Inside we'll attach any required event listeners.
@@ -297,6 +273,348 @@ interface DesignInputStep {
297
273
  interface DesignInputStepData {
298
274
  }
299
275
 
276
+ interface SVGLayoutProps {
277
+ configuration: RenderingConfiguration;
278
+ preserveAspectRatio?: string;
279
+ outlineArea?: {
280
+ x?: number;
281
+ y?: number;
282
+ width?: number;
283
+ height?: number;
284
+ scale?: number;
285
+ hidden?: boolean;
286
+ };
287
+ viewBox?: {
288
+ x: number;
289
+ y: number;
290
+ width: number;
291
+ height: number;
292
+ };
293
+ width: number | string;
294
+ height: number | string;
295
+ position?: string;
296
+ maxWidth?: string;
297
+ maxHeight?: string;
298
+ elements: LayoutElement[];
299
+ backgroundColor?: string;
300
+ outlineColor?: string;
301
+ omitBoundClipping?: boolean;
302
+ borderRadius?: number;
303
+ }
304
+
305
+ /**
306
+ * An abstract base class from which to extend all potential element commands. These commands
307
+ * follow the command design pattern in software development. To learn more about this pattern
308
+ * take a look at the following link.
309
+ *
310
+ * https://sourcemaking.com/design_patterns/command
311
+ *
312
+ */
313
+ declare abstract class CanvasCommand {
314
+ abstract apply(state: LayoutsState): LayoutsState;
315
+ varying?: boolean;
316
+ protected oldState?: LayoutsState;
317
+ undo(): LayoutsState;
318
+ overrideOldState(state: LayoutsState): void;
319
+ sequenceId?: string;
320
+ }
321
+ /**
322
+ * Shifts an element with given ID from its current position to a new position.
323
+ */
324
+ declare class MoveCommand extends CanvasCommand {
325
+ private id;
326
+ private x;
327
+ private y;
328
+ constructor(id: string, x: number, y: number);
329
+ apply(state: LayoutsState): {
330
+ layouts: {
331
+ [x: string]: LayoutState;
332
+ };
333
+ serializableWorkflow: SerializableWorkflow;
334
+ };
335
+ }
336
+ /**
337
+ * Rotates an element to a given angle in degrees.
338
+ */
339
+ declare class RotateCommand extends CanvasCommand {
340
+ private id;
341
+ private angle;
342
+ constructor(id: string, angle: number);
343
+ apply(state: LayoutsState): {
344
+ layouts: {
345
+ [x: string]: LayoutState;
346
+ };
347
+ serializableWorkflow: SerializableWorkflow;
348
+ };
349
+ }
350
+ /**
351
+ * Updates the width and height of an element to reflect a new size. Negative values will be
352
+ * converted to their absolute value. ie. -10 will become 10.
353
+ */
354
+ declare class ResizeCommand extends CanvasCommand {
355
+ private id;
356
+ private width;
357
+ private height;
358
+ constructor(id: string, width: number, height: number);
359
+ apply(state: LayoutsState): {
360
+ layouts: {
361
+ [x: string]: LayoutState;
362
+ };
363
+ serializableWorkflow: SerializableWorkflow;
364
+ };
365
+ }
366
+ /**
367
+ * Applys a list of command objects to the current state, the final state
368
+ * will be that of all commands applied in the order of left to right.
369
+ */
370
+ declare class GroupCommand extends CanvasCommand {
371
+ private commands;
372
+ constructor(commands: CanvasCommand[]);
373
+ apply(state: LayoutsState): LayoutsState;
374
+ }
375
+ declare class CreateLayoutCommand extends CanvasCommand {
376
+ private layout;
377
+ constructor(layout: ILayout);
378
+ apply(state: LayoutsState): LayoutsState;
379
+ }
380
+ /**
381
+ * Add an element to the canvas
382
+ */
383
+ declare class CreateElementCommand<T extends LayoutElement> extends CanvasCommand {
384
+ private element;
385
+ private layout;
386
+ /**
387
+ * @param initialParams The initial parameters to be set on this new object
388
+ * @param callback An optional callback function to be notified when the object has been instantiated
389
+ * @param layout
390
+ */
391
+ constructor(element: T, layout: ILayout);
392
+ apply(state: LayoutsState): {
393
+ layouts: {
394
+ [x: string]: LayoutState | {
395
+ elements: LayoutElement[];
396
+ modificationID: string;
397
+ layout: ILayout;
398
+ };
399
+ };
400
+ serializableWorkflow: SerializableWorkflow;
401
+ };
402
+ private assignIndex;
403
+ }
404
+ /**
405
+ * Delete an element on the canvas
406
+ */
407
+ declare class DeleteElementCommand extends CanvasCommand {
408
+ private id;
409
+ constructor(id: string);
410
+ apply(state: LayoutsState): {
411
+ layouts: {
412
+ [key: string]: LayoutState;
413
+ };
414
+ serializableWorkflow: SerializableWorkflow;
415
+ };
416
+ }
417
+ declare class FontColorCommand extends CanvasCommand {
418
+ private id;
419
+ private color;
420
+ private textFillSpotColor?;
421
+ constructor(id: string, color: string, textFillSpotColor?: TextFillSpotColor$1);
422
+ apply(state: LayoutsState): {
423
+ layouts: {
424
+ [x: string]: LayoutState;
425
+ };
426
+ serializableWorkflow: SerializableWorkflow;
427
+ };
428
+ }
429
+ declare class FontSizeCommand extends CanvasCommand {
430
+ private id;
431
+ private size;
432
+ constructor(id: string, size: number);
433
+ apply(state: LayoutsState): {
434
+ layouts: {
435
+ [x: string]: LayoutState;
436
+ };
437
+ serializableWorkflow: SerializableWorkflow;
438
+ };
439
+ }
440
+ declare class FontSourceCommand extends CanvasCommand {
441
+ private id;
442
+ private fontData;
443
+ constructor(id: string, fontData: FontData);
444
+ apply(state: LayoutsState): {
445
+ layouts: {
446
+ [x: string]: LayoutState;
447
+ };
448
+ serializableWorkflow: SerializableWorkflow;
449
+ };
450
+ }
451
+ declare class FontAlignmentCommand extends CanvasCommand {
452
+ private id;
453
+ private align;
454
+ constructor(id: string, align: "left" | "center" | "right");
455
+ apply(state: LayoutsState): {
456
+ layouts: {
457
+ [x: string]: LayoutState;
458
+ };
459
+ serializableWorkflow: SerializableWorkflow;
460
+ };
461
+ }
462
+ declare class UpdateImageSourceCommand extends CanvasCommand {
463
+ private id;
464
+ private src;
465
+ constructor(id: string, src: string);
466
+ apply(state: LayoutsState): LayoutsState;
467
+ }
468
+ /**
469
+ * TextChange will modify the text displayed in a text box
470
+ */
471
+ declare class TextChangeCommand extends CanvasCommand {
472
+ private id;
473
+ private text;
474
+ constructor(id: string, text: string);
475
+ apply(state: LayoutsState): {
476
+ layouts: {
477
+ [x: string]: LayoutState;
478
+ };
479
+ serializableWorkflow: SerializableWorkflow;
480
+ };
481
+ }
482
+ declare class BringToFrontCommand extends CanvasCommand {
483
+ private id;
484
+ /**
485
+ * @param id The targeted element to bring to the front.
486
+ */
487
+ constructor(id: string);
488
+ apply(state: LayoutsState): {
489
+ layouts: {
490
+ [x: string]: LayoutState | {
491
+ elements: LayoutElement[];
492
+ modificationID: string;
493
+ layout: ILayout;
494
+ };
495
+ };
496
+ serializableWorkflow: SerializableWorkflow;
497
+ };
498
+ }
499
+ declare class BringToBackCommand extends CanvasCommand {
500
+ private id;
501
+ /**
502
+ * @param id The targeted element to bring to the back.
503
+ */
504
+ constructor(id: string);
505
+ apply(state: LayoutsState): {
506
+ layouts: {
507
+ [x: string]: LayoutState | {
508
+ elements: LayoutElement[];
509
+ modificationID: string;
510
+ layout: ILayout;
511
+ };
512
+ };
513
+ serializableWorkflow: SerializableWorkflow;
514
+ };
515
+ }
516
+ /**
517
+ * Bring an element forward by one layer. Does nothing if the element is already at the front.
518
+ */
519
+ declare class BringForwardCommand extends CanvasCommand {
520
+ private id;
521
+ /**
522
+ * @param id The targeted element to bring to the front.
523
+ */
524
+ constructor(id: string);
525
+ apply(state: LayoutsState): {
526
+ layouts: {
527
+ [x: string]: LayoutState | {
528
+ elements: LayoutElement[];
529
+ modificationID: string;
530
+ layout: ILayout;
531
+ };
532
+ };
533
+ serializableWorkflow: SerializableWorkflow;
534
+ };
535
+ }
536
+ /**
537
+ * Send an element backwards by one layer. Does nothing if the element is already at the back.
538
+ */
539
+ declare class SendBackwardsCommand extends CanvasCommand {
540
+ private id;
541
+ /**
542
+ * @param id The targeted element to bring to the front.
543
+ */
544
+ constructor(id: string);
545
+ apply(state: LayoutsState): {
546
+ layouts: {
547
+ [x: string]: LayoutState | {
548
+ elements: LayoutElement[];
549
+ modificationID: string;
550
+ layout: ILayout;
551
+ };
552
+ };
553
+ serializableWorkflow: SerializableWorkflow;
554
+ };
555
+ }
556
+
557
+ interface CommandState {
558
+ transaction: LayoutsState;
559
+ variation?: Partial<LayoutsState>;
560
+ }
561
+ interface LayoutComponentConfiguration {
562
+ renderingConfiguration: RenderingConfiguration;
563
+ outlineArea?: {
564
+ x?: number;
565
+ y?: number;
566
+ width?: number;
567
+ height?: number;
568
+ scale?: number;
569
+ hidden?: boolean;
570
+ };
571
+ viewBox?: {
572
+ x: number;
573
+ y: number;
574
+ width: number;
575
+ height: number;
576
+ };
577
+ maxHeight?: string;
578
+ maxWidth?: string;
579
+ height?: string | number;
580
+ width?: string | number;
581
+ position?: string;
582
+ borderRadius?: number;
583
+ outlineColor?: string;
584
+ backgroundColor?: string;
585
+ }
586
+ declare class CommandContext {
587
+ private state;
588
+ private stateCallbacks;
589
+ private id;
590
+ private prevCommands;
591
+ private nextCommands;
592
+ constructor();
593
+ registerStateCallback(callback: () => void): void;
594
+ unregisterStateCallback(callback: () => void): void;
595
+ getState(): CommandState | undefined;
596
+ private runStateCallbacks;
597
+ apply(command: CanvasCommand, leaveOffUndoStack?: boolean): void;
598
+ undo(): void;
599
+ redo(): void;
600
+ /**
601
+ * Find all commands in history with the given sequence ID,
602
+ * discard all but the last and overwrite its oldState.
603
+ */
604
+ flattenSequence(sequenceId: string, initialState: LayoutsState): void;
605
+ getLayoutById(layoutId: string): LayoutData;
606
+ getAllLayouts(): LayoutData[];
607
+ private getLayoutDataWithState;
608
+ initialize(layouts: ILayout[], reloadedState?: LayoutsState): void;
609
+ private commandReducer;
610
+ }
611
+ declare const getSvgElement: (layout: ILayout, elements: LayoutElement[], configuration: LayoutComponentConfiguration) => PapyrusNode;
612
+ interface LayoutData {
613
+ layoutState: LayoutState;
614
+ Component: PapyrusComponent<SVGLayoutProps>;
615
+ getComponentWithProps: (configuration: LayoutComponentConfiguration) => PapyrusComponent<SVGLayoutProps>;
616
+ }
617
+
300
618
  declare class LayoutPreviewService implements RenderableContextService {
301
619
  private readonly layouts;
302
620
  private handleCompleteRender;
@@ -1044,7 +1362,7 @@ declare abstract class GlobalPropertyHandle {
1044
1362
  * Returns all steps that share this property.
1045
1363
  * @param targetExperiences Optionally filter the steps to only those in the given experiences.
1046
1364
  */
1047
- protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<_spiffcommerce_papyrus.AnyStepData>[];
1365
+ protected getSharedSteps(targetExperiences?: WorkflowExperience[]): StepHandle<AnyStepData>[];
1048
1366
  protected getStateValue(): string | undefined;
1049
1367
  }
1050
1368
  /**
@@ -2215,128 +2533,900 @@ interface WorkflowManager {
2215
2533
  getStepTags(stepId: string): string[];
2216
2534
  }
2217
2535
 
2218
- interface StepService<T extends AnyStepData> {
2536
+ declare enum AssetType {
2537
+ Data = "Data",
2538
+ Font = "Font",
2539
+ Frame = "Frame",
2540
+ Illustration = "Illustration",
2541
+ Image = "Image",
2542
+ Model = "Model",
2543
+ Material = "Material",
2544
+ Color = "Color",
2545
+ QuestionnaireCollateral = "QuestionnaireCollateral",
2546
+ RequestCollateral = "RequestCollateral",
2547
+ SignupCollateral = "SignupCollateral",
2548
+ Video = "Video",
2549
+ ColorProfile = "ColorProfile",
2550
+ Environment = "Environment"
2551
+ }
2552
+ interface Asset {
2553
+ /**
2554
+ * The path of the asset within the bucket.
2555
+ */
2556
+ key?: string;
2557
+ /**
2558
+ * The name of this asset, the file name by default, otherwise a name set by the user.
2559
+ */
2560
+ name?: string;
2219
2561
  /**
2220
- * Initialize the given step, or reload from serialized data if present.
2562
+ * The time that this asset was uploaded.
2221
2563
  */
2222
- init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
2223
- }
2224
- interface FileInfo {
2564
+ createdAt?: string;
2225
2565
  /**
2226
- * The name of the file.
2566
+ * The ID of this asset's license.
2227
2567
  */
2228
- name: string;
2568
+ licenseId?: string;
2229
2569
  /**
2230
- * A blob object representing the
2231
- * data of the file.
2570
+ * The content type registered with the bucket.
2232
2571
  */
2233
- blob: Blob;
2572
+ mimeType?: string;
2573
+ /**
2574
+ * The ID of the person that uploaded this asset.
2575
+ */
2576
+ ownerId?: string;
2577
+ /**
2578
+ * The price to use this asset.
2579
+ */
2580
+ price?: number;
2581
+ /**
2582
+ * The asset type being dealt with.
2583
+ */
2584
+ type?: AssetType;
2585
+ /**
2586
+ * True when this asset is publicly available to anyone.
2587
+ */
2588
+ public?: boolean;
2589
+ /**
2590
+ * All versions for this asset, including the "latest" one which is the default and represented
2591
+ * by the key of the asset itself.
2592
+ */
2593
+ objectVersions?: AssetObjectVersion[];
2594
+ /**
2595
+ * A list of tags for organisational purposes.
2596
+ */
2597
+ tags?: AssetTag[];
2598
+ hubLink?: string;
2599
+ fileLink?: string;
2600
+ newVersionLink?: string;
2601
+ invalidateLink?: string;
2602
+ versions?: AssetVersion[];
2603
+ metadata?: AssetMetadata[];
2234
2604
  }
2235
2605
  /**
2236
- * A command along with a function to run afterwards.
2606
+ * A tag for organisation of assets
2237
2607
  */
2238
- interface CommandWithFollowup {
2239
- command?: CanvasCommand;
2240
- followup?: () => Promise<void>;
2608
+ interface AssetTag {
2609
+ /**
2610
+ * A unique ID.
2611
+ */
2612
+ id: string;
2613
+ /**
2614
+ * The human friendly display name of the tag.
2615
+ */
2616
+ name: string;
2617
+ /**
2618
+ * The key of the asset the tag is associated to.
2619
+ */
2620
+ assetKey: string;
2621
+ /**
2622
+ * The partner that owns that asset & tag.
2623
+ */
2624
+ partnerId: string;
2625
+ }
2626
+ interface AssetMetadata {
2627
+ key: string;
2628
+ value: string;
2629
+ }
2630
+ interface AssetVersion {
2631
+ name: string;
2632
+ link: string;
2241
2633
  }
2242
2634
  /**
2243
- * The variant selections of a completed step.
2635
+ * An object version is a snapshow of an asset at a given point in time. Each time
2636
+ * the user updates the file associated to an asset a new object version is created.
2637
+ * Users can then see a timeline of all object versions and switch between them.
2244
2638
  */
2245
- interface SelectedVariants {
2246
- [stepName: string]: {
2247
- id: string;
2248
- name: string;
2249
- priceModifier: number;
2250
- }[];
2639
+ interface AssetObjectVersion {
2640
+ /**
2641
+ * The size of the file in bytes.
2642
+ */
2643
+ size: number;
2644
+ /**
2645
+ * A timestamp for when this version was created.
2646
+ */
2647
+ timestamp: string;
2648
+ /**
2649
+ * The id of the version, this is required in cases where we want to perform
2650
+ * specific operations on a version such as making it the latest one or deleting it.
2651
+ */
2652
+ versionId: string;
2653
+ /**
2654
+ * The url that this asset should be called on when we want to get it,
2655
+ * instead of the base key. This key is
2656
+ */
2657
+ versionedKey: string;
2251
2658
  }
2252
- interface ExportedData {
2253
- [name: string]: {
2254
- value: string;
2255
- priceModifier: number;
2256
- };
2659
+ interface Step<T extends AnyStepData = AnyStepData> {
2660
+ conditions?: Condition[];
2661
+ data: T;
2662
+ globalPropertyAspectConfigurations?: GlobalPropertyAspectConfiguration[];
2663
+ helpText?: string;
2664
+ mandatory?: boolean;
2665
+ silent?: boolean;
2666
+ option?: OptionResource;
2667
+ optionId?: string;
2668
+ stepName: string;
2669
+ stepTitle: string;
2670
+ tags?: string[];
2671
+ type: StepType;
2257
2672
  }
2258
- interface DesignCreationMessage {
2259
- additionalExternalProductId?: string;
2260
- additionalExternalVariantId?: string;
2261
- baseCost?: number;
2262
- designExternalVariants?: DesignExternalVariant[];
2263
- designProductId?: string;
2264
- designProductVariantId?: string;
2265
- event: string;
2266
- exportedData: ExportedData;
2267
- externalCartProductId?: string;
2268
- externalCartProductVariantId?: string;
2269
- lineItemImageUrl: string;
2270
- metadata?: {
2271
- [stepName: string]: string;
2673
+ interface GlobalPropertyAspectConfiguration {
2674
+ aspectName?: string;
2675
+ globalPropertyConfigurationId?: string;
2676
+ }
2677
+ interface GlobalPropertyConfiguration {
2678
+ id: string;
2679
+ aspects: GlobalPropertyConfigurationAspect[];
2680
+ }
2681
+ interface GlobalPropertyConfigurationAspect {
2682
+ name: string;
2683
+ type: AspectType;
2684
+ title: string;
2685
+ description: string;
2686
+ entityId?: string;
2687
+ conditions?: GlobalPropertyConfigurationAspectCondition[];
2688
+ }
2689
+ interface GlobalPropertyConfigurationAspectCondition {
2690
+ targetAspectName?: string;
2691
+ action: AspectConditionAction;
2692
+ requiredVariantSelections: string[];
2693
+ }
2694
+ declare enum AspectConditionAction {
2695
+ Show = "Show"
2696
+ }
2697
+ declare enum AspectType {
2698
+ FileUpload = "FileUpload",
2699
+ Option = "Option",
2700
+ ColorOption = "ColorOption",
2701
+ Text = "Text"
2702
+ }
2703
+ declare enum StepType {
2704
+ Information = "Information",
2705
+ Bulk = "Bulk",
2706
+ DigitalContent = "DigitalContent",
2707
+ Finish = "Finish",
2708
+ Frame = "Frame",
2709
+ Illustration = "Illustration",
2710
+ Introduction = "Introduction",
2711
+ Material = "Material",
2712
+ Model = "Model",
2713
+ Module = "Module",
2714
+ Picture = "Picture",
2715
+ /**
2716
+ * @deprecated Use Frame instead.
2717
+ */
2718
+ Photo = "Photo",
2719
+ ProductOverlay = "ProductOverlay",
2720
+ Question = "Question",
2721
+ Shape = "Shape",
2722
+ SilentIllustration = "SilentIllustration",
2723
+ Text = "Text"
2724
+ }
2725
+ interface StepAspect {
2726
+ stepName: string;
2727
+ stepType: StepType;
2728
+ aspectType: StepAspectType;
2729
+ }
2730
+ declare enum StepAspectType {
2731
+ Color = "Color",
2732
+ Colors = "Colors",
2733
+ Selection = "Selection",
2734
+ Selections = "Selections",
2735
+ Text = "Text",
2736
+ Upload = "Upload"
2737
+ }
2738
+ interface Region {
2739
+ top: number;
2740
+ left: number;
2741
+ width: number;
2742
+ height: number;
2743
+ layer?: number;
2744
+ layerIndex?: number;
2745
+ rotation: number;
2746
+ panelId: string;
2747
+ immutable?: boolean;
2748
+ adjustmentBoundary?: {
2749
+ x: number;
2750
+ y: number;
2751
+ height: number;
2752
+ width: number;
2272
2753
  };
2273
- optionsCost: number;
2274
- processExecutionId?: string;
2275
- quantity?: number;
2276
- selectedVariants?: SelectedVariants;
2277
- sku?: string;
2278
- transactionId: string;
2279
- transactionOwnerId?: string;
2280
- weight?: number;
2281
- workflowViewerLink: string;
2282
- workflowViewerReadOnlyLink: string;
2283
2754
  }
2284
- interface BundleDesignCreationMessage {
2285
- bundleId: string;
2286
- items: DesignCreationMessage[];
2287
- bundleOwnerId?: string;
2755
+ interface Condition {
2756
+ requiredVariantSelections: string[];
2757
+ action: string;
2758
+ targetStepName: string;
2759
+ }
2760
+ interface StepAsset {
2761
+ key: string;
2762
+ previewKey?: string;
2763
+ }
2764
+ interface OptionResource {
2765
+ id?: string;
2766
+ localId?: string;
2767
+ name: string;
2768
+ type?: string;
2769
+ variants?: VariantResource[];
2770
+ defaultVariant?: VariantResource;
2771
+ workflowId?: string;
2772
+ public?: boolean;
2773
+ displayType?: string;
2774
+ colorProfile?: Asset;
2775
+ integrationOptions?: IntegrationOptionResource[];
2776
+ }
2777
+ interface VariantResource {
2778
+ id?: string;
2779
+ name: string;
2780
+ enabled: boolean;
2781
+ priceModifier: number;
2782
+ asset?: Asset;
2783
+ material?: MaterialResource;
2784
+ thumbnail?: Asset;
2785
+ color?: string;
2786
+ localId?: string;
2787
+ default?: boolean;
2788
+ namedColor?: string;
2789
+ option?: OptionResource;
2790
+ }
2791
+ interface IntegrationOptionResource {
2792
+ id?: string;
2793
+ localId?: string;
2794
+ integrationId: string;
2795
+ externalProductId?: string;
2288
2796
  }
2289
2797
  /**
2290
- * Represents a transaction.
2798
+ * Represents a material resource that can be additively applied to
2799
+ * a material targeted in the scene.
2291
2800
  */
2292
- interface Transaction {
2801
+ type MaterialResource = {
2293
2802
  /**
2294
- * A unique identifier for this transaction. Useful for reloading and
2295
- * modifying state of the transaction.
2803
+ * A unique identified for this material.
2296
2804
  */
2297
2805
  id: string;
2298
2806
  /**
2299
- * User-supplied name for the associated design.
2807
+ * The name of this material
2300
2808
  */
2301
- designName?: string;
2809
+ name: string;
2302
2810
  /**
2303
- * The workflow associated with this transaction.
2811
+ * Defines the base color of a surface before any other calculations are made.
2304
2812
  */
2305
- workflowId?: string;
2813
+ albedoMapKey?: string;
2306
2814
  /**
2307
- * Temporary ID that grants write permission to the transaction.
2815
+ * Defines the transparency of a surface.
2308
2816
  */
2309
- transactionOwnerId?: string;
2817
+ alphaMapKey?: string;
2310
2818
  /**
2311
- * The current state of the design.
2819
+ * Defines shadowing on a surface.
2312
2820
  */
2313
- workflowState?: string;
2821
+ ambientMapKey?: string;
2314
2822
  /**
2315
- * URL to a partner-specific logo intended to display during the workflow experience.
2823
+ * Defines the amount of light being emitted from a surface.
2316
2824
  */
2317
- customLogoLink?: string;
2825
+ emissionMapKey?: string;
2318
2826
  /**
2319
- * URL to a logo intended to display at the periphery of the workflow experience.
2827
+ * Identical to roughness.
2320
2828
  */
2321
- workflowFooterLogoLink?: string;
2829
+ metallicMapKey?: string;
2322
2830
  /**
2323
- * URL to the corresponding integration in the REST API.
2831
+ * Defines the direction light will bounce in when it hits a point on a surface.
2324
2832
  */
2325
- restApiIntegrationLink?: string;
2833
+ normalMapKey?: string;
2326
2834
  /**
2327
- * URL to redirect to when a workflow is finished.
2835
+ * Used to define how smooth a surface is.
2328
2836
  */
2329
- callbackUrl?: string;
2837
+ roughnessMapKey?: string;
2330
2838
  /**
2331
- * Product that this transaction belongs to.
2839
+ * Used to define refraction of light on a surface.
2332
2840
  */
2333
- product?: Product;
2841
+ refractionMapKey?: string;
2334
2842
  /**
2335
- * The integration product related to this lineitem.
2843
+ * The intensity of refraction, when refraction is enabled via a texture.
2336
2844
  */
2337
- integrationProduct?: IntegrationProductResource;
2845
+ refractionIntensity?: number;
2338
2846
  /**
2339
- * Whether this transaction has previously been ordered.
2847
+ * Use to define reflection of light on a surface.
2848
+ */
2849
+ reflectionMapKey?: string;
2850
+ /**
2851
+ * The intensity of reflection, when reflection is enabled via a texture.
2852
+ */
2853
+ reflectionIntensity?: number;
2854
+ /**
2855
+ * The rotation of the reflection map (around the up axis, in degrees), when reflection is enabled via a texture.
2856
+ */
2857
+ reflectionRotation?: number;
2858
+ /**
2859
+ * When enabled the material will be displayed with a clearcoat affect for simulating coated plastic surfaces.
2860
+ */
2861
+ clearCoat: MaterialEffectMode;
2862
+ /**
2863
+ * Index of refraction when clear coat is enabled.
2864
+ */
2865
+ clearCoatIOR?: number;
2866
+ /**
2867
+ * The date that this material resource was created
2868
+ */
2869
+ createdAt: string;
2870
+ /**
2871
+ * The date that this material resource was last updated.
2872
+ */
2873
+ updatedAt: string;
2874
+ };
2875
+ /**
2876
+ * Used to specify the behavior of a material effect such as clearcoat, sheen and translucency.
2877
+ */
2878
+ declare enum MaterialEffectMode {
2879
+ /**
2880
+ * When a material variant effect specifies 'None' the effect doesn't change in any way. This is the default behavior.
2881
+ */
2882
+ None = "None",
2883
+ /**
2884
+ * When a material variant effect specifies 'RemoveWhenSelected' the effect is removed.
2885
+ */
2886
+ RemoveWhenSelected = "RemoveWhenSelected",
2887
+ /**
2888
+ * When a material variant effect specifies 'ApplyWhenSelected' the effect is enabled.
2889
+ */
2890
+ ApplyWhenSelected = "ApplyWhenSelected"
2891
+ }
2892
+ type AnyStepData = InformationStepData | BulkStepData | DigitalContentStepData | FinalizeStepData | FrameStepData | IllustrationStepData | MaterialStepData | ModelStepData | ModuleStepData | PictureStepData | QuestionStepData | ShapeStepData | SilentStepData | TextStepData;
2893
+ interface Animatable {
2894
+ lookAtAnimation?: CameraAnimation;
2895
+ modelAnimation?: ModelAnimation;
2896
+ }
2897
+ interface BulkStepData extends Animatable {
2898
+ aspects: StepAspect[];
2899
+ }
2900
+ interface InformationStepData extends Animatable, Placeable {
2901
+ content: string;
2902
+ }
2903
+ interface DigitalContentStepData extends Animatable, Placeable {
2904
+ baseUrl: string;
2905
+ varyUpload?: boolean;
2906
+ }
2907
+ interface FrameStepData extends Animatable, Placeable, Colorable {
2908
+ hideSelectionInCart?: boolean;
2909
+ hideImageInCart?: boolean;
2910
+ colorPickerEnabled?: boolean;
2911
+ displaySelectionOnFinishStep?: boolean;
2912
+ displayImageOnFinishStep?: boolean;
2913
+ disablePlaceholder?: boolean;
2914
+ initialZoomLevel?: number;
2915
+ markSelectionAsCustomField?: boolean;
2916
+ markImageAsCustomField?: boolean;
2917
+ maxColors?: number;
2918
+ focalBlur?: boolean;
2919
+ focalBlurRadius?: number;
2920
+ focalBlurStrength?: number;
2921
+ forceImageCover?: boolean;
2922
+ overlayImageKey?: string;
2923
+ placeholderImageKey?: string;
2924
+ placeholderImageUrl?: string;
2925
+ varySelection?: boolean;
2926
+ varyUpload?: boolean;
2927
+ whitelistedExtensions: string[];
2928
+ }
2929
+ interface IllustrationStepData extends Animatable, Placeable, Colorable {
2930
+ hideSelectionInCart?: boolean;
2931
+ hideColorsInCart?: boolean;
2932
+ displaySelectionOnFinishStep?: boolean;
2933
+ displayColorsOnFinishStep?: boolean;
2934
+ markSelectionAsCustomField?: boolean;
2935
+ markColorsAsCustomField?: boolean;
2936
+ assetKeys?: string[];
2937
+ assets?: StepAsset[];
2938
+ defaultAssetKey?: string;
2939
+ colorPickerEnabled?: boolean;
2940
+ varySelection?: boolean;
2941
+ varyColors?: boolean;
2942
+ }
2943
+ interface MaterialStepData extends Animatable {
2944
+ hideSelectionInCart?: boolean;
2945
+ displaySelectionOnFinishStep?: boolean;
2946
+ markSelectionAsCustomField?: boolean;
2947
+ targetMaterials: string[];
2948
+ varySelection?: boolean;
2949
+ }
2950
+ interface ModelStepData extends Animatable {
2951
+ replaceProductModel?: boolean;
2952
+ hideSelectionInCart?: boolean;
2953
+ displaySelectionOnFinishStep?: boolean;
2954
+ markSelectionAsCustomField?: boolean;
2955
+ varySelection?: boolean;
2956
+ }
2957
+ interface ModuleStepData extends Animatable, Placeable {
2958
+ hideTextInCart?: boolean;
2959
+ displayTextOnFinishStep?: boolean;
2960
+ markTextAsCustomField?: boolean;
2961
+ module: string;
2962
+ maxLength: number;
2963
+ varyText?: string;
2964
+ }
2965
+ interface PictureStepData extends Animatable, Placeable {
2966
+ hideSelectionInCart?: boolean;
2967
+ displaySelectionOnFinishStep?: boolean;
2968
+ markSelectionAsCustomField?: boolean;
2969
+ varySelection?: boolean;
2970
+ }
2971
+ interface QuestionStepData extends Animatable {
2972
+ hideSelectionsInCart?: boolean;
2973
+ displaySelectionsOnFinishStep?: boolean;
2974
+ markSelectionsAsCustomField?: boolean;
2975
+ varySelections?: boolean;
2976
+ }
2977
+ interface ShapeStepData extends Animatable, Placeable {
2978
+ hideSelectionInCart?: boolean;
2979
+ displaySelectionOnFinishStep?: boolean;
2980
+ markSelectionAsCustomField?: boolean;
2981
+ defaultColour?: string;
2982
+ excludeFromPrint?: boolean;
2983
+ varySelection?: boolean;
2984
+ }
2985
+ interface TextStepData extends Animatable, Placeable, Colorable {
2986
+ hideSelectionInCart?: boolean;
2987
+ hideFillImageInCart?: boolean;
2988
+ hideColorInCart?: boolean;
2989
+ hideTextInCart?: boolean;
2990
+ displaySelectionOnFinishStep?: boolean;
2991
+ displayFillImageOnFinishStep?: boolean;
2992
+ displayColorOnFinishStep?: boolean;
2993
+ displayTextOnFinishStep?: boolean;
2994
+ markSelectionAsCustomField?: boolean;
2995
+ markFillImageAsCustomField?: boolean;
2996
+ markColorAsCustomField?: boolean;
2997
+ markTextAsCustomField?: boolean;
2998
+ allowNewlines?: boolean;
2999
+ defaultText: string;
3000
+ deleteDefaultOnFocus?: boolean;
3001
+ replaceableText?: string;
3002
+ font: string;
3003
+ colorPickerEnabled?: boolean;
3004
+ maxLength: number;
3005
+ maxSize?: number;
3006
+ minSize?: number;
3007
+ size: number;
3008
+ textAlign: string;
3009
+ colour: string;
3010
+ uppercase?: boolean;
3011
+ vertical?: boolean;
3012
+ verticalAlign: string;
3013
+ curved?: boolean;
3014
+ paths?: string[];
3015
+ userCanReplaceText?: boolean;
3016
+ varySelection?: boolean;
3017
+ varyText?: boolean;
3018
+ varyColor?: boolean;
3019
+ imageFillOption?: OptionResource;
3020
+ imageFillScale?: number;
3021
+ }
3022
+ interface SilentStepData extends Animatable, Placeable {
3023
+ asset?: Asset;
3024
+ excludeFromPrint?: boolean;
3025
+ }
3026
+ type FinalizeStepData = Animatable;
3027
+ /**
3028
+ * A colorable step is a step that can have an optional color option assigned to help drive color palette choices.
3029
+ */
3030
+ interface Colorable {
3031
+ colorOption?: OptionResource;
3032
+ }
3033
+ /**
3034
+ * A placeable step is a step that can be placed on a canvas in a set of specific positions.
3035
+ */
3036
+ interface Placeable {
3037
+ regions: Region[];
3038
+ }
3039
+ interface StepService<T extends AnyStepData> {
3040
+ /**
3041
+ * Initialize the given step, or reload from serialized data if present.
3042
+ */
3043
+ init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;
3044
+ }
3045
+ interface LayoutsState {
3046
+ layouts: {
3047
+ [id: string]: LayoutState;
3048
+ };
3049
+ serializableWorkflow: SerializableWorkflow;
3050
+ }
3051
+ /**
3052
+ * A workflow step in the process of being serialized or deserialized.
3053
+ */
3054
+ interface SerializableStep {
3055
+ stepName: string;
3056
+ storage?: StepStorage;
3057
+ selectedVariants?: SerializableVariant[];
3058
+ }
3059
+ interface SerializableWorkflow {
3060
+ steps: SerializableStep[];
3061
+ }
3062
+ interface SerializableVariant {
3063
+ id: string;
3064
+ priceModifier: number;
3065
+ }
3066
+ interface StepStorage {
3067
+ bulkIsConnected?: boolean;
3068
+ color?: string;
3069
+ colorProfileAssetKey?: string;
3070
+ colors?: {
3071
+ [key: string]: IllustrationColorObject;
3072
+ };
3073
+ colour?: string;
3074
+ currentFrameSources?: string[];
3075
+ customiseAllText?: boolean;
3076
+ defaultCleared?: boolean;
3077
+ fillImage?: TextFillImage;
3078
+ frameOffsetsList?: FrameOffsets[];
3079
+ framePatternData?: {
3080
+ originalAssetKey?: string;
3081
+ backgroundRemovedAssetKey?: string;
3082
+ useOriginalAsset?: boolean;
3083
+ };
3084
+ framePatternSrc?: string;
3085
+ inputText?: string;
3086
+ overrideGlobalConfiguration?: boolean;
3087
+ overrideGlobalConfigurations?: {
3088
+ [key: string]: boolean;
3089
+ };
3090
+ text?: string;
3091
+ videoShortUrl?: string;
3092
+ videoUrl?: string;
3093
+ }
3094
+ interface IllustrationColorObject {
3095
+ browserValue: string;
3096
+ spotColor?: {
3097
+ profileName: string;
3098
+ namedColor: string;
3099
+ };
3100
+ pmsValue?: string;
3101
+ }
3102
+ interface FrameOffsets {
3103
+ y: number;
3104
+ x: number;
3105
+ zoom: number;
3106
+ }
3107
+ interface LayoutState {
3108
+ /**
3109
+ * The elements currently on this layout.
3110
+ */
3111
+ elements: LayoutElement[];
3112
+ /**
3113
+ * A file describing the properties of this layout.
3114
+ */
3115
+ layout: ILayout;
3116
+ /**
3117
+ * A unique ID regenerated each time this layout is changed.
3118
+ */
3119
+ modificationID: string;
3120
+ }
3121
+ /**
3122
+ * Represents an element on the SVG canvas. This may comprise of multiple SVG elements when
3123
+ * output such as path elements, defs, etc. All concrete elements must implement this interface.
3124
+ */
3125
+ interface LayoutElement extends Layerable {
3126
+ /**
3127
+ * The unique identifier for this element.
3128
+ */
3129
+ id: string;
3130
+ /**
3131
+ * If the element was made from a workflow step, this is its step name.
3132
+ */
3133
+ stepName?: string;
3134
+ /**
3135
+ * If the element was made from a workflow step, this is its region.
3136
+ */
3137
+ stepRegion?: Region;
3138
+ /**
3139
+ * The type of this element
3140
+ */
3141
+ type: LayoutElementType;
3142
+ /**
3143
+ * Horizontal offset from top left origin point.
3144
+ */
3145
+ x: number;
3146
+ /**
3147
+ * Vertical offset from top left origin point.
3148
+ */
3149
+ y: number;
3150
+ /**
3151
+ * The height in pixels of the element.
3152
+ */
3153
+ width: number;
3154
+ /**
3155
+ * The height in pixels of the element.
3156
+ */
3157
+ height: number;
3158
+ /**
3159
+ * The rotation in degrees.
3160
+ */
3161
+ rotation: number;
3162
+ /**
3163
+ * The element is considered immutable and shouldn't be modifiable by the user.
3164
+ */
3165
+ immutable?: boolean;
3166
+ /**
3167
+ * When true this element should be rendered on top of all other elements always.
3168
+ */
3169
+ productOverlay?: boolean;
3170
+ /**
3171
+ * When true, this element will be removed from SVGString output when
3172
+ * the removeExcludedElements flag is set to true.
3173
+ */
3174
+ excludeFromExport?: boolean;
3175
+ /**
3176
+ * Value to use as the mask attribute if the element does not correspond to a step.
3177
+ */
3178
+ mask?: string;
3179
+ /**
3180
+ * Injected by the LayoutsProvider if required. Shouldn't be
3181
+ * used by the user. This is a simple way to pass global rendering configuration
3182
+ * to individual elements without having to set up a react context.
3183
+ */
3184
+ _renderingConfiguration?: RenderingConfiguration;
3185
+ }
3186
+ /**
3187
+ * Represents a layerable entity. Layerable entities can be sorted within our system for rendering purposes.
3188
+ */
3189
+ interface Layerable {
3190
+ /**
3191
+ * The layer that this element exists on. Elements on a higher layer can never
3192
+ * be below an element on a lower layer. 0 by default.
3193
+ */
3194
+ layer?: number;
3195
+ /**
3196
+ * The index of this element on the current layer, if no layer is present it is assumed to be 0.
3197
+ * For the index 0 is lower, > 0 is higher
3198
+ */
3199
+ layerIndex?: number;
3200
+ }
3201
+ interface TextFillImage {
3202
+ src: string;
3203
+ width: number;
3204
+ height: number;
3205
+ scale: number;
3206
+ }
3207
+ /**
3208
+ * The reason we need to turn a layout into an SVG.
3209
+ */
3210
+ declare enum LayoutRenderingPurpose {
3211
+ ThreeD = "ThreeD",
3212
+ FreeDesign = "FreeDesign",
3213
+ Print = "Print"
3214
+ }
3215
+ /**
3216
+ * Specifies configuration for rendering a Papyrus canvas as an SVG string.
3217
+ */
3218
+ interface RenderingConfiguration {
3219
+ /**
3220
+ * Sets the viewbox to a custom value when subregions are desired.
3221
+ */
3222
+ region?: PreviewRegion;
3223
+ /**
3224
+ * Excludes marked elements from the SVG output when true.
3225
+ */
3226
+ removeExcludedElements?: boolean;
3227
+ purpose: LayoutRenderingPurpose;
3228
+ /**
3229
+ * When true any cached data will be ignored and assets will be rendered in full
3230
+ * with the properties they are provided.
3231
+ */
3232
+ omitCachedFields?: boolean;
3233
+ /**
3234
+ * When true, spot colors will be output, when provided, into any
3235
+ * fill or stroke style in an illustration.
3236
+ */
3237
+ spotColors?: boolean;
3238
+ colorProfiles?: ColorProfileProps[];
3239
+ /**
3240
+ * Allow for debug rendering on elements.
3241
+ */
3242
+ debug?: boolean;
3243
+ }
3244
+ interface ColorProfileProps {
3245
+ name: string;
3246
+ key: string;
3247
+ }
3248
+ /**
3249
+ * The possible types for an element.
3250
+ */
3251
+ declare enum LayoutElementType {
3252
+ Frame = "frame",
3253
+ Group = "group",
3254
+ Image = "image",
3255
+ Pattern = "pattern",
3256
+ Illustration = "illustration",
3257
+ Textbox = "textbox"
3258
+ }
3259
+ /**
3260
+ * Represents a layout contained within a specific user created design.
3261
+ */
3262
+ interface ILayout {
3263
+ /**
3264
+ * The internal identifier for this layout.
3265
+ */
3266
+ id: string;
3267
+ /**
3268
+ * A link to the json resource describing this layout
3269
+ */
3270
+ layoutPath?: string;
3271
+ /**
3272
+ * The index this layout appears at in its design
3273
+ */
3274
+ index: number;
3275
+ /**
3276
+ * An id for the panel associated to this layout.
3277
+ */
3278
+ panelId: string;
3279
+ /**
3280
+ * The date this layout was created.
3281
+ */
3282
+ createdAt: Date;
3283
+ /**
3284
+ * The date this layout was last updated.
3285
+ */
3286
+ updatedAt: Date;
3287
+ /**
3288
+ * The height of the layout. This matches the background element on the canvas as a convenience.
3289
+ */
3290
+ height: number;
3291
+ /**
3292
+ * The width of the layout. This matches the background element on the canvas as a convenience.
3293
+ */
3294
+ width: number;
3295
+ /**
3296
+ * When true this layout should contain no background fill.
3297
+ */
3298
+ transparentBackground?: boolean;
3299
+ previewRegion?: {
3300
+ height: number;
3301
+ width: number;
3302
+ top: number;
3303
+ left: number;
3304
+ };
3305
+ useEditableArea?: boolean;
3306
+ editableArea?: {
3307
+ x: number;
3308
+ y: number;
3309
+ height: number;
3310
+ width: number;
3311
+ };
3312
+ name: string;
3313
+ }
3314
+ interface FileInfo {
3315
+ /**
3316
+ * The name of the file.
3317
+ */
3318
+ name: string;
3319
+ /**
3320
+ * A blob object representing the
3321
+ * data of the file.
3322
+ */
3323
+ blob: Blob;
3324
+ }
3325
+ /**
3326
+ * A command along with a function to run afterwards.
3327
+ */
3328
+ interface CommandWithFollowup {
3329
+ command?: CanvasCommand;
3330
+ followup?: () => Promise<void>;
3331
+ }
3332
+ /**
3333
+ * The variant selections of a completed step.
3334
+ */
3335
+ interface SelectedVariants {
3336
+ [stepName: string]: {
3337
+ id: string;
3338
+ name: string;
3339
+ priceModifier: number;
3340
+ }[];
3341
+ }
3342
+ interface ExportedData {
3343
+ [name: string]: {
3344
+ value: string;
3345
+ priceModifier: number;
3346
+ };
3347
+ }
3348
+ interface DesignCreationMessage {
3349
+ additionalExternalProductId?: string;
3350
+ additionalExternalVariantId?: string;
3351
+ baseCost?: number;
3352
+ designExternalVariants?: DesignExternalVariant[];
3353
+ designProductId?: string;
3354
+ designProductVariantId?: string;
3355
+ event: string;
3356
+ exportedData: ExportedData;
3357
+ externalCartProductId?: string;
3358
+ externalCartProductVariantId?: string;
3359
+ lineItemImageUrl: string;
3360
+ metadata?: {
3361
+ [stepName: string]: string;
3362
+ };
3363
+ optionsCost: number;
3364
+ processExecutionId?: string;
3365
+ quantity?: number;
3366
+ selectedVariants?: SelectedVariants;
3367
+ sku?: string;
3368
+ transactionId: string;
3369
+ transactionOwnerId?: string;
3370
+ weight?: number;
3371
+ workflowViewerLink: string;
3372
+ workflowViewerReadOnlyLink: string;
3373
+ }
3374
+ interface BundleDesignCreationMessage {
3375
+ bundleId: string;
3376
+ items: DesignCreationMessage[];
3377
+ bundleOwnerId?: string;
3378
+ }
3379
+ /**
3380
+ * Represents a transaction.
3381
+ */
3382
+ interface Transaction {
3383
+ /**
3384
+ * A unique identifier for this transaction. Useful for reloading and
3385
+ * modifying state of the transaction.
3386
+ */
3387
+ id: string;
3388
+ /**
3389
+ * User-supplied name for the associated design.
3390
+ */
3391
+ designName?: string;
3392
+ /**
3393
+ * The workflow associated with this transaction.
3394
+ */
3395
+ workflowId?: string;
3396
+ /**
3397
+ * Temporary ID that grants write permission to the transaction.
3398
+ */
3399
+ transactionOwnerId?: string;
3400
+ /**
3401
+ * The current state of the design.
3402
+ */
3403
+ workflowState?: string;
3404
+ /**
3405
+ * URL to a partner-specific logo intended to display during the workflow experience.
3406
+ */
3407
+ customLogoLink?: string;
3408
+ /**
3409
+ * URL to a logo intended to display at the periphery of the workflow experience.
3410
+ */
3411
+ workflowFooterLogoLink?: string;
3412
+ /**
3413
+ * URL to the corresponding integration in the REST API.
3414
+ */
3415
+ restApiIntegrationLink?: string;
3416
+ /**
3417
+ * URL to redirect to when a workflow is finished.
3418
+ */
3419
+ callbackUrl?: string;
3420
+ /**
3421
+ * Product that this transaction belongs to.
3422
+ */
3423
+ product?: Product;
3424
+ /**
3425
+ * The integration product related to this lineitem.
3426
+ */
3427
+ integrationProduct?: IntegrationProductResource;
3428
+ /**
3429
+ * Whether this transaction has previously been ordered.
2340
3430
  */
2341
3431
  isOrdered?: boolean;
2342
3432
  /**
@@ -2475,6 +3565,19 @@ interface Integration {
2475
3565
  logo: string;
2476
3566
  partner: Partner;
2477
3567
  }
3568
+ interface Theme {
3569
+ configuration?: string;
3570
+ fontAsset?: Asset;
3571
+ id?: string;
3572
+ name?: string;
3573
+ primaryColor?: string;
3574
+ secondaryColor?: string;
3575
+ textColor?: string;
3576
+ themeLayout?: {
3577
+ id?: string;
3578
+ name?: string;
3579
+ };
3580
+ }
2478
3581
  declare enum IntegrationType {
2479
3582
  Hub = "Hub",
2480
3583
  Shopify = "Shopify"
@@ -2547,7 +3650,7 @@ interface Product {
2547
3650
  /**
2548
3651
  * A description of the Product, written in Markdown.
2549
3652
  */
2550
- description: string;
3653
+ description?: string;
2551
3654
  /**
2552
3655
  * A URL to the image asset associated with this product.
2553
3656
  */
@@ -2838,87 +3941,585 @@ interface BundleStakeholder {
2838
3941
  customer?: Customer;
2839
3942
  type?: StakeholderType;
2840
3943
  }
2841
- interface BundleStakeholderInput {
2842
- type: StakeholderType;
2843
- customerDetails: CustomerDetailsInput;
3944
+ interface BundleStakeholderInput {
3945
+ type: StakeholderType;
3946
+ customerDetails: CustomerDetailsInput;
3947
+ }
3948
+ type ProductCollectionResource = {
3949
+ id: string;
3950
+ globalPropertyConfiguration?: GlobalPropertyConfiguration;
3951
+ productCollectionProducts?: ProductCollectionProductResource[];
3952
+ name: string;
3953
+ description?: string;
3954
+ image?: Asset;
3955
+ transformCollection?: TransformCollection;
3956
+ };
3957
+ type ProductCollectionProductResource = {
3958
+ id: string;
3959
+ productCollection?: ProductCollectionResource;
3960
+ productCollectionId?: string;
3961
+ product: Product;
3962
+ productId: string;
3963
+ workflowId?: string;
3964
+ };
3965
+ type GlobalPropertyState = {
3966
+ id: string;
3967
+ aspects: GlobalPropertyStateAspect[];
3968
+ };
3969
+ type GlobalPropertyStateAspect = {
3970
+ name: string;
3971
+ value: string;
3972
+ type?: AspectType;
3973
+ storage?: GlobalPropertyStateAspectStorage;
3974
+ };
3975
+ type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage | GlobalPropertyStateColorOptionStorage;
3976
+ type GlobalPropertyStateFileUploadStorage = {
3977
+ originalAssetKey?: string;
3978
+ backgroundRemovedAssetKey?: string;
3979
+ useOriginalAsset?: boolean;
3980
+ };
3981
+ type GlobalPropertyStateColorOptionStorage = {
3982
+ customColor?: string;
3983
+ };
3984
+ interface BundleStateTransform {
3985
+ position: Vector3;
3986
+ rotation: Vector3;
3987
+ scale: Vector3;
3988
+ }
3989
+ interface Vector3 {
3990
+ x: number;
3991
+ y: number;
3992
+ z: number;
3993
+ }
3994
+ interface TransformCollection {
3995
+ id: string;
3996
+ name: string;
3997
+ transforms: TransformCollectionTransform[];
3998
+ }
3999
+ interface TransformCollectionTransform {
4000
+ id: string;
4001
+ name: string;
4002
+ position: Vector3;
4003
+ rotation: Vector3;
4004
+ scale: Vector3;
4005
+ }
4006
+ type Extendable<T> = T & {
4007
+ [key: string]: any;
4008
+ };
4009
+ interface Metafield {
4010
+ id: string;
4011
+ createdAt: string;
4012
+ updatedAt: string;
4013
+ entityId: string;
4014
+ value: string;
4015
+ metafieldConfiguration: MetafieldConfiguration;
4016
+ }
4017
+ interface MetafieldConfiguration {
4018
+ id: string;
4019
+ createdAt: string;
4020
+ updatedAt: string;
4021
+ entityType: string;
4022
+ metafieldType: string;
4023
+ name: string;
4024
+ }
4025
+ declare enum TextAlgorithm {
4026
+ /**
4027
+ * An algorithm that finds the best size for text based
4028
+ * on a range minSize <-> maxSize
4029
+ * NOTE: Default, this is how we've calculated historically.
4030
+ */
4031
+ Autosize = "Autosize",
4032
+ /**
4033
+ * An algorithm that follows behavior of other popular
4034
+ * text editing applications.
4035
+ */
4036
+ Traditional = "Traditional"
4037
+ }
4038
+ interface FrameElement extends LayoutElement {
4039
+ path: string;
4040
+ /**
4041
+ * Assigns the 'data-frame-width' attribute to the frame element. The rasterizer we use has issues with images inside
4042
+ * patterns. This is a workaround to ensure that the pattern is correctly sized.
4043
+ */
4044
+ dataWidth?: number;
4045
+ /**
4046
+ * Assigns the 'data-frame-height' attribute to the frame element. The rasterizer we use has issues with images inside
4047
+ * patterns. This is a workaround to ensure that the pattern is correctly sized.
4048
+ */
4049
+ dataHeight?: number;
4050
+ disablePlaceholder?: boolean;
4051
+ scaleX: number;
4052
+ scaleY: number;
4053
+ opacity?: number;
4054
+ pattern?: Pattern;
4055
+ focalBlur?: boolean;
4056
+ focalBlurStrength?: number;
4057
+ focalBlurRadius?: number;
4058
+ forceImageCover?: boolean;
4059
+ useThreshold?: boolean;
4060
+ invertThreshold?: boolean;
4061
+ threshold?: number;
4062
+ thresholdSaturation?: number;
4063
+ }
4064
+ /**
4065
+ * A pattern object stores data relevant for displaying an image within a frame, including
4066
+ * the source for the image itself and also dimensions and offsets.
4067
+ */
4068
+ interface Pattern extends Omit<LayoutElement, "type"> {
4069
+ /**
4070
+ * The image to use when a file is generated, this should be an original high resolution source file.
4071
+ */
4072
+ src: string;
4073
+ /**
4074
+ * Scaling X of image within frame.
4075
+ */
4076
+ scaleX: number;
4077
+ /**
4078
+ * Scaling Y of image within frame.
4079
+ */
4080
+ scaleY: number;
4081
+ /**
4082
+ * The SVG document that the src represents. This must be the actual content string of the document, rather than a URL.
4083
+ */
4084
+ svg?: string;
4085
+ /**
4086
+ * A map of ID to color code, used to store color selections in the SVG. Only applicable when `svg` is provided.
4087
+ */
4088
+ colors?: {
4089
+ [key: string]: ColorDefinition;
4090
+ };
4091
+ }
4092
+ interface IllustrationElement extends LayoutElement {
4093
+ /**
4094
+ * When provided a src will be used to rehyrdrate the svg field. On serialization
4095
+ * the svg field will be dropped and only src will remain.
4096
+ */
4097
+ src?: string;
4098
+ /**
4099
+ * The string representation of the SVG element. A valid SVG document.
4100
+ */
4101
+ svg?: string;
4102
+ /**
4103
+ * A cached image representation of this SVG, to be used for faster
4104
+ * rendering in performance critical code.
4105
+ */
4106
+ cachedObjectURL?: string;
4107
+ /**
4108
+ * A map of ID to color code, used to store color selections in the SVG.
4109
+ */
4110
+ colors: {
4111
+ [key: string]: ColorDefinition;
4112
+ };
4113
+ }
4114
+ /**
4115
+ * Represents a raster image on the Papyrus canvas.
4116
+ */
4117
+ interface ImageElement extends LayoutElement {
4118
+ /**
4119
+ * A src for the image. This will be used in place of the data URL in server environments and should
4120
+ * be original image quality.
4121
+ */
4122
+ src: string;
4123
+ /**
4124
+ * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/preserveAspectRatio
4125
+ */
4126
+ preserveAspectRatio?: string;
4127
+ }
4128
+ interface TextboxElement extends LayoutElement {
4129
+ /**
4130
+ * Horizontal alignment of text. eg. left, center, right.
4131
+ */
4132
+ align?: string;
4133
+ /**
4134
+ * An image to use as the fill instead of a color.
4135
+ */
4136
+ textFillImage?: TextFillImage;
4137
+ /**
4138
+ * Fill color of this text. Any value that can be parsed by css fill should work here.
4139
+ */
4140
+ fill: string;
4141
+ /**
4142
+ * The font size.
4143
+ */
4144
+ fontSize: number;
4145
+ /**
4146
+ * Information about the font family used to render this text.
4147
+ */
4148
+ fontData: FontData | undefined;
4149
+ /**
4150
+ * Text computed for this textbox.
4151
+ */
4152
+ text?: string;
4153
+ /**
4154
+ * Per element user input. Not used by the layout engine. Instead
4155
+ * used to store user input for textbox to preserve newlines.
4156
+ */
4157
+ input?: string;
4158
+ /**
4159
+ * Should the text layout top to bottom.
4160
+ */
4161
+ vertical?: boolean;
4162
+ /**
4163
+ * The height between text lines.
4164
+ */
4165
+ lineHeight?: number;
4166
+ /**
4167
+ * The alignment of text vertically, top center or bottom.
4168
+ */
4169
+ verticalAlign: string;
4170
+ /**
4171
+ * When true the text will be rendered using the provided curve.
4172
+ */
4173
+ curved?: boolean;
4174
+ /**
4175
+ * The curve to use when curved = true. Ignored otherwise.
4176
+ */
4177
+ paths?: string[];
4178
+ /**
4179
+ * The algorithm to use when laying out text.
4180
+ */
4181
+ algorithm?: TextAlgorithm;
4182
+ fillSpotColorDefinition?: SpotColorDefinition;
4183
+ }
4184
+ interface FontData {
4185
+ assetUrl: string;
4186
+ name: string;
4187
+ }
4188
+ /**
4189
+ * Contains configuration for font sizing.
4190
+ *
4191
+ * When min/maxSize values are set we interpret the textbox as being
4192
+ * in "Variable Mode" which essentially
4193
+ * auto sizes the text based on a given region.
4194
+ *
4195
+ * When only size is set, we interpret the textbox as being in "Fixed Mode" where
4196
+ * text is computed at a fixed font size.
4197
+ */
4198
+ interface SizeRange {
4199
+ /**
4200
+ * Variable Mode: A maximum size
4201
+ */
4202
+ maxSize?: number;
4203
+ /**
4204
+ * Variable Mode: Minimum Size
4205
+ */
4206
+ minSize?: number;
4207
+ /**
4208
+ * Fixed Mode: A Fixed font size to be used at all times.
4209
+ */
4210
+ size: number;
4211
+ }
4212
+ interface ColorDefinition {
4213
+ /**
4214
+ * Represents the color value in hex or any other
4215
+ * browser supported format. This will be used when rendering the canvas
4216
+ * in an environment that doesn't support spot color.
4217
+ */
4218
+ browserValue: string;
4219
+ /**
4220
+ * A spot color definition. This is optional and will
4221
+ * be applied to the SVG returned by toString when configured allowing
4222
+ * filegen to output spot colors.
4223
+ */
4224
+ spotColor?: SpotColorDefinition;
4225
+ /**
4226
+ * Represents the color value in the PMS colorspace.
4227
+ */
4228
+ pmsValue?: string;
4229
+ }
4230
+ /**
4231
+ * A container for data related to a specific spotcolor. toString
4232
+ * can be used to output a string expected by Filegen inside a stroke or fill.
4233
+ */
4234
+ interface SpotColorDefinition {
4235
+ /**
4236
+ * The name of the profile being used.
4237
+ */
4238
+ profileName: string;
4239
+ /**
4240
+ * The named color expected by the profile.
4241
+ */
4242
+ namedColor: string;
4243
+ }
4244
+ /**
4245
+ * A container for data related to a specific spotcolor. toString
4246
+ * can be used to output a string expected by Filegen inside a stroke or fill.
4247
+ */
4248
+ interface SpotColorDefinition {
4249
+ /**
4250
+ * The name of the profile being used.
4251
+ */
4252
+ profileName: string;
4253
+ /**
4254
+ * The named color expected by the profile.
4255
+ */
4256
+ namedColor: string;
4257
+ }
4258
+ interface TextFillSpotColor$1 {
4259
+ profileName: string;
4260
+ namedColor: string;
4261
+ }
4262
+ interface PatternImageData {
4263
+ /**
4264
+ * The original src of the image.
4265
+ */
4266
+ src: string;
4267
+ /**
4268
+ * The natural width of the image.
4269
+ */
4270
+ width: number;
4271
+ /**
4272
+ * The natural height of the image.
4273
+ */
4274
+ height: number;
4275
+ /**
4276
+ * Cached result of the calculation width/height.
4277
+ */
4278
+ aspect: number;
4279
+ /**
4280
+ * The SVG document that the src represents. This must be the actual content string of the document, rather than a URL.
4281
+ */
4282
+ svg?: string;
4283
+ /**
4284
+ * A map of ID to color code, used to store color selections in the SVG. Only applicable when `svg` is provided.
4285
+ */
4286
+ colors?: {
4287
+ [key: string]: ColorDefinition;
4288
+ };
2844
4289
  }
2845
- type ProductCollectionResource = {
2846
- id: string;
2847
- globalPropertyConfiguration?: GlobalPropertyConfiguration;
2848
- productCollectionProducts?: ProductCollectionProductResource[];
2849
- name: string;
2850
- description?: string;
2851
- image?: Asset;
2852
- transformCollection?: TransformCollection;
2853
- };
2854
- type ProductCollectionProductResource = {
2855
- id: string;
2856
- productCollection?: ProductCollectionResource;
2857
- productCollectionId?: string;
2858
- product: Product;
2859
- productId: string;
2860
- workflowId?: string;
2861
- };
2862
- type GlobalPropertyState = {
2863
- id: string;
2864
- aspects: GlobalPropertyStateAspect[];
2865
- };
2866
- type GlobalPropertyStateAspect = {
2867
- name: string;
2868
- value: string;
2869
- type?: AspectType;
2870
- storage?: GlobalPropertyStateAspectStorage;
2871
- };
2872
- type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage | GlobalPropertyStateColorOptionStorage;
2873
- type GlobalPropertyStateFileUploadStorage = {
2874
- originalAssetKey?: string;
2875
- backgroundRemovedAssetKey?: string;
2876
- useOriginalAsset?: boolean;
2877
- };
2878
- type GlobalPropertyStateColorOptionStorage = {
2879
- customColor?: string;
2880
- };
2881
- interface BundleStateTransform {
2882
- position: Vector3;
2883
- rotation: Vector3;
2884
- scale: Vector3;
4290
+ /**
4291
+ * Defines the direction of scaling, can be used
4292
+ * to determine the anchor point of a scale calculation.
4293
+ */
4294
+ declare enum ScaleAxis {
4295
+ North = 0,
4296
+ Northeast = 1,
4297
+ East = 2,
4298
+ Southeast = 3,
4299
+ South = 4,
4300
+ Southwest = 5,
4301
+ West = 6,
4302
+ Northwest = 7
2885
4303
  }
2886
- interface Vector3 {
4304
+ /**
4305
+ * A point in a 2D coordinate space.
4306
+ */
4307
+ interface Point {
2887
4308
  x: number;
2888
4309
  y: number;
2889
- z: number;
2890
4310
  }
2891
- interface TransformCollection {
4311
+ interface Workflow {
4312
+ defaultPreviewPanelIndex?: number;
4313
+ deletedAt?: Date;
2892
4314
  id: string;
4315
+ previewAssetKey?: string;
4316
+ previewImageUrl?: string;
2893
4317
  name: string;
2894
- transforms: TransformCollectionTransform[];
4318
+ introduction: string;
4319
+ panels: WorkflowPanel[];
4320
+ showModelOnFinishStep: boolean;
4321
+ showPricing?: boolean;
4322
+ baseCurrency?: string;
4323
+ showPlusInVariantPrices?: boolean;
4324
+ allowProofDownload: boolean;
4325
+ steps: Step<AnyStepData>[];
4326
+ stepGroups: StepGroup[];
4327
+ theme?: {
4328
+ primaryColour: string;
4329
+ textColour: string;
4330
+ };
4331
+ globalPreviewConfig?: PreviewConfiguration;
4332
+ finalizeStepConfig?: FinalizeStepConfig;
4333
+ partnerId?: string;
4334
+ toggleBulkSourceView?: boolean;
4335
+ overrideTheme?: Theme;
4336
+ globalPropertyConfiguration?: GlobalPropertyConfiguration;
2895
4337
  }
2896
- interface TransformCollectionTransform {
2897
- id: string;
4338
+ interface WorkflowPanel {
4339
+ height: number;
4340
+ width: number;
2898
4341
  name: string;
2899
- position: Vector3;
2900
- rotation: Vector3;
2901
- scale: Vector3;
2902
- }
2903
- type Extendable<T> = T & {
2904
- [key: string]: any;
2905
- };
2906
- interface Metafield {
2907
- id: string;
2908
- createdAt: string;
2909
- updatedAt: string;
2910
- entityId: string;
2911
- value: string;
2912
- metafieldConfiguration: MetafieldConfiguration;
4342
+ index: number;
4343
+ transparentBackground?: boolean;
4344
+ previewRegion?: PreviewRegion;
4345
+ useEditableArea?: boolean;
4346
+ editableArea?: {
4347
+ x: number;
4348
+ y: number;
4349
+ height: number;
4350
+ width: number;
4351
+ };
2913
4352
  }
2914
- interface MetafieldConfiguration {
2915
- id: string;
2916
- createdAt: string;
2917
- updatedAt: string;
2918
- entityType: string;
2919
- metafieldType: string;
4353
+ interface StepGroup {
4354
+ id?: string;
2920
4355
  name: string;
4356
+ stepNames: string[];
4357
+ }
4358
+ interface FinalizeStepConfig {
4359
+ termsMarkdown?: string;
4360
+ modelAnimation?: ModelAnimation;
4361
+ lookAtAnimation?: CameraAnimation;
4362
+ previewRegion?: {
4363
+ left: number;
4364
+ top: number;
4365
+ width: number;
4366
+ height: number;
4367
+ };
4368
+ }
4369
+ interface PreviewRegion {
4370
+ top: number;
4371
+ left: number;
4372
+ width: number;
4373
+ height: number;
4374
+ }
4375
+ interface PreviewRegion {
4376
+ top: number;
4377
+ left: number;
4378
+ width: number;
4379
+ height: number;
4380
+ }
4381
+ interface ModelAnimation {
4382
+ /**
4383
+ * A value it seconds along the animation timeline to begin at.
4384
+ */
4385
+ from?: number;
4386
+ /**
4387
+ * A value in seconds along the animation timeline to end at.
4388
+ */
4389
+ to?: number;
4390
+ /**
4391
+ * When true the animation will loop. The only behaviour currently is to reset
4392
+ * back to from but we could have it bounce back and forth and/or follow a curve.
4393
+ */
4394
+ loop?: boolean;
4395
+ /**
4396
+ * The name of the animation to play.
4397
+ */
4398
+ name?: string;
4399
+ }
4400
+ /**
4401
+ * A CameraAnimation specifies a discrete state that the camera should
4402
+ * animate to. This state represents the final position of the camera after animations have run.
4403
+ */
4404
+ interface CameraAnimation {
4405
+ /**
4406
+ * The longitutude in degrees the camera should animate to.
4407
+ */
4408
+ lonDeg: number;
4409
+ /**
4410
+ * The lattitude in degrees the camera should animnate to.
4411
+ */
4412
+ latDeg: number;
4413
+ /**
4414
+ * An optional target for the camera to focus on in the scene.
4415
+ */
4416
+ target?: {
4417
+ x: number;
4418
+ y: number;
4419
+ z: number;
4420
+ };
4421
+ /**
4422
+ * A value in scene units specifying camera distance from the target.
4423
+ */
4424
+ radius?: number;
4425
+ }
4426
+ /**
4427
+ * Settings related to the 3D preview for use at either a global level or at per step level. The global
4428
+ * values can be a default if per step values aren't specified.
4429
+ */
4430
+ interface PreviewConfiguration {
4431
+ /**
4432
+ * @deprecated Removed in favor of backgroundColor as a simple hexadecimal color value.
4433
+ */
4434
+ clearColor?: [number, number, number];
4435
+ /**
4436
+ * The color expected to be seen in the background of the product
4437
+ */
4438
+ backgroundColor?: string;
4439
+ /**
4440
+ * The closest zoom the camera can achieve to the product.
4441
+ */
4442
+ maxZoomOverride?: number;
4443
+ /**
4444
+ * The furthest zoom the camera can achieve to the product.
4445
+ */
4446
+ minZoomOverride?: number;
4447
+ /**
4448
+ * The environment file used to calculate product lighting.
4449
+ */
4450
+ environmentFile?: string;
4451
+ /**
4452
+ * The lowest point, vertically, that the camera can rotate to.
4453
+ * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
4454
+ */
4455
+ lowerBetaLimitDeg?: number;
4456
+ /**
4457
+ * The highest point, vertically, that the camera can rotate to.
4458
+ * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
4459
+ */
4460
+ upperBetaLimitDeg?: number;
4461
+ /**
4462
+ * The leftmost point, horizontally, that the camera can rotate to.
4463
+ * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
4464
+ */
4465
+ lowerAlphaLimitDeg?: number;
4466
+ /**
4467
+ * The rightmost point, horizontally, that the camera can rotate to.
4468
+ * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
4469
+ */
4470
+ upperAlphaLimitDeg?: number;
4471
+ /**
4472
+ * When set the product while rotate slowly
4473
+ */
4474
+ autoRotation?: boolean;
4475
+ /**
4476
+ * Time in milliseconds before the product starts rotating after a user input has taken control.
4477
+ */
4478
+ idleTimeBeforeRotation?: number;
4479
+ /**
4480
+ * When set the 3D preview won't attempt to orient the product automatically to its front view at load.
4481
+ */
4482
+ disableAutomaticOrientation?: boolean;
4483
+ /**
4484
+ * When true the action bar won't be displayed to the user.
4485
+ */
4486
+ disableActionBar?: boolean;
4487
+ /**
4488
+ * When true the AR button will be displayed to the user.
4489
+ */
4490
+ enableAR?: boolean;
4491
+ }
4492
+ declare enum UnitOfMeasurement {
4493
+ Pixel = "px",
4494
+ Millimeter = "mm",
4495
+ Centimeter = "cm"
4496
+ }
4497
+ type PapyrusComponent<T = any> = FunctionComponent<T>;
4498
+ type PapyrusNode = ReactNode;
4499
+
4500
+ declare class OptionService {
4501
+ /**
4502
+ * Allows for retrieving an option, returns the option from a cache if possible.
4503
+ * @param id The option ID to be retrieved.
4504
+ */
4505
+ getOption(id: string): Promise<undefined | OptionResource>;
4506
+ getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
4507
+ getDefaultVariant(option: OptionResource): VariantResource | undefined;
4508
+ /**
4509
+ * Returns the first variant marked as selected. This is used by most steps.
4510
+ */
4511
+ getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
4512
+ }
4513
+ declare const optionService: OptionService;
4514
+
4515
+ declare const setBearerAuthenticationToken: (token: string) => void;
4516
+ declare class GraphQlManager {
4517
+ private shadowGraphqlClient;
4518
+ constructor();
4519
+ getShadowGraphqlClient(): ApolloClient<any>;
4520
+ private constructShadowGraphqlClient;
2921
4521
  }
4522
+ declare const graphQlManager: GraphQlManager;
2922
4523
 
2923
4524
  interface StorageService {
2924
4525
  /**
@@ -3284,17 +4885,17 @@ declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
3284
4885
  * @returns A list of color definitions that are currently applied to the illustration.
3285
4886
  */
3286
4887
  getColors(): {
3287
- [key: string]: _spiffcommerce_papyrus.ColorDefinition;
4888
+ [key: string]: ColorDefinition;
3288
4889
  } | undefined;
3289
4890
  /**
3290
4891
  * Set color for the illustration.
3291
4892
  */
3292
4893
  setColor(key: string, value: string): Promise<void>;
3293
- getColorOption(): Promise<_spiffcommerce_papyrus.OptionResource | undefined>;
4894
+ getColorOption(): Promise<OptionResource | undefined>;
3294
4895
  getAvailableColors(): Promise<{
3295
4896
  fill: string | undefined;
3296
4897
  stroke: string | undefined;
3297
- variant: _spiffcommerce_papyrus.VariantResource;
4898
+ variant: VariantResource;
3298
4899
  }[] | undefined>;
3299
4900
  isColorPickerEnabled(): boolean;
3300
4901
  }
@@ -3367,7 +4968,7 @@ declare class TextStepHandle extends StepHandle<TextStepData> implements CustomC
3367
4968
  */
3368
4969
  clearDefaultTextIfNecessary(): TextChangeResult | undefined;
3369
4970
  hasColorPicker(): boolean | undefined;
3370
- getRegions(): _spiffcommerce_papyrus.Region[];
4971
+ getRegions(): Region[];
3371
4972
  /**
3372
4973
  * Return the maximum characters allowed for
3373
4974
  * this step, or undefined if there is no limit.
@@ -3480,7 +5081,7 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
3480
5081
  constructor(manager: WorkflowManager, step: Step<FrameStepData>, tags: string[]);
3481
5082
  private frameService;
3482
5083
  selectVariant(variant: Variant): Promise<void>;
3483
- onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
5084
+ onFrameDataChanged(callback: (frameData: FrameData[]) => void): void;
3484
5085
  /**
3485
5086
  * Updates the image selection inside the frame.
3486
5087
  * @param asset The asset to use.
@@ -3504,7 +5105,7 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
3504
5105
  removeBackgroundFromImageSelection(applyNewAsset?: boolean): Promise<Asset>;
3505
5106
  changeColors(newFills: Map<string, ColorDefinition>): void;
3506
5107
  getImageData(): PatternImageData | undefined;
3507
- getColorOption(): Promise<_spiffcommerce_papyrus.OptionResource | undefined>;
5108
+ getColorOption(): Promise<OptionResource | undefined>;
3508
5109
  getAvailableColors(): Promise<ColorOption[]>;
3509
5110
  isColorPickerEnabled(): boolean;
3510
5111
  getOriginalImageColors(): Promise<{
@@ -3512,7 +5113,7 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
3512
5113
  } | undefined>;
3513
5114
  getMaxAllowedColors(): number | undefined;
3514
5115
  getUniqueColorCount(): number;
3515
- getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
5116
+ getCurrentFrameStep(frameData: FrameData, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
3516
5117
  getFrameService(): FrameService | undefined;
3517
5118
  hasOverlayImageKey(): string | undefined;
3518
5119
  hasOverlayImageUrl(): any;
@@ -3557,7 +5158,7 @@ declare class ShapeStepHandle extends StepHandle<ShapeStepData> implements Custo
3557
5158
  getColors(): Promise<{
3558
5159
  fill: string | undefined;
3559
5160
  stroke: string | undefined;
3560
- variant: _spiffcommerce_papyrus.VariantResource;
5161
+ variant: VariantResource;
3561
5162
  }[]>;
3562
5163
  /**
3563
5164
  * Allows for setting a custom color when the custom variant is selected. Will
@@ -3629,6 +5230,13 @@ declare function findPmsColors(input: string, limit?: number): PmsSearchResult[]
3629
5230
  * @returns
3630
5231
  */
3631
5232
  declare function browserColorToHex(color: string): string;
5233
+ /**
5234
+ * Converts a color value found in an SVG file into a color definition. This
5235
+ * logic will split out the browser value eg. "#ffffff" and the spot color value if available eg.
5236
+ * icc-named-color(cub, PANTONE_AAA_100_C)
5237
+ * @param value A color definition based on the data provided in the value.
5238
+ */
5239
+ declare const svgColorValueToDefinition: (value: string) => ColorDefinition;
3632
5240
 
3633
5241
  /**
3634
5242
  * The digital content step allows for associating uploaded content with a QR code. This code
@@ -3667,4 +5275,193 @@ declare class ModuleStepHandle extends StepHandle<ModuleStepData> {
3667
5275
  setText(value: string): void;
3668
5276
  }
3669
5277
 
3670
- 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, DigitalContentStepHandle, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, Integration, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, ModuleStepHandle, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, ParseError, PictureStepHandle, PmsSearchResult, 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, TextChangeResult, TextGlobalPropertyHandle, TextInput, TextStepHandle, TextStepStorage, ToastCallback, Transaction, TransactionShareAction, TransactionShareActionType, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, browserColorToHex, createDesign, designService, digitalContentStepService, findPmsColors, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, matchHexToPms, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, pmsToRgb, questionStepService, rgbToPms, setBearerAuthenticationToken, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
5278
+ declare class LayoutElementFactory {
5279
+ static getFrame(layout: LayoutData, opts: {
5280
+ region?: Region;
5281
+ configuration: Partial<FrameStepData>;
5282
+ src?: string;
5283
+ }): Promise<FrameElement>;
5284
+ static getImage(layout: LayoutData, opts: {
5285
+ region?: Region;
5286
+ layout?: LayoutData;
5287
+ configuration: Partial<PictureStepData>;
5288
+ src: string;
5289
+ }): Promise<ImageElement>;
5290
+ static getTextbox(layout: LayoutData, opts: {
5291
+ region?: Region;
5292
+ configuration: Partial<TextStepData>;
5293
+ fontSrc: string;
5294
+ designInputStep?: any;
5295
+ }): Promise<TextboxElement>;
5296
+ static getShape(layout: LayoutData, opts: {
5297
+ region?: Region;
5298
+ color: string;
5299
+ }): Promise<IllustrationElement>;
5300
+ static getIllustration(layout: LayoutData, opts: {
5301
+ region?: Region;
5302
+ src: string;
5303
+ }): Promise<IllustrationElement>;
5304
+ }
5305
+
5306
+ /**
5307
+ * We use this to register a window in environments where one wouldn't be available.
5308
+ */
5309
+ declare function registerWindowImplementation(impl: any): void;
5310
+ declare function registerFetchImplementation(impl: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>): void;
5311
+ declare const fetchAsString: (externalUrl: string, allowCache?: boolean) => Promise<string>;
5312
+ declare const xmlSerializer: () => XMLSerializer;
5313
+ declare const dataUrlFromExternalUrl: (url: string) => Promise<string>;
5314
+ declare const svgToDataUrl: (svgString: string) => string;
5315
+
5316
+ declare const findElement: <T extends LayoutElement>(id: string, layouts: LayoutState[]) => T;
5317
+ declare const rehydrateSerializedLayout: (transactionState: LayoutsState, variationState?: LayoutsState) => Promise<void>;
5318
+
5319
+ /**
5320
+ * A map of src to pattern image data.
5321
+ */
5322
+ declare const patternImageDataCache: Map<string, PatternImageData>;
5323
+ /**
5324
+ * A map of frame path to frame data relevant to that path.
5325
+ */
5326
+ declare const frameDataCache: Map<string, FrameData>;
5327
+ declare const getFrameData: (frameSvg: string) => Promise<FrameData>;
5328
+ /**
5329
+ * Return the dimensions of an SVG string.
5330
+ */
5331
+ declare const svgStringDimensions: (svgText: string) => {
5332
+ width: number;
5333
+ height: number;
5334
+ };
5335
+
5336
+ declare const generate: () => string;
5337
+
5338
+ /**
5339
+ * Returns an axis aligned bounding box for a given element.
5340
+ * @param element The element to calculate an AABB for.
5341
+ * @returns The AABB for the element.
5342
+ */
5343
+ declare const getAxisAlignedBoundingBox: (x: number, y: number, width: number, height: number, rotation: number) => {
5344
+ minX: number;
5345
+ maxX: number;
5346
+ minY: number;
5347
+ maxY: number;
5348
+ };
5349
+ declare const findAngle: (a: Point, b: Point, c: Point) => number;
5350
+ /**
5351
+ * @param a The first value.
5352
+ * @param b The second value.
5353
+ * @returns Returns true if two values are within a distance to each other.
5354
+ */
5355
+ declare const isCloseToValue: (a: number, b: number, allowableDistance: number) => boolean;
5356
+ declare const getTrueCoordinates: (point: Point, pointOfRotation: Point, rotation: number) => Point;
5357
+ declare const getPointOfRotation: (nwPoint: Point, sePoint: Point) => Point;
5358
+ declare const getNWPoint: (bounds: DOMRect, element: LayoutElement, scaleX: number, scaleY: number) => Point;
5359
+ declare const getNEPoint: (bounds: DOMRect, element: LayoutElement, scaleX: number, scaleY: number) => Point;
5360
+ declare const getSEPoint: (bounds: DOMRect, element: LayoutElement, scaleX: number, scaleY: number) => Point;
5361
+ declare const currentDirection: (originalDirection: ScaleAxis, rotation: number) => ScaleAxis;
5362
+ /**
5363
+ * Computes helpful values about a rotated element, Useful in calculating updated element locations.
5364
+ * @param element The element to calculate the vertices for.
5365
+ * @returns a, b, c, d starting from top left and moving clockwise. Center represents the point central to
5366
+ * all vertices on thge element.
5367
+ */
5368
+ declare const getElementVertices: (element: {
5369
+ x: number;
5370
+ y: number;
5371
+ width: number;
5372
+ height: number;
5373
+ rotation: number;
5374
+ }, canvasBounds?: Point, scale?: Point) => {
5375
+ a: {
5376
+ x: number;
5377
+ y: number;
5378
+ };
5379
+ b: {
5380
+ x: number;
5381
+ y: number;
5382
+ };
5383
+ c: {
5384
+ x: number;
5385
+ y: number;
5386
+ };
5387
+ d: {
5388
+ x: number;
5389
+ y: number;
5390
+ };
5391
+ center: Point;
5392
+ };
5393
+ /**
5394
+ * Rotates a point around another point by an angle.
5395
+ * @param p The point to rotate.
5396
+ * @param c The point to rotate around..
5397
+ * @param angleRadians The angle to rotate.
5398
+ * @returns A new point transformed by the rotation.
5399
+ */
5400
+ declare const rotateAroundPoint: (p: Point, c: Point, angleRadians: number) => {
5401
+ x: number;
5402
+ y: number;
5403
+ };
5404
+
5405
+ declare const mmPerPixel = 0.352778;
5406
+ declare const cmPerPixel = 0.035277;
5407
+
5408
+ declare const sanitizeSvgTree: (root: Element, preserveAspectRatio?: boolean) => void;
5409
+ declare const generateSVGWithUnknownColors: (svgBody: string) => Promise<{
5410
+ svg: string;
5411
+ colors: {
5412
+ [key: string]: ColorDefinition;
5413
+ };
5414
+ }>;
5415
+
5416
+ interface CustomImage {
5417
+ height: number;
5418
+ naturalHeight: number;
5419
+ naturalWidth: number;
5420
+ src: string | ArrayBuffer;
5421
+ width: number;
5422
+ }
5423
+ interface CustomContext {
5424
+ drawImage(image: CustomCanvas | CustomImage, dx: number, dy: number): void;
5425
+ drawImage(image: CustomCanvas | CustomImage, dx: number, dy: number, dw: number, dh: number): void;
5426
+ drawImage(image: CustomCanvas | CustomImage, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
5427
+ rotate(angle: number): void;
5428
+ scale(x: number, y: number): void;
5429
+ translate(x: number, y: number): void;
5430
+ }
5431
+ interface CustomCanvas {
5432
+ height: number;
5433
+ getContext(type: string): CustomContext | null;
5434
+ toDataURL(): string;
5435
+ toDataURL(type?: string, quality?: number): string;
5436
+ width: number;
5437
+ }
5438
+ declare const createCanvas: (width?: number, height?: number, type?: "pdf" | "svg") => CustomCanvas;
5439
+ declare const loadImage: (src: string | ArrayBuffer, allowCrossOrigin?: boolean) => Promise<CustomImage>;
5440
+ interface CustomCanvasModule {
5441
+ createCanvas: typeof createCanvas;
5442
+ loadImage: typeof loadImage;
5443
+ }
5444
+ declare function setCanvasModule(module?: CustomCanvasModule): void;
5445
+
5446
+ declare const getAttributesFromArrayBuffer: (arrayBuffer: ArrayBuffer) => Promise<{
5447
+ dataUrl: string;
5448
+ height: number;
5449
+ width: number;
5450
+ }>;
5451
+
5452
+ /**
5453
+ * Determine what the font size for a text element should be,
5454
+ * taking autosizing into account.
5455
+ * @Deprecated Old Text system, Transition to new system when Autosizing has been brought across in a way that makes sense.
5456
+ */
5457
+ declare const determineCorrectFontSizeAndLines: (curFontSize: number, fontData: FontData, region: Region, linesToBreak: string[], sizeRange: SizeRange) => [number, null | string[], null | number];
5458
+
5459
+ /**
5460
+ * A function for loading and caching a font
5461
+ * @param url The URL to load either a web URL or dataURL
5462
+ * @param buffer An optional array buffer for the resource if available
5463
+ * @returns An opentype font object.
5464
+ */
5465
+ declare const loadFont: (url: string) => Promise<Font>;
5466
+
5467
+ export { AddonHandle, Animatable, AnyStepData, ArrayInput, AspectType, Asset, AssetNotFoundError, AssetObjectVersion, AssetType, BringForwardCommand, BringToBackCommand, BringToFrontCommand, Bundle$1 as Bundle, BundleDesignCreationMessage, BundleEvent, BundleEventData, BundleEventType, CanvasCommand, CollectionProduct, ColorDefinition, ColorOption, ColorOptionGlobalPropertyHandle, ColorProfileProps, CommandContext, CommandState, Condition, ConditionalGlobalPropertiesChangedEventData, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, CreateElementCommand, CreateLayoutCommand, Customer, CustomerDetailsInput, DeleteElementCommand, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, DigitalContentStepData, DigitalContentStepHandle, EditedSteps, FileUploadGlobalPropertyHandle, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FontAlignmentCommand, FontColorCommand, FontSizeCommand, FontSourceCommand, FrameElement, FrameService, FrameStep, FrameStepData, FrameStepHandle, FrameThresholdSettings, GetNewWorkflowOptions, GetWorkflowOptions, GlobalPropertyConfiguration, GlobalPropertyHandle, GroupCommand, ILayout, IllustrationElement, IllustrationStepData, IllustrationStepHandle, ImageElement, InformationMessageType, InformationResult, InformationStepData, InformationStepHandle, Integration, IntegrationOptionResource, IntegrationProduct, IntegrationType, LayoutData, LayoutElement, LayoutElementFactory, LayoutElementType, LayoutNotFoundError, LayoutRenderingPurpose, LayoutState, LayoutsState, MandatorySteps, MaterialEffectMode, MaterialStepData, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepData, ModelStepHandle, ModuleStepData, ModuleStepHandle, MoveCommand, NodeType, ObjectInput, ObjectInputType, OptionGlobalPropertyHandle, OptionNotFoundError, OptionResource, PapyrusComponent, ParseError, PictureStepData, PictureStepHandle, Placeable, PmsSearchResult, Point, Product, ProductCameraRig, ProductCollection, ProductWorkflow$1 as ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepData, QuestionStepHandle, QueueablePromise, Region, RegionElement, RenderableScene, ResizeCommand, ResourceNotFoundError, RotateCommand, SavedDesign, ScaleAxis, SelectionStorage, SendBackwardsCommand, ShapeStepData, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, Step, StepAspect, StepAspectType, StepElements, StepGroup, StepHandle, StepStorage, StepType, TextAlgorithm, TextChangeCommand, TextChangeResult, TextGlobalPropertyHandle, TextInput, TextStepData, TextStepHandle, TextStepStorage, TextboxElement, Theme, ToastCallback, Transaction, TransactionShareAction, TransactionShareActionType, Transform, TransformCollection$1 as TransformCollection, UnhandledBehaviorError, UnitOfMeasurement, UpdateImageSourceCommand, Variant, VariantResource, Vector3, Workflow, WorkflowExperience, WorkflowExperienceEventType, WorkflowExperienceHoverEventData, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowPanel, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, browserColorToHex, cmPerPixel, createDesign, currentDirection, dataUrlFromExternalUrl, designService, determineCorrectFontSizeAndLines, digitalContentStepService, fetchAsString, findAngle, findElement, findPmsColors, frameDataCache, frameStepService, generate, generateCommands, generateSVGWithUnknownColors, generateStateFromDesignInputSteps, getAttributesFromArrayBuffer, getAxisAlignedBoundingBox, getBoundedOffsets, getElementVertices, getFrameData, getNEPoint, getNWPoint, getPointOfRotation, getSEPoint, getSvgElement, getTrueCoordinates, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, isCloseToValue, loadFont, matchHexToPms, materialStepService, mmPerPixel, modelStepService, moduleStepService, optionService, patternImageDataCache, persistenceService, pictureStepService, pmsToRgb, questionStepService, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout, rgbToPms, rotateAroundPoint, sanitizeSvgTree, setBearerAuthenticationToken, setCanvasModule, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, svgColorValueToDefinition, svgStringDimensions, svgToDataUrl, textStepService, toast, xmlSerializer };