Guide to migrate from the legacy Web Extension Coupon SDK @sleek/web-ext-coupon-sdk
to the modern, more powerful Web Extension SDK @sleek/web-ext-sdk
.
@sleek/web-ext-sdk
, replacing the legacy @sleek/web-ext-coupon-sdk
. This new SDK brings enhanced performance, additional capabilities, and a more extensible foundation for future features.
If you’re currently using @sleek/web-ext-coupon-sdk
, follow the guide below to migrate to @sleek/web-ext-sdk
.
Feature | @sleek/web-ext-coupon-sdk | @sleek/web-ext-sdk |
---|---|---|
Core methods | initializeSleekSdk , getSdkInstance | initializeWebExtSdk , getWebExtSdk |
Script files | fc.js , f.js , t.js | mf.js , f.js |
Events | Mainly coupon-focused | Coupon, classification, product, order, affiliate activation detection |
Performance | Legacy | More performant and modular |
Type Safety | Typed | Stronger types, extensible event system |
.npmrc
if not already configured:
manifest.json
.
@sleek/web-ext-sdk
introduces a more modular and intuitive API design. Instead of global functions, you now operate on a specific tab context using .onTab(tabId)
for all tab-related actions.
Here’s a mapping of commonly used methods to help you migrate:
Legacy @sleek/web-ext-coupon-sdk | New @sleek/web-ext-sdk |
---|---|
getSdkInstance().fillCouponsOnTab(tabId, options?: FillCouponsOnTabOptions) | getWebExtSdk().onTab(tabId).startCouponAutoApply(codes) |
getSdkInstance().cancelCouponsOnTab(tabId) | getWebExtSdk().onTab(tabId).stopCouponAutoApply() |
getSdkInstance().classifyPageOnTab(tabId) | getWebExtSdk().onTab(tabId).classifyPage() |
getSdkInstance().extractProductsOnTab(tabId, options?: ExtractProductsOnTabOptions) | getWebExtSdk().onTab(tabId).extractProducts(options?: ExtractProductsOptions) |
getSdkInstance().extractOrderOnTab(tabId) | getWebExtSdk().onTab(tabId).extractOrder() |