@algolia/autocomplete-js 1.10.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-js 1.10.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-js 1.11.0 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
@@ -347,7 +347,7 @@
347
347
  return undefined;
348
348
  }
349
349
 
350
- var version = '1.10.0';
350
+ var version = '1.11.0';
351
351
 
352
352
  var userAgents$1 = [{
353
353
  segment: 'autocomplete-core',
@@ -940,14 +940,23 @@
940
940
  var setContext = _ref4.setContext,
941
941
  onSelect = _ref4.onSelect,
942
942
  onActive = _ref4.onActive;
943
+ function setInsightsContext(userToken) {
944
+ setContext({
945
+ algoliaInsightsPlugin: {
946
+ __algoliaSearchParameters: _objectSpread$f({
947
+ clickAnalytics: true
948
+ }, userToken ? {
949
+ userToken: userToken
950
+ } : {}),
951
+ insights: insights
952
+ }
953
+ });
954
+ }
943
955
  insightsClient('addAlgoliaAgent', 'insights-plugin');
944
- setContext({
945
- algoliaInsightsPlugin: {
946
- __algoliaSearchParameters: {
947
- clickAnalytics: true
948
- },
949
- insights: insights
950
- }
956
+ setInsightsContext();
957
+ insightsClient('onUserTokenChange', setInsightsContext);
958
+ insightsClient('getUserToken', null, function (_error, userToken) {
959
+ setInsightsContext(userToken);
951
960
  });
952
961
  onSelect(function (_ref5) {
953
962
  var item = _ref5.item,