@spiffcommerce/core 20.1.0-alpha.0 → 20.1.0-beta.1

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
@@ -137,7 +137,7 @@ declare class PromiseQueue<T extends QueueablePromise> {
137
137
  * @param mustCover When true the image sgould be bounded in such a way that it covers the entire frame at all times.
138
138
  */
139
139
  declare function getBoundedOffsets(newOffsets: FrameOffsets, frameData: FrameData, imageData: PatternImageData, mustCover?: boolean): FrameOffsets;
140
- declare class FrameService {
140
+ declare class FrameService$1 {
141
141
  private offsets;
142
142
  private thresholdSettings;
143
143
  private forceImageCover?;
@@ -379,7 +379,7 @@ declare enum InformationMessageType {
379
379
  * Services required for the operaiton of individual steps.
380
380
  */
381
381
  interface StepSpecificServices {
382
- frameService?: FrameService;
382
+ frameService?: FrameService$1;
383
383
  module?: ModuleProduct;
384
384
  }
385
385
  type DesignCreationProgressUpdate = (message: string) => void;
@@ -2378,7 +2378,6 @@ declare class SpiffCommerceClient {
2378
2378
  * @returns The transaction associated with this client.
2379
2379
  */
2380
2380
  getTransaction(): Transaction;
2381
- configureUrls(hubUrl: string, serverUrl: string, servicesApiUrl: string): void;
2382
2381
  /**
2383
2382
  * A function used to synchronize transaction state with the server.
2384
2383
  * @param options New state details. To be spread into the query.
@@ -2439,7 +2438,7 @@ declare class FrameStepService implements StepService<FrameStepData> {
2439
2438
  selectImage(stepData: Step<FrameStepData>, asset: Asset, workflowManager: WorkflowManager): void;
2440
2439
  selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): Promise<void>;
2441
2440
  getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): CreateElementCommand<FrameElement>;
2442
- loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
2441
+ loadPatternFromString(src: string, frameService: FrameService$1): Promise<void>;
2443
2442
  private selectVariantCommand;
2444
2443
  private frameSourceSvg;
2445
2444
  /**
@@ -2882,7 +2881,7 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
2882
2881
  selectImage(asset: Asset): void;
2883
2882
  getImageData(): PatternImageData | undefined;
2884
2883
  getCurrentFrameStep(frameData: FrameData$1, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
2885
- getFrameService(): FrameService | undefined;
2884
+ getFrameService(): FrameService$1 | undefined;
2886
2885
  hasOverlayImageKey(): string | undefined;
2887
2886
  hasOverlayImageUrl(): any;
2888
2887
  }
@@ -2962,4 +2961,74 @@ declare class PromiseCache {
2962
2961
  }
2963
2962
  declare const promiseCache: PromiseCache;
2964
2963
 
2965
- export { ArrayInput, AssetNotFoundError, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };
2964
+ declare enum FrameEventType {
2965
+ /**
2966
+ * This event is sent when the user has clicked a close button within the frame.
2967
+ */
2968
+ OnCancel = "onCancel",
2969
+ /**
2970
+ * This event is sent when the frame has encountered an error.
2971
+ */
2972
+ OnError = "onError",
2973
+ /**
2974
+ * This event is sent when the user has completed the experience in the frame and is passign back information to the parent.
2975
+ */
2976
+ OnComplete = "onComplete",
2977
+ /**
2978
+ * This event is sent when the content in the frame is loaded and ready to display.
2979
+ */
2980
+ OnLoad = "onLoad"
2981
+ }
2982
+ /**
2983
+ * This event is sent when the frame has encountered an error.
2984
+ */
2985
+ interface ErrorEvent {
2986
+ event: FrameEventType.OnError;
2987
+ data: Error;
2988
+ }
2989
+ /**
2990
+ * This event is sent when the user has clicked a close button within the frame.
2991
+ */
2992
+ interface CancelEvent {
2993
+ event: FrameEventType.OnCancel;
2994
+ }
2995
+ /**
2996
+ * This event is sent when the content in the frame is loaded and ready to display. As
2997
+ * the point at which the content is considered 'loaded' can vary between themes, we require the theme developer to report it.
2998
+ */
2999
+ interface LoadEvent {
3000
+ event: FrameEventType.OnLoad;
3001
+ }
3002
+ /**
3003
+ * This event is sent when the user has completed the transaction in the frame and is passing back information to the parent.
3004
+ */
3005
+ interface TransactionCompleteEvent {
3006
+ event: FrameEventType.OnComplete;
3007
+ }
3008
+ /**
3009
+ * This event is sent when the user has completed the bundle experience in the frame and is passing back information to the parent.
3010
+ */
3011
+ interface BundleCompleteEvent {
3012
+ bundleId: string;
3013
+ items: TransactionCompleteEvent[];
3014
+ event: FrameEventType.OnComplete;
3015
+ }
3016
+ /**
3017
+ * A union of the various frame events that can be sent to the parent window.
3018
+ */
3019
+ type FrameEvent = BundleCompleteEvent | (TransactionCompleteEvent & DesignCreationMessage) | CancelEvent | ErrorEvent | LoadEvent;
3020
+ /**
3021
+ * Service for communicating with the parent window. Wraps calls to `window.parent.postMessage` and provides strongly typed events.
3022
+ */
3023
+ declare class FrameService {
3024
+ /**
3025
+ * * Send a message to the parent window.
3026
+ * We don't currently know the domain of the parent window in a secure way so we use `window.parent.origin` to send the message.
3027
+ * FIXME: One day in the future let's build a whitelist or something similar that can be used to validate the origin of the parent window.
3028
+ * @param event The event to send. Must be strongly typed as one of the FrameEvent types.
3029
+ */
3030
+ postMessage(event: FrameEvent): void;
3031
+ }
3032
+ declare const frameService: FrameService;
3033
+
3034
+ export { ArrayInput, AssetNotFoundError, Bundle, CollectionProduct, ColorOption, ConversionConfiguration, ConversionData, ConversionDataType, ConversionLocation, Customer, CustomerDetailsInput, DesignCreationMessage, DesignCreationProgressUpdate, DesignInputStep, EditedSteps, FlowExecutionNodeResult, FlowExecutionResult, FlowService, FrameEventType, FrameService$1 as FrameService, FrameStep, FrameStepHandle, FrameThresholdSettings, GetWorkflowOptions, GlobalPropertyHandle, IllustrationStepHandle, InformationMessageType, InformationResult, InformationStepHandle, IntegrationProduct, IntegrationType, LayoutNotFoundError, MandatorySteps, MaterialStepHandle, MisconfigurationError, MockWorkflowManager, ModelStepHandle, NodeType, ObjectInput, ObjectInputType, OptionNotFoundError, ParseError, PictureStepHandle, Product, ProductCameraRig, ProductCollection, ProductWorkflow, promiseCache as PromiseCache, PromiseQueue, QuestionStepHandle, QueueablePromise, RegionElement, RenderableScene, ResourceNotFoundError, SavedDesign, SelectionStorage, ShapeStepHandle, SilentIllustrationStepData, SpiffCommerceClient, Stakeholder, StakeholderType, StateMutationFunc, StepElements, StepHandle, TextInput, TextStepHandle, TextStepStorage, Transaction, Transform, TransformCollection, UnhandledBehaviorError, Variant, Vector3, WorkflowExperience, WorkflowExperienceImpl, WorkflowManager, WorkflowMetadata, WorkflowScene, WorkflowSelections, WorkflowStorage, assetService, createDesign, designService, digitalContentStepService, frameService, frameStepService, generateCommands, generateStateFromDesignInputSteps, getBoundedOffsets, getWorkflow, getWorkflows, graphQlManager, illustrationStepService, materialStepService, modelStepService, moduleStepService, optionService, persistenceService, pictureStepService, questionStepService, shapeStepService, shortenUrl, spiffCoreConfiguration, stepAspectValuesToDesignInputSteps, textStepService, toast };