@cartbase/storefront 0.17.0 → 0.18.1
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/package.json +3 -1
- package/src/api/auth.ts +108 -108
- package/src/api/carts.ts +523 -523
- package/src/api/categories.ts +184 -184
- package/src/api/checkout.ts +526 -526
- package/src/api/collections.ts +130 -130
- package/src/api/consent.ts +75 -75
- package/src/api/content.ts +125 -125
- package/src/api/customers.ts +303 -303
- package/src/api/gift-cards.ts +112 -112
- package/src/api/http.ts +180 -180
- package/src/api/index.ts +30 -30
- package/src/api/menus.ts +77 -77
- package/src/api/metaobjects.ts +136 -136
- package/src/api/orders.ts +290 -290
- package/src/api/products.ts +43 -1
- package/src/api/redirects.ts +37 -37
- package/src/api/regions.ts +200 -200
- package/src/api/reviews.ts +259 -259
- package/src/api/search.ts +163 -163
- package/src/api/store.ts +35 -35
- package/src/api/types.ts +91 -91
- package/src/cart-drawer/context.tsx +367 -168
- package/src/cart-drawer/cross-sell-carousel.tsx +211 -211
- package/src/cart-drawer/cross-sell-sidebar.tsx +158 -158
- package/src/cart-drawer/gift-wrap.tsx +82 -82
- package/src/cart-drawer/index.ts +73 -68
- package/src/cart-drawer/item/index.tsx +162 -162
- package/src/cart-drawer/item/quantity.tsx +8 -14
- package/src/cart-drawer/item/upsell.tsx +110 -110
- package/src/cart-drawer/labels.ts +123 -123
- package/src/cart-drawer/mutation-queue.ts +78 -0
- package/src/cart-drawer/notes.tsx +131 -131
- package/src/cart-drawer/sticky-footer.tsx +73 -73
- package/src/cart-drawer/summary-breakdown.tsx +197 -197
- package/src/checkout/address-error-copy.ts +117 -117
- package/src/checkout/boxnow-locker-selector.tsx +410 -410
- package/src/checkout/compare-addresses.ts +40 -40
- package/src/checkout/discount-section.tsx +218 -218
- package/src/checkout/error-copy-codes.ts +63 -63
- package/src/checkout/geocode.ts +154 -154
- package/src/checkout/gift-card-section.tsx +224 -224
- package/src/checkout/index.ts +72 -72
- package/src/checkout/labels.ts +495 -495
- package/src/checkout/payment-button.tsx +372 -372
- package/src/checkout/payment-error-copy.ts +154 -154
- package/src/checkout/promotion-error-copy.ts +91 -91
- package/src/checkout/use-checkout-orchestration.ts +1604 -1592
- package/src/common/country-flag.tsx +52 -52
- package/src/common/country-select.tsx +11 -11
- package/src/common/index.ts +20 -20
- package/src/common/market-select.tsx +57 -57
- package/src/index.ts +12 -12
- package/src/lib/cookie-names.ts +14 -0
- package/src/lib/country-name.ts +59 -59
- package/src/lib/get-product-price.ts +133 -133
- package/src/lib/media-image.tsx +39 -39
- package/src/lib/payment-constants.ts +53 -53
- package/src/lib/platform.ts +13 -13
- package/src/lib/price.tsx +39 -39
- package/src/lib/store-api-error.ts +36 -36
- package/src/lib/variant-caption.ts +32 -32
- package/src/locales/bg.ts +467 -467
- package/src/locales/context.ts +37 -37
- package/src/locales/en.ts +26 -26
- package/src/locales/es.ts +466 -466
- package/src/locales/index.ts +19 -19
- package/src/locales/provider.tsx +59 -59
- package/src/locales/types.ts +77 -77
- package/src/order/index.ts +62 -62
- package/src/order/labels.ts +79 -79
- package/src/order/order-totals.tsx +250 -250
- package/src/primitives/select-field.tsx +93 -93
- package/src/products/image-gallery.tsx +43 -43
- package/src/products/index.ts +68 -59
- package/src/products/option-select.tsx +67 -67
- package/src/products/product-actions-wrapper.tsx +63 -62
- package/src/products/product-actions.tsx +151 -150
- package/src/products/product-price.tsx +69 -69
- package/src/products/product-promises.tsx +61 -61
- package/src/products/product-specs.tsx +65 -65
- package/src/products/product-tabs.tsx +123 -123
- package/src/products/product-template.tsx +163 -162
- package/src/products/purchase-options.tsx +130 -130
- package/src/products/sets.ts +110 -0
- package/src/products/use-product-actions.ts +199 -164
- package/src/products/variant-matching.ts +71 -71
- package/src/products/variant-url.ts +74 -74
- package/src/reviews-ui/index.ts +73 -73
- package/src/store/category-template.tsx +136 -136
- package/src/store/index.ts +40 -40
- package/src/tracking/chatgpt-pixel.tsx +99 -99
- package/src/tracking/consent-init.tsx +62 -62
- package/src/tracking/events.ts +348 -348
- package/src/tracking/ga4.tsx +93 -93
- package/src/tracking/google-ads.ts +84 -84
- package/src/tracking/gtm.tsx +60 -60
- package/src/tracking/inline-script.ts +49 -49
- package/src/tracking/oaiq.ts +206 -206
- package/src/tracking/tiktok-pixel.tsx +91 -91
- package/src/tracking/track-init.tsx +56 -56
- package/src/tracking/track-order-purchase.tsx +122 -122
- package/src/tracking/ttq.ts +180 -180
- package/src/tracking/use-tracking-config.ts +54 -54
- package/theme/index.css +25 -25
- package/theme/theme.css +150 -150
- package/theme/tokens.css +106 -106
package/src/locales/index.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* THE LOCALE LAYER.
|
|
3
|
-
*
|
|
4
|
-
* The library speaks international ENGLISH by default and knows nothing
|
|
5
|
-
* about any other language. A language is a PACK the store imports:
|
|
6
|
-
*
|
|
7
|
-
* import { es } from "@cartbase/storefront/locales/es"
|
|
8
|
-
* <StorefrontLocaleProvider locale={es}>{children}</StorefrontLocaleProvider>
|
|
9
|
-
*
|
|
10
|
-
* Import a pack by its own subpath (`/locales/es`, `/locales/bg`) rather
|
|
11
|
-
* than from here, so a store that ships one language does not bundle the
|
|
12
|
-
* others. This barrel carries the type, the provider and English only.
|
|
13
|
-
*
|
|
14
|
-
* Shipping: English, Spanish, Bulgarian (2026-09-13). Adding a language is
|
|
15
|
-
* one file in this folder plus its export path, and nothing else.
|
|
16
|
-
*/
|
|
17
|
-
export { en } from "./en"
|
|
18
|
-
export { StorefrontLocaleProvider, useStorefrontLocale } from "./provider"
|
|
19
|
-
export type { PropLabelAreas, StorefrontLocale } from "./types"
|
|
1
|
+
/**
|
|
2
|
+
* THE LOCALE LAYER.
|
|
3
|
+
*
|
|
4
|
+
* The library speaks international ENGLISH by default and knows nothing
|
|
5
|
+
* about any other language. A language is a PACK the store imports:
|
|
6
|
+
*
|
|
7
|
+
* import { es } from "@cartbase/storefront/locales/es"
|
|
8
|
+
* <StorefrontLocaleProvider locale={es}>{children}</StorefrontLocaleProvider>
|
|
9
|
+
*
|
|
10
|
+
* Import a pack by its own subpath (`/locales/es`, `/locales/bg`) rather
|
|
11
|
+
* than from here, so a store that ships one language does not bundle the
|
|
12
|
+
* others. This barrel carries the type, the provider and English only.
|
|
13
|
+
*
|
|
14
|
+
* Shipping: English, Spanish, Bulgarian (2026-09-13). Adding a language is
|
|
15
|
+
* one file in this folder plus its export path, and nothing else.
|
|
16
|
+
*/
|
|
17
|
+
export { en } from "./en"
|
|
18
|
+
export { StorefrontLocaleProvider, useStorefrontLocale } from "./provider"
|
|
19
|
+
export type { PropLabelAreas, StorefrontLocale } from "./types"
|
package/src/locales/provider.tsx
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useContext, type ReactNode } from "react"
|
|
4
|
-
import { CheckoutProvider } from "../checkout/context"
|
|
5
|
-
import { OrderLabelsProvider } from "../order/context"
|
|
6
|
-
import { ProductLabelsProvider } from "../products/context"
|
|
7
|
-
import { StorefrontLocaleContext } from "./context"
|
|
8
|
-
import type { StorefrontLocale } from "./types"
|
|
9
|
-
import { en } from "./en"
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* ONE PROVIDER FOR THE STORE'S LANGUAGE.
|
|
13
|
-
*
|
|
14
|
-
* import { es } from "@cartbase/storefront/locales/es"
|
|
15
|
-
* <StorefrontLocaleProvider locale={es}>{children}</StorefrontLocaleProvider>
|
|
16
|
-
*
|
|
17
|
-
* Every CLIENT component inside it speaks the pack, and nothing else has to
|
|
18
|
-
* be wired: it mounts the three label contexts (products, checkout, order),
|
|
19
|
-
* and the cart drawer and the reviews family read the language from it
|
|
20
|
-
* directly (`useLocaleArea`, since 2026-09-14). It does not MOUNT the cart
|
|
21
|
-
* drawer, because that provider carries the cart's state, its client and its
|
|
22
|
-
* persistence callbacks, which belong where the app owns that state; the
|
|
23
|
-
* drawer only reads the language from here.
|
|
24
|
-
*
|
|
25
|
-
* What it cannot reach is a SERVER component, because a server component has
|
|
26
|
-
* no context. The store, product and order templates render on the server,
|
|
27
|
-
* so each page hands them their area of the pack as a REQUIRED prop:
|
|
28
|
-
* `PropLabelAreas` in ./types names them, with the mounts written out.
|
|
29
|
-
*
|
|
30
|
-
* DEFAULT IS ENGLISH. A component rendered outside this provider reads the
|
|
31
|
-
* library's own English defaults, so nothing renders blank or crashes for
|
|
32
|
-
* want of a provider.
|
|
33
|
-
*/
|
|
34
|
-
export function StorefrontLocaleProvider({
|
|
35
|
-
locale,
|
|
36
|
-
children,
|
|
37
|
-
}: {
|
|
38
|
-
locale: StorefrontLocale
|
|
39
|
-
children: ReactNode
|
|
40
|
-
}) {
|
|
41
|
-
return (
|
|
42
|
-
<StorefrontLocaleContext.Provider value={locale}>
|
|
43
|
-
<ProductLabelsProvider labels={locale.products}>
|
|
44
|
-
<CheckoutProvider labels={locale.checkout}>
|
|
45
|
-
<OrderLabelsProvider labels={locale.order}>{children}</OrderLabelsProvider>
|
|
46
|
-
</CheckoutProvider>
|
|
47
|
-
</ProductLabelsProvider>
|
|
48
|
-
</StorefrontLocaleContext.Provider>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The whole mounted locale, English when none is mounted: for the code that
|
|
54
|
-
* needs the language itself, e.g. `<html lang={locale.code}>`, and for a
|
|
55
|
-
* client shell that hands a server template its pack.
|
|
56
|
-
*/
|
|
57
|
-
export function useStorefrontLocale(): StorefrontLocale {
|
|
58
|
-
return useContext(StorefrontLocaleContext) ?? en
|
|
59
|
-
}
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useContext, type ReactNode } from "react"
|
|
4
|
+
import { CheckoutProvider } from "../checkout/context"
|
|
5
|
+
import { OrderLabelsProvider } from "../order/context"
|
|
6
|
+
import { ProductLabelsProvider } from "../products/context"
|
|
7
|
+
import { StorefrontLocaleContext } from "./context"
|
|
8
|
+
import type { StorefrontLocale } from "./types"
|
|
9
|
+
import { en } from "./en"
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* ONE PROVIDER FOR THE STORE'S LANGUAGE.
|
|
13
|
+
*
|
|
14
|
+
* import { es } from "@cartbase/storefront/locales/es"
|
|
15
|
+
* <StorefrontLocaleProvider locale={es}>{children}</StorefrontLocaleProvider>
|
|
16
|
+
*
|
|
17
|
+
* Every CLIENT component inside it speaks the pack, and nothing else has to
|
|
18
|
+
* be wired: it mounts the three label contexts (products, checkout, order),
|
|
19
|
+
* and the cart drawer and the reviews family read the language from it
|
|
20
|
+
* directly (`useLocaleArea`, since 2026-09-14). It does not MOUNT the cart
|
|
21
|
+
* drawer, because that provider carries the cart's state, its client and its
|
|
22
|
+
* persistence callbacks, which belong where the app owns that state; the
|
|
23
|
+
* drawer only reads the language from here.
|
|
24
|
+
*
|
|
25
|
+
* What it cannot reach is a SERVER component, because a server component has
|
|
26
|
+
* no context. The store, product and order templates render on the server,
|
|
27
|
+
* so each page hands them their area of the pack as a REQUIRED prop:
|
|
28
|
+
* `PropLabelAreas` in ./types names them, with the mounts written out.
|
|
29
|
+
*
|
|
30
|
+
* DEFAULT IS ENGLISH. A component rendered outside this provider reads the
|
|
31
|
+
* library's own English defaults, so nothing renders blank or crashes for
|
|
32
|
+
* want of a provider.
|
|
33
|
+
*/
|
|
34
|
+
export function StorefrontLocaleProvider({
|
|
35
|
+
locale,
|
|
36
|
+
children,
|
|
37
|
+
}: {
|
|
38
|
+
locale: StorefrontLocale
|
|
39
|
+
children: ReactNode
|
|
40
|
+
}) {
|
|
41
|
+
return (
|
|
42
|
+
<StorefrontLocaleContext.Provider value={locale}>
|
|
43
|
+
<ProductLabelsProvider labels={locale.products}>
|
|
44
|
+
<CheckoutProvider labels={locale.checkout}>
|
|
45
|
+
<OrderLabelsProvider labels={locale.order}>{children}</OrderLabelsProvider>
|
|
46
|
+
</CheckoutProvider>
|
|
47
|
+
</ProductLabelsProvider>
|
|
48
|
+
</StorefrontLocaleContext.Provider>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The whole mounted locale, English when none is mounted: for the code that
|
|
54
|
+
* needs the language itself, e.g. `<html lang={locale.code}>`, and for a
|
|
55
|
+
* client shell that hands a server template its pack.
|
|
56
|
+
*/
|
|
57
|
+
export function useStorefrontLocale(): StorefrontLocale {
|
|
58
|
+
return useContext(StorefrontLocaleContext) ?? en
|
|
59
|
+
}
|
package/src/locales/types.ts
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import type { CartDrawerLabels } from "../cart-drawer/labels"
|
|
2
|
-
import type { CheckoutLabels } from "../checkout/labels"
|
|
3
|
-
import type { OrderLabels } from "../order/labels"
|
|
4
|
-
import type { ProductLabels } from "../products/labels"
|
|
5
|
-
import type { ReviewsUiLabels } from "../reviews-ui/labels"
|
|
6
|
-
import type { StoreLabels } from "../store/labels"
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* A LOCALE IS ONE OBJECT COVERING THE WHOLE STOREFRONT.
|
|
10
|
-
*
|
|
11
|
-
* Before this (2026-09-13) every area shipped its own English defaults and
|
|
12
|
-
* its own Bulgarian file, so localizing a store meant importing six packs
|
|
13
|
-
* and mounting four separate providers, and a global package shipped
|
|
14
|
-
* Bulgarian copy to every merchant on earth. Alexander's ruling: the
|
|
15
|
-
* library is international ENGLISH, and a language is a pack the store
|
|
16
|
-
* opts into.
|
|
17
|
-
*
|
|
18
|
-
* So: English is the library's own default and lives in each area's
|
|
19
|
-
* `labels.ts` beside its type. Every other language is a locale pack
|
|
20
|
-
* imported by subpath — `@cartbase/storefront/locales/es`,
|
|
21
|
-
* `/locales/bg` — and is typed against these six shapes, which means a
|
|
22
|
-
* missing translation is a COMPILE ERROR rather than a silent fall back to
|
|
23
|
-
* English in the middle of a Spanish checkout.
|
|
24
|
-
*
|
|
25
|
-
* Adding a language is one file in `src/locales/` plus its export path.
|
|
26
|
-
* Nothing else in the package changes, and no component knows a language
|
|
27
|
-
* exists.
|
|
28
|
-
*/
|
|
29
|
-
export interface StorefrontLocale {
|
|
30
|
-
/** BCP 47 code, for the app's own persistence and for `<html lang>`. */
|
|
31
|
-
code: string
|
|
32
|
-
/** The language's own name, for a switcher that does not want Intl. */
|
|
33
|
-
name: string
|
|
34
|
-
products: ProductLabels
|
|
35
|
-
store: StoreLabels
|
|
36
|
-
cartDrawer: CartDrawerLabels
|
|
37
|
-
checkout: CheckoutLabels
|
|
38
|
-
order: OrderLabels
|
|
39
|
-
reviews: ReviewsUiLabels
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* THE AREAS WHOSE PACK THE APP MUST HAND OVER AS A PROP, and the prop is
|
|
44
|
-
* REQUIRED.
|
|
45
|
-
*
|
|
46
|
-
* Not a style choice and not a gap in this layer: a React SERVER component
|
|
47
|
-
* cannot read a client context, and these areas are rendered on the server.
|
|
48
|
-
* `StorefrontLocaleProvider` therefore reaches the client components and
|
|
49
|
-
* nothing else, and a server-rendered heading would stay English however
|
|
50
|
-
* many providers were mounted above it.
|
|
51
|
-
*
|
|
52
|
-
* Since 2026-09-14 the page-level templates of these areas REQUIRE the pack
|
|
53
|
-
* (`labels: StoreLabels`, never `labels?`), so a page that forgets it fails
|
|
54
|
-
* to compile instead of shipping silent English. That was the defect: on
|
|
55
|
-
* 2026-09-13 evoo, a Bulgarian store, ended a product page in the English
|
|
56
|
-
* "Related products / You might also want to check out these products", and
|
|
57
|
-
* its search page and order confirmation stayed English, with no error, no
|
|
58
|
-
* warning and no failing test. English is not a special case: an English
|
|
59
|
-
* store passes `en.store`. The scaffold declares `STORE_LOCALE` once in its
|
|
60
|
-
* config and every page reads its area from it.
|
|
61
|
-
*
|
|
62
|
-
* Hand the pack to each page-level template once and everything inside it
|
|
63
|
-
* follows:
|
|
64
|
-
*
|
|
65
|
-
* <StoreTemplate labels={STORE_LOCALE.store} />
|
|
66
|
-
* <SearchTemplate labels={STORE_LOCALE.store} />
|
|
67
|
-
* <CollectionTemplate labels={STORE_LOCALE.store} />
|
|
68
|
-
* <CategoryTemplate labels={STORE_LOCALE.store} />
|
|
69
|
-
* <ProductTemplate labels={STORE_LOCALE.products} /> // + the related strip
|
|
70
|
-
* <OrderCompletedTemplate labels={STORE_LOCALE.order} />
|
|
71
|
-
*
|
|
72
|
-
* The cart drawer and the reviews family were listed here until 2026-09-14.
|
|
73
|
-
* They are client components, so they now read the mounted language
|
|
74
|
-
* themselves (`useLocaleArea` in ./context); their `labels` prop is an
|
|
75
|
-
* override, never a requirement.
|
|
76
|
-
*/
|
|
77
|
-
export type PropLabelAreas = Pick<StorefrontLocale, "products" | "store" | "order">
|
|
1
|
+
import type { CartDrawerLabels } from "../cart-drawer/labels"
|
|
2
|
+
import type { CheckoutLabels } from "../checkout/labels"
|
|
3
|
+
import type { OrderLabels } from "../order/labels"
|
|
4
|
+
import type { ProductLabels } from "../products/labels"
|
|
5
|
+
import type { ReviewsUiLabels } from "../reviews-ui/labels"
|
|
6
|
+
import type { StoreLabels } from "../store/labels"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A LOCALE IS ONE OBJECT COVERING THE WHOLE STOREFRONT.
|
|
10
|
+
*
|
|
11
|
+
* Before this (2026-09-13) every area shipped its own English defaults and
|
|
12
|
+
* its own Bulgarian file, so localizing a store meant importing six packs
|
|
13
|
+
* and mounting four separate providers, and a global package shipped
|
|
14
|
+
* Bulgarian copy to every merchant on earth. Alexander's ruling: the
|
|
15
|
+
* library is international ENGLISH, and a language is a pack the store
|
|
16
|
+
* opts into.
|
|
17
|
+
*
|
|
18
|
+
* So: English is the library's own default and lives in each area's
|
|
19
|
+
* `labels.ts` beside its type. Every other language is a locale pack
|
|
20
|
+
* imported by subpath — `@cartbase/storefront/locales/es`,
|
|
21
|
+
* `/locales/bg` — and is typed against these six shapes, which means a
|
|
22
|
+
* missing translation is a COMPILE ERROR rather than a silent fall back to
|
|
23
|
+
* English in the middle of a Spanish checkout.
|
|
24
|
+
*
|
|
25
|
+
* Adding a language is one file in `src/locales/` plus its export path.
|
|
26
|
+
* Nothing else in the package changes, and no component knows a language
|
|
27
|
+
* exists.
|
|
28
|
+
*/
|
|
29
|
+
export interface StorefrontLocale {
|
|
30
|
+
/** BCP 47 code, for the app's own persistence and for `<html lang>`. */
|
|
31
|
+
code: string
|
|
32
|
+
/** The language's own name, for a switcher that does not want Intl. */
|
|
33
|
+
name: string
|
|
34
|
+
products: ProductLabels
|
|
35
|
+
store: StoreLabels
|
|
36
|
+
cartDrawer: CartDrawerLabels
|
|
37
|
+
checkout: CheckoutLabels
|
|
38
|
+
order: OrderLabels
|
|
39
|
+
reviews: ReviewsUiLabels
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* THE AREAS WHOSE PACK THE APP MUST HAND OVER AS A PROP, and the prop is
|
|
44
|
+
* REQUIRED.
|
|
45
|
+
*
|
|
46
|
+
* Not a style choice and not a gap in this layer: a React SERVER component
|
|
47
|
+
* cannot read a client context, and these areas are rendered on the server.
|
|
48
|
+
* `StorefrontLocaleProvider` therefore reaches the client components and
|
|
49
|
+
* nothing else, and a server-rendered heading would stay English however
|
|
50
|
+
* many providers were mounted above it.
|
|
51
|
+
*
|
|
52
|
+
* Since 2026-09-14 the page-level templates of these areas REQUIRE the pack
|
|
53
|
+
* (`labels: StoreLabels`, never `labels?`), so a page that forgets it fails
|
|
54
|
+
* to compile instead of shipping silent English. That was the defect: on
|
|
55
|
+
* 2026-09-13 evoo, a Bulgarian store, ended a product page in the English
|
|
56
|
+
* "Related products / You might also want to check out these products", and
|
|
57
|
+
* its search page and order confirmation stayed English, with no error, no
|
|
58
|
+
* warning and no failing test. English is not a special case: an English
|
|
59
|
+
* store passes `en.store`. The scaffold declares `STORE_LOCALE` once in its
|
|
60
|
+
* config and every page reads its area from it.
|
|
61
|
+
*
|
|
62
|
+
* Hand the pack to each page-level template once and everything inside it
|
|
63
|
+
* follows:
|
|
64
|
+
*
|
|
65
|
+
* <StoreTemplate labels={STORE_LOCALE.store} />
|
|
66
|
+
* <SearchTemplate labels={STORE_LOCALE.store} />
|
|
67
|
+
* <CollectionTemplate labels={STORE_LOCALE.store} />
|
|
68
|
+
* <CategoryTemplate labels={STORE_LOCALE.store} />
|
|
69
|
+
* <ProductTemplate labels={STORE_LOCALE.products} /> // + the related strip
|
|
70
|
+
* <OrderCompletedTemplate labels={STORE_LOCALE.order} />
|
|
71
|
+
*
|
|
72
|
+
* The cart drawer and the reviews family were listed here until 2026-09-14.
|
|
73
|
+
* They are client components, so they now read the mounted language
|
|
74
|
+
* themselves (`useLocaleArea` in ./context); their `labels` prop is an
|
|
75
|
+
* override, never a requirement.
|
|
76
|
+
*/
|
|
77
|
+
export type PropLabelAreas = Pick<StorefrontLocale, "products" | "store" | "order">
|
package/src/order/index.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @cartbase/storefront/order — order confirmation + account order views.
|
|
3
|
-
* Ported from `@1click/ui/src/order` (v2.3.1) with Cartbase data seams; see
|
|
4
|
-
* per-module JSDoc and docs/storefront/components.md for the contracts.
|
|
5
|
-
*/
|
|
6
|
-
export { OrderLabelsProvider, useOrderLabels } from "./context"
|
|
7
|
-
export { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
OrderConfirmationHeader,
|
|
11
|
-
type OrderConfirmationHeaderProps,
|
|
12
|
-
type OrderHeaderData,
|
|
13
|
-
} from "./order-confirmation-header"
|
|
14
|
-
export {
|
|
15
|
-
OrderItem,
|
|
16
|
-
displayItemFromOrderItem,
|
|
17
|
-
displayItemFromCartLine,
|
|
18
|
-
variantLabelFrom,
|
|
19
|
-
type OrderItemProps,
|
|
20
|
-
type OrderDisplayItem,
|
|
21
|
-
type CartLineLike,
|
|
22
|
-
} from "./order-item"
|
|
23
|
-
export { OrderItemsList, type OrderItemsListProps } from "./order-items-list"
|
|
24
|
-
export {
|
|
25
|
-
OrderTotals,
|
|
26
|
-
selectOrderTotalsRows,
|
|
27
|
-
orderTotalsFromSummary,
|
|
28
|
-
type OrderTotalsProps,
|
|
29
|
-
type OrderTotalsSource,
|
|
30
|
-
type OrderTotalsRow,
|
|
31
|
-
} from "./order-totals"
|
|
32
|
-
export {
|
|
33
|
-
OrderAddressCard,
|
|
34
|
-
type OrderAddressCardProps,
|
|
35
|
-
type OrderContactData,
|
|
36
|
-
} from "./order-address-card"
|
|
37
|
-
export {
|
|
38
|
-
OrderDeliveryCard,
|
|
39
|
-
pickTrackingLabels,
|
|
40
|
-
type OrderDeliveryCardProps,
|
|
41
|
-
type OrderDeliveryData,
|
|
42
|
-
type ShippingMethodDisplay,
|
|
43
|
-
type TrackingLabel,
|
|
44
|
-
} from "./order-delivery-card"
|
|
45
|
-
export {
|
|
46
|
-
OrderPaymentCard,
|
|
47
|
-
resolvePaymentTitle,
|
|
48
|
-
type OrderPaymentCardProps,
|
|
49
|
-
} from "./order-payment-card"
|
|
50
|
-
export {
|
|
51
|
-
OrderTimeline,
|
|
52
|
-
deriveFulfillmentStatus,
|
|
53
|
-
type OrderTimelineProps,
|
|
54
|
-
} from "./order-timeline"
|
|
55
|
-
export {
|
|
56
|
-
OrderHelpSection,
|
|
57
|
-
type OrderHelpSectionProps,
|
|
58
|
-
} from "./order-help-section"
|
|
59
|
-
export {
|
|
60
|
-
OrderCompletedTemplate,
|
|
61
|
-
type OrderCompletedTemplateProps,
|
|
62
|
-
} from "./order-completed-template"
|
|
1
|
+
/**
|
|
2
|
+
* @cartbase/storefront/order — order confirmation + account order views.
|
|
3
|
+
* Ported from `@1click/ui/src/order` (v2.3.1) with Cartbase data seams; see
|
|
4
|
+
* per-module JSDoc and docs/storefront/components.md for the contracts.
|
|
5
|
+
*/
|
|
6
|
+
export { OrderLabelsProvider, useOrderLabels } from "./context"
|
|
7
|
+
export { defaultOrderLabels, type OrderLabels } from "./labels"
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
OrderConfirmationHeader,
|
|
11
|
+
type OrderConfirmationHeaderProps,
|
|
12
|
+
type OrderHeaderData,
|
|
13
|
+
} from "./order-confirmation-header"
|
|
14
|
+
export {
|
|
15
|
+
OrderItem,
|
|
16
|
+
displayItemFromOrderItem,
|
|
17
|
+
displayItemFromCartLine,
|
|
18
|
+
variantLabelFrom,
|
|
19
|
+
type OrderItemProps,
|
|
20
|
+
type OrderDisplayItem,
|
|
21
|
+
type CartLineLike,
|
|
22
|
+
} from "./order-item"
|
|
23
|
+
export { OrderItemsList, type OrderItemsListProps } from "./order-items-list"
|
|
24
|
+
export {
|
|
25
|
+
OrderTotals,
|
|
26
|
+
selectOrderTotalsRows,
|
|
27
|
+
orderTotalsFromSummary,
|
|
28
|
+
type OrderTotalsProps,
|
|
29
|
+
type OrderTotalsSource,
|
|
30
|
+
type OrderTotalsRow,
|
|
31
|
+
} from "./order-totals"
|
|
32
|
+
export {
|
|
33
|
+
OrderAddressCard,
|
|
34
|
+
type OrderAddressCardProps,
|
|
35
|
+
type OrderContactData,
|
|
36
|
+
} from "./order-address-card"
|
|
37
|
+
export {
|
|
38
|
+
OrderDeliveryCard,
|
|
39
|
+
pickTrackingLabels,
|
|
40
|
+
type OrderDeliveryCardProps,
|
|
41
|
+
type OrderDeliveryData,
|
|
42
|
+
type ShippingMethodDisplay,
|
|
43
|
+
type TrackingLabel,
|
|
44
|
+
} from "./order-delivery-card"
|
|
45
|
+
export {
|
|
46
|
+
OrderPaymentCard,
|
|
47
|
+
resolvePaymentTitle,
|
|
48
|
+
type OrderPaymentCardProps,
|
|
49
|
+
} from "./order-payment-card"
|
|
50
|
+
export {
|
|
51
|
+
OrderTimeline,
|
|
52
|
+
deriveFulfillmentStatus,
|
|
53
|
+
type OrderTimelineProps,
|
|
54
|
+
} from "./order-timeline"
|
|
55
|
+
export {
|
|
56
|
+
OrderHelpSection,
|
|
57
|
+
type OrderHelpSectionProps,
|
|
58
|
+
} from "./order-help-section"
|
|
59
|
+
export {
|
|
60
|
+
OrderCompletedTemplate,
|
|
61
|
+
type OrderCompletedTemplateProps,
|
|
62
|
+
} from "./order-completed-template"
|
package/src/order/labels.ts
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Order family label pack. Ported from `@1click/ui/src/order/labels.ts`
|
|
3
|
-
* (v2.3.1) unchanged, plus `tracking` — new in the Cartbase port because the
|
|
4
|
-
* Cartbase order surface exposes fulfillment tracking labels
|
|
5
|
-
* (`StoreOrderDetail.fulfillments[].fulfillment.labels`) that
|
|
6
|
-
* `OrderDeliveryCard` now renders.
|
|
7
|
-
*/
|
|
8
|
-
export type OrderLabels = {
|
|
9
|
-
orderConfirmed: string
|
|
10
|
-
confirmationSent: string
|
|
11
|
-
orderNumber: string
|
|
12
|
-
orderDate: string
|
|
13
|
-
summary: string
|
|
14
|
-
subtotal: string
|
|
15
|
-
shipping: string
|
|
16
|
-
discount: string
|
|
17
|
-
tax: string
|
|
18
|
-
total: string
|
|
19
|
-
/** Default label for the cash-on-delivery fee row. Used as the third-
|
|
20
|
-
* level fallback when neither a per-store override nor the server's
|
|
21
|
-
* `payment_method_fee_label` / fee line title is available. */
|
|
22
|
-
paymentMethodFee: string
|
|
23
|
-
contactInfo: string
|
|
24
|
-
delivery: string
|
|
25
|
-
paymentMethod: string
|
|
26
|
-
paymentMethodTitles: {
|
|
27
|
-
card: string
|
|
28
|
-
cod: string
|
|
29
|
-
/** Offline manual payments (pp_manual) — NOT cash on delivery. */
|
|
30
|
-
manual: string
|
|
31
|
-
paypal: string
|
|
32
|
-
}
|
|
33
|
-
needHelp: string
|
|
34
|
-
contactUs: string
|
|
35
|
-
returnsExchanges: string
|
|
36
|
-
orderPlaced: string
|
|
37
|
-
processing: string
|
|
38
|
-
shipped: string
|
|
39
|
-
delivered: string
|
|
40
|
-
free: string
|
|
41
|
-
continueShopping: string
|
|
42
|
-
qty: string
|
|
43
|
-
/** Heading for the fulfillment tracking-numbers block (Cartbase addition). */
|
|
44
|
-
tracking: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const defaultOrderLabels: OrderLabels = {
|
|
48
|
-
orderConfirmed: "Order confirmed",
|
|
49
|
-
confirmationSent: "We sent a confirmation to",
|
|
50
|
-
orderNumber: "Order",
|
|
51
|
-
orderDate: "Date",
|
|
52
|
-
summary: "Order summary",
|
|
53
|
-
subtotal: "Subtotal",
|
|
54
|
-
shipping: "Shipping",
|
|
55
|
-
discount: "Discount",
|
|
56
|
-
tax: "Tax",
|
|
57
|
-
total: "Total",
|
|
58
|
-
paymentMethodFee: "Payment method fee",
|
|
59
|
-
contactInfo: "Contact info",
|
|
60
|
-
delivery: "Delivery",
|
|
61
|
-
paymentMethod: "Payment method",
|
|
62
|
-
paymentMethodTitles: {
|
|
63
|
-
card: "Credit / debit card",
|
|
64
|
-
cod: "Cash on delivery",
|
|
65
|
-
manual: "Manual payment",
|
|
66
|
-
paypal: "PayPal",
|
|
67
|
-
},
|
|
68
|
-
needHelp: "Need help?",
|
|
69
|
-
contactUs: "Contact us",
|
|
70
|
-
returnsExchanges: "Returns & exchanges",
|
|
71
|
-
orderPlaced: "Placed",
|
|
72
|
-
processing: "Processing",
|
|
73
|
-
shipped: "Shipped",
|
|
74
|
-
delivered: "Delivered",
|
|
75
|
-
free: "FREE",
|
|
76
|
-
continueShopping: "Continue shopping",
|
|
77
|
-
qty: "qty.",
|
|
78
|
-
tracking: "Tracking",
|
|
79
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Order family label pack. Ported from `@1click/ui/src/order/labels.ts`
|
|
3
|
+
* (v2.3.1) unchanged, plus `tracking` — new in the Cartbase port because the
|
|
4
|
+
* Cartbase order surface exposes fulfillment tracking labels
|
|
5
|
+
* (`StoreOrderDetail.fulfillments[].fulfillment.labels`) that
|
|
6
|
+
* `OrderDeliveryCard` now renders.
|
|
7
|
+
*/
|
|
8
|
+
export type OrderLabels = {
|
|
9
|
+
orderConfirmed: string
|
|
10
|
+
confirmationSent: string
|
|
11
|
+
orderNumber: string
|
|
12
|
+
orderDate: string
|
|
13
|
+
summary: string
|
|
14
|
+
subtotal: string
|
|
15
|
+
shipping: string
|
|
16
|
+
discount: string
|
|
17
|
+
tax: string
|
|
18
|
+
total: string
|
|
19
|
+
/** Default label for the cash-on-delivery fee row. Used as the third-
|
|
20
|
+
* level fallback when neither a per-store override nor the server's
|
|
21
|
+
* `payment_method_fee_label` / fee line title is available. */
|
|
22
|
+
paymentMethodFee: string
|
|
23
|
+
contactInfo: string
|
|
24
|
+
delivery: string
|
|
25
|
+
paymentMethod: string
|
|
26
|
+
paymentMethodTitles: {
|
|
27
|
+
card: string
|
|
28
|
+
cod: string
|
|
29
|
+
/** Offline manual payments (pp_manual) — NOT cash on delivery. */
|
|
30
|
+
manual: string
|
|
31
|
+
paypal: string
|
|
32
|
+
}
|
|
33
|
+
needHelp: string
|
|
34
|
+
contactUs: string
|
|
35
|
+
returnsExchanges: string
|
|
36
|
+
orderPlaced: string
|
|
37
|
+
processing: string
|
|
38
|
+
shipped: string
|
|
39
|
+
delivered: string
|
|
40
|
+
free: string
|
|
41
|
+
continueShopping: string
|
|
42
|
+
qty: string
|
|
43
|
+
/** Heading for the fulfillment tracking-numbers block (Cartbase addition). */
|
|
44
|
+
tracking: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const defaultOrderLabels: OrderLabels = {
|
|
48
|
+
orderConfirmed: "Order confirmed",
|
|
49
|
+
confirmationSent: "We sent a confirmation to",
|
|
50
|
+
orderNumber: "Order",
|
|
51
|
+
orderDate: "Date",
|
|
52
|
+
summary: "Order summary",
|
|
53
|
+
subtotal: "Subtotal",
|
|
54
|
+
shipping: "Shipping",
|
|
55
|
+
discount: "Discount",
|
|
56
|
+
tax: "Tax",
|
|
57
|
+
total: "Total",
|
|
58
|
+
paymentMethodFee: "Payment method fee",
|
|
59
|
+
contactInfo: "Contact info",
|
|
60
|
+
delivery: "Delivery",
|
|
61
|
+
paymentMethod: "Payment method",
|
|
62
|
+
paymentMethodTitles: {
|
|
63
|
+
card: "Credit / debit card",
|
|
64
|
+
cod: "Cash on delivery",
|
|
65
|
+
manual: "Manual payment",
|
|
66
|
+
paypal: "PayPal",
|
|
67
|
+
},
|
|
68
|
+
needHelp: "Need help?",
|
|
69
|
+
contactUs: "Contact us",
|
|
70
|
+
returnsExchanges: "Returns & exchanges",
|
|
71
|
+
orderPlaced: "Placed",
|
|
72
|
+
processing: "Processing",
|
|
73
|
+
shipped: "Shipped",
|
|
74
|
+
delivered: "Delivered",
|
|
75
|
+
free: "FREE",
|
|
76
|
+
continueShopping: "Continue shopping",
|
|
77
|
+
qty: "qty.",
|
|
78
|
+
tracking: "Tracking",
|
|
79
|
+
}
|