Release Notes
v2.0.0
This release adds an “Order Completed” Segment event to the finalizeCheckout() method. Previously, finalizeCheckout() sent a “Checkout Completed” Segment event. Now, finalizeCheckout() sends both “Order Completed” and “Checkout Completed”.
No changes to your website code are required to upgrade to this release. However, we’re releasing this change as a new major version because the “Order Completed” event is a standard event that many Segment destinations process automatically, and adding it may impact the way your Segment destinations track conversions and revenue.
“Order Completed” is part of the Segment ecommerce event spec. It is usually mapped by default to standard conversion/purchase events in Segment destinations like the Facebook Pixel and TikTok Conversions destinations. You can override this mapping in the Segment destination settings. You may have changed the event mapping in your Segment destination settings to map “Checkout Completed” to the conversion/purchase event for the destination. This will continue to work.
The Chord OMS back-end Segment source has always sent an “Order Completed” event, and you may have connected Segment destinations to this source that are using this event to track conversions and revenue. We recommend continuing to rely on this “Order Completed” event, if possible, because events from back-end sources tend to be more reliable and accurate. (You can read more about this from Segment.)
If you currently have any Segment destinations connected to both the Chord OMS back-end Segment source (typically named "My Company Back-End (Production)”) and your website front-end Segment source (typically named "My Company Front-End (Production)”), you may want to add a destination filter to stop your destination from receiving “Order Completed” events from one of the two Chord Segment sources. If a destination receives an “Order Completed” event from both sources, that could result in revenue or conversions being double counted.
Note regarding the Google Universal Analytics Segment destination: This destination accepts total or revenue as a property on "Order Completed", but not both. The "Order Completed" event does include both of these properties, to match the Segment ecommerce spec and to be compatible with other Segment destinations. You may need to add a destination-specific transformation to remove one of the two properties.
v1.7.0
This release adds eventing for when a subscription is added or removed from the cart. Adding a subscription to the cart will trigger a Product Added event with the interval and actionable date attached to it. Removing a subscription from the cart will trigger a Product Removed event with the same attributes.
Reach out to Chord support for instructions on how to add these properties to your tracking plan.
v1.5.0 / v1.6.0
These releases introduce the ability to purchase prepaid / gift subscriptions in your storefront through the purchasePrepaidSubscription method in useCart. The purchasing flow for prepaid subscriptions roughly follows:
- Customer clicks purchase on the prepaid subscription.
- Storefront collects the email, name and shipping information for the recipient of prepaid subscription.
- That information is passed to the SDK method which will return a checkout session token.
- The caller should direct the customer directly to checkout, where the only item in the cart will be the prepaid subscription and the shipping information will already be filled in.
- Upon successful purchase, the subscription is immediately activated and will begin shipping to the recipient.
- In future releases, the shipping date, notifications and redemption methods will be controllable through this new method.
- If the customer backs out of the purchase, the order is lost.
More detailed documentation is below.
v1.2.0 / 1.3.0
These releases have several fixes related 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.
Here is an example of what that page might look like, should you need inspiration.
v1.0.0
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.
v0.1.0
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:
Typescript support
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.
JSDoc documentation
react-autonomy includes function documentation following the JSDoc specification.
Improved hooks and methods
Names, parameters, and behavior has been standardized across the SDK.