@picked/client 0.0.72-next.2 → 0.0.72

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 (52) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/api-CW_zTZ3f.cjs +1 -0
  3. package/dist/{api-B8SVav6V.js → api-U_YQGMNg.js} +1 -1
  4. package/dist/cjs/index.js +2 -2
  5. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  6. package/dist/cjs/server/index.js +1 -1
  7. package/dist/docs/explanation/content-references.md +99 -0
  8. package/dist/docs/explanation/the-content-model.md +38 -28
  9. package/dist/docs/how-to/create-a-content-entry.md +48 -0
  10. package/dist/docs/how-to/define-a-page-layout.md +12 -5
  11. package/dist/docs/how-to/point-one-entry-at-another.md +61 -0
  12. package/dist/docs/how-to/read-a-referenced-entry.md +111 -0
  13. package/dist/docs/how-to/reuse-a-section.md +26 -10
  14. package/dist/docs/index.md +1 -1
  15. package/dist/docs/reference/dashboard/content/blocks.mdx +57 -0
  16. package/dist/docs/reference/dashboard/content/content-entries.mdx +61 -10
  17. package/dist/docs/reference/dashboard/content/models.mdx +108 -0
  18. package/dist/docs/reference/dashboard/content/pages.mdx +4 -3
  19. package/dist/docs/reference/dashboard/fields.mdx +1 -1
  20. package/dist/docs/reference/dashboard/steps.mdx +2 -2
  21. package/dist/docs/reference/delivery-api/experience-content.md +68 -13
  22. package/dist/docs/reference/glossary.md +13 -5
  23. package/dist/docs/reference/management-api/error-handling.md +2 -2
  24. package/dist/docs/reference/sdk/content.md +216 -0
  25. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +1 -1
  26. package/dist/docs/reference/sdk/ssr/serialize.md +6 -3
  27. package/dist/docs/tutorials/first-api-call.md +1 -1
  28. package/dist/docs/tutorials/first-server-rendered-page.mdx +1 -1
  29. package/dist/esm/index.js +464 -430
  30. package/dist/esm/plugins/dynamic-experiences/index.js +3 -3
  31. package/dist/esm/server/index.js +2 -2
  32. package/dist/{plugin-EFn9ALEF.cjs → plugin-DkSWIASL.cjs} +1 -1
  33. package/dist/{plugin-YytfMG0n.js → plugin-DviILBha.js} +1 -1
  34. package/dist/{provider-GuxX7UDO.js → provider-BEBe0guB.js} +1 -1
  35. package/dist/{provider-DmXJ58nW.cjs → provider-vseAwQ-c.cjs} +1 -1
  36. package/dist/{registry-CMsN5pHn.cjs → registry-CbBS-WYh.cjs} +1 -1
  37. package/dist/{registry-DzpNnRIF.js → registry-DOsuMPmK.js} +1 -1
  38. package/dist/types/entities/content/reference.d.ts +101 -0
  39. package/dist/types/entities/content/reference.d.ts.map +1 -0
  40. package/dist/types/exports.d.ts +2 -0
  41. package/dist/types/exports.d.ts.map +1 -1
  42. package/dist/types/index.d.ts +1 -0
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
  45. package/dist/types/plugins/dynamic-experiences/types.d.ts +10 -0
  46. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +1 -1
  47. package/dist/types/server/serialize.d.ts +6 -1
  48. package/dist/types/server/serialize.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/api-D9899KCk.cjs +0 -1
  51. package/dist/docs/reference/dashboard/content/layouts.mdx +0 -62
  52. package/dist/docs/reference/dashboard/content/sections.mdx +0 -28
@@ -1,4 +1,4 @@
1
- import { i as e } from "../../../api-B8SVav6V.js";
2
- import { t } from "../../../plugin-YytfMG0n.js";
3
- import { a as n, i as r, n as i } from "../../../registry-DzpNnRIF.js";
1
+ import { i as e } from "../../../api-U_YQGMNg.js";
2
+ import { t } from "../../../plugin-DviILBha.js";
3
+ import { a as n, i as r, n as i } from "../../../registry-DOsuMPmK.js";
4
4
  export { e as createClientHeaders, t as dynamicExperiencesPlugin, r as fetchExperienceContent, n as fetchProject, i as registerPickedBundle };
@@ -1,5 +1,5 @@
1
1
  import { a as e, c as t, i as n, o as r, s as i, t as a, u as o } from "../../experience-instance-DGk11d8a.js";
2
- import { n as s } from "../../plugin-YytfMG0n.js";
2
+ import { n as s } from "../../plugin-DviILBha.js";
3
3
  import { attach as c, createEffect as l, createEvent as u, createStore as d, sample as f } from "effector";
4
4
  //#region src/server/serialize.ts
5
5
  var p = 1e4;
@@ -25,7 +25,7 @@ async function g(e, n = {}) {
25
25
  ...i,
26
26
  signal: AbortSignal.timeout(l)
27
27
  }))), v = /* @__PURE__ */ new Map();
28
- for (let e of _) if (e) for (let t of e.content) v.set(t.id, t);
28
+ for (let e of _) if (e) for (let t of [...e.references ?? [], ...e.content]) v.set(t.id, t);
29
29
  return {
30
30
  versionId: a.versionId,
31
31
  projectConfig: a,
@@ -1 +1 @@
1
- require("./logger-CSTvAyyB.cjs");let e=require("effector");function t(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return t>>>0}function n(e){let t=e;return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function r(e,r){return n(t(`${e}:${r}`))%100}function i(e,t){return t<=0?!1:t>=100||e<t}function a(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function o(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function s(e,t){if(Array.isArray(t.fields))for(let n of t.fields)e.registerField(n)}function c(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function l(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)o(e,n)}function u(e,t,n){p(e,t,n.isPreview,n.sessionId),a(e,t),s(e,t),c(e,t),l(e,t)}function d(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function f(e){let t=new Set,n=e.searchParams.feature;if(!n)return t;for(let e of n){let n=e.indexOf(`:`);n>0&&t.add(e.substring(0,n))}return t}function p(e,t,n,r){let i=f(e);for(let a of t.features)i.has(a.id)||m(e,a,n,r)}function m(e,t,n,a){let o=r(a,t.id);e.registerFeature(t.id,{key:`v${t.version}`,name:t.name,enabled:t.enabled,weight:t.weight,storage:n?`session`:`local`,decide:()=>i(o,t.weight)})}function h(e,t){for(let n of t.content)e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function g(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&h(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function _(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}function v(){return{name:`dynamic-experiences`,setup:t=>({onStart:(0,e.attach)({source:t.session.store.map(e=>e.id),effect:async e=>{let n=d(t),r=n!==void 0,i=n===void 0?void 0:{previewToken:n},a=await t.getProjectConfig(n===void 0?void 0:{previewToken:n}).catch(e=>null);if(t.contentLoader=g(t,_(e=>t.getExperienceContent(e,i),a)),!a)return;let o=t.seededVersionId;if(o!==null&&o!==a.versionId){t.versionSkew={seeded:o,resolved:a.versionId},`${a.versionId}${o}`;return}t.previewEmbedderOrigins=a.previewEmbedderOrigins??null,u(t,a,{isPreview:r,sessionId:e})}})})}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
1
+ require("./logger-CSTvAyyB.cjs");let e=require("effector");function t(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return t>>>0}function n(e){let t=e;return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function r(e,r){return n(t(`${e}:${r}`))%100}function i(e,t){return t<=0?!1:t>=100||e<t}function a(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function o(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function s(e,t){if(Array.isArray(t.fields))for(let n of t.fields)e.registerField(n)}function c(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function l(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)o(e,n)}function u(e,t,n){p(e,t,n.isPreview,n.sessionId),a(e,t),s(e,t),c(e,t),l(e,t)}function d(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function f(e){let t=new Set,n=e.searchParams.feature;if(!n)return t;for(let e of n){let n=e.indexOf(`:`);n>0&&t.add(e.substring(0,n))}return t}function p(e,t,n,r){let i=f(e);for(let a of t.features)i.has(a.id)||m(e,a,n,r)}function m(e,t,n,a){let o=r(a,t.id);e.registerFeature(t.id,{key:`v${t.version}`,name:t.name,enabled:t.enabled,weight:t.weight,storage:n?`session`:`local`,decide:()=>i(o,t.weight)})}function h(e,t){for(let n of[...t.references??[],...t.content])e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function g(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&h(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function _(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}function v(){return{name:`dynamic-experiences`,setup:t=>({onStart:(0,e.attach)({source:t.session.store.map(e=>e.id),effect:async e=>{let n=d(t),r=n!==void 0,i=n===void 0?void 0:{previewToken:n},a=await t.getProjectConfig(n===void 0?void 0:{previewToken:n}).catch(e=>null);if(t.contentLoader=g(t,_(e=>t.getExperienceContent(e,i),a)),!a)return;let o=t.seededVersionId;if(o!==null&&o!==a.versionId){t.versionSkew={seeded:o,resolved:a.versionId},`${a.versionId}${o}`;return}t.previewEmbedderOrigins=a.previewEmbedderOrigins??null,u(t,a,{isPreview:r,sessionId:e})}})})}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});
@@ -99,7 +99,7 @@ function m(e, t, n, a) {
99
99
  });
100
100
  }
101
101
  function h(e, t) {
102
- for (let n of t.content) e.registerContent({
102
+ for (let n of [...t.references ?? [], ...t.content]) e.registerContent({
103
103
  id: n.id,
104
104
  contentModelKey: n.contentModelKey,
105
105
  data: n.data
@@ -1,5 +1,5 @@
1
1
  import "./logger-DMN6TxJJ.js";
2
- import { a as e, i as t, r as n, t as r } from "./registry-DzpNnRIF.js";
2
+ import { a as e, i as t, r as n, t as r } from "./registry-DOsuMPmK.js";
3
3
  //#region src/data-source/provider.ts
4
4
  var i = "bundle", a = "api";
5
5
  async function o() {
@@ -1 +1 @@
1
- require("./logger-CSTvAyyB.cjs");const e=require("./registry-CMsN5pHn.cjs");var t=`bundle`,n=`api`;async function r(){try{let t=await import(`virtual:picked/data`);return e.r(t)?t:null}catch{return null}}function i(t){if(t===void 0||e.r(t))return t}function a(a){let{apiUrl:o,projectId:s,previewToken:c,signal:l}=a,u=!!c,d=u?n:a.mode,f=i(u?void 0:a.bundle),p=u?void 0:a.projectConfig,m=a.getContent,h={mode:d??n,manifest:null},g,_,v=new Map;function y(){if(d===n)return Promise.resolve(null);if(f)return Promise.resolve(f);let t=e.t();return t?Promise.resolve(t):(g??=r(),g)}function b(e){h.mode=e?t:n,h.manifest=e?e.manifestMetadata:null}async function x(){if(p)return b(await y()),p;let n=await y();return b(n),n?n.projectConfig:d===t?null:e.a(o,s,{...c!==void 0&&{previewToken:c},...l!==void 0&&{signal:l}})}async function S(n,r){let i=c===void 0?void 0:{previewToken:c};if(m)return m(n,i);let a=await y();if(b(a),a)try{return await a.experienceContent(n,i)}catch{return`${n.id}`,null}if(d===t)return null;let u=r??l;return e.i(o,s,n.id,{...c!==void 0&&{previewToken:c},...u!==void 0&&{signal:u}})}return{meta:h,getProjectConfig:()=>(_??=x(),_),getContent:(e,t)=>{let n=v.get(e.id);if(n)return n;let r=S(e,t?.signal).finally(()=>{v.delete(e.id)});return v.set(e.id,r),r}}}exports.createPickedDataProvider=a;
1
+ require("./logger-CSTvAyyB.cjs");const e=require("./registry-CbBS-WYh.cjs");var t=`bundle`,n=`api`;async function r(){try{let t=await import(`virtual:picked/data`);return e.r(t)?t:null}catch{return null}}function i(t){if(t===void 0||e.r(t))return t}function a(a){let{apiUrl:o,projectId:s,previewToken:c,signal:l}=a,u=!!c,d=u?n:a.mode,f=i(u?void 0:a.bundle),p=u?void 0:a.projectConfig,m=a.getContent,h={mode:d??n,manifest:null},g,_,v=new Map;function y(){if(d===n)return Promise.resolve(null);if(f)return Promise.resolve(f);let t=e.t();return t?Promise.resolve(t):(g??=r(),g)}function b(e){h.mode=e?t:n,h.manifest=e?e.manifestMetadata:null}async function x(){if(p)return b(await y()),p;let n=await y();return b(n),n?n.projectConfig:d===t?null:e.a(o,s,{...c!==void 0&&{previewToken:c},...l!==void 0&&{signal:l}})}async function S(n,r){let i=c===void 0?void 0:{previewToken:c};if(m)return m(n,i);let a=await y();if(b(a),a)try{return await a.experienceContent(n,i)}catch{return`${n.id}`,null}if(d===t)return null;let u=r??l;return e.i(o,s,n.id,{...c!==void 0&&{previewToken:c},...u!==void 0&&{signal:u}})}return{meta:h,getProjectConfig:()=>(_??=x(),_),getContent:(e,t)=>{let n=v.get(e.id);if(n)return n;let r=S(e,t?.signal).finally(()=>{v.delete(e.id)});return v.set(e.id,r),r}}}exports.createPickedDataProvider=a;
@@ -1 +1 @@
1
- require("./logger-CSTvAyyB.cjs");const e=require("./api-D9899KCk.cjs");function t(e){return typeof e==`object`&&!!e}function n(e){return t(e)&&`features`in e&&Array.isArray(e.features)}function r(e){return!t(e)||!(`experienceId`in e)||!(`content`in e)?!1:Array.isArray(e.content)}function i(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function a(e){if(!t(e)||!(`cause`in e))return!1;let{cause:n}=e;return!t(n)||!(`code`in n)?!1:n.code===`ECONNREFUSED`}async function o(t,r,o){let s=o?.previewToken?`projects/${r}?preview_token=${encodeURIComponent(o.previewToken)}`:`projects/${r}`,c;try{c=await e.t(t,s,o?.headers,o?.signal)}catch(e){return i(t)&&a(e),null}if(!c.ok)return`${c.status.toString()}`,null;let l;try{l=await c.json()}catch{return null}return n(l)?l:null}async function s(t,n,o,s){let c=s?.previewToken?`projects/${n}/experiences/${o}/content?preview_token=${encodeURIComponent(s.previewToken)}`:`projects/${n}/experiences/${o}/content`,l;try{l=await e.t(t,c,s?.headers,s?.signal)}catch(e){return i(t)&&a(e)||`${o}`,null}if(!l.ok)return`${o}${l.status.toString()}`,null;let u;try{u=await l.json()}catch{return`${o}`,null}return r(u)?u:(`${o}`,null)}function c(e){if(typeof e!=`object`||!e||!(`projectConfig`in e)||!(`experienceContent`in e)||!(`manifestMetadata`in e))return!1;let{experienceContent:t}=e;return typeof t==`function`}var l=null;function u(e){c(e)&&(l=e)}function d(){return l}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
1
+ require("./logger-CSTvAyyB.cjs");const e=require("./api-CW_zTZ3f.cjs");function t(e){return typeof e==`object`&&!!e}function n(e){return t(e)&&`features`in e&&Array.isArray(e.features)}function r(e){return!t(e)||!(`experienceId`in e)||!(`content`in e)?!1:Array.isArray(e.content)}function i(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function a(e){if(!t(e)||!(`cause`in e))return!1;let{cause:n}=e;return!t(n)||!(`code`in n)?!1:n.code===`ECONNREFUSED`}async function o(t,r,o){let s=o?.previewToken?`projects/${r}?preview_token=${encodeURIComponent(o.previewToken)}`:`projects/${r}`,c;try{c=await e.t(t,s,o?.headers,o?.signal)}catch(e){return i(t)&&a(e),null}if(!c.ok)return`${c.status.toString()}`,null;let l;try{l=await c.json()}catch{return null}return n(l)?l:null}async function s(t,n,o,s){let c=s?.previewToken?`projects/${n}/experiences/${o}/content?preview_token=${encodeURIComponent(s.previewToken)}`:`projects/${n}/experiences/${o}/content`,l;try{l=await e.t(t,c,s?.headers,s?.signal)}catch(e){return i(t)&&a(e)||`${o}`,null}if(!l.ok)return`${o}${l.status.toString()}`,null;let u;try{u=await l.json()}catch{return`${o}`,null}return r(u)?u:(`${o}`,null)}function c(e){if(typeof e!=`object`||!e||!(`projectConfig`in e)||!(`experienceContent`in e)||!(`manifestMetadata`in e))return!1;let{experienceContent:t}=e;return typeof t==`function`}var l=null;function u(e){c(e)&&(l=e)}function d(){return l}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
@@ -1,5 +1,5 @@
1
1
  import "./logger-DMN6TxJJ.js";
2
- import { t as e } from "./api-B8SVav6V.js";
2
+ import { t as e } from "./api-U_YQGMNg.js";
3
3
  function t(e) {
4
4
  return typeof e == "object" && !!e;
5
5
  }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @file Reading `reference` field values out of a delivered content blob.
3
+ *
4
+ * A `reference` field arrives as a pointer at another Content record rather than
5
+ * as the record itself. The referenced record travels separately and is
6
+ * registered into the content index under its own id, so resolving a pointer is
7
+ * a registry lookup — see `useReference` (`@picked/react`) and `getReference`
8
+ * (`@picked/svelte`), which is what most consumers should reach for.
9
+ *
10
+ * This module is the framework-agnostic half: readers that turn a raw field
11
+ * value into the id (or ids) to look up, tolerating both a single value and the
12
+ * array a repeatable field delivers, plus the store derivations the framework
13
+ * bindings wrap.
14
+ */
15
+ import { type Store } from 'effector';
16
+ import type { Content, ContentsStore } from './content';
17
+ /** A pointer at another Content record, as delivered inside a `reference` field. */
18
+ export interface ContentReference {
19
+ /** Id of the referenced Content record, to look up in the content index. */
20
+ contentEntryId: string;
21
+ /** The `key` of the Content Model the target belongs to, or `null` when unresolved. */
22
+ contentModelKey?: string | null;
23
+ }
24
+ /**
25
+ * Narrows an arbitrary field value to a {@link ContentReference}.
26
+ *
27
+ * A pointer that still carries inline `data` matches: the delivery surface emits
28
+ * inline data alongside the separate record while that format is retired, and
29
+ * both shapes address the same record.
30
+ *
31
+ * @param {unknown} value - The raw value read from a content blob's `data`.
32
+ * @returns {boolean} Whether `value` is a reference pointer.
33
+ * @example
34
+ * ```typescript
35
+ * if (isContentReference(content.author)) { content.author.contentEntryId }
36
+ * ```
37
+ */
38
+ export declare function isContentReference(value: unknown): value is ContentReference;
39
+ /**
40
+ * Reads the referenced Content record id from a single `reference` field value.
41
+ *
42
+ * @param {unknown} value - The raw value read from a content blob's `data`.
43
+ * @returns {string | null} The referenced id, or `null` when the field is unset or not a reference.
44
+ * @example
45
+ * ```typescript
46
+ * const authorId = readReferenceId(content.author)
47
+ * ```
48
+ */
49
+ export declare function readReferenceId(value: unknown): string | null;
50
+ /**
51
+ * Reads every referenced Content record id from a `reference` field, whether it
52
+ * was authored as repeatable or not. Values that are not references are dropped,
53
+ * so the result is always a list of ids that can be looked up.
54
+ *
55
+ * @param {unknown} value - The raw value read from a content blob's `data`.
56
+ * @returns {string[]} The referenced ids, in field order.
57
+ * @example
58
+ * ```typescript
59
+ * const authorIds = readReferenceIds(content.authors)
60
+ * ```
61
+ */
62
+ export declare function readReferenceIds(value: unknown): string[];
63
+ /**
64
+ * Derives a store resolving a single `reference` field value against the content
65
+ * registry.
66
+ *
67
+ * Reads the registry index rather than a per-id store so an unset field, an
68
+ * unregistered target, and a target registered after first paint all flow
69
+ * through one reactive path. The framework bindings (`useReference`,
70
+ * `getReference`) wrap this; call it directly only outside React and Svelte.
71
+ *
72
+ * @param {ContentsStore} contents - The client's content registry.
73
+ * @param {unknown} value - The raw `reference` value, or an Effector store carrying one. A
74
+ * store keeps the lookup live when the field arrives after this call.
75
+ * @returns {Store<Content | null>} The referenced record, or `null` when the field is unset or its target is not registered.
76
+ * @example
77
+ * ```typescript
78
+ * const author = deriveReference(client.contents, content.author)
79
+ * ```
80
+ */
81
+ export declare function deriveReference(contents: ContentsStore, value: unknown): Store<Content | null>;
82
+ /**
83
+ * Derives a store resolving a repeatable `reference` field against the content
84
+ * registry, in field order. A single (non-repeatable) value resolves to a
85
+ * one-element list.
86
+ *
87
+ * The list is dense: a pointer whose target is not registered — deleted, cut off
88
+ * by the reference depth cap, or belonging to another workspace — is skipped
89
+ * rather than held as a hole, so consumers can iterate without a null check.
90
+ *
91
+ * @param {ContentsStore} contents - The client's content registry.
92
+ * @param {unknown} value - The raw `reference` value, or an Effector store carrying one. A
93
+ * store keeps the lookup live when the field arrives after this call.
94
+ * @returns {Store<Content[]>} The referenced records that resolved.
95
+ * @example
96
+ * ```typescript
97
+ * const authors = deriveReferences(client.contents, content.authors)
98
+ * ```
99
+ */
100
+ export declare function deriveReferences(contents: ContentsStore, value: unknown): Store<Content[]>;
101
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../src/entities/content/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEvD,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAA;IACtB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAQ5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAUzD;AAiCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAS9F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAS1F"}
@@ -14,6 +14,8 @@ export { evaluateRuleLogic } from './utils/rules-logic';
14
14
  export { getPickedConfig } from './utils/picked-config';
15
15
  export { lazyComponent, isLazyLoader } from './entities/component/lazyComponent';
16
16
  export { createPluginEffect } from './entities/plugin/plugin';
17
+ export { deriveReference, deriveReferences, isContentReference, readReferenceId, readReferenceIds, } from './entities/content/reference';
18
+ export type { ContentReference } from './entities/content/reference';
17
19
  /**
18
20
  * Creates a new Picked client instance and binds it to the window object.
19
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,8IAA8I;AAC9I,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AAEpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,iBAAiB,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAE7D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,YAAa,mBAAmB,KAAG,MAI3D,CAAA;AAED,YAAY,EACV,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kCAAkC,CAAA"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,8IAA8I;AAC9I,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AAEpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,iBAAiB,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,8BAA8B,CAAA;AACrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,YAAa,mBAAmB,KAAG,MAI3D,CAAA;AAED,YAAY,EACV,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kCAAkC,CAAA"}
@@ -4,6 +4,7 @@ export type * from './client';
4
4
  export type * from './entities/action/action';
5
5
  export type * from './entities/condition/condition';
6
6
  export type * from './entities/content/content';
7
+ export type * from './entities/content/reference';
7
8
  export type * from './entities/component/component';
8
9
  export type * from './entities/component/lazyComponent';
9
10
  export type * from './entities/experience-instance/experience-instance';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAyI5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD,IAAI,CAMN;AAoMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA4DjD"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAyI5E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjD,IAAI,CAMN;AAwMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CA4DjD"}
@@ -105,7 +105,17 @@ export interface ContentBlob {
105
105
  export interface ExperienceContentResponse {
106
106
  experienceId: string;
107
107
  versionId: string | null;
108
+ /** The Content records the experience's steps point at, via `Step.layoutContentId`. */
108
109
  content: ContentBlob[];
110
+ /**
111
+ * Content records reached from `content` through a `reference` field, deduped
112
+ * and excluding the step blobs. Registered into the content registry the same
113
+ * way, so a `{ contentEntryId }` pointer resolves through `contents.getById`.
114
+ *
115
+ * Optional: a response produced before this field existed — notably a build-time
116
+ * cache written by an older `@picked/vite-plugin-picked` — omits it entirely.
117
+ */
118
+ references?: ContentBlob[];
109
119
  }
110
120
  /**
111
121
  * Function that resolves an experience's content blobs. Set on the Picked client by
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;A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;IACpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,uFAAuF;IACvF,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,WAAW,EAAE,CAAA;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,UAAU,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACvC,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,KAChC,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;AAE9C;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,6FAA6F;IAC7F,IAAI,EAAE,KAAK,GAAG,OAAO,CAAA;IACrB,8FAA8F;IAC9F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,iEAAiE;IACjE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAA;IAC5B,iBAAiB,EAAE,aAAa,CAAA;IAChC,gBAAgB,EAAE,sBAAsB,CAAA;CACzC"}
@@ -40,7 +40,12 @@ export interface PickedSnapshot {
40
40
  versionId: string | null;
41
41
  /** The project config the server selected with (travels for preview parity). */
42
42
  projectConfig: ProjectConfig;
43
- /** Deduped content blobs for the selected experiences. */
43
+ /**
44
+ * Deduped content blobs for the selected experiences — the steps' own layout
45
+ * content and every entry reached from it through a `reference` field. The
46
+ * client provider seeds the whole array into the content registry, so both
47
+ * resolve identically on the server render and the first client paint.
48
+ */
44
49
  content: ContentBlob[];
45
50
  /** Memoized condition-evaluation results keyed by rule hash. */
46
51
  conditionResults: Record<string, boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceR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ED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.72-next.2",
3
+ "version": "0.0.72",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -1 +0,0 @@
1
- function e(e,t){return{"Picked-Client":e,"Picked-Version":t}}var t=()=>`0.0.72-next.2`,n=`v1`;function r(e,t){return new URL(`/api/${n}/${t}`,e).toString()}function i(n){return{...e(`sdk`,t()),...n}}async function a(e,t,n,a){let o=r(e,t);return fetch(o,{headers:i(n),signal:a})}async function o(e,t,n,a){let o=r(e,t);return fetch(o,{method:`POST`,headers:{"Content-Type":`application/json`,...i(a)},body:JSON.stringify(n)})}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
@@ -1,62 +0,0 @@
1
- ---
2
- type: reference
3
- layout: docs
4
- ---
5
-
6
- import { Screenshot } from '../../../../../components/Screenshot'
7
-
8
- # Page & Step Layouts
9
-
10
- Layouts are reusable JSON schemas. Page Layouts back standalone Pages; Step Layouts back individual Steps inside a Flow.
11
-
12
- <Screenshot
13
- route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/models"
14
- alt="The layouts list in the schema builder on the Picked dashboard"
15
- />
16
-
17
- ## A page layout and a step layout
18
-
19
- Each layout has a fixed category, and the category decides what the layout gives its
20
- shape to:
21
-
22
- | Layout | It gives its shape to | Who renders it |
23
- | --- | --- | --- |
24
- | **Page Layout** | A standalone [Page](/reference/dashboard/content/pages). | The SDK renders the entry on your server. |
25
- | **Step Layout** | One [Step](/reference/dashboard/steps) inside a Flow. | The Step renders the entry in the browser. |
26
-
27
- ## Field types
28
-
29
- A layout is built from fields. Each field has a type that decides its editor and the shape of the value it stores.
30
-
31
- | Type | Stores | Use it for |
32
- | --- | --- | --- |
33
- | **Single-line text** | A short string. | A title, a label, or a short headline. |
34
- | **Multi-line text** | A longer plain string. | A description, or a paragraph with no format marks. |
35
- | **Markdown** | A Markdown string. | Body copy with format marks. |
36
- | **Slug** | A URL-safe string. | A part of a path, or an identifier. |
37
- | **Number** | A numeric value. | A price, a count, or a rating. |
38
- | **Boolean** | A true or false value. | A toggle or a flag. |
39
- | **Date** | A date value. | A publish date or a deadline. |
40
- | **Color** | A color value. | A theme accent or a swatch. |
41
- | **JSON** | Any JSON value. | Structured data with no editor of its own. |
42
- | **Group** | An object of fields inside the layout. | A set of related fields, held together. |
43
- | **Section** | A [Section](/reference/dashboard/content/sections) schema inside the layout. | A shared schema fragment that you reuse. |
44
- | **Asset** | A link to an [Asset Library](/reference/dashboard/content/asset-library) item. | An image, a video, or a document. |
45
- | **HTML asset** | A link to a `.html` file in your library. | HTML that you wrote before, held inside the content. |
46
-
47
- ## Repeatable and grouped fields
48
-
49
- You can make any field **repeatable**. It then renders as a sortable list of values,
50
- and not as one value. Use it for a gallery, for a list of features, or for any
51
- collection.
52
-
53
- A **Group** field holds a set of fields under one key, and it gives a structured
54
- object. Make a group repeatable to describe a list of objects, such as a list of
55
- feature cards.
56
-
57
- ## Related
58
-
59
- - [About the content model](/explanation/the-content-model) — why a schema change does not
60
- migrate your data.
61
- - [How to define a page layout](/how-to/define-a-page-layout)
62
- - [How to reuse a section](/how-to/reuse-a-section)
@@ -1,28 +0,0 @@
1
- ---
2
- type: reference
3
- layout: docs
4
- ---
5
-
6
- import { Screenshot } from '../../../../../components/Screenshot'
7
-
8
- # Sections
9
-
10
- Sections are reusable schema fragments you embed inside layouts, so common structures such as a hero or a feature list are defined once.
11
-
12
- <Screenshot
13
- route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/blocks"
14
- alt="The sections list in the schema builder on the Picked dashboard"
15
- />
16
-
17
- ## What a section is
18
-
19
- A Section is a reusable schema fragment with its own **Key**. A
20
- [layout](/reference/dashboard/content/layouts) gives its shape to a whole Page or Step. A Section is a
21
- part that you put into one or more layouts. Define the shape one time, then reuse it
22
- everywhere.
23
-
24
- ## Related
25
-
26
- - [About the content model](/explanation/the-content-model) — why sections exist.
27
- - [How to reuse a section](/how-to/reuse-a-section)
28
- - [Page and step layouts](/reference/dashboard/content/layouts)