mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 07:26:59 +00:00
chore: update docs and cleanup
This commit is contained in:
parent
88dcc56995
commit
f33cb3fc86
@ -14,13 +14,17 @@ cp framework/commercelayer/.env.template .env.local
|
||||
|
||||
Next, add the application credentials from your organization's application dashboard in `.env.local`.
|
||||
|
||||
## Content management
|
||||
|
||||
Commerce Layer does not provide a collaborative environment to create and modify digital content but is CMS agnostic. It manages the transactional part of a sales channel and allows users to integrate with any CMS of their choice. This will enable businesses to utilize any content model, produce a better customer experience, outstand competition, and unleash creativity. For now, in this provider, we manage content locally, and in the future, you would be able to plug in any CMS of your choice instead.
|
||||
|
||||
## Checkout
|
||||
|
||||
Demo checkout in this provider is powered by the open-sourced [Commmerce Layer Checkout](#) application that provides you with a PCI-compliant, PSD2-compliant, and production-ready checkout flow that lets you easily place orders through the Commerce Layer API.
|
||||
Demo checkout in this provider is powered by the open-sourced [Commmerce Layer React Checkout](https://github.com/commercelayer/commercelayer-react-checkout) application that provides you with a PCI-compliant, PSD2-compliant, and production-ready checkout flow that lets you easily place orders through the Commerce Layer API.
|
||||
|
||||
## Future upgrades
|
||||
|
||||
For now, this provider supports a single market. In the future, we would add multi-market support by default so you can add more than one market from your organization to your application. Also, note that the demo is configured to serve a European market; hence you need to checkout with an address in Europe to get the available shipping methods. You can learn more about how to create markets in different categorized geographical regions for your organization [here](https://commercelayer.io/docs/data-model/markets-and-business-models).
|
||||
For now, this provider supports a single market. In the future, we would add multi-market support by default so you can add more than one market from your organization to your application. Also, note that the demo is configured to serve a US market; hence you need to checkout with an address in the United States to get the available shipping methods. You can learn more about how to create markets in different categorized geographical regions for your organization [here](https://commercelayer.io/docs/data-model/markets-and-business-models).
|
||||
|
||||
## Contribute
|
||||
|
||||
|
@ -8,11 +8,13 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
||||
}) => {
|
||||
let { orderId, accessToken } = req.query
|
||||
|
||||
const name = 'CL_TOKEN' + "=";
|
||||
const cookiesArr = decodeURIComponent(accessToken = typeof accessToken === 'string' ? accessToken : '').split('; ');
|
||||
cookiesArr.forEach(val => {
|
||||
if (val.indexOf(name) === 0) accessToken = val.substring(name.length)
|
||||
})
|
||||
const name = 'CL_TOKEN' + '='
|
||||
const cookiesArr = decodeURIComponent(
|
||||
(accessToken = typeof accessToken === 'string' ? accessToken : '')
|
||||
).split('; ')
|
||||
cookiesArr.forEach((val) => {
|
||||
if (val.indexOf(name) === 0) accessToken = val.substring(name.length)
|
||||
})
|
||||
|
||||
const { endpoint } = getCredentials()
|
||||
if (orderId && accessToken) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { GetAPISchema, createEndpoint, CommerceAPI } from '@commerce/api'
|
||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||
import type { CheckoutSchema } from '@commerce/types/checkout'
|
||||
import type { CommercelayerAPI } from '../..'
|
||||
import checkout from './checkout'
|
||||
|
||||
export const handlers: CheckoutEndpoint['handlers'] = { checkout }
|
||||
|
@ -53,4 +53,4 @@ export default function getAllProductsOperation({
|
||||
}
|
||||
}
|
||||
return getAllProducts
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ export default useCustomer as UseCustomer<typeof handler>
|
||||
|
||||
export const handler: SWRHook<CustomerHook> = {
|
||||
fetchOptions: {
|
||||
url: `${ENDPOINT}/api/customers/`,
|
||||
url: `${ENDPOINT}/api/customers`,
|
||||
method: 'GET',
|
||||
},
|
||||
async fetcher({ options, fetch }) {
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
import useToken from './auth/use-token'
|
||||
|
||||
export const commercelayerConfig: CommerceConfig = {
|
||||
locale: 'en-us',
|
||||
locale: 'en-US',
|
||||
cartCookie: 'session',
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import { handler as useLogout } from './auth/use-logout'
|
||||
import { handler as useSignup } from './auth/use-signup'
|
||||
|
||||
export const CommercelayerProvider = {
|
||||
locale: 'en-us',
|
||||
locale: 'en-US',
|
||||
cartCookie: 'session',
|
||||
fetcher: fetcher,
|
||||
token: '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user