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

Enable specifying custom Recombee region (also updates a lot of packages and rewrites to Vite) #10

Merged
merged 5 commits into from
Apr 29, 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
24 changes: 24 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"@kontent-ai",
"@kontent-ai/eslint-config/react",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: [
"tsconfig.json",
"tsconfig.node.json",
"src/functions/tsconfig.json",
],
},
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- uses: dprint/[email protected]
- run: npm run lint

Choose a reason for hiding this comment

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

where format :/

Copy link
Member Author

Choose a reason for hiding this comment

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

The step above dprint/[email protected] checks formatting.

- run: npm run build
- run: npm run lintFunctions
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
/dist
/dist-ssr
/functions

# local env files
Expand All @@ -20,9 +21,6 @@ yarn-error.log*
*.sln
*.sw?

# production
/build

# dependencies
/node_modules
/.pnp
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ To run this integration, you'll need a Kontent.ai project + a [Recombee account]

You can include multiple Kontent.ai types and languages the webhook will be looking out for and synchronizing - to do so, just include them as a comma-separated list.

Subsequently, set the Kontent.ai **Delivery API triggers** to watch for _Publish_ and _Unpublish_ of your content items.
![webhook-setup](docs/webhook.jpg)

At the end, this is an example of how your webhook might look like:
Subsequently, set the `Triggers` to `published data`. Then choose `Specific events` and select only `Content item` events. (You can also unselect `Content item metadata changed` events as they won't affect the resulting data in the index.)

![webhook-setup](docs/webhook.png)
The resulting triggers setup should look like this:

Save the webhook and copy the generated **secret** as it would be required as a parameter in the following step.
![webhook-triggers-setup](docs/webhook-triggers.jpg)

Save the webhook and copy the generated **secret** as it will be required as a parameter in the following step.

4. ### Configure your Netlify functions

Expand Down Expand Up @@ -160,7 +162,7 @@ $ npm install
$ netlify dev
```

The custom element is created with [Create React App](https://create-react-app.dev/).
The custom element is created with [Vite](https://vitejs.dev/).

Choose a reason for hiding this comment

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

let's chage the screenshot for new webhooks 💪


## Contributors

Expand Down
Binary file added docs/webhook-triggers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/webhook.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/webhook.png
Binary file not shown.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Recombee Initializer for Kontent.ai</title>
<!-- kontent.ai styling -->
<link rel="stylesheet" type="text/css" href="/kontent-ai-app-styles.css">
<!-- kontent.ai custom elements api-->
<script src="https://app.kontent.ai/js-api/custom-element/v1/custom-element.min.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build]
base = "/"
publish = "/build"
publish = "/dist"
command = "npm run build"
functions = "src/functions"
Loading