Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@algolia/autocomplete-plugin-algolia-insights

Package Overview
Dependencies
Maintainers
61
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@algolia/autocomplete-plugin-algolia-insights - npm Package Compare versions

Comparing version 1.0.0-alpha.40 to 1.0.0-alpha.41

dist/esm/types/AutocompleteInsightsApi.d.ts

4

dist/esm/createAlgoliaInsightsPlugin.d.ts
import { AutocompletePlugin } from '@algolia/autocomplete-core';
import { InsightsClient, OnHighlightParams, OnItemsChangeParams, OnSelectParams } from './types';
import { InsightsClient, OnActiveParams, OnItemsChangeParams, OnSelectParams } from './types';
export declare type CreateAlgoliaInsightsPluginParams = {

@@ -22,4 +22,4 @@ /**

*/
onActive?(params: OnHighlightParams): void;
onActive?(params: OnActiveParams): void;
};
export declare function createAlgoliaInsightsPlugin({ insightsClient, onItemsChange, onSelect: onSelectEvent, onActive: onActiveEvent, }: CreateAlgoliaInsightsPluginParams): AutocompletePlugin<any, undefined>;

@@ -0,1 +1,2 @@

export type { AutocompleteInsightsApi } from './types/AutocompleteInsightsApi';
export * from './createAlgoliaInsightsPlugin';
import { AutocompleteState } from '@algolia/autocomplete-core';
import { ClickedObjectIDsAfterSearchParams, ViewedObjectIDsParams } from './InsightsApi';
import { AlgoliaInsightsHit, InsightsApi } from '.';
import { ClickedObjectIDsAfterSearchParams, ViewedObjectIDsParams } from './AutocompleteInsightsApi';
import { AlgoliaInsightsHit, AutocompleteInsightsApi } from '.';
export declare type OnSelectParams = {
insights: InsightsApi;
insights: AutocompleteInsightsApi;
insightsEvents: ClickedObjectIDsAfterSearchParams[];

@@ -11,7 +11,7 @@ item: AlgoliaInsightsHit;

};
export declare type OnHighlightParams = OnSelectParams;
export declare type OnActiveParams = OnSelectParams;
export declare type OnItemsChangeParams = {
insights: InsightsApi;
insights: AutocompleteInsightsApi;
insightsEvents: ViewedObjectIDsParams[];
state: AutocompleteState<any>;
};
export * from './AlgoliaInsightsHit';
export * from './InsightsApi';
export * from './AutocompleteInsightsApi';
export * from './EventParams';
export * from './InsightsClient';
export * from './EventParams';
export * from './AlgoliaInsightsHit';
export * from './InsightsApi';
export * from './InsightsClient';
export * from './EventParams';
export * from './AutocompleteInsightsApi';
export * from './EventParams';
export * from './InsightsClient';

@@ -1,2 +0,2 @@

/*! @algolia/autocomplete-plugin-algolia-insights 1.0.0-alpha.40 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete.js */
/*! @algolia/autocomplete-plugin-algolia-insights 1.0.0-alpha.41 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete.js */
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :

@@ -1,3 +0,3 @@

/*! @algolia/autocomplete-plugin-algolia-insights 1.0.0-alpha.40 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete.js */
/*! @algolia/autocomplete-plugin-algolia-insights 1.0.0-alpha.41 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete.js */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@algolia/autocomplete-plugin-algolia-insights"]={})}(this,(function(e){"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function r(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(Object(i),!0).forEach((function(n){t(e,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function i(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=void 0;return function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(void 0,i)}),t)}}function a(e){return e!==Object(e)}function s(e,t){if(e===t)return!0;if(a(e)||a(t)||"function"==typeof e||"function"==typeof t)return e===t;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];if(!(i in t))return!1;if(!s(e[i],t[i]))return!1}return!0}function u(e){var t=e.item,n=e.items;return{index:t.__autocomplete_indexName,objectIDs:[t.objectID],positions:[1+n.findIndex((function(e){return e.objectID===t.objectID}))],queryID:t.__autocomplete_queryID}}function f(e){var t=e.items.reduce((function(e,t){var n;return e[t.__autocomplete_indexName]=(null!==(n=e[t.__autocomplete_indexName])&&void 0!==n?n:[]).concat(t.objectID),e}),{});return Object.keys(t).map((function(e){return{index:e,objectIDs:t[e]}}))}function l(e){return e.objectID&&e.__autocomplete_indexName&&e.__autocomplete_queryID}var v=c((function(e){var t=e.onItemsChange,n=e.items,i=e.insights,o=e.state;t({insights:i,insightsEvents:f({items:n}).map((function(e){return r({eventName:"Items Viewed"},e)})),state:o})}),400);e.createAlgoliaInsightsPlugin=function(e){var t,n=e.insightsClient,o=e.onItemsChange,a=void 0===o?function(e){var t=e.insights,n=e.insightsEvents;t.viewedObjectIDs.apply(t,i(n))}:o,f=e.onSelect,p=void 0===f?function(e){var t=e.insights,n=e.insightsEvents;t.clickedObjectIDsAfterSearch.apply(t,i(n))}:f,d=e.onActive,g=void 0===d?function(){}:d,y=(t=n,{init:function(e,n){t("init",{appId:e,apiKey:n})},setUserToken:function(e){t("setUserToken",e)},clickedObjectIDsAfterSearch:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["clickedObjectIDsAfterSearch"].concat(n))},clickedObjectIDs:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["clickedObjectIDs"].concat(n))},clickedFilters:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["clickedFilters"].concat(n))},convertedObjectIDsAfterSearch:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["convertedObjectIDsAfterSearch"].concat(n))},convertedObjectIDs:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["convertedObjectIDs"].concat(n))},convertedFilters:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["convertedFilters"].concat(n))},viewedObjectIDs:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["viewedObjectIDs"].concat(n))},viewedFilters:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length>0&&t.apply(void 0,["viewedFilters"].concat(n))}}),b={current:[]},h=c((function(e){var t=e.state;if(t.isOpen){var n=t.collections.reduce((function(e,t){return[].concat(i(e),i(t.items))}),[]).filter(l);s(b.current.map((function(e){return e.objectID})),n.map((function(e){return e.objectID})))||(b.current=n,n.length>0&&v({onItemsChange:a,items:n,insights:y,state:t}))}}),0);return{subscribe:function(e){var t=e.setContext,n=e.onSelect,i=e.onActive;t({algoliaInsightsPlugin:{insights:y}}),n((function(e){var t=e.item,n=e.state,i=e.event;l(t)&&p({state:n,event:i,insights:y,item:t,insightsEvents:[r({eventName:"Item Selected"},u({item:t,items:b.current}))]})})),i((function(e){var t=e.item,n=e.state,i=e.event;l(t)&&g({state:n,event:i,insights:y,item:t,insightsEvents:[r({eventName:"Item Active"},u({item:t,items:b.current}))]})}))},onStateChange:function(e){var t=e.state;h({state:t})}}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@algolia/autocomplete-plugin-algolia-insights",
"description": "A plugin to add Algolia Insights to Algolia Autocomplete.",
"version": "1.0.0-alpha.40",
"version": "1.0.0-alpha.41",
"license": "MIT",

@@ -34,4 +34,4 @@ "homepage": "https://github.com/algolia/autocomplete.js",

"dependencies": {
"@algolia/autocomplete-core": "1.0.0-alpha.40",
"@algolia/autocomplete-shared": "1.0.0-alpha.40"
"@algolia/autocomplete-core": "1.0.0-alpha.41",
"@algolia/autocomplete-shared": "1.0.0-alpha.41"
},

@@ -38,0 +38,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc