Skip to content

Commit 61654b1

Browse files
committed
feat: manage installation and autodraft
1 parent a829935 commit 61654b1

32 files changed

+1251
-136
lines changed

freshdesk-app/.report.json

Lines changed: 243 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,259 @@
11
{
2-
"lints": [],
3-
"coverage": {},
2+
"lints": [
3+
{
4+
"severity": 1,
5+
"value": "server/server.js::17: possible deprecated API usage detected",
6+
"type": "custom-js-lint"
7+
},
8+
{
9+
"severity": 1,
10+
"value": "server/server.js::18: possible deprecated API usage detected",
11+
"type": "custom-js-lint"
12+
}
13+
],
414
"coverageSummary": {
515
"lines": {
6-
"total": 0,
7-
"covered": 0,
16+
"total": 10,
17+
"covered": 10,
818
"skipped": 0,
9-
"pct": "Unknown"
19+
"pct": 100
1020
},
1121
"statements": {
12-
"total": 0,
13-
"covered": 0,
22+
"total": 10,
23+
"covered": 10,
1424
"skipped": 0,
15-
"pct": "Unknown"
25+
"pct": 100
1626
},
1727
"functions": {
18-
"total": 0,
19-
"covered": 0,
28+
"total": 2,
29+
"covered": 2,
2030
"skipped": 0,
21-
"pct": "Unknown"
31+
"pct": 100
2232
},
2333
"branches": {
24-
"total": 0,
25-
"covered": 0,
34+
"total": 2,
35+
"covered": 2,
2636
"skipped": 0,
27-
"pct": "Unknown"
37+
"pct": 100
38+
}
39+
},
40+
"coverage": {
41+
"server/server.js": {
42+
"path": "server/server.js",
43+
"statementMap": {
44+
"0": {
45+
"start": {
46+
"line": 1,
47+
"column": 0
48+
},
49+
"end": {
50+
"line": 25,
51+
"column": 1
52+
}
53+
},
54+
"1": {
55+
"start": {
56+
"line": 3,
57+
"column": 4
58+
},
59+
"end": {
60+
"line": 3,
61+
"column": 79
62+
}
63+
},
64+
"2": {
65+
"start": {
66+
"line": 4,
67+
"column": 4
68+
},
69+
"end": {
70+
"line": 19,
71+
"column": 5
72+
}
73+
},
74+
"3": {
75+
"start": {
76+
"line": 5,
77+
"column": 23
78+
},
79+
"end": {
80+
"line": 13,
81+
"column": 8
82+
}
83+
},
84+
"4": {
85+
"start": {
86+
"line": 14,
87+
"column": 6
88+
},
89+
"end": {
90+
"line": 14,
91+
"column": 72
92+
}
93+
},
94+
"5": {
95+
"start": {
96+
"line": 15,
97+
"column": 6
98+
},
99+
"end": {
100+
"line": 15,
101+
"column": 18
102+
}
103+
},
104+
"6": {
105+
"start": {
106+
"line": 17,
107+
"column": 6
108+
},
109+
"end": {
110+
"line": 17,
111+
"column": 65
112+
}
113+
},
114+
"7": {
115+
"start": {
116+
"line": 18,
117+
"column": 6
118+
},
119+
"end": {
120+
"line": 18,
121+
"column": 66
122+
}
123+
},
124+
"8": {
125+
"start": {
126+
"line": 22,
127+
"column": 4
128+
},
129+
"end": {
130+
"line": 22,
131+
"column": 73
132+
}
133+
},
134+
"9": {
135+
"start": {
136+
"line": 23,
137+
"column": 4
138+
},
139+
"end": {
140+
"line": 23,
141+
"column": 16
142+
}
143+
}
144+
},
145+
"fnMap": {
146+
"0": {
147+
"name": "(anonymous_0)",
148+
"decl": {
149+
"start": {
150+
"line": 2,
151+
"column": 23
152+
},
153+
"end": {
154+
"line": 2,
155+
"column": 24
156+
}
157+
},
158+
"loc": {
159+
"start": {
160+
"line": 2,
161+
"column": 48
162+
},
163+
"end": {
164+
"line": 20,
165+
"column": 3
166+
}
167+
},
168+
"line": 2
169+
},
170+
"1": {
171+
"name": "(anonymous_1)",
172+
"decl": {
173+
"start": {
174+
"line": 21,
175+
"column": 20
176+
},
177+
"end": {
178+
"line": 21,
179+
"column": 21
180+
}
181+
},
182+
"loc": {
183+
"start": {
184+
"line": 21,
185+
"column": 36
186+
},
187+
"end": {
188+
"line": 24,
189+
"column": 3
190+
}
191+
},
192+
"line": 21
193+
}
194+
},
195+
"branchMap": {
196+
"0": {
197+
"loc": {
198+
"start": {
199+
"line": 11,
200+
"column": 22
201+
},
202+
"end": {
203+
"line": 11,
204+
"column": 67
205+
}
206+
},
207+
"type": "binary-expr",
208+
"locations": [
209+
{
210+
"start": {
211+
"line": 11,
212+
"column": 22
213+
},
214+
"end": {
215+
"line": 11,
216+
"column": 60
217+
}
218+
},
219+
{
220+
"start": {
221+
"line": 11,
222+
"column": 64
223+
},
224+
"end": {
225+
"line": 11,
226+
"column": 67
227+
}
228+
}
229+
],
230+
"line": 11
231+
}
232+
},
233+
"s": {
234+
"0": 12,
235+
"1": 8,
236+
"2": 8,
237+
"3": 8,
238+
"4": 4,
239+
"5": 4,
240+
"6": 4,
241+
"7": 4,
242+
"8": 4,
243+
"9": 4
244+
},
245+
"f": {
246+
"0": 8,
247+
"1": 4
248+
},
249+
"b": {
250+
"0": [
251+
8,
252+
4
253+
]
254+
},
255+
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
256+
"hash": "f0f876a7f765003352d8ec10c8a2d36a92c632ee"
28257
}
29258
}
30259
}

freshdesk-app/__mocks__/freshworks-crayons-react.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ export function FwButton(props) {
77
</button>
88
)
99
}
10+
11+
export const FwTextarea = React.forwardRef(function FwTextarea(props, ref) {
12+
return <textarea {...props} ref={ref} onChange={() => {}} />
13+
})

freshdesk-app/config/iparams.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,23 @@
44
"type": "text",
55
"required": true,
66
"secure": true
7+
},
8+
"freshdeskApiKey": {
9+
"display_name": "Freshdesk API Key",
10+
"description": "Follow this tutorial to get your API key: https://support.freshdesk.com/support/solutions/articles/215517-how-to-find-your-api-key",
11+
"type": "text",
12+
"required": true,
13+
"secure": true
14+
},
15+
"email": {
16+
"display_name": "Email",
17+
"type": "text",
18+
"required": true
19+
},
20+
"historicalLookupWindow": {
21+
"display_name": "Historical lookup window in days (default: 180)",
22+
"description": "Defines how far back (in days) Quivr will retrieve historical tickets to use as context when generating responses.",
23+
"type": "number",
24+
"required": false
725
}
826
}

freshdesk-app/config/requests.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,30 @@
99
"Content-Type": "application/json"
1010
}
1111
}
12+
},
13+
"createHelpdeskAccount": {
14+
"schema": {
15+
"method": "POST",
16+
"host": "<%= app_settings.quivrApiUrl %>",
17+
"path": "/helpdesk-accounts",
18+
"headers": {
19+
"Authorization": "Bearer <%= iparam.quivrApiKey %>",
20+
"Content-Type": "application/json"
21+
}
22+
}
23+
},
24+
"getAutodraft": {
25+
"schema": {
26+
"method": "GET",
27+
"host": "<%= app_settings.quivrApiUrl %>",
28+
"path": "/helpdesk-accounts/autodraft",
29+
"headers": {
30+
"Authorization": "Bearer <%= iparam.quivrApiKey %>",
31+
"Content-Type": "application/json"
32+
},
33+
"query": {
34+
"helpdesk_ticket_id": "<%= context.ticket_id %>"
35+
}
36+
}
1237
}
1338
}

freshdesk-app/global.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
declare module "*.scss" {
2-
const content: { [className: string]: string };
3-
export default content;
1+
declare module '*.scss' {
2+
const content: { [className: string]: string }
3+
export default content
44
}
55

6-
declare module "*.css" {
7-
const content: { [className: string]: string };
8-
export default content;
6+
declare module '*.css' {
7+
const content: { [className: string]: string }
8+
export default content
99
}

freshdesk-app/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
setupFilesAfterEnv: ['<rootDir>/setUpTests.js'],
3+
testEnvironment: 'jsdom',
34
transform: { '^.+\\.[jt]sx?$': 'babel-jest' },
45
transformIgnorePatterns: [
56
'/node_modules/(?!(?:@freshworks/crayons)/)' // laissez Jest transpiler ce module

freshdesk-app/manifest.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
}
99
},
1010
"requests": {
11-
"getHelpdeskAccount": {}
11+
"getHelpdeskAccount": {},
12+
"createHelpdeskAccount": {},
13+
"getAutodraft": {}
1214
}
1315
},
1416
"support_ticket": {

freshdesk-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@babel/preset-typescript": "^7.27.1",
2121
"@testing-library/jest-dom": "^5.11.6",
2222
"@testing-library/react": "^11.1.0",
23+
"@testing-library/react-hooks": "^8.0.1",
2324
"@testing-library/user-event": "^12.1.10",
2425
"@types/node": "^24.1.0",
2526
"@types/react": "^17.0.1",

freshdesk-app/public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Quivr App</title>
7+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@freshworks/crayons@v4/css/crayons-min.css" />
78
</head>
89
<body>
910
<div class="" id="root"></div>

0 commit comments

Comments
 (0)