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

feat: rename packages to Recommend #33

Merged
merged 2 commits into from
Jun 10, 2021
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: 16 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ aliases:
mkdir -p packages/horizontal-slider-react/dist
mkdir -p packages/horizontal-slider-vdom/dist
mkdir -p packages/horizontal-slider-theme/dist
mkdir -p packages/recommendations-core/dist
mkdir -p packages/recommendations-js/dist
mkdir -p packages/recommendations-react/dist
mkdir -p packages/recommendations-vdom/dist
mkdir -p packages/recommend-core/dist
mkdir -p packages/recommend-js/dist
mkdir -p packages/recommend-react/dist
mkdir -p packages/recommend-vdom/dist

cp -R /tmp/workspace/packages/horizontal-slider-js/dist packages/horizontal-slider-js/
cp -R /tmp/workspace/packages/horizontal-slider-react/dist packages/horizontal-slider-react/
cp -R /tmp/workspace/packages/horizontal-slider-vdom/dist packages/horizontal-slider-vdom/
cp -R /tmp/workspace/packages/horizontal-slider-theme/dist packages/horizontal-slider-theme/
cp -R /tmp/workspace/packages/recommendations-core/dist packages/recommendations-core/
cp -R /tmp/workspace/packages/recommendations-js/dist packages/recommendations-js/
cp -R /tmp/workspace/packages/recommendations-react/dist packages/recommendations-react/
cp -R /tmp/workspace/packages/recommendations-vdom/dist packages/recommendations-vdom/
cp -R /tmp/workspace/packages/recommend-core/dist packages/recommend-core/
cp -R /tmp/workspace/packages/recommend-js/dist packages/recommend-js/
cp -R /tmp/workspace/packages/recommend-react/dist packages/recommend-react/
cp -R /tmp/workspace/packages/recommend-vdom/dist packages/recommend-vdom/

defaults: &defaults
working_directory: ~/ui-components
Expand Down Expand Up @@ -73,19 +73,19 @@ jobs:
mkdir -p /tmp/workspace/packages/horizontal-slider-react/dist
mkdir -p /tmp/workspace/packages/horizontal-slider-vdom/dist
mkdir -p /tmp/workspace/packages/horizontal-slider-theme/dist
mkdir -p /tmp/workspace/packages/recommendations-core/dist
mkdir -p /tmp/workspace/packages/recommendations-js/dist
mkdir -p /tmp/workspace/packages/recommendations-react/dist
mkdir -p /tmp/workspace/packages/recommendations-vdom/dist
mkdir -p /tmp/workspace/packages/recommend-core/dist
mkdir -p /tmp/workspace/packages/recommend-js/dist
mkdir -p /tmp/workspace/packages/recommend-react/dist
mkdir -p /tmp/workspace/packages/recommend-vdom/dist

cp -R packages/horizontal-slider-js/dist /tmp/workspace/packages/horizontal-slider-js
cp -R packages/horizontal-slider-react/dist /tmp/workspace/packages/horizontal-slider-react
cp -R packages/horizontal-slider-vdom/dist /tmp/workspace/packages/horizontal-slider-vdom
cp -R packages/horizontal-slider-theme/dist /tmp/workspace/packages/horizontal-slider-theme
cp -R packages/recommendations-core/dist /tmp/workspace/packages/recommendations-core
cp -R packages/recommendations-js/dist /tmp/workspace/packages/recommendations-js
cp -R packages/recommendations-react/dist /tmp/workspace/packages/recommendations-react
cp -R packages/recommendations-vdom/dist /tmp/workspace/packages/recommendations-vdom
cp -R packages/recommend-core/dist /tmp/workspace/packages/recommend-core
cp -R packages/recommend-js/dist /tmp/workspace/packages/recommend-js
cp -R packages/recommend-react/dist /tmp/workspace/packages/recommend-react
cp -R packages/recommend-vdom/dist /tmp/workspace/packages/recommend-vdom
- persist_to_workspace:
root: *workspace_root
paths:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

This is the repository packaging the UI components for Algolia Recommend.

> ⚠️ This branch is the experimental version of the UI components. **If you've been using the npm `beta` tag, make sure to [switch to the `experimental` tag](/packages/recommendations-react#installation)**.
> ⚠️ This branch is the experimental version of the UI components. **If you've been using the npm `beta` tag, make sure to [switch to the `experimental` tag](/packages/recommend-react#installation)**.

During the beta of Algolia Recommend, the UI components rely on an Algolia Index to retrieve the recommendations, and perform a regular Search API request to get the recommendations.

## Packages

- [`@algolia/recommendations-core`](/packages/recommendations-react): Core package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommendations-js`](/packages/recommendations-js): JavaScript package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommendations-react`](/packages/recommendations-react): React package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommendations-vdom`](/packages/recommendations-react): VDOM package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommend-core`](/packages/recommend-react): Core package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommend-js`](/packages/recommend-js): JavaScript package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommend-react`](/packages/recommend-react): React package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/recommend-vdom`](/packages/recommend-react): VDOM package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/)
- [`@algolia/ui-components-horizontal-slider-js`](/packages/horizontal-slider-js): JavaScript horizontal slider UI component
- [`@algolia/ui-components-horizontal-slider-react`](/packages/horizontal-slider-react): React horizontal slider UI component
- [`@algolia/ui-components-horizontal-slider-theme`](/packages/horizontal-slider-theme): Horizontal slider UI component theme
Expand Down
8 changes: 4 additions & 4 deletions bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"maxSize": "1.75 kB"
},
{
"path": "packages/recommendations-core/dist/umd/index.js",
"path": "packages/recommend-core/dist/umd/index.js",
"maxSize": "2.25 kB"
},
{
"path": "packages/recommendations-js/dist/umd/index.js",
"path": "packages/recommend-js/dist/umd/index.js",
"maxSize": "7.25 kB"
},
{
"path": "packages/recommendations-react/dist/umd/index.js",
"path": "packages/recommend-react/dist/umd/index.js",
"maxSize": "3.25 kB"
},
{
"path": "packages/recommendations-vdom/dist/umd/index.js",
"path": "packages/recommend-vdom/dist/umd/index.js",
"maxSize": "1.50 kB"
}
]
Expand Down
2 changes: 1 addition & 1 deletion examples/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />

<title>Algolia Recommendations</title>
<title>Algolia Recommend</title>
</head>

<body>
Expand Down
6 changes: 3 additions & 3 deletions examples/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algolia/recommendations-react-example",
"description": "Recommendations React example",
"name": "@algolia/recommend-react-example",
"description": "Recommend React example",
"version": "1.0.0-experimental.2",
"private": true,
"license": "MIT",
Expand All @@ -11,7 +11,7 @@
"dependencies": {
"@algolia/autocomplete-js": "1.1.0",
"@algolia/autocomplete-theme-classic": "1.1.0",
"@algolia/recommendations-react": "1.0.0-experimental.2",
"@algolia/recommend-react": "1.0.0-experimental.2",
"@algolia/ui-components-horizontal-slider-react": "1.0.0-experimental.2",
"@algolia/ui-components-horizontal-slider-theme": "1.0.0-experimental.2",
"algoliasearch": "4.9.1",
Expand Down
6 changes: 3 additions & 3 deletions examples/demo/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
FrequentlyBoughtTogether,
RelatedProducts,
} from '@algolia/recommendations-react';
} from '@algolia/recommend-react';
import { HorizontalSlider } from '@algolia/ui-components-horizontal-slider-react';
import algoliasearch from 'algoliasearch';
import React, { Fragment, useState } from 'react';
Expand All @@ -15,7 +15,7 @@ import { Hit } from './Hit';

import '@algolia/ui-components-horizontal-slider-theme';
import './App.css';
import './Recommendations.css';
import './Recommend.css';

const appId = 'HYDY1KWTWB';
const apiKey = '28cf6d38411215e2eef188e635216508';
Expand Down Expand Up @@ -58,7 +58,7 @@ function App() {

return (
<div className="container">
<h1>Algolia Recommendations</h1>
<h1>Algolia Recommend</h1>

<Autocomplete
placeholder="Search for a product"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--auc-dark-color: #0f0f0f;
}

.auc-Recommendations-list {
.auc-Recommend-list {
display: grid;
gap: 0.5rem;
list-style: none;
Expand All @@ -14,12 +14,12 @@
padding: 0;
}

.auc-Recommendations-list {
.auc-Recommend-list {
grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 999px) {
.auc-Recommendations-list {
.auc-Recommend-list {
grid-template-columns: repeat(5, 1fr);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
--auc-dark-color: #0f0f0f;
}

.auc-Recommendations-list {
.auc-Recommend-list {
display: grid;
gap: 0.5rem;
list-style: none;
Expand All @@ -14,12 +14,12 @@
padding: 0;
}

.auc-Recommendations-list {
.auc-Recommend-list {
grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 999px) {
.auc-Recommendations-list {
.auc-Recommend-list {
grid-template-columns: repeat(5, 1fr);
}
}
2 changes: 1 addition & 1 deletion examples/js-demo/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { autocomplete, getAlgoliaResults } from '@algolia/autocomplete-js';
import {
frequentlyBoughtTogether,
relatedProducts,
} from '@algolia/recommendations-js';
} from '@algolia/recommend-js';
import { horizontalSlider } from '@algolia/ui-components-horizontal-slider-js';
import algoliasearch from 'algoliasearch';
import { h, render } from 'preact';
Expand Down
6 changes: 3 additions & 3 deletions examples/js-demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

<link rel="shortcut icon" href="favicon.png" type="image/x-icon" />
<link rel="stylesheet" href="App.css" />
<link rel="stylesheet" href="Recommendations.css" />
<link rel="stylesheet" href="Recommend.css" />

<title>Algolia JavaScript Recommendations</title>
<title>Algolia JavaScript Recommend</title>
</head>

<body>
<div class="container">
<h1>Algolia Recommendations</h1>
<h1>Algolia Recommend</h1>

<div id="autocomplete"></div>

Expand Down
6 changes: 3 additions & 3 deletions examples/js-demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@algolia/recommendations-js-example",
"description": "Recommendations JavaScript example",
"name": "@algolia/recommend-js-example",
"description": "Recommend JavaScript example",
"version": "1.0.0-experimental.2",
"private": true,
"license": "MIT",
Expand All @@ -11,7 +11,7 @@
"dependencies": {
"@algolia/autocomplete-js": "1.1.0",
"@algolia/autocomplete-theme-classic": "1.1.0",
"@algolia/recommendations-js": "1.0.0-experimental.2",
"@algolia/recommend-js": "1.0.0-experimental.2",
"@algolia/ui-components-horizontal-slider-js": "1.0.0-experimental.2",
"@algolia/ui-components-horizontal-slider-theme": "1.0.0-experimental.2",
"algoliasearch": "4.9.1",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"build": "lerna run build --no-private",
"format": "prettier --write .",
"lint": "eslint --ext .js,.ts,.tsx .",
"playground-js:start": "yarn workspace @algolia/recommendations-js-example start",
"playground:start": "yarn workspace @algolia/recommendations-react-example start",
"playground-js:start": "yarn workspace @algolia/recommend-js-example start",
"playground:start": "yarn workspace @algolia/recommend-react-example start",
"prepare": "lerna run prepare --no-private",
"release": "shipjs prepare",
"test:size": "bundlesize",
Expand Down
2 changes: 1 addition & 1 deletion packages/horizontal-slider-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function App() {

### With recommendations

See usage for [Recommendations](/packages/recommendations-react#horizontal-slider-view).
See usage for [Recommend](/packages/recommend-react#horizontal-slider-view).

## Props

Expand Down
11 changes: 11 additions & 0 deletions packages/recommend-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `@algolia/recommend-core`

Core package for [Algolia Recommend](https://www.algolia.com/doc/guides/algolia-ai/recommend/).

## Installation

```sh
yarn add @algolia/recommend-core@experimental
# or
npm install @algolia/recommend-core@experimental
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@algolia/recommendations-core",
"name": "@algolia/recommend-core",
"version": "1.0.0-experimental.2",
"license": "MIT",
"homepage": "https://github.com/algolia/ui-components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { SearchClient } from 'algoliasearch';

import {
ProductRecord,
RecommendationModel,
RecommendationRecord,
RecommendModel,
RecommendRecord,
RecordWithObjectID,
} from './types';
import {
Expand All @@ -16,12 +16,12 @@ import {
} from './utils';
import { version } from './version';

type RecommendRecord = RecordWithObjectID<{
recommendations?: RecommendationRecord[];
type RecommendedRecord = RecordWithObjectID<{
recommendations?: RecommendRecord[];
}>;

export type GetRecommendationsProps<TObject> = {
model: RecommendationModel;
model: RecommendModel;
indexName: string;
objectIDs: string[];
searchClient: SearchClient;
Expand Down Expand Up @@ -74,11 +74,11 @@ export function getRecommendations<TObject>(
): Promise<GetRecommendationsResult<TObject>> {
const props = getDefaultedProps(userProps);

props.searchClient.addAlgoliaAgent('recommendations-core', version);
props.searchClient.addAlgoliaAgent('recommend-core', version);

return props.searchClient
.initIndex(getIndexNameFromModel(props.model, props.indexName))
.getObjects<RecommendRecord>(props.objectIDs)
.getObjects<RecommendedRecord>(props.objectIDs)
.then((response) => {
const recommendationsList = response.results.map(
(result) => result?.recommendations ?? []
Expand Down
1 change: 1 addition & 0 deletions packages/recommend-core/src/types/RecommendModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type RecommendModel = 'bought-together' | 'related-products';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type RecommendationRecord = {
export type RecommendRecord = {
objectID: string;
score: number;
};
4 changes: 4 additions & 0 deletions packages/recommend-core/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './ProductRecord';
export * from './RecommendModel';
export * from './RecommendRecord';
export * from './RecordWithObjectID';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RecommendationModel } from '../types';
import { RecommendModel } from '../types';

export function getIndexNameFromModel(
model: RecommendationModel,
model: RecommendModel,
indexName: string
) {
switch (model) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { SearchOptions } from '@algolia/client-search';

import { GetRecommendationsInternalProps } from '../getRecommendations';
import { RecommendationModel, RecommendationRecord } from '../types';
import { RecommendModel, RecommendRecord } from '../types';

type GetSearchParametersParams<TObject> = {
fallbackFilters: GetRecommendationsInternalProps<TObject>['fallbackFilters'];
recommendations: RecommendationRecord[];
recommendations: RecommendRecord[];
threshold: GetRecommendationsInternalProps<TObject>['threshold'];
};

Expand Down Expand Up @@ -68,7 +68,7 @@ function getSearchParametersForFrequentlyBoughtTogether<TObject>({
export function getSearchParametersForModel<TObject>(
params: GetSearchParametersParams<TObject>
) {
return (model: RecommendationModel) => {
return (model: RecommendModel) => {
switch (model) {
case 'bought-together':
return getSearchParametersForFrequentlyBoughtTogether(params);
Expand Down
Loading