@picked/client 0.0.1-dev.1764956808030 → 0.0.1-dev.1765227621508
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 h=(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"),b=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,y){return{...l,...y.experience}}}),i=r.map(l=>({name:l.name,decisionLogic:l.condition??l.decide,targetSelectors:l.targets,initializeOpenLogic:e.initializeOpen})),a=t.components.listStore.map(l=>l.find(y=>y.name===`experience:${e.id}`)||l.find(y=>y.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:a,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 a(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getById:a,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=b.getTargetElements(r,e.id);n.forEach(({elements:a})=>a.forEach(s=>b.tagTargetElement(s,e.id))),b.createAppHosts(n,e.id).forEach(a=>{t.experienceInstances.spawn(e,a)})},D=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 b.getTargetElements(n,e.id).length<1||n.length===0?!1:r&&b.isRulesLogic(r)?await b.evaluateRuleLogic(t,r)===!0:!0},Y=(t,e,r)=>{const n=e.name,i=e.setup(t);if(i){const a=r[n]??{};r[n]=Object.freeze({...a,...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 y=X({client:t,name:s,component:o});r.register(y)}const i=e.map(s=>Object.values(s));function a(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:a,listStore:i}});function ee(t){return S.invoke(Z,t)}const B=(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 a(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:a,listStore:i}});function se(t){return S.invoke(re,t)}const ne=(t,e)=>{e.register(t.name,t)},ie=6e3,oe=k.createStorageKey("last_ping","global"),ae=t=>`${t}/api/v1/ping`,ce=async t=>{try{const e=Date.now(),r=k.localStore.get(oe);let n=0;if(r.isSet()&&(n=r.json()??0),n&&e-n<ie)return!0;const i=ae(t.apiUrl),a={projectId:t.projectId,path:window.location.pathname},s=JSON.stringify(a),o={"Content-Type":"application/json"},l=document.getElementById("picked_script"),y=l==null?void 0:l.dataset.verceltoken;y&&(o["x-vercel-protection-bypass"]=y);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 a(s){return e.map(o=>o[s],{skipVoid:!1})}return{register:n,getByName:a,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,u){return{...d,[u.id]:u.feature}}});function i(d,u){e.getState()[d]&&I.logger("warn",`Feature '${d}' already registered. Registering again will override the previous registration.`);const p={id:d,feature:{...u,id:d}};n.register(Object.freeze({id:d,feature:p}))}const a=f.createEffect(async({id:d,key:u,storage:c="local"})=>{const p=k.createStorageKey(`feature:${d}:${u}`,"global"),g=(c==="session"?k.sessionStore:k.localStore).get(p).boolean();return g===null?null:{id:d,key:u,bucket:g,storage:c}}),s=f.createEffect(d=>{if(!d)return null;const u=k.createStorageKey(`feature:${d.id}:${d.key}`,"global");(d.storage==="session"?k.sessionStore:k.localStore).set(u,d.bucket)}),o=new Map,l=f.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:d,resolvedFeaturesStore:u},{id:c,decide:p,key:m})=>{const g=u.find(A=>A.id===c&&A.key===m);if(g)return g;const v=d[c];if(!v)throw new Error(`Feature with id '${c}' not found`);const x=o.get(`${c}:${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(`${c}:${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:u,feature:c}=d;return{id:u,key:c.feature.key,storage:c.feature.storage}},target:a}),f.sample({source:e,clock:l.doneData,fn:(d,u)=>{var v;const{id:c,bucket:p,storage:m}=u,g=(v=d[c])==null?void 0:v.feature.key;return g?{key:g,id:c,bucket:p,storage:m}:null},target:s});const y=f.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:d,resolvedFeaturesStore:u})=>Object.values(d).map(c=>{const p=u.find(m=>m.id===c.id&&m.key===c.feature.key);return p?{id:c.id,name:c.feature.name,key:c.feature.key,getBucket:()=>({id:c.id,bucket:p.bucket}),isResolved:!0}:{id:c.id,name:c.feature.name,key:c.feature.key,getBucket:async()=>await l(c.feature),isResolved:!1}}));f.sample({clock:l.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:d},{id:u,key:c})=>!d.some(m=>m.id===u&&m.key===c),fn:(d,u)=>u,target:t.eventBus.prepend(d=>({type:"feature_decide",feature:d}))}),f.sample({clock:[a.doneData,l.doneData],source:r,fn:(d,u)=>!u||d.some(p=>p.id===u.id&&p.key===u.key)?d:[...d,u],target:r});function F(d){return e.map(u=>u[d],{skipVoid:!1})}return{register:i,getByName:F,listStore:y}});function me(t){return S.invoke(fe,t)}const he=(t,e,r)=>{r.register(t,e)},R=f.createDomain("history");function O(t,e){return{id:N.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const ye=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,O(o.experienceId,o.node)]})),t.on(r,(s,o)=>({entries:[...s.entries.slice(0,-1),O(o.experienceId,o.node)]})),t.on(i,(s,o)=>o);function a(s,o){const l={lastStepIndex:-1,secondLastStepIndex:-1};for(let y=s.length-1;y>=0;y--){const F=s[y],d=F==null?void 0:F.node;if(!(!d||!b.isStepNode(d))&&!(o&&(F==null?void 0:F.experienceId)!==o))if(l.lastStepIndex===-1)l.lastStepIndex=y;else{l.secondLastStepIndex=y;break}}return l}return t.on(n,(s,o)=>{const{secondLastStepIndex:l}=a(s.entries,o.experienceId),y=l!==-1?s.entries.slice(0,l+1):s.entries;return{...s,entries:y}}),{push:e,replace:r,back:n,restore:i,entriesStore:t.map(s=>s.entries)}});function Se(){return S.invoke(ye)}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 a(s){return t.map(o=>Object.values(o).find(l=>l.name===s)||null)}return{register:r,getById:i,listStore:n,getByName:a}});function be(){return S.invoke(we)}const Fe=(t,e)=>{e.register(t)},Ie=f.createDomain("action"),xe=S.createFactory(()=>{const t=Ie.store({}),e=f.createApi(t,{register(a,s){return{...a,[s.name]:{name:s.name,action:s.action}}}});function r(a,s){e.register({name:a,action:s})}const n=t.map(a=>Object.values(a));function i(a){return t.map(s=>s[a],{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 C(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(u,c){return{...u,[c.fieldId]:c.response}},registerBatch(u,c){return{...u,...c}},clear(u,c){const{[c]:p,...m}=u;return m},clearAll(){return{}}});function a(u,c){i.register({fieldId:u,response:c})}async function s(u){const c=[];return await Promise.allSettled(Object.entries(u).map(async([p,m])=>{let g=m;const v=t.fields.getById(p).getState();if(!v){c.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)&&!C(g)){const x=await b.evaluateRuleLogic(t,v.validation,{$input:g});if(typeof x=="string"){c.push({fieldId:p,userMessage:x,systemMessage:`Field validation resulted in an error: ${x}.`,value:g});return}if(x===!1){c.push({fieldId:p,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:g});return}}if(v.required&&C(g)){c.push({fieldId:p,userMessage:"This field is required",systemMessage:"Field is required.",value:g});return}if(!v.multiple&&Array.isArray(g)&&g.length>1){c.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))||c.push({fieldId:p,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:g}))}})),{responsesToCommit:u,validationErrors:c}}async function o(u){const{responsesToCommit:c,validationErrors:p}=await s(u);return p.length?{errors:p}:(i.registerBatch(c),{errors:[]})}const l=e.map(u=>u),y=e.map(u=>Object.keys(u).map(p=>({fieldId:p,value:u[p]})));function F(u){const c=t.fields.getById(u),p=e.map(m=>m[u]||null);return f.combine({f:c,r:p},({f:m,r:g})=>g||(m!=null&&m.defaultValue?m.defaultValue:null))}function d(u){const c=t.fields.getByName(u);return f.combine({f:c,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:a,clearAll:r,clear:n,commit:o,getResponsesToCommit:s,listStore:y,getAllStore:l,getByFieldId:F,getByFieldName:d}});function je(t){return S.invoke(Ae,t)}const De=()=>"0.0.1-dev.1764956808030";function Be(){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 a=i.replace("picked-","");e[a]=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 Oe(){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 Ce=k.createStorageKey("session","global"),Ue=()=>{const t=k.localStore.get(Ce);let e;t.isSet()&&(e=t.json());const r=i=>t.set({id:i.id,isUser:i.isUser,identifiers:i.identifiers}),n={id:(e==null?void 0:e.id)??Oe(),isUser:(e==null?void 0:e.isUser)??void 0,identifiers:(e==null?void 0:e.identifiers)??void 0,setIsUser(i){this.isUser=i,r(this)},setIdentifier(i,a){this.identifiers=Object.assign({},this.identifiers,{[i]:a}),r(this)},removeIdentifier(i){this.identifiers&&(this.identifiers=Object.fromEntries(Object.entries(this.identifiers).filter(([a])=>a!==i)),this.identifiers=Object.keys(this.identifiers).length?this.identifiers:void 0,r(this))}};return r(n),n},Le=()=>w.supportsLocalStorage()?Ue():null;class j{constructor(e){h(this,"options");h(this,"isReady",!1);h(this,"project");h(this,"plugins",{});h(this,"eventBus",ve());h(this,"organizationId");h(this,"projectId");h(this,"apiUrl");h(this,"session");h(this,"precondition");h(this,"condition");h(this,"searchParams",$e());h(this,"history",Se());h(this,"components",ee({client:this}));h(this,"experienceInstances",b.createExperienceInstanceIndex({client:this}));h(this,"experiences",H({client:this}));h(this,"frameworks",se({client:this}));h(this,"predicates",pe({client:this}));h(this,"features",me({client:this}));h(this,"responses",je({client:this}));h(this,"fields",be());h(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||Be(),this.session=Le(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.precondition=e.precondition,this.condition=e.condition,this.eventBus({type:"load",version:De()}),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 b.evaluateRuleLogic(this,this.precondition)===!0;let n;r&&(this.condition===void 0?n=!0:typeof this.condition=="boolean"?n=this.condition:n=await b.evaluateRuleLogic(this,this.condition)===!0);const i=r&&n===!0;if(typeof n=="boolean"&&this.session){const a=n;this.session.setIsUser(a),this.eventBus({type:"user_decide",value:a})}this.eventBus({type:"initialize"}),document.body&&i&&D(this),await b.domInteractive(),i&&D(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){B(e,r,this.components)}registerPlugin(e){Y(this,e,this.plugins)}registerFeature(e,r){he(e,r,this.features)}registerPredicate(e,r){ge(e,r,this.predicates)}registerField(e){Fe(e,this.fields)}registerAction(e,r){Re(e,r,this.actions)}registerExperience(e){e.component&&B(`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 a=i;a==="true"&&(a=!0),a==="false"&&(a=!1),this.registerFeature(n,{key:`${a}`,name:n,decide:()=>a,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]??{}}}h(j,"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 b.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 b.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 j(t);return w.bindClient(e),e};exports.evaluateRuleLogic=b.evaluateRuleLogic;exports.isPickedRoot=b.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=j;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.1765227621508";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,32 +1,32 @@
|
|
|
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
|
|
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
|
-
import { f as
|
|
8
|
-
import { l as
|
|
9
|
-
import { c as
|
|
7
|
+
import { f as St } from "../experience-instance-C4INDX6a.js";
|
|
8
|
+
import { l as v } from "../logger-C9a75KZn.js";
|
|
9
|
+
import { c as B, l as j, s as O } from "../storage-BLmAhfhl.js";
|
|
10
10
|
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 bt, f as
|
|
15
|
-
const H =
|
|
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
|
-
const s = H.store(e), n =
|
|
17
|
+
const s = H.store(e), n = I(s, {
|
|
18
18
|
merge(l, h) {
|
|
19
19
|
return {
|
|
20
20
|
...l,
|
|
21
21
|
...h.experience
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
}),
|
|
24
|
+
}), o = s.map((l) => ({
|
|
25
25
|
name: l.name,
|
|
26
26
|
decisionLogic: l.condition ?? l.decide,
|
|
27
27
|
targetSelectors: l.targets,
|
|
28
28
|
initializeOpenLogic: e.initializeOpen
|
|
29
|
-
})),
|
|
29
|
+
})), u = t.components.listStore.map(
|
|
30
30
|
(l) => l.find((h) => h.name === `experience:${e.id}`) || l.find((h) => h.name === "experience"),
|
|
31
31
|
{ skipVoid: !1 }
|
|
32
32
|
), r = s.map((l) => ({
|
|
@@ -34,13 +34,13 @@ const H = I("experience"), ue = k(
|
|
|
34
34
|
nodes: l.nodes,
|
|
35
35
|
edges: l.edges,
|
|
36
36
|
conditionals: l.conditionals
|
|
37
|
-
})),
|
|
37
|
+
})), i = e.actions ?? [];
|
|
38
38
|
return {
|
|
39
39
|
id: e.id,
|
|
40
|
-
configStore:
|
|
40
|
+
configStore: o,
|
|
41
41
|
treeStore: r,
|
|
42
|
-
componentStore:
|
|
43
|
-
actions:
|
|
42
|
+
componentStore: u,
|
|
43
|
+
actions: i,
|
|
44
44
|
merge: n.merge
|
|
45
45
|
};
|
|
46
46
|
}
|
|
@@ -49,61 +49,61 @@ function le(t) {
|
|
|
49
49
|
return w(ue, t);
|
|
50
50
|
}
|
|
51
51
|
const de = k(({ client: t }) => {
|
|
52
|
-
const e = H.store({}), s =
|
|
53
|
-
register(r,
|
|
52
|
+
const e = H.store({}), s = I(e, {
|
|
53
|
+
register(r, i) {
|
|
54
54
|
return {
|
|
55
55
|
...r,
|
|
56
|
-
[
|
|
56
|
+
[i.id]: i
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
function n(r) {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
|
|
61
|
+
const i = e.getState()[r.id];
|
|
62
|
+
if (i) {
|
|
63
|
+
i.merge({ experience: r, strategy: "override" });
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
const l = le({ client: t, experience: r });
|
|
67
67
|
s.register(l);
|
|
68
68
|
}
|
|
69
|
-
const
|
|
70
|
-
function
|
|
71
|
-
return e.map((
|
|
69
|
+
const o = e.map((r) => Object.values(r));
|
|
70
|
+
function u(r) {
|
|
71
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
72
72
|
}
|
|
73
73
|
return {
|
|
74
74
|
register: n,
|
|
75
|
-
getById:
|
|
76
|
-
listStore:
|
|
75
|
+
getById: u,
|
|
76
|
+
listStore: o
|
|
77
77
|
};
|
|
78
78
|
});
|
|
79
79
|
function pe(t) {
|
|
80
80
|
return w(de, t);
|
|
81
81
|
}
|
|
82
|
-
const
|
|
82
|
+
const ge = (t, e) => {
|
|
83
83
|
e.register(t);
|
|
84
84
|
}, G = (t, e) => {
|
|
85
85
|
const { targetSelectors: s } = e.configStore.getState(), n = _(s, e.id);
|
|
86
86
|
n.forEach(
|
|
87
|
-
({ elements:
|
|
88
|
-
), X(n, e.id).forEach((
|
|
89
|
-
t.experienceInstances.spawn(e,
|
|
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
|
|
94
|
+
await fe(t, e) && G(t, e);
|
|
95
95
|
})
|
|
96
96
|
);
|
|
97
|
-
},
|
|
97
|
+
}, fe = async (t, e) => {
|
|
98
98
|
const { decisionLogic: s, targetSelectors: n } = e.configStore.getState();
|
|
99
99
|
return _(n, e.id).length < 1 || n.length === 0 ? !1 : s && Z(s) ? await E(t, s) === !0 : !0;
|
|
100
100
|
}, me = (t, e, s) => {
|
|
101
|
-
const n = e.name,
|
|
102
|
-
if (
|
|
103
|
-
const
|
|
104
|
-
s[n] = Object.freeze({ ...
|
|
101
|
+
const n = e.name, o = e.setup(t);
|
|
102
|
+
if (o) {
|
|
103
|
+
const u = s[n] ?? {};
|
|
104
|
+
s[n] = Object.freeze({ ...u, ...o });
|
|
105
105
|
}
|
|
106
|
-
}, he =
|
|
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 {
|
|
@@ -113,95 +113,95 @@ const fe = (t, e) => {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
);
|
|
116
|
-
function
|
|
116
|
+
function Se(t) {
|
|
117
117
|
return w(ye, t);
|
|
118
118
|
}
|
|
119
|
-
const
|
|
120
|
-
const e = he.store({}), s =
|
|
121
|
-
register(r,
|
|
119
|
+
const ve = k(({ client: t }) => {
|
|
120
|
+
const e = he.store({}), s = I(e, {
|
|
121
|
+
register(r, i) {
|
|
122
122
|
return {
|
|
123
123
|
...r,
|
|
124
|
-
[
|
|
124
|
+
[i.name]: i
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
function n(r,
|
|
129
|
-
e.getState()[r] &&
|
|
128
|
+
function n(r, i) {
|
|
129
|
+
e.getState()[r] && v(
|
|
130
130
|
"warn",
|
|
131
131
|
`Component '${r}' already registered. Registering again will override the previous registration.`
|
|
132
132
|
);
|
|
133
|
-
const h =
|
|
133
|
+
const h = Se({ client: t, name: r, component: i });
|
|
134
134
|
s.register(h);
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
function
|
|
138
|
-
return e.map((
|
|
136
|
+
const o = e.map((r) => Object.values(r));
|
|
137
|
+
function u(r) {
|
|
138
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
139
139
|
}
|
|
140
140
|
return {
|
|
141
141
|
register: n,
|
|
142
|
-
getByName:
|
|
143
|
-
listStore:
|
|
142
|
+
getByName: u,
|
|
143
|
+
listStore: o
|
|
144
144
|
};
|
|
145
145
|
});
|
|
146
146
|
function ke(t) {
|
|
147
|
-
return w(
|
|
147
|
+
return w(ve, t);
|
|
148
148
|
}
|
|
149
149
|
const V = (t, e, s) => {
|
|
150
150
|
s.register(t, e);
|
|
151
|
-
}, we =
|
|
152
|
-
const e = we.store({}), s =
|
|
153
|
-
register(r,
|
|
151
|
+
}, we = F("framework"), be = k(({ client: t }) => {
|
|
152
|
+
const e = we.store({}), s = I(e, {
|
|
153
|
+
register(r, i) {
|
|
154
154
|
return {
|
|
155
155
|
...r,
|
|
156
|
-
[
|
|
156
|
+
[i.name]: i.framework
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
|
-
function n(r,
|
|
161
|
-
e.getState()[r] &&
|
|
160
|
+
function n(r, i) {
|
|
161
|
+
e.getState()[r] && v(
|
|
162
162
|
"warn",
|
|
163
163
|
`Framework '${r}' already registered. Registering again will override the previous registration.`
|
|
164
|
-
), s.register({ name: r, framework:
|
|
164
|
+
), s.register({ name: r, framework: i });
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
168
|
-
return e.map((
|
|
166
|
+
const o = e.map((r) => Object.values(r));
|
|
167
|
+
function u(r) {
|
|
168
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
169
169
|
}
|
|
170
170
|
return {
|
|
171
171
|
register: n,
|
|
172
|
-
getByName:
|
|
173
|
-
listStore:
|
|
172
|
+
getByName: u,
|
|
173
|
+
listStore: o
|
|
174
174
|
};
|
|
175
175
|
});
|
|
176
|
-
function
|
|
176
|
+
function Fe(t) {
|
|
177
177
|
return w(be, t);
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const Ie = (t, e) => {
|
|
180
180
|
e.register(t.name, t);
|
|
181
|
-
}, xe = 6e3, Ee =
|
|
181
|
+
}, xe = 6e3, Ee = B("last_ping", "global"), Pe = (t) => `${t}/api/v1/ping`, Re = async (t) => {
|
|
182
182
|
try {
|
|
183
|
-
const e = Date.now(), s =
|
|
183
|
+
const e = Date.now(), s = j.get(Ee);
|
|
184
184
|
let n = 0;
|
|
185
185
|
if (s.isSet() && (n = s.json() ?? 0), n && e - n < xe)
|
|
186
186
|
return !0;
|
|
187
|
-
const
|
|
187
|
+
const o = Pe(t.apiUrl), u = {
|
|
188
188
|
projectId: t.projectId,
|
|
189
189
|
path: window.location.pathname
|
|
190
|
-
}, r = JSON.stringify(
|
|
190
|
+
}, r = JSON.stringify(u), i = {
|
|
191
191
|
"Content-Type": "application/json"
|
|
192
192
|
}, l = document.getElementById("picked_script"), h = l == null ? void 0 : l.dataset.verceltoken;
|
|
193
|
-
h && (
|
|
194
|
-
const d = (await fetch(
|
|
193
|
+
h && (i["x-vercel-protection-bypass"] = h);
|
|
194
|
+
const d = (await fetch(o, {
|
|
195
195
|
method: "POST",
|
|
196
|
-
headers:
|
|
196
|
+
headers: i,
|
|
197
197
|
body: r
|
|
198
198
|
})).ok;
|
|
199
199
|
return d && s.set(e), d;
|
|
200
200
|
} catch (e) {
|
|
201
|
-
return
|
|
201
|
+
return v("error", e), !1;
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
|
-
function
|
|
204
|
+
function Be(t) {
|
|
205
205
|
const e = typeof window < "u", s = {
|
|
206
206
|
client: t,
|
|
207
207
|
responses: t.responses.listStore.getState(),
|
|
@@ -213,57 +213,57 @@ function je(t) {
|
|
|
213
213
|
};
|
|
214
214
|
return Object.freeze(s);
|
|
215
215
|
}
|
|
216
|
-
const
|
|
217
|
-
const e =
|
|
218
|
-
register(r,
|
|
216
|
+
const Ae = F("predicate"), $e = k(({ client: t }) => {
|
|
217
|
+
const e = Ae.store({}), s = I(e, {
|
|
218
|
+
register(r, i) {
|
|
219
219
|
return {
|
|
220
220
|
...r,
|
|
221
|
-
[
|
|
222
|
-
name:
|
|
223
|
-
predicate:
|
|
221
|
+
[i.name]: {
|
|
222
|
+
name: i.name,
|
|
223
|
+
predicate: i.predicate
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
|
-
function n(r,
|
|
229
|
-
e.getState()[r] &&
|
|
228
|
+
function n(r, i) {
|
|
229
|
+
e.getState()[r] && v(
|
|
230
230
|
"warn",
|
|
231
231
|
`Predicate '${r}' already registered. Registering again will override the previous registration.`
|
|
232
|
-
), s.register(Object.freeze({ name: r, predicate:
|
|
232
|
+
), s.register(Object.freeze({ name: r, predicate: i }));
|
|
233
233
|
}
|
|
234
|
-
const
|
|
235
|
-
function
|
|
236
|
-
return e.map((
|
|
234
|
+
const o = e.map((r) => Object.values(r));
|
|
235
|
+
function u(r) {
|
|
236
|
+
return e.map((i) => i[r], { skipVoid: !1 });
|
|
237
237
|
}
|
|
238
238
|
return {
|
|
239
239
|
register: n,
|
|
240
|
-
getByName:
|
|
241
|
-
listStore:
|
|
240
|
+
getByName: u,
|
|
241
|
+
listStore: o
|
|
242
242
|
};
|
|
243
243
|
});
|
|
244
|
-
function
|
|
245
|
-
return w(
|
|
244
|
+
function je(t) {
|
|
245
|
+
return w($e, t);
|
|
246
246
|
}
|
|
247
247
|
const Oe = (t, e, s) => {
|
|
248
248
|
s.register(t, e);
|
|
249
|
-
}, T =
|
|
250
|
-
const e = T.store({}), s = T.store([]), n =
|
|
251
|
-
register(d,
|
|
249
|
+
}, T = F("feature"), Ce = k(({ client: t }) => {
|
|
250
|
+
const e = T.store({}), s = T.store([]), n = I(e, {
|
|
251
|
+
register(d, c) {
|
|
252
252
|
return {
|
|
253
253
|
...d,
|
|
254
|
-
[
|
|
254
|
+
[c.id]: c.feature
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
});
|
|
258
|
-
function
|
|
259
|
-
e.getState()[d] &&
|
|
258
|
+
function o(d, c) {
|
|
259
|
+
e.getState()[d] && v(
|
|
260
260
|
"warn",
|
|
261
261
|
`Feature '${d}' already registered. Registering again will override the previous registration.`
|
|
262
262
|
);
|
|
263
263
|
const p = {
|
|
264
264
|
id: d,
|
|
265
265
|
feature: {
|
|
266
|
-
...
|
|
266
|
+
...c,
|
|
267
267
|
id: d
|
|
268
268
|
}
|
|
269
269
|
};
|
|
@@ -274,78 +274,78 @@ const Oe = (t, e, s) => {
|
|
|
274
274
|
})
|
|
275
275
|
);
|
|
276
276
|
}
|
|
277
|
-
const
|
|
277
|
+
const u = U(
|
|
278
278
|
async ({
|
|
279
279
|
id: d,
|
|
280
|
-
key:
|
|
281
|
-
storage:
|
|
280
|
+
key: c,
|
|
281
|
+
storage: a = "local"
|
|
282
282
|
}) => {
|
|
283
|
-
const p =
|
|
284
|
-
return
|
|
283
|
+
const p = B(`feature:${d}:${c}`, "global"), g = (a === "session" ? O : j).get(p).boolean();
|
|
284
|
+
return g === null ? null : { id: d, key: c, bucket: g, storage: a };
|
|
285
285
|
}
|
|
286
286
|
), r = U((d) => {
|
|
287
287
|
if (!d)
|
|
288
288
|
return null;
|
|
289
|
-
const
|
|
290
|
-
(d.storage === "session" ? O :
|
|
291
|
-
}),
|
|
289
|
+
const c = B(`feature:${d.id}:${d.key}`, "global");
|
|
290
|
+
(d.storage === "session" ? O : j).set(c, d.bucket);
|
|
291
|
+
}), i = /* @__PURE__ */ new Map(), l = J({
|
|
292
292
|
source: { allFeaturesStore: e, resolvedFeaturesStore: s },
|
|
293
|
-
effect: async ({ allFeaturesStore: d, resolvedFeaturesStore:
|
|
294
|
-
const
|
|
295
|
-
(
|
|
293
|
+
effect: async ({ allFeaturesStore: d, resolvedFeaturesStore: c }, { id: a, decide: p, key: f }) => {
|
|
294
|
+
const g = c.find(
|
|
295
|
+
($) => $.id === a && $.key === f
|
|
296
296
|
);
|
|
297
|
-
if (
|
|
298
|
-
return
|
|
299
|
-
const y = d[
|
|
297
|
+
if (g)
|
|
298
|
+
return g;
|
|
299
|
+
const y = d[a];
|
|
300
300
|
if (!y)
|
|
301
|
-
throw new Error(`Feature with id '${
|
|
302
|
-
const b =
|
|
301
|
+
throw new Error(`Feature with id '${a}' not found`);
|
|
302
|
+
const b = i.get(`${a}:${f}`);
|
|
303
303
|
if (b !== void 0) {
|
|
304
|
-
const
|
|
305
|
-
return { id: y.id, bucket:
|
|
304
|
+
const $ = await b;
|
|
305
|
+
return { id: y.id, bucket: $, key: f, storage: y.feature.storage };
|
|
306
306
|
}
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const P = await
|
|
310
|
-
return { id: y.id, bucket: P, key:
|
|
307
|
+
const A = p();
|
|
308
|
+
i.set(`${a}:${f}`, A);
|
|
309
|
+
const P = await A;
|
|
310
|
+
return { id: y.id, bucket: P, key: f, storage: y.feature.storage };
|
|
311
311
|
}
|
|
312
312
|
});
|
|
313
313
|
x({
|
|
314
314
|
clock: n.register,
|
|
315
315
|
fn: (d) => {
|
|
316
|
-
const { id:
|
|
317
|
-
return { id:
|
|
316
|
+
const { id: c, feature: a } = d;
|
|
317
|
+
return { id: c, key: a.feature.key, storage: a.feature.storage };
|
|
318
318
|
},
|
|
319
|
-
target:
|
|
319
|
+
target: u
|
|
320
320
|
}), x({
|
|
321
321
|
source: e,
|
|
322
322
|
clock: l.doneData,
|
|
323
|
-
fn: (d,
|
|
323
|
+
fn: (d, c) => {
|
|
324
324
|
var y;
|
|
325
|
-
const { id:
|
|
326
|
-
return
|
|
325
|
+
const { id: a, bucket: p, storage: f } = c, g = (y = d[a]) == null ? void 0 : y.feature.key;
|
|
326
|
+
return g ? { key: g, id: a, bucket: p, storage: f } : null;
|
|
327
327
|
},
|
|
328
328
|
target: r
|
|
329
329
|
});
|
|
330
330
|
const h = C({ allFeaturesStore: e, resolvedFeaturesStore: s }).map(
|
|
331
331
|
({
|
|
332
332
|
allFeaturesStore: d,
|
|
333
|
-
resolvedFeaturesStore:
|
|
334
|
-
}) => Object.values(d).map((
|
|
335
|
-
const p =
|
|
336
|
-
(
|
|
333
|
+
resolvedFeaturesStore: c
|
|
334
|
+
}) => Object.values(d).map((a) => {
|
|
335
|
+
const p = c.find(
|
|
336
|
+
(f) => f.id === a.id && f.key === a.feature.key
|
|
337
337
|
);
|
|
338
338
|
return p ? {
|
|
339
|
-
id:
|
|
340
|
-
name:
|
|
341
|
-
key:
|
|
342
|
-
getBucket: () => ({ id:
|
|
339
|
+
id: a.id,
|
|
340
|
+
name: a.feature.name,
|
|
341
|
+
key: a.feature.key,
|
|
342
|
+
getBucket: () => ({ id: a.id, bucket: p.bucket }),
|
|
343
343
|
isResolved: !0
|
|
344
344
|
} : {
|
|
345
|
-
id:
|
|
346
|
-
name:
|
|
347
|
-
key:
|
|
348
|
-
getBucket: async () => await l(
|
|
345
|
+
id: a.id,
|
|
346
|
+
name: a.feature.name,
|
|
347
|
+
key: a.feature.key,
|
|
348
|
+
getBucket: async () => await l(a.feature),
|
|
349
349
|
isResolved: !1
|
|
350
350
|
};
|
|
351
351
|
})
|
|
@@ -353,28 +353,28 @@ const Oe = (t, e, s) => {
|
|
|
353
353
|
x({
|
|
354
354
|
clock: l.doneData,
|
|
355
355
|
source: { resolvedFeatures: s },
|
|
356
|
-
filter: ({ resolvedFeatures: d }, { id:
|
|
357
|
-
(
|
|
356
|
+
filter: ({ resolvedFeatures: d }, { id: c, key: a }) => !d.some(
|
|
357
|
+
(f) => f.id === c && f.key === a
|
|
358
358
|
),
|
|
359
|
-
fn: (d,
|
|
359
|
+
fn: (d, c) => c,
|
|
360
360
|
target: t.eventBus.prepend((d) => ({
|
|
361
361
|
type: "feature_decide",
|
|
362
362
|
feature: d
|
|
363
363
|
}))
|
|
364
364
|
}), x({
|
|
365
|
-
clock: [
|
|
365
|
+
clock: [u.doneData, l.doneData],
|
|
366
366
|
source: s,
|
|
367
|
-
fn: (d,
|
|
368
|
-
(p) => p.id ===
|
|
369
|
-
) ? d : [...d,
|
|
367
|
+
fn: (d, c) => !c || d.some(
|
|
368
|
+
(p) => p.id === c.id && p.key === c.key
|
|
369
|
+
) ? d : [...d, c],
|
|
370
370
|
target: s
|
|
371
371
|
});
|
|
372
|
-
function
|
|
373
|
-
return e.map((
|
|
372
|
+
function S(d) {
|
|
373
|
+
return e.map((c) => c[d], { skipVoid: !1 });
|
|
374
374
|
}
|
|
375
375
|
return {
|
|
376
|
-
register:
|
|
377
|
-
getByName:
|
|
376
|
+
register: o,
|
|
377
|
+
getByName: S,
|
|
378
378
|
listStore: h
|
|
379
379
|
};
|
|
380
380
|
});
|
|
@@ -383,7 +383,7 @@ function De(t) {
|
|
|
383
383
|
}
|
|
384
384
|
const Ue = (t, e, s) => {
|
|
385
385
|
s.register(t, e);
|
|
386
|
-
}, R =
|
|
386
|
+
}, R = F("history");
|
|
387
387
|
function N(t, e) {
|
|
388
388
|
return {
|
|
389
389
|
// eslint-disable-next-line sonarjs/pseudo-random
|
|
@@ -394,20 +394,20 @@ function N(t, e) {
|
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
const Me = k(() => {
|
|
397
|
-
const t = R.store({ entries: [] }), e = R.event(), s = R.event(), n = R.event(),
|
|
398
|
-
t.on(e, (r,
|
|
399
|
-
entries: [...r.entries, N(
|
|
400
|
-
})), t.on(s, (r,
|
|
397
|
+
const t = R.store({ entries: [] }), e = R.event(), s = R.event(), n = R.event(), o = R.event();
|
|
398
|
+
t.on(e, (r, i) => ({
|
|
399
|
+
entries: [...r.entries, N(i.experienceId, i.node)]
|
|
400
|
+
})), t.on(s, (r, i) => ({
|
|
401
401
|
entries: [
|
|
402
402
|
...r.entries.slice(0, -1),
|
|
403
|
-
N(
|
|
403
|
+
N(i.experienceId, i.node)
|
|
404
404
|
]
|
|
405
|
-
})), t.on(
|
|
406
|
-
function
|
|
405
|
+
})), t.on(o, (r, i) => i);
|
|
406
|
+
function u(r, i) {
|
|
407
407
|
const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
408
408
|
for (let h = r.length - 1; h >= 0; h--) {
|
|
409
|
-
const
|
|
410
|
-
if (!(!d || !ee(d)) && !(
|
|
409
|
+
const S = r[h], d = S == null ? void 0 : S.node;
|
|
410
|
+
if (!(!d || !ee(d)) && !(i && (S == null ? void 0 : S.experienceId) !== i))
|
|
411
411
|
if (l.lastStepIndex === -1)
|
|
412
412
|
l.lastStepIndex = h;
|
|
413
413
|
else {
|
|
@@ -417,8 +417,8 @@ const Me = k(() => {
|
|
|
417
417
|
}
|
|
418
418
|
return l;
|
|
419
419
|
}
|
|
420
|
-
return t.on(n, (r,
|
|
421
|
-
const { secondLastStepIndex: l } =
|
|
420
|
+
return t.on(n, (r, i) => {
|
|
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
|
|
@@ -427,19 +427,19 @@ const Me = k(() => {
|
|
|
427
427
|
push: e,
|
|
428
428
|
replace: s,
|
|
429
429
|
back: n,
|
|
430
|
-
restore:
|
|
430
|
+
restore: o,
|
|
431
431
|
entriesStore: t.map((r) => r.entries)
|
|
432
432
|
};
|
|
433
433
|
});
|
|
434
434
|
function Ve() {
|
|
435
435
|
return w(Me);
|
|
436
436
|
}
|
|
437
|
-
const Te = () => D(), Ne =
|
|
438
|
-
const t = Ne.store({}), e =
|
|
439
|
-
register(r,
|
|
437
|
+
const Te = () => D(), Ne = F("field"), ze = k(() => {
|
|
438
|
+
const t = Ne.store({}), e = I(t, {
|
|
439
|
+
register(r, i) {
|
|
440
440
|
return {
|
|
441
441
|
...r,
|
|
442
|
-
[
|
|
442
|
+
[i.field.id]: i.field
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
445
|
});
|
|
@@ -447,17 +447,17 @@ const Te = () => D(), Ne = I("field"), ze = k(() => {
|
|
|
447
447
|
e.register({ field: r });
|
|
448
448
|
}
|
|
449
449
|
const n = t.map((r) => Object.values(r));
|
|
450
|
-
function
|
|
451
|
-
return t.map((
|
|
450
|
+
function o(r) {
|
|
451
|
+
return t.map((i) => i[r] || null);
|
|
452
452
|
}
|
|
453
|
-
function
|
|
454
|
-
return t.map((
|
|
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
|
-
getById:
|
|
458
|
+
getById: o,
|
|
459
459
|
listStore: n,
|
|
460
|
-
getByName:
|
|
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 =
|
|
469
|
-
const t = He.store({}), e =
|
|
470
|
-
register(
|
|
468
|
+
}, He = F("action"), Ge = k(() => {
|
|
469
|
+
const t = He.store({}), e = I(t, {
|
|
470
|
+
register(u, r) {
|
|
471
471
|
return {
|
|
472
|
-
...
|
|
472
|
+
...u,
|
|
473
473
|
[r.name]: {
|
|
474
474
|
name: r.name,
|
|
475
475
|
action: r.action
|
|
@@ -477,16 +477,16 @@ const Le = (t, e) => {
|
|
|
477
477
|
};
|
|
478
478
|
}
|
|
479
479
|
});
|
|
480
|
-
function s(
|
|
481
|
-
e.register({ name:
|
|
480
|
+
function s(u, r) {
|
|
481
|
+
e.register({ name: u, action: r });
|
|
482
482
|
}
|
|
483
|
-
const n = t.map((
|
|
484
|
-
function
|
|
485
|
-
return t.map((r) => r[
|
|
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,
|
|
489
|
-
getByName:
|
|
489
|
+
getByName: o,
|
|
490
490
|
listStore: n
|
|
491
491
|
};
|
|
492
492
|
});
|
|
@@ -499,140 +499,140 @@ const qe = (t, e, s) => {
|
|
|
499
499
|
function z(t) {
|
|
500
500
|
return typeof t > "u" || t === null || t === "" || Array.isArray(t) && !t.length;
|
|
501
501
|
}
|
|
502
|
-
const We =
|
|
503
|
-
const e = We.store({}), s = D(), n = D(),
|
|
504
|
-
register(
|
|
502
|
+
const We = F("response"), Ye = k(({ client: t }) => {
|
|
503
|
+
const e = We.store({}), s = D(), n = D(), o = I(e, {
|
|
504
|
+
register(c, a) {
|
|
505
505
|
return {
|
|
506
|
-
...
|
|
507
|
-
[
|
|
506
|
+
...c,
|
|
507
|
+
[a.fieldId]: a.response
|
|
508
508
|
};
|
|
509
509
|
},
|
|
510
|
-
registerBatch(
|
|
510
|
+
registerBatch(c, a) {
|
|
511
511
|
return {
|
|
512
|
-
...
|
|
513
|
-
...
|
|
512
|
+
...c,
|
|
513
|
+
...a
|
|
514
514
|
};
|
|
515
515
|
},
|
|
516
|
-
clear(
|
|
517
|
-
const { [
|
|
518
|
-
return
|
|
516
|
+
clear(c, a) {
|
|
517
|
+
const { [a]: p, ...f } = c;
|
|
518
|
+
return f;
|
|
519
519
|
},
|
|
520
520
|
clearAll() {
|
|
521
521
|
return {};
|
|
522
522
|
}
|
|
523
523
|
});
|
|
524
|
-
function
|
|
525
|
-
|
|
524
|
+
function u(c, a) {
|
|
525
|
+
o.register({ fieldId: c, response: a });
|
|
526
526
|
}
|
|
527
|
-
async function r(
|
|
528
|
-
const
|
|
527
|
+
async function r(c) {
|
|
528
|
+
const a = [];
|
|
529
529
|
return await Promise.allSettled(
|
|
530
|
-
Object.entries(
|
|
531
|
-
let
|
|
530
|
+
Object.entries(c).map(async ([p, f]) => {
|
|
531
|
+
let g = f;
|
|
532
532
|
const y = t.fields.getById(p).getState();
|
|
533
533
|
if (!y) {
|
|
534
|
-
|
|
534
|
+
a.push({
|
|
535
535
|
fieldId: p,
|
|
536
536
|
userMessage: `Field '${p}' not found`,
|
|
537
537
|
systemMessage: `No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
|
|
538
|
-
value:
|
|
538
|
+
value: g
|
|
539
539
|
});
|
|
540
540
|
return;
|
|
541
541
|
}
|
|
542
|
-
if (y.multiple && (typeof
|
|
542
|
+
if (y.multiple && (typeof g == "string" || typeof g == "number" || typeof g == "boolean") && (g = [g]), y.validation && !ne(y.validation) && !z(g)) {
|
|
543
543
|
const b = await E(t, y.validation, {
|
|
544
|
-
$input:
|
|
544
|
+
$input: g
|
|
545
545
|
});
|
|
546
546
|
if (typeof b == "string") {
|
|
547
|
-
|
|
547
|
+
a.push({
|
|
548
548
|
fieldId: p,
|
|
549
549
|
userMessage: b,
|
|
550
550
|
systemMessage: `Field validation resulted in an error: ${b}.`,
|
|
551
|
-
value:
|
|
551
|
+
value: g
|
|
552
552
|
});
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
555
|
if (b === !1) {
|
|
556
|
-
|
|
556
|
+
a.push({
|
|
557
557
|
fieldId: p,
|
|
558
558
|
userMessage: "This field is invalid",
|
|
559
559
|
systemMessage: "Field validation resulted in an unspecified error.",
|
|
560
|
-
value:
|
|
560
|
+
value: g
|
|
561
561
|
});
|
|
562
562
|
return;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
if (y.required && z(
|
|
566
|
-
|
|
565
|
+
if (y.required && z(g)) {
|
|
566
|
+
a.push({
|
|
567
567
|
fieldId: p,
|
|
568
568
|
userMessage: "This field is required",
|
|
569
569
|
systemMessage: "Field is required.",
|
|
570
|
-
value:
|
|
570
|
+
value: g
|
|
571
571
|
});
|
|
572
572
|
return;
|
|
573
573
|
}
|
|
574
|
-
if (!y.multiple && Array.isArray(
|
|
575
|
-
|
|
574
|
+
if (!y.multiple && Array.isArray(g) && g.length > 1) {
|
|
575
|
+
a.push({
|
|
576
576
|
fieldId: p,
|
|
577
577
|
userMessage: "This field expects a single response",
|
|
578
578
|
systemMessage: "Field expects a single response.",
|
|
579
|
-
value:
|
|
579
|
+
value: g
|
|
580
580
|
});
|
|
581
581
|
return;
|
|
582
582
|
}
|
|
583
583
|
if (y.options) {
|
|
584
|
-
const b = y.options.map((P) => P.value),
|
|
585
|
-
Array.isArray(
|
|
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
588
|
systemMessage: `Field expects a valid option. Valid options are: ${b.join(", ")}`,
|
|
589
|
-
value:
|
|
589
|
+
value: g
|
|
590
590
|
}));
|
|
591
591
|
}
|
|
592
592
|
})
|
|
593
|
-
), { responsesToCommit:
|
|
593
|
+
), { responsesToCommit: c, validationErrors: a };
|
|
594
594
|
}
|
|
595
|
-
async function
|
|
596
|
-
const { responsesToCommit:
|
|
597
|
-
return p.length ? { errors: p } : (
|
|
595
|
+
async function i(c) {
|
|
596
|
+
const { responsesToCommit: a, validationErrors: p } = await r(c);
|
|
597
|
+
return p.length ? { errors: p } : (o.registerBatch(a), { errors: [] });
|
|
598
598
|
}
|
|
599
|
-
const l = e.map((
|
|
599
|
+
const l = e.map((c) => c), h = e.map((c) => Object.keys(c).map((p) => ({
|
|
600
600
|
fieldId: p,
|
|
601
|
-
value:
|
|
601
|
+
value: c[p]
|
|
602
602
|
})));
|
|
603
|
-
function
|
|
604
|
-
const
|
|
605
|
-
return C({ f:
|
|
606
|
-
}
|
|
607
|
-
function d(
|
|
608
|
-
const
|
|
609
|
-
return C({ f:
|
|
610
|
-
const
|
|
611
|
-
return
|
|
603
|
+
function S(c) {
|
|
604
|
+
const a = t.fields.getById(c), p = e.map((f) => f[c] || null);
|
|
605
|
+
return C({ f: a, r: p }, ({ f, r: g }) => g || (f != null && f.defaultValue ? f.defaultValue : null));
|
|
606
|
+
}
|
|
607
|
+
function d(c) {
|
|
608
|
+
const a = t.fields.getByName(c);
|
|
609
|
+
return C({ f: a, s: e }, ({ f: p, s: f }) => {
|
|
610
|
+
const g = p && f[p.id] || null;
|
|
611
|
+
return g || (p != null && p.defaultValue ? p.defaultValue : null);
|
|
612
612
|
});
|
|
613
613
|
}
|
|
614
614
|
return x({
|
|
615
615
|
clock: s,
|
|
616
|
-
target:
|
|
616
|
+
target: o.clearAll
|
|
617
617
|
}), x({
|
|
618
618
|
clock: n,
|
|
619
|
-
target:
|
|
619
|
+
target: o.clear
|
|
620
620
|
}), {
|
|
621
|
-
register:
|
|
621
|
+
register: u,
|
|
622
622
|
clearAll: s,
|
|
623
623
|
clear: n,
|
|
624
|
-
commit:
|
|
624
|
+
commit: i,
|
|
625
625
|
getResponsesToCommit: r,
|
|
626
626
|
listStore: h,
|
|
627
627
|
getAllStore: l,
|
|
628
|
-
getByFieldId:
|
|
628
|
+
getByFieldId: S,
|
|
629
629
|
getByFieldName: d
|
|
630
630
|
};
|
|
631
631
|
});
|
|
632
632
|
function Je(t) {
|
|
633
633
|
return w(Ye, t);
|
|
634
634
|
}
|
|
635
|
-
const Qe = () => "0.0.1-dev.
|
|
635
|
+
const Qe = () => "0.0.1-dev.1765227621508";
|
|
636
636
|
function Xe() {
|
|
637
637
|
if (L()) {
|
|
638
638
|
const t = [
|
|
@@ -652,19 +652,19 @@ function Ze() {
|
|
|
652
652
|
if (!ie())
|
|
653
653
|
return {};
|
|
654
654
|
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
655
|
-
for (const [
|
|
656
|
-
|
|
657
|
-
for (const
|
|
658
|
-
const
|
|
659
|
-
e[
|
|
655
|
+
for (const [o] of t.entries())
|
|
656
|
+
o.startsWith("picked-") && s.add(o);
|
|
657
|
+
for (const o of s) {
|
|
658
|
+
const u = o.replace("picked-", "");
|
|
659
|
+
e[u] = t.getAll(o);
|
|
660
660
|
}
|
|
661
|
-
const n =
|
|
661
|
+
const n = B("s");
|
|
662
662
|
if (s.size > 0)
|
|
663
663
|
O.set(n, e);
|
|
664
664
|
else {
|
|
665
|
-
const
|
|
666
|
-
if (
|
|
667
|
-
return
|
|
665
|
+
const o = O.get(n);
|
|
666
|
+
if (o)
|
|
667
|
+
return o.json() || {};
|
|
668
668
|
}
|
|
669
669
|
return e;
|
|
670
670
|
}
|
|
@@ -674,28 +674,15 @@ function et() {
|
|
|
674
674
|
const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), s = Math.random().toString(36).substring(2, 15), n = Math.random().toString(36).substring(2, 15);
|
|
675
675
|
return `${t}-${e}-${s}-${n}`;
|
|
676
676
|
}
|
|
677
|
-
const tt =
|
|
678
|
-
const t =
|
|
677
|
+
const tt = B("session", "global"), st = () => {
|
|
678
|
+
const t = j.get(tt);
|
|
679
679
|
let e;
|
|
680
680
|
t.isSet() && (e = t.json());
|
|
681
|
-
const s = (
|
|
682
|
-
id: i.id,
|
|
683
|
-
isUser: i.isUser,
|
|
684
|
-
identifiers: i.identifiers
|
|
685
|
-
}), n = {
|
|
681
|
+
const s = (o) => t.set({ id: o.id, isUser: o.isUser }), n = {
|
|
686
682
|
id: (e == null ? void 0 : e.id) ?? et(),
|
|
687
683
|
isUser: (e == null ? void 0 : e.isUser) ?? void 0,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
this.isUser = i, s(this);
|
|
691
|
-
},
|
|
692
|
-
setIdentifier(i, a) {
|
|
693
|
-
this.identifiers = Object.assign({}, this.identifiers, { [i]: a }), s(this);
|
|
694
|
-
},
|
|
695
|
-
removeIdentifier(i) {
|
|
696
|
-
this.identifiers && (this.identifiers = Object.fromEntries(
|
|
697
|
-
Object.entries(this.identifiers).filter(([a]) => a !== i)
|
|
698
|
-
), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, s(this));
|
|
684
|
+
setIsUser(o) {
|
|
685
|
+
this.isUser = o, s(this);
|
|
699
686
|
}
|
|
700
687
|
};
|
|
701
688
|
return s(n), n;
|
|
@@ -718,13 +705,13 @@ class K {
|
|
|
718
705
|
m(this, "components", ke({ client: this }));
|
|
719
706
|
m(this, "experienceInstances", te({ client: this }));
|
|
720
707
|
m(this, "experiences", pe({ client: this }));
|
|
721
|
-
m(this, "frameworks",
|
|
722
|
-
m(this, "predicates",
|
|
708
|
+
m(this, "frameworks", Fe({ client: this }));
|
|
709
|
+
m(this, "predicates", je({ client: this }));
|
|
723
710
|
m(this, "features", De({ client: this }));
|
|
724
711
|
m(this, "responses", Je({ client: this }));
|
|
725
712
|
m(this, "fields", _e());
|
|
726
713
|
m(this, "actions", Ke());
|
|
727
|
-
|
|
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.");
|
|
728
715
|
}
|
|
729
716
|
start() {
|
|
730
717
|
Re(this), (async () => {
|
|
@@ -734,16 +721,16 @@ class K {
|
|
|
734
721
|
typeof this.precondition > "u" ? s = !0 : typeof this.precondition == "boolean" ? s = this.precondition : s = await E(this, this.precondition) === !0;
|
|
735
722
|
let n;
|
|
736
723
|
s && (this.condition === void 0 ? n = !0 : typeof this.condition == "boolean" ? n = this.condition : n = await E(this, this.condition) === !0);
|
|
737
|
-
const
|
|
724
|
+
const o = s && n === !0;
|
|
738
725
|
if (typeof n == "boolean" && this.session) {
|
|
739
|
-
const
|
|
740
|
-
this.session.setIsUser(
|
|
726
|
+
const u = n;
|
|
727
|
+
this.session.setIsUser(u), this.eventBus({ type: "user_decide", value: u });
|
|
741
728
|
}
|
|
742
|
-
this.eventBus({ type: "initialize" }), document.body &&
|
|
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 });
|
|
743
730
|
})();
|
|
744
731
|
}
|
|
745
732
|
registerFramework(e) {
|
|
746
|
-
|
|
733
|
+
Ie(e, this.frameworks);
|
|
747
734
|
}
|
|
748
735
|
registerComponent(e, s) {
|
|
749
736
|
V(e, s, this.components);
|
|
@@ -764,15 +751,15 @@ class K {
|
|
|
764
751
|
qe(e, s, this.actions);
|
|
765
752
|
}
|
|
766
753
|
registerExperience(e) {
|
|
767
|
-
e.component && V(`experience:${e.id}`, e.component, this.components),
|
|
754
|
+
e.component && V(`experience:${e.id}`, e.component, this.components), ge(e, this.experiences);
|
|
768
755
|
}
|
|
769
756
|
getStateSnapshot() {
|
|
770
|
-
return
|
|
757
|
+
return Be(this);
|
|
771
758
|
}
|
|
772
759
|
async launchExperienceById(e) {
|
|
773
760
|
const s = this.experiences.getById(e).getState();
|
|
774
761
|
if (!s) {
|
|
775
|
-
|
|
762
|
+
v("warn", `Experience with id '${e}' not found.`);
|
|
776
763
|
return;
|
|
777
764
|
}
|
|
778
765
|
G(this, s);
|
|
@@ -790,14 +777,14 @@ class K {
|
|
|
790
777
|
var e;
|
|
791
778
|
(e = this.options.plugins) == null || e.forEach((s) => {
|
|
792
779
|
if (Array.isArray(s)) {
|
|
793
|
-
s.forEach((
|
|
794
|
-
this.registerPlugin(
|
|
780
|
+
s.forEach((o) => {
|
|
781
|
+
this.registerPlugin(o);
|
|
795
782
|
});
|
|
796
783
|
return;
|
|
797
784
|
}
|
|
798
785
|
const n = typeof s == "function" ? s() : s;
|
|
799
786
|
if (Array.isArray(n)) {
|
|
800
|
-
n.forEach((
|
|
787
|
+
n.forEach((o) => this.registerPlugin(o));
|
|
801
788
|
return;
|
|
802
789
|
}
|
|
803
790
|
this.registerPlugin(n);
|
|
@@ -806,20 +793,20 @@ class K {
|
|
|
806
793
|
setupFeatures() {
|
|
807
794
|
const e = this.options.features;
|
|
808
795
|
e && (Object.entries(e).forEach(([s, n]) => {
|
|
809
|
-
const
|
|
810
|
-
this.registerFeature(s,
|
|
796
|
+
const o = typeof n == "function" ? n() : n;
|
|
797
|
+
this.registerFeature(s, o);
|
|
811
798
|
}), this.searchParams.feature && this.searchParams.feature.forEach((s) => {
|
|
812
799
|
try {
|
|
813
|
-
const [n,
|
|
814
|
-
if (!n || !
|
|
800
|
+
const [n, o] = s.split(":");
|
|
801
|
+
if (!n || !o)
|
|
815
802
|
return;
|
|
816
|
-
let
|
|
817
|
-
|
|
818
|
-
key: `${
|
|
803
|
+
let u = o;
|
|
804
|
+
u === "true" && (u = !0), u === "false" && (u = !1), this.registerFeature(n, {
|
|
805
|
+
key: `${u}`,
|
|
819
806
|
// use the assigned bucket value as the key
|
|
820
807
|
name: n,
|
|
821
808
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
822
|
-
decide: () =>
|
|
809
|
+
decide: () => u,
|
|
823
810
|
storage: "session"
|
|
824
811
|
});
|
|
825
812
|
} catch {
|
|
@@ -830,7 +817,7 @@ class K {
|
|
|
830
817
|
const e = this.options.predicates;
|
|
831
818
|
e && Object.entries(e).forEach(([s, n]) => {
|
|
832
819
|
if (typeof n != "function") {
|
|
833
|
-
|
|
820
|
+
v("warn", `Predicate "${s}" is not a function.`);
|
|
834
821
|
return;
|
|
835
822
|
}
|
|
836
823
|
this.registerPredicate(s, n);
|
|
@@ -840,7 +827,7 @@ class K {
|
|
|
840
827
|
const e = this.options.actions;
|
|
841
828
|
e && Object.entries(e).forEach(([s, n]) => {
|
|
842
829
|
if (typeof n != "function") {
|
|
843
|
-
|
|
830
|
+
v("warn", `Action "${s}" is not a function.`);
|
|
844
831
|
return;
|
|
845
832
|
}
|
|
846
833
|
this.registerAction(s, n);
|
|
@@ -850,7 +837,7 @@ class K {
|
|
|
850
837
|
return this.plugins[e] ?? {};
|
|
851
838
|
}
|
|
852
839
|
}
|
|
853
|
-
m(K, "logger",
|
|
840
|
+
m(K, "logger", v);
|
|
854
841
|
function q(t) {
|
|
855
842
|
var e;
|
|
856
843
|
return ((e = t.options) == null ? void 0 : e.some((s) => "condition" in s)) ?? !1;
|
|
@@ -858,7 +845,7 @@ function q(t) {
|
|
|
858
845
|
function nt(t) {
|
|
859
846
|
return t.some((e) => e.condition || q(e));
|
|
860
847
|
}
|
|
861
|
-
async function
|
|
848
|
+
async function ft(t, e) {
|
|
862
849
|
return e.length === 0 || !nt(e) ? e : (await Promise.all(
|
|
863
850
|
e.map(async (n) => {
|
|
864
851
|
if (!(n.condition ? await E(t, n.condition) : !0))
|
|
@@ -879,18 +866,18 @@ const mt = (t) => {
|
|
|
879
866
|
export {
|
|
880
867
|
K as Picked,
|
|
881
868
|
mt as createClient,
|
|
882
|
-
|
|
869
|
+
B as createStorageKey,
|
|
883
870
|
E as evaluateRuleLogic,
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
871
|
+
ft as getStepFields,
|
|
872
|
+
St as isPickedRoot,
|
|
873
|
+
j as localStore,
|
|
887
874
|
O as sessionStore,
|
|
888
875
|
kt as subscribe,
|
|
889
876
|
bt as supportsCookies,
|
|
890
877
|
ae as supportsCryptoRandomUUID,
|
|
891
878
|
L as supportsDocument,
|
|
892
|
-
|
|
893
|
-
|
|
879
|
+
Ft as supportsHistory,
|
|
880
|
+
It as supportsIntersectionObserver,
|
|
894
881
|
oe as supportsLocalStorage,
|
|
895
882
|
xt as supportsLocation,
|
|
896
883
|
Et as supportsSessionStorage,
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
export interface Session {
|
|
2
2
|
id: string;
|
|
3
3
|
isUser?: boolean;
|
|
4
|
-
identifiers?: Record<string, string>;
|
|
5
4
|
}
|
|
6
5
|
export interface SessionStore extends Session {
|
|
7
6
|
setIsUser: (value: boolean) => void;
|
|
8
|
-
setIdentifier: (key: string, value: string) => void;
|
|
9
|
-
removeIdentifier: (key: string) => void;
|
|
10
7
|
}
|
|
11
8
|
export declare const initialiseSession: () => SessionStore | null;
|
|
12
9
|
//# sourceMappingURL=user-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../../src/utils/user-session.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../../src/utils/user-session.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACpC;AA6CD,eAAO,MAAM,iBAAiB,2BAI7B,CAAA"}
|