@algolia/autocomplete-js 1.9.4 → 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.
@@ -44,7 +44,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
44
44
  autoComplete: "on" | "off";
45
45
  autoCorrect: "on" | "off";
46
46
  autoCapitalize: "on" | "off";
47
- enterKeyHint: "search" | "go";
47
+ enterKeyHint: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint;
48
48
  spellCheck: "false";
49
49
  maxLength: number;
50
50
  type: "search";
@@ -69,7 +69,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
69
69
  autoComplete: "on" | "off";
70
70
  autoCorrect: "on" | "off";
71
71
  autoCapitalize: "on" | "off";
72
- enterKeyHint: "search" | "go";
72
+ enterKeyHint: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint;
73
73
  spellCheck: "false";
74
74
  maxLength: number;
75
75
  type: "search";
@@ -186,6 +186,7 @@ export declare function getDefaultOptions<TItem extends BaseItem>(options: Autoc
186
186
  onStateChange?(props: import("@algolia/autocomplete-shared").OnStateChangeProps<TItem>): void;
187
187
  plugins?: import("@algolia/autocomplete-shared").AutocompletePlugin<any, any>[] | undefined;
188
188
  debug?: boolean | undefined;
189
+ enterKeyHint?: import("@algolia/autocomplete-core").AutocompleteEnterKeyHint | undefined;
189
190
  placeholder?: string | undefined;
190
191
  autoFocus?: boolean | undefined;
191
192
  defaultActiveItemId?: number | null | undefined;
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-js 1.9.4 | 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.9.4';
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,
@@ -1666,6 +1675,7 @@
1666
1675
  return _objectSpread$b(_objectSpread$b({
1667
1676
  debug: false,
1668
1677
  openOnFocus: false,
1678
+ enterKeyHint: undefined,
1669
1679
  placeholder: '',
1670
1680
  autoFocus: false,
1671
1681
  defaultActiveItemId: null,
@@ -2741,7 +2751,7 @@
2741
2751
  var activeItem = getActiveItem(store.getState());
2742
2752
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
2743
2753
  var shouldFallbackKeyHint = isSamsung(userAgent);
2744
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
2754
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
2745
2755
  return _objectSpread$6({
2746
2756
  'aria-autocomplete': 'both',
2747
2757
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,