const DS3 = window.MattiuzDesignSystem_ac598e;
const { SectionHeader: SH3, Button: Btn3, Input: In3, Select: Sel3, Checkbox: Cb3, Radio: Rd3, Card: Cd3, Badge: Bdg3, Divider: Dv3, Dialog: Dlg3, Toast: Ts3 } = DS3;
const CONTACT_MAIL = "contato@mattiuz.com.br";
// Chave de envio (Web3Forms) — cadastre contato@mattiuz.com.br em web3forms.com e cole a chave aqui.
// Enquanto estiver vazia, o site abre o e-mail no cliente do usuário como plano B.
const FORM_KEY = "cc9b5778-282c-4c0f-aa7c-7468c84577ba";
function sendMail(subject, body) {
const a = document.createElement("a");
a.href = `mailto:${CONTACT_MAIL}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
document.body.appendChild(a);
a.click();
a.remove();
}
async function postForm(subject, fields) {
const body = Object.entries(fields).map(([k, v]) => `${k}: ${v}`).join("\n");
if (FORM_KEY) {
try {
const r = await fetch("https://api.web3forms.com/submit", {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
body: JSON.stringify({ access_key: FORM_KEY, subject, from_name: "Site Mattiuz", replyto: fields.email || CONTACT_MAIL, message: body, ...fields }),
});
if ((await r.json()).success) return true;
} catch (e) { /* cai no plano B */ }
}
sendMail(subject, body);
return false;
}
function LineCard({ l, i, t, onAsk }) {
return (
{window.LINE_SRC[i]
?

:
}
{l.lab}
{l.t}
{l.spec}
{l.txt}
{l.apps.split(" · ").map((a) => (
{a}
))}
{l.seal.map((s, k) => {s})}
{t.ask}
);
}
function Portfolio({ t, go }) {
const [ask, setAsk] = React.useState(null);
const [toast, setToast] = React.useState(false);
const [req, setReq] = React.useState({ email: "", vol: t.vols[0], cb: true });
const [busy, setBusy] = React.useState(false);
const openAsk = (l) => { setReq({ email: "", vol: t.vols[0], cb: true }); setAsk(l); };
const submitAsk = async () => {
const l = ask;
setBusy(true);
await postForm(t.dlg_t + l.t, {
[t.dlg_email]: req.email,
[t.dlg_vol]: req.vol,
[t.dlg_cb]: req.cb ? t.f_yes : t.f_no,
[t.prod_over]: `${l.lab} · ${l.t} — ${l.spec}`,
});
setBusy(false);
setAsk(null);
setToast(true);
};
return (
{t.port_nums.split(" · ").map((n, i) => (
{n}
))}
{t.lines.map((l, i) => openAsk(l)} />)}
{t.port_foot_t}
{t.port_foot_p}
go("contact")}>{t.port_foot_b}
setAsk(null)} title={t.dlg_t + (ask ? ask.t : "")}
actions={ setAsk(null)}>{t.cancel}{busy ? t.f_sending : t.send_req}}>
setReq({ ...req, email: e.target.value })} />
setReq({ ...req, vol: e.target.value })} />
setReq({ ...req, cb: c })} />
setToast(false)} />
);
}
function Labeled({ label, children }) {
return (
{label}
{children}
);
}
function Contact({ t }) {
const [sent, setSent] = React.useState(false);
const [busy, setBusy] = React.useState(false);
const [country, setCountry] = React.useState(t.countries[0]);
const [v, setV] = React.useState({ client: t.f_no, reason: t.reasons[0], subject: "", name: "", email: "", doc: "", phone: "", msg: "" });
const isBR = country === t.countries[0];
const set = (k) => (e) => setV({ ...v, [k]: e && e.target ? e.target.value : e });
const submit = async () => {
setBusy(true);
await postForm(v.subject.trim() || `${t.c_over} — ${v.reason}`, {
[t.f_client]: v.client,
[t.f_country]: country,
[t.f_reason]: v.reason,
[t.f_fullname]: v.name,
email: v.email,
[isBR ? t.f_doc_br : t.f_doc_intl]: v.doc,
[t.f_phone]: v.phone,
[t.f_msg]: v.msg,
});
setBusy(false);
setSent(true);
};
return (
{t.c_over}
{t.c_t}
{t.c_l}
{t.foot_hq}
{t.foot_addr}
{t.foot_contact}
contato@mattiuz.com.br
{t.c_steps.map((s, i) => (
{"0" + (i + 1)}
{i < t.c_steps.length - 1 && }
))}
{sent ? (
{t.sent_t}
{t.sent_p}
setSent(false)}>{t.sent_again}
) : (
setCountry(e.target.value)} />
{busy ? t.f_sending : t.f_send}
)}
);
}
Object.assign(window, { Portfolio, Contact });