Install Coveo for Sitecore JSS

This article presents the contents of Coveo for Sitecore JSS and its installation instructions.

Coveo for Sitecore JSS consists of two parts, an NPM module and a Sitecore package (i.e., the Coveo for Sitecore JSS Integration Package). The recommended version of Coveo for Sitecore to use alongside the JSS package is the March 26, 2021 release (5.0.943.3). You can find the link to download the Coveo for Sitecore JSS Integration Package in the installation instructions.

Integration Package Contents

The Coveo for Sitecore JSS Integration Package contains the following:

  • the Coveo.JavascriptServices.dll file

  • the Coveo.JavascriptServices.ImportProcessors.config file

  • the Coveo JSS Contents Resolver item

  • Coveo Hive JSS layout and template items

This package links imported Coveo components to a custom Coveo Rendering Contents Resolver, which uses the imported hiveDataSource attribute to provide data to the JSS component.

Installation Instructions

  1. Ensure you have already created a Sitecore JSS app. You will integrate Coveo for Sitecore JSS in your JSS app.

  2. In Sitecore, open the Installation Wizard and install the Coveo for Sitecore December 2020 (or newer) release for a Sitecore 9.2 or 9.3 environment (see Install Coveo for Sitecore).

  3. Configure and activate Coveo for Sitecore.

  4. Download the Coveo for Sitecore JSS Integration Package.

  5. Using the Sitecore Installation Wizard, install the Coveo.Jss.IntegrationPackage+1.X.X.XX.zip file.

  6. In the Sitecore content tree, ensure that you have created an API key in the /sitecore/system/Settings/Services/API Keys folder.

    • The /sitecore/system/Settings/Services/API Keys folder is accessible in the master database.

    • The key name can be whatever you want.

    • For testing purposes only, you can set CORS Origin and AllowedControllers to *. Keep in mind that you should never do this in a serious environment.

  7. Ensure that you have configured your JSS app to link with your Sitecore instance.

Importing Coveo for Sitecore Jss Into Your Jss App

  1. Ensure that you’re running at least version 12 of Node.js.

  2. Run: npm install coveoforsitecore-jss

  3. Run: npm install globalize@0.1.1

  4. In your file system, in your JSS app folder, navigate to the /sitecore/definitions/components/ folder.

  5. In this /sitecore/definitions/components/ folder, create the CoveoForSitecore.sitecore.js file.

  6. Using a text editor, add the following lines to the newly created /sitecore/definitions/components/CoveoForSitecore.sitecore.js file:

    import coveoforsitecore from "coveoforsitecore-jss/dist/manifest";
    export default coveoforsitecore;
  7. In the scripts/generate-component-factory.js file, after the first three require statements, add the following statement:

    const { coveoForSitecoreComponentFactory } = require("coveoforsitecore-jss/dist/componentFactory");
  8. In the scripts/generate-component-factory.js file, immediately before the return /* eslint-disable */ line, add the following statement:

    coveoForSitecoreComponentFactory(imports, registrations);
  9. In the sitecore/definitions/config.js file, after the babelrc: false, statement, add the following statement:

    ignore: [/node_modules\/(?!coveoforsitecore-jss)/]
What's Next for Me?