@picked/client 0.0.39-next.1 → 0.0.39-next.3
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/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +551 -470
- package/dist/esm/plugins/create-experience/index.js +91 -82
- package/dist/esm/plugins/experience-browser-storage/index.js +12 -13
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-D0bQ9DzM.js +815 -0
- package/dist/experience-instance-D8RtqKEZ.cjs +1 -0
- package/dist/types/entities/experience-instance/experience-instance.d.ts +30 -118
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +31 -55
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts +9 -5
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/picked.d.ts +6 -79
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +28 -5
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +10 -10
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-CKiUCMCP.js +0 -815
- package/dist/experience-instance-yl7BWjFA.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("effector"),W=require("@withease/factories"),j=require("./supports-YvpQZxbh.cjs"),x=require("./logger-BsmHUUw1.cjs"),Ee=require("./object-BbFTsGh3.cjs");function xe(e){return typeof e=="number"&&!isNaN(e)}function P(e){return typeof e=="string"}function E(e){return Array.isArray(e)}function ae(e){return e instanceof Promise}function oe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(xe(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function L(e){return`${e}`}const Ne={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>m(e)>m(t),">=":(e,t)=>m(e)>=m(t),"<":(e,t,r)=>{const n=m(e),c=m(t);if(r===void 0)return n<c;const a=m(r);return n<c&&c<a},"<=":(e,t,r)=>{const n=m(e),c=m(t);if(r===void 0)return n<=c;const a=m(r);return n<=c&&c<=a},"!!":async e=>await b(e),"!":async e=>!await b(e),"%":(e,t)=>m(e)%m(t),log:e=>(console.log(e),e),in:(e,t)=>t?P(t)?t.indexOf(L(e))!==-1:E(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(L).join(""),substr:(e,t,r)=>{const n=L(e),c=m(t);if(r===void 0)return n.substr(c);const a=m(r);if(a<0){const o=n.substr(c);return o.substr(0,o.length+a)}return n.substr(c,a)},"+":(...e)=>e.reduce((t,r)=>m(t)+m(r),0),"*":(...e)=>e.reduce((t,r)=>m(t)*m(r),1),"-":(e,t)=>{const r=m(e);return t===void 0?-r:r-m(t)},"/":(e,t)=>m(e)/m(t),min:(...e)=>Math.min(...e.map(m)),max:(...e)=>Math.max(...e.map(m)),merge:(...e)=>e.reduce((t,r)=>E(r)?t.concat(r):t.concat([r]),[]),var(e,t){const r=arguments.length>1?t:null;if(e===""||e==="."||e===null||e===void 0)return this;if(typeof e=="number"&&Array.isArray(this))return e>=0&&e<this.length?this[e]:r;const n=L(e);if(n===""||n===".")return this;const c=n.split(".");let a=this;for(const o of c){if(a==null)return r;if(Array.isArray(a)){const u=parseInt(o,10);isNaN(u)?a=a[o]:a=a[u]}else a=a[o]}return a!==void 0?a:r},async missing(...e){const t=E(e[0])?e[0]:e,r=[];for(const n of t){const c=await g({var:n},this);(c===null||c==="")&&r.push(`${n}`)}return r},async missing_some(e,t){const r=await g({missing:t},this);if(!E(r)||!E(t))return[];const n=r.filter(P);return t.filter(P).length-n.length>=m(e)?[]:n},invoke(...e){const[t,...r]=e;return typeof t!="function"?null:Reflect.apply(t,null,r)},regexp_matches(e,t){let r=e,n="";if(E(e)){const[a,o]=e;r=a,n=o}return!P(r)||!P(n)?!1:new RegExp(r,n).test(L(t))},throw(e){throw new Error(L(e))}};async function g(e,t){if(!e)return e;if(ae(e))return g(await e,t);if(E(e))return Promise.all(e.map(o=>g(o,t)));if(!oe(e))return e;const r=Ie(e);let n=r?e[r]??[]:[];switch(E(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await b(await g(n[o],t)))return g(n[o+1],t);return n.length%2===1?g(n[n.length-1],t):null;case"and":{let o=null;for(const u of n)if(o=await g(u,t),!await b(o))return o;return o}case"or":{let o=null;for(const u of n)if(o=await g(u,t),await b(o))return o;return o}case"map":{const o=await g(n[0],t);return E(o)?await Promise.all(o.map(u=>g(n[1],u))):[]}case"filter":{const o=await g(n[0],t);return E(o)?(await Promise.all(o.map(async p=>{const S=await b(await g(n[1],p));return{item:p,shouldInclude:S}}))).filter(({shouldInclude:p})=>p).map(({item:p})=>p):[]}case"reduce":{const o=await g(n[0],t);if(!E(o))return n.length>2?await g(n[2],t):null;const u=n[1];let S=n.length>2?await g(n[2],t):null;for(const k of o)S=await g(u,{current:k,accumulator:S});return S}case"all":{const o=await g(n[0],t);if(!E(o)||o.length===0)return!1;for(const u of o)if(!await b(await g(n[1],u)))return!1;return!0}case"some":{const o=await g(n[0],t);if(!E(o))return!1;for(const u of o)if(await b(await g(n[1],u)))return!0;return!1}case"none":{const o=await g(n[0],t);if(!E(o))return!0;for(const u of o)if(await b(await g(n[1],u)))return!1;return!0}case"catch":try{return await g(n[0],t)}catch(o){return oe(o)?await g(o,t):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const c=await Promise.all(n.map(o=>g(o,t))),a=r?Ne[r]:void 0;if(!a)throw new Error(`Unrecognized operation ${r}`);return a.apply(t,c)}async function b(e){return ae(e)?b(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function Ie(e){return Object.keys(e)[0]}function ue(e){return!Ee.isEmpty(e)}async function Q(e,t,r){const n=e.getStateSnapshot(),c=e.predicates.listStore.getState().reduce((u,p)=>({...u,[p.name]:(...S)=>p.predicate({...n,args:S})}),{}),a=e.features.listStore.getState().reduce((u,p)=>({...u,[p.id]:async()=>{const{bucket:S}=await p.getBucket();return S}}),{}),o={...r,responses:e.responses.getAllStore.getState(),location:typeof n.location=="object"?{hash:n.location.hash,host:n.location.host,hostname:n.location.hostname,href:n.location.href,origin:n.location.origin,pathname:n.location.pathname,port:n.location.port,protocol:n.location.protocol,search:n.location.search}:void 0,predicates:c,features:a};return await g(t,o)}function ke(e){return!j.supportsWindow()||!j.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}const ve="open";function be(e){if(!j.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:ve})}function Ae(){return new Promise((e,t)=>{if(!j.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function Oe(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const q="picked-root",U="picked-target",Fe="picked-root";function Be(e,t){return[...e,{selector:`${Fe}[experience-id="${t}"]`,placement:"replace"}].flatMap(n=>{const c=ke(n.selector).filter(a=>!Te(a,t)&&!fe(a,t));return{...n,elements:c}})}function _e(e,t){return e.flatMap(r=>r.elements.map(n=>Le(n,r.placement,t)))}function $e(e,t){e.classList.add(U),e.classList.add(`${U}-${t}`)}function Te(e,t){return t?e.classList.contains(`${U}-${t}`):e.classList.contains(`${U}`)}function fe(e,t){return t?e.classList.contains(`${q}-${t}`):e.classList.contains(q)}function Me(e){const t=document.createElement("div");return t.style.display="block",t.classList.add(q),t.classList.add(`${q}-${e}`),t}function Le(e,t,r){let n;const c=Me(r);if(e instanceof Document)n=e.body.appendChild(c);else{switch(t){case"replace":e.replaceWith(c);break;case"before":e.before(c);break;case"after":e.after(c);break;case"prepend":e.prepend(c);break;default:e.append(c);break}n=c}return n}function se(e){return e.type==="conditional"}function $(e){return e.type==="step"}function ie(e){return e.type==="experience"}function X(e){return e.type==="origin"}function ce(e){return e.type==="action"}const le=(e,t,r,n,c=new Set)=>c.has(r.id)?[]:(c.add(r.id),$(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=e.find(p=>p.id===o.destinationNodeId);return u?le(e,t,u,!1,c):[]})),De=(e,t,r)=>le(e,t,r,!0,new Set),de=(e,t,r,n,c=new Set)=>{if(c.has(r.id))return[-1,-1];c.add(r.id);const a=t.filter(p=>p.sourceNodeId===r.id);if(a.length===0)return[0,0];let o=1/0,u=-1/0;for(const p of a){const S=e.find(T=>T.id===p.destinationNodeId);if(!S)continue;const[k,O]=de(e,t,S,!1,new Set(c));k!==-1&&(o=Math.min(o,k+1),u=Math.max(u,O+1))}return o===1/0?[-1,-1]:[o,u]},Re=(e,t,r)=>de(e,t,r,!0,new Set),pe=(e,t,r,n=new Set)=>{if(n.has(r.id))return[-1,-1];if(n.add(r.id),r.type==="origin")return[0,0];const c=t.filter(u=>u.destinationNodeId===r.id);if(c.length===0)return[-1,-1];let a=1/0,o=-1/0;for(const u of c){const p=e.find(O=>O.id===u.sourceNodeId);if(!p)continue;const[S,k]=pe(e,t,p,new Set(n));S!==-1&&(a=Math.min(a,S+1),o=Math.max(o,k+1))}return a===1/0?[-1,-1]:[a,o]},Pe=(e,t,r)=>pe(e,t,r,new Set),ge=e=>e.find(r=>r.type==="origin")||null,J=(e,t,r)=>{if(!e)return ge(t);const n=r.find(a=>a.sourceNodeId===e.id);if(!n)return null;const c=t.find(a=>a.id===n.destinationNodeId);return c||null};async function He(e,t,r,n){const c=e?"true":"false",a=n.find(o=>o.sourceNodeHandle===c&&o.sourceNodeId===t);return r.find(o=>o.id===a?.destinationNodeId)}const Y=i.createDomain("experience-instance"),Ce=W.createFactory(({client:e,experience:t,target:r})=>{const n=i.createEvent(),c=i.createEvent(),a=i.createEvent(),o=i.createEvent(),u=i.createEvent(),p=i.createEvent(),S=t.componentStore,k=Y.store("transitioning"),O=e.history.entriesStore.map(s=>s.filter(d=>d.experienceId===t.id)),T=O.map(s=>s.filter(d=>$(d.node))),N=O.map(s=>s.at(-1)?.node||null),l=i.combine(t.treeStore,N,({steps:s},d)=>s.find(f=>d&&$(d)&&f.id===d.stepId)||null),h=i.combine(t.treeStore,T,({steps:s},d)=>{const f=d.at(-2);if(!f||!$(f.node))return null;const y=f.node;return s.find(B=>B.id===y.stepId)||null}),v=i.combine(t.treeStore,N,({nodes:s,edges:d},f)=>f?De(s,d,f):[]),M=i.combine(t.treeStore,N,({nodes:s,edges:d},f)=>f?Pe(s,d,f):[-1,-1]),D=i.combine(t.treeStore,N,({nodes:s,edges:d},f)=>f?Re(s,d,f):[-1,-1]),F=Y.store(!1),H=i.createApi(F,{open:()=>!0,close:()=>!1,toggle:s=>!s,set:(s,d)=>d}),Se=i.createEffect(async()=>{e.history.back({experienceId:t.id})}),he=i.attach({source:t.treeStore,effect:async(s,d)=>{const f=s.nodes.find(y=>$(y)&&y.stepId===d);f&&e.history.push({experienceId:t.id,node:f})}}),Z=i.attach({source:N,effect:s=>{}}),G=i.attach({source:t.treeStore,effect:async({nodes:s})=>ge(s)}),K=i.attach({source:t.treeStore,effect:async({nodes:s,edges:d},f)=>{if(X(f))return J(f,s,d)}}),V=i.attach({source:t.treeStore,effect:async({nodes:s,edges:d,conditionals:f},y)=>{if(!se(y))return;const B=f.find(A=>A.id===y.conditionalId);if(!B)return;const I=y.id,w=await Q(e,B.condition);return He(!!w,I,s,d)}}),ee=i.attach({source:t.treeStore,effect:async({nodes:s,edges:d},f)=>{if(!ce(f))return;const y=f.action;if(!y){x.logger("warn",`Action node ${f.id} has no action name`);return}const B=e.actions.getByName(y).getState();if(!B){x.logger("warn",`Action '${y}' not registered on client`);const I=d.find(w=>w.sourceNodeId===f.id&&w.sourceNodeHandle==="false");return I?s.find(w=>w.id===I.destinationNodeId):null}if(typeof B.action!="function"){x.logger("warn",`Action '${y}' is not a function`);const I=d.find(w=>w.sourceNodeId===f.id&&w.sourceNodeHandle==="false");return I?s.find(w=>w.id===I.destinationNodeId):null}try{x.logger("info",`Executing action: ${y}`),await B.action(y);const I=d.find(A=>A.sourceNodeId===f.id&&A.sourceNodeHandle==="true");if(!I)return x.logger("warn",`No 'true' edge found for action node ${f.id}`),null;const w=s.find(A=>A.id===I.destinationNodeId);return x.logger("info",`Action '${y}' succeeded, moving to node ${w?.id}`),w||null}catch(I){x.logger("warn",`Action '${y}' failed:`,I);const w=d.find(C=>C.sourceNodeId===f.id&&C.sourceNodeHandle==="false");if(!w)return x.logger("warn",`No 'false' edge found for action node ${f.id}`),null;const A=s.find(C=>C.id===w.destinationNodeId);return x.logger("info",`Action '${y}' failed, moving to node ${A?.id}`),A||null}}}),ye=i.createEffect(s=>{if(ie(s))return e.launchExperienceById(s.experienceId)}),te=i.attach({source:[N,t.treeStore],effect:async([s,{nodes:d,edges:f}])=>J(s,d,f)}),R=i.attach({source:[N,t.treeStore],effect:async([s,{nodes:d,edges:f}])=>J(s,d,f)}),we=i.createEffect(s=>{e.history.push({experienceId:t.id,node:s})}),ne=i.attach({source:t.configStore,effect:async({initializeOpenLogic:s})=>ue(s)?!!await Q(e,s):s??!1}),_=Object.freeze({id:Math.random().toString(36).substring(7),experienceId:t.id,configStore:t.configStore,target:r,componentStore:S,stateStore:k,isOpenStore:F,open:H.open,close:H.close,toggleOpen:H.toggle,setOpen:H.set,treeStore:t.treeStore,fieldsStore:t.fieldsStore,currentNodeStore:N,currentStepStore:l,previousStepStore:h,nextReachableStepNodesStore:v,stepsToOriginStore:M,stepsToLeafStore:D,goToNextStep:c,goToPreviousStep:a,goToStepById:o,stepsHistoryStore:T}),z=i.createEvent(),re=i.createEvent();return i.sample({source:N,target:z}),i.sample({clock:z,filter:s=>s===null,target:G}),i.sample({clock:z,filter:s=>s!==null,target:re}),i.split({source:re,match:s=>se(s)?"condition":$(s)?"step":ie(s)?"launchExperience":X(s)?"origin":ce(s)?"action":"other",cases:{origin:K,condition:V,step:Z,launchExperience:ye,action:ee,__:i.createEvent()}}),i.sample({clock:[V.doneData,K.doneData,G.doneData,R.doneData,te.doneData,ee.doneData],filter:Boolean,target:we}),i.sample({clock:c,target:R}),i.sample({clock:c,source:l,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit",step:s,experience:_}))}),i.sample({clock:R.done,source:l,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_success",step:s,experience:_}))}),i.sample({clock:R.fail,source:l,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_error",step:s,experience:_}))}),i.sample({clock:a,target:Se}),i.sample({clock:o,target:he}),i.sample({source:i.combine([V.pending,K.pending,G.pending,R.pending]),fn:s=>s.some(Boolean)?"transitioning":"ready",target:k}),i.sample({clock:Z.doneData,source:l,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_enter",step:s,experience:_}))}),i.sample({clock:p,target:ne}),i.sample({source:ne.doneData,fn:Boolean,target:F}),i.sample({source:N,clock:n,filter:s=>s?X(s):!0,target:te}),i.sample({source:F,filter:Boolean,target:n}),i.sample({source:F,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:_}))}),i.sample({source:F,filter:s=>!s,target:e.eventBus.prepend(()=>({type:"experience_close",experience:_}))}),i.sample({clock:u,target:[p]}),u(),_});function me(e){return W.invoke(Ce,e)}const je=W.createFactory(({client:e})=>{const t=Y.store({}),r=i.createEvent(),n=i.createEvent(),c=i.createEvent(),a=i.createApi(t,{register(l,h){const v=[...l[h.experienceId]??[]];return v.push(h),{...l,[h.experienceId]:v}},unregister(l,h){const v=h.experienceId,M=l[v]?.filter(D=>D!==h);return{...l,[v]:M??[]}}}),o=i.createEffect(({experience:l,target:h})=>me({client:e,experience:l,target:h})),u=i.createEffect(l=>{a.register(l)}),p=i.createEffect(l=>{l.target&&Oe(l.target,()=>{c(l)})}),S=i.createEffect(l=>{a.unregister(l)}),k=i.createEffect(l=>{const h=l.componentStore.getState();if(!h){x.logger("warn","No app component registered. Skipping init.");return}const v=h.frameworkStore.getState();if(!v){x.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const M=l.target;if(!M){x.logger("error",`No target element registered for experience '${l.experienceId}'. Skipping rendering.`);return}const D=be(M);try{v.render(D,h.component,e,l)}catch(F){x.logger("error",F)}});i.sample({clock:r,target:o}),i.sample({clock:c,target:S}),i.sample({clock:o.doneData,target:[u,p,n]}),i.sample({clock:o.doneData,target:e.eventBus.prepend(l=>({type:"experience_initialize",experience:l}))}),i.sample({clock:n,target:k});function O(l,h){r({experience:l,target:h})}const T=t.map(l=>Object.values(l).flat());function N(l){return t.map(h=>h[l]||[],{skipVoid:!1})}return{spawn:O,getByExperienceId:N,listStore:T}});function qe(e){return W.invoke(je,e)}exports.createAppHosts=_e;exports.createExperienceInstance=me;exports.createExperienceInstanceIndex=qe;exports.domInteractive=Ae;exports.evaluateRuleLogic=Q;exports.getTargetElements=Be;exports.isPickedRoot=fe;exports.isRulesLogic=ue;exports.isStepNode=$;exports.tagTargetElement=$e;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
+
import { EventCallable, Store } from 'effector';
|
|
1
2
|
import { Experience, ExperienceNode, ExperienceStep, ExperienceStore, ExperienceTarget } from '../experience/experience';
|
|
2
3
|
import { Picked } from '../../picked';
|
|
3
|
-
|
|
4
|
+
import { HistoryEntry } from '../history/history';
|
|
5
|
+
export interface ExperienceInstance {
|
|
6
|
+
id: string;
|
|
7
|
+
experienceId: Experience['id'];
|
|
8
|
+
configStore: ExperienceStore['configStore'];
|
|
9
|
+
target: HTMLElement | undefined;
|
|
10
|
+
componentStore: ExperienceStore['componentStore'];
|
|
11
|
+
stateStore: Store<'transitioning' | 'ready'>;
|
|
12
|
+
isOpenStore: Store<boolean>;
|
|
13
|
+
open: EventCallable<void>;
|
|
14
|
+
close: EventCallable<void>;
|
|
15
|
+
toggleOpen: EventCallable<void>;
|
|
16
|
+
setOpen: EventCallable<boolean>;
|
|
17
|
+
treeStore: ExperienceStore['treeStore'];
|
|
18
|
+
fieldsStore: ExperienceStore['fieldsStore'];
|
|
19
|
+
currentNodeStore: Store<ExperienceNode | null>;
|
|
20
|
+
currentStepStore: Store<ExperienceStep | null>;
|
|
21
|
+
previousStepStore: Store<ExperienceStep | null>;
|
|
22
|
+
nextReachableStepNodesStore: Store<ExperienceNode[]>;
|
|
23
|
+
stepsToOriginStore: Store<number[]>;
|
|
24
|
+
stepsToLeafStore: Store<number[]>;
|
|
25
|
+
goToNextStep: EventCallable<void>;
|
|
26
|
+
goToPreviousStep: EventCallable<void>;
|
|
27
|
+
goToStepById: EventCallable<string>;
|
|
28
|
+
stepsHistoryStore: Store<HistoryEntry[]>;
|
|
29
|
+
}
|
|
4
30
|
export type ExperienceInstanceIndex = ReturnType<typeof createExperienceInstanceIndex>;
|
|
5
31
|
export interface ExperienceInstanceTarget {
|
|
6
32
|
selector: HTMLElement[];
|
|
@@ -10,128 +36,14 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, }:
|
|
|
10
36
|
client: Picked;
|
|
11
37
|
experience: ExperienceStore;
|
|
12
38
|
target?: HTMLElement;
|
|
13
|
-
}) =>
|
|
14
|
-
id: string;
|
|
15
|
-
experienceId: string;
|
|
16
|
-
configStore: import('effector').Store<{
|
|
17
|
-
name: string;
|
|
18
|
-
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
19
|
-
targetSelectors: ExperienceTarget[];
|
|
20
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
21
|
-
}>;
|
|
22
|
-
target: HTMLElement | undefined;
|
|
23
|
-
componentStore: import('effector').Store<{
|
|
24
|
-
name: string;
|
|
25
|
-
component: import('../..').AdaptedComponent<string, unknown>;
|
|
26
|
-
frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
|
|
27
|
-
} | undefined>;
|
|
28
|
-
stateStore: import('effector').StoreWritable<"transitioning" | "ready">;
|
|
29
|
-
isOpenStore: import('effector').StoreWritable<boolean>;
|
|
30
|
-
open: import('effector').EventCallable<void>;
|
|
31
|
-
close: import('effector').EventCallable<void>;
|
|
32
|
-
toggleOpen: import('effector').EventCallable<void>;
|
|
33
|
-
setOpen: import('effector').EventCallable<boolean>;
|
|
34
|
-
treeStore: import('effector').Store<{
|
|
35
|
-
steps: ExperienceStep[];
|
|
36
|
-
nodes: ExperienceNode[];
|
|
37
|
-
edges: import('../..').ExperienceEdge[];
|
|
38
|
-
conditionals: import('../..').ExperienceConditional[];
|
|
39
|
-
}>;
|
|
40
|
-
fieldsStore: import('effector').Store<import('../..').Field[]>;
|
|
41
|
-
currentNodeStore: import('effector').Store<ExperienceNode | null>;
|
|
42
|
-
currentStepStore: import('effector').Store<ExperienceStep | null>;
|
|
43
|
-
previousStepStore: import('effector').Store<ExperienceStep | null>;
|
|
44
|
-
nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
|
|
45
|
-
stepsToOriginStore: import('effector').Store<number[]>;
|
|
46
|
-
stepsToLeafStore: import('effector').Store<number[]>;
|
|
47
|
-
goToNextStep: import('effector').EventCallable<void>;
|
|
48
|
-
goToPreviousStep: import('effector').EventCallable<void>;
|
|
49
|
-
goToStepById: import('effector').EventCallable<string>;
|
|
50
|
-
stepsHistoryStore: import('effector').Store<import('../..').HistoryEntry[]>;
|
|
51
|
-
};
|
|
39
|
+
}) => Readonly<ExperienceInstance>;
|
|
52
40
|
export declare function createExperienceInstance<T extends Parameters<typeof createExperienceInstanceFactory>[0]>(params: T): ReturnType<typeof createExperienceInstanceFactory>;
|
|
53
41
|
declare const createExperienceInstanceIndexFactory: ({ client }: {
|
|
54
42
|
client: Picked;
|
|
55
43
|
}) => {
|
|
56
44
|
spawn: (experience: ExperienceStore, target: HTMLElement) => void;
|
|
57
|
-
getByExperienceId: (id: Experience["id"]) =>
|
|
58
|
-
|
|
59
|
-
experienceId: string;
|
|
60
|
-
configStore: import('effector').Store<{
|
|
61
|
-
name: string;
|
|
62
|
-
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
63
|
-
targetSelectors: ExperienceTarget[];
|
|
64
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
65
|
-
}>;
|
|
66
|
-
target: HTMLElement | undefined;
|
|
67
|
-
componentStore: import('effector').Store<{
|
|
68
|
-
name: string;
|
|
69
|
-
component: import('../..').AdaptedComponent<string, unknown>;
|
|
70
|
-
frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
|
|
71
|
-
} | undefined>;
|
|
72
|
-
stateStore: import('effector').StoreWritable<"transitioning" | "ready">;
|
|
73
|
-
isOpenStore: import('effector').StoreWritable<boolean>;
|
|
74
|
-
open: import('effector').EventCallable<void>;
|
|
75
|
-
close: import('effector').EventCallable<void>;
|
|
76
|
-
toggleOpen: import('effector').EventCallable<void>;
|
|
77
|
-
setOpen: import('effector').EventCallable<boolean>;
|
|
78
|
-
treeStore: import('effector').Store<{
|
|
79
|
-
steps: ExperienceStep[];
|
|
80
|
-
nodes: ExperienceNode[];
|
|
81
|
-
edges: import('../..').ExperienceEdge[];
|
|
82
|
-
conditionals: import('../..').ExperienceConditional[];
|
|
83
|
-
}>;
|
|
84
|
-
fieldsStore: import('effector').Store<import('../..').Field[]>;
|
|
85
|
-
currentNodeStore: import('effector').Store<ExperienceNode | null>;
|
|
86
|
-
currentStepStore: import('effector').Store<ExperienceStep | null>;
|
|
87
|
-
previousStepStore: import('effector').Store<ExperienceStep | null>;
|
|
88
|
-
nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
|
|
89
|
-
stepsToOriginStore: import('effector').Store<number[]>;
|
|
90
|
-
stepsToLeafStore: import('effector').Store<number[]>;
|
|
91
|
-
goToNextStep: import('effector').EventCallable<void>;
|
|
92
|
-
goToPreviousStep: import('effector').EventCallable<void>;
|
|
93
|
-
goToStepById: import('effector').EventCallable<string>;
|
|
94
|
-
stepsHistoryStore: import('effector').Store<import('../..').HistoryEntry[]>;
|
|
95
|
-
}[]>;
|
|
96
|
-
listStore: import('effector').Store<{
|
|
97
|
-
id: string;
|
|
98
|
-
experienceId: string;
|
|
99
|
-
configStore: import('effector').Store<{
|
|
100
|
-
name: string;
|
|
101
|
-
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
102
|
-
targetSelectors: ExperienceTarget[];
|
|
103
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
104
|
-
}>;
|
|
105
|
-
target: HTMLElement | undefined;
|
|
106
|
-
componentStore: import('effector').Store<{
|
|
107
|
-
name: string;
|
|
108
|
-
component: import('../..').AdaptedComponent<string, unknown>;
|
|
109
|
-
frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
|
|
110
|
-
} | undefined>;
|
|
111
|
-
stateStore: import('effector').StoreWritable<"transitioning" | "ready">;
|
|
112
|
-
isOpenStore: import('effector').StoreWritable<boolean>;
|
|
113
|
-
open: import('effector').EventCallable<void>;
|
|
114
|
-
close: import('effector').EventCallable<void>;
|
|
115
|
-
toggleOpen: import('effector').EventCallable<void>;
|
|
116
|
-
setOpen: import('effector').EventCallable<boolean>;
|
|
117
|
-
treeStore: import('effector').Store<{
|
|
118
|
-
steps: ExperienceStep[];
|
|
119
|
-
nodes: ExperienceNode[];
|
|
120
|
-
edges: import('../..').ExperienceEdge[];
|
|
121
|
-
conditionals: import('../..').ExperienceConditional[];
|
|
122
|
-
}>;
|
|
123
|
-
fieldsStore: import('effector').Store<import('../..').Field[]>;
|
|
124
|
-
currentNodeStore: import('effector').Store<ExperienceNode | null>;
|
|
125
|
-
currentStepStore: import('effector').Store<ExperienceStep | null>;
|
|
126
|
-
previousStepStore: import('effector').Store<ExperienceStep | null>;
|
|
127
|
-
nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
|
|
128
|
-
stepsToOriginStore: import('effector').Store<number[]>;
|
|
129
|
-
stepsToLeafStore: import('effector').Store<number[]>;
|
|
130
|
-
goToNextStep: import('effector').EventCallable<void>;
|
|
131
|
-
goToPreviousStep: import('effector').EventCallable<void>;
|
|
132
|
-
goToStepById: import('effector').EventCallable<string>;
|
|
133
|
-
stepsHistoryStore: import('effector').Store<import('../..').HistoryEntry[]>;
|
|
134
|
-
}[]>;
|
|
45
|
+
getByExperienceId: (id: Experience["id"]) => Store<ExperienceInstance[]>;
|
|
46
|
+
listStore: Store<ExperienceInstance[]>;
|
|
135
47
|
};
|
|
136
48
|
export declare function createExperienceInstanceIndex<T extends Parameters<typeof createExperienceInstanceIndexFactory>[0]>(params: T): ReturnType<typeof createExperienceInstanceIndexFactory>;
|
|
137
49
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EACjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAiB1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;IAC9B,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC3C,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;IAC/B,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAA;IACjD,UAAU,EAAE,KAAK,CAAC,eA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AAM,CAAC,EAAE,WAAW,CAAA;CACrB,iCAycF,CAAA;AAED,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;wBAqI7D,eAAe,UAAU,WAAW;4BAQhC,UAAU,CAAC,IAAI,CAAC;;CAS/C,CAAA;AAEF,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,8 +1,16 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
1
2
|
import { LogicRule } from '../../logic-engine';
|
|
2
3
|
export type FieldsStore = ReturnType<typeof createFieldIndex>;
|
|
3
4
|
export type PrimitiveFieldValue = string | number | boolean | null;
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* JSON-serializable value type for object fields.
|
|
7
|
+
* Recursively defines all valid JSON-serializable structures.
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = string | number | boolean | null | {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
} | JsonValue[];
|
|
12
|
+
export type FieldValue = PrimitiveFieldValue | PrimitiveFieldValue[] | JsonValue | JsonValue[];
|
|
13
|
+
export interface FieldBase<TOptionValue = PrimitiveFieldValue> {
|
|
6
14
|
id: string;
|
|
7
15
|
name: string;
|
|
8
16
|
label: string;
|
|
@@ -23,89 +31,57 @@ export interface FieldBase {
|
|
|
23
31
|
id: string;
|
|
24
32
|
label: string;
|
|
25
33
|
description?: string;
|
|
26
|
-
value:
|
|
34
|
+
value: TOptionValue;
|
|
27
35
|
condition?: LogicRule;
|
|
28
36
|
}[] | null;
|
|
29
37
|
}
|
|
30
|
-
export interface FieldTextSingular extends FieldBase {
|
|
38
|
+
export interface FieldTextSingular extends FieldBase<string> {
|
|
31
39
|
type: 'text';
|
|
32
40
|
multiple: false;
|
|
33
41
|
defaultValue?: string;
|
|
34
|
-
options?: {
|
|
35
|
-
id: string;
|
|
36
|
-
label: string;
|
|
37
|
-
description?: string;
|
|
38
|
-
value: string;
|
|
39
|
-
condition?: LogicRule;
|
|
40
|
-
}[] | null;
|
|
41
42
|
}
|
|
42
|
-
export interface FieldTextMultiple extends FieldBase {
|
|
43
|
+
export interface FieldTextMultiple extends FieldBase<string> {
|
|
43
44
|
type: 'text';
|
|
44
45
|
multiple: true;
|
|
45
46
|
defaultValue?: string[];
|
|
46
|
-
options?: {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
value: string;
|
|
51
|
-
condition?: LogicRule;
|
|
52
|
-
}[] | null;
|
|
53
47
|
}
|
|
54
|
-
export interface FieldNumberSingular extends FieldBase {
|
|
48
|
+
export interface FieldNumberSingular extends FieldBase<number> {
|
|
55
49
|
type: 'number';
|
|
56
50
|
multiple: false;
|
|
57
51
|
defaultValue?: number;
|
|
58
|
-
options?: {
|
|
59
|
-
id: string;
|
|
60
|
-
label: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
value: number;
|
|
63
|
-
condition?: LogicRule;
|
|
64
|
-
}[] | null;
|
|
65
52
|
}
|
|
66
|
-
export interface FieldNumberMultiple extends FieldBase {
|
|
53
|
+
export interface FieldNumberMultiple extends FieldBase<number> {
|
|
67
54
|
type: 'number';
|
|
68
55
|
multiple: true;
|
|
69
56
|
defaultValue?: number[];
|
|
70
|
-
options?: {
|
|
71
|
-
id: string;
|
|
72
|
-
label: string;
|
|
73
|
-
description?: string;
|
|
74
|
-
value: number;
|
|
75
|
-
condition?: LogicRule;
|
|
76
|
-
}[] | null;
|
|
77
57
|
}
|
|
78
|
-
export interface
|
|
58
|
+
export interface FieldObjectSingular extends FieldBase<JsonValue> {
|
|
59
|
+
type: 'object';
|
|
60
|
+
multiple: false;
|
|
61
|
+
defaultValue?: JsonValue;
|
|
62
|
+
}
|
|
63
|
+
export interface FieldObjectMultiple extends FieldBase<JsonValue> {
|
|
64
|
+
type: 'object';
|
|
65
|
+
multiple: true;
|
|
66
|
+
defaultValue?: JsonValue[];
|
|
67
|
+
}
|
|
68
|
+
export interface FieldBooleanSingular extends FieldBase<boolean> {
|
|
79
69
|
type: 'boolean';
|
|
80
70
|
multiple: false;
|
|
81
71
|
defaultValue?: boolean;
|
|
82
|
-
options?: {
|
|
83
|
-
id: string;
|
|
84
|
-
label: string;
|
|
85
|
-
description?: string;
|
|
86
|
-
value: boolean;
|
|
87
|
-
condition?: LogicRule;
|
|
88
|
-
}[] | null;
|
|
89
72
|
}
|
|
90
|
-
export interface FieldBooleanMultiple extends FieldBase {
|
|
73
|
+
export interface FieldBooleanMultiple extends FieldBase<boolean> {
|
|
91
74
|
type: 'boolean';
|
|
92
75
|
multiple: true;
|
|
93
76
|
defaultValue?: boolean[];
|
|
94
|
-
options?: {
|
|
95
|
-
id: string;
|
|
96
|
-
label: string;
|
|
97
|
-
description?: string;
|
|
98
|
-
value: boolean;
|
|
99
|
-
condition?: LogicRule;
|
|
100
|
-
}[] | null;
|
|
101
77
|
}
|
|
102
|
-
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
78
|
+
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldObjectSingular | FieldObjectMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
103
79
|
declare const createFieldIndexFactory: () => {
|
|
104
80
|
register: (field: Field) => void;
|
|
105
81
|
update: (fieldId: FieldBase["id"], updates: Partial<Field>) => void;
|
|
106
|
-
getById: (id: FieldBase["id"]) =>
|
|
107
|
-
listStore:
|
|
108
|
-
getByName: (name: FieldBase["name"]) =>
|
|
82
|
+
getById: (id: FieldBase["id"]) => Store<Field | null>;
|
|
83
|
+
listStore: Store<Field[]>;
|
|
84
|
+
getByName: (name: FieldBase["name"]) => Store<Field | null>;
|
|
109
85
|
};
|
|
110
86
|
export declare function createFieldIndex(): ReturnType<typeof createFieldIndexFactory>;
|
|
111
87
|
export declare const setupField: (field: Field, fields: FieldsStore) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAI7D,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AAElE;;;GAGG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5B,SAAS,EAAE,CAAA;AAEf,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,GAAG,SAAS,GAAG,SAAS,EAAE,CAAA;AAE9F,MAAM,WAAW,SAAS,CAAC,YAAY,GAAG,mBAAmB;IAC3D,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC9C,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,E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ieldValue } from '../field/field';
|
|
3
|
+
import { Field, FieldValue, JsonValue } from '../field/field';
|
|
3
4
|
export type ResponsesStore = ReturnType<typeof createResponseIndex>;
|
|
4
5
|
export type Response = FieldValue;
|
|
5
6
|
export interface ResponseListItem {
|
|
@@ -22,15 +23,18 @@ declare const createResponseIndexFactory: ({ client }: {
|
|
|
22
23
|
responsesToCommit: CommitResponses;
|
|
23
24
|
validationErrors: ValidationError[];
|
|
24
25
|
}>;
|
|
25
|
-
listStore:
|
|
26
|
+
listStore: Store<{
|
|
26
27
|
fieldId: string;
|
|
27
28
|
value: FieldValue | undefined;
|
|
28
29
|
}[]>;
|
|
29
|
-
getAllStore:
|
|
30
|
+
getAllStore: Store<{
|
|
30
31
|
[fieldId: string]: FieldValue;
|
|
31
32
|
}>;
|
|
32
|
-
getByFieldId:
|
|
33
|
-
|
|
33
|
+
getByFieldId: {
|
|
34
|
+
(fieldId: Field["id"]): Store<FieldValue>;
|
|
35
|
+
<T extends JsonValue>(fieldId: Field["id"]): Store<T | null>;
|
|
36
|
+
};
|
|
37
|
+
getByFieldName: (fieldName: Field["name"]) => Store<FieldValue>;
|
|
34
38
|
};
|
|
35
39
|
export declare function createResponseIndex<T extends Parameters<typeof createResponseIndexFactory>[0]>(params: T): ReturnType<typeof createResponseIndexFactory>;
|
|
36
40
|
export type CommitResponses = Record<Field['id'], FieldValue>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyD,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE5F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAA;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,MAAM,CAAA;IAGrB,KAAK,EAAE,UAAU,CAAA;CAClB"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -55,84 +55,8 @@ export declare class Picked {
|
|
|
55
55
|
};
|
|
56
56
|
readonly experienceInstances: {
|
|
57
57
|
spawn: (experience: import('.').ExperienceStore, target: HTMLElement) => void;
|
|
58
|
-
getByExperienceId: (id: Experience["id"]) => import('effector').Store<
|
|
59
|
-
|
|
60
|
-
experienceId: string;
|
|
61
|
-
configStore: import('effector').Store<{
|
|
62
|
-
name: string;
|
|
63
|
-
decisionLogic: LogicRule | undefined;
|
|
64
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
65
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
66
|
-
}>;
|
|
67
|
-
target: HTMLElement | undefined;
|
|
68
|
-
componentStore: import('effector').Store<{
|
|
69
|
-
name: string;
|
|
70
|
-
component: AdaptedComponent<string, unknown>;
|
|
71
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
72
|
-
} | undefined>;
|
|
73
|
-
stateStore: import('effector').StoreWritable<"transitioning" | "ready">;
|
|
74
|
-
isOpenStore: import('effector').StoreWritable<boolean>;
|
|
75
|
-
open: import('effector').EventCallable<void>;
|
|
76
|
-
close: import('effector').EventCallable<void>;
|
|
77
|
-
toggleOpen: import('effector').EventCallable<void>;
|
|
78
|
-
setOpen: import('effector').EventCallable<boolean>;
|
|
79
|
-
treeStore: import('effector').Store<{
|
|
80
|
-
steps: import('.').ExperienceStep[];
|
|
81
|
-
nodes: import('.').ExperienceNode[];
|
|
82
|
-
edges: import('.').ExperienceEdge[];
|
|
83
|
-
conditionals: import('.').ExperienceConditional[];
|
|
84
|
-
}>;
|
|
85
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
86
|
-
currentNodeStore: import('effector').Store<import('.').ExperienceNode | null>;
|
|
87
|
-
currentStepStore: import('effector').Store<import('.').ExperienceStep | null>;
|
|
88
|
-
previousStepStore: import('effector').Store<import('.').ExperienceStep | null>;
|
|
89
|
-
nextReachableStepNodesStore: import('effector').Store<import('.').ExperienceNode[]>;
|
|
90
|
-
stepsToOriginStore: import('effector').Store<number[]>;
|
|
91
|
-
stepsToLeafStore: import('effector').Store<number[]>;
|
|
92
|
-
goToNextStep: import('effector').EventCallable<void>;
|
|
93
|
-
goToPreviousStep: import('effector').EventCallable<void>;
|
|
94
|
-
goToStepById: import('effector').EventCallable<string>;
|
|
95
|
-
stepsHistoryStore: import('effector').Store<import('.').HistoryEntry[]>;
|
|
96
|
-
}[]>;
|
|
97
|
-
listStore: import('effector').Store<{
|
|
98
|
-
id: string;
|
|
99
|
-
experienceId: string;
|
|
100
|
-
configStore: import('effector').Store<{
|
|
101
|
-
name: string;
|
|
102
|
-
decisionLogic: LogicRule | undefined;
|
|
103
|
-
targetSelectors: import('.').ExperienceTarget[];
|
|
104
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
105
|
-
}>;
|
|
106
|
-
target: HTMLElement | undefined;
|
|
107
|
-
componentStore: import('effector').Store<{
|
|
108
|
-
name: string;
|
|
109
|
-
component: AdaptedComponent<string, unknown>;
|
|
110
|
-
frameworkStore: import('effector').Store<Framework | undefined>;
|
|
111
|
-
} | undefined>;
|
|
112
|
-
stateStore: import('effector').StoreWritable<"transitioning" | "ready">;
|
|
113
|
-
isOpenStore: import('effector').StoreWritable<boolean>;
|
|
114
|
-
open: import('effector').EventCallable<void>;
|
|
115
|
-
close: import('effector').EventCallable<void>;
|
|
116
|
-
toggleOpen: import('effector').EventCallable<void>;
|
|
117
|
-
setOpen: import('effector').EventCallable<boolean>;
|
|
118
|
-
treeStore: import('effector').Store<{
|
|
119
|
-
steps: import('.').ExperienceStep[];
|
|
120
|
-
nodes: import('.').ExperienceNode[];
|
|
121
|
-
edges: import('.').ExperienceEdge[];
|
|
122
|
-
conditionals: import('.').ExperienceConditional[];
|
|
123
|
-
}>;
|
|
124
|
-
fieldsStore: import('effector').Store<Field[]>;
|
|
125
|
-
currentNodeStore: import('effector').Store<import('.').ExperienceNode | null>;
|
|
126
|
-
currentStepStore: import('effector').Store<import('.').ExperienceStep | null>;
|
|
127
|
-
previousStepStore: import('effector').Store<import('.').ExperienceStep | null>;
|
|
128
|
-
nextReachableStepNodesStore: import('effector').Store<import('.').ExperienceNode[]>;
|
|
129
|
-
stepsToOriginStore: import('effector').Store<number[]>;
|
|
130
|
-
stepsToLeafStore: import('effector').Store<number[]>;
|
|
131
|
-
goToNextStep: import('effector').EventCallable<void>;
|
|
132
|
-
goToPreviousStep: import('effector').EventCallable<void>;
|
|
133
|
-
goToStepById: import('effector').EventCallable<string>;
|
|
134
|
-
stepsHistoryStore: import('effector').Store<import('.').HistoryEntry[]>;
|
|
135
|
-
}[]>;
|
|
58
|
+
getByExperienceId: (id: Experience["id"]) => import('effector').Store<import('.').ExperienceInstance[]>;
|
|
59
|
+
listStore: import('effector').Store<import('.').ExperienceInstance[]>;
|
|
136
60
|
};
|
|
137
61
|
readonly experiences: {
|
|
138
62
|
register: (experience: Experience) => void;
|
|
@@ -231,7 +155,10 @@ export declare class Picked {
|
|
|
231
155
|
getAllStore: import('effector').Store<{
|
|
232
156
|
[fieldId: string]: import('.').FieldValue;
|
|
233
157
|
}>;
|
|
234
|
-
getByFieldId:
|
|
158
|
+
getByFieldId: {
|
|
159
|
+
(fieldId: Field["id"]): import('effector').Store<import('.').FieldValue>;
|
|
160
|
+
<T extends import('.').JsonValue>(fieldId: Field["id"]): import('effector').Store<T | null>;
|
|
161
|
+
};
|
|
235
162
|
getByFieldName: (fieldName: Field["name"]) => import('effector').Store<import('.').FieldValue>;
|
|
236
163
|
};
|
|
237
164
|
readonly fields: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"picked.d.ts","sourceRoot":"","sources":["../../src/picked.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,UAAU,EAIhB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,KAAK,MAAM,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EAAE,MAAM,EAAE,MAAM;IAI3C,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAQhD,gBAAgB,IAAI,aAAa;IAI3B,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB/D,OAAO,CAAC,YAAY;IA6BpB,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,YAAY;IAgBpB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,YAAY,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,MAAM,CAY3E;CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionNode, Experience, ExperienceConditional, ExperienceEdge, ExperienceNode, ExperienceStep, ExperienceTarget } from '../../entities/experience/experience';
|
|
2
2
|
import { AdaptedComponent } from '../../entities/component/component';
|
|
3
3
|
import { LogicRule, LogicValue } from '../../logic-engine';
|
|
4
|
-
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldTextMultiple, FieldTextSingular } from '../../entities/field/field';
|
|
4
|
+
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldObjectMultiple, FieldObjectSingular, FieldTextMultiple, FieldTextSingular, JsonValue } from '../../entities/field/field';
|
|
5
5
|
import { Serialized } from './serialization';
|
|
6
6
|
export interface Nodeable {
|
|
7
7
|
node: SerializableNode | null;
|
|
@@ -105,9 +105,9 @@ export type CreateFieldOptions = Omit<Field, 'options' | 'placeholder' | 'descri
|
|
|
105
105
|
doNotTrackValue?: boolean;
|
|
106
106
|
doNotStoreValue?: boolean;
|
|
107
107
|
};
|
|
108
|
-
options?: NonNullable<FieldTextSingular['options']>[number][] | NonNullable<FieldTextMultiple['options']>[number][] | NonNullable<FieldNumberSingular['options']>[number][] | NonNullable<FieldNumberMultiple['options']>[number][] | NonNullable<FieldBooleanSingular['options']>[number][] | NonNullable<FieldBooleanMultiple['options']>[number][];
|
|
108
|
+
options?: NonNullable<FieldTextSingular['options']>[number][] | NonNullable<FieldTextMultiple['options']>[number][] | NonNullable<FieldNumberSingular['options']>[number][] | NonNullable<FieldNumberMultiple['options']>[number][] | NonNullable<FieldBooleanSingular['options']>[number][] | NonNullable<FieldBooleanMultiple['options']>[number][] | Omit<NonNullable<FieldObjectSingular['options']>[number], 'id'>[] | Omit<NonNullable<FieldObjectMultiple['options']>[number], 'id'>[];
|
|
109
109
|
};
|
|
110
|
-
export type SerializableField = {
|
|
110
|
+
export type SerializableField<T extends JsonValue = JsonValue> = {
|
|
111
111
|
id: string;
|
|
112
112
|
name: string;
|
|
113
113
|
label: string;
|
|
@@ -128,9 +128,15 @@ export type SerializableField = {
|
|
|
128
128
|
id: string;
|
|
129
129
|
label: string;
|
|
130
130
|
description?: string;
|
|
131
|
-
value:
|
|
131
|
+
value: JsonValue;
|
|
132
132
|
condition?: LogicRule;
|
|
133
133
|
}[] | null;
|
|
134
|
+
/**
|
|
135
|
+
* Phantom type property for TypeScript type inference.
|
|
136
|
+
* This property never exists at runtime but enables type-safe field value access.
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
__fieldType?: T;
|
|
134
140
|
} & {
|
|
135
141
|
serialize: () => Serialized<Field>;
|
|
136
142
|
};
|
|
@@ -181,6 +187,23 @@ export declare const bindExperienceStep: (stepOptions: CreateStepOptions | Orpha
|
|
|
181
187
|
export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
|
|
182
188
|
export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
|
|
183
189
|
export declare const createConditional: (conditionalOptions: CreateConditionalOptions, experience: SerializableExperience) => SerializableConditional;
|
|
184
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Creates a field with optional generic type parameter for object field type safety.
|
|
192
|
+
*
|
|
193
|
+
* @template T - The type of the object field value (only applicable for type: 'object')
|
|
194
|
+
* @param fieldOptions - The field configuration options
|
|
195
|
+
* @returns A serializable field with type information
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* // Without type parameter (default JsonValue)
|
|
200
|
+
* const field = createField({ type: 'text', ... })
|
|
201
|
+
*
|
|
202
|
+
* // With type parameter for object fields
|
|
203
|
+
* interface MyData { name: string; age: number }
|
|
204
|
+
* const typedField = createField<MyData>({ type: 'object', ... })
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare const createField: <T extends JsonValue = JsonValue>(fieldOptions: CreateFieldOptions) => SerializableField<T>;
|
|
185
208
|
export declare const createExperience: (experience: CreateExperienceOptions) => SerializableExperience;
|
|
186
209
|
//# sourceMappingURL=create-experience.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAGjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[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