Skip to content

Commit f772d05

Browse files
committed
feat(moderation): support crisp tickets
1 parent 1bb32f8 commit f772d05

File tree

88 files changed

+1657
-461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1657
-461
lines changed

.env

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ API_AUTH_URL="http://localhost:6300"
1212
API_AUTH_USERNAME="________________________"
1313
CONSOLA_LEVEL="4"
1414
COOKIE_ENCRYPTION_KEY="password_at_least_32_characters_long"
15+
CRISP_BASE_URL="http://localhost:6400"
16+
CRISP_IDENTIFIER="________-____-____-____-____________"
17+
CRISP_KEY="________________________________________________________________"
18+
CRISP_PLUGIN_URN="urn:_______:______________:_"
19+
CRISP_USER_NICKNAME="______________"
20+
CRISP_WEBSITE_ID="________-____-____-____-____________"
1521
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/postgres?schema=public"
1622
ENTREPRISE_API_GOUV_TOKEN="____.____.____"
1723
ENTREPRISE_API_GOUV_URL="http://localhost:6200"
1824
HOST="https://hyyypertool-preprod.moncomptepro.beta.gouv.fr/proxy/localhost:3000"
1925
SENTRY_DNS="https://____@errors.data.gouv.fr/____"
26+
SYMMETRIC_ENCRYPTION_KEY="aTrueRandom32BytesLongBase64EncodedStringAA="
2027
ZAMMAD_TOKEN="____"
2128
ZAMMAD_URL="https://support.etalab.gouv.fr"
22-
23-
SYMMETRIC_ENCRYPTION_KEY="aTrueRandom32BytesLongBase64EncodedStringAA="

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
node_modules/
44

55
#
6+
.env.local
67
.env.*.local
78

89
# Generated style

bun.lockb

27.2 KB
Binary file not shown.

hyyypertool.code-workspace

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
{ "path": "packages/~/welcome", "name": "📦 welcome" },
2222
{ "path": "packages/~/proxy", "name": "📦 proxy" },
2323

24+
//
2425
//
2526

2627
{ "path": "packages/~/infra/moncomptepro", "name": "🏗️ moncomptepro" },
2728
{ "path": "packages/~/infra/zammad", "name": "🏗️ zammad" },
29+
{ "path": "packages/~/infra/crisp", "name": "🏗️ crisp" },
2830

2931
//
3032
{ "path": "packages/~/config", "name": "⚙️ config" },
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[
2+
{
3+
"httpRequest": {
4+
"method": "GET",
5+
"path": "/v1/website/{website_id}/conversation/{session_id}",
6+
"pathParameters": {
7+
"session_id": ["[A-Z0-9\\-\\_]+"],
8+
"website_id": ["[A-Z0-9\\-\\_]+"]
9+
}
10+
},
11+
"httpResponse": {
12+
"body": {
13+
"data": {
14+
"meta": {
15+
"subjet": "Lorem Ipsum"
16+
}
17+
}
18+
}
19+
}
20+
},
21+
{
22+
"httpRequest": {
23+
"method": "POST",
24+
"path": "/v1/website/{website_id}/conversation/{session_id}/message",
25+
"pathParameters": {
26+
"session_id": ["[A-Z0-9\\-\\_]+"],
27+
"website_id": ["[A-Z0-9\\-\\_]+"]
28+
}
29+
},
30+
"httpResponse": {
31+
"body": {
32+
"data": {
33+
"fingerprint": "123456789"
34+
}
35+
}
36+
}
37+
},
38+
{
39+
"httpRequest": {
40+
"method": "GET",
41+
"path": "/v1/website/{website_id}/conversation/{session_id}/messages",
42+
"pathParameters": {
43+
"session_id": ["[A-Z0-9\\-\\_]+"],
44+
"website_id": ["[A-Z0-9\\-\\_]+"]
45+
}
46+
},
47+
"httpResponse": {
48+
"body": {
49+
"data": [
50+
{
51+
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
52+
"type": "text",
53+
"timestamp": 1715097494011,
54+
"user": {
55+
"user_id": "123456789",
56+
"nickname": "John User"
57+
}
58+
}
59+
]
60+
}
61+
}
62+
},
63+
{
64+
"httpRequest": {
65+
"method": "GET",
66+
"path": "/v1/website/{website_id}/operators/list",
67+
"pathParameters": {
68+
"website_id": ["[A-Z0-9\\-\\_]+"]
69+
}
70+
},
71+
"httpResponse": {
72+
"body": {
73+
"data": [
74+
{
75+
"details": {
76+
"email": "user@yopmail.com",
77+
"firstname": "John",
78+
"lastname": "User",
79+
"user_id": "123456789"
80+
}
81+
}
82+
]
83+
}
84+
}
85+
},
86+
{
87+
"httpRequest": {
88+
"path": "/readyz"
89+
},
90+
"httpResponse": {
91+
"body": "readyz check passed",
92+
"reasonPhrase": "OK",
93+
"statusCode": 200
94+
}
95+
}
96+
]

mocks/docker-compose.mocks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
#
22

33
services:
4+
api.crisp.chat:
5+
image: mockserver/mockserver:5.15.0
6+
command: -proxyRemoteHost api.crisp.chat -proxyRemotePort 443
7+
environment:
8+
MOCKSERVER_LOG_LEVEL: DEBUG
9+
MOCKSERVER_INITIALIZATION_JSON_PATH: /config/mockserverInitialization.json
10+
volumes:
11+
- ./api.crisp.chat/mockserverInitialization.json:/config/mockserverInitialization.json
12+
ports:
13+
- 6400:1080
14+
415
auth.agentconnect.gouv.fr:
516
image: mockserver/mockserver:5.15.0
617
command: -proxyRemoteHost fca.integ01.dev-agentconnect.fr -proxyRemotePort 443

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"packages/~/auth/*",
99
"packages/~/config/*",
1010
"packages/~/infra/moncomptepro/*",
11+
"packages/~/infra/crisp/*",
1112
"packages/~/infra/zammad/*",
1213
"packages/~/moderations/*",
1314
"packages/~/organizations/*",
@@ -63,7 +64,7 @@
6364
"consola": "3.2.3",
6465
"dotenv": "16.4.5",
6566
"hono": "4.5.9",
66-
"tsx": "4.16.5"
67+
"tsx": "4.19.0"
6768
},
6869
"devDependencies": {
6970
"@csmith/release-it-calver-plugin": "2023.12.0",

packages/hono-slotify/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"outDir": "./node_modules/.cache/tsc",
77
"types": ["bun-types", "hono"]
88
},
9-
"extends": "@~/config.typescript/tsx.json",
9+
"extends": "@~/config.typescript/tsx/tsconfig.json",
1010
"references": []
1111
}

packages/~/app/api/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"jsxImportSource": "hono/jsx",
44
"outDir": "./node_modules/.cache/tsc"
55
},
6-
"extends": "@~/config.typescript/base.json",
6+
"extends": "@~/config.typescript/base/tsconfig.json",
77
"references": [
88
{ "path": "../../auth/api/tsconfig.json" },
99
{ "path": "../../infra/moncomptepro/database/tsconfig.json" },

packages/~/app/core/src/config/env.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import { z } from "zod";
99
//
1010

1111
dotenv.config({
12-
path: [`.env.${process.env.NODE_ENV}.local`, ".env.local", ".env"],
12+
path: [
13+
`.env.${process.env.NODE_ENV ?? "development"}.local`,
14+
".env.local",
15+
".env",
16+
],
1317
});
1418

1519
const pkg = await import(join(cwd(), "package.json"));
@@ -48,6 +52,12 @@ export const app_env = z.object({
4852
.string()
4953
.trim()
5054
.default("password_at_least_32_characters_long"),
55+
CRISP_BASE_URL: z.string().url().default("https://api.crisp.chat"),
56+
CRISP_IDENTIFIER: z.string().trim(),
57+
CRISP_KEY: z.string().trim(),
58+
CRISP_PLUGIN_URN: z.string().trim(),
59+
CRISP_USER_NICKNAME: z.string().trim(),
60+
CRISP_WEBSITE_ID: z.string().trim(),
5161
DATABASE_URL: z
5262
.string()
5363
.trim()

0 commit comments

Comments
 (0)