@spiffcommerce/core 21.9.0-alpha.1 → 21.9.0-alpha.11
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 +57 -6
- package/dist/index.js +2358 -2134
- package/dist/index.umd.cjs +92 -79
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
|
|
2
|
-
import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, Workflow, ILayout, LayoutsState, LayoutData, SilentStepData, Placeable, StepStorage, CanvasCommand, CommandContext, LayoutState, SerializableStep, CommandState, GlobalPropertyConfiguration, Asset, MaterialResource, AssetType, StepType,
|
|
2
|
+
import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, Workflow, ILayout, LayoutsState, LayoutData, SilentStepData, Placeable, StepStorage, CanvasCommand, CommandContext, LayoutState, SerializableStep, CommandState, GlobalPropertyConfiguration, AspectType, Asset, MaterialResource, AssetType, StepType, GlobalPropertyConfigurationAspect, Theme, FrameStepData, CreateElementCommand, FrameElement, IllustrationStepData, IllustrationElement, ColorDefinition, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, InformationStepData } from '@spiffcommerce/papyrus';
|
|
3
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, QuestionStepData, ResizeCommand, RotateCommand, SendBackwardsCommand, ShapeStepData, Step, StepAspect, StepAspectType, StepStorage, StepType, TextChangeCommand, TextStepData, TextboxElement, Theme, UnitOfMeasurement, VariantResource, Workflow, WorkflowPanel, dataUrlFromExternalUrl, determineCorrectFontSizeAndLines, findElement, frameDataCache, generate, generateSVGWithUnknownColors, getAttributesFromArrayBuffer, getAxisAlignedBoundingBox, getFrameData, getSvgElement, loadFont, patternImageDataCache, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout, setCanvasModule } from '@spiffcommerce/papyrus';
|
|
4
4
|
import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
|
|
5
5
|
import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
|
|
@@ -1057,6 +1057,14 @@ type GlobalPropertyState = {
|
|
|
1057
1057
|
type GlobalPropertyStateAspect = {
|
|
1058
1058
|
name: string;
|
|
1059
1059
|
value: string;
|
|
1060
|
+
type?: AspectType;
|
|
1061
|
+
storage?: GlobalPropertyStateAspectStorage;
|
|
1062
|
+
};
|
|
1063
|
+
type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage;
|
|
1064
|
+
type GlobalPropertyStateFileUploadStorage = {
|
|
1065
|
+
originalAssetKey?: string;
|
|
1066
|
+
backgroundRemovedAssetKey?: string;
|
|
1067
|
+
useOriginalAsset?: boolean;
|
|
1060
1068
|
};
|
|
1061
1069
|
interface BundleStateTransform {
|
|
1062
1070
|
position: Vector3;
|
|
@@ -1109,7 +1117,6 @@ declare class AssetService implements AssetManager {
|
|
|
1109
1117
|
* Allows for retrieving an asset, returns the option from a cache if possible.
|
|
1110
1118
|
*/
|
|
1111
1119
|
getLocalOrFromServer(assetKey: string): Promise<Asset>;
|
|
1112
|
-
getOriginalFile(asset: Asset): Promise<Asset>;
|
|
1113
1120
|
/**
|
|
1114
1121
|
* Caches an asset if it doesn't already exist.
|
|
1115
1122
|
*/
|
|
@@ -1772,6 +1779,12 @@ declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
|
|
|
1772
1779
|
* @returns A promise resolving when all affected steps have been updated.
|
|
1773
1780
|
*/
|
|
1774
1781
|
selectImage(asset: Asset): Promise<void>;
|
|
1782
|
+
/**
|
|
1783
|
+
* Removes the background from an image, stores it in the state, and returns the new asset.
|
|
1784
|
+
* @param applyNewAsset Optionally applies the new asset to all shared steps. Default: `true`.
|
|
1785
|
+
* @returns A promise that resolves with the newly generated Asset.
|
|
1786
|
+
*/
|
|
1787
|
+
removeBackgroundFromImage(applyNewAsset?: boolean): Promise<Asset>;
|
|
1775
1788
|
/**
|
|
1776
1789
|
* Returns `true` if the state has an image assigned, otherwise `false`.
|
|
1777
1790
|
*/
|
|
@@ -1781,8 +1794,21 @@ declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
|
|
|
1781
1794
|
* @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
|
|
1782
1795
|
*/
|
|
1783
1796
|
getImage(): Promise<Asset | undefined>;
|
|
1797
|
+
/**
|
|
1798
|
+
* Retrieves the original, unmodified image selection, if one exists.
|
|
1799
|
+
* @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
|
|
1800
|
+
*/
|
|
1801
|
+
getOriginalImage(): Promise<Asset | undefined>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Retrieves the version of the image selection that has the background removed, if one exists.
|
|
1804
|
+
* @returns A promise that resolves with an `Asset` object if one is assigned to the state, otherwise `undefined`.
|
|
1805
|
+
*/
|
|
1806
|
+
getBackgroundRemovedImage(): Promise<Asset | undefined>;
|
|
1807
|
+
getUseOriginalImage(): boolean;
|
|
1808
|
+
setUseOriginalImage(value: boolean): Promise<void>;
|
|
1784
1809
|
applyGlobalState(targetExperiences?: WorkflowExperience[]): Promise<void>;
|
|
1785
1810
|
private applyImageSelection;
|
|
1811
|
+
private updateSharedStepStorage;
|
|
1786
1812
|
}
|
|
1787
1813
|
declare class TextGlobalPropertyHandle extends GlobalPropertyHandle {
|
|
1788
1814
|
constructor(bundle: Bundle, property: GlobalPropertyConfigurationAspect);
|
|
@@ -1845,8 +1871,17 @@ interface GlobalPropertyStateManager {
|
|
|
1845
1871
|
getInitializationPromise(): Promise<void>;
|
|
1846
1872
|
getGlobalPropertyState(): GlobalPropertyState | undefined;
|
|
1847
1873
|
getAspect(name: string): string | undefined;
|
|
1848
|
-
|
|
1849
|
-
|
|
1874
|
+
getAspectStorage(name: string): GlobalPropertyStateAspectStorage | undefined;
|
|
1875
|
+
/**
|
|
1876
|
+
* Updates the value of a named aspect in the state.
|
|
1877
|
+
* @param name The name (key) of the aspect. This must match the key in the associated Global Property Config
|
|
1878
|
+
* @param value The value, represented as a string.
|
|
1879
|
+
* @param storage Optional: Additional data storage for the aspect. Not specifying this parameter, or providing `undefined`, will not update the
|
|
1880
|
+
* storage (if it already exists). Providing `null` will clear the existing storage.
|
|
1881
|
+
*/
|
|
1882
|
+
setAspect(name: string, value: string, storage?: GlobalPropertyStateAspectStorage | null): Promise<void>;
|
|
1883
|
+
setAspectStorage(name: string, storage: GlobalPropertyStateAspectStorage | null): Promise<void>;
|
|
1884
|
+
setBundleOptions(bundleOptions?: BundleOptions): void;
|
|
1850
1885
|
}
|
|
1851
1886
|
interface BundleOptions {
|
|
1852
1887
|
additionalHeaders?: {
|
|
@@ -2702,7 +2737,7 @@ interface FrameCreateOpts {
|
|
|
2702
2737
|
declare class FrameStepService implements StepService<FrameStepData> {
|
|
2703
2738
|
init(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<CommandWithFollowup | null>;
|
|
2704
2739
|
private reload;
|
|
2705
|
-
selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager): void
|
|
2740
|
+
selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager): Promise<void>;
|
|
2706
2741
|
selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
|
|
2707
2742
|
getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): CreateElementCommand<FrameElement>;
|
|
2708
2743
|
loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
|
|
@@ -3145,12 +3180,28 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
|
|
|
3145
3180
|
private frameService;
|
|
3146
3181
|
selectVariant(variant: Variant): Promise<void>;
|
|
3147
3182
|
onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
|
|
3148
|
-
|
|
3183
|
+
/**
|
|
3184
|
+
* Updates the image selection inside the frame.
|
|
3185
|
+
* @param asset The asset to use.
|
|
3186
|
+
* @param storeAsOriginal Optional: Store this asset as the original, unmodified version of the image. Default: `true`.
|
|
3187
|
+
*/
|
|
3188
|
+
selectImage(asset: Asset, storeAsOriginal?: boolean): Promise<void>;
|
|
3189
|
+
/**
|
|
3190
|
+
* Removes the background from an image, stores it in the state, and returns the new asset.
|
|
3191
|
+
* @param applyNewAsset Optionally applies the new asset as the current image selection. Default: `true`.
|
|
3192
|
+
* @returns A promise that resolves with the newly generated Asset.
|
|
3193
|
+
*/
|
|
3194
|
+
removeBackgroundFromImageSelection(applyNewAsset?: boolean): Promise<Asset>;
|
|
3149
3195
|
getImageData(): PatternImageData | undefined;
|
|
3150
3196
|
getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
|
|
3151
3197
|
getFrameService(): FrameService | undefined;
|
|
3152
3198
|
hasOverlayImageKey(): string | undefined;
|
|
3153
3199
|
hasOverlayImageUrl(): any;
|
|
3200
|
+
getOriginalImageSelection(): Promise<Asset | undefined>;
|
|
3201
|
+
getBackgroundRemovedImageSelection(): Promise<Asset | undefined>;
|
|
3202
|
+
hasBackgroundRemovedImageSelection(): boolean;
|
|
3203
|
+
getUseOriginalImageSelection(): boolean;
|
|
3204
|
+
setUseOriginalImageSelection(value: boolean): Promise<void>;
|
|
3154
3205
|
}
|
|
3155
3206
|
|
|
3156
3207
|
declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
|