Coder Social home page Coder Social logo

graphcommerce-org / graphcommerce Goto Github PK

View Code? Open in Web Editor NEW
286.0 9.0 63.0 235.42 MB

GraphCommerce® is a headless storefront replacement for Magento 2 (PWA), that delivers a faster, better user experience. Fully customizable (React, Next.js) and open-source.

Home Page: https://www.graphcommerce.org

License: Other

JavaScript 2.78% TypeScript 97.02% CSS 0.20% MDX 0.01%
react magento2 pwa graphql ecommerce typescript headless

graphcommerce's Introduction

GraphCommerce Logo

📚 Docs | 🗣 Slack | 📝 Release notes

GraphCommerce is a framework for building headless ecommerce storefronts in React and Next.js. It provides a best-in-class example, including components and utilities, to deliver a high-performance, high-quality ecommerce Progressive Web App (PWA).

Explore the GraphCommerce demo or start building your custom GraphCommerce ecommerce frontend.

home.mp4

The GraphCommerce homepage, showcasing content from both Magento and Hygraph through a variety of included UX components.


Getting started with GraphCommerce

In this guide, you will set up a GraphCommerce app locally, allowing you to start building.

Requirements

  • Install and use node 16/18: nvm install 16 or nvm use 16
  • Install yarn: corepack enable

Step 1: Create a GraphCommerce app

git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git
# Clone repository
mkdir my-project
# Create project folder
cp -R graphcommerce/examples/magento-graphcms/. my-project && rm -rf graphcommerce && cd my-project
# Copy example, delete repo, navigate to project folder

Step 2: Configure API keys

(Optional, continue reading)

Step 3: Start the app

yarn
# Install the dependencies
yarn codegen
# Converts all .graphql files to typescript files
yarn dev
# Run the app

🎉 Explore your GraphCommerce app running at http://localhost:3000

(Explore the GraphQL Playground running at http://localhost:3000/api/graphql)

No success? Consult the troubleshooting guide

Next steps

  • The Quick start guide covers about 80% of the concepts you'll use, so it's a great place to start.
  • Start customizing to go from "Hello World" to a fully built GraphCommerce custom storefront.

graphcommerce's People

Contributors

action-simon avatar actions-user avatar bigpreshy avatar bramvanderholst avatar carlocarels90 avatar collymore avatar deam avatar dependabot-preview[bot] avatar dependabot[bot] avatar erwinotten avatar frankharland avatar giovanni-schroevers avatar github-actions[bot] avatar haelbichalex avatar hnsr avatar jessevdpoel avatar joshuas98 avatar kmalkowski avatar laurensfranken avatar leandermatse avatar lint-action avatar machielkreiken avatar maikel-koek avatar mikekeehnen avatar paales avatar rustmaestro avatar semantic-release-bot avatar stefanangenent avatar timhofman avatar yvog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphcommerce's Issues

More elaborate error reporting for calls from graphql-mesh

Describe the feature you'd like to request

We sometimes run into errors with calls made through graphql-mesh to external APIs. The current error reporting is not very verbose and I'd like more info on the exact call that errored

Describe the solution you'd like

An option to control verbosity of error logging for external API calls. It would be useful to see the API endpoint, HTTP error code, request body, request response and such

Describe alternatives you've considered

N/a

Module not found: Can't resolve './CartAgreements.gql'

Provide environment information

node 14.19.1

I have changed scripts to this as it wasn't working properly on windows.

"scripts": {
    "dev": "yarn concurrently -k -n codegen,next \"yarn codegen-base -w\" \"yarn next dev\"",
    "codegen": "yarn mesh build && find . -type f -name '*.gql.ts' -delete && yarn codegen-base",
    "build": "yarn codegen && yarn next build && yarn next-sitemap",
    "start": "next start",
    "tsc:lint": "yarn tsc --noEmit -p .",
    "lingui": "NODE_ENV=development lingui extract",
    "codegen-base": "yarn cross-env NEXT_PUBLIC_GRAPHQL_ENDPOINT=.mesh/schema.graphql yarn graphql-codegen"
  },

What browser are you using? (if relevant)

CHROME

How are you deploying your application? (if relevant)

yarn dev

Describe the Bug

The gql.ts files aren't generated.
error - ./node_modules/@graphcommerce/magento-cart/components/CartAgreementsForm/CartAgreementsForm.tsx:23:0
Module not found: Can't resolve './CartAgreements.gql'

Import trace for requested module:
./node_modules/@graphcommerce/magento-cart/components/index.ts
./node_modules/@graphcommerce/magento-cart/index.ts
./lib/graphql/GraphQLProvider.tsx
./pages/_app.tsx

Expected Behavior

Generation of gql.ts files.

To Reproduce

I run it on windows

Build error: "Checking validity of types" fails

Provide environment information

Node: v14.19.0
NPM: 6.5.0
Yarn: 1.22.19
Tsc: 4.7.4

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn next build

Describe the Bug

Executing the build command with yarn next build it fails with following error

./node_modules/@graphcommerce/framer-scroller/components/ScrollerPageCounter.tsx:27:18
Type error: Argument of type 'number | "?"' is not assignable to parameter of type 'SetStateAction<number>'.
  Type 'string' is not assignable to type 'SetStateAction<number>'.

  25 |         .sort((a, b) => b[1] - a[1])
  26 |
> 27 |       setCurrent(visibleItems[0]?.[0] ?? '?')
     |                  ^
  28 |     })
  29 |
  30 |     return (

> Build error occurred
Error: Call retries were exceeded
    at ChildProcessWorker.initialize (/Users/luna/progetti/mlive/song-service/webapp/node_modules/next/dist/compiled/jest-worker/index.js:1:11661)
    at ChildProcessWorker._onExit (/Users/luna/progetti/mlive/song-service/webapp/node_modules/next/dist/compiled/jest-worker/index.js:1:12599)
    at ChildProcess.emit (events.js:400:28)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12) {
  type: 'WorkerError'
}

Expected Behavior

Compile correctly the code

To Reproduce

git clone [email protected]:graphcommerce-org/graphcommerce.git
cp -r graphcommerce/examples/test-graphcommerce test-graphcommerce
cd test-graphcommerce
# follow README, so remove scripts and rename scripts_local in package.json
yarn
yarn codegen
yarn build

Type error: Module '"@graphcommerce/magento-cart-shipping-address"' has no exported member 'CustomerAddressForm'

Provide environment information

node 16

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn build

Describe the Bug

Type error: Module '"@graphcommerce/magento-cart-shipping-address"' has no exported member 'CustomerAddressForm'.

13 | import {
14 | ShippingAddressForm,

15 | CustomerAddressForm,
| ^
16 | } from '@graphcommerce/magento-cart-shipping-address'
17 | import { ShippingMethodForm } from '@graphcommerce/magento-cart-shipping-method'
18 | import { CustomerDocument } from '@graphcommerce/magento-customer'
error Command failed with exit code 1.

Expected Behavior

success

To Reproduce

fresh install
yarn dev

import {
  ShippingAddressForm,
  CustomerAddressForm,
} from '@graphcommerce/magento-cart-shipping-address'

magento-cart-shipping-address:

export * from './Api/BillingAddress.gql'
export * from './Api/ShippingAddress.gql'

export * from './components/ShippingAddressForm/ShippingAddressForm'

Type error: Module '"type-fest"' has no exported member 'OptionalKeysOf'

Provide environment information

Node: v14.21.1

Attempting to build and deploy the example project from the latest release.

https://github.com/graphcommerce-org/graphcommerce/releases/tag/release-1668690782656

Using a local dev environment, as well Netlify, and Vercel. Confirming build errors on all 3 environments using unmodified code and stock env file. Also testing using own instance of Magento/Hygraph

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn build, netlify, vercel

Describe the Bug

3:38:34 PM: info  - Checking validity of types...
3:38:54 PM: Failed to compile.
3:38:54 PM: 
3:38:54 PM: ./node_modules/@graphcommerce/next-ui/RenderType/filterNonNullableKeys.ts:1:15
3:38:54 PM: Type error: Module '"type-fest"' has no exported member 'OptionalKeysOf'.
3:38:54 PM: > 1 | import type { OptionalKeysOf, Simplify } from 'type-fest'
3:38:54 PM:     |               ^
3:38:54 PM:   2 | 
3:38:54 PM:   3 | export type RequiredKeys<
3:38:54 PM:   4 |   T extends Record<string, unknown>,
3:38:54 PM: > Build error occurred

Expected Behavior

I was expecting to build to example project from latest release

To Reproduce

Follow the Getting Started docs.
https://www.graphcommerce.org/docs/getting-started/create

Stop at step 3.

  • run yarn
  • run yarn lingui (not sure if this is required or not)
  • run yarn build
  • observe Checking validity of types step

error Command failed with exit code 1

Provide environment information

v19.2.0

What browser are you using? (if relevant)

Version 107.0.5304.122

How are you deploying your application? (if relevant)

yarn dev

Describe the Bug

warning Resolution field "@graphql-tools/[email protected]" is incompatible with requested version "@graphql-tools/[email protected]"
success Already up-to-date.
$ is-monorepo '[pkgrun] postinstall' '[pkgrun] patch-package'
'postinstall'' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.

this is what im getting im trying to find the issue but not happening BTW im using windows 10

Expected Behavior

i wanted Dev just to work fine

To Reproduce

just will write yarn

Create project cli command

Currently the installation instructions requires quite a bit of manual setup. It would be nice if we could install it with a single command.

"View shopping cart" button moves after "Complete your purchase" section loads (behaviour after adding product to cart on mobile)

Describe the Bug

I think that a button after being displayed should stay in one place instead of being pushed to the top right after by the element below it. It's very easy to click on a product instead of a button and it's a frustrating experience for the user.

Expected Behavior

The "complete your purchase" products could load above the "view shopping cart" button (it wouldn't move in this case). I guess the same issue exists for the close cross icon on the top right corner of this whole element but I don't think that is that important as most people will probably close the element by tapping above it or sliding it down.

To Reproduce

Just add a product to the cart on a mobile device.

Support for Magento Customer group pricing

Describe the feature you'd like to request

Magento supports customer group pricing out of the box, we'd like to support that.

Describe the solution you'd like

I'd like the website to remain fast and does't multiply the server load. So I'd like to be able to fetch price information on the client, in a middleware or with React Server Components.

Describe alternatives you've considered

None

Win NAT locking port 3000 stops "yarn dev" command running successfully

Provide environment information

v14.19.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn dev

Describe the Bug

This bug report contains a fix that may help others who run into the same issue.

When booting the GraphCommerce demo app from a clean pull of the repo a required listener on port 3000 cannot be subscribed to. This appears to be due to the Windows NAT programme locking port 3000.

Fix
Stopping and restarting the Win NAT service appears to resolve the issue.

net stop winnat
net start winnat

Then run:
yarn dev

Error Output
Running the "yarn dev" command from the root dir of the GraphCommerce demo project results in the below output:

magento-graphcms> yarn dev
yarn run v1.22.5
warning ..\..\..\package.json: No license field
$ yarn concurrently -k -n codegen,next "yarn codegen-base -w" "yarn next dev"
warning ..\..\..\package.json: No license field
$ C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\.bin\concurrently -k -n codegen,next "yarn codegen-base -w" "yarn next dev"
warning ..\..\..\package.json: No license field
warning ..\..\..\package.json: No license field
$ yarn graphql-codegen -w
$ C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\.bin\next dev
[next] Error: listen EACCES: permission denied 0.0.0.0:3000
[next]     at Server.setupListenHandle [as _listen2] (net.js:1314:21)
[next]     at listenInCluster (net.js:1379:12)
[next]     at Server.listen (net.js:1465:7)
[next]     at C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\next\dist\server\lib\start-server.js:45:16
[next]     at new Promise (<anonymous>)
[next]     at Object.startServer (C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\next\dist\server\lib\start-server.js:19:12)
[next]     at nextDev (C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\next\dist\cli\next-dev.js:114:23)
[next]     at C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\next\dist\bin\next:141:34 {
[next]   code: 'EACCES',
[next]   errno: -4092,
[next]   syscall: 'listen',
[next]   address: '0.0.0.0',
[next]   port: 3000
[next] }
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
[next] yarn next dev exited with code 1
--> Sending SIGTERM to other processes..
warning ..\..\..\package.json: No license field
$ C:\dev\react\graphcommerce-magento-demo\magento-graphcms\node_modules\.bin\graphql-codegen -w
[codegen] yarn codegen-base -w exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected Behavior

The GraphCommerce app demo boots with a homepage accessible via:
http://localhost:3000/

To Reproduce

Download the example

git clone [email protected]:graphcommerce-org/graphcommerce.git
mkdir my-project
cp -R graphcommerce/examples/magento-graphcms/. my-project && rm -rf graphcommerce
cd my-project
cp -R .env.example .env
rm CHANGELOG.md
rm -rf node_modules && rm -rf .next

Edit /package.json. Delete "scripts": {...} and rename scripts_local to scripts.

Start the development environment
yarn - Install the dependencies
yarn codegen - Converts all .graphql files to typescript files
yarn dev - Run the app

https://www.graphcommerce.org/docs/getting-started/create#step-1-create-a-new-graphcommerce-app

Error: useLingui hook was used without I18nProvider.

Provide environment information

Node v14.19.3

What browser are you using? (if relevant)

Google Chrome

How are you deploying your application? (if relevant)

yarn dev

Describe the Bug

Server Error

Error: useLingui hook was used without I18nProvider.

This error happened while generating the page. Any console logs will be displayed in the terminal window.

Call Stack
useLingui
file:///Users/john/Documents/GitHub/ecom/node_modules/@lingui/react/cjs/react.development.js (21:13)
Trans
file:///Users/john/Documents/GitHub/ecom/node_modules/@lingui/react/cjs/react.development.js (246:20)
renderWithHooks
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5658:16)
renderIndeterminateComponent
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5731:15)
renderElement
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5946:7)
renderNodeDestructiveImpl
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderNode
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6259:12)
renderChildrenArray
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6211:7)
renderNodeDestructiveImpl
file:///Users/john/Documents/GitHub/ecom/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6141:7)

Expected Behavior

It should work as graphcommerce demo store.

To Reproduce

Install and use node 14: nvm install 14 && nvm use 14
Install yarn: npm install --global yarn

Download the example

git clone [email protected]:graphcommerce-org/graphcommerce.git
mkdir my-project
cp -R graphcommerce/examples/magento-graphcms/. my-project && rm -rf graphcommerce
cd my-project
cp -R .env.example .env
rm CHANGELOG.md
rm -rf node_modules && rm -rf .next

Edit /package.json. Delete "scripts": {...} and rename scripts_local to scripts:

yarn Instal
yarn codegen
yarn dev

When creating your first adress in my account section, default shipping/billing adress is not toggled

Provide environment information

v16.15.0

What browser are you using? (if relevant)

Brave Versie 1.39.111 Chromium: 102.0.5005.61 (Officiële build) (arm64)

How are you deploying your application? (if relevant)

No response

Describe the Bug

When creating your first adress through the 'my account' section, the default shipping and default billing flags aren't set. This causes issues in the checkout where you are unable to select a shipping method.

CleanShot 2022-06-08 at 09 48 44

Expected Behavior

I expect when I create my first adress in my account, it will be the default for shipping and billing. So flagged accordingly.

To Reproduce

  1. Create an account
  2. Login to account
  3. Go to my account section -> adresses
  4. Create a new adres
  5. Fill in the proper fields and add it

Now the adres is created but the flags aren't set.

Cannot npm install

Provide environment information

  • node -v:
    8.19.2
  • npm -v
    8.19.2
  • uname -a:
    Linux manjaro 5.10.154-1-MANJARO # 1 SMP PREEMPT Thu Nov 10 20:51:28 UTC 2022 x86_64 GNU/Linux

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

On npm install

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @graphcommerce/[email protected]
npm ERR! Found: @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR!   @mui/material@"5.10.0" from the root project
npm ERR!   peer @mui/material@"5.10.0" from @graphcommerce/[email protected]
npm ERR!   node_modules/@graphcommerce/googleanalytics
npm ERR!     @graphcommerce/googleanalytics@"5.0.0" from the root project
npm ERR!   5 more (@graphcommerce/magento-wishlist, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @mui/material@"5.5.3" from @graphcommerce/[email protected]
npm ERR! node_modules/@graphcommerce/demo-magento-graphcommerce
npm ERR!   @graphcommerce/demo-magento-graphcommerce@"5.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @mui/[email protected]
npm ERR! node_modules/@mui/material
npm ERR!   peer @mui/material@"5.5.3" from @graphcommerce/[email protected]
npm ERR!   node_modules/@graphcommerce/demo-magento-graphcommerce
npm ERR!     @graphcommerce/demo-magento-graphcommerce@"5.0.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Expected Behavior

It should install

To Reproduce

  1. git clone -b main --depth 1 https://github.com/graphcommerce-org/graphcommerce.git
  2. mkdir my-project
  3. cp -R graphcommerce/examples/magento-graphcms/. my-project
  4. cd my-project
  5. cp -R .env.example .env
  6. rm CHANGELOG.md
  7. rm -r node_modules && rm -r .next
  8. npm install

[RFC] Automatic upgrading of the package.json

Describe the feature you'd like to request

At the moment is kinda error-prone to do an upgrade and I would say that about 50% of the issues reported when upgrading are due to a version mismatch, missing packages.

Describe the solution you'd like

The tool should do the following:

  • Update all known versions that are used, that means that all @graphcommerce/* packages can be upgraded as well as all the package versions of the example.
  • Report missing packages that are in the example, but not in the local package.
  • Report additional packages that are installed.

Describe alternatives you've considered

Manual upgrades like we use now.

error running codegen when removing a source from .meshrc.yml

Provide environment information

v16.15.1

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

when running mesh build on the latest @graphcommerce/[email protected] and @graphcommerce/[email protected] the cli throws an error on each graphqls schema:

💥 🕸️  Mesh Error: Directive "@injectable" already exists in the schema. It cannot be redefined.

Directive "@in...

ONLY when a single source is present in the .meshrc.yml config file

I realize this use case for graphql mesh is weird because it defeats its purpose, but we don't need graphcms in our project.

using the same source twice with a different name works for some reason

Expected Behavior

mesh building a single source

To Reproduce

remove graphcms source from .meshrc.yml, but it should throw the same error even if removing m2 source

Make it possible to have a generic url's for static pages instead of /pages/...

Describe the feature you'd like to request

At the moment it ain't possible to have url's for pages such as /about or /privacy. Instead, you need to create static pages like /pages/about or /pages/privacy, due to file based routing in NextJS.

Describe the solution you'd like

I would like to have the opportunity to create pages without /pages in their url. As an example for the about page. At the moment we can only create (or route to) such a page by passing /pages/about as the url. Instead I would like to just have /about.

Describe alternatives you've considered

As an alternative you can create a directory/routing in your project named "about". But this won't be as generic because you would have to do this for all locales and page types.

Improvement of Magento store configuration with separate file

Describe the feature you'd like to request

Provide a more detailed configuration file for stores to deal with M2 store_code, i18n configuration, subfolders and others store's specific configurations.
Allow M2 i18n locale not based on website's subfolder.
Allow different localizations for countries sharing the same language (en-us, en-gb...)

Describe the solution you'd like

Upgrade .env file to remove store configurations and move them into a separate json file to provide more options by store.
EG.:

STORES = {
    'en' : {
        'store_code': 'en_int',
        'i18n': 'en',
        'incl_tax': true,
        ...
    },
    'en-us' : {
        'store_code': 'en_us',
        'i18n': 'en-us',
        'incl_tax': true,
        ...
    },
    'en-gb': {
        'store_code': 'en_gb',
        'i18n': 'en-gb',
        'incl_tax': true,
        ...
    },
    'jp': {
        'store_code': 'ja_jp',
        'i18n': 'ja-jp',
        'incl_tax': false,
        ...
    },
    ...
}

This is an exemple with /subfolder/ as main key but it can also be M2 store_code
We can also imagine lingui i18n fallback and plural configuration here, and maybe different base urls by stores in the future

Describe alternatives you've considered

Add a second configuration in .env file to separate M2 store_code locale and i18n locale:

NEXT_PUBLIC_LOCALE_STORES='{"en-us": "en_US", "nl": "nl_NL", "fr-be": "fr_BE", "nl-be": "nl_BE", "en-gb": "en_GB", "en-ca": "en_CA"}'

NEXT_PUBLIC_LOCALE_I18N='{"en-us": "en-us", "nl": "nl-nl", "fr-be": "fr-be", "nl-be": "nl-be", "en-gb": "en-gb", "en-ca": "en-ca"}'

and provide a localeToI18n function in lingui-next to adapt LinguiProvider.tsx and withLingui.tsx

[RFC] Multi backend optional packages support

Describe the feature you'd like to request

  • GraphCommerce should able to have packages that depend on other services than only magento+graphcms
  • GraphCommerce should be able to have multiple examples that all have their own slice of features

What will this enable:

  • A Magento+Pagebuilder example without any GraphCMS support
  • The groundwork to enable completely different platform support

What are we running into

Currently we assume a single Magento backend to test all features against; https://backend.reachdigital.dev/graphql

This poses a problem as this backend has both more and less features as other backends at the same time:

  • It has all bundled modules installed, so it has support for Braintree which not all Magento endpoints have
  • It has a third party module installed for Mollie
  • It doesn't have any third-party packages installed that could very well be installed, like the Magento PWA module or any third party plugin with GraphQL support.

When a new GraphCommerce user is following the installation instructions they are required to remove Mollie and Braintree from their setup if they don't have the required Magento backend modules installed.

Or in other words: The user's gernerated GraphQL Mesh schema doesn't have the required Mollie or Braintree GraphQL schema fields available.

So this problem isn't specifically a problem with Magento, but a more general problem that the build GraphQL Mesh schema (the output in the .mesh directory) isn't compatible with the queries that a package might want to call, for example:

This issue also exists the other way around: Our generated GraphQL mesh doesn't provide the fields but PR's want to include queries that assume queries, for example we are working on.


Postcode validation example

The postcode validation service would like to be able to run the following query:

fragment PostcodeFields on query_postcodeServiceNL {
  success
  straatnaam
  woonplaats
}
query Postcode($postcode: ID!, $houseNumber: ID!) {
  postcodeServiceNL(postcode: $postcode, housenumber: $houseNumber) {
      ...PostcodeFields
  }
}

With the current setup in GraphCommerce this results in the following error:

Generate [failed]
→ Fragment "PostcodeFields" is set on non-existing type "query_postcodeServiceNL"!

To make this service work we need to define a new entry in the .meshrc.yml file:

sources:
  - name: postcodeService
    handler:
      jsonSchema:
        baseUrl: https://api.postcodeservice.com
        operations:
          - type: Query
            field: postcodeServiceNL
            path: /nl/v3/json/getAddress/index.php?postcode={args.postcode}&huisnummer={args.housenumber}&client_id={env.POSTCODESERVICE_CLIENT_ID}&secure_code={env.POSTCODESERVICE_SECURE_CODE}
            method: GET
            responseSample: '{"success":true,"straatnaam":"Hertshoornvaren","woonplaats":"Bergschenhoek"}'

This currently however is a manual instruction and isn't automated.

However, not all customers would like to have this functionality and we don't even want to have this functionality in the demo at the moment. This doesn't mean that the feature isn't valuable however, so we we want to have full support these kinds of packages.

Describe the solution you'd like

I think a few features would solve this:

1. Composable mesh configuration files

yarn mesh build should be able to find partial .meshrc.yml files inside each package and merge it with the root .meshrc.yml.

We currently already modify the .meshrc.yml and write it to a temporary .meshrc location and use that one for actual code generation.

2. GraphQL code generation based based on installed packages

Currently we simply do a wildcard match to find all schema files and find all documents.

This should be modified to only scan for schema files and documents that that are installed dependencies in your package.json or indirect dependencies that are used.

Current available groundwork

We do have a somewhat similar feature in the codebase somewhere. Currently packages are all written in typescript and aren't transpiled when published to NPM (because we need to generate the the graphql files etc.), so we transpile them during build time with next-transpile-modules.

However, next-transpile-modules only accepts full module paths. So we already generate a list of packages based on the installed packages.

We can reuse this list to limit the search area of the point 1 and 2.

To enable also including your own packages in this transpilation step and therefor in the future in feature 1 and 2 you would simply need to configure the namespaces that are used with withYarn1Scopes(["@graphcommerce", "@yournamespace"]).

Describe alternatives you've considered

In general I'm against introducing 'magic' that adds functionality automatically when installing packages but it seems a fair tradeoff since we are already non-standard by transpiling typescript and generating gql.ts files.

NPM support

Describe the feature you'd like to request

May I know how to run the demo in NPM environment?

Describe the solution you'd like

currently stucked in yarn list info --json error

Describe alternatives you've considered

currently stucked in yarn list info --json error

Automatically insert the typePolicies keyfields into query

Describe the feature you'd like to request

I'd like for this issue to be automatically resolved as it seems redundant

Invariant Violation: Missing field 'uid' while extracting keyFields from {"__typename":"CustomizablePackagingOption"}

Describe the solution you'd like

I'd like GraphQL Codegen to automatically insert the uid /etc. in any generated query: https://github.com/graphcommerce-org/graphcommerce/blob/main/packages/magento-graphql/typePolicies.ts

I'd like for the typePolicies file to be automatically generated for all uid fields or Apollo Client to automatically look for uid fields.

Describe alternatives you've considered

Currently it can happen that there is a very obtrusive error that isn't shown clearly.

Support for customer specific pricing from Magento or my own ERP

Describe the feature you'd like to request

I want to be able to have customer specific pricing for any product directly from my ERP.

Describe the solution you'd like

I'd like to be able to get customer specific pricing from any GraphQL query and have the rest of the system 'just work'.

Describe alternatives you've considered

There is already group based pricing here #1370, so it should probably be something similar to that, but this seems to require more granularity.

Create address, have to save twice

Provide environment information

graphcommerce.vercel.app

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

When logged in and saving a new address you have to press "save" twice.

Expected Behavior

Only press "save" once when saving an address to close the dialog

To Reproduce

  • create account
  • create address and save

Build error occured

Provide environment information

MacOS Monterey

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn build

Describe the Bug

Getting a build error

/account/contact
/account/name
/500
info - Generating static pages (45/45)

Build error occurred
[Error: ENOENT: no such file or directory, rename '.next/export/en/product.html' -> '.next/server/pages/en/product.html'] {
errno: -2,
code: 'ENOENT',
syscall: 'rename',
path: '.next/export/en/product.html',
dest: '.next/server/pages/en/product.html'
}

Expected Behavior

Should build successfully

To Reproduce

yarn build

Build failed: Unable to find field "createKlarnaPaymentsSession" on type "Mutation"!

Provide environment information

yarn run v1.19.1
node v16

What browser are you using? (if relevant)

Chrome Version 104.0.5112.79 (Official Build) (64-bit)

How are you deploying your application? (if relevant)

vercel

Describe the Bug

[SUCCESS] Generate ../../node_modules/@graphcommerce/graphql/generated/fragments.json

19:37:18.510 | [STARTED] Generate to ../../ (using EXPERIMENTAL preset "@graphcommerce/graphql-codegen-near-operation-file")
19:37:18.510 | [STARTED] Load GraphQL schemas
19:37:18.510 | [SUCCESS] Load GraphQL schemas
19:37:18.510 | [STARTED] Load GraphQL documents
19:37:18.712 | [SUCCESS] Load GraphQL documents
19:37:18.712 | [STARTED] Generate
19:37:22.494 | [FAILED] Unable to find field "createKlarnaPaymentsSession" on type "Mutation"!
19:37:22.494 | [SUCCESS] Generate outputs
19:37:22.524 | error Command failed with exit code 1.
19:37:22.524 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
19:37:22.534 | Error: Command "yarn run build" exited with 1

Expected Behavior

it should build fine

To Reproduce

cloned from main branch and connected same to vercel.
note : i have no klarna payments method.

Facing issue in safari browsers for account section

Provide environment information

i have added my env for public graphql.

What browser are you using? (if relevant)

safari : 15.4.1

How are you deploying your application? (if relevant)

vercel

Describe the Bug

https://graphcommerce-rajneesh-49xony8fx-irajneeshgupta.vercel.app/
i have deployed this app on vercel and everything is perfect except the client side exception that i face in safari browser : 15.4.1 latest.
Steps :

  1. register a account
  2. try to login same account
  3. you will successfully logged in.
  4. click on view account. (At this step it will try to fetch accont and not working for safari) for reference i added the screenshot
    https://graphcommerce-rajneesh-49xony8fx-irajneeshgupta.vercel.app/account
    image

Expected Behavior

It should open account details for logged in customer.

To Reproduce

Steps :
My deployed instance: https://graphcommerce-rajneesh-49xony8fx-irajneeshgupta.vercel.app/

  1. register a account
  2. try to login same account
  3. you will successfully logged in.
  4. click on view account. (At this step it will try to fetch accont and not working for safari)

Next.js 13 next/image support

Describe the feature you'd like to request

We currently use our own @graphcommerce/image package which has the same idea as the new next/image component.

Describe the solution you'd like

Move the internal code of @graphcommerce/image to next/image, but keep the API compatible.

Describe alternatives you've considered

Removing @graphcommerce/image completely, but I don't think that is necessary as that would become a breaking change.

Investigate the move to graphql-let

At the moment we're using GraphQL Code Generator to generate graphql documents and typescript declarations. It would be nice if we don't need to run this as a separate project. There exists a project graphql-let, which does somewhat the same, but via webpack/babel

Graphql Let uses GraphQL Code Generator internally so the projects aren't that different :)

Mega Menu

Describe the feature you'd like to request

We need to show child items in the menu without having to recreate the entire menu

Describe the solution you'd like

Please add the sub categories menu with parent category menus

Describe alternatives you've considered

We have not considered alternatives yet

Can't pass headers to graphcms backend

Provide environment information

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Expected Behavior

To Reproduce

GraphQL: Automatic persisted queries

magento/magento2#32543

Alternative: https://github.com/scandipwa/persisted-query
Alternative2: https://github.com/danslo/m2-module-automatic-persisted-queries

Mesh:

Enable Varnish caching for the backend:

  • Implement Automatic Persisted Queries in Magento
  • Implement Automatic Persisted Queries functionality in GraphQL Mesh

Frontend:

Automatic Persisted Queries for the frontend to reduce network overhead (does not rely on the backend implementation at all):

  • Implement Automatic Persisted Queries in Apollo Server
  • Implement Automatic Persisted Queries in Apollo Client

error while yarn codegen

Provide environment information

/node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph
ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"!
Error: Unable to validate GraphQL document!
node version: v14.19.1

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Following Your Readme file

Describe the Bug

note that i have tested it on local magento 2.4.4 instance and it failed to compile.
yarn codegen
/node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph
ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"!
Error: Unable to validate GraphQL document!
node version: v14.19.1

Expected Behavior

It should generate all required files.

To Reproduce

note that i have tested it on local magento 2.4.4 instance and it failed to compile.
yarn codegen
/node_modules/@graphcommerce/mollie-magento-payment/components/MolliePaymentHandler/MolliePaymentHandler.graph
ql caused error: Unable to find field "mollieProcessTransaction" on type "Mutation"!
Error: Unable to validate GraphQL document!
node version: v14.19.1

Lingui related errors

Provide environment information

node v14.19.3

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

yarn build

Describe the Bug

Failed to compile.

./node_modules/@graphcommerce/lingui-next/components/LinguiProvider.tsx:60:24
Type error: Type 'import("/Users/john/Documents/GitHub/ecom/node_modules/@lingui/core/cjs/i18n").I18n' is not assignable to type 'import("/Users/john/Documents/GitHub/ecom/node_modules/@lingui/react/node_modules/@lingui/core/cjs/i18n").I18n'.
Types have separate declarations of a private property '_events'.

58 | }, [locale])
59 |

60 | return <I18nProvider i18n={i18n} {...i18nProviderPRops} />
| ^
61 | }
62 |

Expected Behavior

It should build production version without error.

To Reproduce

Run yarn build

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.