@spiffcommerce/core 0.10.31 → 0.10.32

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 CHANGED
@@ -2,6 +2,28 @@ import { Workflow as _Workflow1, StepAspect as _StepAspect1, Step as _Step1, Any
2
2
  import { ApolloClient } from "@apollo/client";
3
3
  import { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent } from "react";
4
4
  export const gatherVaryingStepAspects: (workflow: _Workflow1) => _StepAspect1[];
5
+ declare class Configuration {
6
+ constructor();
7
+ getServerUrl(): string;
8
+ getServicesApiUrl(): string;
9
+ getHubUrl(): string;
10
+ setServerUrl(serverUrl: string): void;
11
+ setServicesApiUrl(servicesApiUrl: string): void;
12
+ setHubUrl(hubUrl: string): void;
13
+ addServerUrlCallback(callback: () => void): void;
14
+ }
15
+ export const spiffCoreConfiguration: Configuration;
16
+ declare class SwaggerServer implements ServerService {
17
+ constructor();
18
+ setUncachedOperations(operationIds: string[]): void;
19
+ execute(operationName: string, parameters?: object): Promise<ServerResponse>;
20
+ }
21
+ export const server: SwaggerServer;
22
+ declare class GraphQlManager {
23
+ constructor();
24
+ getShadowGraphqlClient(): ApolloClient<any>;
25
+ }
26
+ export const graphQlManager: GraphQlManager;
5
27
  export interface WorkflowScene {
6
28
  name: string;
7
29
  title: string;
@@ -161,28 +183,6 @@ interface StorageService {
161
183
  setMap<K = any, V = any>(key: string, val: Map<K, V>): void;
162
184
  }
163
185
  export const persistenceService: StorageService;
164
- declare class Configuration {
165
- constructor();
166
- getServerUrl(): string;
167
- getServicesApiUrl(): string;
168
- getHubUrl(): string;
169
- setServerUrl(serverUrl: string): void;
170
- setServicesApiUrl(servicesApiUrl: string): void;
171
- setHubUrl(hubUrl: string): void;
172
- addServerUrlCallback(callback: () => void): void;
173
- }
174
- export const spiffCoreConfiguration: Configuration;
175
- declare class SwaggerServer implements ServerService {
176
- constructor();
177
- setUncachedOperations(operationIds: string[]): void;
178
- execute(operationName: string, parameters?: object): Promise<ServerResponse>;
179
- }
180
- export const server: SwaggerServer;
181
- declare class GraphQlManager {
182
- constructor();
183
- getShadowGraphqlClient(): ApolloClient<any>;
184
- }
185
- export const graphQlManager: GraphQlManager;
186
186
  declare class AssetService {
187
187
  constructor();
188
188
  /**
@@ -236,10 +236,10 @@ declare class IllustrationStepService implements StepService<_IllustrationStepDa
236
236
  getIllustrationBody(src: string): Promise<string>;
237
237
  getCreateElementCommand(id: string, region: Region, layout: _ILayout1, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
238
238
  init(stepData: _Step1<_IllustrationStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
239
- availableColors(stepData: _Step1<_IllustrationStepData1>): {
239
+ availableColors(stepData: _Step1<_IllustrationStepData1>): Promise<{
240
240
  fill: string;
241
241
  stroke: string;
242
- }[];
242
+ }[]>;
243
243
  changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<_CanvasCommand1>;
244
244
  changeColors(stepData: _Step1<_IllustrationStepData1>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
245
245
  selectVariant(stepData: _Step1<_IllustrationStepData1>, variant: _VariantResource1, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): Promise<void>;
@@ -305,10 +305,10 @@ declare class QuestionStepService implements StepService<_QuestionStepData1> {
305
305
  }
306
306
  export const questionStepService: QuestionStepService;
307
307
  declare class ShapeStepService implements StepService<_ShapeStepData1> {
308
- colourOptions(stepData: _Step1<_ShapeStepData1>): {
308
+ availableColours(stepData: _Step1<_ShapeStepData1>): Promise<{
309
309
  fill: string;
310
310
  stroke: string;
311
- }[];
311
+ }[]>;
312
312
  init(stepData: _Step1<_ShapeStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
313
313
  selectVariant(stepData: _Step1<_ShapeStepData1>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): void;
314
314
  }
@@ -343,7 +343,7 @@ declare class TextStepService implements StepService<_TextStepData1> {
343
343
  * @param stepData The text step to get colors for.
344
344
  * @returns A list of color objects containg fill, stroke and variant if available.
345
345
  */
346
- availableColors(stepData: _Step1<_TextStepData1>): ColorOption[];
346
+ availableColors(stepData: _Step1<_TextStepData1>): Promise<ColorOption[]>;
347
347
  changeFill(stepData: _Step1<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): Promise<void>;
348
348
  /**
349
349
  * Given an element and a string, filters any characters from the string that are
@@ -395,8 +395,6 @@ export interface WorkflowMetadata {
395
395
  }
396
396
  export interface WorkflowSelections {
397
397
  [stepName: string]: {
398
- groupName?: string;
399
- optionName: string;
400
398
  selections: _VariantResource1[];
401
399
  };
402
400
  }
@@ -417,7 +415,7 @@ interface StepSpecificServices {
417
415
  frameService?: FrameService;
418
416
  module?: ModuleProduct;
419
417
  }
420
- type DesignCreationProgressUpdate = (message: string) => void;
418
+ export type DesignCreationProgressUpdate = (message: string) => void;
421
419
  type ConfirmCallback = (isConfirmed: boolean) => void;
422
420
  type EditedCallback = (editedSteps: EditedSteps) => void;
423
421
  type ElementsCallback = (elements: StepElements) => void;
@@ -824,23 +822,12 @@ export enum ProductCameraRig {
824
822
  Pan = 1
825
823
  }
826
824
  declare class OptionService {
827
- /**
828
- * Returns a promise that resolves once all options required for a given workflow
829
- * have been loaded and cached ready for use.
830
- * @param workflow The workflow to load options for.
831
- */
832
- cacheRequiredOptions(workflow: _Workflow1): Promise<void>;
833
825
  /**
834
826
  * Allows for retrieving an option, returns the option from a cache if possible.
835
827
  * @param server The server service for making the request.
836
828
  * @param id The option ID to be retrieved.
837
829
  */
838
- getLocalOrFromServer(server: ServerService, id: string): Promise<IServerModel<_OptionResource1>>;
839
- /**
840
- * Returns an option from the cache, or null
841
- * @param id The ID to search for.
842
- */
843
- getLocalOrUndefined(id?: string): IServerModel<_OptionResource1>;
830
+ getOption(server: ServerService, id: string): Promise<IServerModel<_OptionResource1>>;
844
831
  getAssetTileImageForVariant(variant: _VariantResource1): Promise<string>;
845
832
  getDefaultVariant(option: _OptionResource1): _VariantResource1 | undefined;
846
833
  getDisplayImageSource: (variant?: _VariantResource1) => undefined | string;
@@ -1095,7 +1082,7 @@ export abstract class StepHandle<T extends _AnyStepData1> {
1095
1082
  /**
1096
1083
  * Gets the currently selected variant, or undefined if no variant is selected.
1097
1084
  */
1098
- getCurrentVariant(): _VariantResource1;
1085
+ getCurrentVariant(): Promise<_VariantResource1>;
1099
1086
  /**
1100
1087
  * Returns a list of valid variants for this step.
1101
1088
  */
@@ -1157,7 +1144,7 @@ export class TextStepHandle extends StepHandle<_TextStepData1> {
1157
1144
  /**
1158
1145
  * @returns A list of colors that can be used to fill the text.
1159
1146
  */
1160
- getAvailableColors(): ColorOption[];
1147
+ getAvailableColors(): Promise<ColorOption[]>;
1161
1148
  /**
1162
1149
  * Changes the fill of text related to this step to the new fill value.
1163
1150
  * @param fill A new fill value to use.
@@ -1172,7 +1159,7 @@ export class TextStepHandle extends StepHandle<_TextStepData1> {
1172
1159
  * abled to edit the entire text string including the non-replaceable text.
1173
1160
  * @param shouldCustomizeAll When true the user can configure the entire text string.
1174
1161
  */
1175
- setFullTextCustomization(shouldCustomizeAll: boolean): void;
1162
+ setFullTextCustomization(shouldCustomizeAll: boolean): TextChangeResult;
1176
1163
  /**
1177
1164
  * Changes the text value of text related to this step to a new value.
1178
1165
  * @param userInput Input from the user.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/core",
3
- "version": "0.10.31",
3
+ "version": "0.10.32",
4
4
  "description": "Core client API for interacting with the Spiff Commerce backend.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",