smartshopping-simple-integration
v0.2.3
Published
Package include base UI and logic for simple integration smartshopping-sdk
Downloads
47
Maintainers
Readme
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 sliderprimaryColor
- color to be used in buttons, progress bar and titlessecondaryColor
- the color that will be used in the buttons on hoverlogoUrl
- link on main logo imagenoDealsImgUrl
- link to the image that will be displayed if all coupons do not matchsuccesImgUrl
- link to the image that will be displayed if you can find a coupon that gives a benefitnoSkipStartSlider
- if you want the starting slider to be impossible to closemarginTopStartSlider
- 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