smartshopping-sdk
Version:
Coupon autoapply SDK
41 lines (40 loc) • 2.98 kB
TypeScript
/// <reference types="chrome" />
import { EngineConfig, EnginePersistedState, Message, ShopUrls, Selector, UserConfig } from '../interfaces';
interface IDBVersion {
urlsVersion: number;
defaultConfigsVersion: number;
userConfigsVersion: number;
}
interface IFetchRetryOptions {
baseUrls: string[];
endpoint: string;
getParams?: Record<string, string>;
options?: RequestInit;
}
declare function getLocalDBVersion(): Promise<IDBVersion | null>;
declare function getLocalUserConfig(): Promise<UserConfig | undefined>;
declare function requireUserConfig(clientID: string, config?: UserConfig, serverUrl?: string): Promise<UserConfig | undefined>;
declare function requireDBVersions(clientID: string, userConfig?: UserConfig, serverUrl?: string): Promise<IDBVersion | null>;
declare function requireShops(clientID: string, config?: UserConfig, serverUrl?: string): Promise<void>;
declare function requireDefaultConfigs(clientID: string, config?: UserConfig, serverUrl?: string): Promise<void>;
declare function prepareDefaultSelectors(key: string): Promise<void>;
declare function locateConfig(url: string, clientID: string, key: string, serverUrl?: string, noUseCache?: boolean, userConfig?: UserConfig): Promise<EngineConfig | null>;
declare function isCheckoutPage(url: string, shop: ShopUrls): boolean;
declare function isProductPage(url: string, shop: ShopUrls): boolean;
declare function checkAdblockDisabled(): Promise<boolean>;
declare function checkCookieEnabled(): Promise<boolean>;
declare function handleMessage(message: Message, sender: chrome.runtime.MessageSender, sendResponse: () => void, clientID: string): Promise<void>;
declare function handleRemoval(tabId: number): Promise<void>;
declare function getPersistedState(id: number): Promise<EnginePersistedState | null>;
declare function getDefaultSelectors(): Promise<{
[key: string]: Array<Selector>;
} | null>;
declare function emptyErrorHandler(): void;
declare function checkOnExistObject(obj: Object): boolean;
declare function overrideUpdateAlarm(periodInMinutes: number): void;
declare function getAlarm(name: string): Promise<unknown>;
declare function initializeUpdateAlarmIfNeeded(): Promise<void>;
declare function initializeData(clientID: string, key: string): Promise<void>;
declare function updateData(clientID: string, key: string, currentVersions: IDBVersion, localVersions: IDBVersion): Promise<void>;
declare function fetchRetry({ endpoint, getParams, baseUrls, options, }: IFetchRetryOptions): Promise<Response>;
export { updateData, initializeData, overrideUpdateAlarm, fetchRetry, getAlarm, initializeUpdateAlarmIfNeeded, getLocalUserConfig, requireUserConfig, getLocalDBVersion, requireDBVersions, requireShops, requireDefaultConfigs, locateConfig, isCheckoutPage, isProductPage, checkAdblockDisabled, checkCookieEnabled, prepareDefaultSelectors, handleMessage, handleRemoval, getPersistedState, getDefaultSelectors, checkOnExistObject, emptyErrorHandler, };