create-cartbase 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +25 -25
- package/dist/index.js +20 -20
- package/package.json +24 -24
- package/template/app/docs/auth.md +105 -105
- package/template/app/docs/carts.md +23 -4
- package/template/app/docs/categories.md +194 -194
- package/template/app/docs/checkout.md +714 -714
- package/template/app/docs/components.md +288 -31
- package/template/app/docs/consent.md +91 -91
- package/template/app/docs/deploy.md +197 -197
- package/template/app/docs/gift-cards.md +153 -153
- package/template/app/docs/metaobjects.md +126 -126
- package/template/app/docs/orders.md +221 -221
- package/template/app/docs/regions.md +269 -269
- package/template/app/docs/reviews.md +258 -223
- package/template/app/docs/search.md +227 -227
- package/template/app/docs/store.md +23 -1
- package/template/app/docs/subscriptions.md +148 -148
- package/template/app/docs/variables.md +331 -315
- package/template/app/package.json +1 -1
- package/template/app/postcss.config.cjs +11 -11
- package/template/app/src/app/checkout/checkout-empty.tsx +36 -0
- package/template/app/src/app/checkout/checkout-page-client.tsx +80 -73
- package/template/app/src/app/checkout/error.tsx +23 -0
- package/template/app/src/app/checkout/page.tsx +16 -7
- package/template/app/src/app/globals.css +26 -26
- package/template/app/src/app/layout.tsx +126 -126
- package/template/app/src/app/page.tsx +37 -37
- package/template/app/src/app/products/[handle]/page.tsx +89 -89
- package/template/app/src/app/search/page.tsx +33 -33
- package/template/app/src/lib/browser-client.ts +35 -35
- package/template/app/src/lib/catalog.ts +120 -120
- package/template/app/src/lib/server-client.ts +25 -25
- package/template/app/src/lib/store-client.ts +16 -16
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { cookies } from "next/headers"
|
|
2
|
-
import { StorefrontClient } from "@cartbase/storefront/api/http"
|
|
3
|
-
import {
|
|
4
|
-
BARTER_CLIENT_ID,
|
|
5
|
-
BARTER_PUBLISHABLE_KEY,
|
|
6
|
-
BARTER_URL,
|
|
7
|
-
LOCALE_COOKIE,
|
|
8
|
-
} from "./config"
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Server-scope StorefrontClient (runbook step 2): construct per request;
|
|
12
|
-
* `getLocale` reads the locale cookie. No customer accounts in this
|
|
13
|
-
* reference app, so `getAuthToken` always answers null (guest).
|
|
14
|
-
*/
|
|
15
|
-
export async function getServerClient(): Promise<StorefrontClient> {
|
|
16
|
-
const jar = await cookies()
|
|
17
|
-
const locale = jar.get(LOCALE_COOKIE)?.value ?? null
|
|
18
|
-
return new StorefrontClient({
|
|
19
|
-
baseUrl: BARTER_URL,
|
|
20
|
-
clientId: BARTER_CLIENT_ID,
|
|
21
|
-
publishableKey: BARTER_PUBLISHABLE_KEY,
|
|
22
|
-
getAuthToken: () => null,
|
|
23
|
-
getLocale: () => locale,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
1
|
+
import { cookies } from "next/headers"
|
|
2
|
+
import { StorefrontClient } from "@cartbase/storefront/api/http"
|
|
3
|
+
import {
|
|
4
|
+
BARTER_CLIENT_ID,
|
|
5
|
+
BARTER_PUBLISHABLE_KEY,
|
|
6
|
+
BARTER_URL,
|
|
7
|
+
LOCALE_COOKIE,
|
|
8
|
+
} from "./config"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Server-scope StorefrontClient (runbook step 2): construct per request;
|
|
12
|
+
* `getLocale` reads the locale cookie. No customer accounts in this
|
|
13
|
+
* reference app, so `getAuthToken` always answers null (guest).
|
|
14
|
+
*/
|
|
15
|
+
export async function getServerClient(): Promise<StorefrontClient> {
|
|
16
|
+
const jar = await cookies()
|
|
17
|
+
const locale = jar.get(LOCALE_COOKIE)?.value ?? null
|
|
18
|
+
return new StorefrontClient({
|
|
19
|
+
baseUrl: BARTER_URL,
|
|
20
|
+
clientId: BARTER_CLIENT_ID,
|
|
21
|
+
publishableKey: BARTER_PUBLISHABLE_KEY,
|
|
22
|
+
getAuthToken: () => null,
|
|
23
|
+
getLocale: () => locale,
|
|
24
|
+
})
|
|
25
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { StorefrontClient } from "@cartbase/storefront/api/http"
|
|
2
|
-
import { BARTER_CLIENT_ID, BARTER_PUBLISHABLE_KEY, BARTER_URL } from "./config"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The catalogue's client on the server (runbook step 2): the store's key and
|
|
6
|
-
* nothing about the visitor. It reads no cookie, so every read made with it
|
|
7
|
-
* can be cached (`lib/catalog.ts`) and every page built from those reads is
|
|
8
|
-
* prerendered. A store with one language and no customer prices has nothing
|
|
9
|
-
* in its catalogue that depends on who asks. Reads that belong to one
|
|
10
|
-
* visitor (the checkout's cart) use `getServerClient` instead.
|
|
11
|
-
*/
|
|
12
|
-
export const storeClient = new StorefrontClient({
|
|
13
|
-
baseUrl: BARTER_URL,
|
|
14
|
-
clientId: BARTER_CLIENT_ID,
|
|
15
|
-
publishableKey: BARTER_PUBLISHABLE_KEY,
|
|
16
|
-
})
|
|
1
|
+
import { StorefrontClient } from "@cartbase/storefront/api/http"
|
|
2
|
+
import { BARTER_CLIENT_ID, BARTER_PUBLISHABLE_KEY, BARTER_URL } from "./config"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The catalogue's client on the server (runbook step 2): the store's key and
|
|
6
|
+
* nothing about the visitor. It reads no cookie, so every read made with it
|
|
7
|
+
* can be cached (`lib/catalog.ts`) and every page built from those reads is
|
|
8
|
+
* prerendered. A store with one language and no customer prices has nothing
|
|
9
|
+
* in its catalogue that depends on who asks. Reads that belong to one
|
|
10
|
+
* visitor (the checkout's cart) use `getServerClient` instead.
|
|
11
|
+
*/
|
|
12
|
+
export const storeClient = new StorefrontClient({
|
|
13
|
+
baseUrl: BARTER_URL,
|
|
14
|
+
clientId: BARTER_CLIENT_ID,
|
|
15
|
+
publishableKey: BARTER_PUBLISHABLE_KEY,
|
|
16
|
+
})
|