@spiffcommerce/core 23.0.5 → 24.0.0

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