@scayle/storefront-core
Version:
Collection of essential utilities to work with the Storefront API
1,234 lines (708 loc) • 32 kB
Markdown
# @scayle/storefront-core (v7)
This changelog contains all changes of `@scayle/storefront-core` above v6.0.0 and below v7.0.0.
## 7.69.3
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.13.0
## 7.69.2
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.12.0
## 7.69.1
### Patch Changes
- Extend `FetchProductsByCategoryParams` type to support `trackSearchAnalyticsEvent?: boolean`
- Allow passing of the `trackSearchAnalyticsEvent` parameter into the `getProductsByCategory` RPC method.
**NOTE**: To prevent logging the search term on every page request when when paginating with the `page` parameter, the `trackSearchAnalyticsEvent` parameter is only passed on the first page (`page === 1`).
For more details on how to utilize this, check the [SCAYLE Search Analytics section](https://scayle.dev/en/core-documentation/the-basics/shops/search#scayle-search-analytics) in the SCAYLE Resource Center.
## 7.69.0
### Minor Changes
- Move test factories to separate entry point. They are now available via `@scayle/storefront-core/dist/test/factories` (or `@scayle/storefront-core/test/factories` when `moduleResolution` is set to `Bundler`.
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.11.0
## 7.68.0
### Minor Changes
- Set `sapiClient` in `RpcContext` as required to improve the upgradability of RPC methods.
## 7.67.1
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.10.1
## 7.67.0
### Minor Changes
- Expose SAPI test factories externally
## 7.66.7
### Patch Changes
- Updated dependency `@scayle/storefront-api@17.9.5` to `@scayle/storefront-api@17.10.0`
## 7.66.6
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.10.0
## 7.66.5
### Patch Changes
- Merging wishlists now retains the `variantId`, `itemGroup` and `customData` when present on the source wishlist item.
## 7.66.4
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.5
## 7.66.3
### Patch Changes
- Response objects with an error status code should not be cached
## 7.66.2
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.4
## 7.66.1
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.3
## 7.66.0
### Minor Changes
- Add `fetchNavigationTreeByName` rpc.
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.2
## 7.65.11
### Patch Changes
- Export `NavigationItemSuggestion` type
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.1
## 7.65.10
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.9.0
## 7.65.9
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.8.1
## 7.65.8
### Patch Changes
- Fixed an issue with handling the deprecated MD5 hash support, e.g. used for generating a user-specific basket hash, resulting in a potential application crash
## 7.65.7
### Patch Changes
- Delete `refreshToken` if it fails to refresh the access token
## 7.65.6
### Patch Changes
- Resolved an issue where the `cache` value from parameters was being unintentionally overwritten by the default value for `getProductsByCategory` rpc.
## 7.65.5
### Patch Changes
- Support passing an internal access header
- Make `getProductsCount`, `getFilters` and `getProductsByCategory` RPC methods handle their parameters consistently
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.8.0
## 7.65.4
### Patch Changes
- Restore filtered list of error status codes in `oauthLogin` (400, 404) `oauthRegister` (400, 409, 422) and `oauthGuestLogin` (400, 409)
## 7.65.3
### Patch Changes
- Fix the `getFilters` RPC method not considering `includeSellableForFree` when calculating the product count
## 7.65.2
### Patch Changes
**Dependencies**
- Updated dependency to @scayle/storefront-api@17.7.0
## 7.65.1
### Patch Changes
- Fix regression in product RPC methods where the categoryId may not be resolved from the category path
## 7.65.0
### Minor Changes
- Improves the handling of `getOrderDataByCbd` RPC to return descriptive errors in case the validation of the token fails.
In case the token can't be validated using the Checkout Secret, this is now returned and a warning on the server is logged.
If the token has expired, this is now also returned and logged on the server.
- Support passing `categoryId` as an alternative to the category path in `getProductsByCategory` and `getFilters`
### Patch Changes
- Fixed cached fallback ttl to be used only if passed `option.ttl` is undefined
## 7.64.4
### Patch Changes
- Replaced `radash` utils with custom native implementations
## 7.64.3
### Patch Changes
- Add support for `orderCustomData` on the basket endpoints
- Updated dependencies
- @scayle/storefront-api@17.6.0
## 7.64.2
### Patch Changes
- Add more specific return type for `getFlattenedMaterialComposition`
## 7.64.1
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.5.0
## 7.64.0
### Minor Changes
- Resolve a issue that prevents filters from working as expected on the search page
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.4.4
## 7.63.1
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.4.3
## 7.63.0
### Minor Changes
- Deprecate `RpcContext.storeCampaignKeyword`
## 7.62.0
### Minor Changes
- Return `ErrorResponse` from RPC when Session is missing
## 7.61.0
### Minor Changes
- Add `sapiClient: StorefrontAPIClient` to `RpcContext`
Deprecate `bapiClient` in favour of `sapiClient`
## 7.60.1
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.4.2
## 7.60.0
### Minor Changes
- Instead of throwing errors, RPCs will now return an `ErrorResponse` object conforming to [RFC9457](https://datatracker.ietf.org/doc/html/rfc9457).
In addition to this change, existing RPCs have been reviewed and updated to return more accurate and descriptive HTTP status codes.
This change allows us to provide more informative error messages and utilize standardized HTTP status codes for better context. The `ErrorResponse` object can include additional details about the error, making it easier to identify and address root causes.
**Action Required:**
Code that previously made direct RPC calls (calling the function directly instead of via `useRpc` or `rpcCall`) and relied on `try {} catch {}` blocks for error handling needs to be updated. Moving forward, please check the status of the RPC response directly.
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.4.1
## 7.59.2
### Patch Changes
- Resolved a memory leak within the `timeout` util where `setTimeout` might not have been garbage collected if the promise had been resolved/rejected before the timeout itself
## 7.59.1
### Patch Changes
- Updated dependencies
- @scayle/storefront-api@17.4.0
## 7.59.0
### Minor Changes
- Add `storefront:afterLogin` and `storefront:afterLogout` hooks to the respective RPC.
Add `callHook`, `callHookParallel` and `callHookWith` types to `RpcContext`
## 7.58.3
### Patch Changes
- Upgrades to the new Wishlist from @scayle/storefront-api
- `getDefaultFractionDigits` will return 2 if `maximumFractionDigits` is not defined
- Updated dependencies
- @scayle/storefront-api@17.3.0
## 7.58.2
### Patch Changes
- Adds the `X-Shop-Id` header to the request when revoking an access token.
## 7.58.1
### Patch Changes
- Fixed an issue by respecting `forceTokenRefresh` flag when calling the `getAccessToken` RPC
## 7.58.0
### Minor Changes
- Deprecate `storefrontAccessToken` of `UserAuthentication`. Use `getAccessToken` RPC to get a valid access token instead.
Deprecated `loginShopId`. `loginShopId` is no longer needed, because each shop now has its own session cookie.
- Add `getAccessToken` RPC to retrieve refreshed access tokens
## 7.57.0
### Minor Changes
- Expose `properties` with option for each category RPC method payload
## 7.56.0
### Minor Changes
- Add refresh token logic to customer API client
### Patch Changes
- Ensure `user.storefrontAccessToken` is up to date when calling the `getUser` RPC
## 7.55.0
### Minor Changes
- Allow disabling the `HashAlgorithm` by setting its value to `none` within a shop config.
- Added exports for `ProductSortConfig` type and enums `APISortOption` and `APISortOrder`.
## 7.54.0
### Minor Changes
- Add new function `purifySensitiveValue` to `sanitizationHelpers` to purify specific value.
- Introduced a new parameter `showFirstAndLastChar` to both `purifySensitiveValue` and `purifySensitiveData`.
## 7.53.0
### Minor Changes
- Deprecate `isCmsPreview` flag in `RpcContext`. This flag indicated that the current session is or has been inside of a CMS editor. With the the introduction of 'Live Preview' for the cms provider 'contentful' and 'storyblok' this flag is no longer necessary.
### Patch Changes
- Removes option `considerItemGroupForUniqueness` from `addItemsToBasket` since this is now enabled by default.
- Updated dependencies
- @scayle/storefront-api@17.2.0
## 7.52.1
### Patch Changes
- Fix `getWishlist` falling back to basket `withParams` instead of wishlist `withParams`
## 7.52.0
### Minor Changes
- Add `getCheckoutToken` RPC, which provides access token and checkout JWT needed by the checkout web component.
## 7.51.1
### Patch Changes
- Update `ShopConfiguration` types
- Updated dependencies
- @scayle/storefront-api@17.1.0
## 7.51.0
### Minor Changes
- Allow extending the `RpcContext` type by augmenting the `AdditionalRpcContext` interface.
## 7.50.1
### Patch Changes
- Add missing `BuyXGetYEffect` and `AutomaticDiscountEffect` exports
- Updated dependencies
- @scayle/storefront-api@17.0.1
## 7.50.0
### Minor Changes
- Upgraded to `@scayle/storefront-api@v17.0.0` and replaced `@aboutyou/backbone`
Noticeable changes are:
- Rename `BapiClient` to `StorefrontAPIClient`
- Removed basic auth support from `initBapi`
## 7.49.4
### Patch Changes
- Deprecate the `getBadgeLabel` function since this is application specific code and translations should be handled per project
## 7.49.3
### Patch Changes
- Updated dependencies
- @aboutyou/backbone@16.3.0
## 7.49.2
### Patch Changes
- Fixed a bug where the `addItemToWishlist` RPC method returned an empty response upon failure.
- Updated dependencies
- @aboutyou/backbone@16.2.2
## 7.49.1
### Patch Changes
- Fix accidental rename of `getFlattenedVariantCrosssellings` in the previous release
## 7.49.0
### Minor Changes
- Add optional `state` attribute to order address for US addresses
### Patch Changes
- Add better type support for `getFlattenedVariantCrosssellings` with generic type
## 7.48.2
### Patch Changes
- Fixes an issue where the `refreshToken` was not exposed on the `RPCContext` even if the user is logged in.
## 7.48.1
### Patch Changes
- Updated `purifySensitiveData` to ensure that empty secrets are logged as empty strings, enhancing clarity in logged configurations.
## 7.48.0
### Minor Changes
- Add support for dynamically adding query parameters to the IDP redirect callback URLs to be read back when the user returns from the IDP.
```ts
const { data: externalIDPRedirects } = await useIDP({
queryParams: { redirectTo: '/account' },
})
```
Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
### Patch Changes
- Added merge basket and merge wishlist functionality after login with IDP
- Updated dependencies
- @aboutyou/backbone@16.2.1
## 7.47.0
### Minor Changes
- Add `resolveSearch` and `getSearchSuggestions` RPC methods
## 7.46.1
### Patch Changes
- Revert breaking change in `handleIDPLoginCallback` signature
## 7.46.0
### Minor Changes
- Add new RPC method `getProductsByReferenceKeys`
## 7.45.0
### Minor Changes
- Improve typing of RPC methods by using `satisfies` instead of assertions. The [`satisfies` operator](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html) validates that an expression matches a type without changing the type of that expression. For RPC methods it can be used to enforce that a function conforms to the spec of an RPC method, without affecting the more specific inferred type of the function.
You can use this pattern in your own custom RPC methods as well.
For example:
```ts
export const custom: RpcHandler<{ shop: number }> = (context: RpcContext) => {
return {
shop: context.shopId,
}
}
```
```ts
export const custom = (
context: RpcContext,
) => {
return {
shop: context.shopId,
}
} satisfies RpcHandler<{ shop: number }>
```
In the first case, `custom` will be typed as `RpcHandler<{shop: number}>` or essentially a function takes no parameters and returns `{ shop: number } | Response<{shop: number}>`. In the second case, it will be typed as a function which takes no parameters and returns `{ shop: number }` which is more specific. The more specific typing may be useful if you are calling the custom RPC function as both a registered RPC method and regular function.
## 7.44.1
### Patch Changes
- Updated dependencies
- @aboutyou/backbone@16.2.0
## 7.44.0
### Minor Changes
- Expose the `loginWithIDP` function from the `useSession` composable.
- Changes the signature of `handleIDPLoginCallback` to receive an object with the code inside instead of just the code for improved logging behavior.
## 7.43.0
### Minor Changes
- Add `createAndPurifyHeaders` sanitization helper
## 7.42.1
### Patch Changes
- Fix usage of the same cache key prefix for `getCategoryByPath`
## 7.42.0
### Minor Changes
- Add `getCategoryByPath` RPC method
## 7.41.3
### Patch Changes
- Fix lost session if user refresh is called while not logged in
## 7.41.2
### Patch Changes
- Updated dependencies
- @aboutyou/backbone@16.1.2
## 7.41.1
### Patch Changes
- Fixes an issue where we were trying to read siblings information from a product where the data was not available
## 7.41.0
### Minor Changes
- Add `purifySensitiveData` sanitization helper
## 7.40.1
### Patch Changes
- patch accessToken on refreshUser RPC Method
## 7.40.0
### Minor Changes
- Export Campaign types from @aboutyou/backbone
## 7.39.1
### Patch Changes
- Persist accessToken to user.authentication
## 7.39.0
### Minor Changes
- Add `sortable` option to `groupFilterableValuesByKey` filter helper
- Add `sortable` option to `getGroupedFilterableValues` to provide the ability for custom sorting implementation for specific filtersGroups
- Authentication RPC methods include status codes in error cases
## 7.38.1
### Patch Changes
- Fix potential empty user after login
## 7.38.0
### Minor Changes
- Allow the session of an `RpcContext` to be undefined
BREAKING: This changes the structure of the `RpcContext`, so it may be a breaking change if you have written custom RPC methods.
The affected properties on the `RpcContext` are `sessionId`, `wishlistKey` and `basketKey` and the affected methods are `destroySession`, `createUserBoundSession`, `updateUser`, and `updateTokens`. If you use these methods or properties in a custom RPC method, make sure that you handle the case where they might be undefined. TypeScript will also catch these cases if you have `strictNullChecks` enabled.
You can check `context.sessionId` (or another session-dependent property) to determine if the session is present. If one of these properties is present, all will be. Alternatively, you can call `assertSession(context)` before referencing any properties on the context. If the session is not present, an error will be thrown. For any usage of `context` after `assertSession` is called, TypeScript will understand that the session properties are present.
## 7.37.0
### Minor Changes
- Update dependency `jose` to the latest `5.2.0` version
## 7.36.0
### Minor Changes
- Support `Response` returns in RPC methods
- Handle 401 from CO and delete session
## 7.35.0
### Minor Changes
- Change `oauthForgetPassword` payload signature to accept `email` only
## 7.34.1
### Patch Changes
- Fix type errors
## 7.34.0
### Minor Changes
- We added support for Identity Provider (IDP), enhancing our authentication and identity management capabilities.
## 7.33.0
### Minor Changes
- Previously the caching time for product RPCs was one hour which could easily lead to outdated product information for a long time.
The `getProductById` and `getProductsByIds` RPCs are now cached for 5 Minutes and `getProductsByCategory` is now cached for 15 Minutes.
## 7.32.0
### Minor Changes
- Use new password change API when oauth is enabled
## 7.31.0
### Minor Changes
- Update SAPI SDK to v16
### Patch Changes
- Fix filter helper to not return null values
## 7.30.0
### Minor Changes
- Allow `null` values for `promotionId` within the basket payload
## 7.29.0
### Minor Changes
- Remove basic `gzip` compression in custom `unstorage` caching interface in favor of custom `@scayle/unstorage-compression-driver`
## 7.28.2
### Patch Changes
- `fetchUser` and `refreshUser` are now proper RPC methods
- Fix parsing error from authentication service
- Use a common API client for interacting with Checkout Customer API
## 7.28.1
### Patch Changes
- Types: shop_id should be optional in updatePasswordByHash
## 7.28.0
### Minor Changes
- Use native fetch instead of axios
## 7.27.0
### Minor Changes
- Introduce gzip-based compression for unstorage cache interface
- Upgrade package `@aboutyou/backbone`to `v15.14.3`
## 7.26.0
### Minor Changes
- Don't return oauth tokens from RPC methods
## 7.25.1
### Patch Changes
- Cache purging should not remove unrelated keys
## 7.25.0
### Minor Changes
- Add `PromotionEffectType` constant and type
## 7.24.1
### Patch Changes
- Forbid saving `null` and `undefined` results to the cache
## 7.24.0
### Minor Changes
- Remove `sanitize` helper function and jsdom dependency
## 7.23.0
### Minor Changes
- Add `runtimeConfiguration` property to the `RPCContext`
## 7.22.1
### Patch Changes
- Add license file
## 7.22.0
### Minor Changes
- Upgrade package `@aboutyou/backbone`to `v15.14.1`
## 7.21.0
### Minor Changes
- Add `promotion` RPC methods and types
- Add promotion data within the basket payloads
### Patch Changes
- Fix product URL generation, remove additional special characters that can break routing
## 7.20.0
### Minor Changes
- Upgrade backbone to the `v15.12.1`
## 7.19.1
### Patch Changes
- The `auth` config is optional
## 7.19.0
### Minor Changes
- Support setting default `with` params in the module options
## 7.18.0
### Minor Changes
- Expose error codes from BAPI for the basket rpc methods
## 7.17.0
### Minor Changes
- Limit perPage for getBrands and getProductsByCategory to 100
## 7.16.0
### Minor Changes
- Support expiring CBD tokens
## 7.15.1
### Patch Changes
- Remove unnecessary dependencies
## 7.15.0
### Minor Changes
- Support importing all dist/ files directly
## 7.14.3
### Patch Changes
- Import fix
## 7.14.2
### Patch Changes
- Make redis an optional dependency
## 7.14.1
### Patch Changes
- Remove unused body-parser dependency
## 7.14.0
### Minor Changes
- Read OAuth settings from the RpcContext
## 7.13.0
### Minor Changes
- Save user to session during login/register process. This will fix wrong wishlist/basket keys, in the RpcContext, after the login/registering.
- Safe user to session during login process. This will fix wrong wishlist/basket keys , in the RpcContext, after the login.
## 7.12.2
### Patch Changes
- Replace crypto with uncrypto
## 7.12.1
### Patch Changes
- Export BapiClient and Redirect from BAPI
## 7.12.0
### Minor Changes
- `to` prop of `BreadcrumbItem` returned from `getBreadcrumbsFromPath` now start with `/`
## 7.11.0
### Minor Changes
- Move `deserializeFilters` and `serializeFilters` to `@scayle/storefront-core`
## 7.10.2
### Patch Changes
- encodeBase64 and decodeBase64 should be able to be run in browser environments
## 7.10.1
### Patch Changes
- Get accessToken from getUserRequest on client side.
Merge basket and wishlist after login/register to logged in user.
## 7.10.0
### Minor Changes
- Add the possibility to use Token based authentication.
## 7.9.0
### Minor Changes
- Add unstorage cache provider
### Patch Changes
- Fix crypto-js imports needed for basked/wishlist key generation.
## 7.8.0
### Minor Changes
- provide exports of package as ESM and CJS format
- Migrate helpers to core package
### Patch Changes
- Add `initBapi` function to initialize a BapiClient
## 7.7.1
### Patch Changes
- orFiltersOperator should be optional in FetchProductsByCategoryParams and FetchProductsCountParams
## 7.7.0
### Minor Changes
- Update @aboutyou/backbone package and add support for `onFiltersOperator` BAPI parameter
## 7.6.1
### Patch Changes
- Move keys utils to core package
## 7.6.0
### Minor Changes
- Set the domain property in the rpc context
## 7.5.0
### Minor Changes
- `refresh()` of `useUser()` and `useUserFacet()` will now clear the session and user state if the checkout returns `HTTP 403 Forbidden`.
- **Breaking** `destroySession` is now async.
## 7.4.0
### Minor Changes
- Add option `includeSellableForFree` to `useFacet` and `useProducts` to include free products.
## 7.3.1
### Patch Changes
- Move RpcMethodsStorefront type to the nuxt2 package so it's accessible to shops
## 7.3.0
### Minor Changes
- Add rpcMethods `getBrand` and `getBrands` & corresponding composables, to make bapi-sdk brand endpoints available.
## 7.2.1
### Patch Changes
- Added ability to add basket groups by accepting `itemGroup` in the payload for the rpc method `addItemsToBasket`
## 7.2.0
### Minor Changes
- Replaced `enums` with the companion object pattern approach.
- Replaced `HttpStatusMessage` number values with the actual message
- Exposed `HashAlgorithm` constant with its type and move it to the core
- **Breaking:** If you are importing `HashAlgorithm` from `@scayle/storefront-nuxt2` change to importing it from `@scayle/storefront-core`
## 7.1.0
### Minor Changes
- Fix `fetchAllFiltersForCategory` caching issue by returning the cached value.
- Fix `fetchAllFiltersForCategory` caching issue by returning the cached value.
## 7.0.0
### Major Changes
- **Changes to basket and wishlist functions**
- Going forward, the only way to specify `with` and `pricePromotionKey` for the basket is by passing them to `useBasketWithParams()`.
They can no longer be overridden when calling `basket.addItem()`, `basket.removeItem()` or `basket.fetch()`.
- The only way to specify `pricePromotionKey` for the wishlist is by to passing them to `useWishlistWithParams()`.
They can no longer be overridden when calling `wishlist.addItem()`, `wishlist.removeItem()`, `wishlist.toggleItem()` or `wishlist.fetch()`.
- **Removed deprecated functions and values**
- **Removal**: `user.fetch()`
- user is fetched automatically. If you want to refresh the user, use `user.refresh()`
- **Removal**: `user.forceRefreshUser()`
- instead use `user.refresh()`
- **Removal**: `useUser()`
- instead use `useUserWithParams()`
- **Removal**: `useBasket()`
- instead use `useBasketWithParams()`
- **Removal**: `useWishlist()`
- instead use `useWishlistWithParams()`
- **Removal**: `ShopUser.emailHash`
- instead hash the email address on shop side
- **Removal**: `wishlist.contains()`
- instead use `wishlist.findItem()`
- **Removal**: `applyFilter()`
- instead use `applyFilters()`
- **Removal**: `Log.attachToNuxtContext()`
- instead use `inject('log', log)` in your plugin
- **Removal**: `Log.attachToWindow()`
- instead use `Log.default = log`
- **Removal**: `sortingValues`
- instead use `getSortingValues()`
- **Changed NPM package names**
- **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-nuxt` to `@scayle/storefront-nuxt2`
- **Breaking**: Change package scope and name of `@aboutyou/sfc-nuxt3` to `@scayle/storefront-nuxt`
- **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-lib` to `@scayle/storefront-core`
- **Breaking**: Change package scope and name of `@aboutyou/eslint-config-sfc` to `@scayle/eslint-config-storefront`
- **Breaking**: Change package scope and name of `@aboutyou/prettier-config-sfc` to `@scayle/prettier-config-storefront`
_NOTE: Due to the changes of the NPM package scope from `@aboutyou` to `@scayle`,
it is required to change the consuming projects local `.npmrc` file as follows:_
- Before:
```text
@aboutyou:registry=https://gitlab.com/api/v4/packages/npm/
```
- After:
```text
@aboutyou:registry=https://gitlab.com/api/v4/projects/29746107/packages/npm/
@scayle:registry=https://gitlab.com/api/v4/projects/29746107/packages/npm/
```
- **Removal**: `isEmpty`, `isEqual`, `pluck` and `copyTo` object helpers are removed.
_NOTE: We recommend to use native utilities or `radash` within your project!_
- **Removal**: Remove the deprecated pino-based logger.
_NOTE: For more information, please check out the "Logging"-section in `README.md`._
- Changes to hash utils:
- `hmac`, `verifyToken`, `buildSignature` functions are now async
- hash functions are no longer exported from `utils/index`. They must be imported from `utils/hash`
- `sha256` function added
- **Breaking**: Minimum `node` version raised to `18.15.0`
- `sha256` is used for default cache keys instead of `md5`
- **Breaking**: Remove the BasicAuth module
- Support sha256 for basket and wishlist keys
The `appKeys.isHashed` config option has been renamed to `appKeys.hashAlgorithm`. Instead of a boolean, there are now three options.
- `'sha256'` Use the `sha256` function for hashing basket and wishlist keys
- `'md5'` Use the `md5` function for hashing basket and wishlist keys (Equivalent to `isHashed: true` in v6)
- `null` Do not hash basket and wishlist keys (Equivalent to `isHashed: false` in v6)
- **Redis optimizations**
Reduce memory usage by replacing `with parameters` from fetching all attributes and fetching minimum attributes required to run the demo shop.
_NOTE: As this is a **breaking change**, in order to upgrade you will need to pass the `with parameters` required by the shop to function correctly!_
### Minor Changes
- Support optionally dropping MD5 and the crypto-js dependency
When `process.env.SFC_OMIT_MD5` is `true`, the md5 function will be replaced with an empty stub. If you do not use the MD5 hash at all this can be used to reduce bundle sizes.
In `nuxt.config.js` add
```js
env: {
SFC_OMIT_MD5: true
}
```
or if you want to control it from a `.env`
```js
env: {
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
}
```
- **Improvement**: Overall code enhancement within `storefront-core` package in favor of reducing the cognitive complexity and increasing maintainability
- Introduce `autobind` helper
- Refactor `cached` file
### Patch Changes
- **Bugfix**: Resolve incompatibility with Webpack 4-based build processes
## 7.0.0-alpha.3
### Major Changes
- Changes to hash utils:
- `hmac`, `verifyToken`, `buildSignature` functions are now async
- hash functions are no longer exported from `utils/index`. They must be imported from `utils/hash`
- `sha256` function added
- `sha256` is used for default cache keys instead of `md5`
- Support sha256 for basket and wishlist keys
The `appKeys.isHashed` config option has been renamed to `appKeys.hashAlgorithm`. Instead of a boolean, there are now three options.
- `'sha256'` Use the `sha256` function for hashing basket and wishlist keys
- `'md5'` Use the `md5` function for hashing basket and wishlist keys (Equivalent to `isHashed: true` in v6)
- `null` Do not hash basket and wishlist keys (Equivalent to `isHashed: false` in v6)
### Minor Changes
- Support optionally dropping MD5 and the crypto-js dependency
When `process.env.SFC_OMIT_MD5` is `true`, the md5 function will be replaced with an empty stub. If you do not use the MD5 hash at all this can be used to reduce bundle sizes.
In `nuxt.config.js` add
```js
env: {
SFC_OMIT_MD5: true
}
```
or if you want to control it from a `.env`
```js
env: {
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
}
```
## 7.0.0-alpha.2
### Patch Changes
- **Bugfix**: Resolve incompatibility with Webpack 4-based build processes
## 7.0.0-alpha.1
### Major Changes
- **Redis optimizations**
Reduce memory usage by replacing `with parameters` from fetching all attributes and fetching minimum attributes required to run the demo shop.
_NOTE: As this is a **breaking change**, in order to upgrade you will need to pass the `with parameters` required by the shop to function correctly!_
### Minor Changes
- **Improvement**: Overall code enhancement within `storefront-core` package in favor of reducing the cognitive complexity and increasing maintainability
- Introduce `autobind` helper
- Refactor `cached` file
## 7.0.0-alpha.0
### Major Changes
- **Changes to basket and wishlist functions**
Going forward, the only way to specify `with` and `pricePromotionKey` for the basket is pass them to `useBasketWithParams()`.
They can no longer be overridden when calling `basket.addItem()`, `basket.removeItem()` and `basket.fetch()`.
The only way to specify `pricePromotionKey` for the wishlist is to pass them to `useWishlistWithParams()`.
They can no longer be overridden when calling `wishlist.addItem()`, `wishlist.removeItem()`, `wishlist.toggleItem()` and `wishlist.fetch()`.
- **Removed deprecated functions and values**
- `user.fetch()` User is fetched automatically. If you want to refresh the user, use `user.refresh()`
- `user.forceRefreshUser()` Use `user.refresh()` instead.
- `useUser()` Use `useUserWithParams()` instead.
- `useBasket()` Use `useBasketWithParams()` instead.
- `useWishlist()` Use `useWishlistWithParams()` instead.
- `ShopUser.emailHash` Hash the email on shop side instead.
- `wishlist.contains()` Use `wishlist.findItem()` instead.
- `applyFilter()` Use `applyFilters()` instead.
- `Log.attachToNuxtContext()` Use `inject('log', log)` in your plugin instead.
- `Log.attachToWindow()` Use `Log.default = log` instead.
- `sortingValues` Use `getSortingValues()` instead.
- **Changed NPM package names**
- **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-nuxt` to `@scayle/storefront-nuxt2`
- **Breaking**: Change package scope and name of `@aboutyou/sfc-nuxt3` to `@scayle/storefront-nuxt`
- **Breaking**: Change package scope and name of `@aboutyou/scayle-sfc-lib` to `@scayle/storefront-core``
- **Breaking**: Change package scope and name of `@aboutyou/eslint-config-sfc` to `@scayle/eslint-config-storefront`
- **Breaking**: Change package scope and name of `@aboutyou/prettier-config-sfc` to `@scayle/prettier-config-storefront`
Due to the changes of the NPM package scope from `@aboutyou` to `@scayle`,
it is required to change the consuming projects local `.npmrc` file as follows:
- Before: `@aboutyou:registry=https://gitlab.com/api/v4/packages/npm/`
- After: `@scayle:registry=https://gitlab.com/api/v4/packages/npm/`
- `isEmpty`, `isEqual`, `pluck` and `copyTo` object helpers are removed. (Recommendation: It would be good to use native utils or `radash` within the project locally)
- Remove the deprecated pino-based logger. For more information, please check out the "Logging"-section in README.md.
- Minimum node version is 18.15.0
- Remove the basic auth module