Add 2nd mail address

As for now, you can add the 2nd email using this code in the Custom JS section on the Style tab of your widget’s settings:

const SECOND_EMAIL = "test@test.com";
const EMAIL_SELECTOR = "[class*='content__Block-sc']:nth-child(4)";

const waitForElement = (selector, root = document) => new Promise(res => {
    let i = 0;

    const check = () => {
        const component = root.querySelector(selector);

        if (component) {
            res(component);
        } else if (i !== 150) {
            setTimeout(check, 100);
            i++;
        }
    };

    check();
});

waitForElement(EMAIL_SELECTOR).then((emailBlock) => {
  const emailBlockCopy = emailBlock.cloneNode(true);
  const anchor = emailBlockCopy.querySelector("a");
  anchor.href = `mailto:${SECOND_EMAIL}`;
  anchor.textContent = SECOND_EMAIL;
  
  emailBlock.insertAdjacentElement("afterend", emailBlockCopy);
});

In the 1st line of the code, you should add the needed email :slightly_smiling_face:

Note: Custom JS operates only upon widget installation, not in preview mode. Thus, the 2nd email will be displayed only on the page with the widget, but not in the editor.

2 Likes