diff --git a/src/connectors/numeric-menu/connectNumericMenu.ts b/src/connectors/numeric-menu/connectNumericMenu.ts index fcbfd10e39..4e0ea20a87 100644 --- a/src/connectors/numeric-menu/connectNumericMenu.ts +++ b/src/connectors/numeric-menu/connectNumericMenu.ts @@ -42,7 +42,7 @@ export type NumericMenuRendererOptionsItem = { * URL encoded of the bounds object with the form `{start, end}`. * This value can be used verbatim in the webpage and can be read by `refine` * directly. If you want to inspect the value, you can do: - * `JSON.parse(window.decodeURI(value))` to get the object. + * `JSON.parse(decodeURI(value))` to get the object. */ value: string; @@ -166,7 +166,7 @@ const connectNumericMenu: NumericMenuConnector = function connectNumericMenu( const prepareItems = (state: SearchParameters) => items.map(({ start, end, label }) => ({ label, - value: (window as any).encodeURI(JSON.stringify({ start, end })), + value: encodeURI(JSON.stringify({ start, end })), isRefined: isRefined(state, attribute, { start, end, label }), })); @@ -366,7 +366,7 @@ function getRefinedState( ) { let resolvedState = state; - const refinedOption = JSON.parse((window as any).decodeURI(facetValue)); + const refinedOption = JSON.parse(decodeURI(facetValue)); // @TODO: why is array / element mixed here & hasRefinements; seems wrong? const currentRefinements = resolvedState.getNumericRefinements( diff --git a/stories/voice-search.stories.ts b/stories/voice-search.stories.ts index 6bb65da917..be1069e1b2 100644 --- a/stories/voice-search.stories.ts +++ b/stories/voice-search.stories.ts @@ -58,8 +58,8 @@ storiesOf('Basics/VoiceSearch', module) .add( 'with a custom button text', withHits(({ search, container }) => { - const style = window.document.createElement('style'); - window.document.head.appendChild(style); + const style = document.createElement('style'); + document.head.appendChild(style); [ `.ais-VoiceSearch-button.custom-button:hover { background: inherit; @@ -130,8 +130,8 @@ storiesOf('Basics/VoiceSearch', module) container.appendChild(subContainer1); container.appendChild(subContainer2); - const style = window.document.createElement('style'); - window.document.head.appendChild(style); + const style = document.createElement('style'); + document.head.appendChild(style); [ `.voice-search-button { position: absolute;