@schukai/monster 4.48.3 → 4.49.1

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,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.49.1] - 2025-12-21
6
+
7
+ ### Bug Fixes
8
+
9
+ - missing comma
10
+
11
+
12
+
13
+ ## [4.49.0] - 2025-12-21
14
+
15
+ ### Add Features
16
+
17
+ - Added fields object for mapping form input names in login component
18
+
19
+
20
+
5
21
  ## [4.48.3] - 2025-12-02
6
22
 
7
23
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@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.48.3"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.4","@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.49.1"}
@@ -214,6 +214,9 @@ class Login extends CustomElement {
214
214
  * @property {boolean} features.redirectToFirstSuccessUrl If true, redirects to the first success URL after login
215
215
  * @property {Object} actions Action definitions for custom event handling
216
216
  * @property {Function} actions.click Callback function for generic click actions within the login component
217
+ * @property {Object} fields Field mappings for form inputs
218
+ * @property {string} fields.identifier Name of the identifier field (username/email)
219
+ * @property {string} fields.password Name of the password field
217
220
  * @property {Object} callbacks Optional callback hooks for modifying internal behavior
218
221
  * @property {Function} callbacks.username A function that receives and can transform the entered username before submission
219
222
  * @property {Function} callbacks.forgotPassword A function that receives and can transform the entered email before submission
@@ -288,6 +291,11 @@ class Login extends CustomElement {
288
291
  },
289
292
  actions: {},
290
293
 
294
+ fields: {
295
+ identifier: "username",
296
+ password: "password",
297
+ },
298
+
291
299
  callbacks: {
292
300
  username: null,
293
301
  forgotPassword: null,
@@ -1293,12 +1301,22 @@ function initEventHandler() {
1293
1301
  return;
1294
1302
  }
1295
1303
 
1304
+ const identifierField =
1305
+ this.getOption("fields.login.identifier") || "username";
1306
+
1307
+ const passwordField = this.getOption("fields.login.password") || "password";
1308
+
1309
+ const payload = {
1310
+ [identifierField]: username,
1311
+ [passwordField]: password,
1312
+ };
1313
+
1296
1314
  const options = {
1297
1315
  method: this.getOption("fetch.login.method"),
1298
1316
  mode: this.getOption("fetch.login.mode"),
1299
1317
  headers: this.getOption("fetch.login.headers"),
1300
1318
  credentials: this.getOption("fetch.login.credentials"),
1301
- body: JSON.stringify({ username, password }),
1319
+ body: JSON.stringify(payload),
1302
1320
  };
1303
1321
 
1304
1322
  getWindow()