chore: update docs and cleanup

This commit is contained in:
Bolaji Ayodeji 2021-10-01 20:42:15 +01:00 committed by Alessandro Casazza
parent 88dcc56995
commit f33cb3fc86
No known key found for this signature in database
GPG Key ID: 3AF41B06C6495D3D
7 changed files with 17 additions and 12 deletions

View File

@ -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`. 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 ## 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 ## 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 ## Contribute

View File

@ -8,9 +8,11 @@ const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
}) => { }) => {
let { orderId, accessToken } = req.query let { orderId, accessToken } = req.query
const name = 'CL_TOKEN' + "="; const name = 'CL_TOKEN' + '='
const cookiesArr = decodeURIComponent(accessToken = typeof accessToken === 'string' ? accessToken : '').split('; '); const cookiesArr = decodeURIComponent(
cookiesArr.forEach(val => { (accessToken = typeof accessToken === 'string' ? accessToken : '')
).split('; ')
cookiesArr.forEach((val) => {
if (val.indexOf(name) === 0) accessToken = val.substring(name.length) if (val.indexOf(name) === 0) accessToken = val.substring(name.length)
}) })

View File

@ -1,7 +1,6 @@
import { GetAPISchema, createEndpoint, CommerceAPI } from '@commerce/api' import { GetAPISchema, createEndpoint, CommerceAPI } from '@commerce/api'
import checkoutEndpoint from '@commerce/api/endpoints/checkout' import checkoutEndpoint from '@commerce/api/endpoints/checkout'
import type { CheckoutSchema } from '@commerce/types/checkout' import type { CheckoutSchema } from '@commerce/types/checkout'
import type { CommercelayerAPI } from '../..'
import checkout from './checkout' import checkout from './checkout'
export const handlers: CheckoutEndpoint['handlers'] = { checkout } export const handlers: CheckoutEndpoint['handlers'] = { checkout }

View File

@ -8,7 +8,7 @@ export default useCustomer as UseCustomer<typeof handler>
export const handler: SWRHook<CustomerHook> = { export const handler: SWRHook<CustomerHook> = {
fetchOptions: { fetchOptions: {
url: `${ENDPOINT}/api/customers/`, url: `${ENDPOINT}/api/customers`,
method: 'GET', method: 'GET',
}, },
async fetcher({ options, fetch }) { async fetcher({ options, fetch }) {

View File

@ -9,7 +9,7 @@ import {
import useToken from './auth/use-token' import useToken from './auth/use-token'
export const commercelayerConfig: CommerceConfig = { export const commercelayerConfig: CommerceConfig = {
locale: 'en-us', locale: 'en-US',
cartCookie: 'session', cartCookie: 'session',
} }

View File

@ -10,7 +10,7 @@ import { handler as useLogout } from './auth/use-logout'
import { handler as useSignup } from './auth/use-signup' import { handler as useSignup } from './auth/use-signup'
export const CommercelayerProvider = { export const CommercelayerProvider = {
locale: 'en-us', locale: 'en-US',
cartCookie: 'session', cartCookie: 'session',
fetcher: fetcher, fetcher: fetcher,
token: '', token: '',