@sgflabs/storefront-core 0.1.20 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sgflabs/storefront-core",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Shared storefront library consumed as raw TypeScript source by the brand apps.",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "sideEffects": [
@@ -56,9 +56,9 @@
56
56
  "devDependencies": {
57
57
  "@sentry/nextjs": "^10.63.0",
58
58
  "@sgflabs/artha-go-sdk": "^0.3.0",
59
- "@sgflabs/gstin": "^0.1.20",
60
- "@sgflabs/page-spec": "^0.1.20",
61
- "@sgflabs/storefront-core-common": "^0.1.20",
59
+ "@sgflabs/gstin": "^0.1.21",
60
+ "@sgflabs/page-spec": "^0.1.21",
61
+ "@sgflabs/storefront-core-common": "^0.1.21",
62
62
  "@testing-library/dom": "^10.4.1",
63
63
  "@testing-library/jest-dom": "^7.0.0",
64
64
  "@testing-library/react": "^16.3.2",
@@ -74,9 +74,9 @@
74
74
  "peerDependencies": {
75
75
  "@sentry/nextjs": "^10.63.0",
76
76
  "@sgflabs/artha-go-sdk": "^0.3.0",
77
- "@sgflabs/gstin": "^0.1.20",
78
- "@sgflabs/page-spec": "^0.1.20",
79
- "@sgflabs/storefront-core-common": "^0.1.20",
77
+ "@sgflabs/gstin": "^0.1.21",
78
+ "@sgflabs/page-spec": "^0.1.21",
79
+ "@sgflabs/storefront-core-common": "^0.1.21",
80
80
  "next": "15.5.27",
81
81
  "react": "^19.3.1",
82
82
  "react-dom": "^19.3.1"
@@ -18,11 +18,22 @@ const HEADINGS = {
18
18
  }
19
19
 
20
20
  /**
21
- * A policy for reading: title, effective version (the content hash a checkout acceptance pins)
22
- * and the author-written content. The content is untrusted: react-markdown renders it as React
21
+ * The author-written policy text. The content is untrusted: react-markdown renders it as React
23
22
  * elements with raw HTML escaped to text (no `rehype-raw`) and unsafe URL schemes dropped, so
24
23
  * it can never inject markup or script.
25
24
  */
25
+ export function LegalContent({ content }: { content: string }) {
26
+ return (
27
+ <div className="text-neutral-700 leading-relaxed break-words [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:mt-6 [&_h2]:mb-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mt-4 [&_h3]:mb-2 [&_p]:my-3 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_a]:underline">
28
+ <ReactMarkdown components={HEADINGS}>{content}</ReactMarkdown>
29
+ </div>
30
+ )
31
+ }
32
+
33
+ /**
34
+ * A policy for reading: title, effective version (the content hash a checkout acceptance pins)
35
+ * and the author-written content.
36
+ */
26
37
  export function LegalDocument({
27
38
  doc,
28
39
  fallbackTitle,
@@ -53,9 +64,7 @@ export function LegalDocument({
53
64
  </p>
54
65
  )}
55
66
  </header>
56
- <div className="text-neutral-700 leading-relaxed break-words [&_h2]:text-xl [&_h2]:font-semibold [&_h2]:mt-6 [&_h2]:mb-2 [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mt-4 [&_h3]:mb-2 [&_p]:my-3 [&_ul]:list-disc [&_ul]:pl-6 [&_ol]:list-decimal [&_ol]:pl-6 [&_a]:underline">
57
- <ReactMarkdown components={HEADINGS}>{doc.content}</ReactMarkdown>
58
- </div>
67
+ <LegalContent content={doc.content} />
59
68
  </article>
60
69
  )
61
70
  }
@@ -2,6 +2,7 @@ import { Metadata } from "next"
2
2
 
3
3
  import { getStoreLegal } from "../../../lib/data/legal"
4
4
  import LocalizedClientLink from "../../../components/molecules/LocalizedLink/LocalizedLink"
5
+ import { LegalContent } from "../../../components/molecules/LegalDocument/LegalDocument"
5
6
  import { getRequestBaseUrl } from "../../../lib/helpers/request-base-url"
6
7
  import { generateBreadcrumbJsonLd, toSafeJsonLdString } from "../../../lib/helpers/seo"
7
8
  import { docForSlug, LEGAL_SLUG_LABELS, LEGAL_SLUGS } from "./legal-docs"
@@ -52,6 +53,12 @@ export default async function LegalPage({ params }: { params: Promise<{ locale:
52
53
  <h2 className="heading-md mb-2">{doc.title?.trim() || LEGAL_SLUG_LABELS[slug]}</h2>
53
54
  <p className="text-neutral-600 text-sm">Version {doc.content_hash.slice(0, 12)}</p>
54
55
  </LocalizedClientLink>
56
+ <details className="mt-2 px-4 md:px-6" data-testid="legal-inline">
57
+ <summary className="cursor-pointer py-2 text-sm font-medium text-neutral-700">
58
+ Read the full text
59
+ </summary>
60
+ <LegalContent content={doc.content} />
61
+ </details>
55
62
  </li>
56
63
  ))}
57
64
  </ul>