1.8.0 (2023-05-08)
1.7.1-beta.6 (2021-10-21)
- add common properties (8d3d3e6)
- add datefield specific properties (a3b4836)
- add number specific properties (614aaa5)
- add textfield specific properties (9643ada)
- Adds in inventory levels into product fragment
- Update graphql schema
- Add support for
DateFieldOption - Add support for
TextFieldOptionandMultiLineTextFieldOption - Add support for
NumberField
Fixes gift recipient typo.
Following the BigCommerce API, OptionSelection have to be an array.
Return only non-null cookies.
Allow to pass array of options to useAddItem, useUpdateItem and useRemoveItem as it's allowed in useCart.
This way, when using the hook of useCart with options, we can update its value through the rest of hooks if the same options are used. This is because behind the scenes we use swr in which the hook update depends on its input arguments. And the cart options are input arguments.
Add review summary to get product operation.
By default, the number of variants returned by the API is 10. This has been changed to the maximum (250) to cover cases where a product has many possible variants.
The new maximum number of products returned by the API is 50.
Add support to more values that are supported in the Customer V3 API:
- phone
- company
- notes
- addresses
- accepts_product_review_abandoned_cart_emails
In addition, eslint/prettier has been configured.
- Return (if exists) category images
- Return specific product options for checkbox option
- Return specific product options for product pick list option
- Return
isDefaultfor multiple choice option
Add the customer id (if the customer is logged) to the cart when creating it using the addItem hook
Export edit and delete handlers correctly. They were swapped.
Include the address folder to the package that will be uploaded to npm
- Allow to override the base URL of every hook
- Allow to override the API handlers
- Allow to set the
baseat Provider level. Thus, if it is set, all requests will be made with that base URL. - Allow to define the credentials that will be used in the network requests
Allow to define at hook level the parameter include, to be able to include more elements in the cart response. This allows, for example, to receive the different options of the products added to the cart.
const { data } = useCart({ include: ['line_items.physical_items.options']})Based on: https://developer.bigcommerce.com/api-reference/store-management/carts/cart/getacart
- Send customer on login response
- Set session and shopper cookies on login
- Export the customer handlers as we do in for the other resources
- Allow responses with http status code 204
With the current configuration, when receiving a 204 (no content) it tries to execute the .json() method and fails. With this change we prevent the call to that method if the status is 204.
- Return the brand name when requesting the products. Receiving only the id was of little use
- Update the schema including the brand name field
- Update the schema including latest changes in the Storefront GraphQL API
Right now, in the useAddItem, we use useRouter to get locale. This requires next as peer dependency, which isn't optimal, and was introduced in version v1.2.0 when adding locale support to the cart #41.
Now the locale will be obtained from the useCommerce as is done in other hooks such as usePrice.
Add a new useOrderProducts hook. Right now the useOrders hook doesn't include the products for each order due to limitations in the BigCommerce API. Thanks to this new hook you can get the products of a specific order.
API Reference: https://developer.bigcommerce.com/api-reference/store-management/orders/order-products/getallorderproducts
import useOrderProduct from "@bigcommerce/storefront-data-hooks/use-order-products"
const { data } = useOrderProduct({ orderId: 20015 })
Allow getting, adding, modifying and deleting customer addresses with hooks.
All hooks require the user to be authenticated, if not, they will return an error.
- New
useAddresseshook to get all the customer addresses (includes pagination) - New
useAddAddresshook to create a new address - New
useRemoveAddresshook to remove a specific address by id. - New
useUpdateAddresshook to update a existing address - Update de Readme to include examples of how to use the new hooks
Programmatically set the prototype to be able to check if a thrown Error is a BigCommerce Error. This is necessary because our compile target is ES5. Related issue: microsoft/TypeScript#22585
Resolves a bug where the user couldn't add new products to the cart because the current cart was invalid but never deleted.
Resolves 49
- The Bigcommerce API has changed the cookies it returns after login, now we specifically select the cookie we are interested in returning to the customer:
SHOP_TOKEN
- Fix a bug in the Login SSO sample code: The
urlparam must be passed inside theoptionsobject.
- Update
README.me - Add a new param to the
useSearchhook:page - Get the results based on the provided
page.
Resolves #38
- Return
basePricein the product query - Update GraphQL schema to generate the updated types (also includes updated types from the latest Storefront GraphQL API updates)
Related to #37
- Now the
SHOP_TOKENis set at TLD (Top Level Domain) so the subdomain (where the embedded checkout iframe lives) can access the token - Added a new section in the readme with some notes about how to make the checkout work
- Modified the
logoutendpoint to bePOSTto prevent unwanted caching
Allow to fetch the orders using a new useOrders hook.
- If the user is not logged in, nothing is returned.
- If the user is logged in, it returns an array with their orders.
- Get the customer ID on the server (through the token) to avoid security issues.
Resolves #25
When creating the carts, you can specify the locale. By default it's en, now the package checks the locale of the app to add it to the request.
next.
Resolves #30
- Fix typo in
- Add missing types to the
Cartbody
Resolves #22
- Accept
optionsin theuseLoginhook to allow Login SSO - Update Readme with a quick guide of using Login SSO
- Add a new key to
useSearch:categoryIds - Stringify
categoryIdsto use as a key in SWR - Add a deprecation warning to
categoryId
Resolves #9
- Set
variantIdas optional
Resolves #21
- Initial public release in support of https://nextjs.org/commerce