@picked/client 0.0.12-next.14 → 0.0.12-next.2
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 +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/shopify/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +745 -150
- package/dist/esm/plugins/create-experience/index.js +45 -45
- package/dist/esm/plugins/shopify/index.js +36 -68
- package/dist/esm/plugins/single-page-app/index.js +3 -3
- package/dist/esm/plugins/web-components/index.js +1 -1
- package/dist/esm/plugins/window-object/index.js +1 -1
- package/dist/esm/server/index.js +7 -7
- package/dist/experience-instance-BBz99AXU.js +766 -0
- package/dist/experience-instance-DDsqvl4c.cjs +1 -0
- package/dist/{supports-DBMT17KZ.js → supports-BjhuLJ8z.js} +10 -10
- package/dist/types/entities/experience/experience.d.ts +5 -5
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +3 -3
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +2 -5
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/picked.d.ts +4 -4
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +3 -3
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/shopify/index.d.ts +0 -2
- package/dist/types/plugins/shopify/index.d.ts.map +1 -1
- package/dist/types/plugins/shopify/{predicates.d.ts → shopify.d.ts} +6 -20
- package/dist/types/plugins/shopify/shopify.d.ts.map +1 -0
- package/dist/types/plugins/shopify/{global-obj.d.ts → utils.d.ts} +1 -8
- package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
- package/dist/types/utils/events.d.ts +4 -10
- package/dist/types/utils/events.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/experience-instance-B2l_MG7I.cjs +0 -1
- package/dist/experience-instance-CeuHLrdL.js +0 -781
- package/dist/types/plugins/shopify/global-obj.d.ts.map +0 -1
- package/dist/types/plugins/shopify/picked-config.d.ts +0 -96
- package/dist/types/plugins/shopify/picked-config.d.ts.map +0 -1
- package/dist/types/plugins/shopify/predicates.d.ts.map +0 -1
- package/dist/user-session-D-l-VMTb.cjs +0 -1
- package/dist/user-session-Ht0ayuo5.js +0 -632
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const a=require("effector"),q=require("@withease/factories"),C=require("./supports-YvpQZxbh.cjs"),I=require("./logger-BsmHUUw1.cjs"),fe=require("./object-BbFTsGh3.cjs");function le(e){return typeof e=="number"&&!isNaN(e)}function R(e){return typeof e=="string"}function N(e){return Array.isArray(e)}function Z(e){return e instanceof Promise}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(le(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function O(e){return`${e}`}const de={"==":(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),s=m(t);if(r===void 0)return n<s;const c=m(r);return n<s&&s<c},"<=":(e,t,r)=>{const n=m(e),s=m(t);if(r===void 0)return n<=s;const c=m(r);return n<=s&&s<=c},"!!":async e=>await A(e),"!":async e=>!await A(e),"%":(e,t)=>m(e)%m(t),log:e=>(console.log(e),e),in:(e,t)=>t?R(t)?t.indexOf(O(e))!==-1:N(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(O).join(""),substr:(e,t,r)=>{const n=O(e),s=m(t);if(r===void 0)return n.substr(s);const c=m(r);if(c<0){const o=n.substr(s);return o.substr(0,o.length+c)}return n.substr(s,c)},"+":(...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)=>N(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=O(e);if(n===""||n===".")return this;const s=n.split(".");let c=this;for(const o of s){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(...e){const t=N(e[0])?e[0]:e,r=[];for(const n of t){const s=await g({var:n},this);(s===null||s==="")&&r.push(`${n}`)}return r},async missing_some(e,t){const r=await g({missing:t},this);if(!N(r)||!N(t))return[];const n=r.filter(R);return t.filter(R).length-n.length>=m(e)?[]:n},invoke(e){return typeof e!="function"?null:e()},regexp_matches(e,t){let r=e,n="";if(N(e)){const[c,o]=e;r=c,n=o}return!R(r)||!R(n)?!1:new RegExp(r,n).test(O(t))},throw(e){throw new Error(O(e))}};async function g(e,t){if(!e)return e;if(Z(e))return g(await e,t);if(N(e))return Promise.all(e.map(o=>g(o,t)));if(!J(e))return e;const r=pe(e);let n=r?e[r]??[]:[];switch(N(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await A(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 A(o))return o;return o}case"or":{let o=null;for(const u of n)if(o=await g(u,t),await A(o))return o;return o}case"map":{const o=await g(n[0],t);return N(o)?await Promise.all(o.map(u=>g(n[1],u))):[]}case"filter":{const o=await g(n[0],t);return N(o)?(await Promise.all(o.map(async d=>{const y=await A(await g(n[1],d));return{item:d,shouldInclude:y}}))).filter(({shouldInclude:d})=>d).map(({item:d})=>d):[]}case"reduce":{const o=await g(n[0],t);if(!N(o))return n.length>2?await g(n[2],t):null;const u=n[1];let y=n.length>2?await g(n[2],t):null;for(const b of o)y=await g(u,{current:b,accumulator:y});return y}case"all":{const o=await g(n[0],t);if(!N(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],t);if(!N(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],t);if(!N(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],t)}catch(o){return J(o)?await g(o,t):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const s=await Promise.all(n.map(o=>g(o,t))),c=r?de[r]:void 0;if(!c)throw new Error(`Unrecognized operation ${r}`);return c.apply(t,s)}async function A(e){return Z(e)?A(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function pe(e){return Object.keys(e)[0]}function ge(e){return!fe.isEmpty(e)}async function ee(e,t,r){const n=e.getStateSnapshot(),s=e.predicates.listStore.getState().reduce((u,d)=>({...u,[d.name]:()=>d.predicate(n)}),{}),c=e.features.listStore.getState().reduce((u,d)=>({...u,[d.id]:async()=>{const{bucket:y}=await d.getBucket();return y}}),{}),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:s,features:c};return await g(t,o)}function me(e){return!C.supportsWindow()||!C.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}function he(e){if(!C.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:"closed"})}function Se(){return new Promise((e,t)=>{if(!C.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function ye(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const H="picked-root",j="picked-target",we="picked-root";function Ee(e,t){return[...e,{selector:`${we}[experience-id="${t}"]`,placement:"replace"}].flatMap(n=>{const s=me(n.selector).filter(c=>!xe(c,t)&&!te(c,t));return{...n,elements:s}})}function Ne(e,t){return e.flatMap(r=>r.elements.map(n=>be(n,r.placement,t)))}function Ie(e,t){e.classList.add(j),e.classList.add(`${j}-${t}`)}function xe(e,t){return t?e.classList.contains(`${j}-${t}`):e.classList.contains(`${j}`)}function te(e,t){return t?e.classList.contains(`${H}-${t}`):e.classList.contains(H)}function ke(e){const t=document.createElement("div");return t.style.display="block",t.classList.add(H),t.classList.add(`${H}-${e}`),t}function be(e,t,r){let n;const s=ke(r);if(e instanceof Document)n=e.body.appendChild(s);else{switch(t){case"replace":e.replaceWith(s);break;case"before":e.before(s);break;case"after":e.after(s);break;case"prepend":e.prepend(s);break;default:e.append(s);break}n=s}return n}function ve(e){return e.type==="conditional"}function T(e){return e.type==="step"}function Ae(e){return e.type==="experience"}function Q(e){return e.type==="origin"}function Y(e){return e.type==="action"}const ne=(e,t,r,n,s=new Set)=>s.has(r.id)?[]:(s.add(r.id),T(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=e.find(d=>d.id===o.destinationNodeId);return u?ne(e,t,u,!1,s):[]})),$e=(e,t,r)=>ne(e,t,r,!0,new Set),re=(e,t,r,n,s=new Set)=>{if(s.has(r.id))return[-1,-1];s.add(r.id);const c=t.filter(d=>d.sourceNodeId===r.id);if(c.length===0)return[0,0];let o=1/0,u=-1/0;for(const d of c){const y=e.find(_=>_.id===d.destinationNodeId);if(!y)continue;const[b,w]=re(e,t,y,!1,new Set(s));b!==-1&&(o=Math.min(o,b+1),u=Math.max(u,w+1))}return o===1/0?[-1,-1]:[o,u]},Fe=(e,t,r)=>re(e,t,r,!0,new Set),oe=(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 s=t.filter(u=>u.destinationNodeId===r.id);if(s.length===0)return[-1,-1];let c=1/0,o=-1/0;for(const u of s){const d=e.find(w=>w.id===u.sourceNodeId);if(!d)continue;const[y,b]=oe(e,t,d,new Set(n));y!==-1&&(c=Math.min(c,y+1),o=Math.max(o,b+1))}return c===1/0?[-1,-1]:[c,o]},Be=(e,t,r)=>oe(e,t,r,new Set),ie=e=>e.find(r=>r.type==="origin")||null,V=(e,t,r)=>{if(!e)return ie(t);const n=r.find(c=>c.sourceNodeId===e.id);if(!n)return null;const s=t.find(c=>c.id===n.destinationNodeId);return s||null};async function _e(e,t,r,n){const s=e?"true":"false",c=n.find(o=>o.sourceNodeHandle===s&&o.sourceNodeId===t);return r.find(o=>o.id===(c==null?void 0:c.destinationNodeId))}const W=a.createDomain("experience-instance"),Le=q.createFactory(({client:e,experience:t,target:r})=>{const n=a.createEvent(),s=a.createEvent(),c=a.createEvent(),o=a.createEvent(),u=t.componentStore,d=W.store("transitioning"),y=e.history.entriesStore.map(i=>i.filter(f=>f.experienceId===t.id)),b=y.map(i=>i.filter(f=>T(f.node))),w=y.map(i=>{var f;return((f=i[i.length-1])==null?void 0:f.node)||null}),_=a.attach({source:t.treeStore,effect:async({nodes:i,edges:f},l)=>{if(!l||!Y(l))return;const E=l.action;if(!E){I.logger("warn",`Action node ${l.id} has no action name`);return}const L=e.actions.getByName(E).getState();if(!L){I.logger("warn",`Action '${E}' not registered on client`);const x=f.find(S=>S.sourceNodeId===l.id&&S.sourceNodeHandle==="false");return x?i.find(S=>S.id===x.destinationNodeId):null}if(typeof L.action!="function"){I.logger("warn",`Action '${E}' is not a function`);const x=f.find(S=>S.sourceNodeId===l.id&&S.sourceNodeHandle==="false");return x?i.find(S=>S.id===x.destinationNodeId):null}try{I.logger("info",`Executing action: ${E}`),await L.action();const x=f.find(k=>k.sourceNodeId===l.id&&k.sourceNodeHandle==="true");if(!x)return I.logger("warn",`No 'true' edge found for action node ${l.id}`),null;const S=i.find(k=>k.id===x.destinationNodeId);return I.logger("info",`Action '${E}' succeeded, moving to node ${S==null?void 0:S.id}`),S||null}catch(x){I.logger("warn",`Action '${E}' failed:`,x);const S=f.find(P=>P.sourceNodeId===l.id&&P.sourceNodeHandle==="false");if(!S)return I.logger("warn",`No 'false' edge found for action node ${l.id}`),null;const k=i.find(P=>P.id===S.destinationNodeId);return I.logger("info",`Action '${E}' failed, moving to node ${k==null?void 0:k.id}`),k||null}}}),B=a.combine(t.treeStore,w,({steps:i},f)=>i.find(l=>f&&T(f)&&l.id===f.stepId)||null),p=a.combine(t.treeStore,w,({nodes:i,edges:f},l)=>l?$e(i,f,l):[]),h=a.combine(t.treeStore,w,({nodes:i,edges:f},l)=>l?Be(i,f,l):[-1,-1]),v=a.combine(t.treeStore,w,({nodes:i,edges:f},l)=>l?Fe(i,f,l):[-1,-1]),$=W.store(!0),F=a.createApi($,{open:()=>!0,close:()=>!1,toggle:i=>!i,set:(i,f)=>f});a.sample({source:$,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:t}))}),a.sample({source:$,filter:i=>!i,target:e.eventBus.prepend(()=>({type:"experience_close",experience:t}))});const M=a.createEffect(async()=>{e.history.back({experienceId:t.id})}),ce=a.attach({source:t.treeStore,effect:async(i,f)=>{const l=i.nodes.find(E=>T(E)&&E.stepId===f);l&&e.history.push({experienceId:t.id,node:l})}}),z=a.attach({source:w,effect:i=>{}}),G=a.attach({source:t.treeStore,effect:async({nodes:i})=>ie(i)}),K=a.attach({source:t.treeStore,effect:async({nodes:i,edges:f},l)=>V(l,i,f)}),U=a.attach({source:t.treeStore,effect:async({nodes:i,edges:f,conditionals:l},E)=>{if(!E)return;const L=l.find(k=>k.id===E.conditionalId);if(!L)return;const x=E.id,S=await ee(e,L.condition);return _e(!!S,x,i,f)}}),ae=a.createEffect(i=>{if(i)return e.launchExperienceById(i.experienceId)}),X=a.attach({source:[w,t.treeStore],effect:async([i,{nodes:f,edges:l}])=>V(i,f,l)}),D=a.attach({source:[w,t.treeStore],effect:async([i,{nodes:f,edges:l}])=>V(i,f,l)}),ue=a.createEffect(i=>{e.history.push({experienceId:t.id,node:i})});return a.split({source:w,match:i=>i?ve(i)?"condition":T(i)?"step":Ae(i)?"launchExperience":Q(i)?"origin":Y(i)?"action":"other":"none",cases:{none:G,origin:K,condition:U,step:z,launchExperience:ae,action:_,__:a.createEvent()}}),a.sample({clock:[U.doneData,K.doneData,G.doneData,D.doneData,X.doneData,_.doneData],filter:Boolean,target:ue}),a.sample({clock:s,target:D}),a.sample({clock:s,source:B,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit",step:i,experience:t}))}),a.sample({clock:D.done,source:B,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit_success",step:i,experience:t}))}),a.sample({clock:D.fail,source:B,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit_error",step:i,experience:t}))}),a.sample({clock:c,target:M}),a.sample({clock:o,target:ce}),a.sample({source:a.combine([U.pending,K.pending,G.pending,D.pending]),fn:i=>i.some(Boolean)?"transitioning":"ready",target:d}),a.sample({clock:z.doneData,source:B,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_enter",step:i,experience:t}))}),a.sample({source:w,clock:n,filter:i=>i?Q(i):!0,target:X}),n(),{id:Math.random().toString(36).substring(7),experienceId:t.id,configStore:t.configStore,target:r,componentStore:u,stateStore:d,isOpenStore:$,open:F.open,close:F.close,toggleOpen:F.toggle,setOpen:F.set,treeStore:t.treeStore,currentNodeStore:w,currentStepStore:B,nextReachableStepNodesStore:p,stepsToOriginStore:h,stepsToLeafStore:v,goToNextStep:s,goToPreviousStep:c,goToStepById:o,stepsHistoryStore:b}});function se(e){return q.invoke(Le,e)}const Oe=q.createFactory(({client:e})=>{const t=W.store({}),r=a.createEvent(),n=a.createEvent(),s=a.createEvent(),c=a.createApi(t,{register(p,h){const v=[...p[h.experienceId]??[]];return v.push(h),{...p,[h.experienceId]:v}},unregister(p,h){var F;const v=h.experienceId,$=(F=p[v])==null?void 0:F.filter(M=>M!==h);return{...p,[v]:$??[]}}}),o=a.createEffect(({experience:p,target:h})=>se({client:e,experience:p,target:h})),u=a.createEffect(p=>{c.register(p)}),d=a.createEffect(p=>{p.target&&ye(p.target,()=>{s(p)})}),y=a.createEffect(p=>{c.unregister(p)}),b=a.createEffect(p=>{const h=p.componentStore.getState();if(!h){I.logger("warn","No app component registered. Skipping init.");return}const v=h.frameworkStore.getState();if(!v){I.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const $=p.target;if(!$){I.logger("error",`No target element registered for experience '${p.experienceId}'. Skipping rendering.`);return}const F=he($);try{v.render(F,h.component,e,p)}catch(M){I.logger("error",M)}});a.sample({clock:r,target:o}),a.sample({clock:s,target:y}),a.sample({clock:o.doneData,target:[u,d,n]}),a.sample({clock:o.doneData,target:e.eventBus.prepend(p=>({type:"experience_initialized",experienceInstance:p}))}),a.sample({clock:n,target:b});function w(p,h){r({experience:p,target:h})}const _=t.map(p=>Object.values(p).flat());function B(p){return t.map(h=>h[p]||[],{skipVoid:!1})}return{spawn:w,getByExperienceId:B,listStore:_}});function Te(e){return q.invoke(Oe,e)}exports.createAppHosts=Ne;exports.createExperienceInstance=se;exports.createExperienceInstanceIndex=Te;exports.domInteractive=Se;exports.evaluateRuleLogic=ee;exports.getTargetElements=Ee;exports.isPickedRoot=te;exports.isRulesLogic=ge;exports.isStepNode=T;exports.tagTargetElement=Ie;
|
|
@@ -81,15 +81,15 @@ function h() {
|
|
|
81
81
|
export {
|
|
82
82
|
t as G,
|
|
83
83
|
l as a,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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
94
|
p as s
|
|
95
95
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AdaptedComponent } from '../component/component';
|
|
2
2
|
import { Picked } from '../../picked';
|
|
3
|
-
import { LogicRule
|
|
3
|
+
import { LogicRule } 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;
|
|
13
14
|
name: string;
|
|
14
15
|
decisionLogic: LogicRule | undefined;
|
|
15
16
|
targetSelectors: ExperienceTarget[];
|
|
16
|
-
initializeOpenLogic: LogicValue | LogicRule;
|
|
17
17
|
}>;
|
|
18
18
|
treeStore: import('effector').Store<{
|
|
19
19
|
steps: ExperienceStep[];
|
|
@@ -40,10 +40,10 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
40
40
|
getById: (id: Experience["id"]) => import('effector').Store<{
|
|
41
41
|
id: string;
|
|
42
42
|
configStore: import('effector').Store<{
|
|
43
|
+
type: string;
|
|
43
44
|
name: string;
|
|
44
45
|
decisionLogic: LogicRule | undefined;
|
|
45
46
|
targetSelectors: ExperienceTarget[];
|
|
46
|
-
initializeOpenLogic: LogicValue | LogicRule;
|
|
47
47
|
}>;
|
|
48
48
|
treeStore: import('effector').Store<{
|
|
49
49
|
steps: ExperienceStep[];
|
|
@@ -65,10 +65,10 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
65
65
|
listStore: import('effector').Store<{
|
|
66
66
|
id: string;
|
|
67
67
|
configStore: import('effector').Store<{
|
|
68
|
+
type: string;
|
|
68
69
|
name: string;
|
|
69
70
|
decisionLogic: LogicRule | undefined;
|
|
70
71
|
targetSelectors: ExperienceTarget[];
|
|
71
|
-
initializeOpenLogic: LogicValue | LogicRule;
|
|
72
72
|
}>;
|
|
73
73
|
treeStore: import('effector').Store<{
|
|
74
74
|
steps: ExperienceStep[];
|
|
@@ -142,9 +142,9 @@ export interface ExperienceTarget {
|
|
|
142
142
|
export interface Experience {
|
|
143
143
|
id: string;
|
|
144
144
|
name: string;
|
|
145
|
+
type: string;
|
|
145
146
|
component?: AdaptedComponent;
|
|
146
147
|
conditionals: ExperienceConditional[];
|
|
147
|
-
initializeOpen?: LogicRule | LogicValue;
|
|
148
148
|
actions?: ExperienceAction[];
|
|
149
149
|
decide: LogicRule | undefined;
|
|
150
150
|
edges: ExperienceEdge[];
|
|
@@ -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,
|
|
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,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Ac,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;AA0BD,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,EACd,YAAY,eAAe,KAC1B,OAAO,CAAC,OAAO,CA4BjB,CAAA"}
|
|
@@ -14,10 +14,10 @@ declare const createExperienceInstanceFactory: ({ client, experience, target, }:
|
|
|
14
14
|
id: string;
|
|
15
15
|
experienceId: string;
|
|
16
16
|
configStore: import('effector').Store<{
|
|
17
|
+
type: string;
|
|
17
18
|
name: string;
|
|
18
19
|
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
19
20
|
targetSelectors: ExperienceTarget[];
|
|
20
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
21
21
|
}>;
|
|
22
22
|
target: HTMLElement | undefined;
|
|
23
23
|
componentStore: import('effector').Store<{
|
|
@@ -56,10 +56,10 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
|
|
|
56
56
|
id: string;
|
|
57
57
|
experienceId: string;
|
|
58
58
|
configStore: import('effector').Store<{
|
|
59
|
+
type: string;
|
|
59
60
|
name: string;
|
|
60
61
|
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
61
62
|
targetSelectors: ExperienceTarget[];
|
|
62
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
63
63
|
}>;
|
|
64
64
|
target: HTMLElement | undefined;
|
|
65
65
|
componentStore: import('effector').Store<{
|
|
@@ -93,10 +93,10 @@ declare const createExperienceInstanceIndexFactory: ({ client }: {
|
|
|
93
93
|
id: string;
|
|
94
94
|
experienceId: string;
|
|
95
95
|
configStore: import('effector').Store<{
|
|
96
|
+
type: string;
|
|
96
97
|
name: string;
|
|
97
98
|
decisionLogic: import('../../logic-engine').LogicRule | undefined;
|
|
98
99
|
targetSelectors: ExperienceTarget[];
|
|
99
|
-
initializeOpenLogic: import('../../logic-engine').LogicValue | import('../../logic-engine').LogicRule;
|
|
100
100
|
}>;
|
|
101
101
|
target: HTMLElement | undefined;
|
|
102
102
|
componentStore: import('effector').Store<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"experience-instance.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience-instance/experience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{ Picked } from '../../picked';
|
|
2
1
|
export interface Feature {
|
|
3
2
|
key: string;
|
|
4
3
|
name: string;
|
|
@@ -38,14 +37,12 @@ export interface ResolvedFeatureBucket extends FeatureBaseBucket {
|
|
|
38
37
|
};
|
|
39
38
|
}
|
|
40
39
|
export type FeatureBucket = UnresolvedFeatureBucket | ResolvedFeatureBucket;
|
|
41
|
-
declare const createFeatureIndexFactory: (
|
|
42
|
-
client: Picked;
|
|
43
|
-
}) => {
|
|
40
|
+
declare const createFeatureIndexFactory: () => {
|
|
44
41
|
register: (id: string, feature: Feature) => void;
|
|
45
42
|
getByName: (name: string) => import('effector').Store<FeatureIndexItem | undefined>;
|
|
46
43
|
listStore: import('effector').Store<FeatureBucket[]>;
|
|
47
44
|
};
|
|
48
|
-
export declare function createFeatureIndex
|
|
45
|
+
export declare function createFeatureIndex(): ReturnType<typeof createFeatureIndexFactory>;
|
|
49
46
|
export declare const setupFeature: (name: string, feature: Feature, features: FeaturesStore) => void;
|
|
50
47
|
export {};
|
|
51
48
|
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../src/entities/feature/feature.ts"],"names":[],"mappings":"
|
|
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,MAAM,CAAA;IACV,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;IAChE,UAAU,EAAE,KAAK,CAAA;IACjB,SAAS,EAAE,MAAM,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,CAAA;CACnE;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,UAAU,EAAE,IAAI,CAAA;IAChB,SAAS,EAAE,MAAM;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAC1D;AAED,MAAM,MAAM,aAAa,GAAG,uBAAuB,GAAG,qBAAqB,CAAA;AAK3E,QAAA,MAAM,yBAAyB;mBAkBP,MAAM,WAAW,OAAO,KAAG,IAAI;sBA0K5B,MAAM;;CAS/B,CAAA;AAEF,wBAAgB,kBAAkB,IAAI,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAEjF;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,OAAO,EAAE,UAAU,aAAa,SAEnF,CAAA"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -56,10 +56,10 @@ export declare class Picked {
|
|
|
56
56
|
id: string;
|
|
57
57
|
experienceId: string;
|
|
58
58
|
configStore: import('effector').Store<{
|
|
59
|
+
type: string;
|
|
59
60
|
name: string;
|
|
60
61
|
decisionLogic: import('./logic-engine').LogicRule | undefined;
|
|
61
62
|
targetSelectors: import('.').ExperienceTarget[];
|
|
62
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | import('./logic-engine').LogicRule;
|
|
63
63
|
}>;
|
|
64
64
|
target: HTMLElement | undefined;
|
|
65
65
|
componentStore: import('effector').Store<{
|
|
@@ -93,10 +93,10 @@ export declare class Picked {
|
|
|
93
93
|
id: string;
|
|
94
94
|
experienceId: string;
|
|
95
95
|
configStore: import('effector').Store<{
|
|
96
|
+
type: string;
|
|
96
97
|
name: string;
|
|
97
98
|
decisionLogic: import('./logic-engine').LogicRule | undefined;
|
|
98
99
|
targetSelectors: import('.').ExperienceTarget[];
|
|
99
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | import('./logic-engine').LogicRule;
|
|
100
100
|
}>;
|
|
101
101
|
target: HTMLElement | undefined;
|
|
102
102
|
componentStore: import('effector').Store<{
|
|
@@ -132,10 +132,10 @@ export declare class Picked {
|
|
|
132
132
|
getById: (id: Experience["id"]) => import('effector').Store<{
|
|
133
133
|
id: string;
|
|
134
134
|
configStore: import('effector').Store<{
|
|
135
|
+
type: string;
|
|
135
136
|
name: string;
|
|
136
137
|
decisionLogic: import('./logic-engine').LogicRule | undefined;
|
|
137
138
|
targetSelectors: import('.').ExperienceTarget[];
|
|
138
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | import('./logic-engine').LogicRule;
|
|
139
139
|
}>;
|
|
140
140
|
treeStore: import('effector').Store<{
|
|
141
141
|
steps: import('.').ExperienceStep[];
|
|
@@ -157,10 +157,10 @@ export declare class Picked {
|
|
|
157
157
|
listStore: import('effector').Store<{
|
|
158
158
|
id: string;
|
|
159
159
|
configStore: import('effector').Store<{
|
|
160
|
+
type: string;
|
|
160
161
|
name: string;
|
|
161
162
|
decisionLogic: import('./logic-engine').LogicRule | undefined;
|
|
162
163
|
targetSelectors: import('.').ExperienceTarget[];
|
|
163
|
-
initializeOpenLogic: import('./logic-engine').LogicValue | import('./logic-engine').LogicRule;
|
|
164
164
|
}>;
|
|
165
165
|
treeStore: import('effector').Store<{
|
|
166
166
|
steps: import('.').ExperienceStep[];
|
|
@@ -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,EAAE,KAAK,iBAAiB,EAAe,MAAM,0BAA0B,CAAA;AAC3F,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EAGtB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAA;AAGvC,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAA;AAE/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAMzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAEnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAOtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAGnD,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ,CAAC,MAAM,0FAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAE7C,OAAO,UAAQ;IAEf,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAEhD,SAAgB,QAAQ,gEAAmB;IAC3C,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC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AAiB,CAAC,IAAI,EAAE,MAAM,mBAAmB,EAAE,SAAS,EAAE,gBAAgB;IAI9E,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIpC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAI9C,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS;IAIpD,aAAa,CAAC,KAAK,EAAE,KAAK;IAI1B,cAAc,CAAC,IAAI,EAAE,MAAM,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;CAGzF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionNode, Experience, ExperienceConditional, ExperienceEdge, ExperienceNode, ExperienceStep, ExperienceTarget } from '../../entities/experience/experience';
|
|
2
2
|
import { AdaptedComponent } from '../../entities/component/component';
|
|
3
|
-
import { LogicRule
|
|
3
|
+
import { LogicRule } from '../../logic-engine';
|
|
4
4
|
import { Field, FieldBooleanMultiple, FieldBooleanSingular, FieldNumberMultiple, FieldNumberSingular, FieldTextMultiple, FieldTextSingular } from '../../entities/field/field';
|
|
5
5
|
import { Serialized } from './serialization';
|
|
6
6
|
export interface Nodeable {
|
|
@@ -136,9 +136,9 @@ export type SerializableField = {
|
|
|
136
136
|
export interface SerializableExperience {
|
|
137
137
|
id: string;
|
|
138
138
|
component?: AdaptedComponent;
|
|
139
|
+
type: string;
|
|
139
140
|
name: string;
|
|
140
141
|
decide?: LogicRule;
|
|
141
|
-
initializeOpen?: LogicRule | LogicValue;
|
|
142
142
|
targets: ExperienceTarget[];
|
|
143
143
|
steps: SerializableStep[];
|
|
144
144
|
nodes: SerializableNode[];
|
|
@@ -164,9 +164,9 @@ export interface CreateExperienceOptions {
|
|
|
164
164
|
id: string;
|
|
165
165
|
name: string;
|
|
166
166
|
decide: LogicRule;
|
|
167
|
-
initializeOpen?: LogicRule | LogicValue;
|
|
168
167
|
targets: ExperienceTarget[];
|
|
169
168
|
component?: AdaptedComponent;
|
|
169
|
+
type: string;
|
|
170
170
|
}
|
|
171
171
|
export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
|
|
172
172
|
addField: (fieldOrFieldOptions: CreateFieldOptions | SerializableField) => void;
|
|
@@ -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,
|
|
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,MAAM,oBAAoB,CAAA;AACnD,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oB,wBAAwB,EAC5C,YAAY,sBAAsB,KACjC,uBA0CF,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,cAAc,kBAAkB,KAAG,iBAiN9D,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,KAAG,sBAsLtE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
1
|
import { StateSnapshot } from '../../utils/state-snaphot';
|
|
2
2
|
export declare const evaluatePathname: (regexPattern: RegExp, location?: StateSnapshot["location"]) => boolean;
|
|
3
|
-
|
|
4
|
-
* Evaluate handle from path using regex pattern
|
|
5
|
-
*
|
|
6
|
-
* @param regexPattern Regex pattern to extract handle
|
|
7
|
-
* @param location Location object containing pathname
|
|
8
|
-
* @returns handle string or undefined
|
|
9
|
-
*/
|
|
10
|
-
export declare const evaluateHandleByPath: (regexPattern: RegExp, location?: StateSnapshot["location"]) => string | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Evaluate handle from pickedConfig based on type
|
|
13
|
-
*
|
|
14
|
-
* @param type page type: 'product' | 'collection'
|
|
15
|
-
* @returns handle string or undefined
|
|
16
|
-
*/
|
|
17
|
-
export declare const evaluateHandleByType: (type: "product" | "collection") => string | false;
|
|
3
|
+
export declare const evaluateHandle: (regexPattern: RegExp, location?: StateSnapshot["location"]) => string | undefined;
|
|
18
4
|
interface PredicateArgs {
|
|
19
5
|
location?: StateSnapshot['location'];
|
|
20
6
|
}
|
|
21
7
|
export declare const shopifyPredicates: {
|
|
22
8
|
'is-page': ({ location }: PredicateArgs) => boolean;
|
|
23
9
|
'get-page-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
24
|
-
'is-product-page': () => boolean;
|
|
25
|
-
'get-product-handle': () => string |
|
|
26
|
-
'is-collection-page': () => boolean;
|
|
27
|
-
'get-collection-handle': () => string |
|
|
10
|
+
'is-product-page': ({ location }: PredicateArgs) => boolean;
|
|
11
|
+
'get-product-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
12
|
+
'is-collection-page': ({ location }: PredicateArgs) => boolean;
|
|
13
|
+
'get-collection-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
28
14
|
'is-blog-page': ({ location }: PredicateArgs) => boolean;
|
|
29
15
|
'get-blog-handle': ({ location }: PredicateArgs) => string | undefined;
|
|
30
16
|
'is-article-page': ({ location }: PredicateArgs) => boolean;
|
|
@@ -39,4 +25,4 @@ export declare const shopifyPredicates: {
|
|
|
39
25
|
'is-homepage': ({ location }: PredicateArgs) => boolean;
|
|
40
26
|
};
|
|
41
27
|
export {};
|
|
42
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=shopify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shopify.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/shopify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAoB9D,eAAO,MAAM,gBAAgB,GAC3B,cAAc,MAAM,EACpB,WAAW,aAAa,CAAC,UAAU,CAAC,KACnC,OAMF,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,cAAc,MAAM,EAAE,WAAW,aAAa,CAAC,UAAU,CAAC,uBAOxF,CAAA;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CACrC;AAED,eAAO,MAAM,iBAAiB;8BAEF,aAAa;sCACL,aAAa;sCAEb,aAAa;yCACV,aAAa;yCAEb,aAAa;4CACV,aAAa;mCAGtB,aAAa;sCACV,aAAa;sCAEb,aAAa;yCACV,aAAa;wCAEd,aAAa;2CACV,aAAa;sCAElB,aAAa;oCACf,aAAa;uCACV,aAAa;mCAGjB,aAAa;uCAET,aAAa;kCAElB,aAAa;CAC5C,CAAA"}
|
|
@@ -7,16 +7,9 @@ declare global {
|
|
|
7
7
|
analytics?: {
|
|
8
8
|
publish?: (event: string, payload: EventPayload) => void;
|
|
9
9
|
};
|
|
10
|
-
shop: string;
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
|
-
export declare function getShopify(): {
|
|
15
|
-
analytics?: {
|
|
16
|
-
publish?: (event: string, payload: EventPayload) => void;
|
|
17
|
-
};
|
|
18
|
-
shop: string;
|
|
19
|
-
} | undefined;
|
|
20
13
|
export declare function supportsShopifyAnalytics(w: Window): w is Window & {
|
|
21
14
|
Shopify: {
|
|
22
15
|
analytics: {
|
|
@@ -25,4 +18,4 @@ export declare function supportsShopifyAnalytics(w: Window): w is Window & {
|
|
|
25
18
|
};
|
|
26
19
|
};
|
|
27
20
|
export {};
|
|
28
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/plugins/shopify/utils.ts"],"names":[],"mappings":"AAAA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GACR,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,YAAY,GACZ,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,CAAC,CAAA;CACvE;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,OAAO,CAAC,EAAE;YACR,SAAS,CAAC,EAAE;gBACV,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;aACzD,CAAA;SACF,CAAA;KACF;CACF;AAED,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG;IACjE,OAAO,EAAE;QAAE,SAAS,EAAE;YAAE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;SAAE,CAAA;KAAE,CAAA;CACpF,CAEA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ValidationError } from '../entities/response/response';
|
|
2
2
|
import { ExperienceStep, ExperienceStore } from '../entities/experience/experience';
|
|
3
3
|
import { ExperienceInstance } from '../entities/experience-instance/experience-instance';
|
|
4
|
-
import { ResolvedFeature } from '../entities/feature/feature';
|
|
5
4
|
export interface FormPayload {
|
|
6
5
|
id: string;
|
|
7
6
|
title: string;
|
|
@@ -11,9 +10,6 @@ export interface PayloadMap {
|
|
|
11
10
|
experience_initialized: {
|
|
12
11
|
experienceInstance: ExperienceInstance;
|
|
13
12
|
};
|
|
14
|
-
feature_decide: {
|
|
15
|
-
feature: ResolvedFeature;
|
|
16
|
-
};
|
|
17
13
|
initialized: {
|
|
18
14
|
version: string;
|
|
19
15
|
};
|
|
@@ -51,12 +47,12 @@ export interface PayloadMap {
|
|
|
51
47
|
};
|
|
52
48
|
form_submit: {
|
|
53
49
|
form: FormPayload;
|
|
54
|
-
experience
|
|
50
|
+
experience?: ExperienceStore;
|
|
55
51
|
step?: ExperienceStep;
|
|
56
52
|
};
|
|
57
53
|
form_submit_success: {
|
|
58
54
|
form: FormPayload;
|
|
59
|
-
experience
|
|
55
|
+
experience?: ExperienceStore;
|
|
60
56
|
step?: ExperienceStep;
|
|
61
57
|
};
|
|
62
58
|
form_submit_error: {
|
|
@@ -64,22 +60,20 @@ export interface PayloadMap {
|
|
|
64
60
|
exception: {
|
|
65
61
|
reason: ValidationError[];
|
|
66
62
|
};
|
|
67
|
-
experience
|
|
63
|
+
experience?: ExperienceStore;
|
|
68
64
|
step?: ExperienceStep;
|
|
69
65
|
};
|
|
70
66
|
field_validation_error: {
|
|
71
67
|
exception: {
|
|
72
68
|
reason: ValidationError[];
|
|
73
69
|
};
|
|
74
|
-
experience: ExperienceInstance;
|
|
75
|
-
step?: ExperienceStep;
|
|
76
70
|
};
|
|
77
71
|
}
|
|
78
72
|
export type PickedEventType = keyof PayloadMap;
|
|
79
73
|
export type EventBusPayload = {
|
|
80
74
|
[K in PickedEventType]: {
|
|
81
75
|
type: K;
|
|
82
|
-
} & (PayloadMap[K] extends never ?
|
|
76
|
+
} & (PayloadMap[K] extends never ? {} : PayloadMap[K]);
|
|
83
77
|
}[PickedEventType];
|
|
84
78
|
export declare const createEventBus: () => import('effector').EventCallable<EventBusPayload>;
|
|
85
79
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/utils/events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAA;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,sBAAsB,EAAE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QAC5B,IAAI,CAAC,EAAE,cAAc,CAAA;KACtB,CAAA;IACD,sBAAsB,EAAE;QACtB,SAAS,EAAE;YAAE,MAAM,EAAE,eAAe,EAAE,CAAA;SAAE,CAAA;KACzC,CAAA;CACF;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,UAAU,CAAA;AAE9C,MAAM,MAAM,eAAe,GAAG;KAC3B,CAAC,IAAI,eAAe,GAAG;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,KAAK,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CACzF,CAAC,eAAe,CAAC,CAAA;AAElB,eAAO,MAAM,cAAc,yDAAuC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("effector"),q=require("@withease/factories"),C=require("./supports-YvpQZxbh.cjs"),N=require("./logger-BsmHUUw1.cjs"),ge=require("./object-BbFTsGh3.cjs");function me(e){return typeof e=="number"&&!isNaN(e)}function R(e){return typeof e=="string"}function E(e){return Array.isArray(e)}function ne(e){return e instanceof Promise}function Z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(me(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function T(e){return`${e}`}const he={"==":(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),a=m(t);if(r===void 0)return n<a;const c=m(r);return n<a&&a<c},"<=":(e,t,r)=>{const n=m(e),a=m(t);if(r===void 0)return n<=a;const c=m(r);return n<=a&&a<=c},"!!":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?R(t)?t.indexOf(T(e))!==-1:E(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(T).join(""),substr:(e,t,r)=>{const n=T(e),a=m(t);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)},"+":(...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=T(e);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(...e){const t=E(e[0])?e[0]:e,r=[];for(const n of t){const a=await g({var:n},this);(a===null||a==="")&&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(R);return t.filter(R).length-n.length>=m(e)?[]:n},invoke(e){return typeof e!="function"?null:e()},regexp_matches(e,t){let r=e,n="";if(E(e)){const[c,o]=e;r=c,n=o}return!R(r)||!R(n)?!1:new RegExp(r,n).test(T(t))},throw(e){throw new Error(T(e))}};async function g(e,t){if(!e)return e;if(ne(e))return g(await e,t);if(E(e))return Promise.all(e.map(o=>g(o,t)));if(!Z(e))return e;const r=Se(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 y=await B(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],t);if(!E(o))return n.length>2?await g(n[2],t):null;const u=n[1];let y=n.length>2?await g(n[2],t):null;for(const k of o)y=await g(u,{current:k,accumulator:y});return y}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 Z(o)?await g(o,t):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const a=await Promise.all(n.map(o=>g(o,t))),c=r?he[r]:void 0;if(!c)throw new Error(`Unrecognized operation ${r}`);return c.apply(t,a)}async function B(e){return ne(e)?B(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function Se(e){return Object.keys(e)[0]}function re(e){return!ge.isEmpty(e)}async function W(e,t,r){const n=e.getStateSnapshot(),a=e.predicates.listStore.getState().reduce((u,p)=>({...u,[p.name]:()=>p.predicate(n)}),{}),c=e.features.listStore.getState().reduce((u,p)=>({...u,[p.id]:async()=>{const{bucket:y}=await p.getBucket();return y}}),{}),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:a,features:c};return await g(t,o)}function ye(e){return!C.supportsWindow()||!C.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}function we(e){if(!C.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:"closed"})}function Ee(){return new Promise((e,t)=>{if(!C.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function Ne(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const H="picked-root",j="picked-target",Ie="picked-root";function xe(e,t){return[...e,{selector:`${Ie}[experience-id="${t}"]`,placement:"replace"}].flatMap(n=>{const a=ye(n.selector).filter(c=>!be(c,t)&&!oe(c,t));return{...n,elements:a}})}function ke(e,t){return e.flatMap(r=>r.elements.map(n=>Be(n,r.placement,t)))}function ve(e,t){e.classList.add(j),e.classList.add(`${j}-${t}`)}function be(e,t){return t?e.classList.contains(`${j}-${t}`):e.classList.contains(`${j}`)}function oe(e,t){return t?e.classList.contains(`${H}-${t}`):e.classList.contains(H)}function Ae(e){const t=document.createElement("div");return t.style.display="block",t.classList.add(H),t.classList.add(`${H}-${e}`),t}function Be(e,t,r){let n;const a=Ae(r);if(e instanceof Document)n=e.body.appendChild(a);else{switch(t){case"replace":e.replaceWith(a);break;case"before":e.before(a);break;case"after":e.after(a);break;case"prepend":e.prepend(a);break;default:e.append(a);break}n=a}return n}function Fe(e){return e.type==="conditional"}function M(e){return e.type==="step"}function $e(e){return e.type==="experience"}function ee(e){return e.type==="origin"}function te(e){return e.type==="action"}const se=(e,t,r,n,a=new Set)=>a.has(r.id)?[]:(a.add(r.id),M(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=e.find(p=>p.id===o.destinationNodeId);return u?se(e,t,u,!1,a):[]})),Oe=(e,t,r)=>se(e,t,r,!0,new Set),ie=(e,t,r,n,a=new Set)=>{if(a.has(r.id))return[-1,-1];a.add(r.id);const c=t.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=e.find(L=>L.id===p.destinationNodeId);if(!y)continue;const[k,F]=ie(e,t,y,!1,new Set(a));k!==-1&&(o=Math.min(o,k+1),u=Math.max(u,F+1))}return o===1/0?[-1,-1]:[o,u]},_e=(e,t,r)=>ie(e,t,r,!0,new Set),ae=(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 a=t.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=e.find(F=>F.id===u.sourceNodeId);if(!p)continue;const[y,k]=ae(e,t,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]},Te=(e,t,r)=>ae(e,t,r,new Set),ce=e=>e.find(r=>r.type==="origin")||null,V=(e,t,r)=>{if(!e)return ce(t);const n=r.find(c=>c.sourceNodeId===e.id);if(!n)return null;const a=t.find(c=>c.id===n.destinationNodeId);return a||null};async function Me(e,t,r,n){const a=e?"true":"false",c=n.find(o=>o.sourceNodeHandle===a&&o.sourceNodeId===t);return r.find(o=>o.id===(c==null?void 0:c.destinationNodeId))}const X=i.createDomain("experience-instance"),Le=q.createFactory(({client:e,experience:t,target:r})=>{const n=i.createEvent(),a=i.createEvent(),c=i.createEvent(),o=i.createEvent(),u=i.createEvent(),p=i.createEvent(),y=t.componentStore,k=X.store("transitioning"),F=e.history.entriesStore.map(s=>s.filter(l=>l.experienceId===t.id)),L=F.map(s=>s.filter(l=>M(l.node))),I=F.map(s=>{var l;return((l=s[s.length-1])==null?void 0:l.node)||null}),f=i.combine(t.treeStore,I,({steps:s},l)=>s.find(d=>l&&M(l)&&d.id===l.stepId)||null),h=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?Oe(s,l,d):[]),A=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?Te(s,l,d):[-1,-1]),O=i.combine(t.treeStore,I,({nodes:s,edges:l},d)=>d?_e(s,l,d):[-1,-1]),v=X.store(!1),$=i.createApi(v,{open:()=>!0,close:()=>!1,toggle:s=>!s,set:(s,l)=>l}),fe=i.createEffect(async()=>{e.history.back({experienceId:t.id})}),le=i.attach({source:t.treeStore,effect:async(s,l)=>{const d=s.nodes.find(w=>M(w)&&w.stepId===l);d&&e.history.push({experienceId:t.id,node:d})}}),z=i.attach({source:I,effect:s=>{}}),G=i.attach({source:t.treeStore,effect:async({nodes:s})=>ce(s)}),K=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l},d)=>V(d,s,l)}),U=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l,conditionals:d},w)=>{if(!w)return;const _=d.find(b=>b.id===w.conditionalId);if(!_)return;const x=w.id,S=await W(e,_.condition);return Me(!!S,x,s,l)}}),J=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l},d)=>{if(!d||!te(d))return;const w=d.action;if(!w){N.logger("warn",`Action node ${d.id} has no action name`);return}const _=e.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?s.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?s.find(S=>S.id===x.destinationNodeId):null}try{N.logger("info",`Executing action: ${w}`),await _.action();const x=l.find(b=>b.sourceNodeId===d.id&&b.sourceNodeHandle==="true");if(!x)return N.logger("warn",`No 'true' edge found for action node ${d.id}`),null;const S=s.find(b=>b.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(P=>P.sourceNodeId===d.id&&P.sourceNodeHandle==="false");if(!S)return N.logger("warn",`No 'false' edge found for action node ${d.id}`),null;const b=s.find(P=>P.id===S.destinationNodeId);return N.logger("info",`Action '${w}' failed, moving to node ${b==null?void 0:b.id}`),b||null}}}),de=i.createEffect(s=>{if(s)return e.launchExperienceById(s.experienceId)}),Q=i.attach({source:[I,t.treeStore],effect:async([s,{nodes:l,edges:d}])=>V(s,l,d)}),D=i.attach({source:[I,t.treeStore],effect:async([s,{nodes:l,edges:d}])=>V(s,l,d)}),pe=i.createEffect(s=>{e.history.push({experienceId:t.id,node:s})}),Y=i.attach({source:t.configStore,effect:async({initializeOpenLogic:s})=>re(s)?!!await W(e,s):s??!1});return i.split({source:I,match:s=>s?Fe(s)?"condition":M(s)?"step":$e(s)?"launchExperience":ee(s)?"origin":te(s)?"action":"other":"none",cases:{none:G,origin:K,condition:U,step:z,launchExperience:de,action:J,__:i.createEvent()}}),i.sample({clock:[U.doneData,K.doneData,G.doneData,D.doneData,Q.doneData,J.doneData],filter:Boolean,target:pe}),i.sample({clock:a,target:D}),i.sample({clock:a,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit",step:s,experience:t}))}),i.sample({clock:D.done,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_success",step:s,experience:t}))}),i.sample({clock:D.fail,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_submit_error",step:s,experience:t}))}),i.sample({clock:c,target:fe}),i.sample({clock:o,target:le}),i.sample({source:i.combine([U.pending,K.pending,G.pending,D.pending]),fn:s=>s.some(Boolean)?"transitioning":"ready",target:k}),i.sample({clock:z.doneData,source:f,filter:Boolean,target:e.eventBus.prepend(s=>({type:"step_enter",step:s,experience:t}))}),i.sample({clock:p,target:Y}),i.sample({source:Y.doneData,fn:Boolean,target:v}),i.sample({source:I,clock:n,filter:s=>s?ee(s):!0,target:Q}),i.sample({source:v,filter:Boolean,target:n}),i.sample({source:v,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:t}))}),i.sample({source:v,filter:s=>!s,target:e.eventBus.prepend(()=>({type:"experience_close",experience:t}))}),i.sample({clock:u,target:[p]}),u(),{id:Math.random().toString(36).substring(7),experienceId:t.id,configStore:t.configStore,target:r,componentStore:y,stateStore:k,isOpenStore:v,open:$.open,close:$.close,toggleOpen:$.toggle,setOpen:$.set,treeStore:t.treeStore,currentNodeStore:I,currentStepStore:f,nextReachableStepNodesStore:h,stepsToOriginStore:A,stepsToLeafStore:O,goToNextStep:a,goToPreviousStep:c,goToStepById:o,stepsHistoryStore:L}});function ue(e){return q.invoke(Le,e)}const De=q.createFactory(({client:e})=>{const t=X.store({}),r=i.createEvent(),n=i.createEvent(),a=i.createEvent(),c=i.createApi(t,{register(f,h){const A=[...f[h.experienceId]??[]];return A.push(h),{...f,[h.experienceId]:A}},unregister(f,h){var v;const A=h.experienceId,O=(v=f[A])==null?void 0:v.filter($=>$!==h);return{...f,[A]:O??[]}}}),o=i.createEffect(({experience:f,target:h})=>ue({client:e,experience:f,target:h})),u=i.createEffect(f=>{c.register(f)}),p=i.createEffect(f=>{f.target&&Ne(f.target,()=>{a(f)})}),y=i.createEffect(f=>{c.unregister(f)}),k=i.createEffect(f=>{const h=f.componentStore.getState();if(!h){N.logger("warn","No app component registered. Skipping init.");return}const A=h.frameworkStore.getState();if(!A){N.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const O=f.target;if(!O){N.logger("error",`No target element registered for experience '${f.experienceId}'. Skipping rendering.`);return}const v=we(O);try{A.render(v,h.component,e,f)}catch($){N.logger("error",$)}});i.sample({clock:r,target:o}),i.sample({clock:a,target:y}),i.sample({clock:o.doneData,target:[u,p,n]}),i.sample({clock:o.doneData,target:e.eventBus.prepend(f=>({type:"experience_initialized",experienceInstance:f}))}),i.sample({clock:n,target:k});function F(f,h){r({experience:f,target:h})}const L=t.map(f=>Object.values(f).flat());function I(f){return t.map(h=>h[f]||[],{skipVoid:!1})}return{spawn:F,getByExperienceId:I,listStore:L}});function Re(e){return q.invoke(De,e)}exports.createAppHosts=ke;exports.createExperienceInstance=ue;exports.createExperienceInstanceIndex=Re;exports.domInteractive=Ee;exports.evaluateRuleLogic=W;exports.getTargetElements=xe;exports.isPickedRoot=oe;exports.isRulesLogic=re;exports.isStepNode=M;exports.tagTargetElement=ve;
|