Repository navigation
Support commerce storefront components before a store is connected - #1497
Open
sbolinger-godaddy wants to merge 3 commits into
Open
sbolinger-godaddy wants to merge 3 commits into
sbolinger-godaddy wants to merge 3 commits into
Conversation
Shorten the sample cart title and checkout note. Return the example app to its existing live demo and remove its link from the package README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6674271 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Rename readBindingState and CommerceBindingState to readConnectionState and CommerceConnectionState, matching the storefront's connection field. Rewrite the new documentation and changeset as a host-agnostic contract for storefronts that are not connected to a store yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
These changes let the commerce storefront components run on a site that is not connected to Commerce yet. The goal is to show a catalog list and a cart in something like an Airo App Builder (AAB) template before the merchant connects a store. When a store connects, the same components switch to real catalog and cart data. No source changes or page reload are needed.
@godaddy/gd-commerce-serverCommerceConfigurationhas a new optionalreadConnectionState()method. It returnsunbound,connecting, orready. A newCommerceConnectionStatetype is exported.GET /configreturns{ state: 'unbound' }or{ state: 'connecting' }without reading store credentials. Areadyresponse keeps the usualcartScopeandcurrencyCode. A host that does not implement the method gets the same response shape as before.ready. This happens before any upstream call.@godaddy/gd-commerce-storefrontCataloghas a newsampleProductsprop. Six generic products (Product 1–6, $10–$60 USD) appear only while the server reportsunbound. When a store is connected, the prop has no effect, and real empty, loading, and error states are never replaced by samples.unboundandconnectingstates. While it is not ready, it re-reads configuration every 5 seconds when the page is visible, so connecting a store activates the live catalog automatically. A failed refresh immediately shows an error and never falls back to samples.data-commerce-source="sample".Compatibility: older clients treat the new unbound response as an error, not as permission to show samples. Hosts that don't report connection state keep their current behavior. The library has no host-specific code; AAB is one host that will implement
readConnectionState().Changeset
.changeset/sample-products-before-connection.md, minor for both packages.Test Plan
Tested locally in AAB a simulated template scenario. Empty components were added to a real AAB app, then the agent was asked to connect real products and checkout. Everything worked fine. Need to publish for a full test.
pnpm --filter @godaddy/gd-commerce-server test: 176 passed. Covers the config states, rejection of non-ready states on data and checkout routes, and legacy response compatibility.pnpm --filter @godaddy/gd-commerce-storefront test: 41 passed. Covers:biome checkpasses for the storefront package.