@schukai/monster 4.6.1 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.7.0] - 2025-05-15
6
+
7
+ ### Add Features
8
+
9
+ - Add forgot password callback support in login component
10
+
11
+
12
+
5
13
  ## [4.6.1] - 2025-05-15
6
14
 
7
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.6.1"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.0","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.7.0"}
@@ -205,6 +205,7 @@ class Login extends CustomElement {
205
205
  * @property {Function} actions.click Callback function for generic click actions within the login component
206
206
  * @property {Object} callbacks Optional callback hooks for modifying internal behavior
207
207
  * @property {Function} callbacks.username A function that receives and can transform the entered username before submission
208
+ * @property {Function} callbacks.forgotPassword A function that receives and can transform the entered email before submission
208
209
  * @property {number} digits Number of digits required for second factor or password reset code input
209
210
  * @property {Object[]} successUrls List of URLs shown after successful login (e.g., home or logout)
210
211
  * @property {string} successUrls.label Label for the success URL (displayed)
@@ -274,6 +275,7 @@ class Login extends CustomElement {
274
275
 
275
276
  callbacks : {
276
277
  username : null,
278
+ forgotPassword : null,
277
279
  },
278
280
 
279
281
  digits: 6,
@@ -1310,8 +1312,17 @@ function initEventHandler() {
1310
1312
  const emailElement = this.shadowRoot.querySelector("input[name='email']");
1311
1313
 
1312
1314
  // get username and password
1313
- const mail = emailElement.value;
1314
- const valid = emailElement.checkValidity();
1315
+ let mail = emailElement.value;
1316
+ let valid = emailElement.checkValidity();
1317
+
1318
+ const mailCallback = this.getOption("callbacks.forgotPassword");
1319
+ if (isFunction(mailCallback)) {
1320
+ const mailCallbackResult = mailCallback.call(this, mail);
1321
+ if (mailCallbackResult !== undefined) {
1322
+ mail = mailCallbackResult;
1323
+ valid = true;
1324
+ }
1325
+ }
1315
1326
 
1316
1327
  let msg = null;
1317
1328
  if (mail === "" || mail === null) {