4
0
forked from crowetic/commerce
Michael Bromley da4371090d
Vendure provider (#223)
* Minimal list/detail views working with Vendure

* Implement useCart/useAddItem

* Implement useUpdateItem & useRemoveItem

* Implement useSearch

* Add operations codegen, tidy up

* Dummy checkout page

* Implement auth/customer hooks

* Use env var for Shop API url

* Add some documentation

* Improve error handling

* Optimize preview image size

* Fix accidental change

* Update Vendure provider to latest changes

* Vendure provider: split out gql operations, remove unused files

* Update Vendure provider readme

* Add local next.config to Vendure provider, update docs

* Update to use demo server

* Fix build errors

* Use proxy for vendure api

* Simplify instructions in Vendure readme

* Refactor Vendure checkout api handler

* Improve image quality
2021-05-27 18:06:56 -03:00
..
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00
2021-05-27 18:06:56 -03:00

Vendure Storefront Data Hooks

UI hooks and data fetching methods built from the ground up for e-commerce applications written in React, that use Vendure as a headless e-commerce platform.

Usage

  1. Clone this repo and install its dependencies with yarn install or npm install
  2. Set the Vendure provider and API URL in your .env.local file:
    COMMERCE_PROVIDER=vendure
    NEXT_PUBLIC_VENDURE_SHOP_API_URL=https://demo.vendure.io/shop-api
    NEXT_PUBLIC_VENDURE_LOCAL_URL=/vendure-shop-api
    
  3. With the Vendure server running, start this project using yarn dev or npm run dev.

Known Limitations

  1. Vendure does not ship with built-in wishlist functionality.
  2. Nor does it come with any kind of blog/page-building feature. Both of these can be created as Vendure plugins, however.
  3. The entire Vendure customer flow is carried out via its GraphQL API. This means that there is no external, pre-existing checkout flow. The checkout flow must be created as part of the Next.js app. See https://github.com/vercel/commerce/issues/64 for further discusion.
  4. By default, the sign-up flow in Vendure uses email verification. This means that using the existing "sign up" flow from this project will not grant a new user the ability to authenticate, since the new account must first be verified. Again, the necessary parts to support this flow can be created as part of the Next.js app.

Code generation

This provider makes use of GraphQL code generation. The schema.graphql and schema.d.ts files contain the generated types & schema introspection results.

When developing the provider, changes to any GraphQL operations should be followed by re-generation of the types and schema files:

From the project root dir, run

graphql-codegen --config ./framework/vendure/codegen.json