0.2.3 • Published 10 months ago

smartshopping-simple-integration v0.2.3

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Smartshopping Simple Integration

This package contains the basic UI with the ability to customize and coupon auto apply logic.

To work, you just need to provide an array of coupons for a specific store.

Install

npm install smartshopping-simple-integration
yarn add smartshopping-simple-integration

Integration

Content script

In content part you need import initSmartshoppingContent function and call like this:

import { initSmartshoppingContent } from 'smartshopping-simple-integration';

initSmartshoppingContent({
  id: 'demo-ext',
  primaryColor: '#50C878',
  secondaryColor: '#AFE1AF',
  noSkipStartSlider: true,
});

initSmartshoppingContent can take the following arguments:

interface ICustomizeProps {
primaryColor?: string;
secondaryColor?: string;
logoUrl?: string;
noDealsImgUrl?: string;
succesImgUrl?: string;
noSkipStartSlider?: boolean;
marginTopStartSlider?: number;
}

export interface ISmartshoppingContentProps extends ICustomizeProps {
id?: string;
}
  • id - unique id for injection slider

  • primaryColor - color to be used in buttons, progress bar and titles

  • secondaryColor - the color that will be used in the buttons on hover

  • logoUrl - link on main logo image

  • noDealsImgUrl - link to the image that will be displayed if all coupons do not match

  • succesImgUrl - link to the image that will be displayed if you can find a coupon that gives a benefit

  • noSkipStartSlider - if you want the starting slider to be impossible to close

  • marginTopStartSlider - indent of the start slider from the top of the page

Background script

In background part you need import initSmartshoppingBackground function and call like this:

import { initSmartshoppingBackground } from 'smartshopping-simple-integration';
import { requireShops, requirePromocodes } from 'src/utils';

const getCodes = async (tabId: number) => {
  const codes = await requirePromocodes(tabId);
  return codes;
}

initSmartshoppingBackground({ clientID: 'admin', key: 'randomstring', getCodes });

initSmartshoppingBackground can take the following arguments:

export interface ISmartshoppingBackgroundProps {
  clientID?: string;
  key?: string;
  getCodes: (tabId: number) => Promise<Array<string>>;
}

getCodes your function that should return a list of promo codes

clientID and key two values you can get on SmartShopping web site. Default value give access to a limited list of stores:

  • Adidas
  • ASOS
  • Dell
  • Macys
  • MyProtein
  • Timberland
0.2.3

10 months ago

0.2.2

12 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago