@picked/client 0.0.1-dev.1783478000089 → 0.0.1-dev.1783575114714
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/{api-vnk5tnrI.js → api-C8oFjhpj.js} +1 -1
- package/dist/{api-CphTE_dH.cjs → api-Dr44uSJA.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dom-observer/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/actions.mdx +2 -16
- package/dist/docs/sdk/actions.md +3 -21
- package/dist/{dom-BwmTHeT7.js → dom-CZyRgp2P.js} +17 -12
- package/dist/dom-CdxDV3e-.cjs +1 -0
- package/dist/esm/index.js +488 -384
- package/dist/esm/plugins/dom-observer/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/plugins/history-browser-storage/index.js +33 -11
- package/dist/esm/server/index.js +2 -2
- package/dist/experience-instance-BbSXoRrr.cjs +1 -0
- package/dist/{experience-instance-pTMwxW1R.js → experience-instance-M2kR3nTp.js} +200 -207
- package/dist/{plugin-NihglGoi.cjs → plugin-8aSF9x8V.cjs} +1 -1
- package/dist/{plugin-CZ3sF5el.js → plugin-DiVy3Ubv.js} +1 -1
- package/dist/types/entities/action/action.d.ts +2 -7
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +2 -2
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +23 -10
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts +30 -16
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +1 -0
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +10 -14
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +17 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +94 -0
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/dom-CDrHc_j9.cjs +0 -1
- package/dist/experience-instance-DunhI3b8.cjs +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +0 -24
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAML,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,UAAU,EAAE,kBAAkB,CAAA;CAC/B;AAED
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,OAAO,EAML,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AAEpF;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,sEAAsE;IACtE,UAAU,EAAE,kBAAkB,CAAA;CAC/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,MAAM,GAAG,CACnB,QAAQ,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,EAC7C,OAAO,EAAE,aAAa,GAAG,IAAI,KAE3B,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,GAChB,MAAM,GACN,OAAO,CAAC,MAAM,CAAC,GACf,MAAM,EAAE,GACR,OAAO,CAAC,MAAM,EAAE,CAAC,GACjB,IAAI,GACJ,OAAO,CAAC,IAAI,CAAC,GACb,SAAS,CAAA;AAEb,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEtE,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;CACf;AAID,QAAA,MAAM,wBAAwB,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;aAqBvC,MAAM;gBAAU,MAAM;;oBA8BpC,MAAM;;mCA6BhB,MAAM,YACP;QAAE,UAAU,EAAE,kBAAkB,CAAA;KAAE,KAC3C,KAAK,CAAC,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;CA4ClC,CAAA;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,CAAC,CAAC,EACxF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAE7C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,YAAY,KAAG,IAEhF,CAAA"}
|
|
@@ -71,8 +71,8 @@ export interface ExperienceStore {
|
|
|
71
71
|
*
|
|
72
72
|
* @template T - Factory parameter type.
|
|
73
73
|
* @param {T} params - The client instance and experience data.
|
|
74
|
-
* @param {Picked} params.client - The Picked client
|
|
75
|
-
* @param {Experience} params.experience - The experience definition to wrap in stores
|
|
74
|
+
* @param {Picked} params.client - The Picked client this experience belongs to.
|
|
75
|
+
* @param {Experience} params.experience - The experience definition to wrap in stores.
|
|
76
76
|
* @returns {ReturnType<typeof createExperienceFactory>} An experience store with config, tree, fields, and component sub-stores.
|
|
77
77
|
* @example
|
|
78
78
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,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C,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;CACjE;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IAClC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,IAAI,CAExE,CAAA"}
|
|
@@ -29,15 +29,6 @@ export interface ExperienceInstance {
|
|
|
29
29
|
setOpen: EventCallable<boolean>;
|
|
30
30
|
treeStore: ExperienceStore['treeStore'];
|
|
31
31
|
currentNodeStore: Store<ExperienceNode | null>;
|
|
32
|
-
/**
|
|
33
|
-
* The step currently on screen. Only step nodes update it, so it deliberately
|
|
34
|
-
* retains the last resolved step — rather than blanking to `null` — while the
|
|
35
|
-
* engine transits ANY non-step node (an action running or a condition
|
|
36
|
-
* evaluating). Both `StepRouter` bindings keep rendering this step during those
|
|
37
|
-
* transits instead of flashing empty; it is `null` only before the first step
|
|
38
|
-
* resolves. This "hold last step" contract intentionally applies to every
|
|
39
|
-
* non-step transit, not just async actions.
|
|
40
|
-
*/
|
|
41
32
|
currentStepStore: Store<ExperienceStep | null>;
|
|
42
33
|
previousStepStore: Store<ExperienceStep | null>;
|
|
43
34
|
nextReachableStepNodesStore: Store<ExperienceNode[]>;
|
|
@@ -46,8 +37,30 @@ export interface ExperienceInstance {
|
|
|
46
37
|
goToNextStep: EventCallable<void>;
|
|
47
38
|
goToPreviousStep: EventCallable<void>;
|
|
48
39
|
goToStepById: EventCallable<string>;
|
|
49
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Drops this instance's history entries so it re-walks from origin via the existing
|
|
42
|
+
* null→origin pipeline. Sibling instances of the same experience keep their own
|
|
43
|
+
* navigation; the derived snapshot map is re-persisted by the storage plugin.
|
|
44
|
+
*/
|
|
45
|
+
reset: EventCallable<void>;
|
|
50
46
|
stepsHistoryStore: Store<HistoryEntry[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Reactive flag: `true` once the user has progressed *past* the first step of this
|
|
49
|
+
* instance. Derived from `stepsHistoryStore` — `true` at ≥ 2 step entries (entry step +
|
|
50
|
+
* one progression); `false` at origin, on the first step, or for a single-step funnel
|
|
51
|
+
* (even when that step has a saved answer). Gate a "continue" affordance on it, not
|
|
52
|
+
* "has any saved state".
|
|
53
|
+
*/
|
|
54
|
+
isResumableStore: Store<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Atomically clears this instance's history entries (as `reset` does) plus the responses
|
|
57
|
+
* owned by the experience's step nodes, so the walk re-fires from origin with blank
|
|
58
|
+
* answers. Use `reset` to clear navigation only and keep responses. History is
|
|
59
|
+
* per-instance, but responses are shared by field key: sibling instances keep their
|
|
60
|
+
* position, and a field shared with another experience via a reused step is cleared for
|
|
61
|
+
* both.
|
|
62
|
+
*/
|
|
63
|
+
restart: EventCallable<void>;
|
|
51
64
|
/**
|
|
52
65
|
* Per-instance mount effect. Attached over `componentAndFrameworkStore` so the render call always receives the current resolved component+framework pair.
|
|
53
66
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,
|
|
1
|
+
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAGlB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EAEV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAkB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AA0BtD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;IAChC,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,sGAAsG;IACtG,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACjD;;OAEG;IACH,0BAA0B,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC,CAAA;I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GAAG,UAAU,CAAC,OAAO,6BAA6B,CAAC,CAAA;AACtF,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACzC;AAED,QAAA,MAAM,+BAA+B,6CAMhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAClC,uBAqhBF,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAE/D;AAED,QAAA,MAAM,oCAAoC,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;wBA4H1E,eAAe,UACnB,WAAW,YACT,uBAAuB;8BAmBF,UAAU,CAAC,KAAK,CAAC;4BAiBnB,UAAU,CAAC,IAAI,CAAC;;CAU/C,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,SAAS,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAAC,CAAC,CAAC,EACpE,MAAM,EAAE,CAAC,GAAG,UAAU,CAAC,OAAO,oCAAoC,CAAC,CAEpE"}
|
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
import { ExperienceNode } from '../experience/experience';
|
|
2
|
-
|
|
2
|
+
/** Identifies one navigation slice: the `ExperienceInstance` and the `Experience` it belongs to. */
|
|
3
|
+
export interface InstanceScope {
|
|
4
|
+
instanceId: string;
|
|
5
|
+
experienceId: string;
|
|
6
|
+
}
|
|
7
|
+
/** Payload carried by `push`/`replace` — an `InstanceScope` plus the node to record. */
|
|
8
|
+
export interface InstanceNodeIntent extends InstanceScope {
|
|
9
|
+
node: ExperienceNode;
|
|
10
|
+
}
|
|
11
|
+
/** One recorded navigation step: the node an instance visited, with a unique id and `Date.now()` timestamp. */
|
|
12
|
+
export interface HistoryEntry extends InstanceScope {
|
|
3
13
|
id: string;
|
|
4
14
|
node: ExperienceNode;
|
|
5
15
|
at: number;
|
|
6
|
-
experienceId: string;
|
|
7
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a fresh history instance: an Effector-backed list of navigation
|
|
19
|
+
* entries plus the events that drive it. Live entries are filtered per
|
|
20
|
+
* instance via `instanceId`; the derived `snapshotStore` groups by
|
|
21
|
+
* `experienceId` and is used by the storage plugin to resume across respawn.
|
|
22
|
+
*
|
|
23
|
+
* @returns {ReturnType<typeof invoke<typeof createHistoryFactory>>} The events and stores.
|
|
24
|
+
* @example
|
|
25
|
+
* const history = createHistory()
|
|
26
|
+
*/
|
|
8
27
|
export declare function createHistory(): {
|
|
9
|
-
push: import('effector').EventCallable<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
experienceId: string;
|
|
15
|
-
node: ExperienceNode;
|
|
16
|
-
}>;
|
|
17
|
-
back: import('effector').EventCallable<{
|
|
18
|
-
experienceId?: string;
|
|
19
|
-
}>;
|
|
20
|
-
restore: import('effector').EventCallable<{
|
|
21
|
-
entries: HistoryEntry[];
|
|
28
|
+
push: import('effector').EventCallable<InstanceNodeIntent>;
|
|
29
|
+
replace: import('effector').EventCallable<InstanceNodeIntent>;
|
|
30
|
+
back: import('effector').EventCallable<Pick<InstanceScope, "instanceId">>;
|
|
31
|
+
restoreSnapshots: import('effector').EventCallable<{
|
|
32
|
+
snapshots: Record<string, HistoryEntry[]>;
|
|
22
33
|
}>;
|
|
23
|
-
|
|
34
|
+
seedInstanceFromSnapshot: import('effector').EventCallable<InstanceScope>;
|
|
35
|
+
clearForInstance: import('effector').EventCallable<Pick<InstanceScope, "instanceId">>;
|
|
36
|
+
entriesStore: import('effector').StoreWritable<HistoryEntry[]>;
|
|
37
|
+
snapshotStore: import('effector').Store<Record<string, HistoryEntry[]>>;
|
|
24
38
|
};
|
|
25
39
|
//# sourceMappingURL=history.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,oGAAoG;AACpG,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,wFAAwF;AACxF,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,EAAE,cAAc,CAAA;CACrB;AAED,+GAA+G;AAC/G,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;CACX;AAyLD;;;;;;;;;GASG;AACH,wBAAgB,aAAa;;;;;mBAhJd,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;;;;;;EAkJ5C"}
|
|
@@ -18,6 +18,7 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
18
18
|
};
|
|
19
19
|
clearAll: import('effector').EventCallable<void>;
|
|
20
20
|
clear: import('effector').EventCallable<string>;
|
|
21
|
+
clearByExperience: (experienceId: string) => void;
|
|
21
22
|
commit: (responsesToCommit: CommitResponses) => Promise<{
|
|
22
23
|
errors: ValidationError[];
|
|
23
24
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAiE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;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K,EAAE,QAAQ,CAAA;CAChB;AAED,QAAA,MAAM,0BAA0B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;mBA6BlD,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,GAAG,IAAI;kBACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,IAAI;;;;sCA6RzC,MAAM,KAAG,IAAI;gCArHjC,eAAe,KACjC,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;8CAtCpB,eAAe,KACjC,OAAO,CAAC;QAAE,iBAAiB,EAAE,eAAe,CAAC;QAAC,gBAAgB,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;;;;;;;;uBAqF7D,KAAK,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;yBAc7B,KAAK,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;gCAezB,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;CAyDpE,CAAA;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAC5F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAE/C;AAED,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -59,21 +59,16 @@ export declare class Picked {
|
|
|
59
59
|
readonly session: SessionEntity;
|
|
60
60
|
readonly searchParams: import('.').PickedSearchParams;
|
|
61
61
|
readonly history: {
|
|
62
|
-
push: EventCallable<
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
push: EventCallable<import('.').InstanceNodeIntent>;
|
|
63
|
+
replace: EventCallable<import('.').InstanceNodeIntent>;
|
|
64
|
+
back: EventCallable<Pick<import('.').InstanceScope, "instanceId">>;
|
|
65
|
+
restoreSnapshots: EventCallable<{
|
|
66
|
+
snapshots: Record<string, import('.').HistoryEntry[]>;
|
|
65
67
|
}>;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
back: EventCallable<{
|
|
71
|
-
experienceId?: string;
|
|
72
|
-
}>;
|
|
73
|
-
restore: EventCallable<{
|
|
74
|
-
entries: import('.').HistoryEntry[];
|
|
75
|
-
}>;
|
|
76
|
-
entriesStore: Store<import('.').HistoryEntry[]>;
|
|
68
|
+
seedInstanceFromSnapshot: EventCallable<import('.').InstanceScope>;
|
|
69
|
+
clearForInstance: EventCallable<Pick<import('.').InstanceScope, "instanceId">>;
|
|
70
|
+
entriesStore: StoreWritable<import('.').HistoryEntry[]>;
|
|
71
|
+
snapshotStore: Store<Record<string, import('.').HistoryEntry[]>>;
|
|
77
72
|
};
|
|
78
73
|
readonly components: {
|
|
79
74
|
register: EventCallable<{
|
|
@@ -172,6 +167,7 @@ export declare class Picked {
|
|
|
172
167
|
};
|
|
173
168
|
clearAll: EventCallable<void>;
|
|
174
169
|
clear: EventCallable<string>;
|
|
170
|
+
clearByExperience: (experienceId: string) => void;
|
|
175
171
|
commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
|
|
176
172
|
errors: import('.').ValidationError[];
|
|
177
173
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC7B,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,iBAAiB,EAAe,MAAM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KAAG,IAAI,CAE1C;IAED,eAAe,GAAI,SAAS,OAAO,KAAG,IAAI,CAEzC;IAED,cAAc,GAAI,KAAK,MAAM,EAAE,QAAQ,MAAM,KAAG,IAAI,CAEnD;IAED,kBAAkB,GAAI,YAAY,UAAU,KAAG,IAAI,CAMlD;IAED;;;;;;;;;OASG;IAEH,oBAAoB,GAClB,cAAc,MAAM,EACpB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IACD;;;;;;;;;OASG;IAEH,qBAAqB,GACnB,eAAe,MAAM,EACrB,UAAU,uBAAuB,KAChC,OAAO,CAAC,IAAI,CAAC,CAEf;IAED;;;;;;;;OAQG;IAEH,kBAAkB,GAAU,cAAc,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAE/D;IAED;;;;;;;;OAQG;IAEH,mBAAmB,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAEjE;IAED,OAAO,CAAC,YAAY;IAsBpB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,eAAe;IAWvB,eAAe,GAAI,YAAY,MAAM,KAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1F;CACF"}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
|
+
export declare const STORAGE_KEY: import('../..').StorageKey;
|
|
2
3
|
/** @public */
|
|
3
4
|
export interface HistoryBrowserStoragePlugin {
|
|
4
5
|
storage?: 'local' | 'session';
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Picked plugin that persists per-experience history snapshots into
|
|
9
|
+
* `localStorage` (default) or `sessionStorage` and restores them on plugin
|
|
10
|
+
* setup and again on the client `load` event (restore is idempotent — the
|
|
11
|
+
* history entity only fills experiences that have no live entries yet).
|
|
12
|
+
*
|
|
13
|
+
* A stored payload that isn't a recognised snapshot map (a legacy flat-array
|
|
14
|
+
* format, or corruption) is ignored rather than restored, so the visitor
|
|
15
|
+
* simply starts fresh and the next save overwrites it.
|
|
16
|
+
*
|
|
17
|
+
* @param {HistoryBrowserStoragePlugin} [options] - Plugin options.
|
|
18
|
+
* @param {'local' | 'session'} [options.storage] - Backing store.
|
|
19
|
+
* @returns {Plugin} A Picked client plugin.
|
|
20
|
+
* @example
|
|
21
|
+
* client.use(historyBrowserStoragePlugin({ storage: 'session' }))
|
|
22
|
+
*/
|
|
6
23
|
export declare const historyBrowserStoragePlugin: ({ storage, }?: HistoryBrowserStoragePlugin) => Plugin;
|
|
7
24
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/history-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,eAAO,MAAM,WAAW,4BAAwC,CAAA;AA8BhE,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,2BAA2B,GAAI,eAEzC,2BAAgC,KAAG,MAyDrC,CAAA"}
|
|
@@ -1,19 +1,113 @@
|
|
|
1
1
|
import { ExperienceTarget } from '../entities/experience/experience';
|
|
2
|
+
/**
|
|
3
|
+
* Queries the document for elements matching `selector`, filtered to `HTMLElement` only.
|
|
4
|
+
* Returns an empty array in non-browser environments.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} selector - CSS selector to query.
|
|
7
|
+
* @returns {HTMLElement[]} Matching elements; empty array if `window`/`document` is unavailable.
|
|
8
|
+
* @example
|
|
9
|
+
* querySelector('.cta-button')
|
|
10
|
+
*/
|
|
2
11
|
export declare function querySelector(selector: string): HTMLElement[];
|
|
12
|
+
/**
|
|
13
|
+
* Attaches an open shadow root to `target` and returns it.
|
|
14
|
+
*
|
|
15
|
+
* @param {HTMLElement} target - Element to attach the shadow root to.
|
|
16
|
+
* @returns {ShadowRoot} The attached shadow root.
|
|
17
|
+
* @throws {Error} When shadow DOM is unsupported in the current environment.
|
|
18
|
+
* @example
|
|
19
|
+
* const root = createShadowRoot(hostElement)
|
|
20
|
+
*/
|
|
3
21
|
export declare function createShadowRoot(target: HTMLElement): ShadowRoot;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves once the document is past `loading` (interactive or complete). Rejects if no
|
|
24
|
+
* document is available (e.g. SSR).
|
|
25
|
+
*
|
|
26
|
+
* @returns {Promise<void>} Resolves on `readystatechange` or immediately if already past loading.
|
|
27
|
+
* @example
|
|
28
|
+
* await domInteractive()
|
|
29
|
+
*/
|
|
4
30
|
export declare function domInteractive(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Invokes `callback` once `element` is removed from the document. Uses a `MutationObserver`
|
|
33
|
+
* scoped to `document.body` with `subtree: true`.
|
|
34
|
+
*
|
|
35
|
+
* @param {HTMLElement} element - The element to watch.
|
|
36
|
+
* @param {() => void} callback - Fires once when `element` leaves the document.
|
|
37
|
+
* @returns {void}
|
|
38
|
+
* @example
|
|
39
|
+
* onElementRemoved(host, () => instance.destroy())
|
|
40
|
+
*/
|
|
5
41
|
export declare function onElementRemoved(element: HTMLElement, callback: () => void): void;
|
|
6
42
|
type Placement = 'replace' | 'before' | 'after' | 'prepend' | 'append';
|
|
43
|
+
/**
|
|
44
|
+
* Resolves each declared `target` to the live DOM elements it matches, filtered to skip
|
|
45
|
+
* elements already tagged for `experienceId` or already wrapped in a picked-root for it.
|
|
46
|
+
* Always appends a synthetic `picked-root[experience-id="…"]` target so web-component
|
|
47
|
+
* placeholders resolve too.
|
|
48
|
+
*
|
|
49
|
+
* @param {{ selector: string; placement: Placement }[]} targets - Declared selectors and placements from experience config.
|
|
50
|
+
* @param {string} experienceId - The current experience id used to skip self-claimed elements.
|
|
51
|
+
* @returns {(ExperienceTarget & { elements: HTMLElement[] })[]} Targets enriched with their resolved elements.
|
|
52
|
+
* @example
|
|
53
|
+
* getTargetElements(config.targetSelectors, experience.id)
|
|
54
|
+
*/
|
|
7
55
|
export declare function getTargetElements(targets: {
|
|
8
56
|
selector: string;
|
|
9
57
|
placement: Placement;
|
|
10
58
|
}[], experienceId: string): (ExperienceTarget & {
|
|
11
59
|
elements: HTMLElement[];
|
|
12
60
|
})[];
|
|
61
|
+
/**
|
|
62
|
+
* Creates a picked-root host per resolved element and inserts it into the DOM according to
|
|
63
|
+
* the target's placement.
|
|
64
|
+
*
|
|
65
|
+
* @param {(ExperienceTarget & { elements: HTMLElement[] })[]} targets - Resolved targets with their matched elements.
|
|
66
|
+
* @param {string} experienceId - The current experience id; stamped onto each host.
|
|
67
|
+
* @param {string} experienceKey - The current experience key; added as a class for styling.
|
|
68
|
+
* @returns {HTMLElement[]} The hosts created and inserted into the DOM, in iteration order.
|
|
69
|
+
* @example
|
|
70
|
+
* const hosts = createAppHosts(targets, experience.id, experience.key)
|
|
71
|
+
*/
|
|
13
72
|
export declare function createAppHosts(targets: (ExperienceTarget & {
|
|
14
73
|
elements: HTMLElement[];
|
|
15
74
|
})[], experienceId: string, experienceKey: string): HTMLElement[];
|
|
75
|
+
/**
|
|
76
|
+
* Finds an existing picked-root host that has already claimed the given selector. Returns
|
|
77
|
+
* the claiming experience id, or `undefined` if no host is found.
|
|
78
|
+
*
|
|
79
|
+
* Used by the per-experience initialise effect to detect target conflicts. The lookup
|
|
80
|
+
* intentionally does not filter by placement: only `placement: 'replace'` removes the
|
|
81
|
+
* original target elements, so any prior claim that caused a later experience to find
|
|
82
|
+
* zero matches must itself have been `replace`. Selector alone is sufficient.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} selector - The original target selector to look up.
|
|
85
|
+
* @returns {string | undefined} The claiming experience id, or `undefined`.
|
|
86
|
+
* @example
|
|
87
|
+
* const claimer = findClaimingExperienceId('.host-slot')
|
|
88
|
+
*/
|
|
89
|
+
export declare function findClaimingExperienceId(selector: string): string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Tags `element` with both the generic and experience-specific picked-target classes so
|
|
92
|
+
* subsequent target resolution can skip it (avoids re-binding the same experience).
|
|
93
|
+
*
|
|
94
|
+
* @param {HTMLElement} element - The element to tag.
|
|
95
|
+
* @param {string} experienceId - The owning experience id.
|
|
96
|
+
* @returns {void}
|
|
97
|
+
* @example
|
|
98
|
+
* tagTargetElement(el, experience.id)
|
|
99
|
+
*/
|
|
16
100
|
export declare function tagTargetElement(element: HTMLElement, experienceId: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Tests whether `element` is a picked-root host, optionally narrowed to a specific
|
|
103
|
+
* experience id.
|
|
104
|
+
*
|
|
105
|
+
* @param {HTMLElement} element - The element to test.
|
|
106
|
+
* @param {string} [experienceId] - When provided, requires the host to belong to this experience.
|
|
107
|
+
* @returns {boolean} True if `element` is a picked-root host matching the constraint.
|
|
108
|
+
* @example
|
|
109
|
+
* isPickedRoot(el, experience.id)
|
|
110
|
+
*/
|
|
17
111
|
export declare function isPickedRoot(element: HTMLElement, experienceId?: string): boolean;
|
|
18
112
|
export {};
|
|
19
113
|
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAGzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAQ7D;AAID,wBAAgB,gBAAgB,CAAC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GAAG,SAAS,GAAG,QAAQ,CAAA;AAOtE;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,EAAE,EACrD,YAAY,EAAE,MAAM,GACnB,CAAC,gBAAgB,GAAG;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,EAAE,CAqBpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,CAAC,gBAAgB,GAAG;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,EAAE,EAC3D,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,iBAOtB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI7E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAE1E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,WAMvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@picked/client",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.1783575114714",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@withease/factories": "^1.0.5"
|
|
6
6
|
},
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"size-limit": [
|
|
167
167
|
{
|
|
168
168
|
"path": "dist/esm/index.js",
|
|
169
|
-
"limit": "
|
|
169
|
+
"limit": "15 kB"
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
"path": "dist/esm/server/index.js",
|
package/dist/dom-CDrHc_j9.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./supports-DBzjGaWD.cjs");function t(t){return!e.f()||!e.i()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}var n=`open`;function r(t){if(!e.u())throw Error(`Shadow DOM is not supported in this environment`);return t.attachShadow({mode:n})}function i(){return new Promise((t,n)=>{if(!e.i()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>t(),{once:!0}):t()})}function a(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var o=`picked-root`,s=`picked-target`,c=`picked-root`;function l(e,n){return[...e,{selector:`${c}[experience-id="${n}"]`,placement:`replace`}].flatMap(e=>{let r=t(e.selector).filter(e=>!f(e,n)&&!p(e,n));return{...e,elements:r}})}function u(e,t,n){return e.flatMap(e=>e.elements.map(r=>h(r,e.placement,t,n)))}function d(e,t){e.classList.add(s),e.classList.add(`${s}-${t}`)}function f(e,t){return t?e.classList.contains(`${s}-${t}`):e.classList.contains(`${s}`)}function p(e,t){return t?e.classList.contains(`${o}-${t}`):e.classList.contains(o)}function m(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(o),n.classList.add(`${o}-${e}`),n.classList.add(`${o}-${t}`),n}function h(e,t,n,r){let i,a=m(n,r);if(e instanceof Document)i=e.body.appendChild(a);else{switch(t){case`replace`:e.replaceWith(a);break;case`before`:e.before(a);break;case`after`:e.after(a);break;case`prepend`:e.prepend(a);break;case`append`:e.append(a);break}i=a}return i}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./rules-logic-CGZIYgAI.cjs");require("./logger-CSTvAyyB.cjs");const t=require("./dom-CDrHc_j9.cjs");let n=require("effector"),r=require("@withease/factories");function i(e){return e.type===`condition`}function a(e){return e.type===`step`}function o(e){return e.type===`experience`}function s(e){return e.type===`origin`}function c(e){return e.type===`action`}var l=`conditions.`,u=(0,n.createDomain)(`condition-results`);function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){if(e===void 0)return null;if(Array.isArray(e))return e.map(e=>f(e));if(d(e)){let t=Object.keys(e).sort((e,t)=>e.localeCompare(t)),n={};for(let r of t)n[r]=f(e[r]);return n}return e}function p(e){return JSON.stringify(f(e))}var m=(0,r.createFactory)(()=>{let e=u.store({}),t=(0,n.createApi)(e,{set(e,t){return{...e,[t.hash]:t.result}},seed(e,t){return{...e,...t}},clear(){return{}}});function r(e){t.set(e)}function i(e){t.seed(e)}function a(){t.clear()}function o(t){return e.getState()[t]}return{store:e,set:r,seed:i,peek:o,reset:a}});function h(){return(0,r.invoke)(m)}async function g(t,n,r){return n==null?!0:typeof n==`boolean`?n:e.n(n)?await e.t(t,n,r)===!0:!0}function _(e){if(typeof e==`string`)return e;if(Array.isArray(e)&&typeof e[0]==`string`)return e[0]}function v(e){if(Array.isArray(e))return e.some(v);if(d(e)){let t=_(e.var);return t!==void 0&&(t===`actions`||t.startsWith(`actions.`))?!0:Object.values(e).some(v)}return!1}function y(e){if(Array.isArray(e))return e.flatMap(y);if(d(e)){let t=_(e.var);return[...t!==void 0&&t.startsWith(l)?[t.slice(11)]:[],...Object.values(e).flatMap(y)]}return[]}function b(e,t,n=new Set){if(v(e))return!0;for(let r of y(e)){if(n.has(r))continue;n.add(r);let e=t[r];if(e!==void 0&&b(e.logic,t,n))return!0}return!1}async function x(e,t,n){let r={};for(let t of e.conditions.listStore.getState())r[t.key]=t;let i=b(t,r),a=p(t);if(!i){let t=e.conditionResults.peek(a);if(t!==void 0)return t}let o=await g(e,t,n?.context);return i||e.conditionResults.set({hash:a,result:o}),o}async function S(e,t,n){let r=n?.context,i=[n?.precondition,n?.condition,t.condition];for(let t of i)if(!await x(e,t,{context:r}))return!1;return!0}var C=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),a(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?C(e,t,r,!1,i):[]})),w=(e,t,n)=>C(e,t,n,!0,new Set),T=(e,t,n,r,i=new Set)=>{if(i.has(n.id))return[-1,-1];i.add(n.id);let a=t.filter(e=>e.sourceNodeId===n.id);if(a.length===0)return[0,0];let o=1/0,s=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,c]=T(e,t,r,!1,new Set(i));a!==-1&&(o=Math.min(o,a+1),s=Math.max(s,c+1))}return o===1/0?[-1,-1]:[o,s]},E=(e,t,n)=>T(e,t,n,!0,new Set),D=(e,t,n,r=new Set)=>{if(r.has(n.id))return[-1,-1];if(r.add(n.id),n.type===`origin`)return[0,0];let i=t.filter(e=>e.destinationNodeId===n.id);if(i.length===0)return[-1,-1];let a=1/0,o=-1/0;for(let n of i){let i=e.find(e=>e.id===n.sourceNodeId);if(!i)continue;let[s,c]=D(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,c+1))}return a===1/0?[-1,-1]:[a,o]},ee=(e,t,n)=>D(e,t,n,new Set),O=e=>e.find(e=>e.type===`origin`)||null,k=(e,t,n)=>{if(!e)return O(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function A(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}function j(e,t,n,r){let i=r.filter(e=>e.sourceNodeId===t),a=e?`true`:`false`,o=i.find(e=>e.sourceHandle===a)??i.find(e=>e.sourceHandle==null);return n.find(e=>e.id===o?.destinationNodeId)}var M=(0,n.createDomain)(`experience-instance`),N=(0,r.createFactory)(({client:r,experience:l,target:u,options:d})=>{let f=(0,n.createEvent)(),p=(0,n.createEvent)(),m=(0,n.createEvent)(),h=(0,n.createEvent)(),g=(0,n.createEvent)(),_=(0,n.createEvent)(),v=(0,n.createEvent)(),y=l.componentStore,b=M.store(`transitioning`),x=r.history.entriesStore.map(e=>e.filter(e=>e.experienceId===l.id)),S=x.map(e=>e.filter(e=>a(e.node))),C=x.map(e=>e.at(-1)?.node||null),T=M.store(null);(0,n.sample)({clock:[C,r.steps.listStore],source:{steps:r.steps.listStore,node:C},filter:({node:e})=>e!==null&&a(e),fn:({steps:e,node:t})=>t&&a(t)?e.find(e=>e.id===t.stepId)??null:null,target:T});let D=(0,n.combine)(r.steps.listStore,S,(e,t)=>{let n=t.at(-2);if(!n||!a(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),N=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?w(e,t,n):[]),P=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?ee(e,t,n):[-1,-1]),F=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?E(e,t,n):[-1,-1]),I=M.store(!1),L=(0,n.createApi)(I,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),R=(0,n.createEffect)(async()=>{r.history.back({experienceId:l.id})}),z=(0,n.attach)({source:l.treeStore,effect:async(e,t)=>{let n=e.nodes.find(e=>a(e)&&e.stepId===t);n&&r.history.push({experienceId:l.id,node:n})}}),B=(0,n.attach)({source:l.treeStore,effect:async(e,t)=>{let n=e.steps.find(e=>e.key===t);if(!n)return;let i=e.nodes.find(e=>a(e)&&e.stepId===n.id);i&&r.history.push({experienceId:l.id,node:i})}}),V=(0,n.attach)({source:C,effect:e=>{}}),H=(0,n.attach)({source:l.treeStore,effect:async({nodes:e})=>O(e)}),U=(0,n.attach)({source:l.treeStore,effect:async({nodes:e,edges:t},n)=>{if(s(n))return k(n,e,t)}}),W=(0,n.attach)({source:l.treeStore,effect:async({nodes:t,edges:n,conditions:a},o)=>{if(!i(o))return;let s=a.find(e=>e.id===o.conditionId)?.logic;return s?A(!!await e.t(r,s),o.id,t,n):void 0}}),G=(0,n.attach)({source:{tree:l.treeStore,actions:r.actions.listStore,snapshot:r.stateSnapshotStore},effect:async({tree:e,actions:t,snapshot:n},r)=>{let{nodes:i,edges:a}=e;if(!c(r))return;let o=r.actionKey;if(!o){`${r.id}`;return}let s=t.find(e=>e.key===o)?.action;if(typeof s!=`function`)return`${o}`,j(!1,r.id,i,a)??null;let l=!0;try{`${o}`,l=await s({...n,args:[]},{experience:Z})!==!1}catch{`${o}`,l=!1}let u=j(l,r.id,i,a);if(!u){let e=a.some(e=>e.sourceNodeId===r.id)?`no edge for its outcome`:`no outgoing edge`;return`${r.id}${e}`,null}return`${o}${u.id}`,u}}),K=(0,n.createEffect)(e=>{o(e)&&r.experiences.launch({key:e.experienceKey})}),q=(0,n.attach)({source:[C,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>k(e,t,n)}),J=(0,n.attach)({source:[C,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>k(e,t,n)}),te=(0,n.createEffect)(e=>{r.history.push({experienceId:l.id,node:e})}),Y=(0,n.attach)({source:l.configStore,effect:async({initializeOpenLogic:t})=>d?.initialiseOpen===void 0?e.n(t)?!!await e.t(r,t):t??!1:d.initialiseOpen}),X=(0,n.combine)(y,r.frameworks.listStore,(e,t)=>{if(!e)return null;let n=t.find(t=>t.name===e.component.frameworkName);return n?{component:e,framework:n}:null},{skipVoid:!1}),Z,ne=(0,n.attach)({source:X,effect:e=>{if(!e)return;if(!u){`${l.id}`;return}let n=t.n(u);try{e.framework.render(n,e.component.component,r,Z)}catch{}}});Z=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:l.key,experienceId:l.id,experienceName:l.name,configStore:l.configStore,target:u,componentStore:y,componentAndFrameworkStore:X,stateStore:b,isOpenStore:I,open:L.open,close:L.close,toggleOpen:L.toggle,setOpen:L.set,treeStore:l.treeStore,currentNodeStore:C,currentStepStore:T,previousStepStore:D,nextReachableStepNodesStore:N,stepsToOriginStore:P,stepsToLeafStore:F,goToNextStep:p,goToPreviousStep:m,goToStepById:h,goToStepByKey:g,stepsHistoryStore:S,mountFx:ne});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:C,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:H}),(0,n.sample)({clock:Q,filter:e=>e!==null,target:$}),(0,n.split)({source:$,match:e=>i(e)?`condition`:a(e)?`step`:o(e)?`launchExperience`:s(e)?`origin`:c(e)?`action`:`other`,cases:{origin:U,condition:W,step:V,launchExperience:K,action:G,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[W.doneData,U.doneData,H.doneData,J.doneData,q.doneData,G.doneData],filter:Boolean,target:te}),(0,n.sample)({clock:p,target:J}),(0,n.sample)({clock:p,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:Z}))}),(0,n.sample)({clock:J.done,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:Z}))}),(0,n.sample)({clock:J.fail,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:Z}))}),(0,n.sample)({clock:m,target:R}),(0,n.sample)({clock:h,target:z}),(0,n.sample)({clock:g,target:B}),(0,n.sample)({source:(0,n.combine)([W.pending,U.pending,H.pending,J.pending,q.pending,G.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:b}),(0,n.sample)({clock:V.doneData,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:Z}))}),(0,n.sample)({clock:v,target:Y}),(0,n.sample)({source:Y.doneData,fn:Boolean,target:I}),(0,n.sample)({source:C,clock:f,filter:e=>e?s(e):!0,target:q}),(0,n.sample)({source:I,filter:Boolean,target:f}),(0,n.sample)({source:I,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:Z}))}),(0,n.sample)({source:I,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:Z}))}),(0,n.sample)({clock:_,target:[v]}),_(),Z});function P(e){return(0,r.invoke)(N,e)}var F=(0,r.createFactory)(({client:e})=>{let r=M.store({}),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createEvent)(),s=(0,n.createApi)(r,{register(e,t){let n=[...e[t.experienceId]??[]];return n.push(t),{...e,[t.experienceId]:n}},unregister(e,t){let n=t.experienceId,r=e[n]?.filter(e=>e!==t);return{...e,[n]:r??[]}}}),c=(0,n.createEffect)(({experience:t,target:n,options:r})=>P({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{s.register(e)}),u=(0,n.createEffect)(e=>{e.target&&t.o(e.target,()=>{o(e)})}),d=(0,n.createEffect)(e=>{s.unregister(e)}),f=(0,n.createEffect)(async e=>{await e.mountFx()});(0,n.sample)({clock:i,target:c}),(0,n.sample)({clock:o,target:d}),(0,n.sample)({clock:c.doneData,target:[l,u,a]}),(0,n.sample)({clock:c.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:a,target:f});function p(e,t,n){i({experience:e,target:t,options:n})}let m=r.map(e=>Object.values(e).flat());function h(e){return m.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function g(e){return r.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:p,getByExperienceKey:h,getByExperienceId:g,listStore:m}});function I(e){return(0,r.invoke)(F,e)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ExperienceEdge, ExperienceNode } from '../../entities/experience/experience';
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the next node after an action node from its success or failure outcome.
|
|
4
|
-
*
|
|
5
|
-
* The explicit outcome branch is preferred (sourceHandle `'true'` for success and
|
|
6
|
-
* `'false'` for failure). When that branch is absent, a plain handle-less edge is used
|
|
7
|
-
* as a fallback, so an action wired as a bare continue (for example the builder's
|
|
8
|
-
* addNext connector) passes through instead of dead-ending. Explicit success and failure
|
|
9
|
-
* branches therefore still win, while a plain connection becomes a pass-through.
|
|
10
|
-
*
|
|
11
|
-
* @param {boolean} success - Whether the action succeeded (`true`) or failed (`false`).
|
|
12
|
-
* @param {string} actionNodeId - The ID of the action node in the graph.
|
|
13
|
-
* @param {ExperienceNode[]} nodes - All nodes in the experience graph.
|
|
14
|
-
* @param {ExperienceEdge[]} edges - All edges in the experience graph.
|
|
15
|
-
* @returns {ExperienceNode | undefined} The next node, or `undefined` when the action node
|
|
16
|
-
* has neither an edge for the outcome nor a plain edge (a genuine terminal).
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* // Branch on an API response without throwing:
|
|
20
|
-
* const nextNode = getNextNodeFromAction(response.ok, 'action-1', nodes, edges)
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function getNextNodeFromAction(success: boolean, actionNodeId: string, nodes: ExperienceNode[], edges: ExperienceEdge[]): ExperienceNode | undefined;
|
|
24
|
-
//# sourceMappingURL=get-next-node-from-action.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-next-node-from-action.d.ts","sourceRoot":"","sources":["../../../../src/utils/node-tree/get-next-node-from-action.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAE1F;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,cAAc,EAAE,EACvB,KAAK,EAAE,cAAc,EAAE,GACtB,cAAc,GAAG,SAAS,CAO5B"}
|