@picked/svelte 0.0.1-dev.1777938796953 → 0.0.1-dev.1778120127377
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/events.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/project/ProjectScreen.svelte +0 -1
- package/dist/router/StepRouter.svelte +11 -45
- package/package.json +2 -2
package/dist/hooks/events.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getExperience as e,getPicked as t}from"./client.js";import{attach as n}from"effector";import{trackRecommendationPresentEvent as r}from"@picked/analytics";var i=()=>{let{session:i,projectId:a
|
|
1
|
+
import{getExperience as e,getPicked as t}from"./client.js";import{attach as n}from"effector";import{trackRecommendationPresentEvent as r}from"@picked/analytics";var i=()=>{let{session:i,projectId:a}=t(),o=e();return n({source:{config:o.configStore,step:o.currentStepStore,sessionSnapshot:i.store},async effect({config:e,step:t,sessionSnapshot:n},i){if(!t)throw Error(`Cannot track recommendation present event: missing experience step.`);return r({projectId:a,experience:{id:o.experienceId,title:e.name},sessionId:n.id,identifiers:n.identifiers,isUser:n.isUser,step:t,productList:i})}})};export{i as getTrackRecommendationPresentEvent};
|
|
@@ -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,7 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/** @file Root router component that manages step registration and active step detection via Effector. */
|
|
3
|
-
import { createEvent, createStore
|
|
4
|
-
import { supportsWindow } from '@picked/client'
|
|
3
|
+
import { combine, createEvent, createStore } from 'effector'
|
|
5
4
|
import { getExperience } from '../hooks'
|
|
6
5
|
import { setStepRouter, type Step } from './context'
|
|
7
6
|
|
|
@@ -9,57 +8,24 @@
|
|
|
9
8
|
|
|
10
9
|
const { currentStepStore } = experience
|
|
11
10
|
|
|
12
|
-
const activeStepStore = createStore<Step | null>(null)
|
|
13
|
-
let hasActiveStep = false
|
|
14
11
|
const stepsStore = createStore<Step[]>([])
|
|
15
12
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const setActiveStepEvent = createEvent<Step | null>()
|
|
13
|
+
const registerStep = createEvent<Step>()
|
|
14
|
+
const unregisterStep = createEvent<Step>()
|
|
19
15
|
|
|
20
|
-
stepsStore
|
|
21
|
-
|
|
16
|
+
stepsStore
|
|
17
|
+
.on(registerStep, (state, step) => [...state, step])
|
|
18
|
+
.on(unregisterStep, (state, step) => state.filter((s) => s !== step))
|
|
22
19
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
const registerStep = (step: Step) => {
|
|
30
|
-
// todo: getIsSSR context
|
|
31
|
-
|
|
32
|
-
if (!supportsWindow()) {
|
|
33
|
-
// In SSR we should set the activeStep immediately if it is a match.
|
|
34
|
-
// If there are more Routes being registered after a match is found,
|
|
35
|
-
// we just skip them.
|
|
36
|
-
if (hasActiveStep) return
|
|
37
|
-
|
|
38
|
-
const isMatchingStep = step.key === currentStepStore.getState()?.key
|
|
39
|
-
|
|
40
|
-
if (isMatchingStep) {
|
|
41
|
-
setActiveStepEvent(step)
|
|
42
|
-
hasActiveStep = true
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
registerStepEvent(step)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const unregisterStep = (step: Step) => {
|
|
50
|
-
unregisterStepEvent(step)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
sample({
|
|
54
|
-
source: { steps: stepsStore, currentStep: currentStepStore },
|
|
55
|
-
fn: ({ steps, currentStep }) => steps.find((s) => s.key === currentStep?.key) || null,
|
|
56
|
-
target: setActiveStepEvent,
|
|
57
|
-
})
|
|
20
|
+
const activeStepStore = combine(
|
|
21
|
+
{ steps: stepsStore, currentStep: currentStepStore },
|
|
22
|
+
({ steps, currentStep }) => steps.find((s) => s.key === currentStep?.key) ?? null,
|
|
23
|
+
)
|
|
58
24
|
|
|
59
25
|
setStepRouter({
|
|
60
26
|
registerStep,
|
|
61
27
|
unregisterStep,
|
|
62
|
-
activeStep: activeStepStore
|
|
28
|
+
activeStep: activeStepStore,
|
|
63
29
|
})
|
|
64
30
|
</script>
|
|
65
31
|
|
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.1778120127377",
|
|
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.1778120127377",
|
|
92
92
|
"effector": "^23.3.0",
|
|
93
93
|
"svelte": "^5.46.4"
|
|
94
94
|
},
|