Skip to content

Commit f3794a0

Browse files
committed
Support Recommend Items to Item Segment endpoint. Use webpack for building.
1 parent e4e8815 commit f3794a0

29 files changed

+2089
-1406
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env"]
3+
}

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The library is [UMD](https://github.com/umdjs/umd) compatible.
1515
You can download [recombee-api-client.min.js](./dist/recombee-api-client.min.js) and host it at your site, or use a CDN such as [jsDelivr](https://www.jsdelivr.com/) CDN:
1616

1717
```js
18-
<script src="https://cdn.jsdelivr.net/gh/recombee/js-api-client@4.1.5/dist/recombee-api-client.min.js"></script>
18+
<script src="https://cdn.jsdelivr.net/gh/recombee/js-api-client@5.0.0/dist/recombee-api-client.min.js"></script>
1919
```
2020

2121
and use the global `recombee` object.
@@ -47,18 +47,18 @@ If you're using TypeScript, it should recognize these correctly and warn you abo
4747

4848
This library allows you to request recommendations and send interactions between users and items (views, bookmarks, purchases ...) to Recombee. It uses the **public token** for authentication.
4949

50-
It is intentionally not possible to change item catalog (properties of items) with public token, so you should use one of the following ways to send it to Recombee:
50+
It is intentionally not possible to change the item catalog (properties of items) with the public token, so you should use one of the following ways to send it to Recombee:
5151

52-
- Use one of the server-side SDKs (Node.js, PHP, Java...). The synchronization can done for example by a peridodically ran script. See [this section](https://docs.recombee.com/gettingstarted.html#managing-item-catalog) for more details.
53-
- Set a product feed at [Recombee web admin](https://admin.recombee.com/).
52+
- Use one of the server-side SDKs (Node.js, PHP, Java...). The synchronization can done for example by a peridodically run script. See [this section](https://docs.recombee.com/gettingstarted.html#managing-item-catalog) for more details.
53+
- Set a catalog feed at [Recombee web admin](https://admin.recombee.com/).
5454

5555
### Sending interactions
5656

5757
```javascript
5858
// Initialize client with name of your database and PUBLIC token
5959
const client = new recombee.ApiClient('name-of-your-db', '...db-public-token...', {region: 'us-west'});
6060

61-
//Interactions take Id of user and Id of item
61+
// Interactions take the ID of the user and the ID of the item
6262
client.send(new recombee.AddBookmark('user-13434', 'item-256'));
6363
client.send(new recombee.AddCartAddition('user-4395', 'item-129'));
6464
client.send(new recombee.AddDetailView('user-9318', 'item-108'));
@@ -69,9 +69,9 @@ client.send(new recombee.SetViewPortion('user-4289', 'item-487', 0.3));
6969

7070
### Requesting recommendations
7171

72-
You can [recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user) or [recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item).
72+
You can [recommend items to user](https://docs.recombee.com/api.html#recommend-items-to-user), [recommend items to item](https://docs.recombee.com/api.html#recommend-items-to-item) or even [recommend Item Segments](https://docs.recombee.com/api#recommend-item-segments-to-user) such as categories, genres or artists.
7373

74-
It is possible to use callbacks or Promises.
74+
It is possible to use Promises or callbacks.
7575

7676
#### Promise
7777

@@ -145,7 +145,7 @@ client.send(new recombee.SearchItems("user-13434", searchQuery, 5), callback);
145145

146146
### Recommend Next Items
147147

148-
Recombee can return items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (infinite scroll) or goes to a next page. See [Recommend next items](https://docs.recombee.com/api.html#recommend-next-items) for more info.
148+
Recombee can return items that shall be shown to a user as next recommendations when the user e.g. scrolls the page down (infinite scroll) or goes to the next page. See [Recommend next items](https://docs.recombee.com/api.html#recommend-next-items) for more info.
149149

150150
```javascript
151151
const initialRecomms = await client.send(
@@ -209,7 +209,7 @@ Let's assume we want to show recommendations at product page of pants `product-2
209209
</div>
210210
</div>
211211

212-
<script src="https://cdn.jsdelivr.net/gh/recombee/js-api-client@4.1.5/dist/recombee-api-client.min.js"></script>
212+
<script src="https://cdn.jsdelivr.net/gh/recombee/js-api-client@5.0.0/dist/recombee-api-client.min.js"></script>
213213

214214
<script type="text/javascript">
215215

dist/recombee-api-client.js

Lines changed: 1659 additions & 1189 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/recombee-api-client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/recombee-api-client.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/recombee-api-client.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import globals from "globals";
2+
import tseslint from "typescript-eslint";
3+
4+
5+
/** @type {import('eslint').Linter.Config[]} */
6+
export default [
7+
{files: ["**/*.{js,mjs,cjs,ts}"]},
8+
{languageOptions: { globals: globals.browser }},
9+
...tseslint.configs.recommended,
10+
];

examples/product_img.svg

Lines changed: 1 addition & 1 deletion
Loading

examples/related_products.png

1 Byte
Loading

package.json

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "recombee-js-api-client",
3-
"version": "4.1.5",
3+
"version": "5.0.0",
44
"description": "Client-side js library for easy use of the Recombee recommendation API",
55
"main": "./src/index.js",
66
"browser": "./src/index.js",
@@ -25,19 +25,23 @@
2525
},
2626
"homepage": "https://github.com/Recombee/js-api-client#readme",
2727
"dependencies": {
28-
"jssha": "^2.3.1"
28+
"jssha": "^3.3.1"
2929
},
3030
"devDependencies": {
31-
"@neutrinojs/fork": "^8.3.0",
32-
"@neutrinojs/library": "^8.3.0",
33-
"neutrino": "^8.3.0",
34-
"qunit": "^2.7.0",
35-
"webpack": "^3.12.0",
36-
"webpack-node-externals": "^1.7.2",
37-
"webpack-sources": "1.0.1"
31+
"@babel/core": "^7.26.0",
32+
"@babel/preset-env": "^7.26.0",
33+
"babel-loader": "^9.2.1",
34+
"eslint": "^9.15.0",
35+
"globals": "^15.12.0",
36+
"qunit": "^2.22.0",
37+
"typescript-eslint": "^8.16.0",
38+
"webpack": "^5.96.1",
39+
"webpack-cli": "^5.1.4",
40+
"webpack-node-externals": "^3.0.0",
41+
"webpack-sources": "3.2.3"
3842
},
3943
"scripts": {
40-
"build": "neutrino build",
41-
"lint": "neutrino lint"
44+
"build": "webpack",
45+
"lint": "eslint ."
4246
}
4347
}

0 commit comments

Comments
 (0)