Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit e5f7724

Browse files
committed
fix: issue #562
1 parent fffd587 commit e5f7724

File tree

2 files changed

+165
-7
lines changed

2 files changed

+165
-7
lines changed

src/server/misc/routes/index.html

+139
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title></title>
6+
<style>
7+
.top-bar {
8+
margin-top: 100px;
9+
display: flex;
10+
flex-direction: row;
11+
align-items: center;
12+
justify-content: space-between;
13+
min-width: 600px;
14+
width: 100%;
15+
}
16+
.top-bar h1 {
17+
margin: 0;
18+
font-weight: 500;
19+
height: 90px;
20+
display: flex;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: 2em;
24+
flex-shrink: 0;
25+
flex: 1 1;
26+
}
27+
.shadowed-content {
28+
margin: auto;
29+
width: 100%;
30+
max-width: 900px;
31+
box-sizing: border-box;
32+
text-align: left;
33+
border: 1px solid transparent;
34+
border-radius: 6px;
35+
box-shadow: none;
36+
position: relative;
37+
border: 1px solid #d6d6d6;
38+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
39+
}
40+
41+
.slot-cancelview {
42+
display: flex;
43+
flex-direction: row;
44+
position: relative;
45+
box-sizing: border-box;
46+
align-items: center;
47+
z-index: 200;
48+
background: #fff;
49+
border-radius: 6px;
50+
height: 420px;
51+
width: 100%;
52+
}
53+
.slot-cancelview h2 {
54+
font-size: 20px;
55+
line-height: 30px;
56+
font-weight: 450;
57+
}
58+
59+
.slot-cancelview h4 {
60+
font-size: 12px;
61+
line-height: 17px;
62+
font-weight: 500;
63+
margin: 10px;
64+
}
65+
.left-panel {
66+
margin-top: 40px;
67+
display: flex;
68+
align-items: center;
69+
justify-content:center;
70+
padding-bottom: 70px ;
71+
flex: 1 1;
72+
}
73+
74+
.left-panel p{
75+
opacity: 0.6;
76+
}
77+
.booking-summary {
78+
text-align: center;
79+
}
80+
81+
.divider {
82+
align-self: stretch;
83+
width: 1px ;
84+
flex-grow: 0;
85+
border-left: 1px solid #eee;
86+
margin-top: 20px;
87+
margin-bottom: 20px;
88+
}
89+
90+
.right-panel {
91+
box-sizing: border-box;
92+
flex: 1.4 1;
93+
display: flex;
94+
justify-content: center;
95+
align-items: center;
96+
flex-direction: column;
97+
}
98+
.right-panel form {
99+
padding: 30px 70px 0;
100+
}
101+
.right-panel form h3 {
102+
margin-bottom: 15px;
103+
font-size: 1.17em;
104+
font-weight: bold;
105+
}
106+
.right-panel form button {
107+
margin: 20px auto;
108+
}
109+
</style>
110+
</head>
111+
<body>
112+
<div class="top-bar">
113+
<h1><%= jobTitle %></h1>
114+
</div>
115+
<div class="shadowed-content">
116+
<div class="slot-cancelview">
117+
<div class="left-panel">
118+
<div class="booking-summary">
119+
<h2>
120+
<%= week %><br />
121+
<%= startDate %>
122+
</h2>
123+
<h4>
124+
<%= startTime %> - <%= endTime %>
125+
</h4>
126+
<h4><%= page_slug %></h4>
127+
<h4>virtual calendar</h4>
128+
<p><%= tz %></p>
129+
</div>
130+
</div>
131+
<div class="divider"></div>
132+
<div class="right-panel">
133+
<h3>You're all set.</h3>
134+
<div class="label">Your response has been recorded</div>
135+
</div>
136+
</div>
137+
</div>
138+
</body>
139+
</html>

src/server/misc/routes/interview-thank-you-page.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,46 @@
22
* Custom Interview Thank You Page
33
*/
44
const url = require("url");
5+
const axios = require("axios");
6+
const _ = require("lodash");
7+
const moment = require("moment");
8+
const fs = require("fs");
9+
10+
// eslint-disable-next-line
11+
const content = fs.readFileSync(__dirname + "/index.html");
12+
513
/**
614
* Render custom HTML thank you page for scheduled or rescheduled interview.
715
*
816
* @param {import("express").Request} req express request
917
* @param {import("express").Response} res express response
1018
*/
11-
function getInterviewThankYouPageController(req, res) {
19+
async function getInterviewThankYouPageController(req, res) {
1220
const query = req.query;
1321
const fullURL = url.format({
1422
protocol: req.protocol,
1523
host: req.get("host"),
1624
pathname: req.originalUrl,
1725
});
26+
const { data: nylasHtml } = await axios.get(
27+
`https://schedule.nylas.com/${query.page_slug}`
28+
);
29+
// extract json object from html file
30+
const nylasconfig = JSON.parse(
31+
nylasHtml.match(/window.nylasWindowContext.page = (.*);<\/script>/)[1]
32+
);
33+
const object = {
34+
jobTitle: nylasconfig.name,
35+
page_slug: query.page_slug,
36+
tz: query.tz,
37+
week: moment.unix(query.start_time).format("dddd"),
38+
startDate: moment.unix(query.start_time).format("MMMM DD, yyyy"),
39+
startTime: moment.unix(query.start_time).format("H:mm A"),
40+
endTime: moment.unix(query.end_time).format("H:mm A"),
41+
};
1842

1943
res.set("Content-Type", "text/html");
20-
res.send(
21-
`<h1>Thank you page (under construction)</h1>
22-
<pre>
23-
URL: ${fullURL}
24-
query: ${JSON.stringify(query, null, 2)}</pre>`
25-
);
44+
res.send(_.template(content)(object));
2645
}
2746

2847
module.exports = getInterviewThankYouPageController;

0 commit comments

Comments
 (0)