fontdue-js 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/components/Recaptcha.js +21 -8
- package/dist/relay/environment.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 3.2.2
|
|
2
|
+
|
|
3
|
+
- **Fixed the reCAPTCHA forms failing to server-render under Vite SSR** (Astro, and any framework whose dev SSR externalizes CJS deps through Node's ESM interop). 3.2.1 switched to `react-google-recaptcha`'s default export, which bundlers honouring the `__esModule` marker (webpack/Next, and Vite's browser optimizer) unwrap straight to the widget wrapper — but Node's strict ESM↔CJS interop models that same default import as the whole module *namespace*, so `<ReCAPTCHA>` was an object at SSR time. React threw "Element type is invalid … got: object" and the checkout, `NewsletterSignup` and `TestFontsForm` islands fell back to client rendering with a console error. The re-export now normalises the binding (`__esModule ? .default : obj`), resolving the wrapper on every path. A no-op for webpack and Vite's browser build. No public API change.
|
|
4
|
+
|
|
1
5
|
## 3.2.1
|
|
2
6
|
|
|
3
7
|
- **Fixed checkout, newsletter signup and trial-font downloads hanging forever on reCAPTCHA-enabled foundries.** `StoreModalUnifiedCheckout`, `NewsletterSignup` and `TestFontsForm` imported the *named* `ReCAPTCHA` export from `react-google-recaptcha` — the barebone widget, which never injects Google's `api.js` and expects you to supply `grecaptcha` yourself. So the invisible widget rendered an empty `<div>`, `window.grecaptcha` stayed undefined, `execute()` was a permanent silent no-op, and the submit button froze on "Submitting…" with no network request and no error. All three forms now use the package's default export (the `react-async-script` wrapper that actually loads the script). This has affected every release since 3.0.0. As defence in depth, each form also arms a 15-second timeout after calling `execute()`: if the reCAPTCHA script never loaded, the form resets and surfaces an inline error so the buyer can retry, while a challenge already in progress is never cancelled. No public API change — no new or changed props.
|
|
@@ -15,11 +15,24 @@
|
|
|
15
15
|
// error. This module re-exports the wrapper under the same name so callers get
|
|
16
16
|
// the working component.
|
|
17
17
|
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
import
|
|
25
|
-
|
|
18
|
+
// Interop caveat — why we normalise the default binding instead of re-exporting
|
|
19
|
+
// it directly: react-google-recaptcha is CJS. Bundlers that honour the
|
|
20
|
+
// `__esModule` marker (webpack/Next, and Vite's *browser* optimizer, which
|
|
21
|
+
// `fontdue-js/vite` pre-bundles this package through) unwrap `import Default
|
|
22
|
+
// from 'react-google-recaptcha'` straight to the wrapper. But Node's strict
|
|
23
|
+
// ESM↔CJS interop — which Vite *dev SSR* uses for this externalized dep — models
|
|
24
|
+
// the same default import as the whole module *namespace*
|
|
25
|
+
// (`{ __esModule, default, ReCAPTCHA }`), not the wrapper. Re-exporting that
|
|
26
|
+
// object made `<ReCAPTCHA>` an object at SSR time, so React threw "Element type
|
|
27
|
+
// is invalid … got: object" and the reCAPTCHA form islands failed to
|
|
28
|
+
// server-render (they fell back to client rendering with a console error).
|
|
29
|
+
// Applying the standard `obj.__esModule ? obj.default : obj` normalisation here
|
|
30
|
+
// resolves the wrapper on every path — webpack, Vite browser, and Node/Vite SSR.
|
|
31
|
+
// react-async-script forwards refs to the inner widget, so `.execute()` /
|
|
32
|
+
// `.reset()` / `.getValue()` still work through a ref typed as the class.
|
|
33
|
+
import ReCAPTCHADefault from 'react-google-recaptcha';
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
const mod = ReCAPTCHADefault;
|
|
37
|
+
const Wrapper = mod && mod.__esModule && mod.default ? mod.default : mod;
|
|
38
|
+
export const ReCAPTCHA = Wrapper;
|
|
@@ -8,7 +8,7 @@ import { NODE_ACCESS_HEADER } from '../nodeAccess.js';
|
|
|
8
8
|
// (defineVersionPlugin in .babelrc.cjs) with the literal package.json#version.
|
|
9
9
|
// Exported so UI (the admin toolbar) can surface it without re-reading the
|
|
10
10
|
// build-time global in a 'use client' module.
|
|
11
|
-
export const version = "3.2.
|
|
11
|
+
export const version = "3.2.2";
|
|
12
12
|
const IS_SERVER = typeof window === typeof undefined;
|
|
13
13
|
|
|
14
14
|
// Opt server fetches into Next's data cache only in production; dev stays
|