@spiffcommerce/core 37.0.3 → 38.0.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 CHANGED
@@ -737,6 +737,7 @@ declare class AssetService implements AssetManager {
737
737
  uploadAsset(file: FileInfo, assetType: AssetType, anonymous?: boolean, temporary?: boolean): Promise<Asset>;
738
738
  uploadFile(file: File, onProgress: (val: number) => void): Promise<Asset>;
739
739
  removeBackgroundFromAsset(asset: Asset): Promise<Asset>;
740
+ vectorizeAsset(asset: Asset): Promise<Asset>;
740
741
  removePersistedAsset(assetKey: string): void;
741
742
  getPersistedAssets(): PersistedAsset[];
742
743
  registerPersistedAssetListener(callback: () => void): void;
@@ -806,13 +807,17 @@ declare class Variant {
806
807
  */
807
808
  isDefault(): boolean;
808
809
  /**
809
- * @returns The underlying variant resource. Generally not needed but made available just incase.
810
+ * @returns The underlying variant resource. Generally not needed but made available just in case.
810
811
  */
811
812
  getResource(): VariantResource;
812
813
  /**
813
814
  * @returns True when the variant is enabled. False otherwise.
814
815
  */
815
816
  isEnabled(): boolean;
817
+ /**
818
+ * @returns The category for grouping variants in an option.
819
+ */
820
+ getCategory(): string | undefined;
816
821
  }
817
822
 
818
823
  /**
@@ -1459,6 +1464,13 @@ declare class FileUploadGlobalPropertyHandle extends GlobalPropertyHandle {
1459
1464
  * @returns A promise that resolves with the newly generated Asset.
1460
1465
  */
1461
1466
  removeBackgroundFromImage(applyNewAsset?: boolean): Promise<Asset>;
1467
+ /**
1468
+ * Vectorizes the current image selection, stores it in the state, and returns the new asset.
1469
+ * Note: This is a more expensive operation than raster background removal, so should only be used when necessary (e.g., for large images or when the user needs a transparent background for printing).
1470
+ * @param applyNewAsset Optionally applies the new asset to all shared steps. Default: `true`.
1471
+ * @returns A promise that resolves with the newly generated Asset.
1472
+ */
1473
+ vectorizeImage(applyNewAsset?: boolean): Promise<Asset>;
1462
1474
  /**
1463
1475
  * Returns `true` if the state has an image assigned, otherwise `false`.
1464
1476
  */
@@ -3069,6 +3081,7 @@ interface VariantResource {
3069
3081
  default?: boolean;
3070
3082
  namedColor?: string;
3071
3083
  option?: OptionResource;
3084
+ category?: string;
3072
3085
  }
3073
3086
  interface IntegrationOptionResource {
3074
3087
  id?: string;
@@ -3193,9 +3206,12 @@ interface FrameStepData extends Animatable, Placeable, Colorable {
3193
3206
  displaySelectionOnFinishStep?: boolean;
3194
3207
  displayImageOnFinishStep?: boolean;
3195
3208
  disablePlaceholder?: boolean;
3209
+ enableVariantCategories?: boolean;
3196
3210
  initialZoomLevel?: number;
3197
3211
  markSelectionAsCustomField?: boolean;
3198
3212
  markImageAsCustomField?: boolean;
3213
+ shouldVectorize?: boolean;
3214
+ vectorizeMaxColors?: number;
3199
3215
  maxColors?: number;
3200
3216
  focalBlur?: boolean;
3201
3217
  focalBlurRadius?: number;
@@ -3213,6 +3229,7 @@ interface IllustrationStepData extends Animatable, Placeable, Colorable {
3213
3229
  hideColorsInCart?: boolean;
3214
3230
  displaySelectionOnFinishStep?: boolean;
3215
3231
  displayColorsOnFinishStep?: boolean;
3232
+ enableVariantCategories?: boolean;
3216
3233
  enableVariantSearch?: boolean;
3217
3234
  markSelectionAsCustomField?: boolean;
3218
3235
  markColorsAsCustomField?: boolean;
@@ -3227,6 +3244,7 @@ interface IllustrationStepData extends Animatable, Placeable, Colorable {
3227
3244
  interface MaterialStepData extends Animatable {
3228
3245
  hideSelectionInCart?: boolean;
3229
3246
  displaySelectionOnFinishStep?: boolean;
3247
+ enableVariantCategories?: boolean;
3230
3248
  markSelectionAsCustomField?: boolean;
3231
3249
  targetMaterials: string[];
3232
3250
  varySelection?: boolean;
@@ -3235,6 +3253,7 @@ interface ModelStepData extends Animatable {
3235
3253
  replaceProductModel?: boolean;
3236
3254
  hideSelectionInCart?: boolean;
3237
3255
  displaySelectionOnFinishStep?: boolean;
3256
+ enableVariantCategories?: boolean;
3238
3257
  markSelectionAsCustomField?: boolean;
3239
3258
  varySelection?: boolean;
3240
3259
  }
@@ -3249,6 +3268,7 @@ interface ModuleStepData extends Animatable, Placeable {
3249
3268
  interface PictureStepData extends Animatable, Placeable {
3250
3269
  hideSelectionInCart?: boolean;
3251
3270
  displaySelectionOnFinishStep?: boolean;
3271
+ enableVariantCategories?: boolean;
3252
3272
  enableVariantSearch?: boolean;
3253
3273
  markSelectionAsCustomField?: boolean;
3254
3274
  varySelection?: boolean;
@@ -3262,6 +3282,7 @@ interface QuestionStepData extends Animatable {
3262
3282
  interface ShapeStepData extends Animatable, Placeable {
3263
3283
  hideSelectionInCart?: boolean;
3264
3284
  displaySelectionOnFinishStep?: boolean;
3285
+ enableVariantCategories?: boolean;
3265
3286
  markSelectionAsCustomField?: boolean;
3266
3287
  defaultColour?: string;
3267
3288
  excludeFromPrint?: boolean;
@@ -3278,6 +3299,7 @@ interface TextStepData extends Animatable, Placeable, Colorable {
3278
3299
  displayColorOnFinishStep?: boolean;
3279
3300
  displayTextOnFinishStep?: boolean;
3280
3301
  displayStrokeOnFinishStep?: boolean;
3302
+ enableVariantCategories?: boolean;
3281
3303
  markSelectionAsCustomField?: boolean;
3282
3304
  markFillImageAsCustomField?: boolean;
3283
3305
  markColorAsCustomField?: boolean;
@@ -3370,6 +3392,7 @@ interface StepStorage {
3370
3392
  framePatternData?: {
3371
3393
  originalAssetKey?: string;
3372
3394
  backgroundRemovedAssetKey?: string;
3395
+ vectorizedAssetKey?: string;
3373
3396
  useOriginalAsset?: boolean;
3374
3397
  };
3375
3398
  framePatternSrc?: string;
@@ -4363,6 +4386,7 @@ type GlobalPropertyStateAspectStorage = GlobalPropertyStateFileUploadStorage | G
4363
4386
  type GlobalPropertyStateFileUploadStorage = {
4364
4387
  originalAssetKey?: string;
4365
4388
  backgroundRemovedAssetKey?: string;
4389
+ vectorizedAssetKey?: string;
4366
4390
  useOriginalAsset?: boolean;
4367
4391
  colors?: GlobalPropertyStateIllustrationColor[];
4368
4392
  };
@@ -5333,6 +5357,7 @@ declare class IllustrationStepHandle extends StepHandle<IllustrationStepData> {
5333
5357
  isColorPickerEnabled(): boolean;
5334
5358
  isPMSPickerEnabled(): boolean;
5335
5359
  isVariantSearchEnabled(): boolean;
5360
+ isVariantCategoriesEnabled(): boolean;
5336
5361
  }
5337
5362
 
5338
5363
  interface TextChangeResult {
@@ -5426,6 +5451,7 @@ declare class TextStepHandle extends StepHandle<TextStepData> implements CustomC
5426
5451
  * @param stroke A new stroke value to use.
5427
5452
  */
5428
5453
  setStrokeColor(stroke: ColorOption | undefined): Promise<void>;
5454
+ isVariantCategoriesEnabled(): boolean;
5429
5455
  }
5430
5456
 
5431
5457
  declare class PictureStepHandle extends StepHandle<PictureStepData> {
@@ -5437,6 +5463,7 @@ declare class PictureStepHandle extends StepHandle<PictureStepData> {
5437
5463
  */
5438
5464
  selectVariant(variant: Variant): Promise<void>;
5439
5465
  isVariantSearchEnabled(): boolean;
5466
+ isVariantCategoriesEnabled(): boolean;
5440
5467
  }
5441
5468
 
5442
5469
  /**
@@ -5516,6 +5543,7 @@ declare class ParseError extends ImplementationError {
5516
5543
  declare class ModelStepHandle extends StepHandle<ModelStepData> {
5517
5544
  constructor(manager: WorkflowManager, step: Step<ModelStepData>, tags: string[]);
5518
5545
  selectVariant(variant: Variant): Promise<void>;
5546
+ isVariantCategoriesEnabled(): boolean;
5519
5547
  }
5520
5548
 
5521
5549
  declare enum FrameStep {
@@ -5549,6 +5577,12 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
5549
5577
  * @returns A promise that resolves with the newly generated Asset.
5550
5578
  */
5551
5579
  removeBackgroundFromImageSelection(applyNewAsset?: boolean): Promise<Asset>;
5580
+ vectorizeImageSelection(applyNewAsset?: boolean): Promise<Asset>;
5581
+ getBackgroundRemovedImageSelection(): Promise<Asset | undefined>;
5582
+ getVectorizedImageSelection(): Promise<Asset | undefined>;
5583
+ hasOriginalImageSelection(): boolean;
5584
+ hasBackgroundRemovedImageSelection(): boolean;
5585
+ hasVectorizedImageSelection(): boolean;
5552
5586
  changeColors(newFills: Map<string, ColorDefinition>): Promise<void>;
5553
5587
  getImageData(): PatternImageData | undefined;
5554
5588
  getColorOption(): Promise<OptionResource | undefined>;
@@ -5557,6 +5591,8 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
5557
5591
  getOriginalImageColors(): Promise<{
5558
5592
  [key: string]: ColorDefinition;
5559
5593
  } | undefined>;
5594
+ getShouldVectorize(): boolean;
5595
+ getVectorizeMaxColors(): number | undefined;
5560
5596
  getMaxAllowedColors(): number | undefined;
5561
5597
  getUniqueColorCount(): number;
5562
5598
  getCurrentFrameStep(frameData: FrameData, uploading?: any, imageUploadComplete?: any, variants?: VariantResource[]): FrameStep;
@@ -5565,17 +5601,16 @@ declare class FrameStepHandle extends StepHandle<FrameStepData> {
5565
5601
  hasOverlayImageUrl(): any;
5566
5602
  getWhitelistedExtensions(): string[];
5567
5603
  getOriginalImageSelection(): Promise<Asset | undefined>;
5568
- getBackgroundRemovedImageSelection(): Promise<Asset | undefined>;
5569
- hasOriginalImageSelection(): boolean;
5570
- hasBackgroundRemovedImageSelection(): boolean;
5571
5604
  getUseOriginalImageSelection(): boolean;
5572
5605
  setUseOriginalImageSelection(value: boolean): Promise<void>;
5573
5606
  private getFrameStepStorage;
5607
+ isVariantCategoriesEnabled(): boolean;
5574
5608
  }
5575
5609
 
5576
5610
  declare class MaterialStepHandle extends StepHandle<MaterialStepData> {
5577
5611
  constructor(manager: WorkflowManager, step: Step<MaterialStepData>, tags: string[]);
5578
5612
  selectVariant(variant: Variant): Promise<void>;
5613
+ isVariantCategoriesEnabled(): boolean;
5579
5614
  }
5580
5615
 
5581
5616
  declare class QuestionStepHandle extends StepHandle<QuestionStepData> {
@@ -5612,6 +5647,7 @@ declare class ShapeStepHandle extends StepHandle<ShapeStepData> implements Custo
5612
5647
  */
5613
5648
  setCustomColor(color: string): void;
5614
5649
  getCustomColor(): string;
5650
+ isVariantCategoriesEnabled(): boolean;
5615
5651
  }
5616
5652
 
5617
5653
  declare const shortenUrl: (longUrl: string) => Promise<string>;