Vue Storefront is now Alokai! Learn More
@vsf-enterprise/contentstack-api

@vsf-enterprise/contentstack-api

4.3.1ri:link

Patch Changesri:link

  • FIXED Fetch first by the exact page url in getPage, only then use the resolved url.

4.3.0ri:link

Minor Changesri:link

  • CHANGED Upgraded the path-to-regexp package to version 8.0.0. Note that page path patterns must now follow a different convention. For more details, please refer to the Release Notes for path-to-regexp@8.0.0.

4.2.3ri:link

Patch Changesri:link

  • Updated dependencies:
    • @vsf-enterprise/cms-components-utils@2.0.0

4.2.2ri:link

Patch Changesri:link

  • CHANGED Removed _metadata from the response

4.2.1ri:link

Patch Changesri:link

  • FIXED Rich text and image normalization

4.2.0ri:link

Minor Changesri:link

  • ADDED Unified extension which allows fetching data from Contentstack and extracting components. The extension is available at the /unified namespace and adds two methods:
  • getPage - Fetches the page data from Contentstack.

To use the extension on the Storefront side:

  1. Add unified property in the API Client configuration:
export const config = {
  location: "@vsf-enterprise/contentstack-api/server",
  extensions: (existing: any[]) => existing.concat(resolverExtension, unifiedApiExtension),
  configuration: {
    key: CNTS_DELIVERY_KEY,
    token: CNTS_DELIVERY_TOKEN,
    env: CNTS_CONTENT_ENV,
    branch: CNTS_CONTENT_BRANCH,
    region: CNTS_REGION_KEY ?? 'US',
    livePreview: {
      enable: true,
      previewToken: CNTS_PREVIEW_TOKEN,
      host: CNTS_PREVIEW_HOST as string,
    },
  },
+ unified: {
+   resolvePages: () => ({
+     "/*": {
+       type: "page",
+       includeReference: [
+         "components_above_fold.items",
+         "components_below_fold.items",
+       ],
+     },
+   }),
+   resolveFallbackPage: () =>
+     Promise.resolve({
+       path: "/vsf-fallback-page",
+       type: "fallback-page",
+     }),
+ },
} satisfies Integration<MiddlewareConfig>;
  1. Export extension types in the storefront-middleware/types.ts file:
+ export type { UnifiedEndpoints as UnifiedCmsEndpoints } from '@vsf-enterprise/contentstack-api';
  1. In the SDK config, add a new middlewareModule:
+ import type { UnifiedCmsEndpoints } from 'storefront-middleware/types';

+ unifiedCms: buildModule(middlewareModule<UnifiedCmsEndpoints>, {
+   apiUrl: `${config.middlewareUrl}/contentstack/unified`,
+   defaultRequestConfig: {
+     headers: getRequestHeaders(),
+   },
+ }),
  // ...
  1. In your page component, use the getPage method to fetch the page data:
const page = await sdk.unifiedCms.getPage({
  path: "/",
  locale: "en-us",
});

All components are extracted, so you don't need to use the extractComponent utility from contentstackModule anymore.

4.1.0ri:link

Minor Changesri:link

  • ADDED: Add exclude option to the params of getContent method.

4.0.0ri:link

Major Changesri:link

  • REMOVED The package no longer exports the ContextualizedEndpoints interface. Use the ApiMethods interface instead.

3.0.0ri:link

Major Changesri:link

  • BREAKING Updated @vue-storefront/middleware version to 4.1.0. Make sure this version is used in your project.
{
  ...
  "dependencies": {
-   "@vue-storefront/middleware": "3.x.x",
+   "@vue-storefront/middleware": "4.1.0"
  }
}

2.0.1ri:link

Patch Changesri:link

Update axios to ^0.28.0 to mitigate security vulnerability CVE-2023-45857

2.0.0ri:link

Major Changesri:link

  • CHANGED Changed minimum Node version from 16 to 18. The condition that was forcing the Node version to be lower than 19 is also removed.

1.5.0ri:link

Minor Changesri:link

  • CHANGED Update axios library from ^0.27.2 to 1.6.8. This change is non-breaking and should not require any changes to your codebase. To read more about latest changes in axios library, please visit axios release notes.
  • CHANGED Starting from contentstack js sdk version 3.19, the LivePreview 2.0 has been released. To enable this feature, a new token previewToken has been added to the middleware.config object. The old 'management_token' is now deprecated and will be removed in future versions. The preview_token is currently optional but will be required in future versions. For more information about live preview, please refer to the official documentation.

Change is backward compatible, you do not need to update the middleware.config however we recommend updating configuration to the new format.

To migrate to the new version, please update the middleware.config file in your project as follows:

  integrations: {
    cntf: {
      location: "@vsf-enterprise/contentstack-api/server",
      configuration: {
        // ...
        livePreview: {
           /** managementToken: "some-token", **/ // remove this line
           previewToken: "some-preview-token", // add this line
          enable: true,
          host: "some-preview-host.contentstack.io", // Update the host to the preview host
        },
        //...
      },
    },
  },

1.4.0ri:link

Minor Changesri:link

  • 4af65fe: ADDED Added new addQuery param for the getContent method. The values passed to it will be used to call query.addQuery() internally.
    See the Contentstack documentation for addQuery for more information.
    Example:
    const content = await sdk.cms.getContent({
      id: "blt9fb6f1c06ef8549e",
      addQuery: { include_dimension: true },
    });
    

1.3.0ri:link

Minor Changesri:link

  • 80eeb99: Support for only feature.

1.2.0ri:link

Minor Changesri:link

  • 2f9d766: Add includeFallback property to automatically include the published fallback language content in your API response (more info here).

1.2.0-rc.0ri:link

Minor Changesri:link

  • Add includeFallback property to automatically include the published fallback language content in your API response.

1.1.0ri:link

Minor Changesri:link

  • bumped axios version to ^0.27.2 and @vue-storefront/middleware version to ^3.5.0 which introduces support for HTTP GET requests

1.0.0ri:link

Major Changesri:link

  • initial release