@godaddy/gd-commerce-storefront 0.1.3 → 0.3.0

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/dist/styles.css CHANGED
@@ -68,12 +68,14 @@
68
68
  font-family: inherit;
69
69
  line-height: 1.5;
70
70
  }
71
- .commerce-storefront :where(*) {
71
+ .commerce-storefront :where(*:not(.commerce-part)) {
72
72
  color: inherit;
73
73
  font-family: inherit;
74
74
  }
75
75
  .commerce-storefront *, .commerce-storefront *::before, .commerce-storefront *::after {
76
76
  box-sizing: border-box;
77
+ }
78
+ .commerce-storefront :where(*:not(.commerce-part)), .commerce-storefront *::before, .commerce-storefront *::after {
77
79
  border-width: 0;
78
80
  border-style: solid;
79
81
  }
@@ -133,6 +135,9 @@
133
135
  .commerce-storefront .fixed {
134
136
  position: fixed;
135
137
  }
138
+ .commerce-storefront .sticky {
139
+ position: sticky;
140
+ }
136
141
  .commerce-storefront .inset-0 {
137
142
  inset: calc(var(--spacing) * 0);
138
143
  }
@@ -175,6 +180,9 @@
175
180
  .commerce-storefront .mt-auto {
176
181
  margin-top: auto;
177
182
  }
183
+ .commerce-storefront .mb-0 {
184
+ margin-bottom: calc(var(--spacing) * 0);
185
+ }
178
186
  .commerce-storefront .mb-2 {
179
187
  margin-bottom: calc(var(--spacing) * 2);
180
188
  }
@@ -101,3 +101,40 @@ The client refreshes the cart before checkout and sends its ID, an absolute cata
101
101
  When using `@godaddy/gd-commerce-server`, configure the router's `checkoutReturnUrls.returnUrls` with the absolute catalog return URL and `checkoutReturnUrls.successUrls` with the absolute success-page URL. The package matches these exact destinations and permits an additional `orderId` parameter on success URLs. Missing policy disables HTTP checkout. Public HTTP requests accept only cart or SKU checkout; non-catalog amounts belong in a trusted server handler.
102
102
 
103
103
  Do not treat `checkoutSuccessPath`, a client-provided URL, the redirect itself, or a draft-order response as proof that payment succeeded. Verify payment using the checkout/payment service or trusted webhook state. Expire or reject paid/closed drafts on subsequent cart reads so returning customers cannot reuse a completed cart.
104
+
105
+ ## Connection state
106
+
107
+ A host may return one of these uncached config responses:
108
+
109
+ ```json
110
+ { "state": "unbound" }
111
+ { "state": "connecting" }
112
+ { "state": "ready", "cartScope": "opaque-cart-scope", "currencyCode": "USD" }
113
+ ```
114
+
115
+ Only an explicit `unbound` response allows `Catalog sampleProducts`. `connecting` suspends all
116
+ catalog and cart actions. Loading, malformed state, HTTP errors, and missing routes never allow
117
+ samples. A successful `{ cartScope, currencyCode }` response without `state` still means ready.
118
+
119
+ `@godaddy/gd-commerce-server` accepts an optional synchronous
120
+ `CommerceConfiguration.readConnectionState(): 'unbound' | 'connecting' | 'ready' | undefined`.
121
+ Return `undefined` to keep the existing config behavior. Return `unbound` only when the host has
122
+ confirmed that no store is connected. Throw when the state is unknown or cannot be read.
123
+ `unbound` and `connecting` responses need no credentials. `ready` still requires `read()` to
124
+ succeed. Data and checkout handlers reject any state other than `ready`, even if credentials
125
+ remain. Do not infer `unbound` from missing credentials or configuration.
126
+
127
+ The host owns the connection lifecycle. Report `ready` only when the store connection is
128
+ complete, and keep failures in a state other than `unbound`. After a store connects, missing
129
+ configuration must never bring samples back. Report `unbound` again only after the store is
130
+ deliberately disconnected. State changes must be visible to the next request. Pages switch to
131
+ live data only when the deployed server reports a new state. If a host's deployments read
132
+ state from deployment configuration, a deployed site keeps showing samples until that
133
+ configuration is updated, for example by publishing again.
134
+
135
+ The storefront polls every five seconds while the page is visible and the state is `unbound` or
136
+ `connecting`, and refreshes on mount and focus. A failed refresh immediately hides samples, without
137
+ automatic request retries. While the last response was `connecting`, refresh failures keep the
138
+ connecting state for up to 60 seconds, so a host restart during connection does not flash an
139
+ error. Polling continues, and a longer failure reports the error. Aborted configuration requests cannot overwrite newer responses.
140
+ Release server and client support before using the `sampleProducts` prop. No new endpoint is required.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godaddy/gd-commerce-storefront",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "description": "Opinionated React storefront templates for GoDaddy Commerce",
5
5
  "type": "module",
6
6
  "license": "MIT",