@klauswuestefeld/jux-web 2026.7.24 → 2026.10.9

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/dist/jux-web.js CHANGED
@@ -203,12 +203,15 @@ var juxWeb = (function (exports) {
203
203
  if (iconHTML) {
204
204
  const icon = document.createElement('login-icon');
205
205
  icon.style.gridColumnStart = '2';
206
- icon.style.width = '28px';
207
- icon.style.padding = '6px';
208
- icon.style.marginLeft = '4px';
206
+ icon.style.width = '16px';
207
+ icon.style.padding = '0';
208
+ icon.style.marginLeft = '0';
209
+ icon.style.display = 'flex';
210
+ icon.style.alignItems = 'center';
209
211
  icon.style.boxSizing = 'border-box';
210
212
  icon.className = 'ico';
211
213
  icon.innerHTML = iconHTML;
214
+ icon.querySelector('svg').style.display = 'block';
212
215
  result.appendChild(icon);
213
216
  }
214
217
  const label = document.createElement('login-label');
@@ -14946,139 +14949,50 @@ var juxWeb = (function (exports) {
14946
14949
  }
14947
14950
  };
14948
14951
 
14949
- const contactField = (tag = 'input', elType, elName, required = true, value) => {
14950
- const result = document.createElement('contact-field');
14951
- const elId = 'contact-' + elName;
14952
- const label = document.createElement('label');
14953
- label.textContent = getTranslation(elId + '-label');
14954
- label.htmlFor = elId;
14955
- const el = document.createElement(tag);
14956
- el.id = elId;
14957
- el.setAttribute('name', elName);
14958
- el.setAttribute('placeholder', getTranslation(elId + '-placeholder'));
14959
- if (tag === 'input') {
14960
- el.setAttribute('type', elType);
14961
- }
14962
- if (required) {
14963
- el.setAttribute('required', 'true');
14964
- }
14965
- if (value) {
14966
- el.setAttribute('value', value);
14967
- }
14968
- result.append(label, el);
14969
- return result;
14970
- };
14971
-
14972
- const getNestedElValue = (el, nestedTag) => {
14973
- const nestedEl = el.querySelector(nestedTag);
14974
- return nestedEl.value;
14975
- };
14976
- const sendInquiry = (name, email, msg, whatsapp, subject, token) => {
14977
- const inquiryPayload = {
14978
- subject: `[${subject.charAt(0).toUpperCase()}${subject.slice(1)}] ${getNestedElValue(name, 'input')}`,
14979
- body: `<strong>Name</strong>: ${getNestedElValue(name, 'input')}<br><br>
14980
- <strong>E-mail</strong>: ${getNestedElValue(email, 'input')}<br><br>
14981
- <strong>Whatsapp</strong>: ${getNestedElValue(whatsapp, 'input')}<br><br>
14982
- <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
14983
- token,
14984
- };
14985
- backendPost('contact-us', inquiryPayload, (_res) => {
14986
- var _a;
14987
- // success(getTranslation('form-success'), Length.long);
14988
- (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
14989
- }, () => { } // TODO: change it to be an error handling fn provided by the client
14990
- );
14991
- // checkMixpanel(() => mixpanel.track('Sent Contact Inquiry', {}));
14992
- };
14993
- const contactUsModal = (subject) => {
14994
- var _a, _b, _c, _d, _e, _f, _g, _h;
14995
- const result = document.createElement('contact-us-modal');
14996
- const currentUser = (_a = window.juxWebGlobal) === null || _a === void 0 ? void 0 : _a.getCurrentUser();
14997
- const currentName = currentUser ? currentUser.name : '';
14998
- const currentEmail = currentUser ? currentUser.email : (_b = document.querySelector('#magic-link-email')) === null || _b === void 0 ? void 0 : _b.textContent;
14999
- const modalBody = document.createElement('modal-body');
15000
- const form = document.createElement('form');
15001
- form.id = 'contact-form';
15002
- const nameField = contactField('input', 'text', 'name', true, currentName);
15003
- const emailField = contactField('input', 'email', 'email', true, currentEmail);
15004
- const messageField = contactField('textarea', 'text', 'message', true);
15005
- const whatsappField = contactField('input', 'tel', 'whatsapp', false);
15006
- const btn = document.createElement('button');
15007
- btn.textContent = getTranslation('contact-submit');
15008
- btn.className = 'primary-button';
15009
- form.append(nameField, emailField, whatsappField, messageField, btn);
15010
- modalBody.appendChild(form);
15011
- const modal = juxModal(getTranslation('contact-page'), [], '', false, false, modalBody, '', '', () => result.remove());
15012
- modal.id = 'contact-us-modal';
15013
- document.body.appendChild(modal);
15014
- (_c = modal.querySelector('modal-wrapper')) === null || _c === void 0 ? void 0 : _c.setAttribute('style', 'max-width: 680px; width: 100%; overflow-y: auto;');
15015
- const captcha = googleCaptcha();
15016
- if (subject !== 'email-not-sent') {
15017
- const admin = ((_e = (_d = window.juxWebGlobal) === null || _d === void 0 ? void 0 : _d.selectedTeam) === null || _e === void 0 ? void 0 : _e.admin) || ((_g = (_f = window.juxWebGlobal) === null || _f === void 0 ? void 0 : _f.getCurrentUser()) === null || _g === void 0 ? void 0 : _g.email);
15018
- backendGet('credits-balance-for', { admin }, (res) => {
15019
- const balance = res;
15020
- if (balance <= 0) {
15021
- form.insertBefore(captcha, btn);
15022
- }
15023
- }, () => { } // TODO: change it to be an error handling fn provided by the client
15024
- );
15025
- }
15026
- else {
15027
- form.insertBefore(captcha, btn);
15028
- }
15029
- (_h = nameField.querySelector('input')) === null || _h === void 0 ? void 0 : _h.select();
15030
- form.addEventListener('submit', (event) => {
15031
- event.preventDefault();
15032
- sendInquiry(nameField, emailField, messageField, whatsappField, subject, captcha.getAttribute('token'));
15033
- });
15034
- return result;
15035
- };
15036
-
15037
- const applyBtnStyles = (btn) => {
15038
- btn.style.cursor = 'pointer';
15039
- btn.style.textDecoration = 'underline';
15040
- btn.style.border = 'none';
15041
- btn.style.backgroundColor = '';
15042
- btn.style.background = 'none';
15043
- btn.style.boxSizing = 'border-box';
15044
- btn.style.margin = '0';
15045
- btn.style.outline = 'none';
15046
- btn.style.padding = '0';
15047
- btn.style.whiteSpace = 'normal';
15048
- btn.style.font = 'inherit';
15049
- };
15050
- const magicLinkRequestedPage = (backgroundImg, onReturn) => {
15051
- const content = [];
14952
+ const magicLinkRequestedPage = (backgroundImg, onReturn, onUserLogin, onLoginError) => {
14953
+ const title = document.createElement('h2');
14954
+ title.textContent = getTranslation('magic-link-confirmation-title');
14955
+ title.style.fontSize = '24px';
14956
+ title.style.lineHeight = '1.25';
14957
+ title.style.margin = '0 0 12px';
15052
14958
  const sent = document.createElement('p');
15053
14959
  sent.id = 'magic-link-sent';
15054
14960
  sent.textContent = getTranslation(sent.id);
15055
- sent.style.marginBottom = '10px';
14961
+ sent.style.margin = '0';
15056
14962
  const email = document.createElement('p');
15057
14963
  email.id = 'magic-link-email';
15058
14964
  email.style.fontWeight = '700';
15059
- email.style.marginBottom = '10px';
14965
+ email.style.margin = '4px 0 0';
14966
+ email.style.overflowWrap = 'anywhere';
15060
14967
  const howTo = document.createElement('p');
15061
14968
  howTo.id = 'magic-link-how-to';
15062
14969
  applyFormattedTranslation(howTo, howTo.id);
15063
- howTo.style.padding = '0 30px';
15064
- howTo.style.textAlign = 'center';
15065
- const btn = document.createElement('button');
15066
- btn.id = 'email-not-received-btn';
15067
- btn.addEventListener('click', () => document.body.appendChild(contactUsModal('email-not-sent')));
15068
- btn.textContent = getTranslation('magic-link-let-us-know');
15069
- applyBtnStyles(btn);
15070
- const returnLink = document.createElement('a');
15071
- returnLink.textContent = getTranslation('return-link');
15072
- returnLink.onclick = () => {
14970
+ howTo.style.margin = '28px 0 12px';
14971
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
14972
+ tokenInput.style.textAlign = 'left';
14973
+ const help = document.createElement('p');
14974
+ applyFormattedTranslation(help, 'magic-link-check-spam');
14975
+ help.style.margin = '20px 0 0';
14976
+ const back = backButton('Back', () => {
15073
14977
  result.remove();
15074
14978
  onReturn();
15075
- };
15076
- returnLink.style.marginTop = '32px';
15077
- returnLink.style.cursor = 'pointer';
15078
- returnLink.style.fontWeight = '700';
15079
- returnLink.style.textDecoration = 'underline';
15080
- content.push(sent, email, howTo, btn, returnLink);
14979
+ });
14980
+ const content = [title, sent, email, howTo, tokenInput, help];
14981
+ content.forEach(element => {
14982
+ element.style.width = '356px';
14983
+ element.style.maxWidth = '100%';
14984
+ });
15081
14985
  const result = basePage('magic-link-requested-page', backgroundImg, content);
14986
+ result.style.overflowY = 'auto';
14987
+ result.style.scrollbarGutter = 'stable both-edges';
14988
+ const section = result.querySelector('section');
14989
+ section.style.maxWidth = 'calc(100% - 48px)';
14990
+ section.style.lineHeight = '1.5';
14991
+ section.style.textAlign = 'center';
14992
+ const buttons = result.querySelector('btns-container');
14993
+ buttons.style.width = '356px';
14994
+ buttons.style.maxWidth = '100%';
14995
+ buttons.appendChild(back);
15082
14996
  return result;
15083
14997
  };
15084
14998
 
@@ -15208,7 +15122,8 @@ var juxWeb = (function (exports) {
15208
15122
  }));
15209
15123
  return;
15210
15124
  }
15211
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
15125
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
15126
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
15212
15127
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
15213
15128
  // checkMixpanel(() => mixpanel.track('View Login Page'));
15214
15129
  };
@@ -15273,7 +15188,7 @@ var juxWeb = (function (exports) {
15273
15188
  };
15274
15189
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
15275
15190
  };
15276
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
15191
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
15277
15192
  var _a;
15278
15193
  if (!email) {
15279
15194
  const mailMagic = document.querySelector('#mail-magic');
@@ -15287,7 +15202,7 @@ var juxWeb = (function (exports) {
15287
15202
  const magicLinkEmail = page.querySelector('#magic-link-email');
15288
15203
  magicLinkEmail.textContent = email;
15289
15204
  };
15290
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
15205
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
15291
15206
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
15292
15207
  requestMagicLink(payload, onSuccess, onUnauthorized);
15293
15208
  };
@@ -1 +1 @@
1
- export declare const magicLinkRequestedPage: (backgroundImg: string, onReturn: any) => HTMLElement;
1
+ export declare const magicLinkRequestedPage: (backgroundImg: string, onReturn: any, onUserLogin: any, onLoginError: any) => HTMLElement;
@@ -12,5 +12,5 @@ export declare const initSession: ({ clientApp, supportedLoginTypes, onUserLogin
12
12
  export declare const onMicrosoftSignIn: (onUserLogin: any) => Promise<void>;
13
13
  export declare const onGoogleSignIn: (onUserLogin: any) => void;
14
14
  export declare const onAuthPasswordLogin: (credentials: any, onUserLogin: any, onLoginError: any, onReturn: any, clientApp: HTMLElement, backgroundImg: string) => void;
15
- export declare const handleMagicLinkRequest: (token: string | null, onReturn: any, backgroundImage: string, currentPage: HTMLElement, clientBody: HTMLElement, email?: string) => void;
15
+ export declare const handleMagicLinkRequest: (token: string | null, onReturn: any, backgroundImage: string, currentPage: HTMLElement, clientBody: HTMLElement, email: string, onUserLogin: any, onLoginError: any) => void;
16
16
  export {};
package/dist/main.esm.js CHANGED
@@ -202,12 +202,15 @@ const backButton = (type, fn) => {
202
202
  if (iconHTML) {
203
203
  const icon = document.createElement('login-icon');
204
204
  icon.style.gridColumnStart = '2';
205
- icon.style.width = '28px';
206
- icon.style.padding = '6px';
207
- icon.style.marginLeft = '4px';
205
+ icon.style.width = '16px';
206
+ icon.style.padding = '0';
207
+ icon.style.marginLeft = '0';
208
+ icon.style.display = 'flex';
209
+ icon.style.alignItems = 'center';
208
210
  icon.style.boxSizing = 'border-box';
209
211
  icon.className = 'ico';
210
212
  icon.innerHTML = iconHTML;
213
+ icon.querySelector('svg').style.display = 'block';
211
214
  result.appendChild(icon);
212
215
  }
213
216
  const label = document.createElement('login-label');
@@ -1626,139 +1629,50 @@ const authSignIn = (onUserLogin) => {
1626
1629
  }
1627
1630
  };
1628
1631
 
1629
- const contactField = (tag = 'input', elType, elName, required = true, value) => {
1630
- const result = document.createElement('contact-field');
1631
- const elId = 'contact-' + elName;
1632
- const label = document.createElement('label');
1633
- label.textContent = getTranslation(elId + '-label');
1634
- label.htmlFor = elId;
1635
- const el = document.createElement(tag);
1636
- el.id = elId;
1637
- el.setAttribute('name', elName);
1638
- el.setAttribute('placeholder', getTranslation(elId + '-placeholder'));
1639
- if (tag === 'input') {
1640
- el.setAttribute('type', elType);
1641
- }
1642
- if (required) {
1643
- el.setAttribute('required', 'true');
1644
- }
1645
- if (value) {
1646
- el.setAttribute('value', value);
1647
- }
1648
- result.append(label, el);
1649
- return result;
1650
- };
1651
-
1652
- const getNestedElValue = (el, nestedTag) => {
1653
- const nestedEl = el.querySelector(nestedTag);
1654
- return nestedEl.value;
1655
- };
1656
- const sendInquiry = (name, email, msg, whatsapp, subject, token) => {
1657
- const inquiryPayload = {
1658
- subject: `[${subject.charAt(0).toUpperCase()}${subject.slice(1)}] ${getNestedElValue(name, 'input')}`,
1659
- body: `<strong>Name</strong>: ${getNestedElValue(name, 'input')}<br><br>
1660
- <strong>E-mail</strong>: ${getNestedElValue(email, 'input')}<br><br>
1661
- <strong>Whatsapp</strong>: ${getNestedElValue(whatsapp, 'input')}<br><br>
1662
- <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
1663
- token,
1664
- };
1665
- backendPost('contact-us', inquiryPayload, (_res) => {
1666
- var _a;
1667
- // success(getTranslation('form-success'), Length.long);
1668
- (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
1669
- }, () => { } // TODO: change it to be an error handling fn provided by the client
1670
- );
1671
- // checkMixpanel(() => mixpanel.track('Sent Contact Inquiry', {}));
1672
- };
1673
- const contactUsModal = (subject) => {
1674
- var _a, _b, _c, _d, _e, _f, _g, _h;
1675
- const result = document.createElement('contact-us-modal');
1676
- const currentUser = (_a = window.juxWebGlobal) === null || _a === void 0 ? void 0 : _a.getCurrentUser();
1677
- const currentName = currentUser ? currentUser.name : '';
1678
- const currentEmail = currentUser ? currentUser.email : (_b = document.querySelector('#magic-link-email')) === null || _b === void 0 ? void 0 : _b.textContent;
1679
- const modalBody = document.createElement('modal-body');
1680
- const form = document.createElement('form');
1681
- form.id = 'contact-form';
1682
- const nameField = contactField('input', 'text', 'name', true, currentName);
1683
- const emailField = contactField('input', 'email', 'email', true, currentEmail);
1684
- const messageField = contactField('textarea', 'text', 'message', true);
1685
- const whatsappField = contactField('input', 'tel', 'whatsapp', false);
1686
- const btn = document.createElement('button');
1687
- btn.textContent = getTranslation('contact-submit');
1688
- btn.className = 'primary-button';
1689
- form.append(nameField, emailField, whatsappField, messageField, btn);
1690
- modalBody.appendChild(form);
1691
- const modal = juxModal(getTranslation('contact-page'), [], '', false, false, modalBody, '', '', () => result.remove());
1692
- modal.id = 'contact-us-modal';
1693
- document.body.appendChild(modal);
1694
- (_c = modal.querySelector('modal-wrapper')) === null || _c === void 0 ? void 0 : _c.setAttribute('style', 'max-width: 680px; width: 100%; overflow-y: auto;');
1695
- const captcha = googleCaptcha();
1696
- if (subject !== 'email-not-sent') {
1697
- const admin = ((_e = (_d = window.juxWebGlobal) === null || _d === void 0 ? void 0 : _d.selectedTeam) === null || _e === void 0 ? void 0 : _e.admin) || ((_g = (_f = window.juxWebGlobal) === null || _f === void 0 ? void 0 : _f.getCurrentUser()) === null || _g === void 0 ? void 0 : _g.email);
1698
- backendGet('credits-balance-for', { admin }, (res) => {
1699
- const balance = res;
1700
- if (balance <= 0) {
1701
- form.insertBefore(captcha, btn);
1702
- }
1703
- }, () => { } // TODO: change it to be an error handling fn provided by the client
1704
- );
1705
- }
1706
- else {
1707
- form.insertBefore(captcha, btn);
1708
- }
1709
- (_h = nameField.querySelector('input')) === null || _h === void 0 ? void 0 : _h.select();
1710
- form.addEventListener('submit', (event) => {
1711
- event.preventDefault();
1712
- sendInquiry(nameField, emailField, messageField, whatsappField, subject, captcha.getAttribute('token'));
1713
- });
1714
- return result;
1715
- };
1716
-
1717
- const applyBtnStyles = (btn) => {
1718
- btn.style.cursor = 'pointer';
1719
- btn.style.textDecoration = 'underline';
1720
- btn.style.border = 'none';
1721
- btn.style.backgroundColor = '';
1722
- btn.style.background = 'none';
1723
- btn.style.boxSizing = 'border-box';
1724
- btn.style.margin = '0';
1725
- btn.style.outline = 'none';
1726
- btn.style.padding = '0';
1727
- btn.style.whiteSpace = 'normal';
1728
- btn.style.font = 'inherit';
1729
- };
1730
- const magicLinkRequestedPage = (backgroundImg, onReturn) => {
1731
- const content = [];
1632
+ const magicLinkRequestedPage = (backgroundImg, onReturn, onUserLogin, onLoginError) => {
1633
+ const title = document.createElement('h2');
1634
+ title.textContent = getTranslation('magic-link-confirmation-title');
1635
+ title.style.fontSize = '24px';
1636
+ title.style.lineHeight = '1.25';
1637
+ title.style.margin = '0 0 12px';
1732
1638
  const sent = document.createElement('p');
1733
1639
  sent.id = 'magic-link-sent';
1734
1640
  sent.textContent = getTranslation(sent.id);
1735
- sent.style.marginBottom = '10px';
1641
+ sent.style.margin = '0';
1736
1642
  const email = document.createElement('p');
1737
1643
  email.id = 'magic-link-email';
1738
1644
  email.style.fontWeight = '700';
1739
- email.style.marginBottom = '10px';
1645
+ email.style.margin = '4px 0 0';
1646
+ email.style.overflowWrap = 'anywhere';
1740
1647
  const howTo = document.createElement('p');
1741
1648
  howTo.id = 'magic-link-how-to';
1742
1649
  applyFormattedTranslation(howTo, howTo.id);
1743
- howTo.style.padding = '0 30px';
1744
- howTo.style.textAlign = 'center';
1745
- const btn = document.createElement('button');
1746
- btn.id = 'email-not-received-btn';
1747
- btn.addEventListener('click', () => document.body.appendChild(contactUsModal('email-not-sent')));
1748
- btn.textContent = getTranslation('magic-link-let-us-know');
1749
- applyBtnStyles(btn);
1750
- const returnLink = document.createElement('a');
1751
- returnLink.textContent = getTranslation('return-link');
1752
- returnLink.onclick = () => {
1650
+ howTo.style.margin = '28px 0 12px';
1651
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
1652
+ tokenInput.style.textAlign = 'left';
1653
+ const help = document.createElement('p');
1654
+ applyFormattedTranslation(help, 'magic-link-check-spam');
1655
+ help.style.margin = '20px 0 0';
1656
+ const back = backButton('Back', () => {
1753
1657
  result.remove();
1754
1658
  onReturn();
1755
- };
1756
- returnLink.style.marginTop = '32px';
1757
- returnLink.style.cursor = 'pointer';
1758
- returnLink.style.fontWeight = '700';
1759
- returnLink.style.textDecoration = 'underline';
1760
- content.push(sent, email, howTo, btn, returnLink);
1659
+ });
1660
+ const content = [title, sent, email, howTo, tokenInput, help];
1661
+ content.forEach(element => {
1662
+ element.style.width = '356px';
1663
+ element.style.maxWidth = '100%';
1664
+ });
1761
1665
  const result = basePage('magic-link-requested-page', backgroundImg, content);
1666
+ result.style.overflowY = 'auto';
1667
+ result.style.scrollbarGutter = 'stable both-edges';
1668
+ const section = result.querySelector('section');
1669
+ section.style.maxWidth = 'calc(100% - 48px)';
1670
+ section.style.lineHeight = '1.5';
1671
+ section.style.textAlign = 'center';
1672
+ const buttons = result.querySelector('btns-container');
1673
+ buttons.style.width = '356px';
1674
+ buttons.style.maxWidth = '100%';
1675
+ buttons.appendChild(back);
1762
1676
  return result;
1763
1677
  };
1764
1678
 
@@ -1888,7 +1802,8 @@ const initSession = ({ clientApp, supportedLoginTypes, onUserLogin, onLoginError
1888
1802
  }));
1889
1803
  return;
1890
1804
  }
1891
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
1805
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
1806
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
1892
1807
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
1893
1808
  // checkMixpanel(() => mixpanel.track('View Login Page'));
1894
1809
  };
@@ -1953,7 +1868,7 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, c
1953
1868
  };
1954
1869
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
1955
1870
  };
1956
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
1871
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
1957
1872
  var _a;
1958
1873
  if (!email) {
1959
1874
  const mailMagic = document.querySelector('#mail-magic');
@@ -1967,7 +1882,7 @@ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, c
1967
1882
  const magicLinkEmail = page.querySelector('#magic-link-email');
1968
1883
  magicLinkEmail.textContent = email;
1969
1884
  };
1970
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
1885
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
1971
1886
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
1972
1887
  requestMagicLink(payload, onSuccess, onUnauthorized);
1973
1888
  };
package/dist/main.js CHANGED
@@ -226,12 +226,15 @@ const backButton = (type, fn) => {
226
226
  if (iconHTML) {
227
227
  const icon = document.createElement('login-icon');
228
228
  icon.style.gridColumnStart = '2';
229
- icon.style.width = '28px';
230
- icon.style.padding = '6px';
231
- icon.style.marginLeft = '4px';
229
+ icon.style.width = '16px';
230
+ icon.style.padding = '0';
231
+ icon.style.marginLeft = '0';
232
+ icon.style.display = 'flex';
233
+ icon.style.alignItems = 'center';
232
234
  icon.style.boxSizing = 'border-box';
233
235
  icon.className = 'ico';
234
236
  icon.innerHTML = iconHTML;
237
+ icon.querySelector('svg').style.display = 'block';
235
238
  result.appendChild(icon);
236
239
  }
237
240
  const label = document.createElement('login-label');
@@ -1650,139 +1653,50 @@ const authSignIn = (onUserLogin) => {
1650
1653
  }
1651
1654
  };
1652
1655
 
1653
- const contactField = (tag = 'input', elType, elName, required = true, value) => {
1654
- const result = document.createElement('contact-field');
1655
- const elId = 'contact-' + elName;
1656
- const label = document.createElement('label');
1657
- label.textContent = getTranslation(elId + '-label');
1658
- label.htmlFor = elId;
1659
- const el = document.createElement(tag);
1660
- el.id = elId;
1661
- el.setAttribute('name', elName);
1662
- el.setAttribute('placeholder', getTranslation(elId + '-placeholder'));
1663
- if (tag === 'input') {
1664
- el.setAttribute('type', elType);
1665
- }
1666
- if (required) {
1667
- el.setAttribute('required', 'true');
1668
- }
1669
- if (value) {
1670
- el.setAttribute('value', value);
1671
- }
1672
- result.append(label, el);
1673
- return result;
1674
- };
1675
-
1676
- const getNestedElValue = (el, nestedTag) => {
1677
- const nestedEl = el.querySelector(nestedTag);
1678
- return nestedEl.value;
1679
- };
1680
- const sendInquiry = (name, email, msg, whatsapp, subject, token) => {
1681
- const inquiryPayload = {
1682
- subject: `[${subject.charAt(0).toUpperCase()}${subject.slice(1)}] ${getNestedElValue(name, 'input')}`,
1683
- body: `<strong>Name</strong>: ${getNestedElValue(name, 'input')}<br><br>
1684
- <strong>E-mail</strong>: ${getNestedElValue(email, 'input')}<br><br>
1685
- <strong>Whatsapp</strong>: ${getNestedElValue(whatsapp, 'input')}<br><br>
1686
- <strong>Message</strong>: ${getNestedElValue(msg, 'textarea')}`,
1687
- token,
1688
- };
1689
- backendPost('contact-us', inquiryPayload, (_res) => {
1690
- var _a;
1691
- // success(getTranslation('form-success'), Length.long);
1692
- (_a = document.querySelector('#contact-us-modal')) === null || _a === void 0 ? void 0 : _a.remove();
1693
- }, () => { } // TODO: change it to be an error handling fn provided by the client
1694
- );
1695
- // checkMixpanel(() => mixpanel.track('Sent Contact Inquiry', {}));
1696
- };
1697
- const contactUsModal = (subject) => {
1698
- var _a, _b, _c, _d, _e, _f, _g, _h;
1699
- const result = document.createElement('contact-us-modal');
1700
- const currentUser = (_a = window.juxWebGlobal) === null || _a === void 0 ? void 0 : _a.getCurrentUser();
1701
- const currentName = currentUser ? currentUser.name : '';
1702
- const currentEmail = currentUser ? currentUser.email : (_b = document.querySelector('#magic-link-email')) === null || _b === void 0 ? void 0 : _b.textContent;
1703
- const modalBody = document.createElement('modal-body');
1704
- const form = document.createElement('form');
1705
- form.id = 'contact-form';
1706
- const nameField = contactField('input', 'text', 'name', true, currentName);
1707
- const emailField = contactField('input', 'email', 'email', true, currentEmail);
1708
- const messageField = contactField('textarea', 'text', 'message', true);
1709
- const whatsappField = contactField('input', 'tel', 'whatsapp', false);
1710
- const btn = document.createElement('button');
1711
- btn.textContent = getTranslation('contact-submit');
1712
- btn.className = 'primary-button';
1713
- form.append(nameField, emailField, whatsappField, messageField, btn);
1714
- modalBody.appendChild(form);
1715
- const modal = juxModal(getTranslation('contact-page'), [], '', false, false, modalBody, '', '', () => result.remove());
1716
- modal.id = 'contact-us-modal';
1717
- document.body.appendChild(modal);
1718
- (_c = modal.querySelector('modal-wrapper')) === null || _c === void 0 ? void 0 : _c.setAttribute('style', 'max-width: 680px; width: 100%; overflow-y: auto;');
1719
- const captcha = googleCaptcha();
1720
- if (subject !== 'email-not-sent') {
1721
- const admin = ((_e = (_d = window.juxWebGlobal) === null || _d === void 0 ? void 0 : _d.selectedTeam) === null || _e === void 0 ? void 0 : _e.admin) || ((_g = (_f = window.juxWebGlobal) === null || _f === void 0 ? void 0 : _f.getCurrentUser()) === null || _g === void 0 ? void 0 : _g.email);
1722
- backendGet('credits-balance-for', { admin }, (res) => {
1723
- const balance = res;
1724
- if (balance <= 0) {
1725
- form.insertBefore(captcha, btn);
1726
- }
1727
- }, () => { } // TODO: change it to be an error handling fn provided by the client
1728
- );
1729
- }
1730
- else {
1731
- form.insertBefore(captcha, btn);
1732
- }
1733
- (_h = nameField.querySelector('input')) === null || _h === void 0 ? void 0 : _h.select();
1734
- form.addEventListener('submit', (event) => {
1735
- event.preventDefault();
1736
- sendInquiry(nameField, emailField, messageField, whatsappField, subject, captcha.getAttribute('token'));
1737
- });
1738
- return result;
1739
- };
1740
-
1741
- const applyBtnStyles = (btn) => {
1742
- btn.style.cursor = 'pointer';
1743
- btn.style.textDecoration = 'underline';
1744
- btn.style.border = 'none';
1745
- btn.style.backgroundColor = '';
1746
- btn.style.background = 'none';
1747
- btn.style.boxSizing = 'border-box';
1748
- btn.style.margin = '0';
1749
- btn.style.outline = 'none';
1750
- btn.style.padding = '0';
1751
- btn.style.whiteSpace = 'normal';
1752
- btn.style.font = 'inherit';
1753
- };
1754
- const magicLinkRequestedPage = (backgroundImg, onReturn) => {
1755
- const content = [];
1656
+ const magicLinkRequestedPage = (backgroundImg, onReturn, onUserLogin, onLoginError) => {
1657
+ const title = document.createElement('h2');
1658
+ title.textContent = getTranslation('magic-link-confirmation-title');
1659
+ title.style.fontSize = '24px';
1660
+ title.style.lineHeight = '1.25';
1661
+ title.style.margin = '0 0 12px';
1756
1662
  const sent = document.createElement('p');
1757
1663
  sent.id = 'magic-link-sent';
1758
1664
  sent.textContent = getTranslation(sent.id);
1759
- sent.style.marginBottom = '10px';
1665
+ sent.style.margin = '0';
1760
1666
  const email = document.createElement('p');
1761
1667
  email.id = 'magic-link-email';
1762
1668
  email.style.fontWeight = '700';
1763
- email.style.marginBottom = '10px';
1669
+ email.style.margin = '4px 0 0';
1670
+ email.style.overflowWrap = 'anywhere';
1764
1671
  const howTo = document.createElement('p');
1765
1672
  howTo.id = 'magic-link-how-to';
1766
1673
  applyFormattedTranslation(howTo, howTo.id);
1767
- howTo.style.padding = '0 30px';
1768
- howTo.style.textAlign = 'center';
1769
- const btn = document.createElement('button');
1770
- btn.id = 'email-not-received-btn';
1771
- btn.addEventListener('click', () => document.body.appendChild(contactUsModal('email-not-sent')));
1772
- btn.textContent = getTranslation('magic-link-let-us-know');
1773
- applyBtnStyles(btn);
1774
- const returnLink = document.createElement('a');
1775
- returnLink.textContent = getTranslation('return-link');
1776
- returnLink.onclick = () => {
1674
+ howTo.style.margin = '28px 0 12px';
1675
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
1676
+ tokenInput.style.textAlign = 'left';
1677
+ const help = document.createElement('p');
1678
+ applyFormattedTranslation(help, 'magic-link-check-spam');
1679
+ help.style.margin = '20px 0 0';
1680
+ const back = backButton('Back', () => {
1777
1681
  result.remove();
1778
1682
  onReturn();
1779
- };
1780
- returnLink.style.marginTop = '32px';
1781
- returnLink.style.cursor = 'pointer';
1782
- returnLink.style.fontWeight = '700';
1783
- returnLink.style.textDecoration = 'underline';
1784
- content.push(sent, email, howTo, btn, returnLink);
1683
+ });
1684
+ const content = [title, sent, email, howTo, tokenInput, help];
1685
+ content.forEach(element => {
1686
+ element.style.width = '356px';
1687
+ element.style.maxWidth = '100%';
1688
+ });
1785
1689
  const result = basePage('magic-link-requested-page', backgroundImg, content);
1690
+ result.style.overflowY = 'auto';
1691
+ result.style.scrollbarGutter = 'stable both-edges';
1692
+ const section = result.querySelector('section');
1693
+ section.style.maxWidth = 'calc(100% - 48px)';
1694
+ section.style.lineHeight = '1.5';
1695
+ section.style.textAlign = 'center';
1696
+ const buttons = result.querySelector('btns-container');
1697
+ buttons.style.width = '356px';
1698
+ buttons.style.maxWidth = '100%';
1699
+ buttons.appendChild(back);
1786
1700
  return result;
1787
1701
  };
1788
1702
 
@@ -1912,7 +1826,8 @@ const initSession = ({ clientApp, supportedLoginTypes, onUserLogin, onLoginError
1912
1826
  }));
1913
1827
  return;
1914
1828
  }
1915
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
1829
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
1830
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
1916
1831
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
1917
1832
  // checkMixpanel(() => mixpanel.track('View Login Page'));
1918
1833
  };
@@ -1977,7 +1892,7 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, c
1977
1892
  };
1978
1893
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
1979
1894
  };
1980
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
1895
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
1981
1896
  var _a;
1982
1897
  if (!email) {
1983
1898
  const mailMagic = document.querySelector('#mail-magic');
@@ -1991,7 +1906,7 @@ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, c
1991
1906
  const magicLinkEmail = page.querySelector('#magic-link-email');
1992
1907
  magicLinkEmail.textContent = email;
1993
1908
  };
1994
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
1909
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
1995
1910
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
1996
1911
  requestMagicLink(payload, onSuccess, onUnauthorized);
1997
1912
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klauswuestefeld/jux-web",
3
- "version": "2026.7.24",
3
+ "version": "2026.10.9",
4
4
  "author": "Jux.House",
5
5
  "license": "Copyrighted",
6
6
  "description": "",
@@ -11,7 +11,7 @@
11
11
  "homepage": "https://github.com/klauswuestefeld/jux-web#readme",
12
12
  "bugs": {
13
13
  "url": "https://github.com/klauswuestefeld/jux-web/issues"
14
- },
14
+ },
15
15
  "dependencies": {
16
16
  "@azure/msal-browser": "2.21.0"
17
17
  },
@@ -1 +0,0 @@
1
- export declare const contactField: (tag: string | undefined, elType: string, elName: string, required?: boolean, value?: string | null) => HTMLElement;
@@ -1 +0,0 @@
1
- export declare const contactUsModal: (subject: string) => HTMLElement;