From f9ce43ef752252570c74c34b9f006855c21bcd24 Mon Sep 17 00:00:00 2001 From: Matias Cappato Date: Fri, 31 Oct 2025 16:40:29 +0000 Subject: [PATCH] fix: certificate worckshop flow --- .../digital-trends/certificate/certificate2.js | 4 +++- .../certificate/certificateWorkshop.js | 3 ++- .../during/digital-trends/certificate/workshop.js | 15 +++++++-------- textify/certificate-emms2025.php | 1 + textify/certificate-emms2025qa.php | 1 + 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/components/digital-trends/during/digital-trends/certificate/certificate2.js b/components/digital-trends/during/digital-trends/certificate/certificate2.js index fa7d6abb..d58c04fc 100644 --- a/components/digital-trends/during/digital-trends/certificate/certificate2.js +++ b/components/digital-trends/during/digital-trends/certificate/certificate2.js @@ -1,7 +1,9 @@ "use strict"; import { isQADomain } from "./utils/certificateUtils.js"; -import { downloadWorkshopCertificate, getUrlWorkshop } from "./workshop.js"; + +const workshop = await import(`./workshop.js?v=${window.APP.VERSION}`); +const { downloadWorkshopCertificate, getUrlWorkshop } = workshop; const buildCertificateUrl = (fullname, type) => { const encodeFullname = encodeURI(fullname); diff --git a/components/digital-trends/during/digital-trends/certificate/certificateWorkshop.js b/components/digital-trends/during/digital-trends/certificate/certificateWorkshop.js index 65fbd3d9..761feaa7 100644 --- a/components/digital-trends/during/digital-trends/certificate/certificateWorkshop.js +++ b/components/digital-trends/during/digital-trends/certificate/certificateWorkshop.js @@ -1,4 +1,5 @@ -import { handleCertificateSubmit } from "./certificate2.js"; +const certificate = await import(`./certificate2.js?v=${window.APP.VERSION}`); +const { handleCertificateSubmit } = certificate; const certificateCta = document.getElementById("certificateCta"); const certificateModal = document.getElementById("certificateModal"); diff --git a/components/digital-trends/during/digital-trends/certificate/workshop.js b/components/digital-trends/during/digital-trends/certificate/workshop.js index 4d5a19c0..d61610c1 100644 --- a/components/digital-trends/during/digital-trends/certificate/workshop.js +++ b/components/digital-trends/during/digital-trends/certificate/workshop.js @@ -22,15 +22,14 @@ const buildWorkshopUrl = (fullname, workshopType) => { return `https://textify.fromdoppler.com/${domainUrl}?fullname=${encodeFullname}&type=workshop&workshoptype=${encodeURI(workshopType)}`; }; -export const downloadWorkshopCertificate = async (fullname) => { +export const downloadWorkshopCertificate = (fullname) => { const workshopType = getUrlWorkshop(); if (!workshopType) return; - const fileName = `certificacion-emms2025-workshop.png`; - const url = buildWorkshopUrl(fullname, workshopType); - - const response = await fetch(url); - if (!response.ok) throw new Error("Error downloading workshop certificate"); - const blob = await response.blob(); - createDownloadLink(blob, fileName); + const url = buildWorkshopUrl(fullname, workshopType); + const iframe = document.createElement("iframe"); + iframe.style.display = "none"; + iframe.src = url; + document.body.appendChild(iframe); + iframe.onload = () => document.body.removeChild(iframe); }; diff --git a/textify/certificate-emms2025.php b/textify/certificate-emms2025.php index 3499a132..c1cdb736 100644 --- a/textify/certificate-emms2025.php +++ b/textify/certificate-emms2025.php @@ -2,6 +2,7 @@ // Establecer el tipo de contenido header('Content-Type: image/png'); header("Access-Control-Allow-Origin: https://goemms.com"); +header('Content-Disposition: attachment; filename="certificate-EMMSDT25.png"'); // Tamaño de la imagen $img_w = 1080; diff --git a/textify/certificate-emms2025qa.php b/textify/certificate-emms2025qa.php index 009a6f34..cb78431b 100644 --- a/textify/certificate-emms2025qa.php +++ b/textify/certificate-emms2025qa.php @@ -2,6 +2,7 @@ // Establecer el tipo de contenido header('Content-Type: image/png'); header("Access-Control-Allow-Origin: https://qa.goemms.com"); +header('Content-Disposition: attachment; filename="certificate-EMMSDT25-qa.png"'); // Tamaño de la imagen $img_w = 1080;