Skip to content

Commit 3b2bf65

Browse files
zaistepatrysroyderks
authored
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>
1 parent 685fb93 commit 3b2bf65

File tree

115 files changed

+34172
-1661
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+34172
-1661
lines changed

.env.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN=
1313

1414
NEXT_PUBLIC_SWELL_STORE_ID=
1515
NEXT_PUBLIC_SWELL_PUBLIC_KEY=
16+
17+
NEXT_PUBLIC_SALEOR_API_URL=
18+
NEXT_PUBLIC_SALEOR_CHANNEL=

.prettierrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,13 @@
22
"semi": false,
33
"singleQuote": true,
44
"tabWidth": 2,
5-
"useTabs": false
5+
"useTabs": false,
6+
"overrides": [
7+
{
8+
"files": ["framework/saleor/**/*"],
9+
"options": {
10+
"printWidth": 120
11+
}
12+
}
13+
]
614
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Demo live at: [demo.vercel.store](https://demo.vercel.store/)
1111
- Swell Demo: https://swell.vercel.store/
1212
- BigCommerce Demo: https://bigcommerce.vercel.store/
1313
- Vendure Demo: https://vendure.vercel.store
14+
- Saleor Demo: https://saleor.vercel.store/
1415

1516
## Features
1617

@@ -26,7 +27,7 @@ Demo live at: [demo.vercel.store](https://demo.vercel.store/)
2627

2728
## Integrations
2829

29-
Next.js Commerce integrates out-of-the-box with BigCommerce and Shopify. We plan to support all major ecommerce backends.
30+
Next.js Commerce integrates out-of-the-box with BigCommerce, Shopify and Saleor. We plan to support all major ecommerce backends.
3031

3132
## Considerations
3233

assets/base.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,3 @@ a {
127127
opacity: 1;
128128
}
129129
}
130-

assets/components.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.fit {
22
min-height: calc(100vh - 88px);
3-
}
3+
}

codegen.bigcommerce.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"schema": {
3+
"https://buybutton.store/graphql": {
4+
"headers": {
5+
"Authorization": "Bearer xzy"
6+
}
7+
}
8+
},
9+
"documents": [
10+
{
11+
"./framework/bigcommerce/api/**/*.ts": {
12+
"noRequire": true
13+
}
14+
}
15+
],
16+
"generates": {
17+
"./framework/bigcommerce/schema.d.ts": {
18+
"plugins": ["typescript", "typescript-operations"]
19+
},
20+
"./framework/bigcommerce/schema.graphql": {
21+
"plugins": ["schema-ast"]
22+
}
23+
},
24+
"hooks": {
25+
"afterAllFileWrite": ["prettier --write"]
26+
}
27+
}

codegen.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
{
22
"schema": {
3-
"https://buybutton.store/graphql": {
4-
"headers": {
5-
"Authorization": "Bearer xzy"
6-
}
7-
}
3+
"https://master.staging.saleor.cloud/graphql/": {}
84
},
95
"documents": [
106
{
11-
"./framework/bigcommerce/api/**/*.ts": {
7+
"./framework/saleor/utils/queries/get-all-products-query.ts": {
8+
"noRequire": true
9+
}
10+
},
11+
{
12+
"./framework/saleor/utils/queries/get-all-products-paths-query.ts": {
13+
"noRequire": true
14+
}
15+
},
16+
{
17+
"./framework/saleor/utils/queries/get-products.ts": {
1218
"noRequire": true
1319
}
1420
}
1521
],
1622
"generates": {
17-
"./framework/bigcommerce/schema.d.ts": {
23+
"./framework/saleor/schema.d.ts": {
1824
"plugins": ["typescript", "typescript-operations"]
1925
},
20-
"./framework/bigcommerce/schema.graphql": {
26+
"./framework/saleor/schema.graphql": {
2127
"plugins": ["schema-ast"]
2228
}
2329
},

commerce.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"features": {
3-
"wishlist": true
3+
"wishlist": false,
4+
"customCheckout": false
45
}
56
}

components/cart/CartItem/CartItem.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,14 @@ const CartItem = ({
108108
<div className="flex-1 flex flex-col text-base">
109109
<Link href={`/product/${item.path}`}>
110110
<span
111-
className="font-bold text-lg cursor-pointer leading-6"
112111
onClick={() => closeSidebarIfPresent()}
113112
>
114-
{item.name}
113+
<div
114+
className="font-bold text-lg cursor-pointer leading-6"
115+
>
116+
{item.name}
117+
</div>
118+
{item.variant ? <span> {item.variant.name}</span> : ""}
115119
</span>
116120
</Link>
117121
{options && options.length > 0 ? (

components/common/Layout/Layout.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,8 @@ const Layout: FC<Props> = ({
4949
children,
5050
pageProps: { categories = [], ...pageProps },
5151
}) => {
52-
const {
53-
displaySidebar,
54-
displayModal,
55-
closeSidebar,
56-
closeModal,
57-
modalView,
58-
} = useUI()
52+
const { displaySidebar, displayModal, closeSidebar, closeModal, modalView } =
53+
useUI()
5954
const { acceptedCookies, onAcceptCookies } = useAcceptCookies()
6055
const { locale = 'en-US' } = useRouter()
6156

0 commit comments

Comments
 (0)