1.0.4 • Published 2 years ago

clerkio v1.0.4

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

CLERKIO RENDERING

This package helps us to quickly render a product shelf using the data received from the ClerkIO API.

Installation

To install this project run

  npm install clerkio
  yarn add clerkio

Environment Variables

To run this package, you will need to add the following environment variables

API_KEY

Customer email

Configuration

The component is quite custom, here are all the existing references for its modification

These would be all the props we can pass to the component

Props

NameTypeDefaultDescriptionRequiredExample
attributesarray✖️We can enter the product attributes referred here atributes✔️attributes={ "image", "name", "price"}
emailstring✖️Email from the client to make recommendations✔️email="test@email.com"
limitnumber✖️Number of results to be returned✔️limit={5}
productsTypestring✖️Type of product recommendation that can only be these values:popular, trending, new, recently_bought, currently_watched, complementary and substituting✔️productsType="popular"
currencystringUSDWe can pass the official acronyms of the coins to get their symbols✖️currency="EUR"
defaultStylesboolean✖️If this prop is passed as true, the default classes are activated and will paint a default productShelf✖️defaultStyles
formatPriceboolean,If we pass this prop as true, the comma is changed to a dot✖️formatPrice
imageHeightnumber192pxHeight of the image✖️imageHeight={200}
imageWidthnumber220pxWidth of the image✖️imageWidth={200}
titlestring✖️Title of the block✖️title="Trending products"
productSubtextstring✖️Card subtext✖️productSubtext="from"

In the attributes, the only one required is the ID, so that it is used as a key for the rendering of the ProductShelf.

These are the attributes that we can send in the array:

Those listed as required, are the ones necessary for the correct rendering of the default style of the ProductShelf which are the minimum values and information of the product.

AttributeImportanceContent
idRequiredThe product ID
nameRequiredThe product name
descriptionOptionalThe product description
priceRequiredThe product current selling price
list_priceOptionalThe product original list price
imageRequiredThe full URL for the product image. This will be used for thumbnails when displaying products.We recommend a maximum image size of 200x200px
urlRequiredThe full URL for the product page
categoriesOptionalA list of the category IDs for the product categories
brandOptionalThe product brand as a string
skuOptionalThe product SKU (Stock Keeping Unit)
stockOptionalStock count of this product
ageOptionalThe number of days since the product was created
on_saleOptionaltrue if this product is on sale, else false
genderOptionalIs the product for a specific gender? Add that information
color/colorsOptionalColor information about the product
keywordsOptionalKeywords or synonyms that should be searchable for the product
created_atOptionalUnix timestamp for when the product was created
indexOptionalIf false, the product will not be indexed and thus not shown in any results.It will still be kept in the database as historic data so results like alternatives and personal recommendations can be based on it.If true, the product will be indexed as normal.Defaults to true if not sent.

How to use?

Example of use with the default styles

You will need to import the component from the node modules

import Clerkio from "clerkio/dist/Clerkio";

Once imported, you will be able to use the component like the example

<Clerkio
  productsType="popular"
  email="test@email.com"
  limit={5}
  attributes={["id", "image", "list_price", "name", "on_sale", "price", "url"]}
  title="Complementary Products"
  productSubtext="A partire da"
  defaultStyles
/>

Example

Dependencies

This package depends on the ClerkIO API service.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago