2.0.1 • Published 5 years ago

@nuskin/product-recommendation v2.0.1

Weekly downloads
443
License
ISC
Repository
-
Last release
5 years ago

ns-product-recommendation

Client SDK for retrieving Nu Skin product recommendations.

Installing

To install with npm:

npm install @nuskin/ns-product-recommendation

To install with Yarn:

yarn add @nuskin/ns-product-recommendation

Dependencies

@nuskin/ns-util^3.0.0 is a peer dependency of this package.

Using the SDK

Use the SDK to get product recommendations as follows:

import { getRecommendations } from "@nuskin/ns-product-recommendation";

const options = {
  country: "MX",
  productSkus: ["01234567", "89012345"]
};

getRecommendations(options).then(recommendations => {
  /* ... */
});

The function resolves to a list of ProductRecommendation objects.

These are the available request options:

{
  // (OPTIONAL) `country` is the market country to get recommendations for.
  // If not provided, defaults to the current market country provided by ns-util.
  country: string;

  // (OPTIONAL) `productSkus` is a list of product SKUs to get recommendations for.
  // Recommendations are for products commonly purchased together with the given 
  // SKUs.
  productSkus: string[];

  // (OPTIONAL) `locale` determines the language of any error messages returned by 
  // the product recommendation service. Must be of the form "en_US" or "es_MX".
  // If not provided, defaults to the current market locale provided by ns-util.
  locale: string;
}

Data Types

The Product Recommendation SDK returns the following data type.

ProductRecommendation

{
  // Product SKU ID
  sku: string;

  // Type of recommendation:
  // "popular_product" - the product is popular in the given market
  // "common_together" - the product is commonly purchased together with one or more 
  //                     of the given product SKUs
  type: "popular_product" | "common_together";
}
2.0.1

5 years ago

2.0.0

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago