Skip to content

Commit fb8f124

Browse files
committed
v6.0.0
1 parent 51244c4 commit fb8f124

File tree

8 files changed

+78
-29
lines changed

8 files changed

+78
-29
lines changed

build/index.js

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

demo/bb.css

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@
522522
padding: 50px;
523523
display: none;
524524
flex-grow: 1;
525+
min-height: 270px;
525526
}
526527

527528
.bb-feedback-dialog-success svg {
@@ -589,7 +590,13 @@
589590
margin-top: 7px;
590591
margin-bottom: 0px;
591592
cursor: pointer;
592-
box-shadow: 0px 5px 8px 0px rgba(0, 0, 0, 0.05);
593+
}
594+
595+
.bb-feedback-send-button--disabled {
596+
background-color: #DEE1EA !important;
597+
color: #9B9FAE !important;
598+
opacity: 1 !important;
599+
cursor: not-allowed !important;
593600
}
594601

595602
.bb-feedback-send-button:hover {
@@ -1198,6 +1205,7 @@ textarea.bb-feedback-required {
11981205
justify-content: center;
11991206
align-items: center;
12001207
flex-grow: 1;
1208+
min-height: 270px;
12011209
}
12021210

12031211
.bb--progress-ring__circle {

demo/main.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ const Gleap = window.Gleap;
22

33
// Gleap.setApiUrl("http://0.0.0.0:9000");
44

5-
Gleap.identify("123", {
6-
name: "XOXO",
7-
email: "test@gleap.io",
8-
});
9-
105
// Sample for feedback type options
116
Gleap.setMenuOptions([
127
{
@@ -168,7 +163,7 @@ Gleap.setFeedbackActions({
168163
feedbackType: "INQUIRY",
169164
disableUserScreenshot: true,
170165
},
171-
featurerequests: {
166+
featurerequest: {
172167
title: "Request a feature",
173168
description: "What feature or improvement would you like to see?",
174169
thanksMessage:
@@ -184,6 +179,16 @@ Gleap.setFeedbackActions({
184179
required: true,
185180
remember: true,
186181
},
182+
{
183+
title: "XX",
184+
placeholder: "Your e-mail",
185+
type: "text",
186+
inputtype: "email",
187+
name: "xx",
188+
hideOnDefaultSet: true,
189+
required: true,
190+
remember: true,
191+
},
187192
{
188193
placeholder: "Explain your request.",
189194
title: "Subject",
@@ -215,7 +220,7 @@ Gleap.setAppBuildNumber("2345");
215220

216221
Gleap.enableReplays(true);
217222

218-
Gleap.setColors("red", "blue", "green");
223+
Gleap.setColors("green", "blue", "green");
219224

220225
Gleap.enablePoweredBy(true);
221226

@@ -224,15 +229,15 @@ Gleap.enableCrashDetector(true, false);
224229
Gleap.enableRageClickDetector(true);
225230

226231
// Sets the app's build number.
227-
Gleap.setAppBuildNumber(5);
232+
Gleap.setAppBuildNumber(64);
228233

229234
// Sets the app's version code.
230-
Gleap.setAppVersionCode("v5.0");
235+
Gleap.setAppVersionCode("v6.0");
231236

232237
// Attaches custom data to the bug reports.
233238
Gleap.attachCustomData({
234239
test1: "Battle",
235240
data2: "Unicorn",
236241
});
237242

238-
Gleap.initialize("ogWhNhuiZcGWrva5nlDS8l7a78OfaLlV");
243+
Gleap.initialize("wytzEhhSa1EFfTEqK3HXBWuGRt2PREAE");

published/6.0.0/index.js

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

published/6.0.0/index.min.css

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

src/FeedbackForm.js

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ export const getFormData = function (form) {
176176
var formData = {};
177177
for (let i = 0; i < form.length; i++) {
178178
const formItem = form[i];
179-
const formElement = document.querySelector(
180-
`.bb-feedback-${formItem.name}`
181-
);
179+
const formElement = document.querySelector(`.bb-feedback-${formItem.name}`);
182180
if (formElement && formElement.value) {
183181
formData[formItem.name] = formElement.value;
184182
}
@@ -216,33 +214,51 @@ export const validateForm = function (form) {
216214
return formValid;
217215
};
218216

219-
export const validateFormItem = function (formItem) {
217+
const validateEmail = function (email) {
218+
const re =
219+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
220+
return re.test(String(email).toLowerCase());
221+
};
222+
223+
export const validateFormItem = function (formItem, showError = true) {
220224
var valid = true;
221-
const formElement = document.querySelector(
222-
`.bb-feedback-${formItem.name}`
223-
);
225+
const formElement = document.querySelector(`.bb-feedback-${formItem.name}`);
224226
if (
225227
(formItem.type === "text" || formItem.type === "textarea") &&
226228
formItem.required
227229
) {
228230
if (!formElement.value || formElement.value === "") {
229-
formElement.classList.add("bb-feedback-required");
231+
showError && formElement.classList.add("bb-feedback-required");
232+
valid = false;
233+
} else {
234+
formElement.classList.remove("bb-feedback-required");
235+
}
236+
}
237+
if (
238+
formItem.type === "text" &&
239+
formItem.inputtype === "email" &&
240+
formItem.required
241+
) {
242+
if (!validateEmail(formElement.value)) {
243+
showError && formElement.classList.add("bb-feedback-required");
230244
valid = false;
231245
} else {
232246
formElement.classList.remove("bb-feedback-required");
233247
}
234248
}
235249
if (formItem.type === "rating" && formItem.required) {
236250
if (!formElement.value || formElement.value === "") {
237-
formElement.parentElement.classList.add("bb-feedback-required");
251+
showError &&
252+
formElement.parentElement.classList.add("bb-feedback-required");
238253
valid = false;
239254
} else {
240255
formElement.parentElement.classList.remove("bb-feedback-required");
241256
}
242257
}
243258
if (formItem.type === "privacypolicy" && formItem.required) {
244259
if (!formElement.checked) {
245-
formElement.parentElement.classList.add("bb-feedback-required");
260+
showError &&
261+
formElement.parentElement.classList.add("bb-feedback-required");
246262
valid = false;
247263
} else {
248264
formElement.parentElement.classList.remove("bb-feedback-required");
@@ -266,9 +282,7 @@ export const hookForm = function (form) {
266282
if (!formItem) {
267283
break;
268284
}
269-
const formInput = document.querySelector(
270-
`.bb-feedback-${formItem.name}`
271-
);
285+
const formInput = document.querySelector(`.bb-feedback-${formItem.name}`);
272286
if (formItem.type === "text") {
273287
if (formItem.remember) {
274288
try {
@@ -286,8 +300,11 @@ export const hookForm = function (form) {
286300
if (formItem.defaultValue && formItem.hideOnDefaultSet) {
287301
formInput.parentElement.classList.add("bb-feedback-form--hidden");
288302
}
289-
formInput.oninput = function () {
303+
formInput.addEventListener("focusout", function () {
290304
validateFormItem(formItem);
305+
});
306+
formInput.oninput = function () {
307+
validateFormItem(formItem, false);
291308
};
292309
}
293310
if (formItem.type === "privacypolicy") {
@@ -296,6 +313,8 @@ export const hookForm = function (form) {
296313
};
297314
}
298315
if (formItem.type === "textarea") {
316+
formInput.style.height = "inherit";
317+
formInput.style.height = formInput.scrollHeight + "px";
299318
formInput.oninput = function () {
300319
formInput.style.height = "inherit";
301320
formInput.style.height = formInput.scrollHeight + "px";

src/Gleap.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ class Gleap {
14401440
customEventLog: this.eventArray,
14411441
type: this.feedbackType,
14421442
formData: this.formData,
1443+
isSilent: this.silentBugReport,
14431444
};
14441445

14451446
if (screenshotData.fileUrl) {

src/css/index.css

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@
522522
padding: 50px;
523523
display: none;
524524
flex-grow: 1;
525+
min-height: 270px;
525526
}
526527

527528
.bb-feedback-dialog-success svg {
@@ -589,7 +590,13 @@
589590
margin-top: 7px;
590591
margin-bottom: 0px;
591592
cursor: pointer;
592-
box-shadow: 0px 5px 8px 0px rgba(0, 0, 0, 0.05);
593+
}
594+
595+
.bb-feedback-send-button--disabled {
596+
background-color: #DEE1EA !important;
597+
color: #9B9FAE !important;
598+
opacity: 1 !important;
599+
cursor: not-allowed !important;
593600
}
594601

595602
.bb-feedback-send-button:hover {
@@ -1198,6 +1205,7 @@ textarea.bb-feedback-required {
11981205
justify-content: center;
11991206
align-items: center;
12001207
flex-grow: 1;
1208+
min-height: 270px;
12011209
}
12021210

12031211
.bb--progress-ring__circle {
@@ -1430,6 +1438,14 @@ textarea.bb-feedback-required {
14301438
background: linear-gradient(135deg, #ed4337 0%, #c7372d 100%);
14311439
}
14321440

1441+
.bb-feedback-dialog--crashed .bb-feedback-dialog-header-title {
1442+
color: #fff;
1443+
}
1444+
1445+
.bb-feedback-dialog--crashed .bb-feedback-send-button {
1446+
color: #fff;
1447+
}
1448+
14331449
.bb-feedback-dialog--crashed .bb-feedback-send-button {
14341450
background-color: #ed4337;
14351451
}

0 commit comments

Comments
 (0)