feat(saleor): Phase 1 - GraphQL Client Setup

- Add Apollo Client for Saleor GraphQL API
- Create GraphQL fragments (Product, Variant, Checkout)
- Create GraphQL queries (Products, Checkout)
- Create GraphQL mutations (Checkout operations)
- Add TypeScript types for Saleor entities
- Add product helper functions
- Install @apollo/client and graphql dependencies

Part of WordPress/WooCommerce → Saleor migration
This commit is contained in:
Unchained
2026-03-21 12:36:21 +02:00
parent db1914d69b
commit 7b94537670
27 changed files with 7879 additions and 3 deletions

View File

@@ -0,0 +1,81 @@
import { gql } from "@apollo/client";
import { PRODUCT_VARIANT_FRAGMENT } from "./Variant";
export const PRODUCT_FRAGMENT = gql`
fragment ProductFragment on Product {
id
name
slug
description
seoTitle
seoDescription
translation(languageCode: $locale) {
id
name
slug
description
seoTitle
seoDescription
}
variants {
...ProductVariantFragment
}
media {
id
url
alt
type
}
category {
id
name
slug
}
metadata {
key
value
}
}
${PRODUCT_VARIANT_FRAGMENT}
`;
export const PRODUCT_LIST_ITEM_FRAGMENT = gql`
fragment ProductListItemFragment on Product {
id
name
slug
description
translation(languageCode: $locale) {
id
name
slug
description
}
variants {
id
name
sku
quantityAvailable
pricing {
price {
gross {
amount
currency
}
}
onSale
discount {
gross {
amount
currency
}
}
}
}
media {
id
url
alt
}
}
`;