Skip to content

Commit 417a996

Browse files
authored
Merge pull request #630 from bluewave-labs/develop
Develop
2 parents 2cf9d19 + 4e73c94 commit 417a996

File tree

6 files changed

+177
-51
lines changed

6 files changed

+177
-51
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ After setting up the project, copy and paste the script that can be found in the
251251

252252
```
253253
window.bwApiBaseUrl = 'https://guidefox-demo.bluewavelabs.ca/api/';
254-
window.bwAgentBaseUrl = 'https://cdn.jsdelivr.net/gh/bluewave-labs/bluewave-onboarding@agent-1.1.4/jsAgent/';
254+
window.bwAgentBaseUrl = 'https://cdn.jsdelivr.net/gh/bluewave-labs/bluewave-onboarding@agent-1.1.5/jsAgent/';
255255
256256
var s=document.createElement("script");
257257
s.type="text/javascript";

backend/seeders/20240610054534-demo-users.js

Lines changed: 0 additions & 48 deletions
This file was deleted.

backend/seeders/seeders.js

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
const constants = require("../src/utils/constants.helper");
2+
const userRole = constants.ROLE;
3+
4+
async function runSeeders(queryInterface) {
5+
const hashedPassword = "$2a$10$vJk551TfHzR8WpiqKlaFe.L8ORsoOPQnwAt0mVzPLpyjdpZNFSM2a"; // Bluewave@1234!
6+
7+
await queryInterface.bulkInsert(
8+
"users",
9+
[
10+
{
11+
name: "Demo",
12+
surname: "User",
13+
email: "bluewaveguidefox@gmail.com",
14+
password: hashedPassword,
15+
role: userRole.ADMIN,
16+
createdAt: new Date(),
17+
},
18+
],
19+
{}
20+
);
21+
22+
await queryInterface.bulkInsert(
23+
'hints',
24+
[
25+
{
26+
action: 'open url',
27+
url: 'https://guidefox-demo.bluewavelabs.ca',
28+
actionButtonUrl: 'https://guidefox.io/',
29+
actionButtonText: 'Take me to GuideFox page',
30+
targetElement: '._text_ophip_12',
31+
tooltipPlacement: 'right',
32+
hintContent:
33+
'Guidefox helps app owners build knowledge and user-experience oriented apps. It includes the following features: welcome tours, popups, banners, helper links, hints',
34+
header: 'GuideFox Intro',
35+
headerBackgroundColor: '#FFFFFF',
36+
headerColor: '#101828',
37+
textColor: '#101828',
38+
buttonBackgroundColor: '#7F56D9',
39+
buttonTextColor: '#FFFFFF',
40+
createdBy: 1,
41+
repetitionType: 'show only once',
42+
isHintIconVisible: true
43+
},
44+
],
45+
{}
46+
);
47+
48+
await queryInterface.bulkInsert(
49+
"popups",
50+
[
51+
{
52+
popupSize: "small",
53+
closeButtonAction: "open url",
54+
url: "https://guidefox-demo.bluewavelabs.ca",
55+
actionButtonUrl: "https://guidefox.io/",
56+
actionButtonText: "Go to guidefox.io",
57+
headerBackgroundColor: "#e4c2f0",
58+
headerColor: "#450fbd",
59+
textColor: "#4889f4",
60+
buttonBackgroundColor: "#7F56D9",
61+
buttonTextColor: "#FFFFFF",
62+
header: "Welcome",
63+
content: "<p>Welcome to GuideFox<p>",
64+
repetitionType: "show every visit",
65+
createdBy: 1
66+
},
67+
],
68+
{}
69+
);
70+
71+
await queryInterface.bulkInsert(
72+
"banners",
73+
[
74+
{
75+
closeButtonAction: "open url",
76+
position: "top",
77+
url: "https://guidefox-demo.bluewavelabs.ca",
78+
fontColor: "#ffffff",
79+
backgroundColor: "#5e4b7b",
80+
bannerText: "Welcome",
81+
repetitionType: "show every visit",
82+
createdBy: 1
83+
}
84+
],
85+
{}
86+
);
87+
88+
const [helperLink] = await queryInterface.bulkInsert(
89+
'helper_link',
90+
[
91+
{
92+
title: 'GuideFox Links',
93+
headerBackgroundColor: '#adb2f5',
94+
linkFontColor: '#344054',
95+
iconColor: '#7F56D9',
96+
createdBy: 1,
97+
url: 'https://guidefox-demo.bluewavelabs.ca/'
98+
},
99+
],
100+
{ returning: true } // Return the created row to use its ID
101+
);
102+
103+
const links = [
104+
{ title: 'GuideFox Website', url: 'https://guidefox-demo.bluewavelabs.ca', target: true, helperId: helperLink.id },
105+
{ title: 'GuideFox Repo', url: 'https://github.com/bluewave-labs/guidefox', target: false, helperId: helperLink.id },
106+
];
107+
108+
await queryInterface.bulkInsert('link', links, {});
109+
110+
await queryInterface.bulkInsert(
111+
"teams",
112+
[
113+
{
114+
name: 'Bluewave',
115+
createdAt: new Date(),
116+
serverUrl: 'https://guidefox-demo.bluewavelabs.ca/api/',
117+
agentUrl: 'https://cdn.jsdelivr.net/gh/bluewave-labs/bluewave-onboarding@agent-1.1.5/jsAgent/'
118+
}
119+
],
120+
{}
121+
);
122+
const [tour] = await queryInterface.bulkInsert(
123+
'tours',
124+
[
125+
{
126+
headerColor: '#101828',
127+
textColor: '#344054',
128+
buttonBackgroundColor: '#7F56D9',
129+
buttonTextColor: '#ffffff',
130+
size: 'medium', // assuming settings.tour.size[1] is 'medium'
131+
finalButtonText: 'Complete tour',
132+
url: 'https://guidefox-demo.bluewavelabs.ca',
133+
active: true,
134+
createdBy: 1,
135+
},
136+
],
137+
{ returning: true }
138+
);
139+
140+
const tourPopups = [
141+
{
142+
title: 'Popup 1',
143+
header: 'See your popup views',
144+
description: 'Explore the popup views available in your dashboard.',
145+
targetElement: 'div:nth-child(2)>div:nth-child(4)>div:nth-child(1)',
146+
order: 1,
147+
tourId: tour.id,
148+
},
149+
{
150+
title: 'Popup 2',
151+
header: 'See your banner views',
152+
description: 'Check out your banner views and customize them.',
153+
targetElement: 'div:nth-child(2)>div:nth-child(4)>div:nth-child(2)',
154+
order: 2,
155+
tourId: tour.id,
156+
},
157+
{
158+
title: 'Popup 3',
159+
header: 'See your helper link views',
160+
description: 'Review and manage your helper link views.',
161+
targetElement: 'div:nth-child(2)>div:nth-child(4)>div:nth-child(3)',
162+
order: 3,
163+
tourId: tour.id,
164+
},
165+
];
166+
167+
await queryInterface.bulkInsert('tour_popup', tourPopups, {});
168+
}
169+
170+
module.exports = { runSeeders };

backend/src/models/Popup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = (sequelize, DataTypes) => {
102102
allowNull: true,
103103
validate: {
104104
isUrl(value) {
105-
validateUrl(value, 'actionUrl');
105+
validateUrl(value, 'actionButtonUrl');
106106
},
107107
},
108108
},

backend/src/server.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ if (process.env.NODE_ENV == 'development') {
5454
.catch((err) => console.log("Error syncing models: " + err));
5555
}
5656

57+
// const { runSeeders } = require('../seeders/seeders');
58+
// const { queryInterface } = sequelize;
59+
// runSeeders(queryInterface)
60+
5761
app.use("/api/auth", authRoutes);
5862
app.use("/api/users", userRoutes);
5963
app.use("/api/mock/", mocks);

backend/src/utils/popup.helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const addOrUpdatePopupValidation = [
4242
}
4343
})
4444
.withMessage('Invalid URL. URL must start with / or use HTTP or HTTPS protocol'),
45-
body('actionUrl')
45+
body('actionButtonUrl')
4646
.custom((value) => {
4747
if(!value) return true;
4848
try {

0 commit comments

Comments
 (0)