@algolia/autocomplete-core 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.
@@ -21,6 +21,7 @@ export function getDefaultProps(props, pluginSubscribers) {
21
21
  return _objectSpread(_objectSpread({
22
22
  debug: false,
23
23
  openOnFocus: false,
24
+ enterKeyHint: undefined,
24
25
  placeholder: '',
25
26
  autoFocus: false,
26
27
  defaultActiveItemId: null,
@@ -144,7 +144,7 @@ export function getPropGetters(_ref) {
144
144
  var activeItem = getActiveItem(store.getState());
145
145
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
146
146
  var shouldFallbackKeyHint = isSamsung(userAgent);
147
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
147
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
148
148
  return _objectSpread({
149
149
  'aria-autocomplete': 'both',
150
150
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,
@@ -1,4 +1,4 @@
1
- /*! @algolia/autocomplete-core 1.9.4 | MIT License | © Algolia, Inc. and contributors | https://github.com/algolia/autocomplete */
1
+ /*! @algolia/autocomplete-core 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) :
@@ -291,7 +291,7 @@
291
291
  return undefined;
292
292
  }
293
293
 
294
- var version = '1.9.4';
294
+ var version = '1.11.0';
295
295
 
296
296
  var userAgents = [{
297
297
  segment: 'autocomplete-core',
@@ -884,14 +884,23 @@
884
884
  var setContext = _ref4.setContext,
885
885
  onSelect = _ref4.onSelect,
886
886
  onActive = _ref4.onActive;
887
+ function setInsightsContext(userToken) {
888
+ setContext({
889
+ algoliaInsightsPlugin: {
890
+ __algoliaSearchParameters: _objectSpread({
891
+ clickAnalytics: true
892
+ }, userToken ? {
893
+ userToken: userToken
894
+ } : {}),
895
+ insights: insights
896
+ }
897
+ });
898
+ }
887
899
  insightsClient('addAlgoliaAgent', 'insights-plugin');
888
- setContext({
889
- algoliaInsightsPlugin: {
890
- __algoliaSearchParameters: {
891
- clickAnalytics: true
892
- },
893
- insights: insights
894
- }
900
+ setInsightsContext();
901
+ insightsClient('onUserTokenChange', setInsightsContext);
902
+ insightsClient('getUserToken', null, function (_error, userToken) {
903
+ setInsightsContext(userToken);
895
904
  });
896
905
  onSelect(function (_ref5) {
897
906
  var item = _ref5.item,
@@ -1353,6 +1362,7 @@
1353
1362
  return _objectSpread2(_objectSpread2({
1354
1363
  debug: false,
1355
1364
  openOnFocus: false,
1365
+ enterKeyHint: undefined,
1356
1366
  placeholder: '',
1357
1367
  autoFocus: false,
1358
1368
  defaultActiveItemId: null,
@@ -2032,7 +2042,7 @@
2032
2042
  var activeItem = getActiveItem(store.getState());
2033
2043
  var userAgent = ((_props$environment$na = props.environment.navigator) === null || _props$environment$na === void 0 ? void 0 : _props$environment$na.userAgent) || '';
2034
2044
  var shouldFallbackKeyHint = isSamsung(userAgent);
2035
- var enterKeyHint = activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search';
2045
+ var enterKeyHint = props.enterKeyHint || (activeItem !== null && activeItem !== void 0 && activeItem.itemUrl && !shouldFallbackKeyHint ? 'go' : 'search');
2036
2046
  return _objectSpread2({
2037
2047
  'aria-autocomplete': 'both',
2038
2048
  'aria-activedescendant': store.getState().isOpen && store.getState().activeItemId !== null ? "".concat(props.id, "-item-").concat(store.getState().activeItemId) : undefined,