### Initialize Lykdat Image Search UI Source: https://github.com/lykdatapps/js-sdk/blob/master/examples/imagesearch/vanilla-custom-button/index.html Import the Lykdat SDK and initialize the image search UI with your API key and catalog name, specifying a custom trigger element. ```html CLICK ME import * as lykdatSDK from '../../node_modules/lykdat/dist/module.js' window.lykdatSDK = lykdatSDK window.addEventListener('load', () => { lykdatSDK.initImageSearchUI({ publishableApiKey: 'API_KEY_HERE', catalogName: 'YOUR_CATALOG_NAME', triggerSelector: '#img-search-trigger' }) }) ``` -------------------------------- ### Initialize Lykdat Image Search UI Source: https://github.com/lykdatapps/js-sdk/blob/master/examples/imagesearch/vanilla/index.html Initializes the Image Search UI with provided API key and catalog name. This code should be run after the window has loaded. ```javascript import * as lykdatSDK from '../../node_modules/lykdat/dist/module.js' window.lykdatSDK = lykdatSDK window.addEventListener('load', () => { lykdatSDK.initImageSearchUI({ publishableApiKey: 'API_KEY_HERE', catalogName: 'YOUR_CATALOG_NAME', }) }) ``` -------------------------------- ### Initialize In-Stock Alert UI Source: https://github.com/lykdatapps/js-sdk/blob/master/examples/productalerts/vanilla/index.html Initializes the Lykdat in-stock alert UI. Ensure you replace 'API_KEY_HERE' and 'YOUR_WEBSITE_NAME' with your actual credentials. The UI will be rendered within the element specified by 'targetSelector'. ```javascript import * as lykdatSDK from '../../node_modules/lykdat/dist/module.js' window.lykdatSDK = lykdatSDK window.addEventListener('load', () => { lykdatSDK.initInStockAlertUI({ publishableApiKey: 'API_KEY_HERE', websiteName: 'YOUR_WEBSITE_NAME', targetSelector: '#back-in-stock-container' }) }) ``` -------------------------------- ### Perform Text Search with Lykdat SDK Source: https://github.com/lykdatapps/js-sdk/blob/master/examples/textsearch/vanilla/index.html This snippet shows how to import the Lykdat SDK, set up query options, and perform a text search. It's useful for integrating product search into your web application. ```javascript import * as lykdatSDK from '../../node_modules/lykdat/dist/module.js' window.lykdatSDK = lykdatSDK window.addEventListener('load', async () => { const queryOptions = { colors: ['navy'] } const result = await lykdatSDK.searchText('leather belt', { publishableApiKey: 'API_KEY_HERE', catalogName: 'YOUR_WEBSITE_NAME' }, queryOptions) console.log(result) }) ``` -------------------------------- ### Initialize Image Search UI Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Initializes the Image Search UI, rendering a search button and handling search results UI. It can optionally use a custom trigger button. ```APIDOC ## Initialize Image Search UI ### Description Initializes the Image Search UI, which includes a search button and displays search results. You can provide a CSS selector for a custom trigger button. ### Method `lykdat.initImageSearchUI(config)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (object) - Required - Configuration object for the Image Search UI. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **catalogName** (string) - Required - The name of your Lykdat catalog. * **triggerSelector** (string) - Optional - The CSS selector for a custom trigger button. ``` -------------------------------- ### Initialize Image Search UI Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Initializes the Image Search UI with default settings. This function renders a search button and handles search result display. ```javascript import * as lykdat from 'lykdat' window.addEventListener('load', () => { lykdat.initImageSearchUI({ publishableApiKey: 'YOUR_API_KEY_HERE', catalogName: 'YOUR_CATALOG_NAME', }) }) ``` -------------------------------- ### Initialize In-stock Alert UI Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Initializes a UI form for users to subscribe to in-stock notifications for a product. This function handles all UI-related code. ```APIDOC ## Initialize In-stock Alert UI ### Description Attaches a form UI to the DOM, allowing users to subscribe to notifications when a product is back in stock. This function handles all UI implementation. ### Method `lykdat.initInStockAlertUI(config)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (object) - Required - Configuration object for the In-stock Alert UI. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **websiteName** (string) - Required - The name of your website. * **targetSelector** (string) - Required - The CSS selector where the form UI should be attached. ``` -------------------------------- ### Initialize In-stock Alerts UI Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Initializes and renders a UI form for users to subscribe to in-stock alerts. This function handles all UI-related code. ```javascript import * as lykdat from 'lykdat' window.addEventListener('load', () => { lykdat.initInStockAlertUI({ publishableApiKey: 'YOUR_API_KEY_HERE', websiteName: 'YOUR_WEBSITE_NAME', targetSelector: '#back-in-stock-container' }) }) ``` -------------------------------- ### Initialize Image Search UI with Custom Trigger Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Initializes the Image Search UI and attaches it to a custom search button specified by a CSS selector. This allows for custom trigger elements. ```javascript import * as lykdat from 'lykdat' window.addEventListener('load', () => { lykdat.initImageSearchUI({ publishableApiKey: 'YOUR_API_KEY_HERE', catalogName: 'YOUR_CATALOG_NAME', triggerSelector: '#my-button-id' }) }) ``` -------------------------------- ### Extract Product Details from URL Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Extracts product details such as name, price, currency, images, and availability from a given product URL. Handles potential extraction failures. ```javascript import * as lykdat from 'lykdat' const config = { publishableApiKey: 'YOUR_API_KEY_HERE', } const productUrl = 'https://mywebsite.url/product/url' lykdat.extractProduct(config, productUrl).then((extraction) => { if (extraction.product) { console.log('success', extraction.product) } else { console.log('product could not be extracted :/') } }).catch((err) => { // handle error }) ``` -------------------------------- ### Extract Product Details Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Extracts product details such as name, price, currency, images, and availability from a given product URL. ```APIDOC ## Extract Product Details ### Description Extracts detailed information about a product, including its name, price, currency, images, and availability, directly from its product URL. ### Method `lykdat.extractProduct(config, productUrl)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (object) - Required - Configuration object. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **productUrl** (string) - Required - The URL of the product page from which to extract details. ``` -------------------------------- ### Subscribe to In-stock Alerts Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Subscribes a user to receive notifications when a product that is currently out of stock becomes available. Requires API key and website name. ```javascript import * as lykdat from 'lykdat' const config = { publishableApiKey: 'YOUR_API_KEY_HERE', websiteName: 'mywebsite' } const email = 'useremail@example.com' const productUrl = 'https://mywebsite.url/product/url' lykdat.subscribeToInStockAlert(config, email, productUrl).then(() => { console.log('success') }).catch((err) => { // handle error }) ``` -------------------------------- ### Subscribe to Price Alerts Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Subscribes a user to receive notifications when the price of a specific product drops. Requires API key and website name. ```javascript import * as lykdat from 'lykdat' const config = { publishableApiKey: 'YOUR_API_KEY_HERE', websiteName: 'mywebsite' } const email = 'useremail@example.com' const productUrl = 'https://mywebsite.url/product/url' lykdat.subscribeToPriceAlert(config, email, productUrl).then(() => { console.log('success') }).catch((err) => { // handle error }) ``` -------------------------------- ### Subscribe to In-stock Alert Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Allows users to subscribe to notifications when a currently unavailable product becomes available. ```APIDOC ## Subscribe to In-stock Alert ### Description Enables users to subscribe to receive notifications when a product that is currently out of stock becomes available. ### Method `lykdat.subscribeToInStockAlert(config, email, productUrl)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (object) - Required - Configuration object. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **websiteName** (string) - Required - The name of your website. * **email** (string) - Required - The email address of the user to subscribe. * **productUrl** (string) - Required - The URL of the product to monitor. ``` -------------------------------- ### Perform Text Search with Options Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Performs a full text search on a catalog with optional filters for genders and colors. Results include products, pagination info, and facets. ```javascript import * as lykdat from 'lykdat' const config = { publishableApiKey: 'YOUR_API_KEY_HERE', catalogName: 'YOUR_CATALOG_NAME', } const options = { genders: ['male', 'unisex'], colors: ['red', 'blue', 'navy'] } lykdat.searchText('furry shorts', config, options).then((result) => { console.log(result.products) console.log(result.pagination) console.log(result.facets) }).catch((err) => { // handle error }) ``` -------------------------------- ### Subscribe to Price Alert Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Allows users to subscribe to notifications when the price of a specific product drops. ```APIDOC ## Subscribe to Price Alert ### Description Enables users to subscribe to receive notifications when the price of a product decreases. ### Method `lykdat.subscribeToPriceAlert(config, email, productUrl)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **config** (object) - Required - Configuration object. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **websiteName** (string) - Required - The name of your website. * **email** (string) - Required - The email address of the user to subscribe. * **productUrl** (string) - Required - The URL of the product to monitor. ``` -------------------------------- ### Text Search Source: https://github.com/lykdatapps/js-sdk/blob/master/README.md Performs a full text search for products in your catalog, with options for filtering and sorting. Returns products, pagination info, and facets. ```APIDOC ## Text Search ### Description Performs a full text search for products within your catalog. Allows filtering and sorting by fields, and returns facets useful for e-commerce search result pages. ### Method `lykdat.searchText(query, config, options)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **query** (string) - Required - The text query to search for. * **config** (object) - Required - Configuration object. * **publishableApiKey** (string) - Required - Your Lykdat publishable API key. * **catalogName** (string) - Required - The name of your Lykdat catalog. * **options** (object) - Optional - Search options for filtering and sorting. * **genders** (array of strings) - Optional - Filter by gender. * **colors** (array of strings) - Optional - Filter by color. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.