These releases have several fixes releated to associating an existing guest cart with a user that has logged in passwordless, magic link contexts. The major change to be aware of here is that, eventually, your application is going to need to have a route that explictly handles the code exchange in these contexts. This should already be the case for users using chord-stytch, but will be a new requirement if you are using chord-magic with this library.
This release has authentication, cart, and user-related fixes that may be breaking in some contexts.
Previous to this, we were loading authentication tokens, carts, and users outside of our core Redux initialization logic and offloading that to application-level useEffects or in useEffects in useAuth, useCart, and useUser. With this release, we have moved those requests to the store initialization logic such that they are only requested once when the site loads for the first time. This change means that your application will make less requests and will sidestep a potential race condition around Chord's login logic.
What this means for you: If you have any calls in your components that use useAuth's getToken function, useCart's loadCart function, and/or useUser's loadUser function, you should probably remove those and respond to the state provided by these hooks.
This is the initial release.
Similar React hooks and methods were previously available in the Next.js starter and Gatsby theme. These have been moved into react-autonomy, and improved with these changes:
react-autonomy has complete Typescript support with type definitions.
Removed dependency on CMS product catalog
Previously, all products in the CMS had to belong to a single catalog. A bootstrapReduxStore query fetched the catalog from the CMS on every page, and Redux stored the catalog and used it to add product metadata, like descriptions and images, to product-related Segment tracking events. react-autonomy removes this dependency on a product catalog and instead adds an optional product argument to some SDK methods, allowing you to provide the product from the CMS and control the CMS query.
react-autonomy includes function documentation following the JSDoc specification.
Improved hooks and methods
Names, parameters, and behavior has been standardized across the SDK.