Skip to content

Commit 528fee4

Browse files
committed
Rename folder to reo
1 parent b95d216 commit 528fee4

File tree

9 files changed

+122
-0
lines changed

9 files changed

+122
-0
lines changed

integrations/reo/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@gitbook/eslint-config/integration"]
3+
}

integrations/reo/assets/icon.png

7.76 KB
Loading

integrations/reo/assets/preview.png

328 KB
Loading
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: reodotdev
2+
title: Reodotdev
3+
icon: ./assets/icon.png
4+
previewImages:
5+
- ./assets/preview.png
6+
description: Plug your GitBook site to your Reo.dev installation.
7+
externalLinks:
8+
- label: Documentation
9+
url: https://www.gitbook.com/integrations/reodotdev
10+
visibility: public
11+
script: ./src/index.ts
12+
# The following scope(s) are available only to GitBook Staff
13+
# See https://developer.gitbook.com/integrations/configurations#scopes
14+
scopes:
15+
- space:script:inject
16+
organization: d8f63b60-89ae-11e7-8574-5927d48c4877
17+
contentSecurityPolicy:
18+
script-src: static.reo.dev;
19+
summary: |
20+
# Overview
21+
Reo.Dev is the Business to Developer (B2D) ABM platform that helps you find revenue opportunity from developer activity.
22+
This integration lets you add the Reo.Dev Javascript on your published GitBook site to seamlessly analyze developer intent through any interactions with your content on GitBook.
23+
24+
# How it works
25+
The integration injects the Reodotdev script on your page, using the configured client ID,
26+
so that you can get analytics information from your GitBook site directly inside of Reo.
27+
28+
# Configure
29+
Install the integration on the GitBook space of your choice.
30+
Locate the Reodotdev's client ID you want to use, which is available in Reodotdev's Integration -> Documentation section
31+
32+
categories:
33+
- analytics
34+
configurations:
35+
space:
36+
properties:
37+
tracking_id:
38+
type: string
39+
title: Client ID
40+
description: Available in Reodotdev's Integration -> Documentation section
41+
required:
42+
- tracking_id

integrations/reo/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@gitbook/integration-reo.dev",
3+
"version": "0.0.1",
4+
"private": true,
5+
"dependencies": {
6+
"@gitbook/api": "*",
7+
"@gitbook/runtime": "*"
8+
},
9+
"devDependencies": {
10+
"@gitbook/cli": "*"
11+
},
12+
"scripts": {
13+
"lint": "eslint ./src/**/*.ts",
14+
"typecheck": "tsc --noEmit",
15+
"publish-integrations-staging": "gitbook publish .",
16+
"publish-integrations": "gitbook publish ."
17+
}
18+
}

integrations/reo/src/index.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {
2+
createIntegration,
3+
FetchPublishScriptEventCallback,
4+
RuntimeContext,
5+
RuntimeEnvironment,
6+
} from '@gitbook/runtime';
7+
8+
import script from './script.raw.js';
9+
10+
type ReoDotDevRuntimeContext = RuntimeContext<
11+
RuntimeEnvironment<
12+
{},
13+
{
14+
tracking_id?: string;
15+
}
16+
>
17+
>;
18+
19+
export const handleFetchEvent: FetchPublishScriptEventCallback = async (
20+
event,
21+
{ environment }: ReoDotDevRuntimeContext
22+
) => {
23+
const trackingId = environment.spaceInstallation.configuration.tracking_id;
24+
if (!trackingId) {
25+
throw new Error(
26+
`The Reo.Dev tracking ID is missing from the configuration (ID: ${event.spaceId}).`
27+
);
28+
}
29+
30+
return new Response(script.replace('<TO_REPLACE>', trackingId), {
31+
headers: {
32+
'Content-Type': 'application/javascript',
33+
'Cache-Control': 'max-age=604800',
34+
},
35+
});
36+
};
37+
38+
export default createIntegration<ReoDotDevRuntimeContext>({
39+
fetch_published_script: handleFetchEvent,
40+
});

integrations/reo/src/script.raw.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const trackingID = '<TO_REPLACE>';
2+
3+
(function (r, e, o) {
4+
var t, c, n;
5+
c = { clientID: trackingID };
6+
t = function () {
7+
Reo.init(c);
8+
};
9+
n = e.createElement("script");
10+
n.src = o + c.clientID + '/reo.js';
11+
n.async = !0;
12+
n.onload = t;
13+
14+
e.head.appendChild(n);
15+
})(window, document, "https://static.reo.dev/");

integrations/reo/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@gitbook/tsconfig/integration.json"
3+
}

package-lock.json

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

0 commit comments

Comments
 (0)