docs
  1. SCAYLE Resource Center
  2. Support and Resources
  3. Changelogs
  4. Storefront Core
  5. @scayle/storefront-core

@scayle/storefront-core

7.64.0

Minor Changes

  • Resolve a issue that prevents filters from working as expected on the search page

Patch Changes

7.63.1

Patch Changes

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

7.60.0

Minor Changes

  • Instead of throwing errors, RPCs will now return an ErrorResponse object conforming to 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

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

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

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

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

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

7.50.0

Minor Changes

  • Upgraded to @scayle/[email protected] 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

7.49.2

Patch Changes

  • Fixed a bug where the addItemToWishlist RPC method returned an empty response upon failure.
  • Updated dependencies

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.
    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

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 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:
    export const custom: RpcHandler<{ shop: number }> = (
      context: RpcContext,
    ) => {
      return {
        shop: context.shopId,
      }
    }
    
    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

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

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 in the context. If the session is not present, an error will be thrown. For any usage 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/backboneto 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/backboneto 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 the client side. Merge basket and wishlist after login/register to logged-in user.

7.10.0

Minor Changes

  • Add the possibility of using 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 the 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

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:

    Copy
    @aboutyou:registry=https://gitlab.com/api/v4/packages/npm/
    
    • After:

    Copy
    @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, 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
    env: {
      SFC_OMIT_MD5: true
    }
    

    or if you want to control it from a .env
    env: {
      SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
    }
    
  • Improvement: Overall code enhancement within storefront-core package in favor of reducing 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
    Copy
    env: {
      SFC_OMIT_MD5: true
    }
    

    or if you want to control it from a .env
    Copy
    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 fetching all attributes and fetching minimum attributes required to run the demo shop. NOTE: As this is a breaking change, 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 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

6.8.0

Minor Changes

  • Adds the ability to ignore shop locale if passed to the breadcrumb helper. The shop needs to provide its locale using $currentShop.locale

6.7.1

Patch Changes

  • Bugfix: move CACHE_TIMEOUT to a dedicated file for reexport, instead of cache/providers/redis.ts, to avoid buildtime errors in the nuxt2 package.

6.7.0

Minor Changes

  • Deps: updated @aboutyou/backbone to v15.3.0

6.6.16

Patch Changes

  • Cache: reduce redis cache timeout from 5000ms to 500ms

6.6.15

Patch Changes

  • Cache: introduce shared Redis CACHE_TIMEOUT constant across shared packages
  • Cache: Increase Redis get timeout from 300ms to 5000ms to account for longer Redis responses