@constructor-io/constructorio-ui-autocomplete 1.24.0 → 1.25.1

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.
@@ -43,10 +43,11 @@ const DefaultRenderSectionItemsList = function ({ section }) {
43
43
  return (react_1.default.createElement("li", Object.assign({}, getSectionProps(section)),
44
44
  react_1.default.createElement("h5", { className: 'cio-section-name cio-sectionName', "aria-hidden": true }, (0, format_1.camelToStartCase)(sectionTitle)),
45
45
  react_1.default.createElement("ul", { className: 'cio-section-items', role: 'none' }, (_c = section === null || section === void 0 ? void 0 : section.data) === null || _c === void 0 ? void 0 : _c.map((item) => {
46
+ var _a, _b;
46
47
  if (typeof (section === null || section === void 0 ? void 0 : section.renderItem) === 'function') {
47
- return (react_1.default.createElement(CustomSectionItem_1.default, { renderItem: section.renderItem, item: item, query: query, key: item.id }));
48
+ return (react_1.default.createElement(CustomSectionItem_1.default, { renderItem: section.renderItem, item: item, query: query, key: ((_a = item === null || item === void 0 ? void 0 : item.data) === null || _a === void 0 ? void 0 : _a.variation_id) || (item === null || item === void 0 ? void 0 : item.id) }));
48
49
  }
49
- return (react_1.default.createElement(SectionItem_1.default, { item: item, key: item === null || item === void 0 ? void 0 : item.id, displaySearchTermHighlights: section.displaySearchTermHighlights }));
50
+ return (react_1.default.createElement(SectionItem_1.default, { item: item, key: ((_b = item === null || item === void 0 ? void 0 : item.data) === null || _b === void 0 ? void 0 : _b.variation_id) || (item === null || item === void 0 ? void 0 : item.id), displaySearchTermHighlights: section.displaySearchTermHighlights }));
50
51
  })),
51
52
  displayShowAllResultsButton &&
52
53
  (typeof type === 'undefined' || type === 'autocomplete') &&
@@ -63,7 +63,7 @@ const disableStoryActions = (story) => {
63
63
  exports.disableStoryActions = disableStoryActions;
64
64
  const getCioClient = (apiKey, cioJsClientOptions) => {
65
65
  if (apiKey && typeof window !== 'undefined') {
66
- const cioClient = new constructorio_client_javascript_1.default(Object.assign({ apiKey, sendTrackingEvents: true, version: `cio-ui-autocomplete-${version_1.default}` }, cioJsClientOptions));
66
+ const cioClient = new constructorio_client_javascript_1.default(Object.assign(Object.assign({ apiKey, sendTrackingEvents: true, version: `cio-ui-autocomplete-${version_1.default}` }, cioJsClientOptions), { eventDispatcher: { waitForBeacon: false } }));
67
67
  // eslint-disable-next-line no-console
68
68
  cioClient.tracker.on('error', (error) => console.error(error));
69
69
  return cioClient;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.24.0';
3
+ exports.default = '1.25.1';
@@ -40,9 +40,9 @@ const DefaultRenderSectionItemsList = function ({ section }) {
40
40
  React.createElement("h5", { className: 'cio-section-name cio-sectionName', "aria-hidden": true }, camelToStartCase(sectionTitle)),
41
41
  React.createElement("ul", { className: 'cio-section-items', role: 'none' }, section?.data?.map((item) => {
42
42
  if (typeof section?.renderItem === 'function') {
43
- return (React.createElement(CustomSectionItem, { renderItem: section.renderItem, item: item, query: query, key: item.id }));
43
+ return (React.createElement(CustomSectionItem, { renderItem: section.renderItem, item: item, query: query, key: item?.data?.variation_id || item?.id }));
44
44
  }
45
- return (React.createElement(SectionItem, { item: item, key: item?.id, displaySearchTermHighlights: section.displaySearchTermHighlights }));
45
+ return (React.createElement(SectionItem, { item: item, key: item?.data?.variation_id || item?.id, displaySearchTermHighlights: section.displaySearchTermHighlights }));
46
46
  })),
47
47
  displayShowAllResultsButton &&
48
48
  (typeof type === 'undefined' || type === 'autocomplete') &&
@@ -57,6 +57,7 @@ export const getCioClient = (apiKey, cioJsClientOptions) => {
57
57
  sendTrackingEvents: true,
58
58
  version: `cio-ui-autocomplete-${version}`,
59
59
  ...cioJsClientOptions,
60
+ eventDispatcher: { waitForBeacon: false },
60
61
  });
61
62
  // eslint-disable-next-line no-console
62
63
  cioClient.tracker.on('error', (error) => console.error(error));
@@ -1 +1 @@
1
- export default '1.24.0';
1
+ export default '1.25.1';
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { Item, Section } from '../../../types';
3
3
  export type RenderResults = (renderResultsArguments: {
4
4
  sections: Section[];
@@ -7,5 +7,5 @@ export type RenderResults = (renderResultsArguments: {
7
7
  type AutocompleteResultsProps = {
8
8
  children?: RenderResults | ReactNode;
9
9
  };
10
- export default function AutocompleteResults(props: AutocompleteResultsProps): React.JSX.Element;
10
+ export default function AutocompleteResults(props: AutocompleteResultsProps): JSX.Element;
11
11
  export {};
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export default function CloseIcon(props: any): React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export default function CloseIcon(props: any): JSX.Element;
@@ -1,2 +1,2 @@
1
- import React from 'react';
2
- export default function NoResults(): React.JSX.Element;
1
+ /// <reference types="react" />
2
+ export default function NoResults(): JSX.Element;
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { CioAutocompleteProps } from '../../../types';
3
- export default function CioAutocomplete(props: CioAutocompleteProps): React.JSX.Element;
3
+ export default function CioAutocomplete(props: CioAutocompleteProps): JSX.Element;
@@ -33,4 +33,4 @@ export declare const CioAutocompleteContext: React.Context<{
33
33
  advancedParameters: import("../../types").AdvancedParameters | undefined;
34
34
  getSearchResultsUrl: ((item: import("../../types").SearchSuggestion) => string) | undefined;
35
35
  }>;
36
- export default function CioAutocompleteProvider(props: CioAutocompleteProps): React.JSX.Element;
36
+ export default function CioAutocompleteProvider(props: CioAutocompleteProps): JSX.Element;
@@ -1,7 +1,7 @@
1
- import React, { ReactElement } from 'react';
1
+ import { ReactElement } from 'react';
2
2
  import { CioAutocompleteProps } from '../../../types';
3
3
  type SearchInputProps = {
4
4
  children?: (args: Partial<Omit<CioAutocompleteProps, 'children'>>) => ReactElement;
5
5
  };
6
- export default function SearchInput(props: SearchInputProps): React.JSX.Element;
6
+ export default function SearchInput(props: SearchInputProps): JSX.Element;
7
7
  export {};
@@ -1,4 +1,4 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { Item } from '../../../types';
3
3
  interface CustomItemProps {
4
4
  item: Item;
@@ -9,5 +9,5 @@ interface CustomItemProps {
9
9
  }) => HTMLElement | ReactNode;
10
10
  query: string;
11
11
  }
12
- export default function CustomSectionItem(props: CustomItemProps): React.JSX.Element | null;
12
+ export default function CustomSectionItem(props: CustomItemProps): JSX.Element | null;
13
13
  export {};
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { SearchSuggestion } from '../../../types';
3
3
  interface SearchSuggestionItemProps {
4
4
  item: SearchSuggestion;
5
5
  displaySearchTermHighlights?: boolean;
6
6
  }
7
- export default function SearchSuggestionItem(props: SearchSuggestionItemProps): React.JSX.Element;
7
+ export default function SearchSuggestionItem(props: SearchSuggestionItemProps): JSX.Element;
8
8
  export {};
@@ -1,9 +1,8 @@
1
- import React, { ReactNode } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { Item } from '../../../types';
3
3
  export interface SectionItemProps {
4
4
  item: Item;
5
5
  children?: ReactNode;
6
- key?: string;
7
6
  displaySearchTermHighlights?: boolean;
8
7
  }
9
- export default function SectionItem(props: SectionItemProps): React.JSX.Element;
8
+ export default function SectionItem(props: SectionItemProps): JSX.Element;
@@ -1,8 +1,8 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { Item } from '../../../types';
3
3
  export interface SectionItemTextProps {
4
4
  item: Item;
5
5
  query: string;
6
6
  highlightSearchTerm?: boolean;
7
7
  }
8
- export default function SectionItemText({ item, query, highlightSearchTerm, }: SectionItemTextProps): React.JSX.Element;
8
+ export default function SectionItemText({ item, query, highlightSearchTerm, }: SectionItemTextProps): JSX.Element;
@@ -6,7 +6,6 @@ export type RenderSectionItemsList = (renderResultsArguments: {
6
6
  type SectionItemsListProps = {
7
7
  section: Section;
8
8
  children?: RenderSectionItemsList;
9
- key?: string;
10
9
  };
11
10
  export default function SectionItemsList(props: SectionItemsListProps): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
12
11
  export {};
@@ -1,2 +1,2 @@
1
- declare const _default: "1.24.0";
1
+ declare const _default: "1.25.1";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-ui-autocomplete",
3
- "version": "1.24.0",
3
+ "version": "1.25.1",
4
4
  "description": "Constructor.io Autocomplete UI library for web applications",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -112,7 +112,7 @@
112
112
  "whatwg-fetch": "^3.6.20"
113
113
  },
114
114
  "peerDependencies": {
115
- "@constructor-io/constructorio-client-javascript": "^2.64.0",
115
+ "@constructor-io/constructorio-client-javascript": "^2.67.6",
116
116
  "downshift": "^7.2.1",
117
117
  "react": ">=16.12.0",
118
118
  "react-dom": ">=16.12.0",