@picked/client 0.0.1-dev.1764914073687 → 0.0.1-dev.1764917673864

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 CHANGED
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var V=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var y=(t,e,r)=>V(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("effector"),S=require("@withease/factories"),F=require("../experience-instance-DjjpHk0t.cjs"),I=require("../logger-BsmHUUw1.cjs"),k=require("../storage-YlR83AWP.cjs"),N=require("../id-BKIWbSTy.cjs"),z=require("../object-BbFTsGh3.cjs"),w=require("../supports-YvpQZxbh.cjs"),U=f.createDomain("experience"),_=S.createFactory(({client:t,experience:e})=>{const r=U.store(e),n=f.createApi(r,{merge(u,h){return{...u,...h.experience}}}),i=r.map(u=>({name:u.name,decisionLogic:u.condition??u.decide,targetSelectors:u.targets,initializeOpenLogic:e.initializeOpen})),l=t.components.listStore.map(u=>u.find(h=>h.name===`experience:${e.id}`)||u.find(h=>h.name==="experience"),{skipVoid:!1}),s=r.map(u=>({steps:u.steps,nodes:u.nodes,edges:u.edges,conditionals:u.conditionals})),o=e.actions??[];return{id:e.id,configStore:i,treeStore:s,componentStore:l,actions:o,merge:n.merge}});function q(t){return S.invoke(_,t)}const K=S.createFactory(({client:t})=>{const e=U.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.id]:o}}});function n(s){const o=e.getState()[s.id];if(o){o.merge({experience:s,strategy:"override"});return}const u=q({client:t,experience:s});r.register(u)}const i=e.map(s=>Object.values(s));function l(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getById:l,listStore:i}});function H(t){return S.invoke(K,t)}const W=(t,e)=>{e.register(t)},L=(t,e)=>{const{targetSelectors:r}=e.configStore.getState(),n=F.getTargetElements(r,e.id);n.forEach(({elements:l})=>l.forEach(s=>F.tagTargetElement(s,e.id))),F.createAppHosts(n,e.id).forEach(l=>{t.experienceInstances.spawn(e,l)})},B=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await G(t,e)&&L(t,e)}))},G=async(t,e)=>{const{decisionLogic:r,targetSelectors:n}=e.configStore.getState();return F.getTargetElements(n,e.id).length<1||n.length===0?!1:r&&F.isRulesLogic(r)?await F.evaluateRuleLogic(t,r)===!0:!0},Y=(t,e,r)=>{const n=e.name,i=e.setup(t);if(i){const l=r[n]??{};r[n]=Object.freeze({...l,...i})}},J=f.createDomain("component"),Q=S.createFactory(({client:t,component:e,name:r})=>{const n=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:n}});function X(t){return S.invoke(Q,t)}const Z=S.createFactory(({client:t})=>{const e=J.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:o}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Component '${s}' already registered. Registering again will override the previous registration.`);const h=X({client:t,name:s,component:o});r.register(h)}const i=e.map(s=>Object.values(s));function l(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:l,listStore:i}});function ee(t){return S.invoke(Z,t)}const j=(t,e,r)=>{r.register(t,e)},te=f.createDomain("framework"),re=S.createFactory(({client:t})=>{const e=te.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:o.framework}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Framework '${s}' already registered. Registering again will override the previous registration.`),r.register({name:s,framework:o})}const i=e.map(s=>Object.values(s));function l(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:l,listStore:i}});function se(t){return S.invoke(re,t)}const ne=(t,e)=>{e.register(t.name,t)},oe=6e3,ie=k.createStorageKey("last_ping","global"),ae=t=>`${t}/api/v1/ping`,ce=async t=>{try{const e=Date.now(),r=k.localStore.get(ie);let n=0;if(r.isSet()&&(n=r.json()??0),n&&e-n<oe)return!0;const i=ae(t.apiUrl),l={projectId:t.projectId,path:window.location.pathname},s=JSON.stringify(l),o={"Content-Type":"application/json"},u=document.getElementById("picked_script"),h=u==null?void 0:u.dataset.verceltoken;h&&(o["x-vercel-protection-bypass"]=h);const d=(await fetch(i,{method:"POST",headers:o,body:s})).ok;return d&&r.set(e),d}catch(e){return I.logger("error",e),!1}};function ue(t){const e=typeof window<"u",r={client:t,responses:t.responses.listStore.getState(),fields:t.fields.listStore.getState(),location:e?window.location:void 0,document:e?window.document:void 0,sessionStorage:e?window.sessionStorage:void 0,localStorage:e?window.localStorage:void 0};return Object.freeze(r)}const le=f.createDomain("predicate"),de=S.createFactory(({client:t})=>{const e=le.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:{name:o.name,predicate:o.predicate}}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Predicate '${s}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:s,predicate:o}))}const i=e.map(s=>Object.values(s));function l(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:l,listStore:i}});function pe(t){return S.invoke(de,t)}const ge=(t,e,r)=>{r.register(t,e)},$=f.createDomain("feature"),fe=S.createFactory(({client:t})=>{const e=$.store({}),r=$.store([]),n=f.createApi(e,{register(d,c){return{...d,[c.id]:c.feature}}});function i(d,c){e.getState()[d]&&I.logger("warn",`Feature '${d}' already registered. Registering again will override the previous registration.`);const p={id:d,feature:{...c,id:d}};n.register(Object.freeze({id:d,feature:p}))}const l=f.createEffect(async({id:d,key:c,storage:a="local"})=>{const p=k.createStorageKey(`feature:${d}:${c}`,"global"),g=(a==="session"?k.sessionStore:k.localStore).get(p).boolean();return g===null?null:{id:d,key:c,bucket:g,storage:a}}),s=f.createEffect(d=>{if(!d)return null;const c=k.createStorageKey(`feature:${d.id}:${d.key}`,"global");(d.storage==="session"?k.sessionStore:k.localStore).set(c,d.bucket)}),o=new Map,u=f.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:d,resolvedFeaturesStore:c},{id:a,decide:p,key:m})=>{const g=c.find(A=>A.id===a&&A.key===m);if(g)return g;const v=d[a];if(!v)throw new Error(`Feature with id '${a}' not found`);const x=o.get(`${a}:${m}`);if(x!==void 0){const A=await x;return{id:v.id,bucket:A,key:m,storage:v.feature.storage}}const P=p();o.set(`${a}:${m}`,P);const E=await P;return{id:v.id,bucket:E,key:m,storage:v.feature.storage}}});f.sample({clock:n.register,fn:d=>{const{id:c,feature:a}=d;return{id:c,key:a.feature.key,storage:a.feature.storage}},target:l}),f.sample({source:e,clock:u.doneData,fn:(d,c)=>{var v;const{id:a,bucket:p,storage:m}=c,g=(v=d[a])==null?void 0:v.feature.key;return g?{key:g,id:a,bucket:p,storage:m}:null},target:s});const h=f.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:d,resolvedFeaturesStore:c})=>Object.values(d).map(a=>{const p=c.find(m=>m.id===a.id&&m.key===a.feature.key);return p?{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:()=>({id:a.id,bucket:p.bucket}),isResolved:!0}:{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:async()=>await u(a.feature),isResolved:!1}}));f.sample({clock:u.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:d},{id:c,key:a})=>!d.some(m=>m.id===c&&m.key===a),fn:(d,c)=>c,target:t.eventBus.prepend(d=>({type:"feature_decide",feature:d}))}),f.sample({clock:[l.doneData,u.doneData],source:r,fn:(d,c)=>!c||d.some(p=>p.id===c.id&&p.key===c.key)?d:[...d,c],target:r});function b(d){return e.map(c=>c[d],{skipVoid:!1})}return{register:i,getByName:b,listStore:h}});function me(t){return S.invoke(fe,t)}const ye=(t,e,r)=>{r.register(t,e)},R=f.createDomain("history");function C(t,e){return{id:N.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const he=S.createFactory(()=>{const t=R.store({entries:[]}),e=R.event(),r=R.event(),n=R.event(),i=R.event();t.on(e,(s,o)=>({entries:[...s.entries,C(o.experienceId,o.node)]})),t.on(r,(s,o)=>({entries:[...s.entries.slice(0,-1),C(o.experienceId,o.node)]})),t.on(i,(s,o)=>o);function l(s,o){const u={lastStepIndex:-1,secondLastStepIndex:-1};for(let h=s.length-1;h>=0;h--){const b=s[h],d=b==null?void 0:b.node;if(!(!d||!F.isStepNode(d))&&!(o&&(b==null?void 0:b.experienceId)!==o))if(u.lastStepIndex===-1)u.lastStepIndex=h;else{u.secondLastStepIndex=h;break}}return u}return t.on(n,(s,o)=>{const{secondLastStepIndex:u}=l(s.entries,o.experienceId),h=u!==-1?s.entries.slice(0,u+1):s.entries;return{...s,entries:h}}),{push:e,replace:r,back:n,restore:i,entriesStore:t.map(s=>s.entries)}});function Se(){return S.invoke(he)}const ve=()=>f.createEvent(),ke=f.createDomain("field"),we=S.createFactory(()=>{const t=ke.store({}),e=f.createApi(t,{register(s,o){return{...s,[o.field.id]:o.field}}});function r(s){e.register({field:s})}const n=t.map(s=>Object.values(s));function i(s){return t.map(o=>o[s]||null)}function l(s){return t.map(o=>Object.values(o).find(u=>u.name===s)||null)}return{register:r,getById:i,listStore:n,getByName:l}});function Fe(){return S.invoke(we)}const be=(t,e)=>{e.register(t)},Ie=f.createDomain("action"),xe=S.createFactory(()=>{const t=Ie.store({}),e=f.createApi(t,{register(l,s){return{...l,[s.name]:{name:s.name,action:s.action}}}});function r(l,s){e.register({name:l,action:s})}const n=t.map(l=>Object.values(l));function i(l){return t.map(s=>s[l],{skipVoid:!1})}return{register:r,getByName:i,listStore:n}});function Ee(){return S.invoke(xe)}const Re=(t,e,r)=>{r.register(t,e)};function O(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}const Pe=f.createDomain("response"),Ae=S.createFactory(({client:t})=>{const e=Pe.store({}),r=f.createEvent(),n=f.createEvent(),i=f.createApi(e,{register(c,a){return{...c,[a.fieldId]:a.response}},registerBatch(c,a){return{...c,...a}},clear(c,a){const{[a]:p,...m}=c;return m},clearAll(){return{}}});function l(c,a){i.register({fieldId:c,response:a})}async function s(c){const a=[];return await Promise.allSettled(Object.entries(c).map(async([p,m])=>{let g=m;const v=t.fields.getById(p).getState();if(!v){a.push({fieldId:p,userMessage:`Field '${p}' not found`,systemMessage:`No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:g});return}if(v.multiple&&(typeof g=="string"||typeof g=="number"||typeof g=="boolean")&&(g=[g]),v.validation&&!z.isEmpty(v.validation)&&!O(g)){const x=await F.evaluateRuleLogic(t,v.validation,{$input:g});if(typeof x=="string"){a.push({fieldId:p,userMessage:x,systemMessage:`Field validation resulted in an error: ${x}.`,value:g});return}if(x===!1){a.push({fieldId:p,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:g});return}}if(v.required&&O(g)){a.push({fieldId:p,userMessage:"This field is required",systemMessage:"Field is required.",value:g});return}if(!v.multiple&&Array.isArray(g)&&g.length>1){a.push({fieldId:p,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:g});return}if(v.options){const x=v.options.map(E=>E.value),P=Array.isArray(g)?g:[g];Array.isArray(g)&&(P.every(E=>x.includes(E))||a.push({fieldId:p,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:g}))}})),{responsesToCommit:c,validationErrors:a}}async function o(c){const{responsesToCommit:a,validationErrors:p}=await s(c);return p.length?{errors:p}:(i.registerBatch(a),{errors:[]})}const u=e.map(c=>c),h=e.map(c=>Object.keys(c).map(p=>({fieldId:p,value:c[p]})));function b(c){const a=t.fields.getById(c),p=e.map(m=>m[c]||null);return f.combine({f:a,r:p},({f:m,r:g})=>g||(m!=null&&m.defaultValue?m.defaultValue:null))}function d(c){const a=t.fields.getByName(c);return f.combine({f:a,s:e},({f:p,s:m})=>{const g=p&&m[p.id]||null;return g||(p!=null&&p.defaultValue?p.defaultValue:null)})}return f.sample({clock:r,target:i.clearAll}),f.sample({clock:n,target:i.clear}),{register:l,clearAll:r,clear:n,commit:o,getResponsesToCommit:s,listStore:h,getAllStore:u,getByFieldId:b,getByFieldName:d}});function De(t){return S.invoke(Ae,t)}const Be=()=>"0.0.1-dev.1764914073687";function je(){if(w.supportsDocument()){const t=[document.currentScript,document.getElementById("picked_script"),document.getElementById("picked"),document.getElementById("cvly"),document.getElementById("cvly-x")];for(const e of t)if(e!=null&&e.dataset.api)return e.dataset.api}return"https://api.picked.app"}function $e(){if(!w.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},r=new Set;for(const[i]of t.entries())i.startsWith("picked-")&&r.add(i);for(const i of r){const l=i.replace("picked-","");e[l]=t.getAll(i)}const n=k.createStorageKey("s");if(r.size>0)k.sessionStore.set(n,e);else{const i=k.sessionStore.get(n);if(i)return i.json()||{}}return e}function Ce(){if(w.supportsCryptoRandomUUID())return crypto.randomUUID();const t=Date.now().toString(36),e=Math.random().toString(36).substring(2,15),r=Math.random().toString(36).substring(2,15),n=Math.random().toString(36).substring(2,15);return`${t}-${e}-${r}-${n}`}const Oe=k.createStorageKey("session","global"),Ue=()=>{const t=k.localStore.get(Oe);let e;t.isSet()&&(e=t.json());const r=i=>t.set({id:i.id,isUser:i.isUser}),n={id:(e==null?void 0:e.id)??Ce(),isUser:(e==null?void 0:e.isUser)??void 0,setIsUser(i){this.isUser=i,r(this)}};return r(n),n},Le=()=>w.supportsLocalStorage()?Ue():null;class D{constructor(e){y(this,"options");y(this,"isReady",!1);y(this,"project");y(this,"plugins",{});y(this,"eventBus",ve());y(this,"organizationId");y(this,"projectId");y(this,"apiUrl");y(this,"session");y(this,"precondition");y(this,"condition");y(this,"searchParams",$e());y(this,"history",Se());y(this,"components",ee({client:this}));y(this,"experienceInstances",F.createExperienceInstanceIndex({client:this}));y(this,"experiences",H({client:this}));y(this,"frameworks",se({client:this}));y(this,"predicates",pe({client:this}));y(this,"features",me({client:this}));y(this,"responses",De({client:this}));y(this,"fields",Fe());y(this,"actions",Ee());I.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||je(),this.session=Le(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.precondition=e.precondition,this.condition=e.condition,this.eventBus({type:"load",version:Be()}),I.logger("info","Picked client initialized.")}start(){ce(this),(async()=>{if(!w.supportsDocument())return;let r=!0,n;this.precondition!==void 0&&await F.evaluateRuleLogic(this,this.precondition)!==!0&&(n=!1,r=!1),this.condition!==void 0&&n!==!1&&await F.evaluateRuleLogic(this,this.condition)!==!0&&(r=!1),this.session&&this.session.setIsUser(r),this.eventBus({type:"initialize"}),this.eventBus({type:"user_decide",value:r}),document.body&&r&&B(this),await F.domInteractive(),r&&B(this),this.eventBus({type:"ready"}),this.isReady=!0,this.session&&this.eventBus({type:"session",...this.session})})()}registerFramework(e){ne(e,this.frameworks)}registerComponent(e,r){j(e,r,this.components)}registerPlugin(e){Y(this,e,this.plugins)}registerFeature(e,r){ye(e,r,this.features)}registerPredicate(e,r){ge(e,r,this.predicates)}registerField(e){be(e,this.fields)}registerAction(e,r){Re(e,r,this.actions)}registerExperience(e){e.component&&j(`experience:${e.id}`,e.component,this.components),W(e,this.experiences)}getStateSnapshot(){return ue(this)}async launchExperienceById(e){const r=this.experiences.getById(e).getState();if(!r){I.logger("warn",`Experience with id '${e}' not found.`);return}L(this,r)}setupPlugins(){var e;(e=this.options.plugins)==null||e.forEach(r=>{if(Array.isArray(r)){r.forEach(i=>{this.registerPlugin(i)});return}const n=typeof r=="function"?r():r;if(Array.isArray(n)){n.forEach(i=>this.registerPlugin(i));return}this.registerPlugin(n)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([r,n])=>{const i=typeof n=="function"?n():n;this.registerFeature(r,i)}),this.searchParams.feature&&this.searchParams.feature.forEach(r=>{try{const[n,i]=r.split(":");if(!n||!i)return;let l=i;l==="true"&&(l=!0),l==="false"&&(l=!1),this.registerFeature(n,{key:`${l}`,name:n,decide:()=>l,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([r,n])=>{if(typeof n!="function"){I.logger("warn",`Predicate "${r}" is not a function.`);return}this.registerPredicate(r,n)})}setupActions(){const e=this.options.actions;e&&Object.entries(e).forEach(([r,n])=>{if(typeof n!="function"){I.logger("warn",`Action "${r}" is not a function.`);return}this.registerAction(r,n)})}getPluginConfig(e){return this.plugins[e]??{}}}y(D,"logger",I.logger);function M(t){var e;return((e=t.options)==null?void 0:e.some(r=>"condition"in r))??!1}function Me(t){return t.some(e=>e.condition||M(e))}async function Te(t,e){return e.length===0||!Me(e)?e:(await Promise.all(e.map(async n=>{if(!(n.condition?await F.evaluateRuleLogic(t,n.condition):!0))return null;if(!n.options||!M(n))return n;const s=(await Promise.all(n.options.map(async u=>u.condition?await F.evaluateRuleLogic(t,u.condition)?u:null:u))).filter(u=>u!==null);return s.length===n.options.length?n:s.length===0?null:{...n,options:s}}))).filter(n=>n!==null)}const Ve=t=>{const e=new D(t);return w.bindClient(e),e};exports.evaluateRuleLogic=F.evaluateRuleLogic;exports.isPickedRoot=F.isPickedRoot;exports.createStorageKey=k.createStorageKey;exports.localStore=k.localStore;exports.sessionStore=k.sessionStore;exports.subscribe=k.subscribe;exports.supportsCookies=w.supportsCookies;exports.supportsCryptoRandomUUID=w.supportsCryptoRandomUUID;exports.supportsDocument=w.supportsDocument;exports.supportsHistory=w.supportsHistory;exports.supportsIntersectionObserver=w.supportsIntersectionObserver;exports.supportsLocalStorage=w.supportsLocalStorage;exports.supportsLocation=w.supportsLocation;exports.supportsSessionStorage=w.supportsSessionStorage;exports.supportsShadowRoot=w.supportsShadowRoot;exports.supportsWebComponents=w.supportsWebComponents;exports.supportsWindow=w.supportsWindow;exports.Picked=D;exports.createClient=Ve;exports.getStepFields=Te;
1
+ "use strict";var T=Object.defineProperty;var V=(t,e,r)=>e in t?T(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var y=(t,e,r)=>V(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("effector"),S=require("@withease/factories"),F=require("../experience-instance-DjjpHk0t.cjs"),I=require("../logger-BsmHUUw1.cjs"),k=require("../storage-YlR83AWP.cjs"),N=require("../id-BKIWbSTy.cjs"),z=require("../object-BbFTsGh3.cjs"),w=require("../supports-YvpQZxbh.cjs"),U=f.createDomain("experience"),_=S.createFactory(({client:t,experience:e})=>{const r=U.store(e),n=f.createApi(r,{merge(l,h){return{...l,...h.experience}}}),i=r.map(l=>({name:l.name,decisionLogic:l.condition??l.decide,targetSelectors:l.targets,initializeOpenLogic:e.initializeOpen})),u=t.components.listStore.map(l=>l.find(h=>h.name===`experience:${e.id}`)||l.find(h=>h.name==="experience"),{skipVoid:!1}),s=r.map(l=>({steps:l.steps,nodes:l.nodes,edges:l.edges,conditionals:l.conditionals})),o=e.actions??[];return{id:e.id,configStore:i,treeStore:s,componentStore:u,actions:o,merge:n.merge}});function q(t){return S.invoke(_,t)}const K=S.createFactory(({client:t})=>{const e=U.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.id]:o}}});function n(s){const o=e.getState()[s.id];if(o){o.merge({experience:s,strategy:"override"});return}const l=q({client:t,experience:s});r.register(l)}const i=e.map(s=>Object.values(s));function u(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getById:u,listStore:i}});function H(t){return S.invoke(K,t)}const W=(t,e)=>{e.register(t)},L=(t,e)=>{const{targetSelectors:r}=e.configStore.getState(),n=F.getTargetElements(r,e.id);n.forEach(({elements:u})=>u.forEach(s=>F.tagTargetElement(s,e.id))),F.createAppHosts(n,e.id).forEach(u=>{t.experienceInstances.spawn(e,u)})},B=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await G(t,e)&&L(t,e)}))},G=async(t,e)=>{const{decisionLogic:r,targetSelectors:n}=e.configStore.getState();return F.getTargetElements(n,e.id).length<1||n.length===0?!1:r&&F.isRulesLogic(r)?await F.evaluateRuleLogic(t,r)===!0:!0},Y=(t,e,r)=>{const n=e.name,i=e.setup(t);if(i){const u=r[n]??{};r[n]=Object.freeze({...u,...i})}},J=f.createDomain("component"),Q=S.createFactory(({client:t,component:e,name:r})=>{const n=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:n}});function X(t){return S.invoke(Q,t)}const Z=S.createFactory(({client:t})=>{const e=J.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:o}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Component '${s}' already registered. Registering again will override the previous registration.`);const h=X({client:t,name:s,component:o});r.register(h)}const i=e.map(s=>Object.values(s));function u(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:u,listStore:i}});function ee(t){return S.invoke(Z,t)}const j=(t,e,r)=>{r.register(t,e)},te=f.createDomain("framework"),re=S.createFactory(({client:t})=>{const e=te.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:o.framework}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Framework '${s}' already registered. Registering again will override the previous registration.`),r.register({name:s,framework:o})}const i=e.map(s=>Object.values(s));function u(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:u,listStore:i}});function se(t){return S.invoke(re,t)}const ne=(t,e)=>{e.register(t.name,t)},oe=6e3,ie=k.createStorageKey("last_ping","global"),ae=t=>`${t}/api/v1/ping`,ce=async t=>{try{const e=Date.now(),r=k.localStore.get(ie);let n=0;if(r.isSet()&&(n=r.json()??0),n&&e-n<oe)return!0;const i=ae(t.apiUrl),u={projectId:t.projectId,path:window.location.pathname},s=JSON.stringify(u),o={"Content-Type":"application/json"},l=document.getElementById("picked_script"),h=l==null?void 0:l.dataset.verceltoken;h&&(o["x-vercel-protection-bypass"]=h);const d=(await fetch(i,{method:"POST",headers:o,body:s})).ok;return d&&r.set(e),d}catch(e){return I.logger("error",e),!1}};function ue(t){const e=typeof window<"u",r={client:t,responses:t.responses.listStore.getState(),fields:t.fields.listStore.getState(),location:e?window.location:void 0,document:e?window.document:void 0,sessionStorage:e?window.sessionStorage:void 0,localStorage:e?window.localStorage:void 0};return Object.freeze(r)}const le=f.createDomain("predicate"),de=S.createFactory(({client:t})=>{const e=le.store({}),r=f.createApi(e,{register(s,o){return{...s,[o.name]:{name:o.name,predicate:o.predicate}}}});function n(s,o){e.getState()[s]&&I.logger("warn",`Predicate '${s}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:s,predicate:o}))}const i=e.map(s=>Object.values(s));function u(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:u,listStore:i}});function pe(t){return S.invoke(de,t)}const ge=(t,e,r)=>{r.register(t,e)},$=f.createDomain("feature"),fe=S.createFactory(({client:t})=>{const e=$.store({}),r=$.store([]),n=f.createApi(e,{register(d,c){return{...d,[c.id]:c.feature}}});function i(d,c){e.getState()[d]&&I.logger("warn",`Feature '${d}' already registered. Registering again will override the previous registration.`);const p={id:d,feature:{...c,id:d}};n.register(Object.freeze({id:d,feature:p}))}const u=f.createEffect(async({id:d,key:c,storage:a="local"})=>{const p=k.createStorageKey(`feature:${d}:${c}`,"global"),g=(a==="session"?k.sessionStore:k.localStore).get(p).boolean();return g===null?null:{id:d,key:c,bucket:g,storage:a}}),s=f.createEffect(d=>{if(!d)return null;const c=k.createStorageKey(`feature:${d.id}:${d.key}`,"global");(d.storage==="session"?k.sessionStore:k.localStore).set(c,d.bucket)}),o=new Map,l=f.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:d,resolvedFeaturesStore:c},{id:a,decide:p,key:m})=>{const g=c.find(A=>A.id===a&&A.key===m);if(g)return g;const v=d[a];if(!v)throw new Error(`Feature with id '${a}' not found`);const x=o.get(`${a}:${m}`);if(x!==void 0){const A=await x;return{id:v.id,bucket:A,key:m,storage:v.feature.storage}}const P=p();o.set(`${a}:${m}`,P);const E=await P;return{id:v.id,bucket:E,key:m,storage:v.feature.storage}}});f.sample({clock:n.register,fn:d=>{const{id:c,feature:a}=d;return{id:c,key:a.feature.key,storage:a.feature.storage}},target:u}),f.sample({source:e,clock:l.doneData,fn:(d,c)=>{var v;const{id:a,bucket:p,storage:m}=c,g=(v=d[a])==null?void 0:v.feature.key;return g?{key:g,id:a,bucket:p,storage:m}:null},target:s});const h=f.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:d,resolvedFeaturesStore:c})=>Object.values(d).map(a=>{const p=c.find(m=>m.id===a.id&&m.key===a.feature.key);return p?{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:()=>({id:a.id,bucket:p.bucket}),isResolved:!0}:{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:async()=>await l(a.feature),isResolved:!1}}));f.sample({clock:l.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:d},{id:c,key:a})=>!d.some(m=>m.id===c&&m.key===a),fn:(d,c)=>c,target:t.eventBus.prepend(d=>({type:"feature_decide",feature:d}))}),f.sample({clock:[u.doneData,l.doneData],source:r,fn:(d,c)=>!c||d.some(p=>p.id===c.id&&p.key===c.key)?d:[...d,c],target:r});function b(d){return e.map(c=>c[d],{skipVoid:!1})}return{register:i,getByName:b,listStore:h}});function me(t){return S.invoke(fe,t)}const ye=(t,e,r)=>{r.register(t,e)},R=f.createDomain("history");function C(t,e){return{id:N.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const he=S.createFactory(()=>{const t=R.store({entries:[]}),e=R.event(),r=R.event(),n=R.event(),i=R.event();t.on(e,(s,o)=>({entries:[...s.entries,C(o.experienceId,o.node)]})),t.on(r,(s,o)=>({entries:[...s.entries.slice(0,-1),C(o.experienceId,o.node)]})),t.on(i,(s,o)=>o);function u(s,o){const l={lastStepIndex:-1,secondLastStepIndex:-1};for(let h=s.length-1;h>=0;h--){const b=s[h],d=b==null?void 0:b.node;if(!(!d||!F.isStepNode(d))&&!(o&&(b==null?void 0:b.experienceId)!==o))if(l.lastStepIndex===-1)l.lastStepIndex=h;else{l.secondLastStepIndex=h;break}}return l}return t.on(n,(s,o)=>{const{secondLastStepIndex:l}=u(s.entries,o.experienceId),h=l!==-1?s.entries.slice(0,l+1):s.entries;return{...s,entries:h}}),{push:e,replace:r,back:n,restore:i,entriesStore:t.map(s=>s.entries)}});function Se(){return S.invoke(he)}const ve=()=>f.createEvent(),ke=f.createDomain("field"),we=S.createFactory(()=>{const t=ke.store({}),e=f.createApi(t,{register(s,o){return{...s,[o.field.id]:o.field}}});function r(s){e.register({field:s})}const n=t.map(s=>Object.values(s));function i(s){return t.map(o=>o[s]||null)}function u(s){return t.map(o=>Object.values(o).find(l=>l.name===s)||null)}return{register:r,getById:i,listStore:n,getByName:u}});function Fe(){return S.invoke(we)}const be=(t,e)=>{e.register(t)},Ie=f.createDomain("action"),xe=S.createFactory(()=>{const t=Ie.store({}),e=f.createApi(t,{register(u,s){return{...u,[s.name]:{name:s.name,action:s.action}}}});function r(u,s){e.register({name:u,action:s})}const n=t.map(u=>Object.values(u));function i(u){return t.map(s=>s[u],{skipVoid:!1})}return{register:r,getByName:i,listStore:n}});function Ee(){return S.invoke(xe)}const Re=(t,e,r)=>{r.register(t,e)};function O(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}const Pe=f.createDomain("response"),Ae=S.createFactory(({client:t})=>{const e=Pe.store({}),r=f.createEvent(),n=f.createEvent(),i=f.createApi(e,{register(c,a){return{...c,[a.fieldId]:a.response}},registerBatch(c,a){return{...c,...a}},clear(c,a){const{[a]:p,...m}=c;return m},clearAll(){return{}}});function u(c,a){i.register({fieldId:c,response:a})}async function s(c){const a=[];return await Promise.allSettled(Object.entries(c).map(async([p,m])=>{let g=m;const v=t.fields.getById(p).getState();if(!v){a.push({fieldId:p,userMessage:`Field '${p}' not found`,systemMessage:`No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:g});return}if(v.multiple&&(typeof g=="string"||typeof g=="number"||typeof g=="boolean")&&(g=[g]),v.validation&&!z.isEmpty(v.validation)&&!O(g)){const x=await F.evaluateRuleLogic(t,v.validation,{$input:g});if(typeof x=="string"){a.push({fieldId:p,userMessage:x,systemMessage:`Field validation resulted in an error: ${x}.`,value:g});return}if(x===!1){a.push({fieldId:p,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:g});return}}if(v.required&&O(g)){a.push({fieldId:p,userMessage:"This field is required",systemMessage:"Field is required.",value:g});return}if(!v.multiple&&Array.isArray(g)&&g.length>1){a.push({fieldId:p,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:g});return}if(v.options){const x=v.options.map(E=>E.value),P=Array.isArray(g)?g:[g];Array.isArray(g)&&(P.every(E=>x.includes(E))||a.push({fieldId:p,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:g}))}})),{responsesToCommit:c,validationErrors:a}}async function o(c){const{responsesToCommit:a,validationErrors:p}=await s(c);return p.length?{errors:p}:(i.registerBatch(a),{errors:[]})}const l=e.map(c=>c),h=e.map(c=>Object.keys(c).map(p=>({fieldId:p,value:c[p]})));function b(c){const a=t.fields.getById(c),p=e.map(m=>m[c]||null);return f.combine({f:a,r:p},({f:m,r:g})=>g||(m!=null&&m.defaultValue?m.defaultValue:null))}function d(c){const a=t.fields.getByName(c);return f.combine({f:a,s:e},({f:p,s:m})=>{const g=p&&m[p.id]||null;return g||(p!=null&&p.defaultValue?p.defaultValue:null)})}return f.sample({clock:r,target:i.clearAll}),f.sample({clock:n,target:i.clear}),{register:u,clearAll:r,clear:n,commit:o,getResponsesToCommit:s,listStore:h,getAllStore:l,getByFieldId:b,getByFieldName:d}});function De(t){return S.invoke(Ae,t)}const Be=()=>"0.0.1-dev.1764917673864";function je(){if(w.supportsDocument()){const t=[document.currentScript,document.getElementById("picked_script"),document.getElementById("picked"),document.getElementById("cvly"),document.getElementById("cvly-x")];for(const e of t)if(e!=null&&e.dataset.api)return e.dataset.api}return"https://api.picked.app"}function $e(){if(!w.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},r=new Set;for(const[i]of t.entries())i.startsWith("picked-")&&r.add(i);for(const i of r){const u=i.replace("picked-","");e[u]=t.getAll(i)}const n=k.createStorageKey("s");if(r.size>0)k.sessionStore.set(n,e);else{const i=k.sessionStore.get(n);if(i)return i.json()||{}}return e}function Ce(){if(w.supportsCryptoRandomUUID())return crypto.randomUUID();const t=Date.now().toString(36),e=Math.random().toString(36).substring(2,15),r=Math.random().toString(36).substring(2,15),n=Math.random().toString(36).substring(2,15);return`${t}-${e}-${r}-${n}`}const Oe=k.createStorageKey("session","global"),Ue=()=>{const t=k.localStore.get(Oe);let e;t.isSet()&&(e=t.json());const r=i=>t.set({id:i.id,isUser:i.isUser}),n={id:(e==null?void 0:e.id)??Ce(),isUser:(e==null?void 0:e.isUser)??void 0,setIsUser(i){this.isUser=i,r(this)}};return r(n),n},Le=()=>w.supportsLocalStorage()?Ue():null;class D{constructor(e){y(this,"options");y(this,"isReady",!1);y(this,"project");y(this,"plugins",{});y(this,"eventBus",ve());y(this,"organizationId");y(this,"projectId");y(this,"apiUrl");y(this,"session");y(this,"precondition");y(this,"condition");y(this,"searchParams",$e());y(this,"history",Se());y(this,"components",ee({client:this}));y(this,"experienceInstances",F.createExperienceInstanceIndex({client:this}));y(this,"experiences",H({client:this}));y(this,"frameworks",se({client:this}));y(this,"predicates",pe({client:this}));y(this,"features",me({client:this}));y(this,"responses",De({client:this}));y(this,"fields",Fe());y(this,"actions",Ee());I.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||je(),this.session=Le(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.precondition=e.precondition,this.condition=e.condition,this.eventBus({type:"load",version:Be()}),I.logger("info","Picked client initialized.")}start(){ce(this),(async()=>{if(!w.supportsDocument())return;let r;typeof this.precondition>"u"?r=!0:typeof this.precondition=="boolean"?r=this.precondition:r=await F.evaluateRuleLogic(this,this.precondition)===!0;let n;r&&(this.condition===void 0?n=!0:typeof this.condition=="boolean"?n=this.condition:n=await F.evaluateRuleLogic(this,this.condition)===!0);const i=r&&n===!0;if(typeof n=="boolean"&&this.session){const u=n;this.session.setIsUser(u),this.eventBus({type:"user_decide",value:u})}this.eventBus({type:"initialize"}),document.body&&i&&B(this),await F.domInteractive(),i&&B(this),this.eventBus({type:"ready"}),this.isReady=!0,this.session&&this.eventBus({type:"session",...this.session})})()}registerFramework(e){ne(e,this.frameworks)}registerComponent(e,r){j(e,r,this.components)}registerPlugin(e){Y(this,e,this.plugins)}registerFeature(e,r){ye(e,r,this.features)}registerPredicate(e,r){ge(e,r,this.predicates)}registerField(e){be(e,this.fields)}registerAction(e,r){Re(e,r,this.actions)}registerExperience(e){e.component&&j(`experience:${e.id}`,e.component,this.components),W(e,this.experiences)}getStateSnapshot(){return ue(this)}async launchExperienceById(e){const r=this.experiences.getById(e).getState();if(!r){I.logger("warn",`Experience with id '${e}' not found.`);return}L(this,r)}setupPlugins(){var e;(e=this.options.plugins)==null||e.forEach(r=>{if(Array.isArray(r)){r.forEach(i=>{this.registerPlugin(i)});return}const n=typeof r=="function"?r():r;if(Array.isArray(n)){n.forEach(i=>this.registerPlugin(i));return}this.registerPlugin(n)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([r,n])=>{const i=typeof n=="function"?n():n;this.registerFeature(r,i)}),this.searchParams.feature&&this.searchParams.feature.forEach(r=>{try{const[n,i]=r.split(":");if(!n||!i)return;let u=i;u==="true"&&(u=!0),u==="false"&&(u=!1),this.registerFeature(n,{key:`${u}`,name:n,decide:()=>u,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([r,n])=>{if(typeof n!="function"){I.logger("warn",`Predicate "${r}" is not a function.`);return}this.registerPredicate(r,n)})}setupActions(){const e=this.options.actions;e&&Object.entries(e).forEach(([r,n])=>{if(typeof n!="function"){I.logger("warn",`Action "${r}" is not a function.`);return}this.registerAction(r,n)})}getPluginConfig(e){return this.plugins[e]??{}}}y(D,"logger",I.logger);function M(t){var e;return((e=t.options)==null?void 0:e.some(r=>"condition"in r))??!1}function Me(t){return t.some(e=>e.condition||M(e))}async function Te(t,e){return e.length===0||!Me(e)?e:(await Promise.all(e.map(async n=>{if(!(n.condition?await F.evaluateRuleLogic(t,n.condition):!0))return null;if(!n.options||!M(n))return n;const s=(await Promise.all(n.options.map(async l=>l.condition?await F.evaluateRuleLogic(t,l.condition)?l:null:l))).filter(l=>l!==null);return s.length===n.options.length?n:s.length===0?null:{...n,options:s}}))).filter(n=>n!==null)}const Ve=t=>{const e=new D(t);return w.bindClient(e),e};exports.evaluateRuleLogic=F.evaluateRuleLogic;exports.isPickedRoot=F.isPickedRoot;exports.createStorageKey=k.createStorageKey;exports.localStore=k.localStore;exports.sessionStore=k.sessionStore;exports.subscribe=k.subscribe;exports.supportsCookies=w.supportsCookies;exports.supportsCryptoRandomUUID=w.supportsCryptoRandomUUID;exports.supportsDocument=w.supportsDocument;exports.supportsHistory=w.supportsHistory;exports.supportsIntersectionObserver=w.supportsIntersectionObserver;exports.supportsLocalStorage=w.supportsLocalStorage;exports.supportsLocation=w.supportsLocation;exports.supportsSessionStorage=w.supportsSessionStorage;exports.supportsShadowRoot=w.supportsShadowRoot;exports.supportsWebComponents=w.supportsWebComponents;exports.supportsWindow=w.supportsWindow;exports.Picked=D;exports.createClient=Ve;exports.getStepFields=Te;
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var W = Object.defineProperty;
2
2
  var Y = (t, e, s) => e in t ? W(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
3
  var m = (t, e, s) => Y(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { createDomain as b, createApi as I, createEffect as U, attach as J, sample as x, combine as C, createEvent as D } from "effector";
4
+ import { createDomain as F, createApi as I, createEffect as U, attach as J, sample as x, combine as C, createEvent as D } from "effector";
5
5
  import { createFactory as k, invoke as w } from "@withease/factories";
6
6
  import { g as _, t as Q, c as X, i as Z, e as E, a as ee, b as te, d as se } from "../experience-instance-C4INDX6a.js";
7
7
  import { f as St } from "../experience-instance-C4INDX6a.js";
@@ -11,35 +11,35 @@ import { a as kt } from "../storage-BLmAhfhl.js";
11
11
  import { g as re } from "../id-BW-g3y32.js";
12
12
  import { i as ne } from "../object-JwZ58NOH.js";
13
13
  import { s as L, a as ie, b as oe, c as ae, d as ce } from "../supports-BjhuLJ8z.js";
14
- import { h as Ft, f as bt, j as It, e as xt, g as Et, i as Pt, k as Rt } from "../supports-BjhuLJ8z.js";
15
- const H = b("experience"), ue = k(
14
+ import { h as bt, f as Ft, j as It, e as xt, g as Et, i as Pt, k as Rt } from "../supports-BjhuLJ8z.js";
15
+ const H = F("experience"), ue = k(
16
16
  ({ client: t, experience: e }) => {
17
17
  const s = H.store(e), n = I(s, {
18
- merge(u, h) {
18
+ merge(l, h) {
19
19
  return {
20
- ...u,
20
+ ...l,
21
21
  ...h.experience
22
22
  };
23
23
  }
24
- }), o = s.map((u) => ({
25
- name: u.name,
26
- decisionLogic: u.condition ?? u.decide,
27
- targetSelectors: u.targets,
24
+ }), o = s.map((l) => ({
25
+ name: l.name,
26
+ decisionLogic: l.condition ?? l.decide,
27
+ targetSelectors: l.targets,
28
28
  initializeOpenLogic: e.initializeOpen
29
- })), l = t.components.listStore.map(
30
- (u) => u.find((h) => h.name === `experience:${e.id}`) || u.find((h) => h.name === "experience"),
29
+ })), u = t.components.listStore.map(
30
+ (l) => l.find((h) => h.name === `experience:${e.id}`) || l.find((h) => h.name === "experience"),
31
31
  { skipVoid: !1 }
32
- ), r = s.map((u) => ({
33
- steps: u.steps,
34
- nodes: u.nodes,
35
- edges: u.edges,
36
- conditionals: u.conditionals
32
+ ), r = s.map((l) => ({
33
+ steps: l.steps,
34
+ nodes: l.nodes,
35
+ edges: l.edges,
36
+ conditionals: l.conditionals
37
37
  })), i = e.actions ?? [];
38
38
  return {
39
39
  id: e.id,
40
40
  configStore: o,
41
41
  treeStore: r,
42
- componentStore: l,
42
+ componentStore: u,
43
43
  actions: i,
44
44
  merge: n.merge
45
45
  };
@@ -63,16 +63,16 @@ const de = k(({ client: t }) => {
63
63
  i.merge({ experience: r, strategy: "override" });
64
64
  return;
65
65
  }
66
- const u = le({ client: t, experience: r });
67
- s.register(u);
66
+ const l = le({ client: t, experience: r });
67
+ s.register(l);
68
68
  }
69
69
  const o = e.map((r) => Object.values(r));
70
- function l(r) {
70
+ function u(r) {
71
71
  return e.map((i) => i[r], { skipVoid: !1 });
72
72
  }
73
73
  return {
74
74
  register: n,
75
- getById: l,
75
+ getById: u,
76
76
  listStore: o
77
77
  };
78
78
  });
@@ -81,17 +81,17 @@ function pe(t) {
81
81
  }
82
82
  const ge = (t, e) => {
83
83
  e.register(t);
84
- }, K = (t, e) => {
84
+ }, G = (t, e) => {
85
85
  const { targetSelectors: s } = e.configStore.getState(), n = _(s, e.id);
86
86
  n.forEach(
87
- ({ elements: l }) => l.forEach((r) => Q(r, e.id))
88
- ), X(n, e.id).forEach((l) => {
89
- t.experienceInstances.spawn(e, l);
87
+ ({ elements: u }) => u.forEach((r) => Q(r, e.id))
88
+ ), X(n, e.id).forEach((u) => {
89
+ t.experienceInstances.spawn(e, u);
90
90
  });
91
91
  }, M = async (t) => {
92
92
  await Promise.all(
93
93
  t.experiences.listStore.getState().map(async (e) => {
94
- await fe(t, e) && K(t, e);
94
+ await fe(t, e) && G(t, e);
95
95
  })
96
96
  );
97
97
  }, fe = async (t, e) => {
@@ -100,10 +100,10 @@ const ge = (t, e) => {
100
100
  }, me = (t, e, s) => {
101
101
  const n = e.name, o = e.setup(t);
102
102
  if (o) {
103
- const l = s[n] ?? {};
104
- s[n] = Object.freeze({ ...l, ...o });
103
+ const u = s[n] ?? {};
104
+ s[n] = Object.freeze({ ...u, ...o });
105
105
  }
106
- }, he = b("component"), ye = k(
106
+ }, he = F("component"), ye = k(
107
107
  ({ client: t, component: e, name: s }) => {
108
108
  const n = t.frameworks.getByName(e.frameworkName);
109
109
  return {
@@ -134,12 +134,12 @@ const ve = k(({ client: t }) => {
134
134
  s.register(h);
135
135
  }
136
136
  const o = e.map((r) => Object.values(r));
137
- function l(r) {
137
+ function u(r) {
138
138
  return e.map((i) => i[r], { skipVoid: !1 });
139
139
  }
140
140
  return {
141
141
  register: n,
142
- getByName: l,
142
+ getByName: u,
143
143
  listStore: o
144
144
  };
145
145
  });
@@ -148,7 +148,7 @@ function ke(t) {
148
148
  }
149
149
  const V = (t, e, s) => {
150
150
  s.register(t, e);
151
- }, we = b("framework"), Fe = k(({ client: t }) => {
151
+ }, we = F("framework"), be = k(({ client: t }) => {
152
152
  const e = we.store({}), s = I(e, {
153
153
  register(r, i) {
154
154
  return {
@@ -164,17 +164,17 @@ const V = (t, e, s) => {
164
164
  ), s.register({ name: r, framework: i });
165
165
  }
166
166
  const o = e.map((r) => Object.values(r));
167
- function l(r) {
167
+ function u(r) {
168
168
  return e.map((i) => i[r], { skipVoid: !1 });
169
169
  }
170
170
  return {
171
171
  register: n,
172
- getByName: l,
172
+ getByName: u,
173
173
  listStore: o
174
174
  };
175
175
  });
176
- function be(t) {
177
- return w(Fe, t);
176
+ function Fe(t) {
177
+ return w(be, t);
178
178
  }
179
179
  const Ie = (t, e) => {
180
180
  e.register(t.name, t);
@@ -184,12 +184,12 @@ const Ie = (t, e) => {
184
184
  let n = 0;
185
185
  if (s.isSet() && (n = s.json() ?? 0), n && e - n < xe)
186
186
  return !0;
187
- const o = Pe(t.apiUrl), l = {
187
+ const o = Pe(t.apiUrl), u = {
188
188
  projectId: t.projectId,
189
189
  path: window.location.pathname
190
- }, r = JSON.stringify(l), i = {
190
+ }, r = JSON.stringify(u), i = {
191
191
  "Content-Type": "application/json"
192
- }, u = document.getElementById("picked_script"), h = u == null ? void 0 : u.dataset.verceltoken;
192
+ }, l = document.getElementById("picked_script"), h = l == null ? void 0 : l.dataset.verceltoken;
193
193
  h && (i["x-vercel-protection-bypass"] = h);
194
194
  const d = (await fetch(o, {
195
195
  method: "POST",
@@ -213,7 +213,7 @@ function Be(t) {
213
213
  };
214
214
  return Object.freeze(s);
215
215
  }
216
- const Ae = b("predicate"), $e = k(({ client: t }) => {
216
+ const Ae = F("predicate"), $e = k(({ client: t }) => {
217
217
  const e = Ae.store({}), s = I(e, {
218
218
  register(r, i) {
219
219
  return {
@@ -232,12 +232,12 @@ const Ae = b("predicate"), $e = k(({ client: t }) => {
232
232
  ), s.register(Object.freeze({ name: r, predicate: i }));
233
233
  }
234
234
  const o = e.map((r) => Object.values(r));
235
- function l(r) {
235
+ function u(r) {
236
236
  return e.map((i) => i[r], { skipVoid: !1 });
237
237
  }
238
238
  return {
239
239
  register: n,
240
- getByName: l,
240
+ getByName: u,
241
241
  listStore: o
242
242
  };
243
243
  });
@@ -246,7 +246,7 @@ function je(t) {
246
246
  }
247
247
  const Oe = (t, e, s) => {
248
248
  s.register(t, e);
249
- }, T = b("feature"), Ce = k(({ client: t }) => {
249
+ }, T = F("feature"), Ce = k(({ client: t }) => {
250
250
  const e = T.store({}), s = T.store([]), n = I(e, {
251
251
  register(d, c) {
252
252
  return {
@@ -274,7 +274,7 @@ const Oe = (t, e, s) => {
274
274
  })
275
275
  );
276
276
  }
277
- const l = U(
277
+ const u = U(
278
278
  async ({
279
279
  id: d,
280
280
  key: c,
@@ -288,7 +288,7 @@ const Oe = (t, e, s) => {
288
288
  return null;
289
289
  const c = B(`feature:${d.id}:${d.key}`, "global");
290
290
  (d.storage === "session" ? O : j).set(c, d.bucket);
291
- }), i = /* @__PURE__ */ new Map(), u = J({
291
+ }), i = /* @__PURE__ */ new Map(), l = J({
292
292
  source: { allFeaturesStore: e, resolvedFeaturesStore: s },
293
293
  effect: async ({ allFeaturesStore: d, resolvedFeaturesStore: c }, { id: a, decide: p, key: f }) => {
294
294
  const g = c.find(
@@ -299,9 +299,9 @@ const Oe = (t, e, s) => {
299
299
  const y = d[a];
300
300
  if (!y)
301
301
  throw new Error(`Feature with id '${a}' not found`);
302
- const F = i.get(`${a}:${f}`);
303
- if (F !== void 0) {
304
- const $ = await F;
302
+ const b = i.get(`${a}:${f}`);
303
+ if (b !== void 0) {
304
+ const $ = await b;
305
305
  return { id: y.id, bucket: $, key: f, storage: y.feature.storage };
306
306
  }
307
307
  const A = p();
@@ -316,10 +316,10 @@ const Oe = (t, e, s) => {
316
316
  const { id: c, feature: a } = d;
317
317
  return { id: c, key: a.feature.key, storage: a.feature.storage };
318
318
  },
319
- target: l
319
+ target: u
320
320
  }), x({
321
321
  source: e,
322
- clock: u.doneData,
322
+ clock: l.doneData,
323
323
  fn: (d, c) => {
324
324
  var y;
325
325
  const { id: a, bucket: p, storage: f } = c, g = (y = d[a]) == null ? void 0 : y.feature.key;
@@ -345,13 +345,13 @@ const Oe = (t, e, s) => {
345
345
  id: a.id,
346
346
  name: a.feature.name,
347
347
  key: a.feature.key,
348
- getBucket: async () => await u(a.feature),
348
+ getBucket: async () => await l(a.feature),
349
349
  isResolved: !1
350
350
  };
351
351
  })
352
352
  );
353
353
  x({
354
- clock: u.doneData,
354
+ clock: l.doneData,
355
355
  source: { resolvedFeatures: s },
356
356
  filter: ({ resolvedFeatures: d }, { id: c, key: a }) => !d.some(
357
357
  (f) => f.id === c && f.key === a
@@ -362,7 +362,7 @@ const Oe = (t, e, s) => {
362
362
  feature: d
363
363
  }))
364
364
  }), x({
365
- clock: [l.doneData, u.doneData],
365
+ clock: [u.doneData, l.doneData],
366
366
  source: s,
367
367
  fn: (d, c) => !c || d.some(
368
368
  (p) => p.id === c.id && p.key === c.key
@@ -383,7 +383,7 @@ function De(t) {
383
383
  }
384
384
  const Ue = (t, e, s) => {
385
385
  s.register(t, e);
386
- }, R = b("history");
386
+ }, R = F("history");
387
387
  function N(t, e) {
388
388
  return {
389
389
  // eslint-disable-next-line sonarjs/pseudo-random
@@ -403,22 +403,22 @@ const Me = k(() => {
403
403
  N(i.experienceId, i.node)
404
404
  ]
405
405
  })), t.on(o, (r, i) => i);
406
- function l(r, i) {
407
- const u = { lastStepIndex: -1, secondLastStepIndex: -1 };
406
+ function u(r, i) {
407
+ const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
408
408
  for (let h = r.length - 1; h >= 0; h--) {
409
409
  const S = r[h], d = S == null ? void 0 : S.node;
410
410
  if (!(!d || !ee(d)) && !(i && (S == null ? void 0 : S.experienceId) !== i))
411
- if (u.lastStepIndex === -1)
412
- u.lastStepIndex = h;
411
+ if (l.lastStepIndex === -1)
412
+ l.lastStepIndex = h;
413
413
  else {
414
- u.secondLastStepIndex = h;
414
+ l.secondLastStepIndex = h;
415
415
  break;
416
416
  }
417
417
  }
418
- return u;
418
+ return l;
419
419
  }
420
420
  return t.on(n, (r, i) => {
421
- const { secondLastStepIndex: u } = l(r.entries, i.experienceId), h = u !== -1 ? r.entries.slice(0, u + 1) : r.entries;
421
+ const { secondLastStepIndex: l } = u(r.entries, i.experienceId), h = l !== -1 ? r.entries.slice(0, l + 1) : r.entries;
422
422
  return {
423
423
  ...r,
424
424
  entries: h
@@ -434,7 +434,7 @@ const Me = k(() => {
434
434
  function Ve() {
435
435
  return w(Me);
436
436
  }
437
- const Te = () => D(), Ne = b("field"), ze = k(() => {
437
+ const Te = () => D(), Ne = F("field"), ze = k(() => {
438
438
  const t = Ne.store({}), e = I(t, {
439
439
  register(r, i) {
440
440
  return {
@@ -450,14 +450,14 @@ const Te = () => D(), Ne = b("field"), ze = k(() => {
450
450
  function o(r) {
451
451
  return t.map((i) => i[r] || null);
452
452
  }
453
- function l(r) {
454
- return t.map((i) => Object.values(i).find((u) => u.name === r) || null);
453
+ function u(r) {
454
+ return t.map((i) => Object.values(i).find((l) => l.name === r) || null);
455
455
  }
456
456
  return {
457
457
  register: s,
458
458
  getById: o,
459
459
  listStore: n,
460
- getByName: l
460
+ getByName: u
461
461
  };
462
462
  });
463
463
  function _e() {
@@ -465,11 +465,11 @@ function _e() {
465
465
  }
466
466
  const Le = (t, e) => {
467
467
  e.register(t);
468
- }, He = b("action"), Ke = k(() => {
468
+ }, He = F("action"), Ge = k(() => {
469
469
  const t = He.store({}), e = I(t, {
470
- register(l, r) {
470
+ register(u, r) {
471
471
  return {
472
- ...l,
472
+ ...u,
473
473
  [r.name]: {
474
474
  name: r.name,
475
475
  action: r.action
@@ -477,12 +477,12 @@ const Le = (t, e) => {
477
477
  };
478
478
  }
479
479
  });
480
- function s(l, r) {
481
- e.register({ name: l, action: r });
480
+ function s(u, r) {
481
+ e.register({ name: u, action: r });
482
482
  }
483
- const n = t.map((l) => Object.values(l));
484
- function o(l) {
485
- return t.map((r) => r[l], { skipVoid: !1 });
483
+ const n = t.map((u) => Object.values(u));
484
+ function o(u) {
485
+ return t.map((r) => r[u], { skipVoid: !1 });
486
486
  }
487
487
  return {
488
488
  register: s,
@@ -490,16 +490,16 @@ const Le = (t, e) => {
490
490
  listStore: n
491
491
  };
492
492
  });
493
- function qe() {
494
- return w(Ke);
493
+ function Ke() {
494
+ return w(Ge);
495
495
  }
496
- const Ge = (t, e, s) => {
496
+ const qe = (t, e, s) => {
497
497
  s.register(t, e);
498
498
  };
499
499
  function z(t) {
500
500
  return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
501
501
  }
502
- const We = b("response"), Ye = k(({ client: t }) => {
502
+ const We = F("response"), Ye = k(({ client: t }) => {
503
503
  const e = We.store({}), s = D(), n = D(), o = I(e, {
504
504
  register(c, a) {
505
505
  return {
@@ -521,7 +521,7 @@ const We = b("response"), Ye = k(({ client: t }) => {
521
521
  return {};
522
522
  }
523
523
  });
524
- function l(c, a) {
524
+ function u(c, a) {
525
525
  o.register({ fieldId: c, response: a });
526
526
  }
527
527
  async function r(c) {
@@ -540,19 +540,19 @@ const We = b("response"), Ye = k(({ client: t }) => {
540
540
  return;
541
541
  }
542
542
  if (y.multiple && (typeof g == "string" || typeof g == "number" || typeof g == "boolean") && (g = [g]), y.validation && !ne(y.validation) && !z(g)) {
543
- const F = await E(t, y.validation, {
543
+ const b = await E(t, y.validation, {
544
544
  $input: g
545
545
  });
546
- if (typeof F == "string") {
546
+ if (typeof b == "string") {
547
547
  a.push({
548
548
  fieldId: p,
549
- userMessage: F,
550
- systemMessage: `Field validation resulted in an error: ${F}.`,
549
+ userMessage: b,
550
+ systemMessage: `Field validation resulted in an error: ${b}.`,
551
551
  value: g
552
552
  });
553
553
  return;
554
554
  }
555
- if (F === !1) {
555
+ if (b === !1) {
556
556
  a.push({
557
557
  fieldId: p,
558
558
  userMessage: "This field is invalid",
@@ -581,11 +581,11 @@ const We = b("response"), Ye = k(({ client: t }) => {
581
581
  return;
582
582
  }
583
583
  if (y.options) {
584
- const F = y.options.map((P) => P.value), A = Array.isArray(g) ? g : [g];
585
- Array.isArray(g) && (A.every((P) => F.includes(P)) || a.push({
584
+ const b = y.options.map((P) => P.value), A = Array.isArray(g) ? g : [g];
585
+ Array.isArray(g) && (A.every((P) => b.includes(P)) || a.push({
586
586
  fieldId: p,
587
587
  userMessage: "This field expects a valid option",
588
- systemMessage: `Field expects a valid option. Valid options are: ${F.join(", ")}`,
588
+ systemMessage: `Field expects a valid option. Valid options are: ${b.join(", ")}`,
589
589
  value: g
590
590
  }));
591
591
  }
@@ -596,7 +596,7 @@ const We = b("response"), Ye = k(({ client: t }) => {
596
596
  const { responsesToCommit: a, validationErrors: p } = await r(c);
597
597
  return p.length ? { errors: p } : (o.registerBatch(a), { errors: [] });
598
598
  }
599
- const u = e.map((c) => c), h = e.map((c) => Object.keys(c).map((p) => ({
599
+ const l = e.map((c) => c), h = e.map((c) => Object.keys(c).map((p) => ({
600
600
  fieldId: p,
601
601
  value: c[p]
602
602
  })));
@@ -618,13 +618,13 @@ const We = b("response"), Ye = k(({ client: t }) => {
618
618
  clock: n,
619
619
  target: o.clear
620
620
  }), {
621
- register: l,
621
+ register: u,
622
622
  clearAll: s,
623
623
  clear: n,
624
624
  commit: i,
625
625
  getResponsesToCommit: r,
626
626
  listStore: h,
627
- getAllStore: u,
627
+ getAllStore: l,
628
628
  getByFieldId: S,
629
629
  getByFieldName: d
630
630
  };
@@ -632,7 +632,7 @@ const We = b("response"), Ye = k(({ client: t }) => {
632
632
  function Je(t) {
633
633
  return w(Ye, t);
634
634
  }
635
- const Qe = () => "0.0.1-dev.1764914073687";
635
+ const Qe = () => "0.0.1-dev.1764917673864";
636
636
  function Xe() {
637
637
  if (L()) {
638
638
  const t = [
@@ -655,8 +655,8 @@ function Ze() {
655
655
  for (const [o] of t.entries())
656
656
  o.startsWith("picked-") && s.add(o);
657
657
  for (const o of s) {
658
- const l = o.replace("picked-", "");
659
- e[l] = t.getAll(o);
658
+ const u = o.replace("picked-", "");
659
+ e[u] = t.getAll(o);
660
660
  }
661
661
  const n = B("s");
662
662
  if (s.size > 0)
@@ -687,7 +687,7 @@ const tt = B("session", "global"), st = () => {
687
687
  };
688
688
  return s(n), n;
689
689
  }, rt = () => oe() ? st() : null;
690
- class q {
690
+ class K {
691
691
  constructor(e) {
692
692
  m(this, "options");
693
693
  m(this, "isReady", !1);
@@ -705,20 +705,28 @@ class q {
705
705
  m(this, "components", ke({ client: this }));
706
706
  m(this, "experienceInstances", te({ client: this }));
707
707
  m(this, "experiences", pe({ client: this }));
708
- m(this, "frameworks", be({ client: this }));
708
+ m(this, "frameworks", Fe({ client: this }));
709
709
  m(this, "predicates", je({ client: this }));
710
710
  m(this, "features", De({ client: this }));
711
711
  m(this, "responses", Je({ client: this }));
712
712
  m(this, "fields", _e());
713
- m(this, "actions", qe());
713
+ m(this, "actions", Ke());
714
714
  v("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Xe(), this.session = rt(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: Qe() }), v("info", "Picked client initialized.");
715
715
  }
716
716
  start() {
717
717
  Re(this), (async () => {
718
718
  if (!L())
719
719
  return;
720
- let s = !0, n;
721
- this.precondition !== void 0 && await E(this, this.precondition) !== !0 && (n = !1, s = !1), this.condition !== void 0 && n !== !1 && await E(this, this.condition) !== !0 && (s = !1), this.session && this.session.setIsUser(s), this.eventBus({ type: "initialize" }), this.eventBus({ type: "user_decide", value: s }), document.body && s && M(this), await se(), s && M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
720
+ let s;
721
+ typeof this.precondition > "u" ? s = !0 : typeof this.precondition == "boolean" ? s = this.precondition : s = await E(this, this.precondition) === !0;
722
+ let n;
723
+ s && (this.condition === void 0 ? n = !0 : typeof this.condition == "boolean" ? n = this.condition : n = await E(this, this.condition) === !0);
724
+ const o = s && n === !0;
725
+ if (typeof n == "boolean" && this.session) {
726
+ const u = n;
727
+ this.session.setIsUser(u), this.eventBus({ type: "user_decide", value: u });
728
+ }
729
+ this.eventBus({ type: "initialize" }), document.body && o && M(this), await se(), o && M(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session && this.eventBus({ type: "session", ...this.session });
722
730
  })();
723
731
  }
724
732
  registerFramework(e) {
@@ -740,7 +748,7 @@ class q {
740
748
  Le(e, this.fields);
741
749
  }
742
750
  registerAction(e, s) {
743
- Ge(e, s, this.actions);
751
+ qe(e, s, this.actions);
744
752
  }
745
753
  registerExperience(e) {
746
754
  e.component && V(`experience:${e.id}`, e.component, this.components), ge(e, this.experiences);
@@ -754,7 +762,7 @@ class q {
754
762
  v("warn", `Experience with id '${e}' not found.`);
755
763
  return;
756
764
  }
757
- K(this, s);
765
+ G(this, s);
758
766
  }
759
767
  // private async fetchProject() {
760
768
  // if (this.project) {
@@ -792,13 +800,13 @@ class q {
792
800
  const [n, o] = s.split(":");
793
801
  if (!n || !o)
794
802
  return;
795
- let l = o;
796
- l === "true" && (l = !0), l === "false" && (l = !1), this.registerFeature(n, {
797
- key: `${l}`,
803
+ let u = o;
804
+ u === "true" && (u = !0), u === "false" && (u = !1), this.registerFeature(n, {
805
+ key: `${u}`,
798
806
  // use the assigned bucket value as the key
799
807
  name: n,
800
808
  // eslint-disable-next-line sonarjs/function-return-type
801
- decide: () => l,
809
+ decide: () => u,
802
810
  storage: "session"
803
811
  });
804
812
  } catch {
@@ -829,34 +837,34 @@ class q {
829
837
  return this.plugins[e] ?? {};
830
838
  }
831
839
  }
832
- m(q, "logger", v);
833
- function G(t) {
840
+ m(K, "logger", v);
841
+ function q(t) {
834
842
  var e;
835
843
  return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
836
844
  }
837
845
  function nt(t) {
838
- return t.some((e) => e.condition || G(e));
846
+ return t.some((e) => e.condition || q(e));
839
847
  }
840
848
  async function ft(t, e) {
841
849
  return e.length === 0 || !nt(e) ? e : (await Promise.all(
842
850
  e.map(async (n) => {
843
851
  if (!(n.condition ? await E(t, n.condition) : !0))
844
852
  return null;
845
- if (!n.options || !G(n))
853
+ if (!n.options || !q(n))
846
854
  return n;
847
855
  const r = (await Promise.all(
848
- n.options.map(async (u) => u.condition ? await E(t, u.condition) ? u : null : u)
849
- )).filter((u) => u !== null);
856
+ n.options.map(async (l) => l.condition ? await E(t, l.condition) ? l : null : l)
857
+ )).filter((l) => l !== null);
850
858
  return r.length === n.options.length ? n : r.length === 0 ? null : { ...n, options: r };
851
859
  })
852
860
  )).filter((n) => n !== null);
853
861
  }
854
862
  const mt = (t) => {
855
- const e = new q(t);
863
+ const e = new K(t);
856
864
  return ce(e), e;
857
865
  };
858
866
  export {
859
- q as Picked,
867
+ K as Picked,
860
868
  mt as createClient,
861
869
  B as createStorageKey,
862
870
  E as evaluateRuleLogic,
@@ -865,10 +873,10 @@ export {
865
873
  j as localStore,
866
874
  O as sessionStore,
867
875
  kt as subscribe,
868
- Ft as supportsCookies,
876
+ bt as supportsCookies,
869
877
  ae as supportsCryptoRandomUUID,
870
878
  L as supportsDocument,
871
- bt as supportsHistory,
879
+ Ft as supportsHistory,
872
880
  It as supportsIntersectionObserver,
873
881
  oe as supportsLocalStorage,
874
882
  xt as supportsLocation,
@@ -21,8 +21,8 @@ export declare class Picked {
21
21
  readonly projectId: string;
22
22
  readonly apiUrl: string;
23
23
  readonly session?: SessionStore | null;
24
- readonly precondition?: LogicRule;
25
- readonly condition?: LogicRule;
24
+ readonly precondition?: LogicRule | boolean;
25
+ readonly condition?: LogicRule | boolean;
26
26
  readonly searchParams: import('./utils/search-params').PickedSearchParams;
27
27
  readonly history: {
28
28
  push: import('effector').EventCallable<{
@@ -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,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,qBAAa,MAAM;IACjB,MAAM,CAAC,QAAQ,CAAC,MAAM,0FAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAE7C,OAAO,UAAQ;I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