@spiffcommerce/core 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +4 -314
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { StepAspect, Workflow, AnyStepData, Step, Asset, AssetType, IServerModel, MaterialResource, IllustrationStepData, VariantResource, DigitalContentStepData, FrameStepData, MaterialStepData, ModelStepData, ModuleStepData, PatchworkStepData, PictureStepData, QuestionStepData, ShapeStepData, TextStepData as _TextStepData1,
|
|
1
|
+
import { StepAspect, Workflow, AnyStepData, Step, Asset, AssetType, IServerModel, MaterialResource, IllustrationStepData, VariantResource, DigitalContentStepData, FrameStepData, MaterialStepData, ModelStepData, ModuleStepData, PatchworkStepData, PictureStepData, QuestionStepData, ShapeStepData, TextStepData as _TextStepData1, OptionResource, StepType, TextStepData } from "papyrus/build/main/generation/Workflow";
|
|
2
2
|
import { PatternImageData, FrameData as _FrameData1, Point, ScaleAxis, UnitOfMeasurement } from "papyrus/build/main/types";
|
|
3
3
|
import { FrameOffsets, ColorDefinition, ILayout, IllustrationElement as _IllustrationElement1, LayoutsState as _LayoutsState1, Region, FrameElement as _FrameElement1, PatchworkOffsets, TextboxElement as _TextboxElement1, FontData, SerializableStep, StepStorage, FrameElement, IllustrationElement, LayoutElement, LayoutsState, PatchworkElement, TextboxElement, ImageElement } from "papyrus/build/main/LayoutsState/types";
|
|
4
4
|
import { ApolloClient } from "@apollo/client";
|
|
5
5
|
import { CanvasCommand, CreateElementCommand as _CreateElementCommand1, GroupCommand, CreateElementCommand, FontAlignmentCommand, FontColorCommand, TextChangeCommand } from "papyrus/build/main/command";
|
|
6
6
|
import { LayoutData as _LayoutData1, CommandState, CommandContext as _CommandContext1, CommandContext, LayoutData } from "papyrus/build/main/CommandContext";
|
|
7
7
|
import { ModuleProduct } from "papyrus/build/main/module/ModuleProduct";
|
|
8
|
+
import { ThreeDPreviewService as _ThreeDPreviewService1, LoadProgressEventData, ProductCameraRig, SpiffCommerce3DPreviewService, ThreeDPreviewService } from "spiff-preview";
|
|
8
9
|
import { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent, MouseEvent } from "react";
|
|
9
|
-
import { ThreeDPreviewService as _ThreeDPreviewService2, LoadProgressEventData, ProductCameraRig, SpiffCommerce3DPreviewService, ThreeDPreviewService } from "spiff-preview";
|
|
10
10
|
import { LayoutElementFactory } from "papyrus/build/main/Elements/factory";
|
|
11
11
|
export const gatherVaryingStepAspects: (workflow: Workflow) => StepAspect[];
|
|
12
12
|
export interface WorkflowScene {
|
|
@@ -760,316 +760,6 @@ interface FrameData {
|
|
|
760
760
|
*/
|
|
761
761
|
height: number;
|
|
762
762
|
}
|
|
763
|
-
type _ThreeDPreviewService1 = {
|
|
764
|
-
/**
|
|
765
|
-
* Allows listeners to be aware of the camera losing focus of the
|
|
766
|
-
* main product.
|
|
767
|
-
* @param listener A function to be called when focus is lost.
|
|
768
|
-
*/
|
|
769
|
-
registerFocusLostListener(listener: () => void): void;
|
|
770
|
-
/**
|
|
771
|
-
* Removes a listener from the focusLost observers. The listener will
|
|
772
|
-
* no longer be notified
|
|
773
|
-
* @param listener The listener to remove.
|
|
774
|
-
*/
|
|
775
|
-
unregisterFocusLostListener(listener: () => void): void;
|
|
776
|
-
/**
|
|
777
|
-
* Providers listeners with information about load progress when
|
|
778
|
-
* the preview is loading scenes.
|
|
779
|
-
* @param listener A function to get load progress updates
|
|
780
|
-
*/
|
|
781
|
-
registerLoadProgressListener(listener: (e: _LoadProgressEventData1) => void): void;
|
|
782
|
-
/**
|
|
783
|
-
* Allows you to pass any function that originally called registerLoadProgressListener()
|
|
784
|
-
* to have it excluded from load progress updates.
|
|
785
|
-
* If the function was never registered this call has no effect.
|
|
786
|
-
* @param listener The listener to exclude from load progress.
|
|
787
|
-
*/
|
|
788
|
-
unregisterLoadProgressListener(listener: (e: _LoadProgressEventData1) => void): void;
|
|
789
|
-
/**
|
|
790
|
-
* Request that the scene renders to a given canvas
|
|
791
|
-
* @param canvas The canvas we should render to.
|
|
792
|
-
*/
|
|
793
|
-
registerView(canvas: HTMLCanvasElement): void;
|
|
794
|
-
/**
|
|
795
|
-
* Returns the number of active viewers of the scene. Useful for
|
|
796
|
-
* avoiding unnecessary rendering when there are no active viewers.
|
|
797
|
-
*/
|
|
798
|
-
getNumViewports(): number;
|
|
799
|
-
/**
|
|
800
|
-
* Tells babylon that we no longer want the given canvas to be rendered to.
|
|
801
|
-
* @param canvas The canvas to be excluded from rendering.
|
|
802
|
-
*/
|
|
803
|
-
unregisterView(canvas: HTMLCanvasElement): void;
|
|
804
|
-
/**
|
|
805
|
-
* Shutdown the preview engine. Noop if the engine is not initialized.
|
|
806
|
-
*/
|
|
807
|
-
shutdown(): void;
|
|
808
|
-
/**
|
|
809
|
-
* Initialize the scene. Also initialize the engine, if it hasn't been done already.
|
|
810
|
-
*/
|
|
811
|
-
initialize(src: string, contextService?: RenderableContextService): Promise<void>;
|
|
812
|
-
/**
|
|
813
|
-
* Executes an animation in the currently loaded scene.
|
|
814
|
-
* @param animation The current animation track to run.
|
|
815
|
-
*/
|
|
816
|
-
executeModelAnimation(animation: ModelAnimation): void;
|
|
817
|
-
/**
|
|
818
|
-
* Executes an animation of the camera.
|
|
819
|
-
* @param animation The animation to execute.
|
|
820
|
-
*/
|
|
821
|
-
executeCameraAnimation(animation: CameraAnimation): void;
|
|
822
|
-
/**
|
|
823
|
-
* Returns the values of the Arc Rotate Camera
|
|
824
|
-
*/
|
|
825
|
-
getCameraPose(): CameraPose | undefined;
|
|
826
|
-
/**
|
|
827
|
-
* Sets the values of the Arc Rotate Camera
|
|
828
|
-
*/
|
|
829
|
-
setCameraPose(cameraPose: CameraPose): void;
|
|
830
|
-
/**
|
|
831
|
-
* Applies a given material modifier to a target material in the scene.
|
|
832
|
-
* @param targetMaterial The material to target.
|
|
833
|
-
* @param key A unique key used to identify this action.
|
|
834
|
-
* @param material The material modifier to apply.
|
|
835
|
-
*/
|
|
836
|
-
applyMaterialVariant(targetMaterial: string, key: string, material: MaterialResource, removeWhenUndefined?: boolean): Promise<void>;
|
|
837
|
-
/**
|
|
838
|
-
* Applies a given model variant to the scene.
|
|
839
|
-
* @param key A unique key used to identify this action.
|
|
840
|
-
* @param modelDetails An asset containing a model file to be loaded into the scene.
|
|
841
|
-
*/
|
|
842
|
-
applyModelVariant(key: string, modelDetails: ModelDetails, replaceProductModel: boolean): Promise<void>;
|
|
843
|
-
/**
|
|
844
|
-
* Controls the current control state of the camera.
|
|
845
|
-
* @param rigType The control type to use.
|
|
846
|
-
*/
|
|
847
|
-
setCameraState(rigType: _ProductCameraRig1): void;
|
|
848
|
-
/**
|
|
849
|
-
* Restores the product camera to it's last set focus point. If the user has
|
|
850
|
-
* been panning this will animate the camera to the original focus point. If the camera is still
|
|
851
|
-
* focused on it's origin point this function is a noop.
|
|
852
|
-
*/
|
|
853
|
-
animateToLastCameraFocus(): Promise<void>;
|
|
854
|
-
/**
|
|
855
|
-
* When configuration has allowed for auto rotation we
|
|
856
|
-
* can pause the rotation via this function.
|
|
857
|
-
* @param shouldAutoRotate When true rotation is running, paused otherwise.
|
|
858
|
-
*/
|
|
859
|
-
setAutoRotation(shouldAutoRotate: boolean): void;
|
|
860
|
-
/**
|
|
861
|
-
* Get current load progress for the scene.
|
|
862
|
-
*/
|
|
863
|
-
getSceneInitializationProgress(): number;
|
|
864
|
-
/**
|
|
865
|
-
* Returns the current configuration object applied to the scene.
|
|
866
|
-
*/
|
|
867
|
-
getCurrentConfiguration(): PreviewOptions | undefined;
|
|
868
|
-
/**
|
|
869
|
-
* Takes a screenshot of the scene using a given
|
|
870
|
-
* camera animation otherwise using the existing orientation
|
|
871
|
-
* of the camera in the scene. A resolution must be provided
|
|
872
|
-
* to render the scene at.
|
|
873
|
-
*/
|
|
874
|
-
renderSceneScreenshot(resolution: number, cameraAnimation: CameraAnimation): Promise<string>;
|
|
875
|
-
/**
|
|
876
|
-
* Returns true when the current configuration allows the user
|
|
877
|
-
* to rotate around the product.
|
|
878
|
-
*/
|
|
879
|
-
orbitEnabled(): boolean;
|
|
880
|
-
/**
|
|
881
|
-
* When called will trigger the internal engine to match the current
|
|
882
|
-
* canvas size. This ensures the image renders correctly in the view and
|
|
883
|
-
* also prevents performance problems.
|
|
884
|
-
*/
|
|
885
|
-
fireResizeEvent(): void;
|
|
886
|
-
/**
|
|
887
|
-
* A callback when the user clicks in the scene and a material is hit.
|
|
888
|
-
*/
|
|
889
|
-
onMaterialSelected(cb: (material: MaterialHandle) => void): void;
|
|
890
|
-
/**
|
|
891
|
-
* Designed for use when utilizing the 3D preview in an editor format.
|
|
892
|
-
* List named materials that are available in the scene.
|
|
893
|
-
*/
|
|
894
|
-
listMaterials(): readonly MaterialHandle[];
|
|
895
|
-
/**
|
|
896
|
-
* Designed for use when utilizing the 3D preview in an editor format.
|
|
897
|
-
* Given a list of material names, highlights the associated meshes in the scene.
|
|
898
|
-
*/
|
|
899
|
-
setHighlights(materials: readonly MaterialHandle[], color?: readonly [number, number, number]): void;
|
|
900
|
-
};
|
|
901
|
-
/**
|
|
902
|
-
* Details relating to a model for use in the preview.
|
|
903
|
-
*/
|
|
904
|
-
type ModelDetails = {
|
|
905
|
-
readonly model?: string;
|
|
906
|
-
readonly contextService: RenderableContextService;
|
|
907
|
-
};
|
|
908
|
-
/**
|
|
909
|
-
* Represents a service capable of managing and returning contexts that
|
|
910
|
-
* can be used for rendering to textures in the 3D preview.
|
|
911
|
-
*/
|
|
912
|
-
type RenderableContextService = {
|
|
913
|
-
/**
|
|
914
|
-
* Returns all managed renderable contexts.
|
|
915
|
-
*/
|
|
916
|
-
getAll(): ReadonlyMap<string, RenderableContext>;
|
|
917
|
-
};
|
|
918
|
-
/**
|
|
919
|
-
* A renderable context represents the relationship of a texture in the 3D preview
|
|
920
|
-
* with an external canvas. This context allows external clients to render to a texture
|
|
921
|
-
* in the 3D preview with a simple interface.
|
|
922
|
-
*/
|
|
923
|
-
type RenderableContext = {
|
|
924
|
-
/**
|
|
925
|
-
* A unique identifier for this renderable context.
|
|
926
|
-
*/
|
|
927
|
-
getID(): string;
|
|
928
|
-
/**
|
|
929
|
-
* A name for this renderable.
|
|
930
|
-
*/
|
|
931
|
-
getName(): string;
|
|
932
|
-
/**
|
|
933
|
-
* Sets the render context associated to this renderable.
|
|
934
|
-
* @param ctx The context to use for rendering.
|
|
935
|
-
*/
|
|
936
|
-
setStaticContext(ctx: CanvasRenderingContext2D): void;
|
|
937
|
-
/**
|
|
938
|
-
* Get the render context associated to this renderable.
|
|
939
|
-
*/
|
|
940
|
-
getStaticContext(): CanvasRenderingContext2D | undefined;
|
|
941
|
-
/**
|
|
942
|
-
* Sets whether or not this renderable is dirty and will need re-rendering.
|
|
943
|
-
* @param value The new value
|
|
944
|
-
*/
|
|
945
|
-
setStaticContextDirty(value: boolean): void;
|
|
946
|
-
/**
|
|
947
|
-
* When this context has been set as dirty, returns true.
|
|
948
|
-
*/
|
|
949
|
-
getStaticContextDirty(): boolean;
|
|
950
|
-
/**
|
|
951
|
-
* A timestamp for the last successful render of the context.
|
|
952
|
-
*/
|
|
953
|
-
getLastCompletedStaticRender(): number | undefined;
|
|
954
|
-
};
|
|
955
|
-
/**
|
|
956
|
-
* Represents a handle to a material in the 3D scene. The underlying complexity of materials is abstracted
|
|
957
|
-
* away so the client doesn't need to know anything more than the ID they're given and the name.
|
|
958
|
-
*/
|
|
959
|
-
type MaterialHandle = {
|
|
960
|
-
/**
|
|
961
|
-
* The identifier for the material.
|
|
962
|
-
*/
|
|
963
|
-
readonly id: string;
|
|
964
|
-
/**
|
|
965
|
-
* The human readable name for the material.
|
|
966
|
-
*/
|
|
967
|
-
readonly name: string;
|
|
968
|
-
};
|
|
969
|
-
/**
|
|
970
|
-
* Settings related to the 3D preview.
|
|
971
|
-
*/
|
|
972
|
-
type PreviewOptions = {
|
|
973
|
-
/**
|
|
974
|
-
* The color expected to be seen in the background of the product. Expects a hexadecimal value.
|
|
975
|
-
*/
|
|
976
|
-
readonly backgroundColor?: string;
|
|
977
|
-
/**
|
|
978
|
-
* Image to be used as a background when running withh transparency, the image
|
|
979
|
-
* will be scaled and centered to fill the preview based on aspect ratio.
|
|
980
|
-
*/
|
|
981
|
-
readonly backgroundImage?: string;
|
|
982
|
-
/**
|
|
983
|
-
* The closest zoom the camera can achieve to the product.
|
|
984
|
-
*/
|
|
985
|
-
readonly maxZoomOverride?: number;
|
|
986
|
-
/**
|
|
987
|
-
* The furthest zoom the camera can achieve to the product.
|
|
988
|
-
*/
|
|
989
|
-
readonly minZoomOverride?: number;
|
|
990
|
-
/**
|
|
991
|
-
* The environment file used to calculate product lighting.
|
|
992
|
-
*/
|
|
993
|
-
readonly environmentFile?: string;
|
|
994
|
-
/**
|
|
995
|
-
* The lowest point, vertically, that the camera can rotate to.
|
|
996
|
-
* https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
|
|
997
|
-
*/
|
|
998
|
-
readonly lowerBetaLimitDeg?: number;
|
|
999
|
-
/**
|
|
1000
|
-
* The highest point, vertically, that the camera can rotate to.
|
|
1001
|
-
* https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
|
|
1002
|
-
*/
|
|
1003
|
-
readonly upperBetaLimitDeg?: number;
|
|
1004
|
-
/**
|
|
1005
|
-
* The leftmost point, horizontally, that the camera can rotate to.
|
|
1006
|
-
* https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
|
|
1007
|
-
*/
|
|
1008
|
-
readonly lowerAlphaLimitDeg?: number;
|
|
1009
|
-
/**
|
|
1010
|
-
* The rightmost point, horizontally, that the camera can rotate to.
|
|
1011
|
-
* https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction
|
|
1012
|
-
*/
|
|
1013
|
-
readonly upperAlphaLimitDeg?: number;
|
|
1014
|
-
/**
|
|
1015
|
-
* When set the product while rotate slowly
|
|
1016
|
-
*/
|
|
1017
|
-
readonly autoRotation?: boolean;
|
|
1018
|
-
/**
|
|
1019
|
-
* Time in milliseconds before the product starts rotating after a user input has taken control.
|
|
1020
|
-
*/
|
|
1021
|
-
readonly idleTimeBeforeRotation?: number;
|
|
1022
|
-
/**
|
|
1023
|
-
* When set the 3D preview won't attempt to orient the product automatically to its front view at load.
|
|
1024
|
-
*/
|
|
1025
|
-
readonly disableAutomaticOrientation?: boolean;
|
|
1026
|
-
/**
|
|
1027
|
-
* When true the action bar won't be displayed to the user.
|
|
1028
|
-
*/
|
|
1029
|
-
readonly disableActionBar?: boolean;
|
|
1030
|
-
/**
|
|
1031
|
-
* When set, mousing over the model in this preview will highlight the associated mesh/material.
|
|
1032
|
-
* When layout contexts are provided, only the materials with matching names will highlight.
|
|
1033
|
-
*/
|
|
1034
|
-
readonly highlightOnMaterialHover?: boolean;
|
|
1035
|
-
/**
|
|
1036
|
-
* Sets the color of highlights when enabled. Expects hexadecimal value.
|
|
1037
|
-
*/
|
|
1038
|
-
readonly highlightColor?: string;
|
|
1039
|
-
};
|
|
1040
|
-
/**
|
|
1041
|
-
* Defines the different behaviors supported by the camera system
|
|
1042
|
-
* for control when viewing a product.
|
|
1043
|
-
*/
|
|
1044
|
-
enum _ProductCameraRig1 {
|
|
1045
|
-
Orbit = 0,
|
|
1046
|
-
Pan = 1
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Identical to CameraAnimation typing, however the
|
|
1050
|
-
* target is always available and hence is not optional.
|
|
1051
|
-
*/
|
|
1052
|
-
type CameraPose = {
|
|
1053
|
-
readonly lonDeg: number;
|
|
1054
|
-
readonly radius: number;
|
|
1055
|
-
readonly latDeg: number;
|
|
1056
|
-
readonly target: {
|
|
1057
|
-
readonly x: number;
|
|
1058
|
-
readonly y: number;
|
|
1059
|
-
readonly z: number;
|
|
1060
|
-
};
|
|
1061
|
-
};
|
|
1062
|
-
type _LoadProgressEventData1 = {
|
|
1063
|
-
/**
|
|
1064
|
-
* The total load value of the scene, this is an average of all
|
|
1065
|
-
* 'in progress' loading events. when all events are fully loaded this value will be 100.
|
|
1066
|
-
*/
|
|
1067
|
-
readonly loadValue: number;
|
|
1068
|
-
/**
|
|
1069
|
-
* This value is true when the base model and scene have been initialized.
|
|
1070
|
-
*/
|
|
1071
|
-
readonly sceneInitialized: boolean;
|
|
1072
|
-
};
|
|
1073
763
|
declare class OptionService {
|
|
1074
764
|
/**
|
|
1075
765
|
* Returns a promise that resolves once all options required for a given workflow
|
|
@@ -1430,11 +1120,11 @@ export class Client {
|
|
|
1430
1120
|
* @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
|
|
1431
1121
|
* @returns A workflow experience configured as requested.
|
|
1432
1122
|
*/
|
|
1433
|
-
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) =>
|
|
1123
|
+
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => _ThreeDPreviewService1): Promise<WorkflowExperience>;
|
|
1434
1124
|
/**
|
|
1435
1125
|
* @returns The preview service that was provided during construction.
|
|
1436
1126
|
*/
|
|
1437
|
-
getPreviewService():
|
|
1127
|
+
getPreviewService(): _ThreeDPreviewService1;
|
|
1438
1128
|
/**
|
|
1439
1129
|
* @returns The product associated with this client.
|
|
1440
1130
|
*/
|