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.
Files changed (35) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +25 -25
  3. package/dist/index.js +20 -20
  4. package/package.json +24 -24
  5. package/template/app/docs/auth.md +105 -105
  6. package/template/app/docs/carts.md +23 -4
  7. package/template/app/docs/categories.md +194 -194
  8. package/template/app/docs/checkout.md +714 -714
  9. package/template/app/docs/components.md +288 -31
  10. package/template/app/docs/consent.md +91 -91
  11. package/template/app/docs/deploy.md +197 -197
  12. package/template/app/docs/gift-cards.md +153 -153
  13. package/template/app/docs/metaobjects.md +126 -126
  14. package/template/app/docs/orders.md +221 -221
  15. package/template/app/docs/regions.md +269 -269
  16. package/template/app/docs/reviews.md +258 -223
  17. package/template/app/docs/search.md +227 -227
  18. package/template/app/docs/store.md +23 -1
  19. package/template/app/docs/subscriptions.md +148 -148
  20. package/template/app/docs/variables.md +331 -315
  21. package/template/app/package.json +1 -1
  22. package/template/app/postcss.config.cjs +11 -11
  23. package/template/app/src/app/checkout/checkout-empty.tsx +36 -0
  24. package/template/app/src/app/checkout/checkout-page-client.tsx +80 -73
  25. package/template/app/src/app/checkout/error.tsx +23 -0
  26. package/template/app/src/app/checkout/page.tsx +16 -7
  27. package/template/app/src/app/globals.css +26 -26
  28. package/template/app/src/app/layout.tsx +126 -126
  29. package/template/app/src/app/page.tsx +37 -37
  30. package/template/app/src/app/products/[handle]/page.tsx +89 -89
  31. package/template/app/src/app/search/page.tsx +33 -33
  32. package/template/app/src/lib/browser-client.ts +35 -35
  33. package/template/app/src/lib/catalog.ts +120 -120
  34. package/template/app/src/lib/server-client.ts +25 -25
  35. 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
+ })