Alert Messages :Download Fact Sheet : fail email means give me : Could not send an email! Please try again later, success_email means give me meeage : We have sent you an email. Please check your inbox. If you cannot view it in your primary inbox, please check your Spam or Junk folder.
Browse files- components/notification.js +10 -29
components/notification.js
CHANGED
|
@@ -66,36 +66,17 @@ class NotificationComponent extends HTMLElement {
|
|
| 66 |
this.closeBtn = this.shadowRoot.querySelector('.close-btn');
|
| 67 |
this.closeBtn.addEventListener('click', () => this.hide());
|
| 68 |
}
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
}
|
| 78 |
-
|
| 79 |
-
// More specific error messages
|
| 80 |
-
if (type === 'error') {
|
| 81 |
-
if (message.includes('email')) {
|
| 82 |
-
message = 'Email failed to send. Please check your connection and try again.';
|
| 83 |
-
} else if (message.includes('form')) {
|
| 84 |
-
message = 'Please complete all required fields correctly.';
|
| 85 |
-
}
|
| 86 |
-
}
|
| 87 |
-
|
| 88 |
-
// More specific success messages
|
| 89 |
-
if (type === 'success') {
|
| 90 |
-
if (message.includes('email')) {
|
| 91 |
-
message = 'Thank you! The fact sheet has been sent to your email. Please check your inbox.';
|
| 92 |
-
} else if (message.includes('download')) {
|
| 93 |
-
message = 'Download started successfully!';
|
| 94 |
}
|
| 95 |
-
|
| 96 |
-
this.
|
| 97 |
-
|
| 98 |
-
const icon = this.shadowRoot.querySelector('.icon i');
|
| 99 |
icon.setAttribute('data-feather', type === 'success' ? 'check-circle' : 'alert-triangle');
|
| 100 |
|
| 101 |
this.classList.add('show');
|
|
|
|
| 66 |
this.closeBtn = this.shadowRoot.querySelector('.close-btn');
|
| 67 |
this.closeBtn.addEventListener('click', () => this.hide());
|
| 68 |
}
|
| 69 |
+
show(type, message, duration = 5000) {
|
| 70 |
+
this.setAttribute('class', type);
|
| 71 |
+
|
| 72 |
+
// Custom messages for email notifications
|
| 73 |
+
if (type === 'error') {
|
| 74 |
+
message = 'Could not send an email! Please try again later.';
|
| 75 |
+
} else if (type === 'success') {
|
| 76 |
+
message = 'We have sent you an email. Please check your inbox. If you cannot view it in your primary inbox, please check your Spam or Junk folder.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
}
|
| 78 |
+
this.innerHTML = message;
|
| 79 |
+
const icon = this.shadowRoot.querySelector('.icon i');
|
|
|
|
|
|
|
| 80 |
icon.setAttribute('data-feather', type === 'success' ? 'check-circle' : 'alert-triangle');
|
| 81 |
|
| 82 |
this.classList.add('show');
|