diff --git a/pwa/Dockerfile b/pwa/Dockerfile index 3f4ce60d1..929127836 100644 --- a/pwa/Dockerfile +++ b/pwa/Dockerfile @@ -7,9 +7,8 @@ RUN apk add --no-cache libc6-compat bash git WORKDIR /srv/app -RUN npm install --global corepack@latest && \ - corepack enable && \ - corepack prepare --activate pnpm@latest && \ +RUN corepack enable && \ + corepack prepare pnpm@9.15.4 --activate && \ pnpm config -g set store-dir /.pnpm-store # Next.js collects completely anonymous telemetry data about general usage. @@ -82,7 +81,7 @@ RUN --mount=type=secret,id=GITHUB_KEY \ if [ -z "$GITHUB_KEY" ]; then \ echo "Please set the GITHUB_KEY secret" && exit 1 ; \ fi \ - && npm i ts-node && npm run prebuild + && pnpm add ts-node && pnpm run prebuild # ADD https://soyuka.me/contributors.json ./data/contributors.json @@ -98,7 +97,7 @@ RUN --mount=type=secret,id=GITHUB_KEY \ if [ -z "$GITHUB_KEY" ]; then \ echo "Please set the GITHUB_KEY secret" && exit 1 ; \ fi \ - && npm i ts-node && npm run postbuild + && pnpm add ts-node && pnpm run postbuild # Production image, copy all the files and run next FROM node:18-alpine AS prod diff --git a/pwa/app/(con)/[locale]/con/2025/tickets/RegisterPage.tsx b/pwa/app/(con)/[locale]/con/2025/tickets/RegisterPage.tsx index d7e7751a1..10ba5c292 100644 --- a/pwa/app/(con)/[locale]/con/2025/tickets/RegisterPage.tsx +++ b/pwa/app/(con)/[locale]/con/2025/tickets/RegisterPage.tsx @@ -3,7 +3,6 @@ import { useContext, useEffect } from "react"; import { LanguageContext } from "contexts/con/LanguageContext"; import SectionTitle from "components/con/common/typography/SectionTitle"; import SectionSubTitle from "components/con/common/typography/SectionSubtitle"; -import Script from "next/script"; import prices from "data/con/2025/prices"; import { Offer } from "types/con"; import dayjs from "dayjs"; @@ -40,12 +39,35 @@ export default function RegisterPage() { const iframe = document.getElementById( "yurplan-widget-141690" ) as HTMLIFrameElement | null; - if (!iframe) return; const handleLoad = () => { const loader = document.getElementById("loader"); loader?.classList.add("hidden"); }; - iframe.addEventListener("load", handleLoad, true); + iframe?.addEventListener("load", handleLoad, true); + + const SRC = "https://assets.yurplan.com/yurplan-v1/dist/widget.js"; + const getYp = () => + (window as unknown as { YurPlanWidgets?: { init: () => void } }) + .YurPlanWidgets; + + if (getYp()) { + getYp()?.init(); + } else if (!document.querySelector(`script[src="${SRC}"]`)) { + const script = document.createElement("script"); + script.src = SRC; + script.async = true; + document.body.appendChild(script); + } + + const handlePageShow = (e: PageTransitionEvent) => { + if (e.persisted) getYp()?.init(); + }; + window.addEventListener("pageshow", handlePageShow); + + return () => { + iframe?.removeEventListener("load", handleLoad, true); + window.removeEventListener("pageshow", handlePageShow); + }; }, []); return ( @@ -184,10 +206,6 @@ export default function RegisterPage() { data-id="141690" > -