@picked/client 0.0.1-dev.1778467244607 → 0.0.1-dev.1778561735098
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-DWGhvwuG.js → api-Bzb9pR2r.js} +1 -1
- package/dist/{api-CF5VqlzY.cjs → api-XV6bcv_D.cjs} +1 -1
- package/dist/cjs/index.js +2 -2
- 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/esm/index.js +440 -380
- package/dist/esm/plugins/dynamic-experiences/index.js +1 -1
- package/dist/esm/plugins/history-browser-storage/index.js +52 -13
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-B16NqD7y.cjs +1 -0
- package/dist/{experience-instance-BrLWgVAN.js → experience-instance-CZC0uPuv.js} +215 -203
- 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.map +1 -1
- package/dist/types/entities/history/history.d.ts +28 -16
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/picked.d.ts +8 -14
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +16 -0
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +27 -0
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-Ct3ogC7n.cjs +0 -1
|
@@ -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,M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A"}
|
|
@@ -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;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;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,uBA0fF,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,37 @@
|
|
|
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
|
+
export interface HistoryEntry extends InstanceScope {
|
|
3
12
|
id: string;
|
|
4
13
|
node: ExperienceNode;
|
|
5
14
|
at: number;
|
|
6
|
-
experienceId: string;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a fresh history instance: an Effector-backed list of navigation
|
|
18
|
+
* entries plus the events that drive it. Live entries are filtered per
|
|
19
|
+
* instance via `instanceId`; the derived `snapshotStore` groups by
|
|
20
|
+
* `experienceId` and is used by the storage plugin to resume across respawn.
|
|
21
|
+
*
|
|
22
|
+
* @returns {ReturnType<typeof invoke<typeof createHistoryFactory>>} The events and stores.
|
|
23
|
+
* @example
|
|
24
|
+
* const history = createHistory()
|
|
25
|
+
*/
|
|
8
26
|
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[];
|
|
27
|
+
push: import('effector').EventCallable<InstanceNodeIntent>;
|
|
28
|
+
replace: import('effector').EventCallable<InstanceNodeIntent>;
|
|
29
|
+
back: import('effector').EventCallable<Pick<InstanceScope, "instanceId">>;
|
|
30
|
+
restoreSnapshots: import('effector').EventCallable<{
|
|
31
|
+
snapshots: Record<string, HistoryEntry[]>;
|
|
22
32
|
}>;
|
|
23
|
-
|
|
33
|
+
seedInstanceFromSnapshot: import('effector').EventCallable<InstanceScope>;
|
|
34
|
+
entriesStore: import('effector').StoreWritable<HistoryEntry[]>;
|
|
35
|
+
snapshotStore: import('effector').Store<Record<string, HistoryEntry[]>>;
|
|
24
36
|
};
|
|
25
37
|
//# 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,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;CACX;AAsKD;;;;;;;;;GASG;AACH,wBAAgB,aAAa;;;;;mBA7Hd,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;;;;;EA+H5C"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -28,21 +28,15 @@ export declare class Picked {
|
|
|
28
28
|
readonly session: SessionEntity;
|
|
29
29
|
readonly searchParams: import('.').PickedSearchParams;
|
|
30
30
|
readonly history: {
|
|
31
|
-
push: EventCallable<
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
push: EventCallable<import('.').InstanceNodeIntent>;
|
|
32
|
+
replace: EventCallable<import('.').InstanceNodeIntent>;
|
|
33
|
+
back: EventCallable<Pick<import('.').InstanceScope, "instanceId">>;
|
|
34
|
+
restoreSnapshots: EventCallable<{
|
|
35
|
+
snapshots: Record<string, import('.').HistoryEntry[]>;
|
|
34
36
|
}>;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}>;
|
|
39
|
-
back: EventCallable<{
|
|
40
|
-
experienceId?: string;
|
|
41
|
-
}>;
|
|
42
|
-
restore: EventCallable<{
|
|
43
|
-
entries: import('.').HistoryEntry[];
|
|
44
|
-
}>;
|
|
45
|
-
entriesStore: Store<import('.').HistoryEntry[]>;
|
|
37
|
+
seedInstanceFromSnapshot: EventCallable<import('.').InstanceScope>;
|
|
38
|
+
entriesStore: StoreWritable<import('.').HistoryEntry[]>;
|
|
39
|
+
snapshotStore: Store<Record<string, import('.').HistoryEntry[]>>;
|
|
46
40
|
};
|
|
47
41
|
readonly components: {
|
|
48
42
|
register: EventCallable<{
|
|
@@ -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,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EACL,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AACzF,OAAO,EAA6B,KAAK,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjG,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAIzD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACjG,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,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AAE,OAAO,CAAC,CAE1F;CACF"}
|
|
@@ -1,7 +1,23 @@
|
|
|
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
|
+
* Reads the v1 flat-array shape transparently and migrates it in place; the
|
|
14
|
+
* next debounced save overwrites the v1 bytes with the v2 record shape.
|
|
15
|
+
*
|
|
16
|
+
* @param {HistoryBrowserStoragePlugin} [options] - Plugin options.
|
|
17
|
+
* @param {'local' | 'session'} [options.storage] - Backing store.
|
|
18
|
+
* @returns {Plugin} A Picked client plugin.
|
|
19
|
+
* @example
|
|
20
|
+
* client.use(historyBrowserStoragePlugin({ storage: 'session' }))
|
|
21
|
+
*/
|
|
6
22
|
export declare const historyBrowserStoragePlugin: ({ storage, }?: HistoryBrowserStoragePlugin) => Plugin;
|
|
7
23
|
//# 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;AA2DhE,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,2BAA2B,GAAI,eAEzC,2BAAgC,KAAG,MA2ErC,CAAA"}
|
|
@@ -13,6 +13,33 @@ export declare function getTargetElements(targets: {
|
|
|
13
13
|
export declare function createAppHosts(targets: (ExperienceTarget & {
|
|
14
14
|
elements: HTMLElement[];
|
|
15
15
|
})[], experienceId: string, experienceKey: string): HTMLElement[];
|
|
16
|
+
/**
|
|
17
|
+
* Finds an existing picked-root host that has already claimed the given selector. Returns
|
|
18
|
+
* the claiming experience id, or `undefined` if no host is found.
|
|
19
|
+
*
|
|
20
|
+
* Used by the per-experience initialise effect to detect target conflicts. The lookup
|
|
21
|
+
* intentionally does not filter by placement: only `placement: 'replace'` removes the
|
|
22
|
+
* original target elements, so any prior claim that caused a later experience to find
|
|
23
|
+
* zero matches must itself have been `replace`. Selector alone is sufficient.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} selector - The original target selector to look up.
|
|
26
|
+
* @returns {string | undefined} The claiming experience id, or `undefined`.
|
|
27
|
+
* @example
|
|
28
|
+
* const claimer = findClaimingExperienceId('.host-slot')
|
|
29
|
+
*/
|
|
30
|
+
export declare function findClaimingExperienceId(selector: string): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Finds an existing picked-root host nested inside `element` that was claimed by a different
|
|
33
|
+
* experience. Used to detect destructive `placement: 'replace'` collisions where the
|
|
34
|
+
* replacing experience would otherwise silently remove another experience's host.
|
|
35
|
+
*
|
|
36
|
+
* @param {HTMLElement} element - The element that is about to be replaced.
|
|
37
|
+
* @param {string} ownExperienceId - The current experience id; matching hosts are ignored.
|
|
38
|
+
* @returns {string | undefined} The id of a nested experience's host, if any.
|
|
39
|
+
* @example
|
|
40
|
+
* findDescendantClaim(parentEl, 'B')
|
|
41
|
+
*/
|
|
42
|
+
export declare function findDescendantClaim(element: HTMLElement, ownExperienceId: string): string | undefined;
|
|
16
43
|
export declare function tagTargetElement(element: HTMLElement, experienceId: string): void;
|
|
17
44
|
export declare function isPickedRoot(element: HTMLElement, experienceId?: string): boolean;
|
|
18
45
|
export {};
|
|
@@ -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,MAAM,EAAE,WAAW,GAAG,UAAU,CAMhE;AAED,wBAAgB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAa9C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,QAS1E;AAED,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;AAOtE,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,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;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAG1E;AAUD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,E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MAAM,QAG1E;AAUD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,WAMvE"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require(`./rules-logic-H6P8xwHF.cjs`);require(`./logger-fbvQC40v.cjs`);const t=require(`./supports-Dsjg-82e.cjs`);let n=require(`effector`),r=require(`@withease/factories`);function i(e){return!t.d()||!t.r()?[]:Array.from(window.document.querySelectorAll(e)).filter(e=>e instanceof HTMLElement)}var a=`open`;function o(e){if(!t.l())throw Error(`Shadow DOM is not supported in this environment`);return e.attachShadow({mode:a})}function s(){return new Promise((e,n)=>{if(!t.r()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>e(),{once:!0}):e()})}function c(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var l=`picked-root`,u=`picked-target`,d=`picked-root`;function f(e,t){return[...e,{selector:`${d}[experience-id="${t}"]`,placement:`replace`}].flatMap(e=>{let n=i(e.selector).filter(e=>!h(e,t)&&!g(e,t));return{...e,elements:n}})}function p(e,t,n){return e.flatMap(e=>e.elements.map(r=>v(r,e.placement,t,n)))}function m(e,t){e.classList.add(u),e.classList.add(`${u}-${t}`)}function h(e,t){return t?e.classList.contains(`${u}-${t}`):e.classList.contains(`${u}`)}function g(e,t){return t?e.classList.contains(`${l}-${t}`):e.classList.contains(l)}function _(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(l),n.classList.add(`${l}-${e}`),n.classList.add(`${l}-${t}`),n}function v(e,t,n,r){let i,a=_(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}function y(e){return e.type===`condition`}function b(e){return e.type===`step`}function x(e){return e.type===`experience`}function S(e){return e.type===`origin`}function C(e){return e.type===`action`}var w=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),b(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?w(e,t,r,!1,i):[]})),T=(e,t,n)=>w(e,t,n,!0,new Set),E=(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]=E(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]},D=(e,t,n)=>E(e,t,n,!0,new Set),O=(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]=O(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]},k=(e,t,n)=>O(e,t,n,new Set),A=e=>e.find(e=>e.type===`origin`)||null,j=(e,t,n)=>{if(!e)return A(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function M(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)}var N=(0,n.createDomain)(`experience-instance`),P=(0,r.createFactory)(({client:t,experience:r,target:i,options:a})=>{let s=(0,n.createEvent)(),c=(0,n.createEvent)(),l=(0,n.createEvent)(),u=(0,n.createEvent)(),d=(0,n.createEvent)(),f=(0,n.createEvent)(),p=r.componentStore,m=N.store(`transitioning`),h=t.history.entriesStore.map(e=>e.filter(e=>e.experienceId===r.id)),g=h.map(e=>e.filter(e=>b(e.node))),_=h.map(e=>e.at(-1)?.node||null),v=(0,n.combine)(t.steps.listStore,_,(e,t)=>e.find(e=>t&&b(t)&&e.id===t.stepId)||null),w=(0,n.combine)(t.steps.listStore,g,(e,t)=>{let n=t.at(-2);if(!n||!b(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),E=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?T(e,t,n):[]),O=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?k(e,t,n):[-1,-1]),P=(0,n.combine)(r.treeStore,_,({nodes:e,edges:t},n)=>n?D(e,t,n):[-1,-1]),F=N.store(!1),I=(0,n.createApi)(F,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),L=(0,n.createEffect)(async()=>{t.history.back({experienceId:r.id})}),R=(0,n.attach)({source:r.treeStore,effect:async(e,n)=>{let i=e.nodes.find(e=>b(e)&&e.stepId===n);i&&t.history.push({experienceId:r.id,node:i})}}),z=(0,n.attach)({source:_,effect:e=>{}}),B=(0,n.attach)({source:r.treeStore,effect:async({nodes:e})=>A(e)}),V=(0,n.attach)({source:r.treeStore,effect:async({nodes:e,edges:t},n)=>{if(S(n))return j(n,e,t)}}),H=(0,n.attach)({source:r.treeStore,effect:async({nodes:n,edges:r,conditions:i},a)=>{if(!y(a))return;let o=i.find(e=>e.id===a.conditionId)?.logic;return o?M(!!await e.t(t,o),a.id,n,r):void 0}}),U=(0,n.attach)({source:{tree:r.treeStore,actions:t.actions.listStore,snapshot:t.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(!s){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}if(typeof s!=`function`){`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);return e?i.find(t=>t.id===e.destinationNodeId):null}try{`${o}`,await s({...n,args:[]},{experience:X});let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`true`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}catch{`${o}`;let e=a.find(e=>e.sourceNodeId===r.id&&e.sourceHandle===`false`);if(!e)return`${r.id}`,null;let t=i.find(t=>t.id===e.destinationNodeId);return`${o}${t?.id}`,t||null}}}),W=(0,n.createEffect)(e=>{x(e)&&t.experiences.launch({key:e.experienceKey})}),G=(0,n.attach)({source:[_,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),K=(0,n.attach)({source:[_,r.treeStore],effect:async([e,{nodes:t,edges:n}])=>j(e,t,n)}),q=(0,n.createEffect)(e=>{t.history.push({experienceId:r.id,node:e})}),J=(0,n.attach)({source:r.configStore,effect:async({initializeOpenLogic:n})=>a?.initialiseOpen===void 0?e.n(n)?!!await e.t(t,n):n??!1:a.initialiseOpen}),Y=(0,n.combine)(p,t.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}),X,Z=(0,n.attach)({source:Y,effect:e=>{if(!e)return;if(!i){`${r.id}`;return}let n=o(i);try{e.framework.render(n,e.component.component,t,X)}catch{}}});X=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:r.key,experienceId:r.id,experienceName:r.name,configStore:r.configStore,target:i,componentStore:p,componentAndFrameworkStore:Y,stateStore:m,isOpenStore:F,open:I.open,close:I.close,toggleOpen:I.toggle,setOpen:I.set,treeStore:r.treeStore,currentNodeStore:_,currentStepStore:v,previousStepStore:w,nextReachableStepNodesStore:E,stepsToOriginStore:O,stepsToLeafStore:P,goToNextStep:c,goToPreviousStep:l,goToStepById:u,stepsHistoryStore:g,mountFx:Z});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:_,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:B}),(0,n.sample)({clock:Q,filter:e=>e!==null,target:$}),(0,n.split)({source:$,match:e=>y(e)?`condition`:b(e)?`step`:x(e)?`launchExperience`:S(e)?`origin`:C(e)?`action`:`other`,cases:{origin:V,condition:H,step:z,launchExperience:W,action:U,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[H.doneData,V.doneData,B.doneData,K.doneData,G.doneData,U.doneData],filter:Boolean,target:q}),(0,n.sample)({clock:c,target:K}),(0,n.sample)({clock:c,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:X}))}),(0,n.sample)({clock:K.done,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:X}))}),(0,n.sample)({clock:K.fail,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:X}))}),(0,n.sample)({clock:l,target:L}),(0,n.sample)({clock:u,target:R}),(0,n.sample)({source:(0,n.combine)([H.pending,V.pending,B.pending,K.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:m}),(0,n.sample)({clock:z.doneData,source:v,filter:Boolean,target:t.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:X}))}),(0,n.sample)({clock:f,target:J}),(0,n.sample)({source:J.doneData,fn:Boolean,target:F}),(0,n.sample)({source:_,clock:s,filter:e=>e?S(e):!0,target:G}),(0,n.sample)({source:F,filter:Boolean,target:s}),(0,n.sample)({source:F,filter:Boolean,target:t.eventBus.prepend(()=>({type:`experience_open`,experience:X}))}),(0,n.sample)({source:F,filter:e=>!e,target:t.eventBus.prepend(()=>({type:`experience_close`,experience:X}))}),(0,n.sample)({clock:d,target:[f]}),d(),X});function F(e){return(0,r.invoke)(P,e)}var I=(0,r.createFactory)(({client:e})=>{let t=N.store({}),r=(0,n.createEvent)(),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createApi)(t,{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??[]}}}),s=(0,n.createEffect)(({experience:t,target:n,options:r})=>F({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{o.register(e)}),u=(0,n.createEffect)(e=>{e.target&&c(e.target,()=>{a(e)})}),d=(0,n.createEffect)(e=>{o.unregister(e)}),f=(0,n.createEffect)(async e=>{await e.mountFx()});(0,n.sample)({clock:r,target:s}),(0,n.sample)({clock:a,target:d}),(0,n.sample)({clock:s.doneData,target:[l,u,i]}),(0,n.sample)({clock:s.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:i,target:f});function p(e,t,n){r({experience:e,target:t,options:n})}let m=t.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 t.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:p,getByExperienceKey:h,getByExperienceId:g,listStore:m}});function L(e){return(0,r.invoke)(I,e)}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return F}});
|