{"version":3,"file":"index.development.js","sources":["../../../autocomplete-shared/dist/esm/createRef.js","../../../autocomplete-shared/dist/esm/debounce.js","../../../autocomplete-shared/dist/esm/isEqual.js","../../../autocomplete-shared/dist/esm/noop.js","../../../autocomplete-shared/dist/esm/safelyRunOnBrowser.js","../../src/createClickedEvent.ts","../../src/isModernInsightsClient.ts","../../src/createSearchInsightsApi.ts","../../src/createViewedEvents.ts","../../src/isAlgoliaInsightsHit.ts","../../src/createAlgoliaInsightsPlugin.ts"],"sourcesContent":["export function createRef(initialValue) {\n return {\n current: initialValue\n };\n}","export function debounce(fn, time) {\n var timerId = undefined;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n if (timerId) {\n clearTimeout(timerId);\n }\n timerId = setTimeout(function () {\n return fn.apply(void 0, args);\n }, time);\n };\n}","function isPrimitive(obj) {\n return obj !== Object(obj);\n}\nexport function isEqual(first, second) {\n if (first === second) {\n return true;\n }\n if (isPrimitive(first) || isPrimitive(second) || typeof first === 'function' || typeof second === 'function') {\n return first === second;\n }\n if (Object.keys(first).length !== Object.keys(second).length) {\n return false;\n }\n for (var _i = 0, _Object$keys = Object.keys(first); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n if (!(key in second)) {\n return false;\n }\n if (!isEqual(first[key], second[key])) {\n return false;\n }\n }\n return true;\n}","export var noop = function noop() {};","/**\n * Safely runs code meant for browser environments only.\n */\nexport function safelyRunOnBrowser(callback) {\n if (typeof window !== 'undefined') {\n return callback({\n window: window\n });\n }\n return undefined;\n}","import type {\n AlgoliaInsightsHit,\n ClickedObjectIDsAfterSearchParams,\n InsightsParamsWithItems,\n} from './types';\n\ntype CreateClickedEventParams = {\n item: AlgoliaInsightsHit;\n items: AlgoliaInsightsHit[];\n};\n\nexport function createClickedEvent({\n item,\n items,\n}: CreateClickedEventParams): Omit<\n InsightsParamsWithItems,\n 'eventName'\n> & { algoliaSource?: string[] } {\n return {\n index: item.__autocomplete_indexName,\n items: [item],\n positions: [1 + items.findIndex((x) => x.objectID === item.objectID)],\n queryID: item.__autocomplete_queryID,\n algoliaSource: ['autocomplete'],\n };\n}\n","import type { InsightsClient } from './types';\n\n/**\n * Determines if a given insights `client` supports the optional call to `init`\n * and the ability to set credentials via extra parameters when sending events.\n */\nexport function isModernInsightsClient(client: InsightsClient): boolean {\n const [major, minor] = (client.version || '').split('.').map(Number);\n\n /* eslint-disable @typescript-eslint/camelcase */\n const v3 = major >= 3;\n const v2_4 = major === 2 && minor >= 4;\n const v1_10 = major === 1 && minor >= 10;\n\n return v3 || v2_4 || v1_10;\n /* eslint-enable @typescript-eslint/camelcase */\n}\n","import type { InsightsMethodMap } from 'search-insights';\n\nimport { isModernInsightsClient } from './isModernInsightsClient';\nimport {\n AlgoliaInsightsHit,\n ClickedFiltersParams,\n ClickedObjectIDsAfterSearchParams,\n ClickedObjectIDsParams,\n ConvertedFiltersParams,\n ConvertedObjectIDsAfterSearchParams,\n ConvertedObjectIDsParams,\n InsightsClient,\n InsightsClientMethod,\n InsightsParamsWithItems,\n ViewedFiltersParams,\n ViewedObjectIDsParams,\n} from './types';\n\nfunction chunk(\n item: TItem,\n chunkSize: number = 20\n): TItem[] {\n const chunks: TItem[] = [];\n for (let i = 0; i < item.objectIDs.length; i += chunkSize) {\n chunks.push({\n ...item,\n objectIDs: item.objectIDs.slice(i, i + chunkSize),\n });\n }\n return chunks;\n}\n\nfunction mapToInsightsParamsApi<\n TInsightsParamsType extends {\n items: AlgoliaInsightsHit[];\n objectIDs?: string[];\n }\n>(params: TInsightsParamsType[]) {\n return params.map(({ items, ...param }) => ({\n ...param,\n objectIDs: items?.map(({ objectID }) => objectID) || param.objectIDs,\n }));\n}\n\nexport function createSearchInsightsApi(searchInsights: InsightsClient) {\n const canSendHeaders = isModernInsightsClient(searchInsights);\n\n function sendToInsights(\n method: InsightsClientMethod,\n payloads: InsightsMethodMap[TInsightsMethod],\n items?: AlgoliaInsightsHit[]\n ) {\n if (canSendHeaders && typeof items !== 'undefined') {\n const { appId, apiKey } = items[0].__autocomplete_algoliaCredentials;\n const headers = {\n 'X-Algolia-Application-Id': appId,\n 'X-Algolia-API-Key': apiKey,\n };\n\n searchInsights(method, ...payloads, { headers });\n } else {\n searchInsights(method, ...payloads);\n }\n }\n\n return {\n /**\n * Initializes Insights with Algolia credentials.\n */\n init(appId: string, apiKey: string) {\n searchInsights('init', { appId, apiKey });\n },\n /**\n * Sets the user token to attach to events.\n */\n setUserToken(userToken: string) {\n searchInsights('setUserToken', userToken);\n },\n /**\n * Sends click events to capture a query and its clicked items and positions.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/clicked-object-ids-after-search/\n */\n clickedObjectIDsAfterSearch(\n ...params: Array<\n InsightsParamsWithItems\n >\n ) {\n if (params.length > 0) {\n sendToInsights(\n 'clickedObjectIDsAfterSearch',\n mapToInsightsParamsApi(params),\n params[0].items\n );\n }\n },\n /**\n * Sends click events to capture clicked items.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/clicked-object-ids/\n */\n clickedObjectIDs(\n ...params: Array>\n ) {\n if (params.length > 0) {\n sendToInsights(\n 'clickedObjectIDs',\n mapToInsightsParamsApi(params),\n params[0].items\n );\n }\n },\n /**\n * Sends click events to capture the filters a user clicks on.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/clicked-filters/\n */\n clickedFilters(...params: ClickedFiltersParams[]) {\n if (params.length > 0) {\n searchInsights('clickedFilters', ...params);\n }\n },\n /**\n * Sends conversion events to capture a query and its clicked items.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/converted-object-ids-after-search/\n */\n convertedObjectIDsAfterSearch(\n ...params: Array<\n InsightsParamsWithItems\n >\n ) {\n if (params.length > 0) {\n sendToInsights(\n 'convertedObjectIDsAfterSearch',\n mapToInsightsParamsApi(params),\n params[0].items\n );\n }\n },\n /**\n * Sends conversion events to capture clicked items.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/converted-object-ids/\n */\n convertedObjectIDs(\n ...params: Array>\n ) {\n if (params.length > 0) {\n sendToInsights(\n 'convertedObjectIDs',\n mapToInsightsParamsApi(params),\n params[0].items\n );\n }\n },\n /**\n * Sends conversion events to capture the filters a user uses when converting.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/converted-filters/\n */\n convertedFilters(...params: ConvertedFiltersParams[]) {\n if (params.length > 0) {\n searchInsights('convertedFilters', ...params);\n }\n },\n /**\n * Sends view events to capture clicked items.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/viewed-object-ids/\n */\n viewedObjectIDs(\n ...params: Array>\n ) {\n if (params.length > 0) {\n params\n .reduce<\n Array<{\n items?: AlgoliaInsightsHit[];\n payload: ViewedObjectIDsParams;\n }>\n >(\n (acc, { items, ...param }) => [\n ...acc,\n ...chunk({\n ...param,\n objectIDs:\n items?.map(({ objectID }) => objectID) || param.objectIDs,\n }).map((payload) => {\n return { items, payload };\n }),\n ],\n []\n )\n .forEach(({ items, payload }) =>\n sendToInsights('viewedObjectIDs', [payload], items)\n );\n }\n },\n /**\n * Sends view events to capture the filters a user uses when viewing.\n *\n * @link https://www.algolia.com/doc/api-reference/api-methods/viewed-filters/\n */\n viewedFilters(...params: ViewedFiltersParams[]) {\n if (params.length > 0) {\n searchInsights('viewedFilters', ...params);\n }\n },\n };\n}\n","import {\n AlgoliaInsightsHit,\n InsightsParamsWithItems,\n ViewedObjectIDsParams,\n} from './types';\n\ntype CreateViewedEventsParams = {\n items: AlgoliaInsightsHit[];\n};\n\nexport function createViewedEvents({\n items,\n}: CreateViewedEventsParams): Array<\n Omit, 'eventName'>\n> {\n const itemsByIndexName = items.reduce>(\n (acc, current) => {\n acc[current.__autocomplete_indexName] = (\n acc[current.__autocomplete_indexName] ?? []\n ).concat(current);\n\n return acc;\n },\n {}\n );\n\n return Object.keys(itemsByIndexName).map((indexName) => {\n const items = itemsByIndexName[indexName];\n\n return {\n index: indexName,\n items,\n algoliaSource: ['autocomplete'],\n };\n });\n}\n","import { AlgoliaInsightsHit } from './types';\n\nexport function isAlgoliaInsightsHit(hit: any): hit is AlgoliaInsightsHit {\n return (\n hit.objectID && hit.__autocomplete_indexName && hit.__autocomplete_queryID\n );\n}\n","import {\n AutocompleteState,\n AutocompletePlugin,\n createRef,\n debounce,\n isEqual,\n noop,\n safelyRunOnBrowser,\n} from '@algolia/autocomplete-shared';\n\nimport { createClickedEvent } from './createClickedEvent';\nimport { createSearchInsightsApi } from './createSearchInsightsApi';\nimport { createViewedEvents } from './createViewedEvents';\nimport { isAlgoliaInsightsHit } from './isAlgoliaInsightsHit';\nimport {\n AlgoliaInsightsHit,\n AutocompleteInsightsApi,\n InsightsClient,\n OnActiveParams,\n OnItemsChangeParams,\n OnSelectParams,\n} from './types';\n\nconst VIEW_EVENT_DELAY = 400;\nconst ALGOLIA_INSIGHTS_VERSION = '2.6.0';\nconst ALGOLIA_INSIGHTS_SRC = `https://cdn.jsdelivr.net/npm/search-insights@${ALGOLIA_INSIGHTS_VERSION}/dist/search-insights.min.js`;\n\ntype SendViewedObjectIDsParams = {\n onItemsChange(params: OnItemsChangeParams): void;\n items: AlgoliaInsightsHit[];\n insights: AutocompleteInsightsApi;\n state: AutocompleteState;\n};\n\nconst sendViewedObjectIDs = debounce(\n ({ onItemsChange, items, insights, state }) => {\n onItemsChange({\n insights,\n insightsEvents: createViewedEvents({ items }).map((event) => ({\n eventName: 'Items Viewed',\n ...event,\n })),\n state,\n });\n },\n VIEW_EVENT_DELAY\n);\n\nexport type CreateAlgoliaInsightsPluginParams = {\n /**\n * The initialized Search Insights client.\n *\n * @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-plugin-algolia-insights/createAlgoliaInsightsPlugin/#param-insightsclient\n */\n insightsClient?: InsightsClient;\n /**\n * Hook to send an Insights event when the items change.\n *\n * By default, it sends a `viewedObjectIDs` event.\n *\n * In as-you-type experiences, items change as the user types. This hook is debounced every 400ms to reflect actual items that users notice and avoid generating too many events for items matching \"in progress\" queries.\n *\n * @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-plugin-algolia-insights/createAlgoliaInsightsPlugin/#param-onitemschange\n */\n onItemsChange?(params: OnItemsChangeParams): void;\n /**\n * Hook to send an Insights event when an item is selected.\n *\n * By default, it sends a clickedObjectIDsAfterSearch event.\n *\n * @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-plugin-algolia-insights/createAlgoliaInsightsPlugin/#param-onselect\n */\n onSelect?(params: OnSelectParams): void;\n /**\n * Hook to send an Insights event when an item is active.\n *\n * By default, it doesn't send any events.\n *\n * @link https://www.algolia.com/doc/ui-libraries/autocomplete/api-reference/autocomplete-plugin-algolia-insights/createAlgoliaInsightsPlugin/#param-onactive\n */\n onActive?(params: OnActiveParams): void;\n};\n\nexport function createAlgoliaInsightsPlugin(\n options: CreateAlgoliaInsightsPluginParams\n): AutocompletePlugin {\n const {\n insightsClient: providedInsightsClient,\n onItemsChange,\n onSelect: onSelectEvent,\n onActive: onActiveEvent,\n } = getOptions(options);\n let insightsClient = providedInsightsClient as InsightsClient;\n\n if (!providedInsightsClient) {\n safelyRunOnBrowser(({ window }) => {\n const pointer = window.AlgoliaAnalyticsObject || 'aa';\n\n if (typeof pointer === 'string') {\n insightsClient = window[pointer];\n }\n\n if (!insightsClient) {\n window.AlgoliaAnalyticsObject = pointer;\n\n if (!window[pointer]) {\n window[pointer] = (...args: any[]) => {\n if (!window[pointer].queue) {\n window[pointer].queue = [];\n }\n\n window[pointer].queue.push(args);\n };\n }\n\n window[pointer].version = ALGOLIA_INSIGHTS_VERSION;\n\n insightsClient = window[pointer];\n\n loadInsights(window);\n }\n });\n }\n\n const insights = createSearchInsightsApi(insightsClient);\n const previousItems = createRef([]);\n\n const debouncedOnStateChange = debounce<{\n state: AutocompleteState;\n }>(({ state }) => {\n if (!state.isOpen) {\n return;\n }\n\n const items = state.collections\n .reduce((acc, current) => {\n return [...acc, ...current.items];\n }, [])\n .filter(isAlgoliaInsightsHit);\n\n if (\n !isEqual(\n previousItems.current.map((x) => x.objectID),\n items.map((x) => x.objectID)\n )\n ) {\n previousItems.current = items;\n\n if (items.length > 0) {\n sendViewedObjectIDs({ onItemsChange, items, insights, state });\n }\n }\n }, 0);\n\n return {\n name: 'aa.algoliaInsightsPlugin',\n subscribe({ setContext, onSelect, onActive }) {\n insightsClient('addAlgoliaAgent', 'insights-plugin');\n\n setContext({\n algoliaInsightsPlugin: {\n __algoliaSearchParameters: {\n clickAnalytics: true,\n },\n insights,\n },\n });\n\n onSelect(({ item, state, event }) => {\n if (!isAlgoliaInsightsHit(item)) {\n return;\n }\n\n onSelectEvent({\n state: state as AutocompleteState,\n event,\n insights,\n item,\n insightsEvents: [\n {\n eventName: 'Item Selected',\n ...createClickedEvent({ item, items: previousItems.current }),\n },\n ],\n });\n });\n\n onActive(({ item, state, event }) => {\n if (!isAlgoliaInsightsHit(item)) {\n return;\n }\n\n onActiveEvent({\n state: state as AutocompleteState,\n event,\n insights,\n item,\n insightsEvents: [\n {\n eventName: 'Item Active',\n ...createClickedEvent({ item, items: previousItems.current }),\n },\n ],\n });\n });\n },\n onStateChange({ state }) {\n debouncedOnStateChange({ state: state as AutocompleteState });\n },\n __autocomplete_pluginOptions: options,\n };\n}\n\nfunction getOptions(options: CreateAlgoliaInsightsPluginParams) {\n return {\n onItemsChange({ insights, insightsEvents }: OnItemsChangeParams) {\n insights.viewedObjectIDs(\n ...insightsEvents.map((event) => ({\n ...event,\n algoliaSource: [\n ...(event.algoliaSource || []),\n 'autocomplete-internal',\n ],\n }))\n );\n },\n onSelect({ insights, insightsEvents }: OnSelectParams) {\n insights.clickedObjectIDsAfterSearch(\n ...insightsEvents.map((event) => ({\n ...event,\n algoliaSource: [\n ...(event.algoliaSource || []),\n 'autocomplete-internal',\n ],\n }))\n );\n },\n onActive: noop,\n ...options,\n };\n}\n\nfunction loadInsights(environment: typeof window) {\n const errorMessage = `[Autocomplete]: Could not load search-insights.js. Please load it manually following https://alg.li/insights-autocomplete`;\n\n try {\n const script = environment.document.createElement('script');\n script.async = true;\n script.src = ALGOLIA_INSIGHTS_SRC;\n\n script.onerror = () => {\n // eslint-disable-next-line no-console\n console.error(errorMessage);\n };\n\n document.body.appendChild(script);\n } catch (cause) {\n // eslint-disable-next-line no-console\n console.error(errorMessage);\n }\n}\n"],"names":["createRef","initialValue","current","debounce","fn","time","timerId","undefined","_len","arguments","length","args","Array","_key","clearTimeout","setTimeout","apply","isPrimitive","obj","Object","isEqual","first","second","keys","_i","_Object$keys","key","noop","safelyRunOnBrowser","callback","window","createClickedEvent","_ref","item","items","index","__autocomplete_indexName","positions","findIndex","x","objectID","queryID","__autocomplete_queryID","algoliaSource","isModernInsightsClient","client","_split$map","version","split","map","Number","_split$map2","_slicedToArray","major","minor","v3","v2_4","v1_10","chunk","chunkSize","chunks","i","objectIDs","push","_objectSpread","slice","mapToInsightsParamsApi","params","param","_objectWithoutProperties","_excluded","_ref2","createSearchInsightsApi","searchInsights","canSendHeaders","sendToInsights","method","payloads","_items$0$__autocomple","__autocomplete_algoliaCredentials","appId","apiKey","headers","concat","_toConsumableArray","init","setUserToken","userToken","clickedObjectIDsAfterSearch","clickedObjectIDs","_len2","_key2","clickedFilters","_len3","_key3","convertedObjectIDsAfterSearch","_len4","_key4","convertedObjectIDs","_len5","_key5","convertedFilters","_len6","_key6","viewedObjectIDs","_len7","_key7","reduce","acc","_ref3","_excluded2","_ref4","payload","forEach","_ref5","viewedFilters","_len8","_key8","createViewedEvents","itemsByIndexName","_acc$current$__autoco","indexName","isAlgoliaInsightsHit","hit","VIEW_EVENT_DELAY","ALGOLIA_INSIGHTS_VERSION","ALGOLIA_INSIGHTS_SRC","sendViewedObjectIDs","onItemsChange","insights","state","insightsEvents","event","eventName","createAlgoliaInsightsPlugin","options","_getOptions","getOptions","providedInsightsClient","insightsClient","onSelectEvent","onSelect","onActiveEvent","onActive","pointer","AlgoliaAnalyticsObject","queue","loadInsights","previousItems","debouncedOnStateChange","isOpen","collections","filter","name","subscribe","setContext","algoliaInsightsPlugin","__algoliaSearchParameters","clickAnalytics","_ref6","onStateChange","_ref7","__autocomplete_pluginOptions","_ref8","_ref9","environment","errorMessage","script","document","createElement","async","src","onerror","console","error","body","appendChild","cause"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAO,SAASA,SAASA,CAACC,YAAY,EAAE;IACtC,OAAO;EACLC,IAAAA,OAAO,EAAED,YAAAA;KACV,CAAA;EACH;;ECJO,SAASE,QAAQA,CAACC,EAAE,EAAEC,IAAI,EAAE;IACjC,IAAIC,OAAO,GAAGC,SAAS,CAAA;EACvB,EAAA,OAAO,YAAY;MACjB,KAAK,IAAIC,IAAI,GAAGC,SAAS,CAACC,MAAM,EAAEC,IAAI,GAAG,IAAIC,KAAK,CAACJ,IAAI,CAAC,EAAEK,IAAI,GAAG,CAAC,EAAEA,IAAI,GAAGL,IAAI,EAAEK,IAAI,EAAE,EAAE;EACvFF,MAAAA,IAAI,CAACE,IAAI,CAAC,GAAGJ,SAAS,CAACI,IAAI,CAAC,CAAA;EAC9B,KAAA;EACA,IAAA,IAAIP,OAAO,EAAE;QACXQ,YAAY,CAACR,OAAO,CAAC,CAAA;EACvB,KAAA;MACAA,OAAO,GAAGS,UAAU,CAAC,YAAY;QAC/B,OAAOX,EAAE,CAACY,KAAK,CAAC,KAAK,CAAC,EAAEL,IAAI,CAAC,CAAA;OAC9B,EAAEN,IAAI,CAAC,CAAA;KACT,CAAA;EACH;;ECbA,SAASY,WAAWA,CAACC,GAAG,EAAE;EACxB,EAAA,OAAOA,GAAG,KAAKC,MAAM,CAACD,GAAG,CAAC,CAAA;EAC5B,CAAA;EACO,SAASE,OAAOA,CAACC,KAAK,EAAEC,MAAM,EAAE;IAC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