Repository navigation
feat!: build on @fleetbase/sdk 2 instead of a bundled 1.2.13 - #25
Merged
Merged
Conversation
POST customers/socket-token with the customer's Customer-Token header,
resolving to { token, expires_in, expires_at } (SocketTokenResponse).
Declarations under types/ updated by hand; dist/ needs regenerating.
The core SDK is now a regular dependency. Its ESM and CommonJS entries, declarations and Fetch transport resolve cleanly, so the module builds import it instead of inlining a copy, and applications that also use the core SDK share one copy of its resources and adapters. Only the browser bundle inlines it. - Drop the local @fleetbase/sdk declaration shim and the axios-era overrides. - Type resources and stores against the SDK 2 declarations; listing endpoints keep resolving to collections in Storefront's types. - Send no Customer-Token header when signed out instead of an empty one. - Rebuild dist and types.
3 of 4 tasks
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.
Why
Storefront 1.2.0 bundled its own frozen copy of
@fleetbase/sdk@1.2.13, axios included, into the ESM and CommonJS builds. As a result:@fleetbase/sdkstill made every Storefront request through the old axios adapter.instanceof Orderfailed), and adapter headers were stored in two different shapes.The bundle existed because 1.2.13's package entries didn't resolve in webpack or in CommonJS. SDK 2 fixed its packaging: proper
exports, its own declarations, and a dependency-free Fetch transport.What changes
@fleetbase/sdk^2.0.0becomes a regular dependency.@fleetbase/sdkdeclaration shim is removed. Sources are typed against the SDK 2 declarations.StorefrontStorenow relies on SDK 2'sStore, which already providesextendActionsandserialize. It narrowsfindAllandqueryto collections, so Storefront's public types are unchanged.StorefrontResourceexposesidas a string. It leavesupdateandemptyopen so cart and store APIs keep their own signatures.Customer-Tokenheader. Previously they sent an empty one.distandtypesare rebuilt.Behaviour notes (breaking, hence v2.0.0)
getAttribute(name, fallback)now returns the fallback fornullvalues as well as missing ones.setAdaptermethods onCustomerandDeliveryServiceQuoteare now inherited instead of redefined. The public API snapshot is updated for that; no method was removed.Stacking
This branch is built on #22 (
customer.socketToken()), so the two don't conflict overdistandtypes. Until #22 merges, this diff also shows #22's commits. Merge #22 first.Verification
update/emptyand missing store hours.@fleetbase/sdkexternally;Follow-up
Once fleetbase/fleetbase-js#47 publishes
@fleetbase/sdk2.1.0, raise the dependency to^2.1.0. That release fixes the Node transport (fleetbase/fleetbase-js#46), which matters for Storefront under Node and SSR.