@amboras-dev/storefront-core 2026.11.9 → 2026.11.10

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/CHANGELOG.md CHANGED
@@ -2,6 +2,71 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2026.11.10
6
+
7
+ ### Fixed
8
+
9
+ - `metafieldHtml` shows a `value` that is not a rich-text tree as escaped text, never as markup; a rich-text link to `/\host` (read by browsers as `//host`) keeps only its text.
10
+ - `getMetaobjectPage`: only a 404 or 410 is "not found". Any other 4xx (429, 401/403, 400) or a body that is not JSON throws `StoreMetaobjectPageUnavailableError`, so it never renders or caches a 404 for a live page.
11
+ - `amboras-check redirect-boundaries` also guards `app/pages` and `app/pages/[handle]` (metaobject entry web pages).
12
+
13
+ ### Added
14
+
15
+ - Blog comments on the storefront (Shopify's article comments; the blog's Comments setting: disabled, allowed pending
16
+ moderation, or allowed and automatically published):
17
+ - `lib/store-blog`: `getArticleComments(blog, article, { limit, offset })` reads
18
+ `GET /store/content/blogs/:blog/articles/:handle/comments` (published comments only, newest first as on Shopify, no emails, with the blog's
19
+ `commentable` setting; `null` for a missing post; strict like the other reads, an outage throws
20
+ `StoreBlogUnavailableError`). `postArticleComment(blog, article, { author, email, body, website })` posts one
21
+ and never throws: `posted` (`status` `published` or `pending`), `invalid` (a message per field),
22
+ `comments_disabled`, `rate_limited`, `not_found` or `unavailable`. `website` is the honeypot. Types
23
+ `ArticleComment`, `ArticleCommentsResponse`, `ArticleCommentInput`, `BlogCommentable`,
24
+ `PostArticleCommentResult`; `MAX_COMMENTS_PAGE`.
25
+ - `client/use-store-blog`: `usePostArticleComment(blog, article)` (the comment form's mutation).
26
+ - No new shims: the existing `lib/store-blog.ts` and `hooks/use-store-blog.ts` re-export everything.
27
+ - Metaobjects on the storefront (content module step 3, "shopper render path for metaobjects"):
28
+ - `lib/store-metaobjects`: `getMetaobjects(type, { limit, offset, revalidate })` and `getMetaobject(type, handle)`
29
+ read `GET /store/metaobjects/:type` (active entries of a definition with storefront access, storefront-visible
30
+ fields only), cached by Next (`revalidate` 60 by default); `metaobjectText(entry, key)` renders a value.
31
+ - `client/use-store-metaobjects`: `useMetaobjects(type)` and `useMetaobject(type, handle)`, the browser twins.
32
+ - `lib/store-metafields`: `getProductMetafields(productId, ['custom.designer'])` reads a product's metafields in the
33
+ order asked (`?metafields=` with `fields=id`); `findMetafield`, `metaobjectOf` and `metaobjectsOf` read the
34
+ entry a metaobject-reference metafield points at, which the store API now embeds (display name + visible
35
+ values; Medusa content step 3).
36
+ - All fail-soft: an older store API, an unknown type or a hidden definition gives an empty list / `null`.
37
+ - Needs new shims `hooks/use-store-metaobjects.ts`, `lib/store-metafields.ts` and `lib/store-metaobjects.ts` (added to
38
+ `core-manifest.json`).
39
+ - Metafield formats (content module step 4, Shopify's): `lib/store-metafields` adds `fileOf(metafield)` (a file
40
+ metafield's file: `url`, `alt`, `width`, `height`, `mime_type`, `size` — the store API now stores the
41
+ Files-library file, not a bare URL), `metafieldHtml(metafield)` (render a rich-text metafield: the store API's new
42
+ `html`, else the tree in `value`, else an older HTML value) and `richTextToHtml(tree)` (a metaobject's rich-text
43
+ field). Types `StoreFile` and `RichTextNode`; `StoreMetafield.html`.
44
+ - Metaobject web pages (content module step 6B, Shopify's "Publish entries as web pages"): `lib/store-metaobjects`
45
+ adds `getMetaobjectPage(type, handle)` (`/store/metaobjects/:type/:handle`: an active entry of a definition with
46
+ storefront access and web pages on, its title and description from the definition's page fields) and
47
+ `metaobjectPagePath(type, handle)` (`/pages/<type>/<handle>`). Strict: a missing entry is `null`, a failed read
48
+ throws `StoreMetaobjectPageUnavailableError` (never a 404 during an outage). Type `StoreMetaobjectPage`.
49
+ - The blog in core (content module step 5; "Blog = core Content, as on Shopify"), for stores whose blog pages are the
50
+ starter template's (`app/blogs/**` reading `@/lib/store-blog`). Same store routes and response shapes as the
51
+ `@amboras-dev/blog` plugin:
52
+ - `lib/store-blog`: `getBlogs()`, `getBlogArticles(blog, { limit, offset })`, `getAllArticles({ perBlog })` (every
53
+ post across blogs, newest first, each with its blog) and `getArticle(blog, article)`, cached by Next
54
+ (`revalidate` 60) and bounded by `STORE_FETCH_TIMEOUT_MS`; `blogPath` / `articlePath` build Shopify's
55
+ `/blogs/<blog>[/<article>]`. A missing blog or post (404/410) is `null`; any other failure throws
56
+ `StoreBlogUnavailableError` (never a 404 during an outage).
57
+ - Moved posts and blogs: the store API answers an old path with the post or blog it moved to (Medusa
58
+ `url_redirect`), carrying the current handles; `articleRedirectPath(blog, article, data)` and
59
+ `blogRedirectPath(blog, data)` return the path to answer 308 to (a renamed post, a post moved to another blog,
60
+ a renamed or archived blog, a URL in another case), or `null`.
61
+ - `client/use-store-blog`: `useBlogs()`, `useBlogArticles(blog, { page, perPage })` and
62
+ `useArticle(blog, article)`, the browser twins (fail-soft).
63
+ - New shims `hooks/use-store-blog.ts` and `lib/store-blog.ts` (in `core-manifest.json`). Inert unless imported:
64
+ no route, no side effect, and the paths never collide with the plugin's (`components/plugins/blog/*`,
65
+ `app/blogs/**`), so a store on the Blog plugin is unchanged by the raise. Named `store-blog`, not `blog`, so a
66
+ raise never overwrites a store's own `lib/blog.ts`.
67
+ - `amboras-check redirect-boundaries` guards `app/blogs` and `app/blogs/[blog]` when the store's blog pages are
68
+ core's (they import `@/lib/store-blog`). A store on the Blog plugin is not checked there, as before.
69
+
5
70
  ## 2026.11.9
6
71
 
7
72
  ### Fixed
@@ -22,17 +22,34 @@
22
22
  * Usage: `node scripts/check-redirect-boundaries.mjs [storefrontRoot]`.
23
23
  * Exit 1 with the offending paths, exit 0 otherwise.
24
24
  */
25
- import { existsSync } from 'node:fs'
25
+ import { existsSync, readFileSync } from 'node:fs'
26
26
  import { join, resolve } from 'node:path'
27
27
  import { fileURLToPath } from 'node:url'
28
28
 
29
- export const GUARDED_DIRS = ['app/products', 'app/collections', 'app/[...slug]']
29
+ // app/pages: a metaobject entry's web page (app/pages/[handle]/[entry]) 308s to a merchant URL redirect when
30
+ // the entry is gone, so a loading.tsx in either parent would turn that into a 200 (content module).
31
+ export const GUARDED_DIRS = ['app/products', 'app/collections', 'app/[...slug]', 'app/pages', 'app/pages/[handle]']
32
+ // app/blogs: core's blog pages 308 a moved post or blog, so a loading.tsx in either parent would turn that into a
33
+ // 200. Guarded only when the blog pages are core's (they import `@/lib/store-blog`): a store on the Blog plugin
34
+ // owns its app/blogs files and is checked exactly as before.
35
+ export const CORE_BLOG_DIRS = ['app/blogs', 'app/blogs/[blog]']
36
+ const CORE_BLOG_MARKER = '@/lib/store-blog'
30
37
  const LOADING_FILES = ['loading.tsx', 'loading.ts', 'loading.jsx', 'loading.js']
31
38
 
39
+ function hasCoreBlogPages(root) {
40
+ return ['app/blogs/[blog]/page.tsx', 'app/blogs/[blog]/[article]/page.tsx'].some((file) => {
41
+ try {
42
+ return readFileSync(join(root, file), 'utf8').includes(CORE_BLOG_MARKER)
43
+ } catch {
44
+ return false
45
+ }
46
+ })
47
+ }
48
+
32
49
  /** Offending files (relative paths) under `root`. */
33
50
  export function findRedirectBoundaryViolations(root) {
34
51
  const found = []
35
- for (const dir of GUARDED_DIRS) {
52
+ for (const dir of hasCoreBlogPages(root) ? [...GUARDED_DIRS, ...CORE_BLOG_DIRS] : GUARDED_DIRS) {
36
53
  for (const file of LOADING_FILES) {
37
54
  if (existsSync(join(root, dir, file))) found.push(`${dir}/${file}`)
38
55
  }
@@ -67,5 +84,5 @@ if (isMain) {
67
84
  )
68
85
  process.exit(1)
69
86
  }
70
- console.log('[check-redirect-boundaries] OK: no loading boundary above a redirecting segment (products, collections, [...slug]).')
87
+ console.log('[check-redirect-boundaries] OK: no loading boundary above a redirecting segment (products, collections, [...slug], pages, core blog pages).')
71
88
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated by scripts/build-manifest.mjs. Paths are relative to the storefront app root.",
3
3
  "package": "@amboras-dev/storefront-core",
4
- "version": "2026.11.9",
4
+ "version": "2026.11.10",
5
5
  "shims": [
6
6
  {
7
7
  "path": "hooks/use-auth.ts",
@@ -178,6 +178,11 @@
178
178
  "import": "@amboras-dev/storefront-core/client/use-shipping-countries",
179
179
  "kind": "reexport"
180
180
  },
181
+ {
182
+ "path": "hooks/use-store-blog.ts",
183
+ "import": "@amboras-dev/storefront-core/client/use-store-blog",
184
+ "kind": "reexport"
185
+ },
181
186
  {
182
187
  "path": "hooks/use-store-config.ts",
183
188
  "import": "@amboras-dev/storefront-core/client/use-store-config",
@@ -188,6 +193,11 @@
188
193
  "import": "@amboras-dev/storefront-core/client/use-store-credit",
189
194
  "kind": "reexport"
190
195
  },
196
+ {
197
+ "path": "hooks/use-store-metaobjects.ts",
198
+ "import": "@amboras-dev/storefront-core/client/use-store-metaobjects",
199
+ "kind": "reexport"
200
+ },
191
201
  {
192
202
  "path": "hooks/use-store-search.ts",
193
203
  "import": "@amboras-dev/storefront-core/client/use-store-search",
@@ -478,11 +488,26 @@
478
488
  "import": "@amboras-dev/storefront-core/lib/store-api",
479
489
  "kind": "reexport"
480
490
  },
491
+ {
492
+ "path": "lib/store-blog.ts",
493
+ "import": "@amboras-dev/storefront-core/lib/store-blog",
494
+ "kind": "reexport"
495
+ },
481
496
  {
482
497
  "path": "lib/store-config.ts",
483
498
  "import": "@amboras-dev/storefront-core/lib/store-config",
484
499
  "kind": "reexport"
485
500
  },
501
+ {
502
+ "path": "lib/store-metafields.ts",
503
+ "import": "@amboras-dev/storefront-core/lib/store-metafields",
504
+ "kind": "reexport"
505
+ },
506
+ {
507
+ "path": "lib/store-metaobjects.ts",
508
+ "import": "@amboras-dev/storefront-core/lib/store-metaobjects",
509
+ "kind": "reexport"
510
+ },
486
511
  {
487
512
  "path": "lib/stripe/appearance.ts",
488
513
  "import": "@amboras-dev/storefront-core/lib/stripe/appearance",
@@ -0,0 +1,53 @@
1
+ import type { ArticleCommentInput, ArticleResponse, PostArticleCommentResult } from '../lib/store-blog.js';
2
+ /**
3
+ * The blog in the browser — the client twin of `lib/store-blog` (`getBlogs`,
4
+ * `getBlogArticles`, `getArticle`, for server components). For interactive
5
+ * islands (pagination, a "latest posts" strip). Same routes, same rules, and
6
+ * FAIL-SOFT: a missing blog or post, or any failure, gives an empty list /
7
+ * null, never an error state the page has to handle. `usePostArticleComment` posts a
8
+ * shopper's comment (the article page's comment form).
9
+ */
10
+ export declare const blogKeys: {
11
+ all: readonly ["blog"];
12
+ blogs: () => readonly ["blog", "blogs"];
13
+ articles: (blogHandle: string, page: number, perPage: number) => readonly ["blog", "articles", string, number, number];
14
+ article: (blogHandle: string, articleHandle: string) => readonly ["blog", "article", string, string];
15
+ };
16
+ /** The store's active blogs. */
17
+ export declare function useBlogs(options?: {
18
+ enabled?: boolean;
19
+ }): {
20
+ blogs: import("../lib/store-blog.js").Blog[];
21
+ count: number;
22
+ isLoading: boolean;
23
+ };
24
+ /** A page of a blog's published posts (`page` from 1). `blog` is null when there is no such blog. */
25
+ export declare function useBlogArticles(blogHandle: string, options?: {
26
+ page?: number;
27
+ perPage?: number;
28
+ enabled?: boolean;
29
+ }): {
30
+ blog: import("../lib/store-blog.js").Blog | null;
31
+ articles: import("../lib/store-blog.js").Article[];
32
+ count: number;
33
+ isLoading: boolean;
34
+ };
35
+ /** One published post; `data` is null when there is none. */
36
+ export declare function useArticle(blogHandle: string, articleHandle: string, options?: {
37
+ enabled?: boolean;
38
+ }): {
39
+ data: ArticleResponse | null;
40
+ isLoading: boolean;
41
+ };
42
+ /**
43
+ * Post a comment on a published post (the article page's comment form). `mutateAsync` resolves a
44
+ * `PostArticleCommentResult` and never rejects: `posted` (`status` `published` or `pending`), `invalid` (field
45
+ * messages), `comments_disabled`, `rate_limited`, `not_found` or `unavailable`. `result` is the last outcome.
46
+ */
47
+ export declare function usePostArticleComment(blogHandle: string, articleHandle: string): {
48
+ postComment: import("@tanstack/react-query").UseMutateAsyncFunction<PostArticleCommentResult, never, ArticleCommentInput, unknown>;
49
+ result: PostArticleCommentResult | null;
50
+ isPosting: boolean;
51
+ reset: () => void;
52
+ };
53
+ //# sourceMappingURL=use-store-blog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-blog.d.ts","sourceRoot":"","sources":["../../src/hooks/use-store-blog.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAuC,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAE/I;;;;;;;GAOG;AAEH,eAAO,MAAM,QAAQ;;;2BAGI,MAAM,QAAQ,MAAM,WAAW,MAAM;0BACtC,MAAM,iBAAiB,MAAM;CACpD,CAAA;AAYD,gCAAgC;AAChC,wBAAgB,QAAQ,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;EAQ3D;AAED,qGAAqG;AACrG,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;EAYvH;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;EASxG;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;;EAU9E"}
@@ -0,0 +1,77 @@
1
+ 'use client';
2
+ import { useMutation, useQuery } from '@tanstack/react-query';
3
+ import { medusaBackendUrl, storeHeaders } from '../lib/store-api.js';
4
+ import { postArticleComment } from '../lib/store-blog.js';
5
+ /**
6
+ * The blog in the browser — the client twin of `lib/store-blog` (`getBlogs`,
7
+ * `getBlogArticles`, `getArticle`, for server components). For interactive
8
+ * islands (pagination, a "latest posts" strip). Same routes, same rules, and
9
+ * FAIL-SOFT: a missing blog or post, or any failure, gives an empty list /
10
+ * null, never an error state the page has to handle. `usePostArticleComment` posts a
11
+ * shopper's comment (the article page's comment form).
12
+ */
13
+ export const blogKeys = {
14
+ all: ['blog'],
15
+ blogs: () => [...blogKeys.all, 'blogs'],
16
+ articles: (blogHandle, page, perPage) => [...blogKeys.all, 'articles', blogHandle, page, perPage],
17
+ article: (blogHandle, articleHandle) => [...blogKeys.all, 'article', blogHandle, articleHandle],
18
+ };
19
+ async function getJson(path) {
20
+ try {
21
+ const res = await fetch(`${medusaBackendUrl()}${path}`, { headers: storeHeaders({ contentType: false }) });
22
+ if (!res.ok)
23
+ return null;
24
+ return (await res.json());
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ }
30
+ /** The store's active blogs. */
31
+ export function useBlogs(options = {}) {
32
+ const { data, isLoading } = useQuery({
33
+ queryKey: blogKeys.blogs(),
34
+ queryFn: () => getJson('/store/content/blogs'),
35
+ enabled: options.enabled ?? true,
36
+ staleTime: 60_000,
37
+ });
38
+ return { blogs: data?.blogs ?? [], count: data?.count ?? 0, isLoading };
39
+ }
40
+ /** A page of a blog's published posts (`page` from 1). `blog` is null when there is no such blog. */
41
+ export function useBlogArticles(blogHandle, options = {}) {
42
+ const { page = 1, perPage = 20, enabled = true } = options;
43
+ const { data, isLoading } = useQuery({
44
+ queryKey: blogKeys.articles(blogHandle, page, perPage),
45
+ queryFn: () => getJson(`/store/content/blogs/${encodeURIComponent(blogHandle)}/articles?limit=${perPage}&offset=${(Math.max(page, 1) - 1) * perPage}`),
46
+ enabled: enabled && !!blogHandle,
47
+ staleTime: 60_000,
48
+ });
49
+ return { blog: data?.blog ?? null, articles: data?.articles ?? [], count: data?.count ?? 0, isLoading };
50
+ }
51
+ /** One published post; `data` is null when there is none. */
52
+ export function useArticle(blogHandle, articleHandle, options = {}) {
53
+ const { data, isLoading } = useQuery({
54
+ queryKey: blogKeys.article(blogHandle, articleHandle),
55
+ queryFn: () => getJson(`/store/content/blogs/${encodeURIComponent(blogHandle)}/articles/${encodeURIComponent(articleHandle)}`),
56
+ enabled: (options.enabled ?? true) && !!blogHandle && !!articleHandle,
57
+ staleTime: 60_000,
58
+ });
59
+ return { data: data ?? null, isLoading };
60
+ }
61
+ /**
62
+ * Post a comment on a published post (the article page's comment form). `mutateAsync` resolves a
63
+ * `PostArticleCommentResult` and never rejects: `posted` (`status` `published` or `pending`), `invalid` (field
64
+ * messages), `comments_disabled`, `rate_limited`, `not_found` or `unavailable`. `result` is the last outcome.
65
+ */
66
+ export function usePostArticleComment(blogHandle, articleHandle) {
67
+ const mutation = useMutation({
68
+ mutationFn: (input) => postArticleComment(blogHandle, articleHandle, input),
69
+ });
70
+ return {
71
+ postComment: mutation.mutateAsync,
72
+ result: mutation.data ?? null,
73
+ isPosting: mutation.isPending,
74
+ reset: mutation.reset,
75
+ };
76
+ }
77
+ //# sourceMappingURL=use-store-blog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-blog.js","sourceRoot":"","sources":["../../src/hooks/use-store-blog.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,EAAE,CAAC,MAAM,CAAU;IACtB,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAU;IAChD,QAAQ,EAAE,CAAC,UAAkB,EAAE,IAAY,EAAE,OAAe,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,CAAU;IAClI,OAAO,EAAE,CAAC,UAAkB,EAAE,aAAqB,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AW,CAAuD;QACjF,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,CAAC;KAC5E,CAAC,CAAA;IACF,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,MAAM,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI;QAC7B,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAA;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { StoreMetaobjectEntry } from '../lib/store-metaobjects.js';
2
+ /**
3
+ * Metaobjects in the browser — the client twin of `lib/store-metaobjects`
4
+ * (`getMetaobjects` / `getMetaobject`, for server components). Same route
5
+ * (`GET /store/metaobjects/:type`), same rules: active entries of a definition
6
+ * with storefront access, storefront-visible fields only, and FAIL-SOFT — a
7
+ * missing route, an unknown type or a hidden definition gives an empty list /
8
+ * null, never an error state the page has to handle.
9
+ */
10
+ export declare const metaobjectKeys: {
11
+ all: readonly ["metaobjects"];
12
+ list: (type: string, params: {
13
+ limit?: number;
14
+ offset?: number;
15
+ }) => readonly ["metaobjects", "list", string, {
16
+ limit?: number;
17
+ offset?: number;
18
+ }];
19
+ entry: (type: string, handle: string) => readonly ["metaobjects", "entry", string, string];
20
+ };
21
+ /** Active entries of one metaobject type, e.g. `useMetaobjects('faq')`. */
22
+ export declare function useMetaobjects(type: string, options?: {
23
+ limit?: number;
24
+ offset?: number;
25
+ enabled?: boolean;
26
+ }): {
27
+ entries: StoreMetaobjectEntry[];
28
+ count: number;
29
+ isLoading: boolean;
30
+ };
31
+ /** One entry by handle, e.g. `useMetaobject('designer', 'stella-mccartney')`; `entry` is null when there is none. */
32
+ export declare function useMetaobject(type: string, handle: string | null | undefined, options?: {
33
+ enabled?: boolean;
34
+ }): {
35
+ entry: StoreMetaobjectEntry | null;
36
+ isLoading: boolean;
37
+ };
38
+ //# sourceMappingURL=use-store-metaobjects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-metaobjects.d.ts","sourceRoot":"","sources":["../../src/hooks/use-store-metaobjects.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAuB,MAAM,6BAA6B,CAAA;AAE5F;;;;;;;GAOG;AAEH,eAAO,MAAM,cAAc;;iBAEZ,MAAM,UAAU;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;gBAAzB,MAAM;iBAAW,MAAM;;kBAChD,MAAM,UAAU,MAAM;CACrC,CAAA;AAkBD,2EAA2E;AAC3E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;EAShH;AAED,qHAAqH;AACrH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;EAYjH"}
@@ -0,0 +1,61 @@
1
+ 'use client';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { medusaBackendUrl, storeHeaders } from '../lib/store-api.js';
4
+ /**
5
+ * Metaobjects in the browser — the client twin of `lib/store-metaobjects`
6
+ * (`getMetaobjects` / `getMetaobject`, for server components). Same route
7
+ * (`GET /store/metaobjects/:type`), same rules: active entries of a definition
8
+ * with storefront access, storefront-visible fields only, and FAIL-SOFT — a
9
+ * missing route, an unknown type or a hidden definition gives an empty list /
10
+ * null, never an error state the page has to handle.
11
+ */
12
+ export const metaobjectKeys = {
13
+ all: ['metaobjects'],
14
+ list: (type, params) => [...metaobjectKeys.all, 'list', type, params],
15
+ entry: (type, handle) => [...metaobjectKeys.all, 'entry', type, handle],
16
+ };
17
+ async function fetchEntries(type, params) {
18
+ const query = new URLSearchParams();
19
+ for (const [key, value] of Object.entries(params))
20
+ if (value !== undefined && value !== '')
21
+ query.set(key, String(value));
22
+ const qs = query.toString();
23
+ try {
24
+ const res = await fetch(`${medusaBackendUrl()}/store/metaobjects/${encodeURIComponent(type)}${qs ? `?${qs}` : ''}`, {
25
+ headers: storeHeaders({ contentType: false }),
26
+ });
27
+ if (!res.ok)
28
+ return { entries: [], count: 0 };
29
+ const data = (await res.json());
30
+ return { entries: data.entries ?? [], count: data.count ?? 0 };
31
+ }
32
+ catch {
33
+ return { entries: [], count: 0 };
34
+ }
35
+ }
36
+ /** Active entries of one metaobject type, e.g. `useMetaobjects('faq')`. */
37
+ export function useMetaobjects(type, options = {}) {
38
+ const { limit, offset, enabled = true } = options;
39
+ const { data, isLoading } = useQuery({
40
+ queryKey: metaobjectKeys.list(type, { limit, offset }),
41
+ queryFn: () => fetchEntries(type, { limit, offset }),
42
+ enabled: enabled && !!type,
43
+ staleTime: 60_000,
44
+ });
45
+ return { entries: data?.entries ?? [], count: data?.count ?? 0, isLoading };
46
+ }
47
+ /** One entry by handle, e.g. `useMetaobject('designer', 'stella-mccartney')`; `entry` is null when there is none. */
48
+ export function useMetaobject(type, handle, options = {}) {
49
+ const { enabled = true } = options;
50
+ const { data, isLoading } = useQuery({
51
+ queryKey: metaobjectKeys.entry(type, handle ?? ''),
52
+ queryFn: async () => {
53
+ const list = await fetchEntries(type, { handle: handle ?? undefined });
54
+ return list.entries.find((entry) => entry.handle === handle) ?? null;
55
+ },
56
+ enabled: enabled && !!type && !!handle,
57
+ staleTime: 60_000,
58
+ });
59
+ return { entry: data ?? null, isLoading };
60
+ }
61
+ //# sourceMappingURL=use-store-metaobjects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-store-metaobjects.js","sourceRoot":"","sources":["../../src/hooks/use-store-metaobjects.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO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,MAAM,IAAI,EAAE,CAAC;QAClD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,SAAS,EAAE,CAAC,CAAA;YACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,IAAI,CAAA;QACtE,CAAC;QACD,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM;QACtC,SAAS,EAAE,MAAM;KAClB,CAAC,CAAA;IACF,OAAO,EAAE,KAAK,EAAE,IAAI,IAAI,IAAI,EAAE,SAAS,EAAE,CAAA;AAC3C,CAAC"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * The blog on the storefront (Shopify's Online Store blogs, artifact decision
3
+ * "Blog = core Content, as on Shopify"). Moved into core from the opt-in
4
+ * `@amboras-dev/blog` plugin: the same reads, the same response shapes, so a
5
+ * page written against the plugin reads the same data here.
6
+ *
7
+ * Shopify's paths: `/blogs` (every post), `/blogs/<blog>` (one blog),
8
+ * `/blogs/<blog>/<article>` (one post).
9
+ *
10
+ * Server-side reads of the public store API, cached by Next for `revalidate`
11
+ * seconds (60 by default; the store API caches the routes for 60 s too) and
12
+ * bounded by `STORE_FETCH_TIMEOUT_MS`. A missing blog or post (Medusa's own
13
+ * 404, or a store API without the route) resolves to `null` / an empty list,
14
+ * so the page answers `notFound()`. Anything else (a 5xx, a timeout, no
15
+ * response, a 429 or any other 4xx, a body that is not JSON) throws
16
+ * `StoreBlogUnavailableError` to the page's error boundary instead: an
17
+ * outage must never render, or cache, a 404 for a live post (the product
18
+ * page's rule).
19
+ *
20
+ * Moved posts (content module step 5): when a post's handle or blog changed,
21
+ * the store API answers the OLD path with the post it moved to, carrying the
22
+ * CURRENT handles. `articleRedirectPath` / `blogRedirectPath` compare them
23
+ * with the URL asked for; the page answers 308 (`permanentRedirect`) to the
24
+ * returned path, so a shared or indexed link keeps working and search engines
25
+ * learn the new URL.
26
+ *
27
+ * Article `content` is HTML sanitised by the store API: safe to render.
28
+ * Browser-side twins: `client/use-store-blog`.
29
+ *
30
+ * Inert unless imported: no side effects, nothing registers a route. A store
31
+ * on the Blog plugin (`@amboras-dev/blog`, `components/plugins/blog/*`) never
32
+ * imports it, so a core raise changes nothing there.
33
+ */
34
+ export type BlogStatus = 'active' | 'archived';
35
+ export type ArticleStatus = 'draft' | 'published' | 'archived';
36
+ /** A blog as the store API serves it. */
37
+ export interface Blog {
38
+ id: string;
39
+ title: string;
40
+ handle: string;
41
+ description: string | null;
42
+ status: BlogStatus;
43
+ seo_title?: string | null;
44
+ seo_description?: string | null;
45
+ created_at: string;
46
+ updated_at: string;
47
+ /** Posts in the blog, when the store API sends it. */
48
+ article_count?: number;
49
+ }
50
+ /** A published post as the store API serves it. */
51
+ export interface Article {
52
+ id: string;
53
+ blog_id: string;
54
+ title: string;
55
+ handle: string;
56
+ /** Sanitised HTML (safe to render). */
57
+ content: string | null;
58
+ excerpt: string | null;
59
+ author_name: string | null;
60
+ featured_image_url: string | null;
61
+ tags: string[];
62
+ status: ArticleStatus;
63
+ published_at: string | null;
64
+ seo_title: string | null;
65
+ seo_description: string | null;
66
+ created_at: string;
67
+ updated_at: string;
68
+ }
69
+ /** GET /store/content/blogs */
70
+ export interface BlogsResponse {
71
+ blogs: Blog[];
72
+ count: number;
73
+ }
74
+ /** GET /store/content/blogs/:blog/articles */
75
+ export interface BlogArticlesResponse {
76
+ blog: Blog;
77
+ articles: Article[];
78
+ count: number;
79
+ offset: number;
80
+ limit: number;
81
+ }
82
+ /** GET /store/content/blogs/:blog/articles/:handle */
83
+ export interface ArticleResponse {
84
+ blog: Blog;
85
+ article: Article;
86
+ }
87
+ /** A post with its blog (the `/blogs` index lists posts across blogs). */
88
+ export type ArticleWithBlog = Article & {
89
+ blog: Blog;
90
+ };
91
+ export interface BlogReadOptions {
92
+ /** Seconds Next may serve the cached response (default 60). */
93
+ revalidate?: number;
94
+ }
95
+ /** The store API failed a blog read (5xx, timeout, no response, a 4xx other than 404/410). `reason` is PII-free (`HTTP 503`, `TimeoutError`). */
96
+ export declare class StoreBlogUnavailableError extends Error {
97
+ readonly reason: string;
98
+ constructor(reason: string);
99
+ }
100
+ /** The store API's page cap for a blog's posts. */
101
+ export declare const MAX_ARTICLES_PAGE = 50;
102
+ /** `/blogs/<blog>` (handles are URL-encoded). */
103
+ export declare function blogPath(blogHandle: string): string;
104
+ /** `/blogs/<blog>/<article>` (handles are URL-encoded). */
105
+ export declare function articlePath(blogHandle: string, articleHandle: string): string;
106
+ /** The store's active blogs (empty when there are none, or on a store API without the route). */
107
+ export declare function getBlogs(options?: BlogReadOptions): Promise<BlogsResponse>;
108
+ /** A blog and its published, visible-now posts (newest first), or null when there is no such blog. */
109
+ export declare function getBlogArticles(blogHandle: string, params?: {
110
+ limit?: number;
111
+ offset?: number;
112
+ }, options?: BlogReadOptions): Promise<BlogArticlesResponse | null>;
113
+ /**
114
+ * Every published post across every active blog, newest first, each with its
115
+ * blog (for `/blogs/<blog>/<article>` links). Reads at most
116
+ * `perBlog` (default and cap: 50) posts per blog.
117
+ */
118
+ export declare function getAllArticles(options?: BlogReadOptions & {
119
+ perBlog?: number;
120
+ }): Promise<ArticleWithBlog[]>;
121
+ /**
122
+ * One published post by blog + post handle, or null. A moved post comes back
123
+ * under its CURRENT handles: check `articleRedirectPath` before rendering.
124
+ */
125
+ export declare function getArticle(blogHandle: string, articleHandle: string, options?: BlogReadOptions): Promise<ArticleResponse | null>;
126
+ /**
127
+ * The path to 308 to when the post was found under other handles than the URL
128
+ * asked for (its handle or blog changed, or the URL's case differs), else
129
+ * null. Route params may arrive encoded or not; both compare equal.
130
+ *
131
+ * const data = await getArticle(params.blog, params.article)
132
+ * if (!data) notFound()
133
+ * const moved = articleRedirectPath(params.blog, params.article, data)
134
+ * if (moved) permanentRedirect(moved)
135
+ */
136
+ export declare function articleRedirectPath(blogHandle: string, articleHandle: string, data: ArticleResponse): string | null;
137
+ /** The path to 308 to when the blog was found under another handle than the URL asked for, else null. */
138
+ export declare function blogRedirectPath(blogHandle: string, data: {
139
+ blog: Blog;
140
+ }): string | null;
141
+ /** The blog's Comments setting. */
142
+ export type BlogCommentable = 'no' | 'moderate' | 'yes';
143
+ /** A published comment as the store API serves it (`body` is plain text: render it as text, never as HTML). */
144
+ export interface ArticleComment {
145
+ id: string;
146
+ author: string;
147
+ body: string;
148
+ created_at: string;
149
+ }
150
+ /** GET /store/content/blogs/:blog/articles/:handle/comments */
151
+ export interface ArticleCommentsResponse {
152
+ comments: ArticleComment[];
153
+ count: number;
154
+ limit: number;
155
+ offset: number;
156
+ commentable: BlogCommentable;
157
+ }
158
+ /** What a shopper sends. `website` is the honeypot: keep its input visually hidden and leave it empty. */
159
+ export interface ArticleCommentInput {
160
+ author: string;
161
+ email: string;
162
+ body: string;
163
+ website?: string;
164
+ }
165
+ /** The fields a comment can be rejected on. */
166
+ export type ArticleCommentField = 'author' | 'email' | 'body';
167
+ /**
168
+ * What posting a comment came back with:
169
+ * - `posted`: saved; `status` is `published` (the blog publishes automatically) or `pending` (moderated, or held
170
+ * as spam: the shopper is never told, so show the moderated message for `pending`).
171
+ * - `invalid`: rejected; `errors` holds a message per field the store API named, `message` its summary.
172
+ * - `comments_disabled`: the blog's Comments setting is "Comments are disabled".
173
+ * - `rate_limited`: too many comments from this visitor on this post; try again later.
174
+ * - `not_found`: the post is not (or no longer) published.
175
+ * - `unavailable`: the store API did not answer properly (5xx, no response, any other answer); `reason` is PII-free.
176
+ */
177
+ export type PostArticleCommentResult = {
178
+ kind: 'posted';
179
+ id: string;
180
+ status: 'published' | 'pending';
181
+ } | {
182
+ kind: 'invalid';
183
+ errors: Partial<Record<ArticleCommentField, string>>;
184
+ message: string;
185
+ } | {
186
+ kind: 'comments_disabled';
187
+ } | {
188
+ kind: 'rate_limited';
189
+ } | {
190
+ kind: 'not_found';
191
+ } | {
192
+ kind: 'unavailable';
193
+ reason: string;
194
+ };
195
+ /** The store API's page cap for an article's comments. */
196
+ export declare const MAX_COMMENTS_PAGE = 50;
197
+ /**
198
+ * A page of a published post's PUBLISHED comments, NEWEST FIRST as on Shopify (`limit` up to `MAX_COMMENTS_PAGE`,
199
+ * the total in `count`), with the blog's Comments setting (`commentable`), or null when there is no such post (or
200
+ * the store API predates comments). A moved post is found under its old handles, like `getArticle`. With
201
+ * comments disabled (`commentable: 'no'`) the list is empty: render no comments section at all (Shopify's Dawn).
202
+ * Strict like the other reads: a failed read throws `StoreBlogUnavailableError`.
203
+ */
204
+ export declare function getArticleComments(blogHandle: string, articleHandle: string, params?: {
205
+ limit?: number;
206
+ offset?: number;
207
+ }, options?: BlogReadOptions): Promise<ArticleCommentsResponse | null>;
208
+ /**
209
+ * Post a shopper's comment on a published post (browser or server; uncached). Never throws: every outcome is a
210
+ * `PostArticleCommentResult`. The store API saves a moderated blog's comment as `pending` and an auto-publishing
211
+ * blog's as `published`; a filled `website` honeypot is answered as posted and stored nowhere.
212
+ */
213
+ export declare function postArticleComment(blogHandle: string, articleHandle: string, input: ArticleCommentInput): Promise<PostArticleCommentResult>;
214
+ //# sourceMappingURL=store-blog.d.ts.map