@moustacherepublic/mr-nosto-package
v0.2.3
Published
Contains Nosto customisations designed to be reusable via an NPM package.
Downloads
6
Maintainers
Readme
MR Nosto Package
Usage Guide
Install via
npm i @moustacherepublic/mr-nosto-package
Import and use Nosto Category Merchandising ``` import { NostoCategoryMerchandisingController } from '@moustacherepublic/mr-nosto-package';
// Init Category Merchandising Controller
// Compulsory arguments
// context - Store Context
// productGridSelector - CSS selector for HTML element that contains the list of product HTML elements | eg. ".productGrid" "#productGrid" "[productGrid]"
// productSelector - CSS selector for HTML element for product cards | eg. ".product" "[data-product]"
// productIdDataAttribute - Attribute selector of the productSelector declared above that contains the product ID (without []) | eg. "data-product-id" "product-id"
// productNostoRankDataAttribute - Attribute name that you want to give to your productSelector in order to rank the products | eg. "data-nosto-rank" "data-nosto-cm-rank"
// sortOrder - Sort in ascending or descending rank based on productNostoRankDataAttribute | only accepts "asc" "desc"
const nostoCMController = new NostoCategoryMerchandisingController(
context, productGridSelector, productSelector, productIdDataAttribute, productNostoRankDataAttribute, sortOrder
);
// Call this method to fetch Nosto Category Merchandising data and sort the product elements in the DOM.
nostoCMController.updateProducts();
```
What is this repository for?
Contains Nosto customisations designed to be reusable via an NPM package.
Current Features
Category Merchandising
Changelog
v0.2.0 - 12 May 2021
Updated README.
Setup CircleCI.
v0.1.0 - 12 May 2021
Init.
Published NPM package.
Added husky, eslint and prettier.
Added cypress and test files.