Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Commerce Layer Provider #517

Closed
wants to merge 66 commits into from

Conversation

BolajiAyodeji
Copy link

@BolajiAyodeji BolajiAyodeji commented Oct 1, 2021

This PR adds Commerce Layer to the list of supported providers with the required hooks. This is a work in progress and is almost ready for production. Here's a brief summary of what we have currently and WIP features:

  • API Endpoint - Checkout
  • API Operations - Get all pages
  • API Operations - Get all products path
  • API Operations - Get all products
  • API Operations - Get product
  • API Operations - Get customer wishlist
  • API Operations - Get page
  • API Operations - Get product
  • Feature - Cart
  • Feature - Search
  • Feature - Wishlist
  • Feature - Customer Auth
  • Feature - External Checkout
  • Feature - Categories
  • Feature - CMS integration
  • Provider documentation

We used the local provider as the base, and we're working on completing the pending issues and features. There will be a lot of conflicts which we will fix since we forked this some months ago. So I'll be creating this PR in draft mode, do take a look and leave comments so we know if we're in the right direction; cheers!

@vercel
Copy link

vercel bot commented Oct 1, 2021

@BolajiAyodeji is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

commerce-local – ./site

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-local/7vzbyThMtdpCM6QbBbReKgLAYqZb
✅ Preview: https://commerce-local-git-fork-bolaji-cd7116-vercel-solutions-vtest314.vercel.app

commerce-bigcommerce – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-bigcommerce/G2T6efCU1D5QeH1PiimeWpzvGsPS
✅ Preview: Failed

commerce-commercejs – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-commercejs/8sphdKo7nZsfViCwiR56TujcjQB8
✅ Preview: Failed

commerce-kibocommerce – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-kibocommerce/BQqPYY4a3CU9TcrBeNvZMvz6j91b
✅ Preview: Failed

commerce-ordercloud – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-ordercloud/Aec5LTEBr8uk24fKC36dx3SoNcqt
✅ Preview: Failed

commerce-saleor – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-saleor/8sdT1St9K6q7xBrtjA7kHojJy1dm
✅ Preview: Failed

commerce-shopify – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-shopify/9CAgDeYJDRHddB3aFHL4FMVEq9HF
✅ Preview: Failed

commerce-spree – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-spree/exGq2yxNxc2hSyYeMp4Q5tTpAnX9
✅ Preview: Failed

commerce-swell – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-swell/64RWPMnDwDunTohV3PDsrN3s8gyT
✅ Preview: Failed

commerce-vendure – ./

🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-vendure/VT2cityobLc1tseibNARaP8FsDU5
✅ Preview: Failed

Copy link
Contributor

@goncy goncy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can first focus on remove the code from the core and we can iterate over the rest later :)

.env.template Outdated Show resolved Hide resolved
@@ -1,6 +1,6 @@
import { FC, useEffect, useState, useCallback } from 'react'
import { Logo, Button, Input } from '@components/ui'
import useLogin from '@framework/auth/use-login'
import useLogin from '@commerce/auth/use-login'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No code should be added outside the provider, if something is missing on the core we can discuss it in an external PR. Also @framework reffers to the hook from the provider, where you can extend the one from @commerce

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we'll submit a separate PR for the changes outside the provider, discuss the changes, and remove the changes from this PR.

@goncy
Copy link
Contributor

goncy commented Dec 20, 2021

Hey @BolajiAyodeji and @acasazza thanks for updating the provider! Can you please merge with main to resolve the conflicts? Thanks!

@BolajiAyodeji
Copy link
Author

Hey @BolajiAyodeji and @acasazza thanks for updating the provider! Can you please merge with main to resolve the conflicts? Thanks!

Sure, I'll do that shortly.

@BolajiAyodeji
Copy link
Author

You can check now @goncy, thanks.

@@ -0,0 +1,36 @@
import type { CheckoutEndpoint } from '.'
import getCredentials from '@framework/api/utils/getCredentials'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't import from framework inside the provider, just relative, otherwise it may break other providers

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'll fix that.

Copy link
Contributor

@goncy goncy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change import from '@framework' to relative imports

Also looks like some file is missing
image

@BolajiAyodeji
Copy link
Author

Change import from '@framework' to relative imports

I'm not sure what file that is. Where did you encounter that error, please?

@goncy
Copy link
Contributor

goncy commented Dec 22, 2021

Change import from '@framework' to relative imports

I'm not sure what file that is. Where did you encounter that error, please?

No @framework imports should be present inside commercelayer folder.

@BolajiAyodeji
Copy link
Author

Change import from '@framework' to relative imports

I'm not sure what file that is. Where did you encounter that error, please?

No @framework imports should be present inside commercelayer folder.

Okay, I have fixed that.

Copy link
Contributor

@goncy goncy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some required files are missing, like checkout/use-checkout.tsx, customer/address/use-add-item and customer/use-add-item, you can get the empty files from other provider like bigcommerce.

import { CommercelayerProvider } from './provider'
import {
CommerceConfig,
CommerceProvider as CoreCommerceProvider,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CommerceProvider doesn't exist in @commerce, you want to import CoreCommerceProvider directly. Also it doesn't receive a config prop as passed below

@BolajiAyodeji
Copy link
Author

Some required files are missing, like checkout/use-checkout.tsx, customer/address/use-add-item and customer/use-add-item, you can get the empty files from other provider like bigcommerce.

Alright, I'll fix that.

@vercel
Copy link

vercel bot commented May 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
commerce-local ❌ Failed (Inspect) May 13, 2022 at 4:26PM (UTC)

@BolajiAyodeji
Copy link
Author

Hi @goncy and @okbel, this PR is ready for another review now. Basically we have added the content as an external resource as discussed and updated our package and documentation accordingly. Please take a look and let us know the next steps. Thank you and have a great weekend!

@leerob
Copy link
Member

leerob commented Apr 18, 2023

Hey there! Thank you for your contribution. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: #966

Would love to see a Commerce LAyer version of v2!

@leerob leerob closed this Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants