@picked/client 0.0.1-dev.1783642866820 → 0.0.1-dev.1784003142683
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-4pMvd_kR.js → api-CsddE4DI.js} +1 -1
- package/dist/{api-BXhgvSc-.cjs → api-U2LgcKqF.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 +6 -6
- package/dist/docs/sdk/actions.md +17 -5
- package/dist/{dom-BwmTHeT7.js → dom-CZyRgp2P.js} +17 -12
- package/dist/dom-CdxDV3e-.cjs +1 -0
- package/dist/esm/index.js +491 -383
- 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-BWL-yghq.cjs +1 -0
- package/dist/{experience-instance-pTMwxW1R.js → experience-instance-QSrdjfn6.js} +254 -233
- package/dist/{plugin-DDe5zJhy.cjs → plugin-CWvFEvt5.cjs} +1 -1
- package/dist/{plugin-DfzEBtiA.js → plugin-CnCP2N-8.js} +1 -1
- package/dist/types/entities/action/action.d.ts +8 -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 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts +43 -12
- 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/lifecycle/condition-selection.d.ts.map +1 -1
- package/dist/types/picked.d.ts +14 -10
- 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/dist/types/utils/node-tree/get-next-node-from-action.d.ts +2 -2
- package/package.json +2 -2
- package/dist/dom-CDrHc_j9.cjs +0 -1
- package/dist/experience-instance-DunhI3b8.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
require("./logger-CSTvAyyB.cjs");const e=require("./api-
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./api-U2LgcKqF.cjs");let t=require("effector");function n(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function r(e){return n(e)%100}function i(e,t){return t<=0?!1:t>=100?!0:e<t}function a(e){return typeof e==`object`&&!!e&&`features`in e&&Array.isArray(e.features)}function o(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function s(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function c(e,t){if(Array.isArray(t.fields))for(let n of t.fields)e.registerField(n)}function l(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function u(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)s(e,n)}function d(e,t,n){m(e,t,n.isPreview,n.sessionId),o(e,t),c(e,t),l(e,t),u(e,t)}function f(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function p(e){let t=new Set,n=e.searchParams.feature;if(!n)return t;for(let e of n){let n=e.indexOf(`:`);n>0&&t.add(e.substring(0,n))}return t}function m(e,t,n,i){let a=p(e),o=r(i);for(let r of t.features)a.has(r.id)||h(e,r,n,o)}function h(e,t,n,r){e.registerFeature(t.id,{key:`v${t.version}`,name:t.name,storage:n?`session`:`local`,decide:()=>t.enabled?i(r,t.weight):!1})}function g(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function _(e){if(typeof e!=`object`||!e||!(`cause`in e))return!1;let{cause:t}=e;return typeof t!=`object`||!t||!(`code`in t)?!1:t.code===`ECONNREFUSED`}async function v(t,n,r){let i=r?.previewToken?`projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}`:`projects/${n}`,o;try{o=await e.t(t,i,r?.headers)}catch(e){return g(t)&&_(e),null}if(!o.ok)return`${o.status.toString()}`,null;let s;try{s=await o.json()}catch{return null}return a(s)?s:null}function y(e){return typeof e!=`object`||!e||!(`experienceId`in e)||!(`content`in e)?!1:Array.isArray(e.content)}async function b(t,n,r,i){let a=i?.previewToken?`projects/${n}/experiences/${r}/content?preview_token=${encodeURIComponent(i.previewToken)}`:`projects/${n}/experiences/${r}/content`,o;try{o=await e.t(t,a,i?.headers,i?.signal)}catch(e){return g(t)&&_(e)||`${r}`,null}if(!o.ok)return`${r}${o.status.toString()}`,null;let s;try{s=await o.json()}catch{return`${r}`,null}return y(s)?s:(`${r}`,null)}function x(e,t){for(let n of t.content)e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function S(e){if(typeof e!=`object`||!e||!(`projectConfig`in e)||!(`experienceContent`in e)||!(`manifestMetadata`in e))return!1;let{experienceContent:t}=e;return typeof t==`function`}async function C(){try{let e=await import(`virtual:picked/data`);return S(e)?e:null}catch{return null}}function w(e,t,n){return r=>b(e,t,r.id,n?{previewToken:n}:void 0)}function T(e,t){return n=>e(n,t?{previewToken:t}:void 0)}function E(e){return(t,n)=>e.experienceContent(t,n)}function D(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&x(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function O(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}async function k(e){let{client:t,apiUrl:n,options:r}=e,i=f(t),a=!!i,o=r?.projectConfig??null,s=r?.getContent?T(r.getContent,i):null,c=null;if(i)return o??=await v(n,t.projectId,{previewToken:i}),s??=w(n,t.projectId,i),{config:o,contentLoader:s,dataSource:c,isPreview:a};if(o&&s)return{config:o,contentLoader:s,dataSource:c,isPreview:a};let l=await C();return l?(o??=l.projectConfig,s??=E(l),c=l.manifestMetadata,{config:o,contentLoader:s,dataSource:c,isPreview:a}):(o??=await v(n,t.projectId),s??=w(n,t.projectId),{config:o,contentLoader:s,dataSource:c,isPreview:a})}function A(e){return{name:`dynamic-experiences`,setup:n=>{let r=e?.apiUrl??n.apiUrl;return{onStart:(0,t.attach)({source:n.session.store.map(e=>e.id),effect:async t=>{let{config:i,contentLoader:a,dataSource:o,isPreview:s}=await k({client:n,apiUrl:r,options:e});a&&(n.contentLoader=D(n,O(a,i))),n.dataSource=o,i&&d(n,i,{isPreview:s,sessionId:t})}})}}}}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return A}});
|
|
@@ -21,18 +21,19 @@ export interface ActionContext {
|
|
|
21
21
|
* only and have no triggering instance.
|
|
22
22
|
*
|
|
23
23
|
* Re-entrancy: do not synchronously call navigation events (`goToNextStep`,
|
|
24
|
-
* `goToPreviousStep`, `goToStepById
|
|
24
|
+
* `goToPreviousStep`, `goToStepById`) or open-state events (`open`, `close`,
|
|
25
25
|
* `toggleOpen`, `setOpen`) on `context.experience` before the handler's returned
|
|
26
26
|
* promise resolves. Those writes race the flow runtime's post-action history
|
|
27
27
|
* push and produce non-deterministic ordering. Perform control flow after your
|
|
28
28
|
* side effect resolves.
|
|
29
29
|
*
|
|
30
|
-
* When executed as an ActionNode,
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* action that
|
|
34
|
-
*
|
|
35
|
-
* the return value is used directly and this
|
|
30
|
+
* When executed as an ActionNode, only a thrown error (or rejected promise) routes to
|
|
31
|
+
* the `onFail` edge. Every resolved value — `void`, `true`, `false`, or a
|
|
32
|
+
* string/string[] — routes to `onSuccess`; a resolved `false` is a valid response, not
|
|
33
|
+
* a failure. An action that maps an API response to the failure branch must therefore
|
|
34
|
+
* throw on the failure case, e.g. `if (!response.ok) throw new Error(...)`. Outside a
|
|
35
|
+
* flow (manual invocation, rule logic) the return value is used directly and this
|
|
36
|
+
* branching does not apply.
|
|
36
37
|
*/
|
|
37
38
|
export type Action = (snapshot: StateSnapshot & {
|
|
38
39
|
args: unknown[];
|
|
@@ -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":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AC,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":"exper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
|
48
48
|
goToStepById: EventCallable<string>;
|
|
49
49
|
goToStepByKey: EventCallable<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Drops this instance's history entries so it re-walks from origin via the existing
|
|
52
|
+
* null→origin pipeline. Sibling instances of the same experience keep their own
|
|
53
|
+
* navigation; the derived snapshot map is re-persisted by the storage plugin.
|
|
54
|
+
*/
|
|
55
|
+
reset: EventCallable<void>;
|
|
50
56
|
stepsHistoryStore: Store<HistoryEntry[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Reactive flag: `true` once the user has progressed *past* the first step of this
|
|
59
|
+
* instance. Derived from `stepsHistoryStore` — `true` at ≥ 2 step entries (entry step +
|
|
60
|
+
* one progression); `false` at origin, on the first step, or for a single-step funnel
|
|
61
|
+
* (even when that step has a saved answer). Gate a "continue" affordance on it, not
|
|
62
|
+
* "has any saved state".
|
|
63
|
+
*/
|
|
64
|
+
isResumableStore: Store<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Atomically clears this instance's history entries (as `reset` does) plus the responses
|
|
67
|
+
* owned by the experience's step nodes, so the walk re-fires from origin with blank
|
|
68
|
+
* answers. Use `reset` to clear navigation only and keep responses. History is
|
|
69
|
+
* per-instance, but responses are shared by field key: sibling instances keep their
|
|
70
|
+
* position, and a field shared with another experience via a reused step is cleared for
|
|
71
|
+
* both.
|
|
72
|
+
*/
|
|
73
|
+
restart: EventCallable<void>;
|
|
51
74
|
/**
|
|
52
75
|
* Per-instance mount effect. Attached over `componentAndFrameworkStore` so the render call always receives the current resolved component+framework pair.
|
|
53
76
|
*/
|
|
@@ -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,EACV,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;
|
|
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,EACV,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;AAmB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,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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AA;IAChC;;;;;;;OAOG;IACH,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;CACnC;AAED,MAAM,MAAM,uBAAuB,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,uBA4iBF,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,56 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* Payload carried by `push`/`replace` — a node plus its experience. `instanceId` is optional:
|
|
9
|
+
* pre-instance callers omit it and it defaults to `experienceId`, preserving the old
|
|
10
|
+
* per-experience behaviour.
|
|
11
|
+
*/
|
|
12
|
+
export interface InstanceNodeIntent {
|
|
13
|
+
instanceId?: string;
|
|
14
|
+
experienceId: string;
|
|
15
|
+
node: ExperienceNode;
|
|
16
|
+
}
|
|
17
|
+
/** One recorded navigation step: the node an instance visited, with a unique id and `Date.now()` timestamp. */
|
|
18
|
+
export interface HistoryEntry extends InstanceScope {
|
|
3
19
|
id: string;
|
|
4
20
|
node: ExperienceNode;
|
|
5
21
|
at: number;
|
|
6
|
-
experienceId: string;
|
|
7
22
|
}
|
|
23
|
+
/** A `HistoryEntry` whose `instanceId` may be omitted — accepted by the backward-compatible `restore` event, which defaults it to the `experienceId`. */
|
|
24
|
+
type RestorableEntry = Omit<HistoryEntry, 'instanceId'> & {
|
|
25
|
+
instanceId?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Creates a fresh history instance: an Effector-backed list of navigation
|
|
29
|
+
* entries plus the events that drive it. Live entries are filtered per
|
|
30
|
+
* instance via `instanceId`; the derived `snapshotStore` groups by
|
|
31
|
+
* `experienceId` and is used by the storage plugin to resume across respawn.
|
|
32
|
+
*
|
|
33
|
+
* @returns {ReturnType<typeof invoke<typeof createHistoryFactory>>} The events and stores.
|
|
34
|
+
* @example
|
|
35
|
+
* const history = createHistory()
|
|
36
|
+
*/
|
|
8
37
|
export declare function createHistory(): {
|
|
9
|
-
push: import('effector').EventCallable<
|
|
10
|
-
|
|
11
|
-
node: ExperienceNode;
|
|
12
|
-
}>;
|
|
13
|
-
replace: import('effector').EventCallable<{
|
|
14
|
-
experienceId: string;
|
|
15
|
-
node: ExperienceNode;
|
|
16
|
-
}>;
|
|
38
|
+
push: import('effector').EventCallable<InstanceNodeIntent>;
|
|
39
|
+
replace: import('effector').EventCallable<InstanceNodeIntent>;
|
|
17
40
|
back: import('effector').EventCallable<{
|
|
41
|
+
instanceId?: string;
|
|
18
42
|
experienceId?: string;
|
|
19
43
|
}>;
|
|
20
44
|
restore: import('effector').EventCallable<{
|
|
21
|
-
entries:
|
|
45
|
+
entries: RestorableEntry[];
|
|
46
|
+
}>;
|
|
47
|
+
restoreSnapshots: import('effector').EventCallable<{
|
|
48
|
+
snapshots: Record<string, HistoryEntry[]>;
|
|
22
49
|
}>;
|
|
23
|
-
|
|
50
|
+
seedInstanceFromSnapshot: import('effector').EventCallable<InstanceScope>;
|
|
51
|
+
clearForInstance: import('effector').EventCallable<Pick<InstanceScope, "instanceId">>;
|
|
52
|
+
entriesStore: import('effector').StoreWritable<HistoryEntry[]>;
|
|
53
|
+
snapshotStore: import('effector').Store<Record<string, HistoryEntry[]>>;
|
|
24
54
|
};
|
|
55
|
+
export {};
|
|
25
56
|
//# 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;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,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;AAED,yJAAyJ;AACzJ,KAAK,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AA4MjF;;;;;;;;;GASG;AACH,wBAAgB,aAAa;;;;qBArKqB,MAAM;uBAAiB,MAAM;;;iBAC9B,eAAe,EAAE;;;mBAEnD,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;;;;;;EAoK5C"}
|
|
@@ -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;AAEpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGvD,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAA;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAA;AAGjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;CA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;
|
|
60
60
|
readonly searchParams: import('.').PickedSearchParams;
|
|
61
61
|
readonly history: {
|
|
62
|
-
push: EventCallable<
|
|
63
|
-
|
|
64
|
-
node: import('.').ExperienceNode;
|
|
65
|
-
}>;
|
|
66
|
-
replace: EventCallable<{
|
|
67
|
-
experienceId: string;
|
|
68
|
-
node: import('.').ExperienceNode;
|
|
69
|
-
}>;
|
|
62
|
+
push: EventCallable<import('.').InstanceNodeIntent>;
|
|
63
|
+
replace: EventCallable<import('.').InstanceNodeIntent>;
|
|
70
64
|
back: EventCallable<{
|
|
65
|
+
instanceId?: string;
|
|
71
66
|
experienceId?: string;
|
|
72
67
|
}>;
|
|
73
68
|
restore: EventCallable<{
|
|
74
|
-
entries: import('.').HistoryEntry
|
|
69
|
+
entries: (Omit<import('.').HistoryEntry, "instanceId"> & {
|
|
70
|
+
instanceId?: string;
|
|
71
|
+
})[];
|
|
72
|
+
}>;
|
|
73
|
+
restoreSnapshots: EventCallable<{
|
|
74
|
+
snapshots: Record<string, import('.').HistoryEntry[]>;
|
|
75
75
|
}>;
|
|
76
|
-
|
|
76
|
+
seedInstanceFromSnapshot: EventCallable<import('.').InstanceScope>;
|
|
77
|
+
clearForInstance: EventCallable<Pick<import('.').InstanceScope, "instanceId">>;
|
|
78
|
+
entriesStore: StoreWritable<import('.').HistoryEntry[]>;
|
|
79
|
+
snapshotStore: Store<Record<string, import('.').HistoryEntry[]>>;
|
|
77
80
|
};
|
|
78
81
|
readonly components: {
|
|
79
82
|
register: EventCallable<{
|
|
@@ -172,6 +175,7 @@ export declare class Picked {
|
|
|
172
175
|
};
|
|
173
176
|
clearAll: EventCallable<void>;
|
|
174
177
|
clear: EventCallable<string>;
|
|
178
|
+
clearByExperience: (experienceId: string) => void;
|
|
175
179
|
commit: (responsesToCommit: import('.').CommitResponses) => Promise<{
|
|
176
180
|
errors: import('.').ValidationError[];
|
|
177
181
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts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EY: 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,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;
|
|
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;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAQ7D;AAID;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAMhE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAa9C;AAED;;;;;;;;;GASG;AACH,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;;;;;;;;;;;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"}
|
|
@@ -16,8 +16,8 @@ import { ExperienceEdge, ExperienceNode } from '../../entities/experience/experi
|
|
|
16
16
|
* has neither an edge for the outcome nor a plain edge (a genuine terminal).
|
|
17
17
|
* @example
|
|
18
18
|
* ```typescript
|
|
19
|
-
* //
|
|
20
|
-
* const nextNode = getNextNodeFromAction(
|
|
19
|
+
* // `success` is false only when the action threw; that routes to the onFail edge.
|
|
20
|
+
* const nextNode = getNextNodeFromAction(succeeded, 'action-1', nodes, edges)
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
export declare function getNextNodeFromAction(success: boolean, actionNodeId: string, nodes: ExperienceNode[], edges: ExperienceEdge[]): ExperienceNode | undefined;
|
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.1784003142683",
|
|
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}});
|