Updated Saleor Provider (#356)

* Initial work, copied from the Shopify provider

* Added basis setup and type generation for the products queries

* refactor: adjust the types

* task: relax the Node.js constraint

* fix: page/product properties

* disable unknown fields

* mention Saleor in the README

* setup debugging for Next.js

* Check nextjs-commerce bug if no images are added for a product

* fix: client/server pecularities for env visibility

Must prefix with `NEXT_PUBLIC_` so that the API URL is
visible on the client

* re: make search work with Saleor API (WIP)

* task: update deps

* task: move to Webpack 5.x

* saleor: initial cart integration

* update deps

* saleor: shall the cart appear!

* task: remove deprecated packages

* saleor: adding/removing from the cart

* saleor: preliminary signup process

* saleor: fix the prices in the cart

* update deps

* update deps

* Added the options for a variant to the product page

* Mapped options to variants

* Mapped options to variants

* saleor: refine the auth process

* saleor: remove unused code

* saleor: handle customer find via refresh

temporary solution

* saleor: update deps

* saleor: fix the session handling

* saleor: fix the variants

* saleor: simplify the naming for GraphQL statements

* saleor: fix the type for collection

* saleor: arrange the error codes

* saleor: integrate collections

* saleor: fix product sorting

* saleor: set cookie location

* saleor: update the schema

* saleor: attach checkout to customer

* saleor: fix the checkout flow

* saleor: unify GraphQL naming approach

* task: update deps

* Add the env variables for saleor to the template

* task: prettier

* saleor: stub API for build/typescript compilation

thanks @cond0r

* task: temporarily disable for the `build`

* saleor: refactor GraphQL queries

* saleor: adjust the config

* task: update dependencies

* revert: Next.js to `10.0.9`

* saleor: fix the checkout fetch query

* task: update dependencies

* saleor: adapt for displaying featured products

* saleor: update the provider structure

* saleor: make the home page representable

* feature/cart: display the variant name (cond)

Co-authored-by: Patryk Zawadzki <patrys@room-303.com>
Co-authored-by: royderks <10717410+royderks@users.noreply.github.com>
This commit is contained in:
Jakub Neander
2021-06-10 08:46:28 +02:00
committed by GitHub
parent 685fb932db
commit 3b2bf654fe
115 changed files with 34182 additions and 1671 deletions

View File

@@ -0,0 +1,12 @@
import * as fragment from '../fragments'
export const CheckoutOne = /* GraphQL */ `
query CheckoutOne($checkoutId: UUID!) {
checkout(token: $checkoutId) {
... on Checkout {
...CheckoutDetails
}
}
}
${fragment.CheckoutDetails}
`

View File

@@ -0,0 +1,13 @@
export const CollectionMany = /* GraphQL */ `
query CollectionMany($first: Int!, $channel: String = "default-channel") {
collections(first: $first, channel: $channel) {
edges {
node {
id
name
slug
}
}
}
}
`

View File

@@ -0,0 +1,13 @@
import * as fragment from '../fragments'
export const CollectionOne = /* GraphQL */ `
query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = "default-channel") {
collection(id: $categoryId, channel: $channel) {
id
products(first: $first) {
...ProductConnection
}
}
}
${fragment.ProductConnection}
`

View File

@@ -0,0 +1,11 @@
export const CustomerCurrent = /* GraphQL */ `
query CustomerCurrent {
me {
id
email
firstName
lastName
dateJoined
}
}
`

View File

@@ -0,0 +1,7 @@
export const CustomerOne = /* GraphQL */ `
query CustomerOne($customerAccessToken: String!) {
customer(customerAccessToken: $customerAccessToken) {
id
}
}
`

View File

@@ -0,0 +1,16 @@
export const getAllProductVendors = /* GraphQL */ `
query getAllProductVendors($first: Int = 250, $cursor: String) {
products(first: $first, after: $cursor) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
vendor
}
cursor
}
}
}
`

View File

@@ -0,0 +1,16 @@
export const getAllProductsPathsQuery = /* GraphQL */ `
query getAllProductPaths($first: Int = 100, $cursor: String, $channel: String = "default-channel") {
products(first: $first, after: $cursor, channel: $channel) {
pageInfo {
hasNextPage
hasPreviousPage
}
edges {
node {
slug
}
cursor
}
}
}
`

View File

@@ -0,0 +1,14 @@
export { CollectionMany } from './collection-many'
export { ProductOneBySlug } from './product-one-by-slug'
export { ProductMany } from './product-many'
export { CollectionOne } from './collection-one'
export { CheckoutOne } from './checkout-one'
export { PageMany } from './page-many'
export { PageOne } from './page-one'
export { CustomerCurrent } from './customer-current'
// getCustomerIdQuery
export { CustomerOne } from './customer-one'
export { getAllProductsPathsQuery } from './get-all-products-paths-query'
export { getAllProductVendors } from './get-all-product-vendors-query'

View File

@@ -0,0 +1,13 @@
export const PageMany = /* GraphQL */ `
query PageMany($first: Int = 100) {
pages(first: $first) {
edges {
node {
id
title
slug
}
}
}
}
`

View File

@@ -0,0 +1,9 @@
export const PageOne = /* GraphQL */ `
query PageOne($id: ID!) {
page(id: $id) {
id
title
slug
}
}
`

View File

@@ -0,0 +1,15 @@
import * as fragment from '../fragments'
export const ProductMany = /* GraphQL */ `
query ProductMany(
$first: Int = 100
$filter: ProductFilterInput
$sortBy: ProductOrder
$channel: String = "default-channel"
) {
products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {
...ProductConnection
}
}
${fragment.ProductConnection}
`

View File

@@ -0,0 +1,43 @@
export const ProductOneBySlug = /* GraphQL */ `
query ProductOneBySlug($slug: String!, $channel: String = "default-channel") {
product(slug: $slug, channel: $channel) {
id
slug
name
description
pricing {
priceRange {
start {
net {
amount
}
}
}
}
variants {
id
name
attributes {
attribute {
name
}
values {
name
}
}
pricing {
price {
net {
amount
currency
}
}
}
}
media {
url
alt
}
}
}
`