@spiffcommerce/core
Version:
Core client API for interacting with the Spiff Commerce backend.
615 lines (336 loc) • 20.8 kB
Markdown
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
#### Types of changes
- `Added` for new features.
- `Changed` for changes in existing functionality.
- `Deprecated` for soon-to-be removed features.
- `Removed` for now removed features.
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.
## [29.0.1] - 07-08-2025
## Fixed
- Missing `ExportedStepData` types.
## [29.0.0] - 06-08-2025
## Changed
- The `getExportedData` method has been renamed `getExportedStepData` for clarity, it now returns a list of steps and their metadata chronological to the workflow. Localization has also been removed as this is a theme concern.
## [28.0.0] - 30-07-2025
## Changed
- The `duplicateBundle` method now returns a function that creates a bundle object, rather than creating the object automatically.
## Fixed
- Fixed bugs around reloading state.
## [27.3.0] - 28-07-2025
## Added
- CurrencyService & CurrencyContext can now be used to correctly transform values for display. See `client.getCurrencyContext`
## [27.2.1] - 28-07-2025
## Fixed
- `WorkflowExperience.assignCustomerDetails` should no longer fail when you have ownership of the associated Transaction.
## [27.2.0] - 24-07-2025
## Added
- Bundles now have the `applyGlobalPropertyState` method for copying one global state onto another.
## [27.1.1] - 23-07-2025
## Fixed
- Correctly the case of handle multiple text steps that are conditional and share a text aspect.
## [27.1.0] - 16-07-2025
## Changed
- Added support for Handlebars in text steps.
## [27.0.0] - 15-07-2025
## Changed
- Modified the functions for logging in as a customer.
## [26.40.0] - 10-07-2025
## Added
- Added `setDispatchDate` and `setPurchaseOrder` to `Bundle`.
## [26.39.0] - 08-07-2025
## Fixed
- The function `fetchProductsFeed` on `ProductCollection` now correctly reads from the in-memory cache for repeated calls with the same inputs.
## [26.38.0] - 07-07-2025
## Added
- `WorkflowManager` now has the function `addRecipientCallback` to listen to changes to the attached Recipient.
## [26.35.0] - 03-07-2025
## Added
- The `Bundle` type now has the `productsCount` property.
## [26.33.0] - 02-07-2025
## Added
- The method `getBundlesForCustomer` now has an "ordered" option.
## [26.31.0] - 24-06-2025
## Fixed
- Fixed issues with authorizing certain requests affecting recipients.
## [26.30.0] - 23-06-2025
## Added
- New global function `getProductCollections`, which fetches a list of Product Collections by their ids.
## [26.29.3] - 19-06-2025
## Fixed
- The method `updateRecipient` now saves its arguments correctly.
## [26.29.1] - 18-06-2025
### Fixed
- Fix issues with bleeding-edge endpoints.
## [26.29.0] - 18-06-2025
### Added
- The method `updateRecipient` on `WorkflowManager`.
## [26.28.0] - 18-06-2025
### Added
- The methods `filterProducts` and `fetchProductsFeed` on `ProductCollection` now accept the optional parameters `sortKey` and `sortDescending`. Sort key can be one of: Default, Name, Price.
## [26.27.0] - 11-06-2025
### Added
- The methods `filterProducts` and `fetchProductsFeed` on `ProductCollection` now accept an optional parameter `tags`, which is an object with the shape `{ include: string[]; exclude: string[]; }`. Only products that have all tags in `include` and no tags in `exclude` will be returned. If either array is provided as empty they will have no effect on the query.
## [26.26.0] - 27-05-2025
### Changed
- The event emitter on `Bundle` has been improved and made generic. Two new events will also now fire. One for a workflow being added and one for a workflow being removed.
### Added
- The `MetafieldManager` is now exposed for use. Certain functions such as CollectionProduct will now expose utility functions that allow pulling the metafields for the entity being called on.
## [26.24.0] - 12-05-2025
### Changed
- The functions `getIntegrationProductById` and `getIntegrationProductFromExternalIds` now accept an additional boolean parameter that allows you to fetch all of the linked integration products on the product you have requested.
### Fixed
- The `duplicateBundle` call no longer fails due to missing GraphQl fragments.
## [26.23.2] - 16-04-2025
### Fixed
- The `duplicateBundle` will now correctly duplicate the global property state.
## [26.22.0] - 07-04-2025
### Changed
- The `approve` and `reject` functions on `Bundle` now accept a `stakeholderId?: string` to specify which stakeholder you are interacting as.
## [26.21.1] - 03-04-2025
### Fixed
- Fixed a bug around illustrations in global configurations being initializd with the incorrect amount of channel aspects.
## [26.21.0] - 01-04-2025
### Added
- The `getQuoteCompleteMessage` method on bundles. Pass the return value of this method to Theme Bridge's `SpiffThemeLoader.completeQuote` method.
## [26.20.0] - 31-03-2025
### Added
- Added new methods to the `FileUploadGlobalPropertyHandle` for overriding SVG colors:
- `getImageWithColors`: Returns a promise that resolves with the current image with the current color configuration, if applicable.
- `getAvailableColors`: Returns the colors from the configured color option.
- `getCurrentColors`: Returns the current color configuration.
- `isColorPickerEnabled` and `isPmsPickerEnabled`: Return whether the color picker and pms picker are enabled, respectively.
- `getOriginalColors`: Returns a promise that resolves with the original color configuration of the image asset.
- `changeColors`: Updates the current color configuration and propagates the changes to all connected workflow experiences.
## [26.19.0] - 26-03-2025
### Added
- The `generateQuoteId` method on bundles.
## [26.18.0] - 24-03-2025
### Added
- Added `OneToOne` mode to `BundleDesignCreationCartAddMode`, which adds each Transaction of a Bundle to the cart as individual line items.
## [26.17.0] - 24-03-2025
### Added
- The object returned by `Bundle.finish()`, `BundleDesignCreationMessage`, has a new field `cartAddMode?: BundleDesignCreationCartAddMode`. This controls the strategy for adding the items of a Bundle to an ecommerce cart.
## [26.16.1] - 18-03-2025
### Changed
- If both the partner and workflow have terms and conditions, the workflow wins.
## [26.15.0] - 03-03-2025
### Added
- Methods on experiences and bundles to attach addresses and organizations.
## [26.13.0] - 27-02-2025
### Changed
- The selectVariant method of ColorOptionGlobalPropertyHandle objects now has an optional `channel` parameter for color channels.
## [26.12.0] - 26-02-2025
### Changed
- The global function `getIntegration` now supports a second parameter, `themeConfigurationId`, which allows you to override the Theme Configuration that is returned on the object.
## [26.11.0] - 24-02-2025
### Changed
- The `createPreviewImage` parameter in `Bundle.finish()` is now provided a second argument, `shouldRender3D: boolean`, which can be passed to `WorkflowExperience.createPreviewImage()`
## [26.10.0] - 24-02-2025
### Added
- Ability to handle illustrations with asset configurations.
## [26.9.1] - 20-02-2025
### Fixed
- Resolved an issue allowing empty text to pass mandatory checks on the text step.
## [26.8.0] - 06-02-2025
### Fixed
- Resolved an issue causing clients using module steps not to handle errors correctly.
## [26.7.9] - 21-01-2025
### Fixed
- Resolved an issue when duplicating a bundle causing any copied workflow experiences to be missing in the javascript class returned.
## [26.7.6] - 10-01-2025
### Fixed
- Reverted the previous due to issues with other areas of opentype.
## [26.7.5] - 10-01-2025
### Added
- Updated opentype to access more functionality around font outlining.
## [26.7.4] - 19-12-2024
### Fixed
- The version of Opentype we use now correctly includes the fill functionality of the font outlining tool. Fill will now be correctly applied to any text outlined by this tool.
## [26.7.3] - 18-12-2024
### Added
- Added the `illustrationStep.isPMSPickerEnabled` function. This function returns a boolean indicating whether the PMS picker is enabled for the step.
## [26.7.2] - 02-12-2024
### Fixed
- Corrected an issue with `TextStepService.availableFillColors` not returning the correct colors under certain conditions.
## [26.7.0] - 27-11-2024
### Added
- Text steps now support custom stroke. Similar to other color customisation features, this is accessible via the functions `getAvailableStrokeColors`, `getStrokeColor`, and `setStrokeColor` on `TextStepHandle`.
The thickness of the stroke, the colors to select from, and other options, are configurable via the Spiff Hub in the Workflow editor.
## [26.5.2] - 20-11-2024
### Fixed
- Fixed issues regarding EXIF orientation calculation throwing errors under specific conditions.
## [26.5.1] - 20-11-2024
### Fixed
- SVG Files uploaded to the platform will now have widths and heights specified in non-pixel values
stripped. This shouldn't have any effect on user uploads but will prevent the system from breaking when
encountering these values.
## [26.5.0] - 18-11-2024
### Added
- ProductCollection has a new function `fetchProductsFeed`, which fetches a paginated array of product collection products (entries in the product collection). Note that this does not edit the internal array of previously fetched products like `fetchProducts` does, so calls to `fetchProductsFeed` will not change the array that is returned by `getProducts`. If `fetchProducts` has already been called, or if the ProductCollection has been initialised with products, `fetchProductsFeed` will avoid making any network calls where it can.
## [26.4.0] - 07-11-2024
### Added
- The client now has a `placeOrder` function. This allows ordering any combination of transactions. Remember that this may require additional permissions on the application key.
- Bundle now has a `placeOrder` function that will place an order for the bundle. The will create an order containing all transactions in the bundle. Remember that this may require additional permissions on the application key.
- Interface `Order` and `OrderItem` have been added to the package. These interfaces can be used with the new placeOrder functions.
## [26.3.0] - 04-11-2024
### Changed
- IllustrationStepHandle now accepts providing PMS values when calling `setColor`
- IllustrationStepHandle's `getAvailableColors` function now returns the names of the variants as PMS values.
## [26.1.2] - 30-10-2024
### Fixed
- The ProductCollection class will no longer request the products it contains if they are already present in the cache.
## [26.1.1] - 30-10-2024
### Changed
- Merged some GraphQL calls to reduce the number of requests made when loading a bundle.
## [26.1.0] - 30-10-2024
### Changed
- Several internal functions have been changed, been merged or removed. This should not affect any public API.
- `rehydrateSerializedLayout` is no longer exported from the package. No functionality is intended to take its place. The function was always intended for internal use only.
## [26.0.0] - 30-10-2024
### Changed
- `getWorkflowExperience` has removed 3 deprecated parameters in favor of the options object. The options object is no longer optional.
- `configureUrls` has been removed in favor of the `configure` function. Please use `configure` moving forwards.
- The client constructor should know be called with an application in most use cases. We'll continue locking down functionality to require this in the future.
## [22.0.0] - 10-07-2024
### Changed
- `matchHexToPms` now returns a list of objects of `{ pms: string; hex: string; }` rather than strings.
### Added
- `findPmsColors(input: string, limit?: number): PmsSearchResult[]`: A function to find PMS colors by name using fuzzy search.
## [21.8.1] - 27-03-2024
### Fixed
- `WorkflowExperience.getTotalPriceSubunits` no longer always returns the discounted price.
## [21.8.0] - 26-03-2024
### Added
- `Bundle.removeStakeholder(email: string): Promise<void>`: Removes a single stakeholder from the Bundle, via email address.
## [21.7.1] - 25-03-2024
### Fixed
- `Bundle.getAllStakeholders()` now returns correct results on subsequent calls.
## [21.7.0] - 25-03-2024
### Added
- `CollectionProduct.getAllWorkflows(): ProductWorkflow[]`: Returns all workflows associated with this product.
## [21.6.0] - 22-03-2024
### Added
- `WorkflowExperienceEventType.PriceBreakChanged`: The relevant event fires whenever the price break to be used in a WorkflowExperience changes. This even will fire when the quantity changes, and will also fire when in a Bundle when other WorkflowExperiences using the same Product have quantity changes (or are added & removed from the Bundle).
## [21.5.0] - 22-03-2024
### Changed
- `StepHandle`: The override global property state setting now has a different value for each Global Property Aspect type. The get/set functions have been renamed and have an extra parameter to determine the Aspect Type.
- `getOverrideGlobalPreviewConfiguration` -> `getOverrideGlobalPropertyConfiguration(type: AspectType): boolean`.
- `setOverrideGlobalPreviewConfiguration` -> `setOverrideGlobalPropertyConfiguration(type: AspectType, value: boolean): void`
## [21.4.1] - 21-03-2024
### Changed
- `readTransactionsQuery` now fetches `printFileUrl1` to `printFileUrl5` for each transaction.
## [21.4.0] - 20-03-2024
### Added
- `StepHandle`:
- `getOverrideGlobalPreviewConfiguration(): boolean`: Returns a boolean that indicates whether this step should override (ignore) Global Property state.
- `setOverrideGlobalPreviewConfiguration(value: boolean): void`: Modifies whether this step should override (ignore) Global Property state.
- `getGlobalPropertyAspects(configurationId: string): string[]`: Returns all Aspect names in the supplied Global Property Configuration that this step is configured to use.
- `Bundle.getGlobalPropertyConfiguration(): GlobalPropertyConfiguration | undefined`: Returns the Global Property Configuration object associated with the Bundle, if it exists.
## [21.3.1] - 20-03-2024
### Fixed
- When a `Bundle` is loaded by ID, the `WorkflowExperience` objects it loads will not correctly be linked internally. This resolves issues regarding price breaks not calculating correctly on bundle reload when multiple transactions share a product.
## [21.3.0] - 20-03-2024
### Added
- `WorkflowExperience.priceBreakToBeApplied()` returns the percentage that will be used in `WorkflowExperience.getTotalPriceSubunits()` and related methods.
### Changed
- `WorkflowExperience.getTotalPriceSubunits()` and related methods now consider price breaks in their calculations, but also now have a `disablePriceBreaks` argument.
## [21.2.1] - 15-03-2024
### Fixed
- Fixed Global Property Handles not updating values when WorkflowExperiences in the Bundle share the same Workflow.
## [21.2.0] - 15-03-2024
### Added
- `FileUploadGlobalPropertyHandle`:
- `hasImage(): boolean`: Returns a boolean value indicating if the associated state has an image.
- `getImage(): Promise<Asset | undefined>`: Retrieves the current image from the server.
## [21.1.1] - 15-03-2024
### Fixed
- Exported missing `AspectType` for global property handles.
## [21.1.0] - 14-03-2024
### Added
- `Bundle.hasGlobalProperties(): boolean`: Returns true when the bundle is linked to a Global Property Configuration.
## [21.0.1] - 13-03-2024
### Fixed
- Package now supplies this `CHANGELOG.md` in published releases.
## [21.0.0] - 13-03-2024
### Added
- `DesignCreationMessage` now has `quantity: number | undefined`.
### Changed
- `Bundle.finish()` no longer returns an array of `DesignCreationMessage` objects, but instead returns a `BundleDesignCreationMessage` object which wraps the array of `DesignCreationMessage` entries.
## [20.5.1] - 12-03-2024
### Fixed
- `WorkflowExperience.getSelectionPriceSubunits()` (and consequently `getTotalPriceSubunits()`) can no longer return `NaN`.
## [20.5.0] - 12-03-2024
### Added
- `WorkflowManager.injectIntoPreviewService()` now has a second argument `refocusCamera`, a boolean which allows you to disable the automatic refocusing of the camera when the model is loaded. This requires `@spiffcommerce/preview@^5.7.0`.
## [20.4.5] - 08-03-2024
### Added
- `RenderableScene` objects will now contain a `workflowScene: WorkflowScene` field. This is only provided for backwards compatibility and is considered deprecated functionality.
## [20.4.4] - 08-03-2024
### Fixed
- Updating quantity via `WorkflowExperience.setQuantity()` will now correctly update on the server.
## [20.4.3] - 08-03-2024
### Changed
- `WorkflowExperience.setQuantity()` now returns a promise that resolves once the quantity has been updated on the server.
## [20.4.0] - 08-03-2024
### Added
- `Transaction` entities now have `quantity: number | undefined`.
- New functions on `WorkflowExperience` for managing quantity:
- `getQuantity()`: The amount that was, or will be, ordered of the underlying `Transaction`. This will default to `1` if the value is undefined. If you want to read the raw value, use `getWorkflowManager().getTransaction().quantity`.
- `setQuantity(<number>)`: Updates the quantity value on the underlying `Transaction` entity. Must be >= 1.
- New events functionality on `WorkflowExperience`. Currently the only event is `QuantityChanged`.
- `addEventListener(<type>, <callback>)`: Registers a callback function to be called when the specified event is raised. The associated `WorkflowExperience` is passed as a parameter to the callback function.
- `removeEventListener(<type>, <callback>)`: Removes a previously registered callback.
## [20.3.0] - 07-03-2024
### Added
- `CollectionProduct.getCurrentIntegration()`: returns the `IntegrationProductResource` associated with the product that is linked to the current Integration (resolved via the application key).
## [20.2.2] - 05-03-2024
### Changed
- `WorkflowExperience.getStepById(<string>)` now internally caches the `StepHandle` objects that it creates. This resolves an issue with functional rendering systems that re-render when the object reference changes, where they would re-renderer whenever this function was called even if the object was identical.
## [20.2.1] - 29-02-2024
### Changed
- The union type `GetWorkflowOptions` has some of its entries wrapped in another union. The types that will create a brand new `Transaction` are now nested under `GetNewWorkflowOptions`:
```ts
// Before
export type GetWorkflowOptions =
| GetWorkflowFromTransactionOptions
| GetWorkflowFromIntegrationProductOptions
| GetWorkflowFromExternalProductOptions;
// After
export type GetNewWorkflowOptions =
| GetWorkflowFromIntegrationProductOptions
| GetWorkflowFromExternalProductOptions;
export type GetWorkflowOptions = GetWorkflowFromTransactionOptions | GetNewWorkflowOptions;
```
## [20.2.0] - 29-02-2024
### Added
- `SpiffCommerceClient.getIntegrationProduct(<options>)`: Fetches an `IntegrationProduct` object. Essentially a wrapper for the functions `getIntegrationProductById` and `getIntegrationProductFromExternalIds`. The options object type is as follows:
```ts
{
type: "integration";
integrationProductId: string;
} | {
type: "external";
externalIntegrationId: string;
externalProductId: string;
}
```
## [20.1.0] - 23-02-2024
### Added
- `IntegrationProduct.getAllWorkflows()`: Returns an array of `ProductWorkflow`, ordered by their internal `index` value (matches the order seen on the SpiffCommerce Hub).
## [20.0.1] - 23-02-2024
### Changed
- `StepHandle.executeAnimations()` now logs a warning to the console when the associated `WorkflowManager` is not associated with a `ThreeDPreviewService`.
## [20.0.0] - 15-02-2024
### Added
- Additional configuration options for GraphQL on bundles.
- A separate fetchProducts function on the ProductCollection interface.
### Changed
- Removed async on getProducts call.
### Removed
- Unused normalize.css file.
- Identical links assigned in each translation file.
- Duplicate index file for the english version.