@klauswuestefeld/jux-web 2026.7.24 → 2026.10.19

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,48 @@ 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 16px';
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';
15060
- const howTo = document.createElement('p');
15061
- howTo.id = 'magic-link-how-to';
15062
- 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 = () => {
14965
+ email.style.margin = '4px 0 0';
14966
+ email.style.overflowWrap = 'anywhere';
14967
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
14968
+ tokenInput.style.textAlign = 'left';
14969
+ tokenInput.style.marginTop = '24px';
14970
+ const help = document.createElement('p');
14971
+ applyFormattedTranslation(help, 'magic-link-check-spam');
14972
+ help.style.margin = '24px 0 0';
14973
+ const back = backButton('Back', () => {
15073
14974
  result.remove();
15074
14975
  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);
14976
+ });
14977
+ back.style.marginTop = '24px';
14978
+ const content = [title, sent, email, tokenInput, help];
14979
+ content.forEach(element => {
14980
+ element.style.width = '356px';
14981
+ element.style.maxWidth = '100%';
14982
+ });
15081
14983
  const result = basePage('magic-link-requested-page', backgroundImg, content);
14984
+ result.style.overflowY = 'auto';
14985
+ result.style.scrollbarGutter = 'stable both-edges';
14986
+ const section = result.querySelector('section');
14987
+ section.style.maxWidth = 'calc(100% - 48px)';
14988
+ section.style.lineHeight = '1.5';
14989
+ section.style.textAlign = 'center';
14990
+ const buttons = result.querySelector('btns-container');
14991
+ buttons.style.width = '356px';
14992
+ buttons.style.maxWidth = '100%';
14993
+ buttons.appendChild(back);
15082
14994
  return result;
15083
14995
  };
15084
14996
 
@@ -15208,7 +15120,8 @@ var juxWeb = (function (exports) {
15208
15120
  }));
15209
15121
  return;
15210
15122
  }
15211
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
15123
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
15124
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
15212
15125
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
15213
15126
  // checkMixpanel(() => mixpanel.track('View Login Page'));
15214
15127
  };
@@ -15273,7 +15186,7 @@ var juxWeb = (function (exports) {
15273
15186
  };
15274
15187
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
15275
15188
  };
15276
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
15189
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
15277
15190
  var _a;
15278
15191
  if (!email) {
15279
15192
  const mailMagic = document.querySelector('#mail-magic');
@@ -15287,7 +15200,7 @@ var juxWeb = (function (exports) {
15287
15200
  const magicLinkEmail = page.querySelector('#magic-link-email');
15288
15201
  magicLinkEmail.textContent = email;
15289
15202
  };
15290
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
15203
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
15291
15204
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
15292
15205
  requestMagicLink(payload, onSuccess, onUnauthorized);
15293
15206
  };
@@ -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,48 @@ 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 16px';
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';
1740
- const howTo = document.createElement('p');
1741
- howTo.id = 'magic-link-how-to';
1742
- 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 = () => {
1645
+ email.style.margin = '4px 0 0';
1646
+ email.style.overflowWrap = 'anywhere';
1647
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
1648
+ tokenInput.style.textAlign = 'left';
1649
+ tokenInput.style.marginTop = '24px';
1650
+ const help = document.createElement('p');
1651
+ applyFormattedTranslation(help, 'magic-link-check-spam');
1652
+ help.style.margin = '24px 0 0';
1653
+ const back = backButton('Back', () => {
1753
1654
  result.remove();
1754
1655
  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);
1656
+ });
1657
+ back.style.marginTop = '24px';
1658
+ const content = [title, sent, email, tokenInput, help];
1659
+ content.forEach(element => {
1660
+ element.style.width = '356px';
1661
+ element.style.maxWidth = '100%';
1662
+ });
1761
1663
  const result = basePage('magic-link-requested-page', backgroundImg, content);
1664
+ result.style.overflowY = 'auto';
1665
+ result.style.scrollbarGutter = 'stable both-edges';
1666
+ const section = result.querySelector('section');
1667
+ section.style.maxWidth = 'calc(100% - 48px)';
1668
+ section.style.lineHeight = '1.5';
1669
+ section.style.textAlign = 'center';
1670
+ const buttons = result.querySelector('btns-container');
1671
+ buttons.style.width = '356px';
1672
+ buttons.style.maxWidth = '100%';
1673
+ buttons.appendChild(back);
1762
1674
  return result;
1763
1675
  };
1764
1676
 
@@ -1888,7 +1800,8 @@ const initSession = ({ clientApp, supportedLoginTypes, onUserLogin, onLoginError
1888
1800
  }));
1889
1801
  return;
1890
1802
  }
1891
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
1803
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
1804
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
1892
1805
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
1893
1806
  // checkMixpanel(() => mixpanel.track('View Login Page'));
1894
1807
  };
@@ -1953,7 +1866,7 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, c
1953
1866
  };
1954
1867
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
1955
1868
  };
1956
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
1869
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
1957
1870
  var _a;
1958
1871
  if (!email) {
1959
1872
  const mailMagic = document.querySelector('#mail-magic');
@@ -1967,7 +1880,7 @@ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, c
1967
1880
  const magicLinkEmail = page.querySelector('#magic-link-email');
1968
1881
  magicLinkEmail.textContent = email;
1969
1882
  };
1970
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
1883
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
1971
1884
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
1972
1885
  requestMagicLink(payload, onSuccess, onUnauthorized);
1973
1886
  };
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,48 @@ 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 16px';
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';
1764
- const howTo = document.createElement('p');
1765
- howTo.id = 'magic-link-how-to';
1766
- 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 = () => {
1669
+ email.style.margin = '4px 0 0';
1670
+ email.style.overflowWrap = 'anywhere';
1671
+ const tokenInput = loginTokenTextarea(onUserLogin, onLoginError);
1672
+ tokenInput.style.textAlign = 'left';
1673
+ tokenInput.style.marginTop = '24px';
1674
+ const help = document.createElement('p');
1675
+ applyFormattedTranslation(help, 'magic-link-check-spam');
1676
+ help.style.margin = '24px 0 0';
1677
+ const back = backButton('Back', () => {
1777
1678
  result.remove();
1778
1679
  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);
1680
+ });
1681
+ back.style.marginTop = '24px';
1682
+ const content = [title, sent, email, tokenInput, help];
1683
+ content.forEach(element => {
1684
+ element.style.width = '356px';
1685
+ element.style.maxWidth = '100%';
1686
+ });
1785
1687
  const result = basePage('magic-link-requested-page', backgroundImg, content);
1688
+ result.style.overflowY = 'auto';
1689
+ result.style.scrollbarGutter = 'stable both-edges';
1690
+ const section = result.querySelector('section');
1691
+ section.style.maxWidth = 'calc(100% - 48px)';
1692
+ section.style.lineHeight = '1.5';
1693
+ section.style.textAlign = 'center';
1694
+ const buttons = result.querySelector('btns-container');
1695
+ buttons.style.width = '356px';
1696
+ buttons.style.maxWidth = '100%';
1697
+ buttons.appendChild(back);
1786
1698
  return result;
1787
1699
  };
1788
1700
 
@@ -1912,7 +1824,8 @@ const initSession = ({ clientApp, supportedLoginTypes, onUserLogin, onLoginError
1912
1824
  }));
1913
1825
  return;
1914
1826
  }
1915
- displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest }));
1827
+ const requestSignInLink = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => handleMagicLinkRequest(token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError);
1828
+ displayPage(clientApp, loginPage(clientApp, backgroundImage, onUserLogin, onLoginError, supportedLoginTypesArray, handleSSOLogin, { onAuthPasswordLogin, onGoogleSignIn, onMicrosoftSignIn, handleMagicLinkRequest: requestSignInLink }));
1916
1829
  // validateThirdPartyCookies(initGapi, () => displayPage(Page.LOGIN));
1917
1830
  // checkMixpanel(() => mixpanel.track('View Login Page'));
1918
1831
  };
@@ -1977,7 +1890,7 @@ const onAuthPasswordLogin = (credentials, onUserLogin, onLoginError, onReturn, c
1977
1890
  };
1978
1891
  authPasswordLogin(credentials, onSuccess, onError, onUnauthorized);
1979
1892
  };
1980
- const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email = '') => {
1893
+ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, clientBody, email, onUserLogin, onLoginError) => {
1981
1894
  var _a;
1982
1895
  if (!email) {
1983
1896
  const mailMagic = document.querySelector('#mail-magic');
@@ -1991,7 +1904,7 @@ const handleMagicLinkRequest = (token, onReturn, backgroundImage, currentPage, c
1991
1904
  const magicLinkEmail = page.querySelector('#magic-link-email');
1992
1905
  magicLinkEmail.textContent = email;
1993
1906
  };
1994
- const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn));
1907
+ const onSuccess = () => onResponse(magicLinkRequestedPage(backgroundImage, onReturn, onUserLogin, onLoginError));
1995
1908
  const onUnauthorized = () => onResponse(unauthorizedMagicLinkRequestPage(backgroundImage, onReturn));
1996
1909
  requestMagicLink(payload, onSuccess, onUnauthorized);
1997
1910
  };
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.19",
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;