Conversation
e81254f to
743dbaa
Compare
f03a404 to
110934b
Compare
110934b to
629f3f5
Compare
629f3f5 to
768a106
Compare
BC-krasnoshapka
left a comment
There was a problem hiding this comment.
Overall looks good for now, left comments for future improvements.
| lines.map(async ({ merchandiseId }) => { | ||
| const productId = Number(merchandiseId); | ||
|
|
||
| const resp = await bigcommerceFetch<BigCommerceProductOperation>({ |
There was a problem hiding this comment.
Not critical for now, but maybe we can avoid multiple queries and fetch all products via single query instead, which should be better and faster?
| }; | ||
| }; | ||
|
|
||
| export async function createCart(): Promise<VercelCart> { |
There was a problem hiding this comment.
Does this function really return promise?
| for (let removals = lineIds.length; removals > 0; removals--) { | ||
| const lineId = lineIds[removals - 1]!; | ||
|
|
||
| const res = await bigcommerceFetch<BigCommerceDeleteCartItemOperation>({ |
There was a problem hiding this comment.
Also not critical, but maybe we can avoid mutliple mutations and use single instead?
|
|
||
| const collections = await Promise.all( | ||
| collectionIdList.map(async (entityId) => { | ||
| const res = await bigcommerceFetch<BigCommerceCollectionOperation>({ |
There was a problem hiding this comment.
Is there a way to fetch all categories via single query?
| } | ||
|
|
||
| export async function getMenu(handle: string): Promise<VercelMenu[]> { | ||
| const expectedMenyType = 'footerOrHeader'; |
| return []; | ||
| } | ||
|
|
||
| // TODO: replace with BC API next Page(s) Methods |
There was a problem hiding this comment.
Is this TODO already implemented?
|
|
||
| export const fetchStorefrontToken = async () => { | ||
| const response = await fetch( | ||
| `${BIGCOMMERCE_API_URL}/stores/${process.env.BIGCOMMERCE_STORE_HASH}/v3/storefront/api-token-customer-impersonation`, |
There was a problem hiding this comment.
Also not critical, but we'll need to figure out a way how to not generate new token for every incoming request, which doesn't make sense. cc @zvuki
There was a problem hiding this comment.
I think we might be considering the approach of just generating a CIT and letting the merchant rotate it before (recommendation) or after it expires. That removes some complex logic with env vars we had in place before.
|
|
||
| export default async function Navbar() { | ||
| const menu = await getMenu('next-js-frontend-header-menu'); | ||
| const demoMenu = menu.slice(0, 4); |
There was a problem hiding this comment.
🍹 Let's throw this logic inside getMenu, that way our view logic doesn't need to know about any "business" logic.
|
|
||
| export const fetchStorefrontToken = async () => { | ||
| const response = await fetch( | ||
| `${BIGCOMMERCE_API_URL}/stores/${process.env.BIGCOMMERCE_STORE_HASH}/v3/storefront/api-token-customer-impersonation`, |
There was a problem hiding this comment.
I think we might be considering the approach of just generating a CIT and letting the merchant rotate it before (recommendation) or after it expires. That removes some complex logic with env vars we had in place before.
|
Merged as we need this prototype to be handed over to Vercel. @bc-alexsaiannyi will work on comments/suggestions in next PR. |



What/Why
Added initial setup to the project and connectors between Vercel and BigCommerce.
This PR covers:
Cart functionality will be added in the following PR separetly.
Proof
Tested locally. Video's attached below.
Screen.Recording.2023-05-29.at.12.02.11.mov