@picked/svelte 0.0.1-dev.1778561735098 → 0.0.1-dev.1778730134956
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/hooks/client.d.ts +16 -4
- package/dist/hooks/content.d.ts +18 -0
- package/dist/hooks/content.js +1 -0
- package/dist/hooks/index.d.ts +2 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/step.d.ts +25 -2
- package/dist/hooks/step.js +1 -1
- package/dist/plugins/devtools/screens/history/HistoryEntriesTable.svelte +2 -3
- package/dist/plugins/devtools/screens/history/HistoryEntryListItem.svelte +2 -2
- package/dist/plugins/devtools/screens/responses/ResponseTableRow.svelte +2 -2
- package/package.json +2 -2
package/dist/hooks/client.d.ts
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import { Picked, ExperienceInstance } from '@picked/client';
|
|
2
2
|
/**
|
|
3
|
-
* Retrieves the Picked Client for the Experience Instance
|
|
3
|
+
* Retrieves the Picked Client for the Experience Instance.
|
|
4
4
|
*
|
|
5
|
-
* @returns The Picked client instance that provides access to experiences, steps, and other Picked functionality
|
|
5
|
+
* @returns The Picked client instance that provides access to experiences, steps, and other Picked functionality.
|
|
6
|
+
* @example
|
|
7
|
+
* const client = getPicked()
|
|
6
8
|
*/
|
|
7
9
|
export declare function getPicked(): Picked;
|
|
8
10
|
/**
|
|
9
|
-
* Retrieves the Experience Store for the current Experience Instance
|
|
11
|
+
* Retrieves the Experience Store for the current Experience Instance.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
13
|
+
* The returned instance exposes `restart` and `isResumableStore` for SDK-native
|
|
14
|
+
* resume/restart flows: call `instance.restart()` to atomically clear this
|
|
15
|
+
* experience's history and owned responses, and subscribe to
|
|
16
|
+
* `instance.isResumableStore` (via the `$` prefix) to render a
|
|
17
|
+
* "continue / start over" prompt when the user has in-progress state.
|
|
18
|
+
*
|
|
19
|
+
* @returns The Experience store instance that provides access to experience configuration and state.
|
|
20
|
+
* @example
|
|
21
|
+
* const experience = getExperience()
|
|
22
|
+
* const canResume = experience.isResumableStore
|
|
23
|
+
* // in markup: {#if $canResume}…{/if}
|
|
12
24
|
*/
|
|
13
25
|
export declare function getExperience(): ExperienceInstance;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
import { Content } from '@picked/client';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the registry store for a content id, mirroring `getField(key)`. Resolves
|
|
5
|
+
* the Picked client via `getPicked()` and returns `client.contents.getById(id)`.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} id - The content record id to look up.
|
|
8
|
+
* @returns {Store<Content | null>} The registry store; `null` until content is registered.
|
|
9
|
+
* @example
|
|
10
|
+
* ```svelte
|
|
11
|
+
* <script>
|
|
12
|
+
* import { getContent } from '@picked/svelte'
|
|
13
|
+
* const banner = getContent('lc_banner')
|
|
14
|
+
* </script>
|
|
15
|
+
* <h1>{$banner?.data?.headline ?? ''}</h1>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function getContent(id: string): Store<Content | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getPicked as e}from"./client.js";function t(t){return e().contents.getById(t)}export{t as getContent};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export { getPicked, getExperience } from './client';
|
|
|
3
3
|
export { getPredicate, getPredicateResult } from './predicate';
|
|
4
4
|
export { getFeature, getFeatureResult } from './feature';
|
|
5
5
|
export { getAction, getActionResult } from './action';
|
|
6
|
-
export { getStep, setStepContext } from './step';
|
|
6
|
+
export { getStep, setStepContext, getStepContent } from './step';
|
|
7
|
+
export { getContent } from './content';
|
|
7
8
|
export { useUnit, getContextScope, setContextScope } from './stores';
|
|
8
9
|
export { createSessionStorageStore, createLocalStorageStore } from './storage.js';
|
|
9
10
|
export { getTrackRecommendationPresentEvent } from './events';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureResult as a}from"./feature.js";import{getAction as o,getActionResult as s}from"./action.js";import{getStep as c,setStepContext as
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{getPredicate as n,getPredicateResult as r}from"./predicate.js";import{getFeature as i,getFeatureResult as a}from"./feature.js";import{getAction as o,getActionResult as s}from"./action.js";import{getStep as c,getStepContent as l,setStepContext as u}from"./step.js";import{getContent as d}from"./content.js";import{getContextScope as f,setContextScope as p,useUnit as m}from"./stores.js";import{createLocalStorageStore as h,createSessionStorageStore as g}from"./storage.js";import{getTrackRecommendationPresentEvent as _}from"./events.js";import{createQuery as v,queryCache as y,queryPresets as b}from"./create-query/index.js";export{h as createLocalStorageStore,v as createQuery,g as createSessionStorageStore,o as getAction,s as getActionResult,d as getContent,f as getContextScope,e as getExperience,i as getFeature,a as getFeatureResult,t as getPicked,n as getPredicate,r as getPredicateResult,c as getStep,l as getStepContent,_ as getTrackRecommendationPresentEvent,y as queryCache,b as queryPresets,p as setContextScope,u as setStepContext,m as useUnit};
|
package/dist/hooks/step.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
|
-
import { ExperienceStep } from '@picked/client';
|
|
2
|
+
import { Content, ExperienceStep } from '@picked/client';
|
|
3
3
|
import { FormInstance, FormField } from '../form/create-form.svelte';
|
|
4
4
|
export interface StepContext extends FormInstance {
|
|
5
5
|
step: Store<ExperienceStep>;
|
|
6
6
|
/** Directly accessible fields with current response values — usable without a form. */
|
|
7
7
|
fields: Store<FormField[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Reactive store of the current step's CMS layout content. Resolves the step's
|
|
10
|
+
* `layoutContentId` against `client.contents` and stays reactive.
|
|
11
|
+
*/
|
|
12
|
+
layoutContentStore: Store<Content | null>;
|
|
8
13
|
isActive: Store<boolean>;
|
|
9
14
|
/** @deprecated Use `isActive` instead. */
|
|
10
15
|
isActiveStep: Store<boolean>;
|
|
@@ -12,13 +17,31 @@ export interface StepContext extends FormInstance {
|
|
|
12
17
|
/**
|
|
13
18
|
* Creates and sets step context in the Svelte context tree.
|
|
14
19
|
*
|
|
15
|
-
* @param stepKey - The step key.
|
|
20
|
+
* @param {string} stepKey - The step key.
|
|
21
|
+
* @returns {StepContext} The created step context.
|
|
16
22
|
* @example setStepContext('step-1')
|
|
17
23
|
*/
|
|
18
24
|
export declare function setStepContext(stepKey: string): StepContext;
|
|
19
25
|
/**
|
|
20
26
|
* Retrieves the step context from the Svelte context tree.
|
|
21
27
|
*
|
|
28
|
+
* @returns {StepContext} The current step context.
|
|
22
29
|
* @example getStep()
|
|
23
30
|
*/
|
|
24
31
|
export declare function getStep(): StepContext;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a Svelte/Effector store that yields the current step's resolved CMS content
|
|
34
|
+
* data, or `null` when no content is registered for the step's `layoutContentId`.
|
|
35
|
+
* Subscribers automatically receive updates when content is registered or replaced.
|
|
36
|
+
*
|
|
37
|
+
* @returns {Store<Record<string, unknown> | null>} A store of the Content record's `data`.
|
|
38
|
+
* @example
|
|
39
|
+
* ```svelte
|
|
40
|
+
* <script>
|
|
41
|
+
* import { getStepContent } from '@picked/svelte'
|
|
42
|
+
* const content = getStepContent()
|
|
43
|
+
* </script>
|
|
44
|
+
* <h1>{$content?.headline ?? ''}</h1>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function getStepContent(): Store<Record<string, unknown> | null>;
|
package/dist/hooks/step.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getPicked as t}from"./client.js";import{getStepRouter as n}from"../router/context.js";import{getContext as
|
|
1
|
+
import{STEP_CONTEXT_KEY as e}from"../context.js";import{getPicked as t}from"./client.js";import{getStepRouter as n}from"../router/context.js";import{combine as r}from"effector";import{getContext as i,setContext as a}from"svelte";import{createForm as o}from"../form/create-form.svelte";function s(i){let s=t(),{activeStep:c}=n(),l=c.map(e=>e?.key===i),u=s.steps.listStore.map(e=>e.find(e=>e.key===i)??{id:i,key:i,name:``,fieldKeys:[]}),d=o(i,u.map(e=>e.name),u.map(e=>e.fieldKeys));return a(e,{step:u,layoutContentStore:r(u,s.contents.indexStore,(e,t)=>e.layoutContentId?t[e.layoutContentId]??null:null,{skipVoid:!1}),isActive:l,isActiveStep:l,...d})}function c(){return i(e)}function l(){let{layoutContentStore:e}=c();return e.map(e=>e?.data??null,{skipVoid:!1})}export{c as getStep,l as getStepContent,s as setStepContext};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
<script lang="ts"
|
|
1
|
+
<script lang="ts">
|
|
2
2
|
import type { HistoryEntry } from '@picked/client'
|
|
3
|
-
import { Card, DataTable, EmptyState, Stack } from '../../ui'
|
|
4
3
|
import HistoryEntryListItem from './HistoryEntryListItem.svelte'
|
|
4
|
+
import { Card, DataTable, EmptyState, Stack } from '../../ui'
|
|
5
5
|
|
|
6
6
|
export let historyEntries: HistoryEntry[]
|
|
7
7
|
|
|
8
8
|
const columns = [
|
|
9
9
|
{ key: 'id', header: 'ID' },
|
|
10
|
-
{ key: 'instanceId', header: 'Instance ID' },
|
|
11
10
|
{ key: 'experienceId', header: 'Experience ID' },
|
|
12
11
|
{ key: 'nodeId', header: 'Node ID' },
|
|
13
12
|
{ key: 'nodeType', header: 'Node Type' },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
<script lang="ts"
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/** @file List item row displaying a navigation history entry in the devtools history screen. */
|
|
2
3
|
import type { HistoryEntry } from '@picked/client'
|
|
3
4
|
import { getPicked } from '../../../../hooks'
|
|
4
5
|
|
|
@@ -11,7 +12,6 @@
|
|
|
11
12
|
|
|
12
13
|
<tr>
|
|
13
14
|
<td>{historyEntry.id}</td>
|
|
14
|
-
<td>{historyEntry.instanceId}</td>
|
|
15
15
|
<td>{experienceName}</td>
|
|
16
16
|
<td>{historyEntry.node.id}</td>
|
|
17
17
|
<td>{historyEntry.node.type}</td>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/** @file Editable table row for a single field response in the devtools responses screen. */
|
|
3
|
-
import type { ResponseListItem, PrimitiveFieldValue, Field } from '@picked/client'
|
|
3
|
+
import type { ResponseListItem, PrimitiveFieldValue, Field, FieldValue } from '@picked/client'
|
|
4
4
|
import { getPicked } from '../../../../hooks'
|
|
5
5
|
import { Button, Text, CodeBlock, Banner, Stack } from '../../ui'
|
|
6
6
|
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
* ```
|
|
198
198
|
*/
|
|
199
199
|
function handleClear() {
|
|
200
|
-
client.responses.clear(field.
|
|
200
|
+
client.responses.clear(field.key)
|
|
201
201
|
}
|
|
202
202
|
</script>
|
|
203
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/svelte",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1778730134956",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"d3": "^7.9.0"
|
|
6
6
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
},
|
|
89
89
|
"module": "./dist/index.js",
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@picked/client": "0.0.1-dev.
|
|
91
|
+
"@picked/client": "0.0.1-dev.1778730134956",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
93
|
"svelte": "^5.46.4"
|
|
94
94
|
},
|