@picked/react 0.0.1-dev.1784003142683 → 0.0.1-dev.1784270162396
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/dist/experience/HtmlRender.d.ts +23 -0
- package/dist/experience/HtmlRender.d.ts.map +1 -0
- package/dist/experience/HtmlRender.js +1 -0
- package/dist/hooks/client.d.ts +0 -9
- package/dist/hooks/client.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface HtmlRenderProps {
|
|
3
|
+
/** The resolved html-asset field value (for example `content.body`). */
|
|
4
|
+
readonly html: unknown;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Renders a resolved html-asset field's HTML inside an open shadow root and rehydrates its
|
|
8
|
+
* Picked-tagged scripts. The shadow boundary keeps the host page's CSS from bleeding into the
|
|
9
|
+
* landing-page markup and lets shadow-scoped page scripts locate their own root during rehydration. On the server
|
|
10
|
+
* the markup is emitted as a declarative shadow DOM template, a parser-only feature the browser
|
|
11
|
+
* attaches as a real shadow root while parsing the response, so content is present from first paint.
|
|
12
|
+
* On the client, the first commit adopts that parser-attached root and only rehydrates its scripts; a
|
|
13
|
+
* client-only mount or a later content change attaches and writes the shadow root imperatively
|
|
14
|
+
* instead. A non-matching value or a `null` content renders nothing.
|
|
15
|
+
*
|
|
16
|
+
* @param {HtmlRenderProps} props - The component props.
|
|
17
|
+
* @returns {React.JSX.Element} The shadow-root host element.
|
|
18
|
+
* @example
|
|
19
|
+
* <HtmlRender html={content.body} />
|
|
20
|
+
*/
|
|
21
|
+
declare function HtmlRender({ html }: HtmlRenderProps): React.JSX.Element;
|
|
22
|
+
export default HtmlRender;
|
|
23
|
+
//# sourceMappingURL=HtmlRender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HtmlRender.d.ts","sourceRoot":"","sources":["../../src/experience/HtmlRender.tsx"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,OAAO,KAA4B,MAAM,OAAO,CAAA;AAQhD,UAAU,eAAe;IACvB,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE,eAAe,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgChE;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";import{isHtmlAssetValue as n,rehydrateScripts as r,supportsShadowRoot as i,supportsWindow as a}from"@picked/client";import{jsx as o}from"react/jsx-runtime";function s({html:s}){let c=(n(s)?s:null)?.content??``,l=t(null),u=t(!1);return e(()=>{let e=l.current;if(!i()||!e)return;let t=e.shadowRoot,n=!u.current;if(u.current=!0,t&&n){c&&r(t);return}let a=t??e.attachShadow({mode:`open`});a.innerHTML=c,c&&r(a)},[c]),a()?o(`div`,{ref:l,suppressHydrationWarning:!0}):o(`div`,{ref:l,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`<template shadowrootmode="open">${c}</template>`}})}export{s as default};
|
package/dist/hooks/client.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExperienceInstance, Picked } from '@picked/client';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieves the Picked Client for the Experience Instance.
|
|
4
|
-
*
|
|
5
4
|
* @returns The Picked client instance that provides access to experiences, steps, and other Picked functionality.
|
|
6
5
|
* @example
|
|
7
6
|
* const client = usePicked()
|
|
@@ -9,17 +8,9 @@ import { ExperienceInstance, Picked } from '@picked/client';
|
|
|
9
8
|
export declare function usePicked(): Picked;
|
|
10
9
|
/**
|
|
11
10
|
* Retrieves the Experience Store for the current Experience Instance.
|
|
12
|
-
*
|
|
13
|
-
* The returned instance exposes `restart` and `isResumableStore` for SDK-native
|
|
14
|
-
* resume/restart flows: call `instance.restart()` to clear this instance's history and
|
|
15
|
-
* the experience's owned responses, and read `instance.isResumableStore` (via `useUnit`)
|
|
16
|
-
* to render a "continue / start over" prompt once the user has progressed past the first
|
|
17
|
-
* step (it stays `false` on the first step, even with a saved answer).
|
|
18
|
-
*
|
|
19
11
|
* @returns The Experience store instance that provides access to experience configuration and state.
|
|
20
12
|
* @example
|
|
21
13
|
* const experience = useExperience()
|
|
22
|
-
* const canResume = useUnit(experience.isResumableStore)
|
|
23
14
|
*/
|
|
24
15
|
export declare function useExperience(): ExperienceInstance;
|
|
25
16
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hooks/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGhE
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/hooks/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGhE;;;;;GAKG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAOlC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,kBAAkB,CAOlD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,5 @@ export { adaptReactComponent, isValidAdaptedComponent } from './component';
|
|
|
5
5
|
export type * from './component';
|
|
6
6
|
export { default as PickedProvider } from './experience/PickedProvider';
|
|
7
7
|
export { default as ExperienceSlot } from './experience/ExperienceSlot';
|
|
8
|
+
export { default as HtmlRender } from './experience/HtmlRender';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1E,mBAAmB,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAC1E,mBAAmB,aAAa,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{adaptReactComponent as e,isValidAdaptedComponent as t}from"./component.js";import n from"./experience/PickedProvider.js";import r from"./experience/ExperienceSlot.js";export{r as ExperienceSlot,n as PickedProvider,e as adaptReactComponent,t as isValidAdaptedComponent};
|
|
1
|
+
import{adaptReactComponent as e,isValidAdaptedComponent as t}from"./component.js";import n from"./experience/PickedProvider.js";import r from"./experience/ExperienceSlot.js";import i from"./experience/HtmlRender.js";export{r as ExperienceSlot,i as HtmlRender,n as PickedProvider,e as adaptReactComponent,t as isValidAdaptedComponent};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/react",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1784270162396",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@picked/client": "workspace:*",
|
|
6
6
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"module": "./dist/index.js",
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@picked/client": "0.0.1-dev.
|
|
88
|
+
"@picked/client": "0.0.1-dev.1784270162396",
|
|
89
89
|
"effector": "^23.3.0",
|
|
90
90
|
"react": "19.2.2",
|
|
91
91
|
"react-dom": "19.2.2"
|