@picked/client 0.0.1-dev.1756875690387 → 0.0.1-dev.1762750479117

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.
Files changed (107) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/plugins/create-experience/index.js +1 -1
  3. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -0
  4. package/dist/cjs/plugins/history-browser-storage/index.js +1 -0
  5. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -0
  6. package/dist/cjs/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +1 -1
  7. package/dist/cjs/plugins/shopify/index.js +1 -1
  8. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  9. package/dist/cjs/plugins/web-components/index.js +1 -0
  10. package/dist/cjs/plugins/window-object/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/esm/index.js +555 -443
  13. package/dist/esm/plugins/create-experience/index.js +172 -103
  14. package/dist/esm/plugins/experience-browser-storage/index.js +39 -0
  15. package/dist/esm/plugins/{history-browserstorage-plugin → history-browser-storage}/index.js +2 -2
  16. package/dist/esm/plugins/responses-browser-storage/index.js +41 -0
  17. package/dist/esm/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +24 -21
  18. package/dist/esm/plugins/shopify/index.js +38 -28
  19. package/dist/esm/plugins/single-page-app/index.js +3 -3
  20. package/dist/esm/plugins/web-components/index.js +21 -0
  21. package/dist/esm/plugins/window-object/index.js +1 -1
  22. package/dist/esm/server/index.js +1 -1
  23. package/dist/experience-instance-Bs9t-zff.js +777 -0
  24. package/dist/experience-instance-COUhADSj.cjs +1 -0
  25. package/dist/storage-Cb_71y48.js +94 -0
  26. package/dist/storage-DuRlyFaY.cjs +1 -0
  27. package/dist/{supports-BvrzQAVk.js → supports-BjhuLJ8z.js} +27 -11
  28. package/dist/supports-YvpQZxbh.cjs +1 -0
  29. package/dist/types/client.d.ts +26 -0
  30. package/dist/types/client.d.ts.map +1 -1
  31. package/dist/types/entities/action/action.d.ts +15 -0
  32. package/dist/types/entities/action/action.d.ts.map +1 -0
  33. package/dist/types/entities/experience/experience.d.ts +19 -6
  34. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  35. package/dist/types/entities/experience-instance/experience-instance.d.ts +13 -10
  36. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  37. package/dist/types/entities/feature/feature.d.ts +5 -2
  38. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  39. package/dist/types/entities/field/field.d.ts +27 -19
  40. package/dist/types/entities/field/field.d.ts.map +1 -1
  41. package/dist/types/entities/history/history.d.ts.map +1 -1
  42. package/dist/types/entities/predicate/predicate.d.ts +1 -1
  43. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  44. package/dist/types/entities/response/response.d.ts +8 -0
  45. package/dist/types/entities/response/response.d.ts.map +1 -1
  46. package/dist/types/exports.d.ts +2 -0
  47. package/dist/types/exports.d.ts.map +1 -1
  48. package/dist/types/picked.d.ts +28 -10
  49. package/dist/types/picked.d.ts.map +1 -1
  50. package/dist/types/plugins/create-experience/create-experience.d.ts +48 -13
  51. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  52. package/dist/types/plugins/experience-browser-storage/index.d.ts.map +1 -0
  53. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
  54. package/dist/types/plugins/history-browser-storage/index.d.ts.map +1 -0
  55. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -0
  56. package/dist/types/plugins/responses-browser-storage/index.d.ts.map +1 -0
  57. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
  58. package/dist/types/plugins/responses-indexeddb/index.d.ts.map +1 -0
  59. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
  60. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
  61. package/dist/types/plugins/shopify/utils.d.ts +21 -0
  62. package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
  63. package/dist/types/plugins/web-components/index.d.ts +2 -0
  64. package/dist/types/plugins/web-components/index.d.ts.map +1 -0
  65. package/dist/types/plugins/web-components/plugin.d.ts +3 -0
  66. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -0
  67. package/dist/types/utils/dom.d.ts +5 -5
  68. package/dist/types/utils/dom.d.ts.map +1 -1
  69. package/dist/types/utils/events.d.ts +29 -24
  70. package/dist/types/utils/events.d.ts.map +1 -1
  71. package/dist/types/utils/get-step-fields.d.ts +4 -0
  72. package/dist/types/utils/get-step-fields.d.ts.map +1 -0
  73. package/dist/types/utils/nodes.d.ts +2 -1
  74. package/dist/types/utils/nodes.d.ts.map +1 -1
  75. package/dist/types/utils/storage.d.ts +3 -0
  76. package/dist/types/utils/storage.d.ts.map +1 -1
  77. package/dist/types/utils/supports.d.ts +2 -0
  78. package/dist/types/utils/supports.d.ts.map +1 -1
  79. package/dist/types/utils/user-session.d.ts +5 -0
  80. package/dist/types/utils/user-session.d.ts.map +1 -0
  81. package/package.json +32 -26
  82. package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +0 -1
  83. package/dist/cjs/plugins/history-browserstorage-plugin/index.js +0 -1
  84. package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +0 -1
  85. package/dist/esm/plugins/experience-browserstorage-plugin/index.js +0 -38
  86. package/dist/esm/plugins/responses-browserstorage-plugin/index.js +0 -36
  87. package/dist/experience-instance-6ZKZS7dF.cjs +0 -1
  88. package/dist/experience-instance-BA0EXYg5.js +0 -712
  89. package/dist/storage-BPJwmlva.cjs +0 -1
  90. package/dist/storage-D87xFySf.js +0 -85
  91. package/dist/supports-C0y3-V5V.cjs +0 -1
  92. package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +0 -1
  93. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +0 -1
  94. package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +0 -1
  95. package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +0 -1
  96. package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +0 -1
  97. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +0 -1
  98. package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +0 -1
  99. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +0 -1
  100. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/index.d.ts +0 -0
  101. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/plugin.d.ts +0 -0
  102. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/index.d.ts +0 -0
  103. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/plugin.d.ts +0 -0
  104. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/index.d.ts +0 -0
  105. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/plugin.d.ts +0 -0
  106. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.d.ts +0 -0
  107. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/plugin.d.ts +0 -0
@@ -0,0 +1 @@
1
+ "use strict";const s=require("effector"),G=require("@withease/factories"),H=require("./supports-YvpQZxbh.cjs"),N=require("./logger-BsmHUUw1.cjs"),mt=require("./object-BbFTsGh3.cjs");function ht(t){return typeof t=="number"&&!isNaN(t)}function R(t){return typeof t=="string"}function E(t){return Array.isArray(t)}function rt(t){return t instanceof Promise}function tt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&Object.keys(t).length===1}function m(t){if(ht(t))return t;const e=parseFloat(`${t}`);return isNaN(e)?0:e}function T(t){return`${t}`}const St={"==":(t,e)=>t==e,"===":(t,e)=>t===e,"!=":(t,e)=>t!=e,"!==":(t,e)=>t!==e,">":(t,e)=>m(t)>m(e),">=":(t,e)=>m(t)>=m(e),"<":(t,e,r)=>{const n=m(t),a=m(e);if(r===void 0)return n<a;const c=m(r);return n<a&&a<c},"<=":(t,e,r)=>{const n=m(t),a=m(e);if(r===void 0)return n<=a;const c=m(r);return n<=a&&a<=c},"!!":async t=>await A(t),"!":async t=>!await A(t),"%":(t,e)=>m(t)%m(e),log:t=>(console.log(t),t),in:(t,e)=>e?R(e)?e.indexOf(T(t))!==-1:E(e)?e.includes(t):!1:!1,cat:(...t)=>t.map(T).join(""),substr:(t,e,r)=>{const n=T(t),a=m(e);if(r===void 0)return n.substr(a);const c=m(r);if(c<0){const o=n.substr(a);return o.substr(0,o.length+c)}return n.substr(a,c)},"+":(...t)=>t.reduce((e,r)=>m(e)+m(r),0),"*":(...t)=>t.reduce((e,r)=>m(e)*m(r),1),"-":(t,e)=>{const r=m(t);return e===void 0?-r:r-m(e)},"/":(t,e)=>m(t)/m(e),min:(...t)=>Math.min(...t.map(m)),max:(...t)=>Math.max(...t.map(m)),merge:(...t)=>t.reduce((e,r)=>E(r)?e.concat(r):e.concat([r]),[]),var(t,e){const r=arguments.length>1?e:null;if(t===""||t==="."||t===null||t===void 0)return this;if(typeof t=="number"&&Array.isArray(this))return t>=0&&t<this.length?this[t]:r;const n=T(t);if(n===""||n===".")return this;const a=n.split(".");let c=this;for(const o of a){if(c==null)return r;if(Array.isArray(c)){const u=parseInt(o,10);isNaN(u)?c=c[o]:c=c[u]}else c=c[o]}return c!==void 0?c:r},async missing(...t){const e=E(t[0])?t[0]:t,r=[];for(const n of e){const a=await g({var:n},this);(a===null||a==="")&&r.push(`${n}`)}return r},async missing_some(t,e){const r=await g({missing:e},this);if(!E(r)||!E(e))return[];const n=r.filter(R);return e.filter(R).length-n.length>=m(t)?[]:n},invoke(t){return typeof t!="function"?null:t()},regexp_matches(t,e){let r=t,n="";if(E(t)){const[c,o]=t;r=c,n=o}return!R(r)||!R(n)?!1:new RegExp(r,n).test(T(e))},throw(t){throw new Error(T(t))}};async function g(t,e){if(!t)return t;if(rt(t))return g(await t,e);if(E(t))return Promise.all(t.map(o=>g(o,e)));if(!tt(t))return t;const r=yt(t);let n=r?t[r]??[]:[];switch(E(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await A(await g(n[o],e)))return g(n[o+1],e);return n.length%2===1?g(n[n.length-1],e):null;case"and":{let o=null;for(const u of n)if(o=await g(u,e),!await A(o))return o;return o}case"or":{let o=null;for(const u of n)if(o=await g(u,e),await A(o))return o;return o}case"map":{const o=await g(n[0],e);return E(o)?await Promise.all(o.map(u=>g(n[1],u))):[]}case"filter":{const o=await g(n[0],e);return E(o)?(await Promise.all(o.map(async p=>{const y=await A(await g(n[1],p));return{item:p,shouldInclude:y}}))).filter(({shouldInclude:p})=>p).map(({item:p})=>p):[]}case"reduce":{const o=await g(n[0],e);if(!E(o))return n.length>2?await g(n[2],e):null;const u=n[1];let y=n.length>2?await g(n[2],e):null;for(const k of o)y=await g(u,{current:k,accumulator:y});return y}case"all":{const o=await g(n[0],e);if(!E(o)||o.length===0)return!1;for(const u of o)if(!await A(await g(n[1],u)))return!1;return!0}case"some":{const o=await g(n[0],e);if(!E(o))return!1;for(const u of o)if(await A(await g(n[1],u)))return!0;return!1}case"none":{const o=await g(n[0],e);if(!E(o))return!0;for(const u of o)if(await A(await g(n[1],u)))return!1;return!0}case"catch":try{return await g(n[0],e)}catch(o){return tt(o)?await g(o,e):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const a=await Promise.all(n.map(o=>g(o,e))),c=r?St[r]:void 0;if(!c)throw new Error(`Unrecognized operation ${r}`);return c.apply(e,a)}async function A(t){return rt(t)?A(await t):!(Array.isArray(t)&&t.length===0)&&!!t}function yt(t){return Object.keys(t)[0]}function ot(t){return!mt.isEmpty(t)}async function z(t,e,r){const n=t.getStateSnapshot(),a=t.predicates.listStore.getState().reduce((u,p)=>({...u,[p.name]:()=>p.predicate(n)}),{}),c=t.features.listStore.getState().reduce((u,p)=>({...u,[p.id]:async()=>{const{bucket:y}=await p.getBucket();return y}}),{}),o={...r,responses:t.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:a,features:c};return await g(e,o)}function wt(t){return!H.supportsWindow()||!H.supportsDocument()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}function Et(t){if(!H.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return t.attachShadow({mode:"closed"})}function Nt(){return new Promise((t,e)=>{if(!H.supportsDocument()){e();return}document.readyState!=="loading"?t():document.addEventListener("readystatechange",()=>t(),{once:!0})})}function It(t,e){const r=new MutationObserver(n=>{document.contains(t)||(r.disconnect(),e())});r.observe(document.body,{childList:!0,subtree:!0})}const j="picked-root",q="picked-target",xt="picked-root";function kt(t,e){return[...t,{selector:`${xt}[experience-id="${e}"]`,placement:"replace"}].flatMap(n=>{const a=wt(n.selector).filter(c=>!At(c,e)&&!it(c,e));return{...n,elements:a}})}function vt(t,e){return t.flatMap(r=>r.elements.map(n=>Bt(n,r.placement,e)))}function bt(t,e){t.classList.add(q),t.classList.add(`${q}-${e}`)}function At(t,e){return e?t.classList.contains(`${q}-${e}`):t.classList.contains(`${q}`)}function it(t,e){return e?t.classList.contains(`${j}-${e}`):t.classList.contains(j)}function Ot(t){const e=document.createElement("div");return e.style.display="block",e.classList.add(j),e.classList.add(`${j}-${t}`),e}function Bt(t,e,r){let n;const a=Ot(r);if(t instanceof Document)n=t.body.appendChild(a);else{switch(e){case"replace":t.replaceWith(a);break;case"before":t.before(a);break;case"after":t.after(a);break;case"prepend":t.prepend(a);break;default:t.append(a);break}n=a}return n}function Ft(t){return t.type==="conditional"}function L(t){return t.type==="step"}function $t(t){return t.type==="experience"}function et(t){return t.type==="origin"}function nt(t){return t.type==="action"}const st=(t,e,r,n,a=new Set)=>a.has(r.id)?[]:(a.add(r.id),L(r)&&!n?[r]:e.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=t.find(p=>p.id===o.destinationNodeId);return u?st(t,e,u,!1,a):[]})),_t=(t,e,r)=>st(t,e,r,!0,new Set),at=(t,e,r,n,a=new Set)=>{if(a.has(r.id))return[-1,-1];a.add(r.id);const c=e.filter(p=>p.sourceNodeId===r.id);if(c.length===0)return[0,0];let o=1/0,u=-1/0;for(const p of c){const y=t.find(M=>M.id===p.destinationNodeId);if(!y)continue;const[k,B]=at(t,e,y,!1,new Set(a));k!==-1&&(o=Math.min(o,k+1),u=Math.max(u,B+1))}return o===1/0?[-1,-1]:[o,u]},Tt=(t,e,r)=>at(t,e,r,!0,new Set),ct=(t,e,r,n=new Set)=>{if(n.has(r.id))return[-1,-1];if(n.add(r.id),r.type==="origin")return[0,0];const a=e.filter(u=>u.destinationNodeId===r.id);if(a.length===0)return[-1,-1];let c=1/0,o=-1/0;for(const u of a){const p=t.find(B=>B.id===u.sourceNodeId);if(!p)continue;const[y,k]=ct(t,e,p,new Set(n));y!==-1&&(c=Math.min(c,y+1),o=Math.max(o,k+1))}return c===1/0?[-1,-1]:[c,o]},Lt=(t,e,r)=>ct(t,e,r,new Set),ut=t=>t.find(r=>r.type==="origin")||null,W=(t,e,r)=>{if(!t)return ut(e);const n=r.find(c=>c.sourceNodeId===t.id);if(!n)return null;const a=e.find(c=>c.id===n.destinationNodeId);return a||null};async function Mt(t,e,r,n){const a=t?"true":"false",c=n.find(o=>o.sourceNodeHandle===a&&o.sourceNodeId===e);return r.find(o=>o.id===(c==null?void 0:c.destinationNodeId))}const X=s.createDomain("experience-instance"),Dt=G.createFactory(({client:t,experience:e,target:r})=>{const n=s.createEvent(),a=s.createEvent(),c=s.createEvent(),o=s.createEvent(),u=s.createEvent(),p=s.createEvent(),y=e.componentStore,k=X.store("transitioning"),B=t.history.entriesStore.map(i=>i.filter(l=>l.experienceId===e.id)),M=B.map(i=>i.filter(l=>L(l.node))),I=B.map(i=>{var l;return((l=i[i.length-1])==null?void 0:l.node)||null}),f=s.combine(e.treeStore,I,({steps:i},l)=>i.find(d=>l&&L(l)&&d.id===l.stepId)||null),h=s.combine(e.treeStore,I,({nodes:i,edges:l},d)=>d?_t(i,l,d):[]),b=s.combine(e.treeStore,I,({nodes:i,edges:l},d)=>d?Lt(i,l,d):[-1,-1]),F=s.combine(e.treeStore,I,({nodes:i,edges:l},d)=>d?Tt(i,l,d):[-1,-1]),$=e.configStore.getState().initializeOpenLogic,O=X.store($===!0),P=s.createApi(O,{open:()=>!0,close:()=>!1,toggle:i=>!i,set:(i,l)=>l}),lt=s.createEffect(async()=>{t.history.back({experienceId:e.id})}),dt=s.attach({source:e.treeStore,effect:async(i,l)=>{const d=i.nodes.find(w=>L(w)&&w.stepId===l);d&&t.history.push({experienceId:e.id,node:d})}}),J=s.attach({source:I,effect:i=>{}}),K=s.attach({source:e.treeStore,effect:async({nodes:i})=>ut(i)}),U=s.attach({source:e.treeStore,effect:async({nodes:i,edges:l},d)=>W(d,i,l)}),V=s.attach({source:e.treeStore,effect:async({nodes:i,edges:l,conditionals:d},w)=>{if(!w)return;const _=d.find(v=>v.id===w.conditionalId);if(!_)return;const x=w.id,S=await z(t,_.condition);return Mt(!!S,x,i,l)}}),Q=s.attach({source:e.treeStore,effect:async({nodes:i,edges:l},d)=>{if(!d||!nt(d))return;const w=d.action;if(!w){N.logger("warn",`Action node ${d.id} has no action name`);return}const _=t.actions.getByName(w).getState();if(!_){N.logger("warn",`Action '${w}' not registered on client`);const x=l.find(S=>S.sourceNodeId===d.id&&S.sourceNodeHandle==="false");return x?i.find(S=>S.id===x.destinationNodeId):null}if(typeof _.action!="function"){N.logger("warn",`Action '${w}' is not a function`);const x=l.find(S=>S.sourceNodeId===d.id&&S.sourceNodeHandle==="false");return x?i.find(S=>S.id===x.destinationNodeId):null}try{N.logger("info",`Executing action: ${w}`),await _.action();const x=l.find(v=>v.sourceNodeId===d.id&&v.sourceNodeHandle==="true");if(!x)return N.logger("warn",`No 'true' edge found for action node ${d.id}`),null;const S=i.find(v=>v.id===x.destinationNodeId);return N.logger("info",`Action '${w}' succeeded, moving to node ${S==null?void 0:S.id}`),S||null}catch(x){N.logger("warn",`Action '${w}' failed:`,x);const S=l.find(C=>C.sourceNodeId===d.id&&C.sourceNodeHandle==="false");if(!S)return N.logger("warn",`No 'false' edge found for action node ${d.id}`),null;const v=i.find(C=>C.id===S.destinationNodeId);return N.logger("info",`Action '${w}' failed, moving to node ${v==null?void 0:v.id}`),v||null}}}),pt=s.createEffect(i=>{if(i)return t.launchExperienceById(i.experienceId)}),Y=s.attach({source:[I,e.treeStore],effect:async([i,{nodes:l,edges:d}])=>W(i,l,d)}),D=s.attach({source:[I,e.treeStore],effect:async([i,{nodes:l,edges:d}])=>W(i,l,d)}),gt=s.createEffect(i=>{t.history.push({experienceId:e.id,node:i})}),Z=s.attach({source:e.configStore,effect:async({initializeOpenLogic:i})=>ot(i)?!!await z(t,i):i??!1});return s.split({source:I,match:i=>i?Ft(i)?"condition":L(i)?"step":$t(i)?"launchExperience":et(i)?"origin":nt(i)?"action":"other":"none",cases:{none:K,origin:U,condition:V,step:J,launchExperience:pt,action:Q,__:s.createEvent()}}),s.sample({clock:[V.doneData,U.doneData,K.doneData,D.doneData,Y.doneData,Q.doneData],filter:Boolean,target:gt}),s.sample({clock:a,target:D}),s.sample({clock:a,source:f,filter:Boolean,target:t.eventBus.prepend(i=>({type:"step_submit",step:i,experience:e}))}),s.sample({clock:D.done,source:f,filter:Boolean,target:t.eventBus.prepend(i=>({type:"step_submit_success",step:i,experience:e}))}),s.sample({clock:D.fail,source:f,filter:Boolean,target:t.eventBus.prepend(i=>({type:"step_submit_error",step:i,experience:e}))}),s.sample({clock:c,target:lt}),s.sample({clock:o,target:dt}),s.sample({source:s.combine([V.pending,U.pending,K.pending,D.pending]),fn:i=>i.some(Boolean)?"transitioning":"ready",target:k}),s.sample({clock:J.doneData,source:f,filter:Boolean,target:t.eventBus.prepend(i=>({type:"step_enter",step:i,experience:e}))}),s.sample({clock:p,target:Z}),s.sample({source:Z.doneData,fn:i=>!!i,target:O}),s.sample({source:I,clock:n,filter:i=>i?et(i):!0,target:Y}),s.sample({source:O,filter:Boolean,target:t.eventBus.prepend(()=>({type:"experience_open",experience:e}))}),s.sample({source:O,filter:i=>!i,target:t.eventBus.prepend(()=>({type:"experience_close",experience:e}))}),s.sample({clock:u,target:[n,p]}),u(),{id:Math.random().toString(36).substring(7),experienceId:e.id,configStore:e.configStore,target:r,componentStore:y,stateStore:k,isOpenStore:O,open:P.open,close:P.close,toggleOpen:P.toggle,setOpen:P.set,treeStore:e.treeStore,currentNodeStore:I,currentStepStore:f,nextReachableStepNodesStore:h,stepsToOriginStore:b,stepsToLeafStore:F,goToNextStep:a,goToPreviousStep:c,goToStepById:o,stepsHistoryStore:M}});function ft(t){return G.invoke(Dt,t)}const Rt=G.createFactory(({client:t})=>{const e=X.store({}),r=s.createEvent(),n=s.createEvent(),a=s.createEvent(),c=s.createApi(e,{register(f,h){const b=[...f[h.experienceId]??[]];return b.push(h),{...f,[h.experienceId]:b}},unregister(f,h){var $;const b=h.experienceId,F=($=f[b])==null?void 0:$.filter(O=>O!==h);return{...f,[b]:F??[]}}}),o=s.createEffect(({experience:f,target:h})=>ft({client:t,experience:f,target:h})),u=s.createEffect(f=>{c.register(f)}),p=s.createEffect(f=>{f.target&&It(f.target,()=>{a(f)})}),y=s.createEffect(f=>{c.unregister(f)}),k=s.createEffect(f=>{const h=f.componentStore.getState();if(!h){N.logger("warn","No app component registered. Skipping init.");return}const b=h.frameworkStore.getState();if(!b){N.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const F=f.target;if(!F){N.logger("error",`No target element registered for experience '${f.experienceId}'. Skipping rendering.`);return}const $=Et(F);try{b.render($,h.component,t,f)}catch(O){N.logger("error",O)}});s.sample({clock:r,target:o}),s.sample({clock:a,target:y}),s.sample({clock:o.doneData,target:[u,p,n]}),s.sample({clock:o.doneData,target:t.eventBus.prepend(f=>({type:"experience_initialized",experienceInstance:f}))}),s.sample({clock:n,target:k});function B(f,h){r({experience:f,target:h})}const M=e.map(f=>Object.values(f).flat());function I(f){return e.map(h=>h[f]||[],{skipVoid:!1})}return{spawn:B,getByExperienceId:I,listStore:M}});function Pt(t){return G.invoke(Rt,t)}exports.createAppHosts=vt;exports.createExperienceInstance=ft;exports.createExperienceInstanceIndex=Pt;exports.domInteractive=Nt;exports.evaluateRuleLogic=z;exports.getTargetElements=kt;exports.isPickedRoot=it;exports.isRulesLogic=ot;exports.isStepNode=L;exports.tagTargetElement=bt;
@@ -0,0 +1,94 @@
1
+ const f = (e) => btoa([...e].map((t) => String.fromCharCode(t.charCodeAt(0) ^ 7)).join("")).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
2
+ function m(e, t = "global", o) {
3
+ let r = "pckd";
4
+ if (t === "experience") {
5
+ if (!o)
6
+ throw new Error("Experience instance is required to scope storage to an experience");
7
+ r = `${r}:${o.experienceId}`;
8
+ }
9
+ return `${r}:${f(e)}`;
10
+ }
11
+ function l(e, t, o, r) {
12
+ const n = o === "local" ? localStorage : sessionStorage, s = typeof t != "string" ? JSON.stringify(t) : t;
13
+ if (n.setItem(e, s), typeof r == "number") {
14
+ const a = new Date(Date.now() + r).toISOString();
15
+ n.setItem(`${e}:expires-at`, a);
16
+ }
17
+ }
18
+ function c(e, t) {
19
+ const o = t === "local" ? localStorage : sessionStorage;
20
+ o.removeItem(e), o.removeItem(`${e}:expires-at`);
21
+ }
22
+ function u(e, t, o, r) {
23
+ const n = t === "local" ? localStorage : sessionStorage;
24
+ function s(i) {
25
+ i.storageArea === n && i.key === e && r(o(e));
26
+ }
27
+ return window.addEventListener("storage", s), function() {
28
+ window.removeEventListener("storage", s);
29
+ };
30
+ }
31
+ function g(e, t) {
32
+ const o = t === "local" ? localStorage : sessionStorage, r = o.getItem(e), n = o.getItem(`${e}:expires-at`), s = (a) => l(e, a, t), i = () => c(e, t);
33
+ if (n) {
34
+ const a = /* @__PURE__ */ new Date(), p = new Date(n);
35
+ if (a > p)
36
+ return c(e, t), {
37
+ isSet: () => !1,
38
+ text: () => null,
39
+ json: () => null,
40
+ boolean: () => null,
41
+ set: s,
42
+ remove: i
43
+ };
44
+ }
45
+ return {
46
+ isSet() {
47
+ return r !== null;
48
+ },
49
+ text() {
50
+ return r;
51
+ },
52
+ json() {
53
+ return r ? JSON.parse(r) : null;
54
+ },
55
+ boolean() {
56
+ return r ? r === "true" : null;
57
+ },
58
+ set: s,
59
+ remove: i
60
+ };
61
+ }
62
+ const S = {
63
+ get(e) {
64
+ return g(e, "session");
65
+ },
66
+ set(e, t, o) {
67
+ l(e, t, "session", o);
68
+ },
69
+ remove(e) {
70
+ c(e, "session");
71
+ },
72
+ subscribe(e, t) {
73
+ return u(e, "session", this.get, t);
74
+ }
75
+ }, x = {
76
+ get(e) {
77
+ return g(e, "local");
78
+ },
79
+ set(e, t, o) {
80
+ l(e, t, "local", o);
81
+ },
82
+ remove(e) {
83
+ c(e, "local");
84
+ },
85
+ subscribe(e, t) {
86
+ return u(e, "local", this.get, t);
87
+ }
88
+ };
89
+ export {
90
+ u as a,
91
+ m as c,
92
+ x as l,
93
+ S as s
94
+ };
@@ -0,0 +1 @@
1
+ "use strict";const f=e=>btoa([...e].map(t=>String.fromCharCode(t.charCodeAt(0)^7)).join("")).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");function m(e,t="global",o){let r="pckd";if(t==="experience"){if(!o)throw new Error("Experience instance is required to scope storage to an experience");r=`${r}:${o.experienceId}`}return`${r}:${f(e)}`}function l(e,t,o,r){const n=o==="local"?localStorage:sessionStorage,s=typeof t!="string"?JSON.stringify(t):t;if(n.setItem(e,s),typeof r=="number"){const c=new Date(Date.now()+r).toISOString();n.setItem(`${e}:expires-at`,c)}}function a(e,t){const o=t==="local"?localStorage:sessionStorage;o.removeItem(e),o.removeItem(`${e}:expires-at`)}function u(e,t,o,r){const n=t==="local"?localStorage:sessionStorage;function s(i){i.storageArea===n&&i.key===e&&r(o(e))}return window.addEventListener("storage",s),function(){window.removeEventListener("storage",s)}}function g(e,t){const o=t==="local"?localStorage:sessionStorage,r=o.getItem(e),n=o.getItem(`${e}:expires-at`),s=c=>l(e,c,t),i=()=>a(e,t);if(n){const c=new Date,S=new Date(n);if(c>S)return a(e,t),{isSet:()=>!1,text:()=>null,json:()=>null,boolean:()=>null,set:s,remove:i}}return{isSet(){return r!==null},text(){return r},json(){return r?JSON.parse(r):null},boolean(){return r?r==="true":null},set:s,remove:i}}const p={get(e){return g(e,"session")},set(e,t,o){l(e,t,"session",o)},remove(e){a(e,"session")},subscribe(e,t){return u(e,"session",this.get,t)}},b={get(e){return g(e,"local")},set(e,t,o){l(e,t,"local",o)},remove(e){a(e,"local")},subscribe(e,t){return u(e,"local",this.get,t)}};exports.createStorageKey=m;exports.localStore=b;exports.sessionStore=p;exports.subscribe=u;
@@ -50,30 +50,46 @@ function l() {
50
50
  return !1;
51
51
  }
52
52
  }
53
- function f() {
53
+ function p() {
54
54
  try {
55
55
  return "document" in t;
56
56
  } catch {
57
57
  return !1;
58
58
  }
59
59
  }
60
- function p() {
60
+ function f() {
61
61
  try {
62
62
  return "IntersectionObserver" in t;
63
63
  } catch {
64
64
  return !1;
65
65
  }
66
66
  }
67
+ function y() {
68
+ try {
69
+ return "customElements" in t && !!t.customElements;
70
+ } catch {
71
+ return !1;
72
+ }
73
+ }
74
+ function h() {
75
+ try {
76
+ return "crypto" in t && "randomUUID" in t.crypto;
77
+ } catch {
78
+ return !1;
79
+ }
80
+ }
67
81
  export {
68
82
  t as G,
69
83
  l as a,
70
- r as b,
71
- e as c,
72
- s as d,
73
- a as e,
74
- c as f,
75
- u as g,
76
- i as h,
77
- p as i,
78
- f as s
84
+ a as b,
85
+ h as c,
86
+ r as d,
87
+ e,
88
+ s as f,
89
+ c as g,
90
+ u as h,
91
+ i,
92
+ f as j,
93
+ y as k,
94
+ p as s
79
95
  };
@@ -0,0 +1 @@
1
+ "use strict";const n=Symbol("Picked"),t=globalThis,r=o=>{t[n]=o};function e(){try{return"location"in t&&!!t.location}catch{return!1}}function s(){try{return"history"in t&&!!t.history}catch{return!1}}function u(){try{return"localStorage"in t&&!!t.localStorage}catch{return!1}}function c(){try{return"sessionStorage"in t&&!!t.sessionStorage}catch{return!1}}function a(){try{return"document"in t&&"cookie"in t.document}catch{return!1}}function i(){try{return"document"in t&&"createElement"in t.document&&"attachShadow"in t.document.createElement("div")}catch{return!1}}function p(){try{return"window"in t}catch{return!1}}function l(){try{return"document"in t}catch{return!1}}function f(){try{return"IntersectionObserver"in t}catch{return!1}}function y(){try{return"customElements"in t&&!!t.customElements}catch{return!1}}function m(){try{return"crypto"in t&&"randomUUID"in t.crypto}catch{return!1}}exports.GLOBAL_OBJ=t;exports.bindClient=r;exports.supportsCookies=a;exports.supportsCryptoRandomUUID=m;exports.supportsDocument=l;exports.supportsHistory=s;exports.supportsIntersectionObserver=f;exports.supportsLocalStorage=u;exports.supportsLocation=e;exports.supportsSessionStorage=c;exports.supportsShadowRoot=i;exports.supportsWebComponents=y;exports.supportsWindow=p;
@@ -1,4 +1,5 @@
1
1
  import { Predicate } from './entities/predicate/predicate';
2
+ import { Action } from './entities/action/action';
2
3
  import { Plugin } from './entities/plugin/plugin';
3
4
  import { Feature } from './entities/feature/feature';
4
5
  export interface CreateClientOptions {
@@ -31,6 +32,31 @@ export interface CreateClientOptions {
31
32
  * ```
32
33
  */
33
34
  predicates?: Record<string, Predicate>;
35
+ /**
36
+ * Register actions to be invoked in experience trees
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * actions: {
41
+ * logEvent({ event, data }) {
42
+ * // custom logic
43
+ * }
44
+ * }
45
+ * ```
46
+ */
47
+ /**
48
+ * Register actions to be invoked in experience trees
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * actions: {
53
+ * logEvent({ event, data }) {
54
+ * // custom logic
55
+ * }
56
+ * }
57
+ * ```
58
+ */
59
+ actions?: Record<string, Action>;
34
60
  /**
35
61
  * Plugins to extend client functionality
36
62
  *
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,EAAE,CAAA;IAEnE;;;;;;;;;;;;;;;OAeG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAA;CACrD"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEzD,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAA;IAEjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAEtC;;;;;;;;;;;OAWG;IACH;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAEhC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,EAAE,CAAA;IAEnE;;;;;;;;;;;;;;;OAeG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,CAAC,CAAA;CACrD"}
@@ -0,0 +1,15 @@
1
+ export type Action = () => void;
2
+ export type ActionsStore = ReturnType<typeof createActionIndexFactory>;
3
+ export interface ActionIndexItem {
4
+ name: string;
5
+ action: Action;
6
+ }
7
+ declare const createActionIndexFactory: () => {
8
+ register: (name: string, action: Action) => void;
9
+ getByName: (name: string) => import('effector').Store<ActionIndexItem | undefined>;
10
+ listStore: import('effector').Store<ActionIndexItem[]>;
11
+ };
12
+ export declare function createActionIndex(): ReturnType<typeof createActionIndexFactory>;
13
+ export declare const setupAction: (name: string, action: Action, actions: ActionsStore) => void;
14
+ export {};
15
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../../src/entities/action/action.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,MAAM,GAAG,MAAM,IAAI,CAAA;AAC/B,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAItE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,QAAA,MAAM,wBAAwB;qBAiBJ,MAAM,UAAU,MAAM,KAAG,IAAI;sBAQ5B,MAAM;;CAS/B,CAAA;AAEF,wBAAgB,iBAAiB,IAAI,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAE/E;AAED,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,QAAQ,MAAM,EAAE,SAAS,YAAY,KAAG,IAEjF,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { AdaptedComponent } from '../component/component';
2
2
  import { Picked } from '../../picked';
3
- import { LogicRule } from '../../logic-engine';
3
+ import { LogicRule, LogicValue } from '../../logic-engine';
4
4
  import { Field } from '../field/field';
5
5
  export type ExperiencesListStore = ReturnType<typeof createExperienceIndex>;
6
6
  export type ExperienceStore = ReturnType<typeof createExperience>;
@@ -10,10 +10,10 @@ declare const createExperienceFactory: ({ client, experience }: {
10
10
  }) => {
11
11
  id: string;
12
12
  configStore: import('effector').Store<{
13
- type: string;
14
13
  name: string;
15
14
  decisionLogic: LogicRule | undefined;
16
15
  targetSelectors: ExperienceTarget[];
16
+ initializeOpenLogic: LogicValue | LogicRule;
17
17
  }>;
18
18
  treeStore: import('effector').Store<{
19
19
  steps: ExperienceStep[];
@@ -26,6 +26,7 @@ declare const createExperienceFactory: ({ client, experience }: {
26
26
  component: AdaptedComponent<string, unknown>;
27
27
  frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
28
28
  } | undefined>;
29
+ actions: ExperienceAction[];
29
30
  merge: import('effector').EventCallable<{
30
31
  experience: Partial<Experience>;
31
32
  strategy: "override";
@@ -39,10 +40,10 @@ declare const createExperienceIndexFactory: ({ client }: {
39
40
  getById: (id: Experience["id"]) => import('effector').Store<{
40
41
  id: string;
41
42
  configStore: import('effector').Store<{
42
- type: string;
43
43
  name: string;
44
44
  decisionLogic: LogicRule | undefined;
45
45
  targetSelectors: ExperienceTarget[];
46
+ initializeOpenLogic: LogicValue | LogicRule;
46
47
  }>;
47
48
  treeStore: import('effector').Store<{
48
49
  steps: ExperienceStep[];
@@ -55,6 +56,7 @@ declare const createExperienceIndexFactory: ({ client }: {
55
56
  component: AdaptedComponent<string, unknown>;
56
57
  frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
57
58
  } | undefined>;
59
+ actions: ExperienceAction[];
58
60
  merge: import('effector').EventCallable<{
59
61
  experience: Partial<Experience>;
60
62
  strategy: "override";
@@ -63,10 +65,10 @@ declare const createExperienceIndexFactory: ({ client }: {
63
65
  listStore: import('effector').Store<{
64
66
  id: string;
65
67
  configStore: import('effector').Store<{
66
- type: string;
67
68
  name: string;
68
69
  decisionLogic: LogicRule | undefined;
69
70
  targetSelectors: ExperienceTarget[];
71
+ initializeOpenLogic: LogicValue | LogicRule;
70
72
  }>;
71
73
  treeStore: import('effector').Store<{
72
74
  steps: ExperienceStep[];
@@ -79,6 +81,7 @@ declare const createExperienceIndexFactory: ({ client }: {
79
81
  component: AdaptedComponent<string, unknown>;
80
82
  frameworkStore: import('effector').Store<import('../..').Framework | undefined>;
81
83
  } | undefined>;
84
+ actions: ExperienceAction[];
82
85
  merge: import('effector').EventCallable<{
83
86
  experience: Partial<Experience>;
84
87
  strategy: "override";
@@ -91,7 +94,16 @@ export interface ExperienceStep {
91
94
  label: string;
92
95
  fieldIds: string[];
93
96
  }
94
- export type ExperienceNode = StepNode | ConditionalNode | LaunchExperienceNode | OriginNode;
97
+ export type ExperienceNode = StepNode | ConditionalNode | LaunchExperienceNode | OriginNode | ActionNode;
98
+ export interface ExperienceAction {
99
+ id: string;
100
+ action: string;
101
+ }
102
+ export interface ActionNode extends BaseNode {
103
+ type: 'action';
104
+ action: string;
105
+ position: [number, number];
106
+ }
95
107
  export interface BaseNode {
96
108
  id: string;
97
109
  type: string;
@@ -130,9 +142,10 @@ export interface ExperienceTarget {
130
142
  export interface Experience {
131
143
  id: string;
132
144
  name: string;
133
- type: string;
134
145
  component?: AdaptedComponent;
135
146
  conditionals: ExperienceConditional[];
147
+ initializeOpen?: LogicRule | LogicValue;
148
+ actions?: ExperienceAction[];
136
149
  decide: LogicRule | undefined;
137
150
  edges: ExperienceEdge[];
138
151
  nodes: ExperienceNode[];
@@ -1 +1 @@
1
- {"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAIjE,QAAA,MAAM,uBAAuB,2BACF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;oBAIjB,OAAO,CAAC,UAAU,CAAC;kBAAY,UAAU;;CAgD5F,CAAA;AACD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACtF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE5C;AAED,QAAA,MAAM,4BAA4B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;2BAclD,UAAU,KAAG,IAAI;kBAgB1B,UAAU,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;wBArFa,OAAO,CAAC,UAAU,CAAC;sBAAY,UAAU;;;;;;;;;;;;;;;;;;;;;;;wBAAzC,OAAO,CAAC,UAAU,CAAC;sBAAY,UA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YAAY,EAAE,qBAAqB,EAAE,CAAA;IACrC,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACvC,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC5B,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;CAC5B;AAED,eAAO,MAAM,eAAe,GAC1B,YAAY,UAAU,EACtB,iBAAiB,oBAAoB,KACpC,IAEF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,EAAE,YAAY,eAAe,SAa/E,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,kBASzD,CAAA;AAsBD,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,EACd,YAAY,eAAe,KAC1B,OAAO,CAAC,OAAO,CAsBjB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { Experience, ExperienceNode, ExperienceStore, ExperienceTarget } from '../experience/experience';
1
+ import { Experience, ExperienceNode, ExperienceStep, ExperienceStore, ExperienceTarget } from '../experience/experience';
2
2
  import { Picked } from '../../picked';
3
3
  export type ExperienceInstance = ReturnType<typeof createExperienceInstance>;
4
4
  export type ExperienceInstanceIndex = ReturnType<typeof createExperienceInstanceIndex>;
@@ -11,12 +11,13 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, }:
11
11
  experience: ExperienceStore;
12
12
  target?: HTMLElement;
13
13
  }) => {
14
+ id: string;
14
15
  experienceId: string;
15
16
  configStore: import('effector').Store<{
16
- type: string;
17
17
  name: string;
18
18
  decisionLogic: import('../../logic-engine').LogicRule | undefined;
19
19
  targetSelectors: ExperienceTarget[];
20
+ initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
20
21
  }>;
21
22
  target: HTMLElement | undefined;
22
23
  componentStore: import('effector').Store<{
@@ -31,13 +32,13 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, }:
31
32
  toggleOpen: import('effector').EventCallable<void>;
32
33
  setOpen: import('effector').EventCallable<boolean>;
33
34
  treeStore: import('effector').Store<{
34
- steps: import('../..').ExperienceStep[];
35
+ steps: ExperienceStep[];
35
36
  nodes: ExperienceNode[];
36
37
  edges: import('../..').ExperienceEdge[];
37
38
  conditionals: import('../..').ExperienceConditional[];
38
39
  }>;
39
40
  currentNodeStore: import('effector').Store<ExperienceNode | null>;
40
- currentStepStore: import('effector').Store<import('../..').ExperienceStep | null>;
41
+ currentStepStore: import('effector').Store<ExperienceStep | null>;
41
42
  nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
42
43
  stepsToOriginStore: import('effector').Store<number[]>;
43
44
  stepsToLeafStore: import('effector').Store<number[]>;
@@ -52,12 +53,13 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
52
53
  }) => {
53
54
  spawn: (experience: ExperienceStore, target: HTMLElement) => void;
54
55
  getByExperienceId: (id: Experience["id"]) => import('effector').Store<{
56
+ id: string;
55
57
  experienceId: string;
56
58
  configStore: import('effector').Store<{
57
- type: string;
58
59
  name: string;
59
60
  decisionLogic: import('../../logic-engine').LogicRule | undefined;
60
61
  targetSelectors: ExperienceTarget[];
62
+ initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
61
63
  }>;
62
64
  target: HTMLElement | undefined;
63
65
  componentStore: import('effector').Store<{
@@ -72,13 +74,13 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
72
74
  toggleOpen: import('effector').EventCallable<void>;
73
75
  setOpen: import('effector').EventCallable<boolean>;
74
76
  treeStore: import('effector').Store<{
75
- steps: import('../..').ExperienceStep[];
77
+ steps: ExperienceStep[];
76
78
  nodes: ExperienceNode[];
77
79
  edges: import('../..').ExperienceEdge[];
78
80
  conditionals: import('../..').ExperienceConditional[];
79
81
  }>;
80
82
  currentNodeStore: import('effector').Store<ExperienceNode | null>;
81
- currentStepStore: import('effector').Store<import('../..').ExperienceStep | null>;
83
+ currentStepStore: import('effector').Store<ExperienceStep | null>;
82
84
  nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
83
85
  stepsToOriginStore: import('effector').Store<number[]>;
84
86
  stepsToLeafStore: import('effector').Store<number[]>;
@@ -88,12 +90,13 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
88
90
  stepsHistoryStore: import('effector').Store<import('../..').HistoryEntry[]>;
89
91
  }[]>;
90
92
  listStore: import('effector').Store<{
93
+ id: string;
91
94
  experienceId: string;
92
95
  configStore: import('effector').Store<{
93
- type: string;
94
96
  name: string;
95
97
  decisionLogic: import('../../logic-engine').LogicRule | undefined;
96
98
  targetSelectors: ExperienceTarget[];
99
+ initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
97
100
  }>;
98
101
  target: HTMLElement | undefined;
99
102
  componentStore: import('effector').Store<{
@@ -108,13 +111,13 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
108
111
  toggleOpen: import('effector').EventCallable<void>;
109
112
  setOpen: import('effector').EventCallable<boolean>;
110
113
  treeStore: import('effector').Store<{
111
- steps: import('../..').ExperienceStep[];
114
+ steps: ExperienceStep[];
112
115
  nodes: ExperienceNode[];
113
116
  edges: import('../..').ExperienceEdge[];
114
117
  conditionals: import('../..').ExperienceConditional[];
115
118
  }>;
116
119
  currentNodeStore: import('effector').Store<ExperienceNode | null>;
117
- currentStepStore: import('effector').Store<import('../..').ExperienceStep | null>;
120
+ currentStepStore: import('effector').Store<ExperienceStep | null>;
118
121
  nextReachableStepNodesStore: import('effector').Store<ExperienceNode[]>;
119
122
  stepsToOriginStore: import('effector').Store<number[]>;
120
123
  stepsToLeafStore: import('effector').Store<number[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"experience-instance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,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience-instance.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAEV,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,gBAAgB,EAGjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAoB1C,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC5E,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,oCAKhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,eAAe,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuZF,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,3 +1,4 @@
1
+ import { Picked } from '../../picked';
1
2
  export interface Feature {
2
3
  key: string;
3
4
  name: string;
@@ -37,12 +38,14 @@ export interface ResolvedFeatureBucket extends FeatureBaseBucket {
37
38
  };
38
39
  }
39
40
  export type FeatureBucket = UnresolvedFeatureBucket | ResolvedFeatureBucket;
40
- declare const createFeatureIndexFactory: () => {
41
+ declare const createFeatureIndexFactory: ({ client }: {
42
+ client: Picked;
43
+ }) => {
41
44
  register: (id: string, feature: Feature) => void;
42
45
  getByName: (name: string) => import('effector').Store<FeatureIndexItem | undefined>;
43
46
  listStore: import('effector').Store<FeatureBucket[]>;
44
47
  };
45
- export declare function createFeatureIndex(): ReturnType<typeof createFeatureIndexFactory>;
48
+ export declare function createFeatureIndex<T extends Parameters<typeof createFeatureIndexFactory>[0]>(params: T): ReturnType<typeof createFeatureIndexFactory>;
46
49
  export declare const setupFeature: (name: string, feature: Feature, features: FeaturesStore) => void;
47
50
  export {};
48
51
  //# sourceMappingURL=feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEjE,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MA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C,SAAS,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAC1F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAE9C;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,OAAO,EAAE,UAAU,aAAa,SAEnF,CAAA"}
@@ -9,79 +9,87 @@ export interface FieldBase {
9
9
  type: 'text' | 'number' | 'object' | 'boolean';
10
10
  multiple: boolean;
11
11
  required: boolean;
12
- defaultValue: FieldValue;
13
- placeholder: string | null;
14
- description: string | null;
15
- helpText: string | null;
16
- validation: LogicRule;
17
- policies: {
12
+ defaultValue?: FieldValue;
13
+ condition?: LogicRule;
14
+ placeholder?: string;
15
+ description?: string;
16
+ helpText?: string;
17
+ validation?: LogicRule;
18
+ policies?: {
18
19
  doNotTrackValue?: boolean;
19
20
  doNotStoreValue?: boolean;
20
21
  };
21
- options: {
22
+ options?: {
22
23
  id: string;
23
24
  label: string;
24
25
  value: PrimitiveFieldValue;
26
+ condition?: LogicRule;
25
27
  }[] | null;
26
28
  }
27
29
  export interface FieldTextSingular extends FieldBase {
28
30
  type: 'text';
29
31
  multiple: false;
30
- defaultValue: string | null;
31
- options: {
32
+ defaultValue?: string;
33
+ options?: {
32
34
  id: string;
33
35
  label: string;
34
36
  value: string;
37
+ condition?: LogicRule;
35
38
  }[] | null;
36
39
  }
37
40
  export interface FieldTextMultiple extends FieldBase {
38
41
  type: 'text';
39
42
  multiple: true;
40
- defaultValue: string[] | null;
41
- options: {
43
+ defaultValue?: string[];
44
+ options?: {
42
45
  id: string;
43
46
  label: string;
44
47
  value: string;
48
+ condition?: LogicRule;
45
49
  }[] | null;
46
50
  }
47
51
  export interface FieldNumberSingular extends FieldBase {
48
52
  type: 'number';
49
53
  multiple: false;
50
- defaultValue: number | null;
51
- options: {
54
+ defaultValue?: number;
55
+ options?: {
52
56
  id: string;
53
57
  label: string;
54
58
  value: number;
59
+ condition?: LogicRule;
55
60
  }[] | null;
56
61
  }
57
62
  export interface FieldNumberMultiple extends FieldBase {
58
63
  type: 'number';
59
64
  multiple: true;
60
- defaultValue: number[] | null;
61
- options: {
65
+ defaultValue?: number[];
66
+ options?: {
62
67
  id: string;
63
68
  label: string;
64
69
  value: number;
70
+ condition?: LogicRule;
65
71
  }[] | null;
66
72
  }
67
73
  export interface FieldBooleanSingular extends FieldBase {
68
74
  type: 'boolean';
69
75
  multiple: false;
70
- defaultValue: boolean | null;
71
- options: {
76
+ defaultValue?: boolean;
77
+ options?: {
72
78
  id: string;
73
79
  label: string;
74
80
  value: boolean;
81
+ condition?: LogicRule;
75
82
  }[] | null;
76
83
  }
77
84
  export interface FieldBooleanMultiple extends FieldBase {
78
85
  type: 'boolean';
79
86
  multiple: true;
80
- defaultValue: boolean[] | null;
81
- options: {
87
+ defaultValue?: boolean[];
88
+ options?: {
82
89
  id: string;
83
90
  label: string;
84
91
  value: boolean;
92
+ condition?: LogicRule;
85
93
  }[] | null;
86
94
  }
87
95
  export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldBooleanSingular | FieldBooleanMultiple;
@@ -1 +1 @@
1
- {"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"AAEA,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;AAClE,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,mBAAmB,EAAE,CAAA;AAIpE,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,Q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