From d48ad1ab0e27afed4e60d0df04ee318c7f126c33 Mon Sep 17 00:00:00 2001 From: Sarthak Agrawal Date: Fri, 23 Oct 2026 07:26:32 +0530 Subject: [PATCH 1/2] fix: preserve landing feedback retry identity --- package.json | 7 +- ...-maker-templates-footer-retry-0.1.20.patch | 81 +++++++++++++++++++ pnpm-lock.yaml | 17 ++-- 3 files changed, 95 insertions(+), 10 deletions(-) create mode 100644 patches/saas-maker-templates-footer-retry-0.1.20.patch diff --git a/package.json b/package.json index 7350d66..eccf653 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,6 @@ "pnpm": { "overrides": { "astro@7.2.8>vite": "8.2.4", - "dompurify@<=3.4.12": "3.4.13", "esbuild@>=0.27.3 <0.28.1": "0.28.1", "js-yaml@>=4.0.0 <4.3.1": "4.3.1", "nanoid@<3.3.18": "3.3.18", @@ -118,10 +117,12 @@ "devalue@<=5.9.2": "5.9.3", "http-cache-semantics": "4.3.0", "sharp@<0.35.5": "0.35.5", - "source-map-js@<1.2.2": "1.2.2" + "source-map-js@<1.2.2": "1.2.2", + "dompurify@<3.4.17": "3.4.17" }, "patchedDependencies": { - "http-cache-semantics@4.3.0": "patches/http-cache-semantics@4.3.0.patch" + "http-cache-semantics@4.3.0": "patches/http-cache-semantics@4.3.0.patch", + "@saas-maker/templates@0.1.20": "patches/saas-maker-templates-footer-retry-0.1.20.patch" } } } diff --git a/patches/saas-maker-templates-footer-retry-0.1.20.patch b/patches/saas-maker-templates-footer-retry-0.1.20.patch new file mode 100644 index 0000000..5f01745 --- /dev/null +++ b/patches/saas-maker-templates-footer-retry-0.1.20.patch @@ -0,0 +1,81 @@ +diff --git a/src/Base.astro b/src/Base.astro +--- a/src/Base.astro ++++ b/src/Base.astro +@@ -150,10 +150,22 @@ + // Close any open popover (mobile menu) after in-page navigation. + addEventListener("hashchange", () => document.querySelectorAll(":popover-open").forEach((p) => p.hidePopover())); + ++ if (!document.querySelector("form[data-subscribe], form[data-feedback]")) return; ++ + // Footer forms post to SaaS Maker with a publishable key. Without one they run in preview mode. + const api = "https://api.sassmaker.com"; + // A page address without query or fragment, which can carry private tokens. + const pageUrl = () => location.origin + location.pathname; ++ const feedbackIntents = new WeakMap(); ++ function submissionId(form, feedback, shot, key) { ++ const signature = JSON.stringify([key, feedback]); ++ let intent = feedbackIntents.get(form); ++ if (!intent || intent.signature !== signature || intent.shot !== shot) { ++ intent = { signature, shot, id: crypto.randomUUID() }; ++ feedbackIntents.set(form, intent); ++ } ++ return intent.id; ++ } + // The publishable project key: given directly, or resolved from the catalog id. + // Only a found key is cached; a miss or a failed lookup is retried on the next send. + // null means preview mode (no key, or the catalog id has no project); a failed +@@ -250,6 +262,7 @@ + async function send(form, statusSel, request, ok) { + const status = form.querySelector(statusSel); + const button = form.querySelector("button[type=submit]"); ++ if (button.disabled) return false; + const say = (text) => (status.textContent = text); + button.disabled = true; + say("Sending…"); +@@ -266,7 +279,7 @@ + } catch (err) { + say(err instanceof Unreachable + ? "Couldn't reach SaaS Maker, so nothing was sent. Please try again in a moment." +- : "That did not send. Please try again in a moment."); ++ : "Couldn't confirm delivery. Please try again in a moment."); + } finally { + button.disabled = false; + } +@@ -280,24 +293,28 @@ + e.preventDefault(); + const data = new FormData(form); + const email = String(data.get("email") || "").trim(); +- const shot = data.get("screenshot"); ++ const shot = form.elements.namedItem("screenshot")?.files?.[0]; ++ const feedback = { ++ type: data.get("type") || "feedback", ++ title: String(data.get("title") || "").trim(), ++ description: String(data.get("message") || "").trim(), ++ ...(email && { submitter_email: email }), ++ page: { url: pageUrl(), title: document.title }, ++ ...(anchor && { anchor }), ++ source: "studio-footer", ++ }; + const sent = await send(form, "[data-feedback-status]", async () => { + const key = await projectKey(form); + if (!key) return null; + const body = new FormData(); + body.set("feedback", JSON.stringify({ +- type: data.get("type") || "feedback", +- title: String(data.get("title") || "").trim(), +- description: String(data.get("message") || "").trim(), +- ...(email && { submitter_email: email }), +- page: { url: pageUrl(), title: document.title }, +- ...(anchor && { anchor }), +- source: "studio-footer", ++ ...feedback, ++ submission_id: submissionId(form, feedback, shot, key), + })); + if (shot && shot.size) body.set("screenshot", shot); + return fetch(api + "/v1/feedback", { method: "POST", credentials: "omit", headers: { "X-Project-Key": key }, body }); + }, "Thanks, it reached the person who builds " + form.dataset.product + "."); +- if (sent) { anchor = null; showAnchor(); form.querySelector("[data-feedback-file-label]").textContent = "Add a screenshot"; } ++ if (sent) { feedbackIntents.delete(form); anchor = null; showAnchor(); form.querySelector("[data-feedback-file-label]").textContent = "Add a screenshot"; } + } + + if (form.hasAttribute("data-subscribe")) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca50b94..0a2d1e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,6 @@ settings: overrides: astro@7.2.8>vite: 8.2.4 - dompurify@<=3.4.12: 3.4.13 esbuild@>=0.27.3 <0.28.1: 0.28.1 js-yaml@>=4.0.0 <4.3.1: 4.3.1 nanoid@<3.3.18: 3.3.18 @@ -28,8 +27,12 @@ overrides: http-cache-semantics: 4.3.0 sharp@<0.35.5: 0.35.5 source-map-js@<1.2.2: 1.2.2 + dompurify@<3.4.17: 3.4.17 patchedDependencies: + '@saas-maker/templates@0.1.20': + hash: f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332 + path: patches/saas-maker-templates-footer-retry-0.1.20.patch http-cache-semantics@4.3.0: hash: 1bde1fe699a4c0f618ade5961734d1d414333292a27feacc6780a501009c0c74 path: patches/http-cache-semantics@4.3.0.patch @@ -173,7 +176,7 @@ importers: version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0) '@saas-maker/templates': specifier: github:sass-maker/ui-library#v0.1.20&path:/packages/templates - version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0) + version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0) '@saas-maker/ui': specifier: github:sass-maker/ui-library#v0.1.20&path:/packages/ui version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3) @@ -3541,8 +3544,8 @@ packages: resolution: {integrity: sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg==} engines: {node: '>=20.19.0'} - dompurify@3.4.13: - resolution: {integrity: sha512-2vmYIoqjze2d+kakP8S/nS5shfsl587kzwEjcGlTdiksUVgFHnFCsLYDVj/JNqJVOQZGSYBTmuycv0PodwmnMQ==} + dompurify@3.4.17: + resolution: {integrity: sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==} domutils@3.2.2: resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==} @@ -7310,7 +7313,7 @@ snapshots: - react - react-dom - '@saas-maker/templates@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0)': + '@saas-maker/templates@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0)': dependencies: '@saas-maker/motion': https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0) '@saas-maker/ui': https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3) @@ -8181,7 +8184,7 @@ snapshots: dependencies: domelementtype: 3.0.0 - dompurify@3.4.13: + dompurify@3.4.17: optionalDependencies: '@types/trusted-types': 2.0.7 @@ -9033,7 +9036,7 @@ snapshots: '@posthog/core': 1.45.1 '@posthog/types': 1.398.0 core-js: 3.49.0 - dompurify: 3.4.13 + dompurify: 3.4.17 fflate: 0.4.9 preact: 10.29.7 query-selector-shadow-dom: 1.0.1 From 7a09822ca8e563b75be4a43e75f0626bf03bdbf7 Mon Sep 17 00:00:00 2001 From: Sarthak Agrawal Date: Fri, 23 Oct 2026 07:37:02 +0530 Subject: [PATCH 2/2] fix: use whitespace-clean full controller patch context --- ...-maker-templates-footer-retry-0.1.20.patch | 386 +++++++++++++++--- pnpm-lock.yaml | 6 +- 2 files changed, 338 insertions(+), 54 deletions(-) diff --git a/patches/saas-maker-templates-footer-retry-0.1.20.patch b/patches/saas-maker-templates-footer-retry-0.1.20.patch index 5f01745..30bda13 100644 --- a/patches/saas-maker-templates-footer-retry-0.1.20.patch +++ b/patches/saas-maker-templates-footer-retry-0.1.20.patch @@ -1,16 +1,190 @@ diff --git a/src/Base.astro b/src/Base.astro --- a/src/Base.astro +++ b/src/Base.astro -@@ -150,10 +150,22 @@ - // Close any open popover (mobile menu) after in-page navigation. - addEventListener("hashchange", () => document.querySelectorAll(":popover-open").forEach((p) => p.hidePopover())); - +@@ -147,173 +147,190 @@ + {footerScript && } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0a2d1e3..b4539b2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,7 +31,7 @@ overrides: patchedDependencies: '@saas-maker/templates@0.1.20': - hash: f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332 + hash: e73706937975906c34366e008bd7b7e690347f12061fd489ab0e5d0fd2fea4bd path: patches/saas-maker-templates-footer-retry-0.1.20.patch http-cache-semantics@4.3.0: hash: 1bde1fe699a4c0f618ade5961734d1d414333292a27feacc6780a501009c0c74 @@ -176,7 +176,7 @@ importers: version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0) '@saas-maker/templates': specifier: github:sass-maker/ui-library#v0.1.20&path:/packages/templates - version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0) + version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=e73706937975906c34366e008bd7b7e690347f12061fd489ab0e5d0fd2fea4bd)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0) '@saas-maker/ui': specifier: github:sass-maker/ui-library#v0.1.20&path:/packages/ui version: https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3) @@ -7313,7 +7313,7 @@ snapshots: - react - react-dom - '@saas-maker/templates@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=f9511bd646309c23fcf933fa04f83a7b87ccedae726bad2c7f75375eefbf3332)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0)': + '@saas-maker/templates@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/templates(patch_hash=e73706937975906c34366e008bd7b7e690347f12061fd489ab0e5d0fd2fea4bd)(@saas-maker/motion@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0))(@saas-maker/ui@https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3))(astro@7.2.8(@emnapi/core@1.11.2)(@emnapi/runtime@1.11.3)(@types/node@25.6.0)(jiti@2.7.0)(terser@5.16.9)(tsx@4.23.1)(yaml@2.9.0))(react@19.3.0)': dependencies: '@saas-maker/motion': https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/motion(react-dom@19.3.0(react@19.3.0))(react@19.3.0) '@saas-maker/ui': https://codeload.github.com/sass-maker/ui-library/tar.gz/1afddb16e172c02e2d1a86ed780330ecb3dd84fe#path:/packages/ui(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.3.0(react@19.3.0))(react@19.3.0)(tailwindcss@4.3.3)