fontdue-js 3.2.4 → 3.2.5

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.2.5
2
+
3
+ - **`CartButton` is back in the server-rendered HTML.** Since 3.0.0 it rendered nothing at all until its cart query resolved in the browser, so the button was absent from the initial HTML and only appeared after hydration and a network round-trip — missing for crawlers, and a visible pop-in for everyone else. It now server-renders its empty state (`data-count="0"`) and fills in the count once the cart loads, as it did on 2.x. No public API change.
4
+
1
5
  ## 3.2.4
2
6
 
3
7
  - **The `StoreModal` checkout no longer advances past the customer step when the customer fails to save.** A rejected save — an invalid email, a duplicate record — previously moved the buyer on to payment with their details unsaved. The step now holds and shows the field errors. No public API change.
@@ -22,12 +22,14 @@ const openCart = () => ({
22
22
  type: 'OPEN_CART'
23
23
  });
24
24
  function CartButtonComponent(_ref) {
25
+ var _orderData$stripeChar;
25
26
  let {
26
27
  label,
27
28
  buttonStyle = 'inline',
28
29
  order: orderKey,
29
30
  children,
30
- suffix
31
+ suffix,
32
+ pending = false
31
33
  } = _ref;
32
34
  const orderData = useFragment((_CartButton_order.hash && _CartButton_order.hash !== "26a092d7efb579c98adda18413349b3b" && console.error("The definition of 'CartButton_order' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _CartButton_order), orderKey);
33
35
  const [count, setCount] = useState(0);
@@ -71,8 +73,8 @@ function CartButtonComponent(_ref) {
71
73
  useEffect(() => {
72
74
  setCount(cartButtonCount(orderData));
73
75
  }, [orderData, setCount]);
74
- if (!orderData) return null;
75
- if (orderData.stripeCharge && orderData.stripeCharge.paid) return null;
76
+ if (!orderData && !pending) return null;
77
+ if (orderData !== null && orderData !== void 0 && (_orderData$stripeChar = orderData.stripeCharge) !== null && _orderData$stripeChar !== void 0 && _orderData$stripeChar.paid) return null;
76
78
  const suffixNodes = formatSuffix();
77
79
  return /*#__PURE__*/React.createElement(ComponentsContext.Consumer, null, components => components.CartButton ? /*#__PURE__*/React.createElement(components.CartButton, {
78
80
  count: count,
@@ -118,9 +120,11 @@ export default function CartButton(_ref2) {
118
120
  config: config
119
121
  }, mounted ? /*#__PURE__*/React.createElement(Suspense, {
120
122
  fallback: /*#__PURE__*/React.createElement(CartButtonComponent, _extends({}, props, {
121
- order: null
123
+ order: null,
124
+ pending: true
122
125
  }))
123
126
  }, /*#__PURE__*/React.createElement(CartButtonLazyQueryRenderer, props)) : /*#__PURE__*/React.createElement(CartButtonComponent, _extends({}, props, {
124
- order: null
127
+ order: null,
128
+ pending: true
125
129
  })));
126
130
  }
@@ -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.4";
11
+ export const version = "3.2.5";
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fontdue-js",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "npm run relay && run-p build-js build-css build-ts",