@spurtcommerce/faq) adds FAQ management functionality to a SpurtCommerce application. It provides APIs for vendors to manage FAQ categories and their questions, and APIs for the storefront to retrieve active FAQs.
The package is designed as a plug-and-play add-on for SpurtCommerce Community and Enterprise editions. Once installed, the host application’s add-on loader discovers and registers its components.
Key Features
- Vendor FAQ management: Create, list, view, update, and delete FAQ categories and their associated questions.
- Storefront FAQ access: Retrieve active FAQs based on the customer user type.
- Structured FAQ data: Store the main FAQ record separately from its child questions and answers.
- Automatic registration: The host application’s
addonPackageLoaderregisters the package’s entities, controllers, and migrations. - Safe package removal: The host application is designed to continue running when the FAQ package is uninstalled.
Requirements
- A compatible SpurtCommerce Community or Enterprise project.
- The project must include the add-on loading mechanism (
addonPackageLoader) expected by the package.
Installation
Run the following command from the root directory of your SpurtCommerce project:How the Add-on Works
The FAQ add-on is composed of API controllers and TypeORM data models. When the host application loads the installed package,addonPackageLoader handles the registration of:
This allows the FAQ functionality to be integrated through package installation rather than requiring developers to manually wire each component into the host application.
API Overview
The add-on exposes two API groups.Vendor FAQ API
Base route:/api/faq/*
The vendor API is used to manage FAQ categories and their child questions. The supported operations include:
- Creating FAQ records
- Listing FAQ records
- Retrieving FAQ details
- Updating FAQ records
- Deleting FAQ records
Store FAQ API
Base route:/api/store-faq/*
The storefront API provides access to active FAQs. FAQ results are filtered according to the customer user type.
This API is intended for storefront experiences that need to display relevant FAQ content to customers.
Data Models
The add-on uses two TypeORM entities:FaqDescription is linked to the main Faq record. Together, these entities represent the FAQ content managed through the vendor API and retrieved through the storefront API.
Application Integration
After installing the package:- Keep the package installed in the SpurtCommerce project.
- Start the application using the project’s normal development or production procedure.
- Allow the host application’s
addonPackageLoaderto discover and register the add-on components. - Use the vendor FAQ API to manage FAQ content.
- Use the storefront FAQ API to retrieve active FAQs for customers.
Uninstallation
To remove the FAQ add-on, run the following command from the SpurtCommerce project root:Note: Uninstalling the package removes the add-on from the application. This documentation does not imply that its database tables or existing records are automatically deleted.
Summary
@spurtcommerce/faq provides vendor-managed FAQ content and storefront FAQ retrieval as an installable SpurtCommerce add-on. Its integration with addonPackageLoader is intended to handle the registration of its controllers, entities, and migrations, reducing the manual integration work required from developers.