@spiffcommerce/core 21.9.0-alpha.3 → 21.9.0-alpha.4
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 +48 -4
- package/dist/index.js +2248 -2096
- package/dist/index.umd.cjs +91 -78
- 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,6 +1794,18 @@ 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;
|
|
1786
1811
|
}
|
|
@@ -1845,8 +1870,17 @@ interface GlobalPropertyStateManager {
|
|
|
1845
1870
|
getInitializationPromise(): Promise<void>;
|
|
1846
1871
|
getGlobalPropertyState(): GlobalPropertyState | undefined;
|
|
1847
1872
|
getAspect(name: string): string | undefined;
|
|
1848
|
-
|
|
1849
|
-
|
|
1873
|
+
getAspectStorage(name: string): GlobalPropertyStateAspectStorage | undefined;
|
|
1874
|
+
/**
|
|
1875
|
+
* Updates the value of a named aspect in the state.
|
|
1876
|
+
* @param name The name (key) of the aspect. This must match the key in the associated Global Property Config
|
|
1877
|
+
* @param value The value, represented as a string.
|
|
1878
|
+
* @param storage Optional: Additional data storage for the aspect. Not specifying this parameter, or providing `undefined`, will not update the
|
|
1879
|
+
* storage (if it already exists). Providing `null` will clear the existing storage.
|
|
1880
|
+
*/
|
|
1881
|
+
setAspect(name: string, value: string, storage?: GlobalPropertyStateAspectStorage | null): Promise<void>;
|
|
1882
|
+
setAspectStorage(name: string, storage: GlobalPropertyStateAspectStorage | null): Promise<void>;
|
|
1883
|
+
setBundleOptions(bundleOptions?: BundleOptions): void;
|
|
1850
1884
|
}
|
|
1851
1885
|
interface BundleOptions {
|
|
1852
1886
|
additionalHeaders?: {
|
|
@@ -3146,11 +3180,21 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
|
|
|
3146
3180
|
selectVariant(variant: Variant): Promise<void>;
|
|
3147
3181
|
onFrameDataChanged(callback: (frameData: FrameData$1[]) => void): void;
|
|
3148
3182
|
selectImage(asset: Asset): void;
|
|
3183
|
+
/**
|
|
3184
|
+
* Removes the background from an image, stores it in the state, and returns the new asset.
|
|
3185
|
+
* @param applyNewAsset Optionally applies the new asset as the current image selection. Default: `true`.
|
|
3186
|
+
* @returns A promise that resolves with the newly generated Asset.
|
|
3187
|
+
*/
|
|
3188
|
+
removeBackgroundFromImageSelection(applyNewAsset?: boolean): Promise<Asset>;
|
|
3149
3189
|
getImageData(): PatternImageData | undefined;
|
|
3150
3190
|
getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
|
|
3151
3191
|
getFrameService(): FrameService | undefined;
|
|
3152
3192
|
hasOverlayImageKey(): string | undefined;
|
|
3153
3193
|
hasOverlayImageUrl(): any;
|
|
3194
|
+
getOriginalImageSelection(): Promise<Asset | undefined>;
|
|
3195
|
+
getBackgroundRemovedImageSelection(): Promise<Asset | undefined>;
|
|
3196
|
+
getUseOriginalImageSelection(): boolean;
|
|
3197
|
+
setUseOriginalImageSelection(value: boolean): void;
|
|
3154
3198
|
}
|
|
3155
3199
|
|
|
3156
3200
|
declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
|