@usequeek/theme-kit 0.1.21 → 0.1.22
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/README.md +187 -117
- package/api/collections.ts +5 -5
- package/api/shop.ts +1 -1
- package/client.ts +2 -0
- package/components/checkout/checkout-contact.tsx +3 -3
- package/components/image.tsx +5 -5
- package/components/language-switcher.css +131 -0
- package/components/language-switcher.tsx +144 -0
- package/components/markdown.tsx +1 -1
- package/components/powered-by-queek.tsx +4 -4
- package/components/product-media-frame.tsx +1 -1
- package/components/product-metafields.tsx +2 -3
- package/components/variant-picker.tsx +6 -9
- package/demo.ts +10 -14
- package/design-token-preview.tsx +0 -2
- package/edit-mode-active.tsx +3 -4
- package/hooks/use-announcement.ts +1 -1
- package/hooks/use-auth-flow.tsx +1 -1
- package/hooks/use-locales.ts +107 -0
- package/hooks/use-posts.ts +1 -1
- package/hooks/use-product-detail.ts +1 -2
- package/hooks/use-product-sections.ts +4 -6
- package/hooks/use-products.ts +5 -8
- package/index.ts +13 -16
- package/locales/en.default.json +4 -0
- package/next-reference.d.ts +2 -4
- package/package.json +3 -2
- package/page-renderer.tsx +5 -6
- package/provider.tsx +22 -2
- package/scripts/verify-package.ts +6 -8
- package/sdk/client.ts +13 -12
- package/sdk/error-handler.ts +1 -1
- package/sdk/platform.ts +6 -8
- package/sdk/queek-client.ts +11 -12
- package/sdk/server-store-client.ts +13 -17
- package/shared-blocks/metaobjects.tsx +1 -1
- package/stores/cart-store.ts +2 -2
- package/stores/checkout-store.ts +1 -1
- package/stores/edit-preview-store.ts +5 -6
- package/stores/user-store.ts +4 -5
- package/strings/pseudo-locale.ts +3 -4
- package/strings/theme-strings.ts +9 -7
- package/tests/auth-email-errors.test.tsx +2 -2
- package/tests/currency-contract.test.ts +2 -3
- package/tests/display-format.test.ts +17 -25
- package/tests/fixtures/external-theme.tsx +18 -2
- package/tests/language-switcher.test.tsx +350 -0
- package/tests/list-pagination.test.tsx +8 -8
- package/tests/locale-switch.test.ts +197 -0
- package/tests/locale-transport.test.tsx +3 -3
- package/tests/markdown-render.test.ts +5 -6
- package/tests/orders-walk.test.ts +5 -5
- package/tests/page-renderer-signature.test.tsx +1 -1
- package/tests/powered-by-queek.test.tsx +3 -3
- package/tests/powered-by-url.test.ts +2 -2
- package/tests/public-surface.test.ts +1 -4
- package/tests/shopper-chrome-strings.test.tsx +5 -6
- package/tests/storefront-client-scope.test.ts +5 -5
- package/tests/theme-hook-placement.test.tsx +2 -2
- package/tests/theme-strings-client.test.tsx +5 -5
- package/tests/theme-strings-pseudo.test.tsx +1 -1
- package/tests/theme-strings-typed.test.tsx +1 -1
- package/tests/theme-strings.test.tsx +8 -11
- package/tests/use-shop-prefetch.test.tsx +1 -1
- package/theme-mount.tsx +6 -11
- package/types/block.ts +7 -7
- package/types/media.ts +8 -9
- package/types/product.ts +8 -12
- package/types/theme.ts +26 -25
- package/types/vendor.ts +10 -12
- package/utils/announcement.ts +3 -3
- package/utils/benefit-icon.tsx +9 -11
- package/utils/brand.ts +7 -10
- package/utils/format.ts +5 -7
- package/utils/image-srcset.ts +2 -2
- package/utils/locale-switch.ts +208 -0
- package/utils/locale.ts +10 -11
- package/utils/menu-link.ts +1 -1
- package/utils/product-media.ts +1 -1
- package/utils/product-normalizer.ts +2 -2
- package/utils/vendor-host.ts +7 -11
package/utils/menu-link.ts
CHANGED
|
@@ -17,7 +17,7 @@ export function menuItemToHref(item: MenuItem, basePath: string = ''): string {
|
|
|
17
17
|
const href = `${basePath}/${item.ref}`;
|
|
18
18
|
const anchor = item.meta?.anchor;
|
|
19
19
|
// href may already end in "/" (the home page's ref is normalized to
|
|
20
|
-
// "/"
|
|
20
|
+
// "/") — never emit a doubled
|
|
21
21
|
// slash before the fragment.
|
|
22
22
|
return anchor ? `${href.replace(/\/$/, '')}#${anchor}` : href;
|
|
23
23
|
}
|
package/utils/product-media.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface MediaFrame {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Picks the largest tier a PDP hero should ever request. `view` is capped at
|
|
17
|
-
* 1600px
|
|
17
|
+
* 1600px, which covers every theme's hero box
|
|
18
18
|
* at DPR2 — the raw `original` is uncapped and unoptimized.
|
|
19
19
|
*/
|
|
20
20
|
function heroUrl(variants: ImageVariants | null | undefined): string | null {
|
|
@@ -37,8 +37,8 @@ function toBool(value: unknown, fallback = false): boolean {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Same base/sale/compare-at shape as normalizePricing(), but a variant's own price lives on
|
|
40
|
-
* FLAT fields (price/discount_price/compare_at_price/discount_amount
|
|
41
|
-
*
|
|
40
|
+
* FLAT fields (price/discount_price/compare_at_price/discount_amount), never nested
|
|
41
|
+
* under a `pricing` key.
|
|
42
42
|
* Reading `variant.pricing?.sale_amount` (as this used to) is always undefined, so every
|
|
43
43
|
* variant silently fell back to the base product's price — picking Denim vs Taupe never
|
|
44
44
|
* changed what was shown, even though the backend had already computed the right number.
|
package/utils/vendor-host.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vendor resolution from a hostname: which store is this request for?
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* and
|
|
6
|
-
* core depended on the app. Nothing here is app-specific: it reads env and
|
|
7
|
-
* resolves a slug. (The actual Next middleware is `proxy.ts`; the old filename
|
|
8
|
-
* suggested otherwise and was never that.)
|
|
4
|
+
* Nothing here is app-specific: it reads env and resolves a slug, so the kit's
|
|
5
|
+
* server fetchers and a host app's proxy can both import it.
|
|
9
6
|
*/
|
|
10
7
|
|
|
11
|
-
// Mirrors
|
|
8
|
+
// Mirrors the API's reserved store slugs. Keep in sync.
|
|
12
9
|
// These are subdomains the storefront proxy must NOT treat as vendor slugs.
|
|
13
10
|
export const RESERVED_VENDOR_SLUGS = new Set([
|
|
14
11
|
// Live platform subdomains
|
|
@@ -24,11 +21,10 @@ export const RESERVED_VENDOR_SLUGS = new Set([
|
|
|
24
21
|
'staff', 'team', 'queek', 'merchant', 'vendor', 'rider', 'customer',
|
|
25
22
|
]);
|
|
26
23
|
|
|
27
|
-
// Every sluggable
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
// backend round-trip instead of burning calls that all 404. This is what stops
|
|
24
|
+
// Every sluggable API model (Vendor, Product, Category, Region, Service)
|
|
25
|
+
// produces lowercase alphanumeric slugs, optionally hyphen-separated, never a
|
|
26
|
+
// dot/underscore/uppercase. Anything else cannot be a real slug of any kind, so
|
|
27
|
+
// reject it before any API round-trip instead of burning calls that all 404. This is what stops
|
|
32
28
|
// scanners probing `.env`, `.ssh`, `docker-compose.yaml`, `*.php` etc —
|
|
33
29
|
// RESERVED_VENDOR_SLUGS alone only covers known words, not the infinite space
|
|
34
30
|
// of file-extension guesses.
|