diff --git a/.changeset/clear-order-status-errors.md b/.changeset/clear-order-status-errors.md deleted file mode 100644 index bcd7f7452..000000000 --- a/.changeset/clear-order-status-errors.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@godaddy/gd-commerce-server': minor ---- - -Return 400 from the order-status route for invalid order IDs, including IDs the Orders API rejects as malformed, and 404 when the Orders API reports the order missing or it belongs to another store or channel, instead of 500. A 404 without the Orders API's `NOT_FOUND` code, such as from a misconfigured base URL, stays a logged 500. The 500 response no longer includes the internal error message; it is logged server-side instead. Export `InvalidOrderIdError`, `OrderNotFoundError`, and `ORDER_STATUS_UNKNOWN` for in-process `getOrderStatus()` callers; check `error.name` rather than `instanceof` so the check holds when a host has more than one copy of this package. diff --git a/.changeset/free-shipping-default-selection.md b/.changeset/free-shipping-default-selection.md deleted file mode 100644 index 934cb465a..000000000 --- a/.changeset/free-shipping-default-selection.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@godaddy/react': patch ---- - -Select a free shipping rate by default when one is available, even if a paid rate was already applied automatically or is already on the draft order. A rate the shopper picks is kept until the page is reloaded or the shopper switches to local pickup. diff --git a/.changeset/quiet-route-failures.md b/.changeset/quiet-route-failures.md deleted file mode 100644 index 1a7958e1d..000000000 --- a/.changeset/quiet-route-failures.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -'@godaddy/gd-commerce-server': minor ---- - -Standardize route error handling. Every failure now responds with `{ error, code, requestId }` and no longer includes internal error text in a `message` field. - -Status codes now reflect the cause: - -- 502 for Commerce failures, including rejected OAuth credentials (`upstream_unauthorized`); previously 500. This includes order-status upstream failures, which were 500. An OAuth 400 is `upstream_unauthorized` only for `invalid_client`, `invalid_grant`, `unauthorized_client`, or `invalid_scope`. -- 503 for missing or unreadable configuration on every route; previously 500 everywhere except `/config`. Data and checkout routes also return 503 `not_configured` when the host reports a connection state other than `ready`; previously 500. -- 404 for writes to an existing cart (`/cart/:id/...`) that is missing, expired, or completed; previously 500. Creating a cart and checkout are not classified this way and return 502. -- 500 only for unexpected errors. - -Hosts can pass `logger` and `getRequestId` to the router factories to receive failure detail and reuse their own request ids; a throwing `getRequestId` falls back to a generated id. In-process helpers, including `getOrderStatus()` and `createCheckoutSession()`, throw exported `CommerceError` subclasses, also when a host configuration throws while being read. Check `error.code` rather than `instanceof` or `error.name`; it holds when a host has more than one copy of this package. `validateCommerceCartScope` was internal and is replaced by a throwing `assertCommerceCartScope`. - -Hosts that read `message` or check for status 500 should switch to `code` and server-side logs. diff --git a/packages/commerce-server/CHANGELOG.md b/packages/commerce-server/CHANGELOG.md index bfd08f2b6..51da6c8a7 100644 --- a/packages/commerce-server/CHANGELOG.md +++ b/packages/commerce-server/CHANGELOG.md @@ -1,5 +1,23 @@ # @godaddy/gd-commerce-server +## 0.3.0 + +### Minor Changes + +- b39d49d: Return 400 from the order-status route for invalid order IDs, including IDs the Orders API rejects as malformed, and 404 when the Orders API reports the order missing or it belongs to another store or channel, instead of 500. A 404 without the Orders API's `NOT_FOUND` code, such as from a misconfigured base URL, stays a logged 500. The 500 response no longer includes the internal error message; it is logged server-side instead. Export `InvalidOrderIdError`, `OrderNotFoundError`, and `ORDER_STATUS_UNKNOWN` for in-process `getOrderStatus()` callers; check `error.name` rather than `instanceof` so the check holds when a host has more than one copy of this package. +- 9a172d8: Standardize route error handling. Every failure now responds with `{ error, code, requestId }` and no longer includes internal error text in a `message` field. + + Status codes now reflect the cause: + + - 502 for Commerce failures, including rejected OAuth credentials (`upstream_unauthorized`); previously 500. This includes order-status upstream failures, which were 500. An OAuth 400 is `upstream_unauthorized` only for `invalid_client`, `invalid_grant`, `unauthorized_client`, or `invalid_scope`. + - 503 for missing or unreadable configuration on every route; previously 500 everywhere except `/config`. Data and checkout routes also return 503 `not_configured` when the host reports a connection state other than `ready`; previously 500. + - 404 for writes to an existing cart (`/cart/:id/...`) that is missing, expired, or completed; previously 500. Creating a cart and checkout are not classified this way and return 502. + - 500 only for unexpected errors. + + Hosts can pass `logger` and `getRequestId` to the router factories to receive failure detail and reuse their own request ids; a throwing `getRequestId` falls back to a generated id. In-process helpers, including `getOrderStatus()` and `createCheckoutSession()`, throw exported `CommerceError` subclasses, also when a host configuration throws while being read. Check `error.code` rather than `instanceof` or `error.name`; it holds when a host has more than one copy of this package. `validateCommerceCartScope` was internal and is replaced by a throwing `assertCommerceCartScope`. + + Hosts that read `message` or check for status 500 should switch to `code` and server-side logs. + ## 0.2.0 ### Minor Changes diff --git a/packages/commerce-server/package.json b/packages/commerce-server/package.json index ebacaeb79..f66a6ee38 100644 --- a/packages/commerce-server/package.json +++ b/packages/commerce-server/package.json @@ -1,6 +1,6 @@ { "name": "@godaddy/gd-commerce-server", - "version": "0.2.0", + "version": "0.3.0", "description": "Opinionated Express server integration for GoDaddy Commerce", "type": "module", "license": "MIT", diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 34a920321..628f50a3e 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -1,5 +1,11 @@ # @godaddy/react +## 1.0.59 + +### Patch Changes + +- c564b12: Select a free shipping rate by default when one is available, even if a paid rate was already applied automatically or is already on the draft order. A rate the shopper picks is kept until the page is reloaded or the shopper switches to local pickup. + ## 1.0.58 ### Patch Changes diff --git a/packages/react/package.json b/packages/react/package.json index 50c3e4c7d..ad43477a6 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,7 +1,7 @@ { "name": "@godaddy/react", "private": false, - "version": "1.0.58", + "version": "1.0.59", "type": "module", "types": "./dist/index.d.ts", "files": [