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

@docsearch/react

Package Overview
Dependencies
Maintainers
3
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docsearch/react - npm Package Compare versions

Comparing version 3.0.0-alpha.42 to 3.0.0-alpha.50

158

dist/esm/__tests__/api.test.js

@@ -1,4 +0,4 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

@@ -23,2 +23,21 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

}, props));
} // mock empty response
function noResultSearch(_queries, _requestOptions) {
return new Promise(function (resolve) {
resolve({
results: [{
hits: [],
hitsPerPage: 0,
nbHits: 0,
nbPages: 0,
page: 0,
processingTimeMS: 0,
exhaustiveNbHits: true,
params: '',
query: ''
}]
});
});
}

@@ -81,23 +100,6 @@

case 0:
render( /*#__PURE__*/React.createElement(DocSearch // mock empty response
, {
render( /*#__PURE__*/React.createElement(DocSearch, {
transformSearchClient: function transformSearchClient(searchClient) {
return _objectSpread(_objectSpread({}, searchClient), {}, {
search: function search() {
return new Promise(function (resolve) {
resolve({
results: [{
hits: [],
hitsPerPage: 0,
nbHits: 0,
nbPages: 0,
page: 0,
processingTimeMS: 0,
exhaustiveNbHits: true,
params: '',
query: ''
}]
});
});
}
search: noResultSearch
});

@@ -109,6 +111,9 @@ },

noResultsText: 'Pas de résultats pour',
openIssueText: 'Ouvrez une issue sur docsearch-configs',
openIssueLinkText: 'Lien du repo'
reportMissingResultsText: 'Ouvrez une issue sur docsearch-configs',
reportMissingResultsLinkText: 'Lien du repo'
}
}
},
getMissingResultsUrl: function getMissingResultsUrl() {
return 'algolia.com';
}

@@ -227,2 +232,109 @@ }));

});
describe('getMissingResultsUrl', function () {
it('does not render the link to the repository by default', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
return regeneratorRuntime.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
render( /*#__PURE__*/React.createElement(DocSearch, {
transformSearchClient: function transformSearchClient(searchClient) {
return _objectSpread(_objectSpread({}, searchClient), {}, {
search: noResultSearch
});
}
}));
_context7.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
return regeneratorRuntime.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
case 2:
fireEvent.input(document.querySelector('.DocSearch-Input'), {
target: {
value: 'q'
}
});
case 3:
case "end":
return _context6.stop();
}
}
}, _callee6);
})));
case 3:
expect(screen.getByText(/No results for/)).toBeInTheDocument();
expect(document.querySelector('.DocSearch-Help a')).not.toBeInTheDocument();
case 5:
case "end":
return _context7.stop();
}
}
}, _callee7);
})));
it('render the link to the repository', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9() {
var link;
return regeneratorRuntime.wrap(function _callee9$(_context9) {
while (1) {
switch (_context9.prev = _context9.next) {
case 0:
render( /*#__PURE__*/React.createElement(DocSearch, {
transformSearchClient: function transformSearchClient(searchClient) {
return _objectSpread(_objectSpread({}, searchClient), {}, {
search: noResultSearch
});
},
getMissingResultsUrl: function getMissingResultsUrl(_ref9) {
var query = _ref9.query;
return "https://github.com/algolia/docsearch/issues/new?title=".concat(query);
}
}));
_context9.next = 3;
return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
return regeneratorRuntime.wrap(function _callee8$(_context8) {
while (1) {
switch (_context8.prev = _context8.next) {
case 0:
_context8.next = 2;
return waitFor(function () {
fireEvent.click(document.querySelector('.DocSearch-Button'));
});
case 2:
fireEvent.input(document.querySelector('.DocSearch-Input'), {
target: {
value: 'q'
}
});
case 3:
case "end":
return _context8.stop();
}
}
}, _callee8);
})));
case 3:
expect(screen.getByText(/No results for/)).toBeInTheDocument();
link = document.querySelector('.DocSearch-Help a');
expect(link).toBeInTheDocument();
expect(link.getAttribute('href')).toBe('https://github.com/algolia/docsearch/issues/new?title=q');
case 7:
case "end":
return _context9.stop();
}
}
}, _callee9);
})));
});
});

2

dist/esm/AlgoliaLogo.js

@@ -8,3 +8,3 @@ import React from 'react';

return /*#__PURE__*/React.createElement("a", {
href: "https://www.algolia.com/docsearch",
href: "https://www.algolia.com/ref/docsearch/?utm_source=".concat(window.location.hostname, "&utm_medium=referral&utm_content=powered_by&utm_campaign=docsearch"),
target: "_blank",

@@ -11,0 +11,0 @@ rel: "noopener noreferrer"

@@ -30,3 +30,6 @@ import type { AutocompleteState, AutocompleteOptions } from '@algolia/autocomplete-core';

translations?: DocSearchTranslations;
getMissingResultsUrl?: ({ query: string }: {
query: any;
}) => string;
}
export declare function DocSearch(props: DocSearchProps): JSX.Element;

@@ -11,3 +11,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -14,0 +14,0 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -15,2 +15,2 @@ /// <reference types="react" />

};
export declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, }: DocSearchModalProps): JSX.Element;
export declare function DocSearchModal({ appId, apiKey, indexName, placeholder, searchParameters, onClose, transformItems, hitComponent, resultsFooterComponent, navigator, initialScrollY, transformSearchClient, disableUserPersonalization, initialQuery: initialQueryFromProp, translations, getMissingResultsUrl, }: DocSearchModalProps): JSX.Element;

@@ -5,5 +5,5 @@ var _excluded = ["footer", "searchBox"];

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

@@ -20,3 +20,3 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -69,3 +69,4 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

_ref$translations = _ref.translations,
translations = _ref$translations === void 0 ? {} : _ref$translations;
translations = _ref$translations === void 0 ? {} : _ref$translations,
getMissingResultsUrl = _ref.getMissingResultsUrl;

@@ -368,2 +369,3 @@ var footerTranslations = translations.footer,

translations: screenStateTranslations,
getMissingResultsUrl: getMissingResultsUrl,
onItemClick: function onItemClick(item) {

@@ -370,0 +372,0 @@ saveRecentSearch(item);

@@ -7,4 +7,4 @@ /// <reference types="react" />

suggestedQueryText: string;
openIssueText: string;
openIssueLinkText: string;
reportMissingResultsText: string;
reportMissingResultsLinkText: string;
}>;

@@ -11,0 +11,0 @@ declare type NoResultsScreenProps = Omit<ScreenStateProps<InternalDocSearchHit>, 'translations'> & {

@@ -9,3 +9,3 @@ var _excluded = ["translations"];

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -31,6 +31,6 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

suggestedQueryText = _translations$suggest === void 0 ? 'Try searching for' : _translations$suggest,
_translations$openIss = translations.openIssueText,
openIssueText = _translations$openIss === void 0 ? 'Believe this query should return results?' : _translations$openIss,
_translations$openIss2 = translations.openIssueLinkText,
openIssueLinkText = _translations$openIss2 === void 0 ? 'Let us know' : _translations$openIss2;
_translations$reportM = translations.reportMissingResultsText,
reportMissingResultsText = _translations$reportM === void 0 ? 'Believe this query should return results?' : _translations$reportM,
_translations$reportM2 = translations.reportMissingResultsLinkText,
reportMissingResultsLinkText = _translations$reportM2 === void 0 ? 'Let us know.' : _translations$reportM2;
var searchSuggestions = props.state.context.searchSuggestions;

@@ -60,9 +60,11 @@ return /*#__PURE__*/React.createElement("div", {

}, search))]);
}, []))), /*#__PURE__*/React.createElement("p", {
}, []))), props.getMissingResultsUrl && /*#__PURE__*/React.createElement("p", {
className: "DocSearch-Help"
}, "".concat(openIssueText, " "), /*#__PURE__*/React.createElement("a", {
href: "https://github.com/algolia/docsearch-configs/issues/new?template=Missing_results.md&title=[".concat(props.indexName, "]+Missing+results+for+query+\"").concat(props.state.query, "\""),
}, "".concat(reportMissingResultsText, " "), /*#__PURE__*/React.createElement("a", {
href: props.getMissingResultsUrl({
query: props.state.query
}),
target: "_blank",
rel: "noopener noreferrer"
}, openIssueLinkText), "."));
}, reportMissingResultsLinkText)));
}

@@ -9,3 +9,3 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -12,0 +12,0 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

@@ -25,3 +25,4 @@ import type { AutocompleteApi, AutocompleteState, BaseItem } from '@algolia/autocomplete-core';

translations: ScreenStateTranslations;
getMissingResultsUrl?: DocSearchProps['getMissingResultsUrl'];
}
export declare const ScreenState: React.MemoExoticComponent<({ translations, ...props }: ScreenStateProps<InternalDocSearchHit>) => JSX.Element>;
var _excluded = ["hit", "attribute", "tagName"];
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

@@ -7,0 +7,0 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

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

export declare const version = "3.0.0-alpha.42";
export declare const version = "3.0.0-alpha.50";

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

export var version = '3.0.0-alpha.42';
export var version = '3.0.0-alpha.50';
{
"name": "@docsearch/react",
"description": "React package for DocSearch, the best search experience for docs.",
"version": "3.0.0-alpha.42",
"version": "3.0.0-alpha.50",
"license": "MIT",

@@ -37,5 +37,5 @@ "homepage": "https://docsearch.algolia.com",

"dependencies": {
"@algolia/autocomplete-core": "1.5.0",
"@algolia/autocomplete-preset-algolia": "1.5.0",
"@docsearch/css": "3.0.0-alpha.42",
"@algolia/autocomplete-core": "1.5.2",
"@algolia/autocomplete-preset-algolia": "1.5.2",
"@docsearch/css": "3.0.0-alpha.50",
"algoliasearch": "^4.0.0"

@@ -42,0 +42,0 @@ },

Sorry, the diff of this file is too big to display

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