@spiffcommerce/core 16.2.6 → 16.4.0-rc.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 +80 -33
- package/dist/index.js +1692 -1722
- package/dist/index.umd.cjs +82 -82
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _spiffcommerce_papyrus from '@spiffcommerce/papyrus';
|
|
2
|
-
import { OptionResource, VariantResource, Step, AnyStepData, FrameOffsets, PatternImageData, Region, SilentStepData, Placeable, StepStorage, CanvasCommand, CommandContext,
|
|
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, GlobalPropertyConfigurationAspect, AspectType, Theme, StepAspect, FrameStepData, CreateElementCommand, FrameElement, IllustrationStepData, IllustrationElement, ColorDefinition, MaterialStepData, ModelStepData, TextStepData, TextboxElement, TextFillImage, FontData, GroupCommand, PictureStepData, QuestionStepData, ShapeStepData, ModuleStepData, DigitalContentStepData, FrameData as FrameData$1, BulkStepData, InformationStepData } from '@spiffcommerce/papyrus';
|
|
3
3
|
export { Animatable, AnyStepData, Asset, AssetType, BringForwardCommand, BringToBackCommand, BringToFrontCommand, BulkStepData, 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, loadFontFromDataUrl, loadFontFromExternalUrl, patternImageDataCache, registerFetchImplementation, registerWindowImplementation, rehydrateSerializedLayout } from '@spiffcommerce/papyrus';
|
|
4
4
|
import { ApolloClient, MutationOptions, FetchResult } from '@apollo/client/core';
|
|
5
|
+
import { RenderableContextService, RenderableContext, ThreeDPreviewService, ModelContainer } from '@spiffcommerce/preview';
|
|
5
6
|
import * as lodash from 'lodash';
|
|
6
7
|
|
|
7
8
|
declare class OptionService {
|
|
@@ -263,6 +264,69 @@ declare abstract class ModuleProduct {
|
|
|
263
264
|
abstract svgPrint(text: string, region: Region): string;
|
|
264
265
|
}
|
|
265
266
|
|
|
267
|
+
interface DesignInputStep {
|
|
268
|
+
data: DesignInputStepData;
|
|
269
|
+
name: string;
|
|
270
|
+
}
|
|
271
|
+
interface DesignInputStepData {
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
declare class LayoutPreviewService implements RenderableContextService {
|
|
275
|
+
private readonly layouts;
|
|
276
|
+
private handleCompleteRender;
|
|
277
|
+
constructor(layouts: ILayout[]);
|
|
278
|
+
setCompleteRenderCallback(handleCompleteRender: (layouts: LayoutPreviewBridge[]) => void): void;
|
|
279
|
+
onCompleteRender(): void;
|
|
280
|
+
getAll(): ReadonlyMap<string, LayoutPreviewBridge>;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* The panel canvas class that stores both the main rendering canvas as well as rendering context
|
|
284
|
+
* for a rendering context
|
|
285
|
+
*/
|
|
286
|
+
declare class LayoutPreviewBridge implements RenderableContext {
|
|
287
|
+
hasSetStaticContext: boolean;
|
|
288
|
+
private readonly id;
|
|
289
|
+
private readonly name;
|
|
290
|
+
private service;
|
|
291
|
+
private interactiveDirty;
|
|
292
|
+
private textureCtx?;
|
|
293
|
+
private staticCtxDirty;
|
|
294
|
+
private lastRequestedRenderArguments;
|
|
295
|
+
private lastCompletedStaticRender;
|
|
296
|
+
private lastModificationID;
|
|
297
|
+
private renderQueue;
|
|
298
|
+
constructor(id: string, name: string, service: LayoutPreviewService);
|
|
299
|
+
getID(): string;
|
|
300
|
+
getName(): string;
|
|
301
|
+
getStaticContext(): CanvasRenderingContext2D | undefined;
|
|
302
|
+
/**
|
|
303
|
+
* Register canvas to be rendered to.
|
|
304
|
+
*/
|
|
305
|
+
setStaticContext(ctx: CanvasRenderingContext2D): void;
|
|
306
|
+
getStaticContextDirty(): boolean;
|
|
307
|
+
setStaticContextDirty(dirty: boolean): void;
|
|
308
|
+
getInteractiveCanvasDirty(): boolean;
|
|
309
|
+
setInteractiveCanvasDirty(dirty: boolean): void;
|
|
310
|
+
markLastCompletedStaticRender(): void;
|
|
311
|
+
/**
|
|
312
|
+
* Returns a timestamp for the last time that this canvas rendered to its dynamic texture in the
|
|
313
|
+
* form of Date.now(). If this panel has never rendered undefined will be returned.
|
|
314
|
+
*/
|
|
315
|
+
getLastCompletedStaticRender(): number | undefined;
|
|
316
|
+
getLastModificationID(): string | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Actions to perform when a static render event is fired for this canvas.
|
|
319
|
+
*/
|
|
320
|
+
render(workflow: Workflow, layouts: LayoutData[], variationRecord: null | VariationRecord, productOverlayImageUrl?: string): Promise<void>;
|
|
321
|
+
}
|
|
322
|
+
interface StepAspectValue {
|
|
323
|
+
stepName: string;
|
|
324
|
+
stepAspectType: string;
|
|
325
|
+
value?: string;
|
|
326
|
+
}
|
|
327
|
+
declare const stepAspectValuesToDesignInputSteps: (stepAspectValues: StepAspectValue[], workflow: Workflow) => DesignInputStep[];
|
|
328
|
+
declare const generateStateFromDesignInputSteps: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<LayoutsState>;
|
|
329
|
+
|
|
266
330
|
interface SilentIllustrationStepData extends SilentStepData, Placeable {
|
|
267
331
|
}
|
|
268
332
|
interface EditedSteps {
|
|
@@ -347,8 +411,8 @@ interface WorkflowManager {
|
|
|
347
411
|
getCommandContext: () => CommandContext;
|
|
348
412
|
getLayouts: () => ILayout[];
|
|
349
413
|
getAllLayoutData: () => LayoutState[];
|
|
350
|
-
getLayoutPreviewService: () =>
|
|
351
|
-
getPreviewService: () =>
|
|
414
|
+
getLayoutPreviewService: () => LayoutPreviewService | undefined;
|
|
415
|
+
getPreviewService: () => ThreeDPreviewService | undefined;
|
|
352
416
|
getProfanities: () => string[];
|
|
353
417
|
getRegionElements: (stepName: string) => RegionElement[];
|
|
354
418
|
getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
|
|
@@ -401,14 +465,14 @@ interface WorkflowManager {
|
|
|
401
465
|
*/
|
|
402
466
|
updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
|
|
403
467
|
updateStorage: (stepName: string, update: StepStorage) => void;
|
|
404
|
-
getModelContainer: () =>
|
|
405
|
-
setModelContainer: (container:
|
|
468
|
+
getModelContainer: () => ModelContainer | undefined;
|
|
469
|
+
setModelContainer: (container: ModelContainer) => void;
|
|
406
470
|
/**
|
|
407
471
|
* Injects the model of this product into the preview service.
|
|
408
472
|
* This also overwrites the internal preview service.
|
|
409
473
|
* @param previewService The preview service to inject into.
|
|
410
474
|
*/
|
|
411
|
-
injectIntoPreviewService(previewService:
|
|
475
|
+
injectIntoPreviewService(previewService: ThreeDPreviewService): Promise<void>;
|
|
412
476
|
/**
|
|
413
477
|
* Ejects the model of this product from the preview service. This also sets the internal preview service to undefined.
|
|
414
478
|
*/
|
|
@@ -1311,9 +1375,9 @@ interface ExperienceOptions {
|
|
|
1311
1375
|
product: Product;
|
|
1312
1376
|
transaction: Transaction;
|
|
1313
1377
|
workflow?: Workflow;
|
|
1314
|
-
previewService?:
|
|
1315
|
-
modelContainer?:
|
|
1316
|
-
renderableContextService?:
|
|
1378
|
+
previewService?: ThreeDPreviewService;
|
|
1379
|
+
modelContainer?: ModelContainer;
|
|
1380
|
+
renderableContextService?: LayoutPreviewService;
|
|
1317
1381
|
layouts: ILayout[];
|
|
1318
1382
|
reloadedState?: LayoutsState;
|
|
1319
1383
|
/**
|
|
@@ -1830,7 +1894,7 @@ interface Bundle {
|
|
|
1830
1894
|
* If a preview service was specified when calling client.getExistingBundle, this will return that service.
|
|
1831
1895
|
* Call `setPreviewService` to update the preview service for this bundle.
|
|
1832
1896
|
*/
|
|
1833
|
-
getPreviewService():
|
|
1897
|
+
getPreviewService(): ThreeDPreviewService | undefined;
|
|
1834
1898
|
/**
|
|
1835
1899
|
* Set the preview service for this bundle. This will update the preview service for all workflow experiences in this bundle, and will
|
|
1836
1900
|
* also automatically inject the preview service into any new workflow experiences that are added to this bundle.
|
|
@@ -1838,7 +1902,7 @@ interface Bundle {
|
|
|
1838
1902
|
* @param previewService The preview service to use for this bundle.
|
|
1839
1903
|
* @returns A promise that resolves when the preview service has been updated for all workflow experiences in this bundle.
|
|
1840
1904
|
*/
|
|
1841
|
-
setPreviewService(previewService?:
|
|
1905
|
+
setPreviewService(previewService?: ThreeDPreviewService): Promise<void>;
|
|
1842
1906
|
/**
|
|
1843
1907
|
* Returns a promise that resolves when the bundle has been initialized.
|
|
1844
1908
|
* This will resolve immediately if the bundle has no experiences, or if the bundle has already been initialized.
|
|
@@ -2053,7 +2117,7 @@ interface GetWorkflowOptionsBase {
|
|
|
2053
2117
|
/**
|
|
2054
2118
|
* An existing preview service to use, instead of creating a new one.
|
|
2055
2119
|
*/
|
|
2056
|
-
previewService?:
|
|
2120
|
+
previewService?: ThreeDPreviewService;
|
|
2057
2121
|
graphql?: GetWorkflowGraphqlOptions;
|
|
2058
2122
|
}
|
|
2059
2123
|
interface GetWorkflowFromTransactionOptions extends GetWorkflowOptionsBase {
|
|
@@ -2167,7 +2231,7 @@ declare class SpiffCommerceClient {
|
|
|
2167
2231
|
* @param graphqlOptions Optional: Options to configure loading the workflow.
|
|
2168
2232
|
* @returns A bundle to be used for grouping and operating on large amounts of workflow experiences.
|
|
2169
2233
|
*/
|
|
2170
|
-
getExistingBundle(bundleId: string, previewService?:
|
|
2234
|
+
getExistingBundle(bundleId: string, previewService?: ThreeDPreviewService, graphqlOptions?: GetWorkflowGraphqlOptions): Promise<Bundle>;
|
|
2171
2235
|
/**
|
|
2172
2236
|
* Retrieves all existing bundle stakeholders from the API, for the currently authenticated customer.
|
|
2173
2237
|
* @returns An array of bundle stakeholders.
|
|
@@ -2181,7 +2245,7 @@ declare class SpiffCommerceClient {
|
|
|
2181
2245
|
* @param options Options to configure loading the transaction and workflow.
|
|
2182
2246
|
* @returns A workflow experience configured as requested.
|
|
2183
2247
|
*/
|
|
2184
|
-
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) =>
|
|
2248
|
+
getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => ThreeDPreviewService, options?: GetWorkflowOptions): Promise<WorkflowExperience>;
|
|
2185
2249
|
/**
|
|
2186
2250
|
* Gets multiple workflow experiences at once.
|
|
2187
2251
|
* @param optionsArray An array of options to configure loading the transactions and workflows.
|
|
@@ -2211,7 +2275,7 @@ declare class SpiffCommerceClient {
|
|
|
2211
2275
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `workflowExperience.getWorkflowManager().getPreviewService()` instead.
|
|
2212
2276
|
* @returns The preview service that was provided during construction.
|
|
2213
2277
|
*/
|
|
2214
|
-
getPreviewService():
|
|
2278
|
+
getPreviewService(): ThreeDPreviewService | undefined;
|
|
2215
2279
|
/**
|
|
2216
2280
|
* @deprecated The value this returns will be changed whenever `getWorkflowExperience()` is called. Use `WorkflowManager.getProduct()` instead.
|
|
2217
2281
|
* @returns The product associated with this client.
|
|
@@ -2494,9 +2558,7 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
2494
2558
|
addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
|
|
2495
2559
|
getCommandDispatcher(): (_command: CanvasCommand) => void;
|
|
2496
2560
|
getLayouts(): never[];
|
|
2497
|
-
getLayoutPreviewService():
|
|
2498
|
-
getAll: () => Map<any, any>;
|
|
2499
|
-
};
|
|
2561
|
+
getLayoutPreviewService(): any;
|
|
2500
2562
|
getPreviewService(): undefined;
|
|
2501
2563
|
setModelContainer: (container: any) => void;
|
|
2502
2564
|
getModelContainer(): undefined;
|
|
@@ -2539,13 +2601,6 @@ declare class MockWorkflowManager implements WorkflowManager {
|
|
|
2539
2601
|
ejectFromPreviewService(): void;
|
|
2540
2602
|
}
|
|
2541
2603
|
|
|
2542
|
-
interface DesignInputStep {
|
|
2543
|
-
data: DesignInputStepData;
|
|
2544
|
-
name: string;
|
|
2545
|
-
}
|
|
2546
|
-
interface DesignInputStepData {
|
|
2547
|
-
}
|
|
2548
|
-
|
|
2549
2604
|
declare const generateCommands: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<CanvasCommand[]>;
|
|
2550
2605
|
|
|
2551
2606
|
declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
|
|
@@ -2829,12 +2884,4 @@ declare class InformationStepHandle extends StepHandle<InformationStepData> {
|
|
|
2829
2884
|
getContent(): string;
|
|
2830
2885
|
}
|
|
2831
2886
|
|
|
2832
|
-
interface StepAspectValue {
|
|
2833
|
-
stepName: string;
|
|
2834
|
-
stepAspectType: string;
|
|
2835
|
-
value?: string;
|
|
2836
|
-
}
|
|
2837
|
-
declare const stepAspectValuesToDesignInputSteps: (stepAspectValues: StepAspectValue[], workflow: Workflow) => DesignInputStep[];
|
|
2838
|
-
declare const generateStateFromDesignInputSteps: (designInputSteps: DesignInputStep[], workflow: Workflow, layouts: ILayout[], productOverlayImageUrl?: string) => Promise<LayoutsState>;
|
|
2839
|
-
|
|
2840
2887
|
export { AssetNotFoundError, BulkPriceCalculationStrategy, BulkStepHandle, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, VariationRecord, Vector3, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, gatherVaryingStepAspects, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
|