Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): support v5 fully #6270

Merged
merged 4 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ workflows:
- unit tests:
requires:
- build
- legacy algoliasearch:
- legacy algoliasearch v3:
requires:
- build
- legacy algoliasearch v4:
requires:
- build
- vue v3:
Expand Down Expand Up @@ -97,7 +100,8 @@ workflows:
- lint
- unit tests
- examples
- legacy algoliasearch
- legacy algoliasearch v3
- legacy algoliasearch v4
- helper docs
- e2e tests
filters:
Expand Down Expand Up @@ -202,7 +206,7 @@ jobs:
name: Type Checking
command: yarn run type-check

legacy algoliasearch:
legacy algoliasearch v3:
<<: *defaults
steps:
- checkout
Expand All @@ -221,6 +225,28 @@ jobs:
name: Type Checking
command: yarn run type-check:v3

legacy algoliasearch v4:
<<: *defaults
resource_class: large
steps:
- checkout
- *attach_workspace
- *install_yarn_version
- *restore_yarn_cache
- *run_yarn_install
- run:
name: Update dependencies
command: |
./scripts/legacy/downgrade-algoliasearch-v4.js
- run:
name: Unit & Integration tests
command: yarn run test:ci
- store_test_results:
path: junit/jest/
- run:
name: Type Checking
command: yarn run type-check

vue v3:
<<: *defaults
steps:
Expand Down
2 changes: 1 addition & 1 deletion examples/js/calendar-widget/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global moment Calendar $ */
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should provide this name as the export?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're doing any change, adding the default export would be very handy

import instantsearch from 'instantsearch.js';
import { connectRange } from 'instantsearch.js/es/connectors';
import { searchBox, hits } from 'instantsearch.js/es/widgets';
Expand Down
2 changes: 1 addition & 1 deletion examples/js/calendar-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"website:examples": "BABEL_ENV=parcel parcel build index.html --public-url . --dist-dir=../../../website/examples/js/calendar-widget"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce-umd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"browserslist": "firefox 68, chrome 78, IE 11",
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's 5.0.2 that fixes the highlight and snippet result recursive stuff

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an example so we can update separately of this pr

"instantsearch.js": "4.73.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce-umd/src/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';

import getRouting from './routing';
import {
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"browserslist": "firefox 68, chrome 78, IE 11",
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce/src/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';

import getRouting from './routing';
Expand Down
2 changes: 1 addition & 1 deletion examples/js/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint:fix": "npm run lint -- --fix"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.css": "8.4.0",
"instantsearch.js": "4.73.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/js/getting-started/products.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ <h1 class="header-title">
<div id="related-products"></div>
</div>

<script type="module" src="./src/products.js"></script>
<script type="module" src="./src/products.ts"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/js/getting-started/src/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import { carousel } from 'instantsearch.js/es/templates';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import { carousel } from 'instantsearch.js/es/templates';
import { configure, hits, relatedProducts } from 'instantsearch.js/es/widgets';
Expand All @@ -9,6 +9,10 @@ const searchParams = new URLSearchParams(document.location.search);

const pid = searchParams.get('pid');

if (!pid) {
throw new Error('No product ID provided');
}

const searchClient = algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
Expand Down
2 changes: 1 addition & 1 deletion examples/js/media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"website:examples": "BABEL_ENV=parcel parcel build index.html --public-url . --dist-dir=../../../website/examples/js/media"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"date-fns": "2.25.0",
"instantsearch.js": "4.73.4"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/js/media/src/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import { singleIndex } from 'instantsearch.js/es/lib/stateMappings';

Expand Down
2 changes: 1 addition & 1 deletion examples/js/tourism/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"website:examples": "BABEL_ENV=parcel parcel build index.html --public-url . --dist-dir=../../../website/examples/js/tourism"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/js/tourism/search.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import {
configure,
Expand Down
2 changes: 1 addition & 1 deletion examples/react/default-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "BABEL_ENV=parcel parcel index.html"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/default-theme/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import React from 'react';
import {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/e-commerce/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import React, { useRef } from 'react';
import {
Configure,
Expand Down
2 changes: 1 addition & 1 deletion examples/react/e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"browserslist": "firefox 68, chrome 78, IE 11",
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4",
"react": "18.2.0",
"react-compound-slider": "3.4.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "BABEL_ENV=parcel parcel index.html products.html --port 3000"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.js": "4.73.4",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/getting-started/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit } from 'instantsearch.js';
import React from 'react';
import {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/getting-started/src/Product.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { type Hit } from 'instantsearch.js';
import React from 'react';
import {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-app-router/app/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import React from 'react';
import {
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.css": "8.4.0",
"next": "13.5.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.css": "8.4.0",
"next": "13.5.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-routing/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import { GetServerSideProps } from 'next';
import Head from 'next/head';
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next-routing/pages/test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This is only to test `onStateChange` does not get called twice
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { GetServerSideProps } from 'next';
import Head from 'next/head';
import Link from 'next/link';
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"instantsearch.css": "8.4.0",
"next": "13.5.1",
"react": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/next/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import { GetServerSideProps } from 'next';
import Head from 'next/head';
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-native/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useRef } from 'react';
import { FlatList, SafeAreaView, StyleSheet, Text, View } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { InstantSearch } from 'react-instantsearch-core';

import { InfiniteHits } from './src/InfiniteHits';
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"eject": "expo eject"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"expo": "~44.0.0",
"expo-status-bar": "~1.2.0",
"instantsearch.js": "4.73.4",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/react-native/src/Highlight.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import { StyleSheet, Text } from 'react-native';
import { Hit as AlgoliaHit } from '@algolia/client-search';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import {
getHighlightedParts,
getPropertyByPath,
Expand All @@ -26,7 +26,7 @@ type HighlightProps<THit> = {
separator?: string;
};

export function Highlight<THit extends AlgoliaHit<Record<string, unknown>>>({
export function Highlight<THit extends AlgoliaHit>({
hit,
attribute,
separator = ', ',
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-native/src/InfiniteHits.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef } from 'react';
import { StyleSheet, View, FlatList } from 'react-native';
import { Hit as AlgoliaHit } from '@algolia/client-search';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import {
useInfiniteHits,
UseInfiniteHitsProps,
Expand Down
2 changes: 1 addition & 1 deletion examples/react/react-native/types/ProductHit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hit as AlgoliaHit } from '@algolia/client-search';
import { Hit as AlgoliaHit } from 'instantsearch.js';

export type ProductHit = AlgoliaHit<{
brand: string;
Expand Down
2 changes: 1 addition & 1 deletion examples/react/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"webpack-node-externals": "1.7.2"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"express": "4.17.1",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/ssr/src/searchClient.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';

export const searchClient = algoliasearch(
'latency',
Expand Down
4 changes: 2 additions & 2 deletions examples/react/ssr/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = [
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
exclude: /node_modules\/(?!(algoliasearch)\/).*/,
use: [
{
loader: 'babel-loader',
Expand All @@ -48,7 +48,7 @@ module.exports = [
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
exclude: /node_modules\/(?!(algoliasearch)\/).*/,
use: [
{
loader: 'babel-loader',
Expand Down
1 change: 1 addition & 0 deletions examples/vue/default-theme/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
presets: ['@vue/app'],
plugins: ['@babel/plugin-proposal-optional-chaining'],
sourceType: 'unambiguous',
};
2 changes: 1 addition & 1 deletion examples/vue/default-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"website:examples": "NODE_OPTIONS=--openssl-legacy-provider vue-cli-service build --dest ../../../website/examples/vue/default-theme"
},
"dependencies": {
"algoliasearch": "4.23.2",
"algoliasearch": "5.0.0",
"core-js": "2",
"instantsearch.js": "4.73.4",
"vue": "2.7.14",
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/default-theme/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
</template>

<script>
import algoliasearch from 'algoliasearch/lite';
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { history as historyRouter } from 'instantsearch.js/es/lib/routers';
import { simple as simpleMapping } from 'instantsearch.js/es/lib/stateMappings';

Expand Down
1 change: 1 addition & 0 deletions examples/vue/default-theme/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ module.exports = {
devServer: {
disableHostCheck: true,
},
transpileDependencies: ['algoliasearch'],
};
1 change: 1 addition & 0 deletions examples/vue/e-commerce/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
presets: ['@vue/app'],
plugins: ['@babel/plugin-proposal-optional-chaining'],
sourceType: 'unambiguous',
};
Loading