@picked/client 0.0.1-dev.1771907441854 → 0.0.1-dev.1771981674305
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/esm/index.js +228 -217
- package/dist/types/entities/component/component.d.ts +2 -1
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/component/lazyComponent.d.ts +11 -0
- package/dist/types/entities/component/lazyComponent.d.ts.map +1 -0
- package/dist/types/exports.d.ts +1 -0
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("effector"),S=require("@withease/factories"),b=require("../experience-instance-D_Mwuzb4.cjs"),F=require("../logger-BsmHUUw1.cjs"),w=require("../storage-Be5xWNPC.cjs"),q=require("../api-DzSCgBQ2.cjs"),H=require("../id-BKIWbSTy.cjs"),K=require("../object-BbFTsGh3.cjs"),k=require("../supports-YvpQZxbh.cjs"),M=f.createDomain("experience"),G=S.createFactory(({client:t,experience:e})=>{const r=M.store(e),s=f.createApi(r,{merge(p,h){return{...p,...h.experience}}}),i=r.map(p=>({name:p.name,decisionLogic:p.condition??p.decide,targetSelectors:p.targets,initializeOpenLogic:e.initializeOpen})),l=t.components.listStore.map(p=>p.find(h=>h.name===`experience:${e.id}`)||p.find(h=>h.name==="experience"),{skipVoid:!1}),o=r.map(p=>({steps:p.steps,nodes:p.nodes,edges:p.edges,conditionals:p.conditionals})),n=r.map(p=>p.fields),d=e.actions??[];return{id:e.id,configStore:i,treeStore:o,fieldsStore:n,componentStore:l,actions:d,merge:s.merge}});function W(t){return S.invoke(G,t)}const J=S.createFactory(({client:t})=>{const e=M.store({}),r=f.createApi(e,{register(o,n){return{...o,[n.id]:n}}});function s(o){const n=e.getState()[o.id];if(n){n.merge({experience:o,strategy:"override"});return}const d=W({client:t,experience:o});r.register(d)}const i=e.map(o=>Object.values(o));function l(o){return e.map(n=>n[o],{skipVoid:!1})}return{register:s,getById:l,listStore:i}});function Y(t){return S.invoke(J,t)}const Q=(t,e)=>{e.register(t)},U=(t,e,r)=>{const{targetSelectors:s}=e.configStore.getState(),i=b.getTargetElements(s,e.id);i.forEach(({elements:o})=>o.forEach(n=>b.tagTargetElement(n,e.id))),b.createAppHosts(i,e.id).forEach(o=>{t.experienceInstances.spawn(e,o,r)})},D=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await X(t,e)&&U(t,e)}))},X=async(t,e)=>{const{decisionLogic:r,targetSelectors:s}=e.configStore.getState();return b.getTargetElements(s,e.id).length<1||s.length===0?!1:r&&b.isRulesLogic(r)?await b.evaluateRuleLogic(t,r)===!0:!0},Z=(t,e,r)=>{const s=e.name,i=e.setup(t);if(i){const l=r[s]??{};r[s]=Object.freeze({...l,...i})}},ee=f.createDomain("component"),te=S.createFactory(({client:t,component:e,name:r})=>{const s=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:s}});function re(t){return S.invoke(te,t)}const se=S.createFactory(({client:t})=>{const e=ee.store({}),r=f.createApi(e,{register(o,n){return{...o,[n.name]:n}}});function s(o,n){e.getState()[o]&&F.logger("warn",`Component '${o}' already registered. Registering again will override the previous registration.`);const p=re({client:t,name:o,component:n});r.register(p)}const i=e.map(o=>Object.values(o));function l(o){return e.map(n=>n[o],{skipVoid:!1})}return{register:s,getByName:l,listStore:i}});function ne(t){return S.invoke(se,t)}const C=(t,e,r)=>{r.register(t,e)},ie=f.createDomain("framework"),oe=S.createFactory(({client:t})=>{const e=ie.store({}),r=f.createApi(e,{register(o,n){return{...o,[n.name]:n.framework}}});function s(o,n){e.getState()[o]&&F.logger("warn",`Framework '${o}' already registered. Registering again will override the previous registration.`),r.register({name:o,framework:n})}const i=e.map(o=>Object.values(o));function l(o){return e.map(n=>n[o],{skipVoid:!1})}return{register:s,getByName:l,listStore:i}});function ae(t){return S.invoke(oe,t)}const ce=(t,e)=>{e.register(t.name,t)},ue=6e3,le=w.createStorageKey("last_ping","global"),de=async t=>{try{const e=Date.now(),r=w.localStore.get(le);let s=0;if(r.isSet()&&(s=r.json()??0),s&&e-s<ue)return!0;const i={projectId:t.projectId,path:window.location.pathname},l={},n=document.getElementById("picked_script")?.dataset.verceltoken;n&&(l["x-vercel-protection-bypass"]=n);const p=(await q.post(t.apiUrl,"ping",i,l)).ok;return p&&r.set(e),p}catch(e){return F.logger("error",e),!1}};function V(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 pe=f.createDomain("predicate"),ge=S.createFactory(({client:t})=>{const e=pe.store({}),r=f.createApi(e,{register(n,d){return{...n,[d.name]:{name:d.name,predicate:d.predicate}}}});function s(n,d){e.getState()[n]&&F.logger("warn",`Predicate '${n}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:n,predicate:d}))}const i=e.map(n=>Object.values(n));function l(n){return e.map(d=>d[n]?.predicate,{skipVoid:!1})}function o(n){const d=f.createStore(()=>{},{skipVoid:!1}),p=f.createEffect(async()=>{const h=l(n).getState();if(!h)return;const x=V(t);return(...y)=>h({...x,args:y})});return f.sample({source:{responses:t.responses.listStore,fields:t.fields.listStore},target:p}),f.sample({clock:p.doneData,filter:h=>h!==void 0,target:d}),p(),d}return{register:s,getByName:l,listStore:i,getEvokablePredicate:o}});function fe(t){return S.invoke(ge,t)}const me=(t,e,r)=>{r.register(t,e)},$=f.createDomain("feature"),ye=S.createFactory(({client:t})=>{const e=$.store({}),r=$.store([]),s=f.createApi(e,{register(a,c){return{...a,[c.id]:c.feature}}});function i(a,c){e.getState()[a]&&F.logger("warn",`Feature '${a}' already registered. Registering again will override the previous registration.`);const u={id:a,feature:{...c,id:a}};s.register(Object.freeze({id:a,feature:u}))}const l=f.createEffect(async({id:a,key:c,storage:g="local"})=>{const u=w.createStorageKey(`feature:${a}:${c}`,"global"),v=(g==="session"?w.sessionStore:w.localStore).get(u).boolean();return v===null?null:{id:a,key:c,bucket:v,storage:g}}),o=f.createEffect(a=>{if(!a)return null;const c=w.createStorageKey(`feature:${a.id}:${a.key}`,"global");(a.storage==="session"?w.sessionStore:w.localStore).set(c,a.bucket)}),n=new Map,d=f.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:a,resolvedFeaturesStore:c},{id:g,decide:u,key:m})=>{const v=c.find(P=>P.id===g&&P.key===m);if(v)return v;const E=a[g];if(!E)throw new Error(`Feature with id '${g}' not found`);const A=n.get(`${g}:${m}`);if(A!==void 0){const P=await A;return{id:E.id,bucket:P,key:m,storage:E.feature.storage}}const I=u();n.set(`${g}:${m}`,I);const _=await I;return{id:E.id,bucket:_,key:m,storage:E.feature.storage}}});f.sample({clock:s.register,fn:a=>{const{id:c,feature:g}=a;return{id:c,key:g.feature.key,storage:g.feature.storage}},target:l}),f.sample({source:e,clock:d.doneData,fn:(a,c)=>{const{id:g,bucket:u,storage:m}=c,v=a[g]?.feature.key;return v?{key:v,id:g,bucket:u,storage:m}:null},target:o});const p=f.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:a,resolvedFeaturesStore:c})=>Object.values(a).map(g=>{const u=c.find(m=>m.id===g.id&&m.key===g.feature.key);return u?{id:g.id,name:g.feature.name,key:g.feature.key,getBucket:()=>({id:g.id,bucket:u.bucket}),isResolved:!0}:{id:g.id,name:g.feature.name,key:g.feature.key,getBucket:async()=>await d(g.feature),isResolved:!1}}));f.sample({clock:d.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:a},{id:c,key:g})=>!a.some(m=>m.id===c&&m.key===g),fn:(a,c)=>c,target:t.eventBus.prepend(a=>({type:"feature_decide",feature:a}))}),f.sample({clock:[l.doneData,d.doneData],source:r,fn:(a,c)=>!c||a.some(u=>u.id===c.id&&u.key===c.key)?a:[...a,c],target:r});function h(a){return p.map(c=>c.find(g=>g.id===a))}function x(a){return e.map(c=>c[a],{skipVoid:!1})}function y(a){const c=f.createStore(async()=>{},{skipVoid:!1}),g=f.createEffect(async()=>{const u=h(a).getState();if(u)return async()=>(await u.getBucket()).bucket});return f.sample({source:r,filter:u=>u.some(m=>m.id===a),target:g}),f.sample({clock:g.doneData,filter:u=>u!==void 0,target:c}),g(),c}return{register:i,getById:h,getByName:x,listStore:p,getEvokableFeature:y}});function he(t){return S.invoke(ye,t)}const Se=(t,e,r)=>{r.register(t,e)},j=f.createDomain("history");function O(t,e){return{id:H.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const ve=S.createFactory(()=>{const t=j.store({entries:[]}),e=j.event(),r=j.event(),s=j.event(),i=j.event();t.on(e,(o,n)=>({entries:[...o.entries,O(n.experienceId,n.node)]})),t.on(r,(o,n)=>({entries:[...o.entries.slice(0,-1),O(n.experienceId,n.node)]})),t.on(i,(o,n)=>n);function l(o,n){const d={lastStepIndex:-1,secondLastStepIndex:-1};for(let p=o.length-1;p>=0;p--){const h=o[p],x=h?.node;if(!(!x||!b.isStepNode(x))&&!(n&&h?.experienceId!==n))if(d.lastStepIndex===-1)d.lastStepIndex=p;else{d.secondLastStepIndex=p;break}}return d}return t.on(s,(o,n)=>{const{secondLastStepIndex:d}=l(o.entries,n.experienceId),p=d!==-1?o.entries.slice(0,d+1):o.entries;return{...o,entries:p}}),{push:e,replace:r,back:s,restore:i,entriesStore:t.map(o=>o.entries)}});function ke(){return S.invoke(ve)}let we=0;const be=t=>{const e=f.createStore([]);return f.sample({clock:t,source:e,fn:(r,s)=>[...r,{id:we++,at:new Date,payload:s}],target:e}),e},Ie=f.createDomain("field"),Fe=S.createFactory(()=>{const t=Ie.store({}),e=f.createApi(t,{register(n,d){return{...n,[d.field.id]:d.field}}});function r(n){e.register({field:n})}function s(n,d){const p=l(n).getState();if(!p)return;const h=Object.assign({},p,{...d});e.register({field:{...h}})}const i=t.map(n=>Object.values(n));function l(n){return t.map(d=>d[n]||null)}function o(n){return t.map(d=>Object.values(d).find(p=>p.name===n)||null)}return{register:r,update:s,getById:l,listStore:i,getByName:o}});function Ee(){return S.invoke(Fe)}const xe=(t,e)=>{e.register(t)},je=f.createDomain("action"),Ae=S.createFactory(()=>{const t=je.store({}),e=f.createApi(t,{register(o,n){return{...o,[n.name]:{name:n.name,action:n.action}}}});function r(o,n){e.register({name:o,action:n})}const s=t.map(o=>Object.values(o));function i(o){return t.map(n=>n[o],{skipVoid:!1})}function l(o){return t.map(n=>{const d=n[o];return d?d.action:void 0},{skipVoid:!1})}return{register:r,getByName:i,listStore:s,getEvokableAction:l}});function Pe(){return S.invoke(Ae)}const Re=(t,e,r)=>{r.register(t,e)};function B(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function Be(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null}function z(t){try{return JSON.stringify(t),!0}catch{return!1}}const De=f.createDomain("response"),Ce=S.createFactory(({client:t})=>{const e=De.store({}),r=f.createEvent(),s=f.createEvent(),i=f.createApi(e,{register(y,a){return{...y,[a.fieldId]:a.response}},registerBatch(y,a){return{...y,...a}},clear(y,a){const{[a]:c,...g}=y;return g},clearAll(){return{}}});function l(y,a){if(typeof y=="string"){if(a===void 0)throw new Error("Response is required when registering a single field");i.register({fieldId:y,response:a})}else i.registerBatch(y)}async function o(y){const a=[];return await Promise.allSettled(Object.entries(y).map(async([c,g])=>{let u=g;const m=t.fields.getById(c).getState();if(!m){a.push({fieldId:c,userMessage:`Field '${c}' not found`,systemMessage:`No field with ID '${c}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:u});return}if(m.multiple&&(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&(u=[u]),m.validation&&!K.isEmpty(m.validation)&&!B(u)){const v=await b.evaluateRuleLogic(t,m.validation,{$input:u});if(typeof v=="string"){a.push({fieldId:c,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:u});return}if(v===!1){a.push({fieldId:c,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:u});return}}if(m.required&&B(u)){a.push({fieldId:c,userMessage:"This field is required",systemMessage:"Field is required.",value:u});return}if(!m.multiple&&Array.isArray(u)&&u.length>1){a.push({fieldId:c,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:u});return}if(m.type==="object"&&!B(u))if(m.multiple){if(!Array.isArray(u)){a.push({fieldId:c,userMessage:"This field expects multiple values",systemMessage:"Field expects an array of objects.",value:u});return}for(const v of u){if(typeof v!="object"||v===null){a.push({fieldId:c,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:u});return}if(!z(v)){a.push({fieldId:c,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:u});return}}}else{if(Array.isArray(u)){a.push({fieldId:c,userMessage:"This field expects a single value",systemMessage:"Field expects a single object, not an array.",value:u});return}if(typeof u!="object"||u===null){a.push({fieldId:c,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:u});return}if(!z(u)){a.push({fieldId:c,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:u});return}}if(m.options){const v=Array.isArray(u)?u:[u];if(m.type==="object"){const E=m.options.map(I=>JSON.stringify(I.value));v.every(I=>E.includes(JSON.stringify(I)))||a.push({fieldId:c,userMessage:"This field expects a valid option",systemMessage:"Field expects a valid option from the defined choices.",value:u})}else{const E=m.options.map(I=>I.value);v.every(I=>!Be(I)||I===null?!1:E.includes(I))||a.push({fieldId:c,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${E.join(", ")}`,value:u})}}})),{responsesToCommit:y,validationErrors:a}}async function n(y){const{responsesToCommit:a,validationErrors:c}=await o(y);return c.length?{errors:c}:(i.registerBatch(a),{errors:[]})}const d=e.map(y=>y),p=e.map(y=>Object.keys(y).map(c=>({fieldId:c,value:y[c]})));function h(y){const a=t.fields.getById(y),c=e.map(g=>g[y]||null);return f.combine({f:a,r:c},({f:g,r:u})=>u||(g?.defaultValue?g.defaultValue:null))}function x(y){const a=t.fields.getByName(y);return f.combine({f:a,s:e},({f:c,s:g})=>{const u=c&&g[c.id]||null;return u||(c?.defaultValue?c.defaultValue:null)})}return f.sample({clock:r,target:i.clearAll}),f.sample({clock:s,target:i.clear}),{register:l,clearAll:r,clear:s,commit:n,getResponsesToCommit:o,listStore:p,getAllStore:d,getByFieldId:h,getByFieldName:x}});function $e(t){return S.invoke(Ce,t)}const Oe=()=>"0.0.1-dev.1771907441854";function ze(){if(k.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?.dataset.api)return e.dataset.api}return"https://api.picked.app"}function Me(){if(!k.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 s=w.createStorageKey("s");if(r.size>0)w.sessionStore.set(s,e);else{const i=w.sessionStore.get(s);if(i)return i.json()||{}}return e}function Ue(){if(k.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),s=Math.random().toString(36).substring(2,15);return`${t}-${e}-${r}-${s}`}const Ve=w.createStorageKey("session","global"),Te=()=>{const t=w.localStore.get(Ve);let e;t.isSet()&&(e=t.json());const r=i=>t.set({id:i.id,isUser:i.isUser,identifiers:i.identifiers}),s={id:e?.id??Ue(),isUser:e?.isUser??void 0,identifiers:e?.identifiers??void 0,setIsUser(i){this.isUser=i,r(this)},setIdentifier(i,l){this.identifiers={...this.identifiers,[i]:l},r(this)},removeIdentifier(i){this.identifiers&&(this.identifiers=Object.fromEntries(Object.entries(this.identifiers).filter(([l])=>l!==i)),this.identifiers=Object.keys(this.identifiers).length?this.identifiers:void 0,r(this))}};return r(s),s},Le=()=>k.supportsLocalStorage()?Te():null;function T(){if(k.supportsWindow())return globalThis.window.pickedConfig}function Ne(){if(!k.supportsWindow())return;const t=T(),e=t?.organizationId,r=t?.projectId;return e&&r?{organizationId:e,projectId:r}:void 0}function _e(){if(!k.supportsDocument())return;const t=document.getElementById("picked_script")||document.querySelector("script#picked")||document.getElementById("cvly");if(!t)return;const e=t.dataset.organizationid||t.getAttribute("organization-id"),r=t.dataset.projectid||t.getAttribute("project-id");return e&&r?{organizationId:e,projectId:r}:void 0}function qe(t){const{organizationId:e,projectId:r}=t;if(e&&r)return{organizationId:e,projectId:r};const s=Ne();if(s)return s;const i=_e();if(i)return i;throw new Error(`organizationId and projectId are required. You can provide them via one of:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("effector"),S=require("@withease/factories"),b=require("../experience-instance-D_Mwuzb4.cjs"),F=require("../logger-BsmHUUw1.cjs"),w=require("../storage-Be5xWNPC.cjs"),q=require("../api-DzSCgBQ2.cjs"),H=require("../id-BKIWbSTy.cjs"),K=require("../object-BbFTsGh3.cjs"),k=require("../supports-YvpQZxbh.cjs"),M=f.createDomain("experience"),G=S.createFactory(({client:t,experience:e})=>{const r=M.store(e),n=f.createApi(r,{merge(p,h){return{...p,...h.experience}}}),i=r.map(p=>({name:p.name,decisionLogic:p.condition??p.decide,targetSelectors:p.targets,initializeOpenLogic:e.initializeOpen})),l=t.components.listStore.map(p=>p.find(h=>h.name===`experience:${e.id}`)||p.find(h=>h.name==="experience"),{skipVoid:!1}),o=r.map(p=>({steps:p.steps,nodes:p.nodes,edges:p.edges,conditionals:p.conditionals})),s=r.map(p=>p.fields),d=e.actions??[];return{id:e.id,configStore:i,treeStore:o,fieldsStore:s,componentStore:l,actions:d,merge:n.merge}});function W(t){return S.invoke(G,t)}const J=S.createFactory(({client:t})=>{const e=M.store({}),r=f.createApi(e,{register(o,s){return{...o,[s.id]:s}}});function n(o){const s=e.getState()[o.id];if(s){s.merge({experience:o,strategy:"override"});return}const d=W({client:t,experience:o});r.register(d)}const i=e.map(o=>Object.values(o));function l(o){return e.map(s=>s[o],{skipVoid:!1})}return{register:n,getById:l,listStore:i}});function Y(t){return S.invoke(J,t)}const Q=(t,e)=>{e.register(t)},U=(t,e,r)=>{const{targetSelectors:n}=e.configStore.getState(),i=b.getTargetElements(n,e.id);i.forEach(({elements:o})=>o.forEach(s=>b.tagTargetElement(s,e.id))),b.createAppHosts(i,e.id).forEach(o=>{t.experienceInstances.spawn(e,o,r)})},$=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await X(t,e)&&U(t,e)}))},X=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},Z=(t,e,r)=>{const n=e.name,i=e.setup(t);if(i){const l=r[n]??{};r[n]=Object.freeze({...l,...i})}},ee=f.createDomain("component"),te=S.createFactory(({client:t,component:e,name:r})=>{const n=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:n}});function re(t){return S.invoke(te,t)}const ne=S.createFactory(({client:t})=>{const e=ee.store({}),r=f.createApi(e,{register(o,s){return{...o,[s.name]:s}}});function n(o,s){e.getState()[o]&&F.logger("warn",`Component '${o}' already registered. Registering again will override the previous registration.`);const p=re({client:t,name:o,component:s});r.register(p)}const i=e.map(o=>Object.values(o));function l(o){return e.map(s=>s[o],{skipVoid:!1})}return{register:n,getByName:l,listStore:i}});function se(t){return S.invoke(ne,t)}const C=(t,e,r)=>{r.register(t,e)},ie=f.createDomain("framework"),oe=S.createFactory(({client:t})=>{const e=ie.store({}),r=f.createApi(e,{register(o,s){return{...o,[s.name]:s.framework}}});function n(o,s){e.getState()[o]&&F.logger("warn",`Framework '${o}' already registered. Registering again will override the previous registration.`),r.register({name:o,framework:s})}const i=e.map(o=>Object.values(o));function l(o){return e.map(s=>s[o],{skipVoid:!1})}return{register:n,getByName:l,listStore:i}});function ae(t){return S.invoke(oe,t)}const ce=(t,e)=>{e.register(t.name,t)},ue=6e3,le=w.createStorageKey("last_ping","global"),de=async t=>{try{const e=Date.now(),r=w.localStore.get(le);let n=0;if(r.isSet()&&(n=r.json()??0),n&&e-n<ue)return!0;const i={projectId:t.projectId,path:window.location.pathname},l={},s=document.getElementById("picked_script")?.dataset.verceltoken;s&&(l["x-vercel-protection-bypass"]=s);const p=(await q.post(t.apiUrl,"ping",i,l)).ok;return p&&r.set(e),p}catch(e){return F.logger("error",e),!1}};function L(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 pe=f.createDomain("predicate"),ge=S.createFactory(({client:t})=>{const e=pe.store({}),r=f.createApi(e,{register(s,d){return{...s,[d.name]:{name:d.name,predicate:d.predicate}}}});function n(s,d){e.getState()[s]&&F.logger("warn",`Predicate '${s}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:s,predicate:d}))}const i=e.map(s=>Object.values(s));function l(s){return e.map(d=>d[s]?.predicate,{skipVoid:!1})}function o(s){const d=f.createStore(()=>{},{skipVoid:!1}),p=f.createEffect(async()=>{const h=l(s).getState();if(!h)return;const x=L(t);return(...y)=>h({...x,args:y})});return f.sample({source:{responses:t.responses.listStore,fields:t.fields.listStore},target:p}),f.sample({clock:p.doneData,filter:h=>h!==void 0,target:d}),p(),d}return{register:n,getByName:l,listStore:i,getEvokablePredicate:o}});function fe(t){return S.invoke(ge,t)}const me=(t,e,r)=>{r.register(t,e)},D=f.createDomain("feature"),ye=S.createFactory(({client:t})=>{const e=D.store({}),r=D.store([]),n=f.createApi(e,{register(a,c){return{...a,[c.id]:c.feature}}});function i(a,c){e.getState()[a]&&F.logger("warn",`Feature '${a}' already registered. Registering again will override the previous registration.`);const u={id:a,feature:{...c,id:a}};n.register(Object.freeze({id:a,feature:u}))}const l=f.createEffect(async({id:a,key:c,storage:g="local"})=>{const u=w.createStorageKey(`feature:${a}:${c}`,"global"),v=(g==="session"?w.sessionStore:w.localStore).get(u).boolean();return v===null?null:{id:a,key:c,bucket:v,storage:g}}),o=f.createEffect(a=>{if(!a)return null;const c=w.createStorageKey(`feature:${a.id}:${a.key}`,"global");(a.storage==="session"?w.sessionStore:w.localStore).set(c,a.bucket)}),s=new Map,d=f.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:a,resolvedFeaturesStore:c},{id:g,decide:u,key:m})=>{const v=c.find(P=>P.id===g&&P.key===m);if(v)return v;const E=a[g];if(!E)throw new Error(`Feature with id '${g}' not found`);const A=s.get(`${g}:${m}`);if(A!==void 0){const P=await A;return{id:E.id,bucket:P,key:m,storage:E.feature.storage}}const I=u();s.set(`${g}:${m}`,I);const _=await I;return{id:E.id,bucket:_,key:m,storage:E.feature.storage}}});f.sample({clock:n.register,fn:a=>{const{id:c,feature:g}=a;return{id:c,key:g.feature.key,storage:g.feature.storage}},target:l}),f.sample({source:e,clock:d.doneData,fn:(a,c)=>{const{id:g,bucket:u,storage:m}=c,v=a[g]?.feature.key;return v?{key:v,id:g,bucket:u,storage:m}:null},target:o});const p=f.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:a,resolvedFeaturesStore:c})=>Object.values(a).map(g=>{const u=c.find(m=>m.id===g.id&&m.key===g.feature.key);return u?{id:g.id,name:g.feature.name,key:g.feature.key,getBucket:()=>({id:g.id,bucket:u.bucket}),isResolved:!0}:{id:g.id,name:g.feature.name,key:g.feature.key,getBucket:async()=>await d(g.feature),isResolved:!1}}));f.sample({clock:d.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:a},{id:c,key:g})=>!a.some(m=>m.id===c&&m.key===g),fn:(a,c)=>c,target:t.eventBus.prepend(a=>({type:"feature_decide",feature:a}))}),f.sample({clock:[l.doneData,d.doneData],source:r,fn:(a,c)=>!c||a.some(u=>u.id===c.id&&u.key===c.key)?a:[...a,c],target:r});function h(a){return p.map(c=>c.find(g=>g.id===a))}function x(a){return e.map(c=>c[a],{skipVoid:!1})}function y(a){const c=f.createStore(async()=>{},{skipVoid:!1}),g=f.createEffect(async()=>{const u=h(a).getState();if(u)return async()=>(await u.getBucket()).bucket});return f.sample({source:r,filter:u=>u.some(m=>m.id===a),target:g}),f.sample({clock:g.doneData,filter:u=>u!==void 0,target:c}),g(),c}return{register:i,getById:h,getByName:x,listStore:p,getEvokableFeature:y}});function he(t){return S.invoke(ye,t)}const Se=(t,e,r)=>{r.register(t,e)},j=f.createDomain("history");function z(t,e){return{id:H.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const ve=S.createFactory(()=>{const t=j.store({entries:[]}),e=j.event(),r=j.event(),n=j.event(),i=j.event();t.on(e,(o,s)=>({entries:[...o.entries,z(s.experienceId,s.node)]})),t.on(r,(o,s)=>({entries:[...o.entries.slice(0,-1),z(s.experienceId,s.node)]})),t.on(i,(o,s)=>s);function l(o,s){const d={lastStepIndex:-1,secondLastStepIndex:-1};for(let p=o.length-1;p>=0;p--){const h=o[p],x=h?.node;if(!(!x||!b.isStepNode(x))&&!(s&&h?.experienceId!==s))if(d.lastStepIndex===-1)d.lastStepIndex=p;else{d.secondLastStepIndex=p;break}}return d}return t.on(n,(o,s)=>{const{secondLastStepIndex:d}=l(o.entries,s.experienceId),p=d!==-1?o.entries.slice(0,d+1):o.entries;return{...o,entries:p}}),{push:e,replace:r,back:n,restore:i,entriesStore:t.map(o=>o.entries)}});function ke(){return S.invoke(ve)}let we=0;const be=t=>{const e=f.createStore([]);return f.sample({clock:t,source:e,fn:(r,n)=>[...r,{id:we++,at:new Date,payload:n}],target:e}),e},Ie=f.createDomain("field"),Fe=S.createFactory(()=>{const t=Ie.store({}),e=f.createApi(t,{register(s,d){return{...s,[d.field.id]:d.field}}});function r(s){e.register({field:s})}function n(s,d){const p=l(s).getState();if(!p)return;const h=Object.assign({},p,{...d});e.register({field:{...h}})}const i=t.map(s=>Object.values(s));function l(s){return t.map(d=>d[s]||null)}function o(s){return t.map(d=>Object.values(d).find(p=>p.name===s)||null)}return{register:r,update:n,getById:l,listStore:i,getByName:o}});function Ee(){return S.invoke(Fe)}const xe=(t,e)=>{e.register(t)},je=f.createDomain("action"),Ae=S.createFactory(()=>{const t=je.store({}),e=f.createApi(t,{register(o,s){return{...o,[s.name]:{name:s.name,action:s.action}}}});function r(o,s){e.register({name:o,action:s})}const n=t.map(o=>Object.values(o));function i(o){return t.map(s=>s[o],{skipVoid:!1})}function l(o){return t.map(s=>{const d=s[o];return d?d.action:void 0},{skipVoid:!1})}return{register:r,getByName:i,listStore:n,getEvokableAction:l}});function Pe(){return S.invoke(Ae)}const Re=(t,e,r)=>{r.register(t,e)};function B(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function Be(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null}function O(t){try{return JSON.stringify(t),!0}catch{return!1}}const $e=f.createDomain("response"),Ce=S.createFactory(({client:t})=>{const e=$e.store({}),r=f.createEvent(),n=f.createEvent(),i=f.createApi(e,{register(y,a){return{...y,[a.fieldId]:a.response}},registerBatch(y,a){return{...y,...a}},clear(y,a){const{[a]:c,...g}=y;return g},clearAll(){return{}}});function l(y,a){if(typeof y=="string"){if(a===void 0)throw new Error("Response is required when registering a single field");i.register({fieldId:y,response:a})}else i.registerBatch(y)}async function o(y){const a=[];return await Promise.allSettled(Object.entries(y).map(async([c,g])=>{let u=g;const m=t.fields.getById(c).getState();if(!m){a.push({fieldId:c,userMessage:`Field '${c}' not found`,systemMessage:`No field with ID '${c}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:u});return}if(m.multiple&&(typeof u=="string"||typeof u=="number"||typeof u=="boolean")&&(u=[u]),m.validation&&!K.isEmpty(m.validation)&&!B(u)){const v=await b.evaluateRuleLogic(t,m.validation,{$input:u});if(typeof v=="string"){a.push({fieldId:c,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:u});return}if(v===!1){a.push({fieldId:c,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:u});return}}if(m.required&&B(u)){a.push({fieldId:c,userMessage:"This field is required",systemMessage:"Field is required.",value:u});return}if(!m.multiple&&Array.isArray(u)&&u.length>1){a.push({fieldId:c,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:u});return}if(m.type==="object"&&!B(u))if(m.multiple){if(!Array.isArray(u)){a.push({fieldId:c,userMessage:"This field expects multiple values",systemMessage:"Field expects an array of objects.",value:u});return}for(const v of u){if(typeof v!="object"||v===null){a.push({fieldId:c,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:u});return}if(!O(v)){a.push({fieldId:c,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:u});return}}}else{if(Array.isArray(u)){a.push({fieldId:c,userMessage:"This field expects a single value",systemMessage:"Field expects a single object, not an array.",value:u});return}if(typeof u!="object"||u===null){a.push({fieldId:c,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:u});return}if(!O(u)){a.push({fieldId:c,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:u});return}}if(m.options){const v=Array.isArray(u)?u:[u];if(m.type==="object"){const E=m.options.map(I=>JSON.stringify(I.value));v.every(I=>E.includes(JSON.stringify(I)))||a.push({fieldId:c,userMessage:"This field expects a valid option",systemMessage:"Field expects a valid option from the defined choices.",value:u})}else{const E=m.options.map(I=>I.value);v.every(I=>!Be(I)||I===null?!1:E.includes(I))||a.push({fieldId:c,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${E.join(", ")}`,value:u})}}})),{responsesToCommit:y,validationErrors:a}}async function s(y){const{responsesToCommit:a,validationErrors:c}=await o(y);return c.length?{errors:c}:(i.registerBatch(a),{errors:[]})}const d=e.map(y=>y),p=e.map(y=>Object.keys(y).map(c=>({fieldId:c,value:y[c]})));function h(y){const a=t.fields.getById(y),c=e.map(g=>g[y]||null);return f.combine({f:a,r:c},({f:g,r:u})=>u||(g?.defaultValue?g.defaultValue:null))}function x(y){const a=t.fields.getByName(y);return f.combine({f:a,s:e},({f:c,s:g})=>{const u=c&&g[c.id]||null;return u||(c?.defaultValue?c.defaultValue:null)})}return f.sample({clock:r,target:i.clearAll}),f.sample({clock:n,target:i.clear}),{register:l,clearAll:r,clear:n,commit:s,getResponsesToCommit:o,listStore:p,getAllStore:d,getByFieldId:h,getByFieldName:x}});function De(t){return S.invoke(Ce,t)}const ze=()=>"0.0.1-dev.1771981674305";function Oe(){if(k.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?.dataset.api)return e.dataset.api}return"https://api.picked.app"}function Me(){if(!k.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=w.createStorageKey("s");if(r.size>0)w.sessionStore.set(n,e);else{const i=w.sessionStore.get(n);if(i)return i.json()||{}}return e}function Ue(){if(k.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 Le=w.createStorageKey("session","global"),Ve=()=>{const t=w.localStore.get(Le);let e;t.isSet()&&(e=t.json());const r=i=>t.set({id:i.id,isUser:i.isUser,identifiers:i.identifiers}),n={id:e?.id??Ue(),isUser:e?.isUser??void 0,identifiers:e?.identifiers??void 0,setIsUser(i){this.isUser=i,r(this)},setIdentifier(i,l){this.identifiers={...this.identifiers,[i]:l},r(this)},removeIdentifier(i){this.identifiers&&(this.identifiers=Object.fromEntries(Object.entries(this.identifiers).filter(([l])=>l!==i)),this.identifiers=Object.keys(this.identifiers).length?this.identifiers:void 0,r(this))}};return r(n),n},Te=()=>k.supportsLocalStorage()?Ve():null;function V(){if(k.supportsWindow())return globalThis.window.pickedConfig}function Ne(){if(!k.supportsWindow())return;const t=V(),e=t?.organizationId,r=t?.projectId;return e&&r?{organizationId:e,projectId:r}:void 0}function _e(){if(!k.supportsDocument())return;const t=document.getElementById("picked_script")||document.querySelector("script#picked")||document.getElementById("cvly");if(!t)return;const e=t.dataset.organizationid||t.getAttribute("organization-id"),r=t.dataset.projectid||t.getAttribute("project-id");return e&&r?{organizationId:e,projectId:r}:void 0}function qe(t){const{organizationId:e,projectId:r}=t;if(e&&r)return{organizationId:e,projectId:r};const n=Ne();if(n)return n;const i=_e();if(i)return i;throw new Error(`organizationId and projectId are required. You can provide them via one of:
|
|
2
2
|
(1) createClient({ organizationId, projectId }) options;
|
|
3
3
|
(2) window.pickedConfig = { organizationId, projectId };
|
|
4
|
-
(3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`)}function R(t){return t==null||t===""||Number.isNaN(t)}const He={default:(t,e)=>R(t)?String(e??""):String(t),append:(t,e)=>e&&!R(t)?`${t} ${e}`:t,prepend:(t,e)=>e&&!R(t)?`${e} ${t}`:t,upper:t=>typeof t=="string"?t.toUpperCase():t,lower:t=>typeof t=="string"?t.toLowerCase():t,capitalize:t=>typeof t=="string"?t.charAt(0).toUpperCase()+t.slice(1):t,list:t=>{if(!t||typeof t!="object")return t;const e=new Intl.ListFormat("en",{style:"long",type:"conjunction"});if(Array.isArray(t))return e.format(t.map(String));if(t instanceof Map){const r=Array.from(t.entries()).map(([
|
|
4
|
+
(3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes data-organizationid/data-projectid (or organization-id/project-id) attributes.`)}function R(t){return t==null||t===""||Number.isNaN(t)}const He={default:(t,e)=>R(t)?String(e??""):String(t),append:(t,e)=>e&&!R(t)?`${t} ${e}`:t,prepend:(t,e)=>e&&!R(t)?`${e} ${t}`:t,upper:t=>typeof t=="string"?t.toUpperCase():t,lower:t=>typeof t=="string"?t.toLowerCase():t,capitalize:t=>typeof t=="string"?t.charAt(0).toUpperCase()+t.slice(1):t,list:t=>{if(!t||typeof t!="object")return t;const e=new Intl.ListFormat("en",{style:"long",type:"conjunction"});if(Array.isArray(t))return e.format(t.map(String));if(t instanceof Map){const r=Array.from(t.entries()).map(([n,i])=>`${n}: ${i}`);return e.format(r)}return t instanceof Set?e.format(Array.from(t).map(String)):t}};function Ke(t){return typeof t=="object"&&t!==null}function Ge(t,e){let r=e;for(const n of t.split("."))if(Ke(r)&&n in r)r=r[n];else return;return typeof r=="function"?r():r}function We(t,e){const r=t.split("|").map(l=>l.trim()),n=r.shift()??"";let i=Ge(n,e);for(const l of r){const[o,...s]=l.split(":"),d=o?.trim()??"",p=s.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g,""),h=He[d];h&&(i=h(i,p))}return R(i)?"":typeof i=="object"?JSON.stringify(i):String(i)}function Je(t,e){let r="",n=0;for(;n<t.length;)if(t[n]==="{"&&t[n+1]==="{"){n+=2;let i="";for(;n<t.length;){if(t[n]==="}"&&t[n+1]==="}"){n+=2;break}i+=t[n++]}r+=We(i.trim(),e)}else r+=t[n++];return r}class T{static logger=F.logger;options;isReady=!1;project;plugins={};pluginStartHooks=[];eventBus=f.createEvent();events;organizationId;projectId;apiUrl;dashboardUrl;documentationSiteUrl;session;precondition;condition;searchParams=Me();history=ke();components=se({client:this});experienceInstances=b.createExperienceInstanceIndex({client:this});experiences=Y({client:this});frameworks=ae({client:this});predicates=fe({client:this});features=he({client:this});responses=De({client:this});fields=Ee();actions=Pe();constructor(e){F.logger("info","Picked client initializing."),this.events=be(this.eventBus);const{organizationId:r,projectId:n}=qe(e);this.organizationId=r,this.projectId=n,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||Oe(),this.dashboardUrl=e.dashboardUrl??"https://dashboard.picked.app",this.documentationSiteUrl=e.documentationSiteUrl??"https://docs.picked.app",this.session=Te(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.precondition=e.precondition,this.condition=e.condition,this.eventBus({type:"load",version:ze()}),F.logger("info","Picked client initialized.")}start=()=>{de(this),(async()=>{if(!k.supportsDocument())return;await this.runPluginStartHooks();const r=await this.evaluateGate(this.precondition);let n;r&&(n=await this.evaluateGate(this.condition));const i=r&&n===!0;if(typeof n=="boolean"&&this.session){const l=n;this.session.setIsUser(l),this.eventBus({type:"user_decide",value:l})}if(this.eventBus({type:"initialize"}),i&&$(this),await b.domInteractive(),i&&$(this),this.eventBus({type:"ready"}),this.isReady=!0,this.session){const{id:l,isUser:o,identifiers:s}=this.session;this.eventBus({type:"session",id:l,isUser:o,identifiers:s})}})()};registerFramework=e=>{ce(e,this.frameworks)};registerComponent=(e,r)=>{C(e,r,this.components)};registerPlugin=e=>{Z(this,e,this.plugins);const r=this.plugins[e.name];r?.onStart&&this.pluginStartHooks.push(r.onStart)};registerFeature=(e,r)=>{Se(e,r,this.features)};registerPredicate=(e,r)=>{me(e,r,this.predicates)};registerField=e=>{xe(e,this.fields)};registerAction=(e,r)=>{Re(e,r,this.actions)};registerExperience=e=>{e.component&&C(`experience:${e.id}`,e.component,this.components),Q(e,this.experiences)};getStateSnapshot=()=>L(this);launchExperienceById=async(e,r)=>{const n=this.experiences.getById(e).getState();if(!n){F.logger("warn",`Experience with id '${e}' not found.`);return}U(this,n,r)};openExperienceById=async e=>{const r=this.experienceInstances.getByExperienceId(e).getState();if(r.length>0)for(const n of r)n.toggleOpen();else return this.launchExperienceById(e,{initialiseOpen:!0})};async runPluginStartHooks(){for(const e of this.pluginStartHooks)await e()}async evaluateGate(e){return e===void 0?!0:typeof e=="boolean"?e:await b.evaluateRuleLogic(this,e)===!0}setupPlugins(){this.options.plugins?.forEach(e=>{if(Array.isArray(e)){e.forEach(n=>{this.registerPlugin(n)});return}const r=typeof e=="function"?e():e;if(Array.isArray(r)){r.forEach(n=>this.registerPlugin(n));return}this.registerPlugin(r)})}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"){F.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"){F.logger("warn",`Action "${r}" is not a function.`);return}this.registerAction(r,n)})}getPluginConfig=e=>this.plugins[e]??{};renderString=(e,r)=>{const n=this.responses.listStore.getState().reduce((i,l)=>(i[l.fieldId]=l.value,i),{});return Je(e,{...r,responses:n})}}function N(t){return t.options?.some(e=>"condition"in e)??!1}function Ye(t){return t.some(e=>e.condition||N(e))}async function Qe(t,e){return e.length===0||!Ye(e)?e:(await Promise.all(e.map(async n=>{if(!(n.condition?await b.evaluateRuleLogic(t,n.condition):!0))return null;if(!n.options||!N(n))return n;const o=(await Promise.all(n.options.map(async d=>d.condition?await b.evaluateRuleLogic(t,d.condition)?d:null:d))).filter(d=>d!==null);return o.length===n.options.length?n:o.length===0?null:{...n,options:o}}))).filter(n=>n!==null)}function Xe(t){return{$$type:"lazy-component",load:t}}function Ze(t){return typeof t=="object"&&t!==null&&"$$type"in t&&t.$$type==="lazy-component"}const et=t=>{const e=new T(t);return k.bindClient(e),e};exports.evaluateRuleLogic=b.evaluateRuleLogic;exports.isPickedRoot=b.isPickedRoot;exports.createStorageKey=w.createStorageKey;exports.localStore=w.localStore;exports.sessionStore=w.sessionStore;exports.subscribe=w.subscribe;exports.supportsCookies=k.supportsCookies;exports.supportsCryptoRandomUUID=k.supportsCryptoRandomUUID;exports.supportsDocument=k.supportsDocument;exports.supportsHistory=k.supportsHistory;exports.supportsIntersectionObserver=k.supportsIntersectionObserver;exports.supportsLocalStorage=k.supportsLocalStorage;exports.supportsLocation=k.supportsLocation;exports.supportsSessionStorage=k.supportsSessionStorage;exports.supportsShadowRoot=k.supportsShadowRoot;exports.supportsWebComponents=k.supportsWebComponents;exports.supportsWindow=k.supportsWindow;exports.Picked=T;exports.createClient=et;exports.getPickedConfig=V;exports.getStepFields=Qe;exports.isLazyLoader=Ze;exports.lazyComponent=Xe;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createDomain as F, createApi as x, createStore as V, createEffect as
|
|
1
|
+
import { createDomain as F, createApi as x, createStore as V, createEffect as R, sample as v, attach as Z, combine as D, createEvent as U } from "effector";
|
|
2
2
|
import { createFactory as w, invoke as b } from "@withease/factories";
|
|
3
|
-
import { g as q, t as ee, c as te, i as re, e as P, a as
|
|
4
|
-
import { f as
|
|
3
|
+
import { g as q, t as ee, c as te, i as re, e as P, a as ne, b as se, d as ie } from "../experience-instance-CU_pYPyd.js";
|
|
4
|
+
import { f as zt } from "../experience-instance-CU_pYPyd.js";
|
|
5
5
|
import { l as k } from "../logger-C9a75KZn.js";
|
|
6
6
|
import { c as A, l as C, s as O } from "../storage-Co_LbKr_.js";
|
|
7
|
-
import { a as
|
|
7
|
+
import { a as Ot } from "../storage-Co_LbKr_.js";
|
|
8
8
|
import { p as oe } from "../api-CbXfbi_s.js";
|
|
9
9
|
import { g as ae } from "../id-BW-g3y32.js";
|
|
10
10
|
import { i as ce } from "../object-JwZ58NOH.js";
|
|
11
11
|
import { s as N, a as T, b as ue, c as de, d as le } from "../supports-8YT4QKI7.js";
|
|
12
|
-
import { e as
|
|
12
|
+
import { e as Dt, f as Ut, g as Vt, h as Nt, i as Tt, j as Lt, k as _t } from "../supports-8YT4QKI7.js";
|
|
13
13
|
const K = F("experience"), pe = w(
|
|
14
14
|
({ client: t, experience: e }) => {
|
|
15
|
-
const r = K.store(e),
|
|
15
|
+
const r = K.store(e), n = x(r, {
|
|
16
16
|
merge(p, h) {
|
|
17
17
|
return {
|
|
18
18
|
...p,
|
|
@@ -32,15 +32,15 @@ const K = F("experience"), pe = w(
|
|
|
32
32
|
nodes: p.nodes,
|
|
33
33
|
edges: p.edges,
|
|
34
34
|
conditionals: p.conditionals
|
|
35
|
-
})),
|
|
35
|
+
})), s = r.map((p) => p.fields), l = e.actions ?? [];
|
|
36
36
|
return {
|
|
37
37
|
id: e.id,
|
|
38
38
|
configStore: i,
|
|
39
39
|
treeStore: o,
|
|
40
|
-
fieldsStore:
|
|
40
|
+
fieldsStore: s,
|
|
41
41
|
componentStore: d,
|
|
42
42
|
actions: l,
|
|
43
|
-
merge:
|
|
43
|
+
merge: n.merge
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
);
|
|
@@ -49,17 +49,17 @@ function fe(t) {
|
|
|
49
49
|
}
|
|
50
50
|
const ge = w(({ client: t }) => {
|
|
51
51
|
const e = K.store({}), r = x(e, {
|
|
52
|
-
register(o,
|
|
52
|
+
register(o, s) {
|
|
53
53
|
return {
|
|
54
54
|
...o,
|
|
55
|
-
[
|
|
55
|
+
[s.id]: s
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
function
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
|
|
59
|
+
function n(o) {
|
|
60
|
+
const s = e.getState()[o.id];
|
|
61
|
+
if (s) {
|
|
62
|
+
s.merge({ experience: o, strategy: "override" });
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
const l = fe({ client: t, experience: o });
|
|
@@ -67,10 +67,10 @@ const ge = w(({ client: t }) => {
|
|
|
67
67
|
}
|
|
68
68
|
const i = e.map((o) => Object.values(o));
|
|
69
69
|
function d(o) {
|
|
70
|
-
return e.map((
|
|
70
|
+
return e.map((s) => s[o], { skipVoid: !1 });
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
73
|
-
register:
|
|
73
|
+
register: n,
|
|
74
74
|
getById: d,
|
|
75
75
|
listStore: i
|
|
76
76
|
};
|
|
@@ -81,34 +81,34 @@ function me(t) {
|
|
|
81
81
|
const he = (t, e) => {
|
|
82
82
|
e.register(t);
|
|
83
83
|
}, W = (t, e, r) => {
|
|
84
|
-
const { targetSelectors:
|
|
84
|
+
const { targetSelectors: n } = e.configStore.getState(), i = q(n, e.id);
|
|
85
85
|
i.forEach(
|
|
86
|
-
({ elements: o }) => o.forEach((
|
|
86
|
+
({ elements: o }) => o.forEach((s) => ee(s, e.id))
|
|
87
87
|
), te(i, e.id).forEach((o) => {
|
|
88
88
|
t.experienceInstances.spawn(e, o, r);
|
|
89
89
|
});
|
|
90
|
-
},
|
|
90
|
+
}, L = async (t) => {
|
|
91
91
|
await Promise.all(
|
|
92
92
|
t.experiences.listStore.getState().map(async (e) => {
|
|
93
93
|
await ye(t, e) && W(t, e);
|
|
94
94
|
})
|
|
95
95
|
);
|
|
96
96
|
}, ye = async (t, e) => {
|
|
97
|
-
const { decisionLogic: r, targetSelectors:
|
|
98
|
-
return q(
|
|
97
|
+
const { decisionLogic: r, targetSelectors: n } = e.configStore.getState();
|
|
98
|
+
return q(n, e.id).length < 1 || n.length === 0 ? !1 : r && re(r) ? await P(t, r) === !0 : !0;
|
|
99
99
|
}, Se = (t, e, r) => {
|
|
100
|
-
const
|
|
100
|
+
const n = e.name, i = e.setup(t);
|
|
101
101
|
if (i) {
|
|
102
|
-
const d = r[
|
|
103
|
-
r[
|
|
102
|
+
const d = r[n] ?? {};
|
|
103
|
+
r[n] = Object.freeze({ ...d, ...i });
|
|
104
104
|
}
|
|
105
105
|
}, ve = F("component"), ke = w(
|
|
106
106
|
({ client: t, component: e, name: r }) => {
|
|
107
|
-
const
|
|
107
|
+
const n = t.frameworks.getByName(e.frameworkName);
|
|
108
108
|
return {
|
|
109
109
|
name: r,
|
|
110
110
|
component: e,
|
|
111
|
-
frameworkStore:
|
|
111
|
+
frameworkStore: n
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
114
|
);
|
|
@@ -117,27 +117,27 @@ function we(t) {
|
|
|
117
117
|
}
|
|
118
118
|
const be = w(({ client: t }) => {
|
|
119
119
|
const e = ve.store({}), r = x(e, {
|
|
120
|
-
register(o,
|
|
120
|
+
register(o, s) {
|
|
121
121
|
return {
|
|
122
122
|
...o,
|
|
123
|
-
[
|
|
123
|
+
[s.name]: s
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
function
|
|
127
|
+
function n(o, s) {
|
|
128
128
|
e.getState()[o] && k(
|
|
129
129
|
"warn",
|
|
130
130
|
`Component '${o}' already registered. Registering again will override the previous registration.`
|
|
131
131
|
);
|
|
132
|
-
const p = we({ client: t, name: o, component:
|
|
132
|
+
const p = we({ client: t, name: o, component: s });
|
|
133
133
|
r.register(p);
|
|
134
134
|
}
|
|
135
135
|
const i = e.map((o) => Object.values(o));
|
|
136
136
|
function d(o) {
|
|
137
|
-
return e.map((
|
|
137
|
+
return e.map((s) => s[o], { skipVoid: !1 });
|
|
138
138
|
}
|
|
139
139
|
return {
|
|
140
|
-
register:
|
|
140
|
+
register: n,
|
|
141
141
|
getByName: d,
|
|
142
142
|
listStore: i
|
|
143
143
|
};
|
|
@@ -145,49 +145,49 @@ const be = w(({ client: t }) => {
|
|
|
145
145
|
function Ie(t) {
|
|
146
146
|
return b(be, t);
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const _ = (t, e, r) => {
|
|
149
149
|
r.register(t, e);
|
|
150
150
|
}, Fe = F("framework"), xe = w(({ client: t }) => {
|
|
151
151
|
const e = Fe.store({}), r = x(e, {
|
|
152
|
-
register(o,
|
|
152
|
+
register(o, s) {
|
|
153
153
|
return {
|
|
154
154
|
...o,
|
|
155
|
-
[
|
|
155
|
+
[s.name]: s.framework
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
|
-
function
|
|
159
|
+
function n(o, s) {
|
|
160
160
|
e.getState()[o] && k(
|
|
161
161
|
"warn",
|
|
162
162
|
`Framework '${o}' already registered. Registering again will override the previous registration.`
|
|
163
|
-
), r.register({ name: o, framework:
|
|
163
|
+
), r.register({ name: o, framework: s });
|
|
164
164
|
}
|
|
165
165
|
const i = e.map((o) => Object.values(o));
|
|
166
166
|
function d(o) {
|
|
167
|
-
return e.map((
|
|
167
|
+
return e.map((s) => s[o], { skipVoid: !1 });
|
|
168
168
|
}
|
|
169
169
|
return {
|
|
170
|
-
register:
|
|
170
|
+
register: n,
|
|
171
171
|
getByName: d,
|
|
172
172
|
listStore: i
|
|
173
173
|
};
|
|
174
174
|
});
|
|
175
|
-
function
|
|
175
|
+
function je(t) {
|
|
176
176
|
return b(xe, t);
|
|
177
177
|
}
|
|
178
|
-
const
|
|
178
|
+
const Ee = (t, e) => {
|
|
179
179
|
e.register(t.name, t);
|
|
180
|
-
}, Pe = 6e3, Ae = A("last_ping", "global"),
|
|
180
|
+
}, Pe = 6e3, Ae = A("last_ping", "global"), $e = async (t) => {
|
|
181
181
|
try {
|
|
182
182
|
const e = Date.now(), r = C.get(Ae);
|
|
183
|
-
let
|
|
184
|
-
if (r.isSet() && (
|
|
183
|
+
let n = 0;
|
|
184
|
+
if (r.isSet() && (n = r.json() ?? 0), n && e - n < Pe)
|
|
185
185
|
return !0;
|
|
186
186
|
const i = {
|
|
187
187
|
projectId: t.projectId,
|
|
188
188
|
path: window.location.pathname
|
|
189
|
-
}, d = {},
|
|
190
|
-
|
|
189
|
+
}, d = {}, s = document.getElementById("picked_script")?.dataset.verceltoken;
|
|
190
|
+
s && (d["x-vercel-protection-bypass"] = s);
|
|
191
191
|
const p = (await oe(t.apiUrl, "ping", i, d)).ok;
|
|
192
192
|
return p && r.set(e), p;
|
|
193
193
|
} catch (e) {
|
|
@@ -206,11 +206,11 @@ function Y(t) {
|
|
|
206
206
|
};
|
|
207
207
|
return Object.freeze(r);
|
|
208
208
|
}
|
|
209
|
-
const
|
|
210
|
-
const e =
|
|
211
|
-
register(
|
|
209
|
+
const Be = F("predicate"), Re = w(({ client: t }) => {
|
|
210
|
+
const e = Be.store({}), r = x(e, {
|
|
211
|
+
register(s, l) {
|
|
212
212
|
return {
|
|
213
|
-
...
|
|
213
|
+
...s,
|
|
214
214
|
[l.name]: {
|
|
215
215
|
name: l.name,
|
|
216
216
|
predicate: l.predicate
|
|
@@ -218,26 +218,26 @@ const Re = F("predicate"), $e = w(({ client: t }) => {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
|
-
function s
|
|
222
|
-
e.getState()[
|
|
221
|
+
function n(s, l) {
|
|
222
|
+
e.getState()[s] && k(
|
|
223
223
|
"warn",
|
|
224
|
-
`Predicate '${
|
|
225
|
-
), r.register(Object.freeze({ name:
|
|
224
|
+
`Predicate '${s}' already registered. Registering again will override the previous registration.`
|
|
225
|
+
), r.register(Object.freeze({ name: s, predicate: l }));
|
|
226
226
|
}
|
|
227
|
-
const i = e.map((
|
|
228
|
-
function d(
|
|
229
|
-
return e.map((l) => l[
|
|
227
|
+
const i = e.map((s) => Object.values(s));
|
|
228
|
+
function d(s) {
|
|
229
|
+
return e.map((l) => l[s]?.predicate, { skipVoid: !1 });
|
|
230
230
|
}
|
|
231
|
-
function o(
|
|
231
|
+
function o(s) {
|
|
232
232
|
const l = V(() => {
|
|
233
233
|
}, {
|
|
234
234
|
skipVoid: !1
|
|
235
|
-
}), p =
|
|
236
|
-
const h = d(
|
|
235
|
+
}), p = R(async () => {
|
|
236
|
+
const h = d(s).getState();
|
|
237
237
|
if (!h)
|
|
238
238
|
return;
|
|
239
|
-
const
|
|
240
|
-
return (...m) => h({ ...
|
|
239
|
+
const j = Y(t);
|
|
240
|
+
return (...m) => h({ ...j, args: m });
|
|
241
241
|
});
|
|
242
242
|
return v({
|
|
243
243
|
source: { responses: t.responses.listStore, fields: t.fields.listStore },
|
|
@@ -249,19 +249,19 @@ const Re = F("predicate"), $e = w(({ client: t }) => {
|
|
|
249
249
|
}), p(), l;
|
|
250
250
|
}
|
|
251
251
|
return {
|
|
252
|
-
register:
|
|
252
|
+
register: n,
|
|
253
253
|
getByName: d,
|
|
254
254
|
listStore: i,
|
|
255
255
|
getEvokablePredicate: o
|
|
256
256
|
};
|
|
257
257
|
});
|
|
258
258
|
function ze(t) {
|
|
259
|
-
return b(
|
|
259
|
+
return b(Re, t);
|
|
260
260
|
}
|
|
261
261
|
const Ce = (t, e, r) => {
|
|
262
262
|
r.register(t, e);
|
|
263
263
|
}, H = F("feature"), Oe = w(({ client: t }) => {
|
|
264
|
-
const e = H.store({}), r = H.store([]),
|
|
264
|
+
const e = H.store({}), r = H.store([]), n = x(e, {
|
|
265
265
|
register(a, c) {
|
|
266
266
|
return {
|
|
267
267
|
...a,
|
|
@@ -281,14 +281,14 @@ const Ce = (t, e, r) => {
|
|
|
281
281
|
id: a
|
|
282
282
|
}
|
|
283
283
|
};
|
|
284
|
-
|
|
284
|
+
n.register(
|
|
285
285
|
Object.freeze({
|
|
286
286
|
id: a,
|
|
287
287
|
feature: u
|
|
288
288
|
})
|
|
289
289
|
);
|
|
290
290
|
}
|
|
291
|
-
const d =
|
|
291
|
+
const d = R(
|
|
292
292
|
async ({
|
|
293
293
|
id: a,
|
|
294
294
|
key: c,
|
|
@@ -297,35 +297,35 @@ const Ce = (t, e, r) => {
|
|
|
297
297
|
const u = A(`feature:${a}:${c}`, "global"), y = (f === "session" ? O : C).get(u).boolean();
|
|
298
298
|
return y === null ? null : { id: a, key: c, bucket: y, storage: f };
|
|
299
299
|
}
|
|
300
|
-
), o =
|
|
300
|
+
), o = R((a) => {
|
|
301
301
|
if (!a)
|
|
302
302
|
return null;
|
|
303
303
|
const c = A(`feature:${a.id}:${a.key}`, "global");
|
|
304
304
|
(a.storage === "session" ? O : C).set(c, a.bucket);
|
|
305
|
-
}),
|
|
305
|
+
}), s = /* @__PURE__ */ new Map(), l = Z({
|
|
306
306
|
source: { allFeaturesStore: e, resolvedFeaturesStore: r },
|
|
307
307
|
effect: async ({ allFeaturesStore: a, resolvedFeaturesStore: c }, { id: f, decide: u, key: g }) => {
|
|
308
308
|
const y = c.find(
|
|
309
|
-
(
|
|
309
|
+
(B) => B.id === f && B.key === g
|
|
310
310
|
);
|
|
311
311
|
if (y)
|
|
312
312
|
return y;
|
|
313
313
|
const I = a[f];
|
|
314
314
|
if (!I)
|
|
315
315
|
throw new Error(`Feature with id '${f}' not found`);
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
319
|
-
return { id: I.id, bucket:
|
|
316
|
+
const $ = s.get(`${f}:${g}`);
|
|
317
|
+
if ($ !== void 0) {
|
|
318
|
+
const B = await $;
|
|
319
|
+
return { id: I.id, bucket: B, key: g, storage: I.feature.storage };
|
|
320
320
|
}
|
|
321
321
|
const S = u();
|
|
322
|
-
|
|
322
|
+
s.set(`${f}:${g}`, S);
|
|
323
323
|
const X = await S;
|
|
324
324
|
return { id: I.id, bucket: X, key: g, storage: I.feature.storage };
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
v({
|
|
328
|
-
clock:
|
|
328
|
+
clock: n.register,
|
|
329
329
|
fn: (a) => {
|
|
330
330
|
const { id: c, feature: f } = a;
|
|
331
331
|
return { id: c, key: f.feature.key, storage: f.feature.storage };
|
|
@@ -385,7 +385,7 @@ const Ce = (t, e, r) => {
|
|
|
385
385
|
function h(a) {
|
|
386
386
|
return p.map((c) => c.find((f) => f.id === a));
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function j(a) {
|
|
389
389
|
return e.map((c) => c[a], { skipVoid: !1 });
|
|
390
390
|
}
|
|
391
391
|
function m(a) {
|
|
@@ -393,7 +393,7 @@ const Ce = (t, e, r) => {
|
|
|
393
393
|
async () => {
|
|
394
394
|
},
|
|
395
395
|
{ skipVoid: !1 }
|
|
396
|
-
), f =
|
|
396
|
+
), f = R(async () => {
|
|
397
397
|
const u = h(a).getState();
|
|
398
398
|
if (u)
|
|
399
399
|
return async () => (await u.getBucket()).bucket;
|
|
@@ -411,7 +411,7 @@ const Ce = (t, e, r) => {
|
|
|
411
411
|
return {
|
|
412
412
|
register: i,
|
|
413
413
|
getById: h,
|
|
414
|
-
getByName:
|
|
414
|
+
getByName: j,
|
|
415
415
|
listStore: p,
|
|
416
416
|
getEvokableFeature: m
|
|
417
417
|
};
|
|
@@ -421,7 +421,7 @@ function Me(t) {
|
|
|
421
421
|
}
|
|
422
422
|
const De = (t, e, r) => {
|
|
423
423
|
r.register(t, e);
|
|
424
|
-
},
|
|
424
|
+
}, E = F("history");
|
|
425
425
|
function G(t, e) {
|
|
426
426
|
return {
|
|
427
427
|
// eslint-disable-next-line sonarjs/pseudo-random
|
|
@@ -432,20 +432,20 @@ function G(t, e) {
|
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
const Ue = w(() => {
|
|
435
|
-
const t =
|
|
436
|
-
t.on(e, (o,
|
|
437
|
-
entries: [...o.entries, G(
|
|
438
|
-
})), t.on(r, (o,
|
|
435
|
+
const t = E.store({ entries: [] }), e = E.event(), r = E.event(), n = E.event(), i = E.event();
|
|
436
|
+
t.on(e, (o, s) => ({
|
|
437
|
+
entries: [...o.entries, G(s.experienceId, s.node)]
|
|
438
|
+
})), t.on(r, (o, s) => ({
|
|
439
439
|
entries: [
|
|
440
440
|
...o.entries.slice(0, -1),
|
|
441
|
-
G(
|
|
441
|
+
G(s.experienceId, s.node)
|
|
442
442
|
]
|
|
443
|
-
})), t.on(i, (o,
|
|
444
|
-
function d(o,
|
|
443
|
+
})), t.on(i, (o, s) => s);
|
|
444
|
+
function d(o, s) {
|
|
445
445
|
const l = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
446
446
|
for (let p = o.length - 1; p >= 0; p--) {
|
|
447
|
-
const h = o[p],
|
|
448
|
-
if (!(!
|
|
447
|
+
const h = o[p], j = h?.node;
|
|
448
|
+
if (!(!j || !ne(j)) && !(s && h?.experienceId !== s))
|
|
449
449
|
if (l.lastStepIndex === -1)
|
|
450
450
|
l.lastStepIndex = p;
|
|
451
451
|
else {
|
|
@@ -455,8 +455,8 @@ const Ue = w(() => {
|
|
|
455
455
|
}
|
|
456
456
|
return l;
|
|
457
457
|
}
|
|
458
|
-
return t.on(
|
|
459
|
-
const { secondLastStepIndex: l } = d(o.entries,
|
|
458
|
+
return t.on(n, (o, s) => {
|
|
459
|
+
const { secondLastStepIndex: l } = d(o.entries, s.experienceId), p = l !== -1 ? o.entries.slice(0, l + 1) : o.entries;
|
|
460
460
|
return {
|
|
461
461
|
...o,
|
|
462
462
|
entries: p
|
|
@@ -464,7 +464,7 @@ const Ue = w(() => {
|
|
|
464
464
|
}), {
|
|
465
465
|
push: e,
|
|
466
466
|
replace: r,
|
|
467
|
-
back:
|
|
467
|
+
back: n,
|
|
468
468
|
restore: i,
|
|
469
469
|
entriesStore: t.map((o) => o.entries)
|
|
470
470
|
};
|
|
@@ -478,30 +478,30 @@ const Te = (t) => {
|
|
|
478
478
|
return v({
|
|
479
479
|
clock: t,
|
|
480
480
|
source: e,
|
|
481
|
-
fn: (r,
|
|
481
|
+
fn: (r, n) => [
|
|
482
482
|
...r,
|
|
483
483
|
{
|
|
484
484
|
id: Ne++,
|
|
485
485
|
at: /* @__PURE__ */ new Date(),
|
|
486
|
-
payload:
|
|
486
|
+
payload: n
|
|
487
487
|
}
|
|
488
488
|
],
|
|
489
489
|
target: e
|
|
490
490
|
}), e;
|
|
491
|
-
},
|
|
492
|
-
const t =
|
|
493
|
-
register(
|
|
491
|
+
}, Le = F("field"), _e = w(() => {
|
|
492
|
+
const t = Le.store({}), e = x(t, {
|
|
493
|
+
register(s, l) {
|
|
494
494
|
return {
|
|
495
|
-
...
|
|
495
|
+
...s,
|
|
496
496
|
[l.field.id]: l.field
|
|
497
497
|
};
|
|
498
498
|
}
|
|
499
499
|
});
|
|
500
|
-
function r(
|
|
501
|
-
e.register({ field:
|
|
500
|
+
function r(s) {
|
|
501
|
+
e.register({ field: s });
|
|
502
502
|
}
|
|
503
|
-
function s
|
|
504
|
-
const p = d(
|
|
503
|
+
function n(s, l) {
|
|
504
|
+
const p = d(s).getState();
|
|
505
505
|
if (!p)
|
|
506
506
|
return;
|
|
507
507
|
const h = Object.assign({}, p, {
|
|
@@ -509,49 +509,49 @@ const Te = (t) => {
|
|
|
509
509
|
});
|
|
510
510
|
e.register({ field: { ...h } });
|
|
511
511
|
}
|
|
512
|
-
const i = t.map((
|
|
513
|
-
function d(
|
|
514
|
-
return t.map((l) => l[
|
|
512
|
+
const i = t.map((s) => Object.values(s));
|
|
513
|
+
function d(s) {
|
|
514
|
+
return t.map((l) => l[s] || null);
|
|
515
515
|
}
|
|
516
|
-
function o(
|
|
517
|
-
return t.map((l) => Object.values(l).find((p) => p.name ===
|
|
516
|
+
function o(s) {
|
|
517
|
+
return t.map((l) => Object.values(l).find((p) => p.name === s) || null);
|
|
518
518
|
}
|
|
519
519
|
return {
|
|
520
520
|
register: r,
|
|
521
|
-
update:
|
|
521
|
+
update: n,
|
|
522
522
|
getById: d,
|
|
523
523
|
listStore: i,
|
|
524
524
|
getByName: o
|
|
525
525
|
};
|
|
526
526
|
});
|
|
527
527
|
function He() {
|
|
528
|
-
return b(
|
|
528
|
+
return b(_e);
|
|
529
529
|
}
|
|
530
530
|
const Ge = (t, e) => {
|
|
531
531
|
e.register(t);
|
|
532
532
|
}, Je = F("action"), qe = w(() => {
|
|
533
533
|
const t = Je.store({}), e = x(t, {
|
|
534
|
-
register(o,
|
|
534
|
+
register(o, s) {
|
|
535
535
|
return {
|
|
536
536
|
...o,
|
|
537
|
-
[
|
|
538
|
-
name:
|
|
539
|
-
action:
|
|
537
|
+
[s.name]: {
|
|
538
|
+
name: s.name,
|
|
539
|
+
action: s.action
|
|
540
540
|
}
|
|
541
541
|
};
|
|
542
542
|
}
|
|
543
543
|
});
|
|
544
|
-
function r(o,
|
|
545
|
-
e.register({ name: o, action:
|
|
544
|
+
function r(o, s) {
|
|
545
|
+
e.register({ name: o, action: s });
|
|
546
546
|
}
|
|
547
|
-
const
|
|
547
|
+
const n = t.map((o) => Object.values(o));
|
|
548
548
|
function i(o) {
|
|
549
|
-
return t.map((
|
|
549
|
+
return t.map((s) => s[o], { skipVoid: !1 });
|
|
550
550
|
}
|
|
551
551
|
function d(o) {
|
|
552
552
|
return t.map(
|
|
553
|
-
(
|
|
554
|
-
const l =
|
|
553
|
+
(s) => {
|
|
554
|
+
const l = s[o];
|
|
555
555
|
return l ? l.action : void 0;
|
|
556
556
|
},
|
|
557
557
|
{ skipVoid: !1 }
|
|
@@ -560,7 +560,7 @@ const Ge = (t, e) => {
|
|
|
560
560
|
return {
|
|
561
561
|
register: r,
|
|
562
562
|
getByName: i,
|
|
563
|
-
listStore:
|
|
563
|
+
listStore: n,
|
|
564
564
|
getEvokableAction: d
|
|
565
565
|
};
|
|
566
566
|
});
|
|
@@ -584,7 +584,7 @@ function J(t) {
|
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
const Qe = F("response"), Xe = w(({ client: t }) => {
|
|
587
|
-
const e = Qe.store({}), r = U(),
|
|
587
|
+
const e = Qe.store({}), r = U(), n = U(), i = x(e, {
|
|
588
588
|
register(m, a) {
|
|
589
589
|
return {
|
|
590
590
|
...m,
|
|
@@ -752,7 +752,7 @@ const Qe = F("response"), Xe = w(({ client: t }) => {
|
|
|
752
752
|
})
|
|
753
753
|
), { responsesToCommit: m, validationErrors: a };
|
|
754
754
|
}
|
|
755
|
-
async function
|
|
755
|
+
async function s(m) {
|
|
756
756
|
const { responsesToCommit: a, validationErrors: c } = await o(m);
|
|
757
757
|
return c.length ? { errors: c } : (i.registerBatch(a), { errors: [] });
|
|
758
758
|
}
|
|
@@ -764,7 +764,7 @@ const Qe = F("response"), Xe = w(({ client: t }) => {
|
|
|
764
764
|
const a = t.fields.getById(m), c = e.map((f) => f[m] || null);
|
|
765
765
|
return D({ f: a, r: c }, ({ f, r: u }) => u || (f?.defaultValue ? f.defaultValue : null));
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function j(m) {
|
|
768
768
|
const a = t.fields.getByName(m);
|
|
769
769
|
return D({ f: a, s: e }, ({ f: c, s: f }) => {
|
|
770
770
|
const u = c && f[c.id] || null;
|
|
@@ -775,24 +775,24 @@ const Qe = F("response"), Xe = w(({ client: t }) => {
|
|
|
775
775
|
clock: r,
|
|
776
776
|
target: i.clearAll
|
|
777
777
|
}), v({
|
|
778
|
-
clock:
|
|
778
|
+
clock: n,
|
|
779
779
|
target: i.clear
|
|
780
780
|
}), {
|
|
781
781
|
register: d,
|
|
782
782
|
clearAll: r,
|
|
783
|
-
clear:
|
|
784
|
-
commit:
|
|
783
|
+
clear: n,
|
|
784
|
+
commit: s,
|
|
785
785
|
getResponsesToCommit: o,
|
|
786
786
|
listStore: p,
|
|
787
787
|
getAllStore: l,
|
|
788
788
|
getByFieldId: h,
|
|
789
|
-
getByFieldName:
|
|
789
|
+
getByFieldName: j
|
|
790
790
|
};
|
|
791
791
|
});
|
|
792
792
|
function Ze(t) {
|
|
793
793
|
return b(Xe, t);
|
|
794
794
|
}
|
|
795
|
-
const et = () => "0.0.1-dev.
|
|
795
|
+
const et = () => "0.0.1-dev.1771981674305";
|
|
796
796
|
function tt() {
|
|
797
797
|
if (N()) {
|
|
798
798
|
const t = [
|
|
@@ -818,32 +818,32 @@ function rt() {
|
|
|
818
818
|
const d = i.replace("picked-", "");
|
|
819
819
|
e[d] = t.getAll(i);
|
|
820
820
|
}
|
|
821
|
-
const
|
|
821
|
+
const n = A("s");
|
|
822
822
|
if (r.size > 0)
|
|
823
|
-
O.set(
|
|
823
|
+
O.set(n, e);
|
|
824
824
|
else {
|
|
825
|
-
const i = O.get(
|
|
825
|
+
const i = O.get(n);
|
|
826
826
|
if (i)
|
|
827
827
|
return i.json() || {};
|
|
828
828
|
}
|
|
829
829
|
return e;
|
|
830
830
|
}
|
|
831
|
-
function
|
|
831
|
+
function nt() {
|
|
832
832
|
if (de())
|
|
833
833
|
return crypto.randomUUID();
|
|
834
|
-
const t = Date.now().toString(36), e = Math.random().toString(36).substring(2, 15), r = Math.random().toString(36).substring(2, 15),
|
|
835
|
-
return `${t}-${e}-${r}-${
|
|
834
|
+
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);
|
|
835
|
+
return `${t}-${e}-${r}-${n}`;
|
|
836
836
|
}
|
|
837
|
-
const
|
|
838
|
-
const t = C.get(
|
|
837
|
+
const st = A("session", "global"), it = () => {
|
|
838
|
+
const t = C.get(st);
|
|
839
839
|
let e;
|
|
840
840
|
t.isSet() && (e = t.json());
|
|
841
841
|
const r = (i) => t.set({
|
|
842
842
|
id: i.id,
|
|
843
843
|
isUser: i.isUser,
|
|
844
844
|
identifiers: i.identifiers
|
|
845
|
-
}),
|
|
846
|
-
id: e?.id ??
|
|
845
|
+
}), n = {
|
|
846
|
+
id: e?.id ?? nt(),
|
|
847
847
|
isUser: e?.isUser ?? void 0,
|
|
848
848
|
identifiers: e?.identifiers ?? void 0,
|
|
849
849
|
setIsUser(i) {
|
|
@@ -858,7 +858,7 @@ const nt = A("session", "global"), it = () => {
|
|
|
858
858
|
), this.identifiers = Object.keys(this.identifiers).length ? this.identifiers : void 0, r(this));
|
|
859
859
|
}
|
|
860
860
|
};
|
|
861
|
-
return r(
|
|
861
|
+
return r(n), n;
|
|
862
862
|
}, ot = () => ue() ? it() : null;
|
|
863
863
|
function at() {
|
|
864
864
|
if (T())
|
|
@@ -884,9 +884,9 @@ function dt(t) {
|
|
|
884
884
|
const { organizationId: e, projectId: r } = t;
|
|
885
885
|
if (e && r)
|
|
886
886
|
return { organizationId: e, projectId: r };
|
|
887
|
-
const
|
|
888
|
-
if (
|
|
889
|
-
return
|
|
887
|
+
const n = ct();
|
|
888
|
+
if (n)
|
|
889
|
+
return n;
|
|
890
890
|
const i = ut();
|
|
891
891
|
if (i)
|
|
892
892
|
return i;
|
|
@@ -914,7 +914,7 @@ const lt = {
|
|
|
914
914
|
if (Array.isArray(t))
|
|
915
915
|
return e.format(t.map(String));
|
|
916
916
|
if (t instanceof Map) {
|
|
917
|
-
const r = Array.from(t.entries()).map(([
|
|
917
|
+
const r = Array.from(t.entries()).map(([n, i]) => `${n}: ${i}`);
|
|
918
918
|
return e.format(r);
|
|
919
919
|
}
|
|
920
920
|
return t instanceof Set ? e.format(Array.from(t).map(String)) : t;
|
|
@@ -925,38 +925,38 @@ function pt(t) {
|
|
|
925
925
|
}
|
|
926
926
|
function ft(t, e) {
|
|
927
927
|
let r = e;
|
|
928
|
-
for (const
|
|
929
|
-
if (pt(r) &&
|
|
930
|
-
r = r[
|
|
928
|
+
for (const n of t.split("."))
|
|
929
|
+
if (pt(r) && n in r)
|
|
930
|
+
r = r[n];
|
|
931
931
|
else
|
|
932
932
|
return;
|
|
933
933
|
return typeof r == "function" ? r() : r;
|
|
934
934
|
}
|
|
935
935
|
function gt(t, e) {
|
|
936
|
-
const r = t.split("|").map((d) => d.trim()),
|
|
937
|
-
let i = ft(
|
|
936
|
+
const r = t.split("|").map((d) => d.trim()), n = r.shift() ?? "";
|
|
937
|
+
let i = ft(n, e);
|
|
938
938
|
for (const d of r) {
|
|
939
|
-
const [o, ...
|
|
939
|
+
const [o, ...s] = d.split(":"), l = o?.trim() ?? "", p = s.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), h = lt[l];
|
|
940
940
|
h && (i = h(i, p));
|
|
941
941
|
}
|
|
942
942
|
return z(i) ? "" : typeof i == "object" ? JSON.stringify(i) : String(i);
|
|
943
943
|
}
|
|
944
944
|
function mt(t, e) {
|
|
945
|
-
let r = "",
|
|
946
|
-
for (;
|
|
947
|
-
if (t[
|
|
948
|
-
|
|
945
|
+
let r = "", n = 0;
|
|
946
|
+
for (; n < t.length; )
|
|
947
|
+
if (t[n] === "{" && t[n + 1] === "{") {
|
|
948
|
+
n += 2;
|
|
949
949
|
let i = "";
|
|
950
|
-
for (;
|
|
951
|
-
if (t[
|
|
952
|
-
|
|
950
|
+
for (; n < t.length; ) {
|
|
951
|
+
if (t[n] === "}" && t[n + 1] === "}") {
|
|
952
|
+
n += 2;
|
|
953
953
|
break;
|
|
954
954
|
}
|
|
955
|
-
i += t[
|
|
955
|
+
i += t[n++];
|
|
956
956
|
}
|
|
957
957
|
r += gt(i.trim(), e);
|
|
958
958
|
} else
|
|
959
|
-
r += t[
|
|
959
|
+
r += t[n++];
|
|
960
960
|
return r;
|
|
961
961
|
}
|
|
962
962
|
class ht {
|
|
@@ -979,9 +979,9 @@ class ht {
|
|
|
979
979
|
searchParams = rt();
|
|
980
980
|
history = Ve();
|
|
981
981
|
components = Ie({ client: this });
|
|
982
|
-
experienceInstances =
|
|
982
|
+
experienceInstances = se({ client: this });
|
|
983
983
|
experiences = me({ client: this });
|
|
984
|
-
frameworks =
|
|
984
|
+
frameworks = je({ client: this });
|
|
985
985
|
predicates = ze({ client: this });
|
|
986
986
|
features = Me({ client: this });
|
|
987
987
|
responses = Ze({ client: this });
|
|
@@ -989,33 +989,33 @@ class ht {
|
|
|
989
989
|
actions = Ke();
|
|
990
990
|
constructor(e) {
|
|
991
991
|
k("info", "Picked client initializing."), this.events = Te(this.eventBus);
|
|
992
|
-
const { organizationId: r, projectId:
|
|
993
|
-
this.organizationId = r, this.projectId =
|
|
992
|
+
const { organizationId: r, projectId: n } = dt(e);
|
|
993
|
+
this.organizationId = r, this.projectId = n, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || tt(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.session = ot(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.precondition = e.precondition, this.condition = e.condition, this.eventBus({ type: "load", version: et() }), k("info", "Picked client initialized.");
|
|
994
994
|
}
|
|
995
995
|
start = () => {
|
|
996
|
-
|
|
996
|
+
$e(this), (async () => {
|
|
997
997
|
if (!N())
|
|
998
998
|
return;
|
|
999
999
|
await this.runPluginStartHooks();
|
|
1000
1000
|
const r = await this.evaluateGate(this.precondition);
|
|
1001
|
-
let
|
|
1002
|
-
r && (
|
|
1003
|
-
const i = r &&
|
|
1004
|
-
if (typeof
|
|
1005
|
-
const d =
|
|
1001
|
+
let n;
|
|
1002
|
+
r && (n = await this.evaluateGate(this.condition));
|
|
1003
|
+
const i = r && n === !0;
|
|
1004
|
+
if (typeof n == "boolean" && this.session) {
|
|
1005
|
+
const d = n;
|
|
1006
1006
|
this.session.setIsUser(d), this.eventBus({ type: "user_decide", value: d });
|
|
1007
1007
|
}
|
|
1008
|
-
if (this.eventBus({ type: "initialize" }), i &&
|
|
1009
|
-
const { id: d, isUser: o, identifiers:
|
|
1010
|
-
this.eventBus({ type: "session", id: d, isUser: o, identifiers:
|
|
1008
|
+
if (this.eventBus({ type: "initialize" }), i && L(this), await ie(), i && L(this), this.eventBus({ type: "ready" }), this.isReady = !0, this.session) {
|
|
1009
|
+
const { id: d, isUser: o, identifiers: s } = this.session;
|
|
1010
|
+
this.eventBus({ type: "session", id: d, isUser: o, identifiers: s });
|
|
1011
1011
|
}
|
|
1012
1012
|
})();
|
|
1013
1013
|
};
|
|
1014
1014
|
registerFramework = (e) => {
|
|
1015
|
-
|
|
1015
|
+
Ee(e, this.frameworks);
|
|
1016
1016
|
};
|
|
1017
1017
|
registerComponent = (e, r) => {
|
|
1018
|
-
|
|
1018
|
+
_(e, r, this.components);
|
|
1019
1019
|
};
|
|
1020
1020
|
registerPlugin = (e) => {
|
|
1021
1021
|
Se(this, e, this.plugins);
|
|
@@ -1035,22 +1035,22 @@ class ht {
|
|
|
1035
1035
|
We(e, r, this.actions);
|
|
1036
1036
|
};
|
|
1037
1037
|
registerExperience = (e) => {
|
|
1038
|
-
e.component &&
|
|
1038
|
+
e.component && _(`experience:${e.id}`, e.component, this.components), he(e, this.experiences);
|
|
1039
1039
|
};
|
|
1040
1040
|
getStateSnapshot = () => Y(this);
|
|
1041
1041
|
launchExperienceById = async (e, r) => {
|
|
1042
|
-
const
|
|
1043
|
-
if (!
|
|
1042
|
+
const n = this.experiences.getById(e).getState();
|
|
1043
|
+
if (!n) {
|
|
1044
1044
|
k("warn", `Experience with id '${e}' not found.`);
|
|
1045
1045
|
return;
|
|
1046
1046
|
}
|
|
1047
|
-
W(this,
|
|
1047
|
+
W(this, n, r);
|
|
1048
1048
|
};
|
|
1049
1049
|
openExperienceById = async (e) => {
|
|
1050
1050
|
const r = this.experienceInstances.getByExperienceId(e).getState();
|
|
1051
1051
|
if (r.length > 0)
|
|
1052
|
-
for (const
|
|
1053
|
-
|
|
1052
|
+
for (const n of r)
|
|
1053
|
+
n.toggleOpen();
|
|
1054
1054
|
else
|
|
1055
1055
|
return this.launchExperienceById(e, { initialiseOpen: !0 });
|
|
1056
1056
|
};
|
|
@@ -1064,14 +1064,14 @@ class ht {
|
|
|
1064
1064
|
setupPlugins() {
|
|
1065
1065
|
this.options.plugins?.forEach((e) => {
|
|
1066
1066
|
if (Array.isArray(e)) {
|
|
1067
|
-
e.forEach((
|
|
1068
|
-
this.registerPlugin(
|
|
1067
|
+
e.forEach((n) => {
|
|
1068
|
+
this.registerPlugin(n);
|
|
1069
1069
|
});
|
|
1070
1070
|
return;
|
|
1071
1071
|
}
|
|
1072
1072
|
const r = typeof e == "function" ? e() : e;
|
|
1073
1073
|
if (Array.isArray(r)) {
|
|
1074
|
-
r.forEach((
|
|
1074
|
+
r.forEach((n) => this.registerPlugin(n));
|
|
1075
1075
|
return;
|
|
1076
1076
|
}
|
|
1077
1077
|
this.registerPlugin(r);
|
|
@@ -1079,19 +1079,19 @@ class ht {
|
|
|
1079
1079
|
}
|
|
1080
1080
|
setupFeatures() {
|
|
1081
1081
|
const e = this.options.features;
|
|
1082
|
-
e && (Object.entries(e).forEach(([r,
|
|
1083
|
-
const i = typeof
|
|
1082
|
+
e && (Object.entries(e).forEach(([r, n]) => {
|
|
1083
|
+
const i = typeof n == "function" ? n() : n;
|
|
1084
1084
|
this.registerFeature(r, i);
|
|
1085
1085
|
}), this.searchParams.feature && this.searchParams.feature.forEach((r) => {
|
|
1086
1086
|
try {
|
|
1087
|
-
const [
|
|
1088
|
-
if (!
|
|
1087
|
+
const [n, i] = r.split(":");
|
|
1088
|
+
if (!n || !i)
|
|
1089
1089
|
return;
|
|
1090
1090
|
let d = i;
|
|
1091
|
-
d === "true" && (d = !0), d === "false" && (d = !1), this.registerFeature(
|
|
1091
|
+
d === "true" && (d = !0), d === "false" && (d = !1), this.registerFeature(n, {
|
|
1092
1092
|
key: `${d}`,
|
|
1093
1093
|
// use the assigned bucket value as the key
|
|
1094
|
-
name:
|
|
1094
|
+
name: n,
|
|
1095
1095
|
// eslint-disable-next-line sonarjs/function-return-type
|
|
1096
1096
|
decide: () => d,
|
|
1097
1097
|
storage: "session"
|
|
@@ -1102,22 +1102,22 @@ class ht {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
setupPredicates() {
|
|
1104
1104
|
const e = this.options.predicates;
|
|
1105
|
-
e && Object.entries(e).forEach(([r,
|
|
1106
|
-
if (typeof
|
|
1105
|
+
e && Object.entries(e).forEach(([r, n]) => {
|
|
1106
|
+
if (typeof n != "function") {
|
|
1107
1107
|
k("warn", `Predicate "${r}" is not a function.`);
|
|
1108
1108
|
return;
|
|
1109
1109
|
}
|
|
1110
|
-
this.registerPredicate(r,
|
|
1110
|
+
this.registerPredicate(r, n);
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
1113
1113
|
setupActions() {
|
|
1114
1114
|
const e = this.options.actions;
|
|
1115
|
-
e && Object.entries(e).forEach(([r,
|
|
1116
|
-
if (typeof
|
|
1115
|
+
e && Object.entries(e).forEach(([r, n]) => {
|
|
1116
|
+
if (typeof n != "function") {
|
|
1117
1117
|
k("warn", `Action "${r}" is not a function.`);
|
|
1118
1118
|
return;
|
|
1119
1119
|
}
|
|
1120
|
-
this.registerAction(r,
|
|
1120
|
+
this.registerAction(r, n);
|
|
1121
1121
|
});
|
|
1122
1122
|
}
|
|
1123
1123
|
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
@@ -1164,10 +1164,10 @@ class ht {
|
|
|
1164
1164
|
* // => "Fruits: apple, banana, and cherry"
|
|
1165
1165
|
*/
|
|
1166
1166
|
renderString = (e, r) => {
|
|
1167
|
-
const
|
|
1167
|
+
const n = this.responses.listStore.getState().reduce((i, d) => (i[d.fieldId] = d.value, i), {});
|
|
1168
1168
|
return mt(e, {
|
|
1169
1169
|
...r,
|
|
1170
|
-
responses:
|
|
1170
|
+
responses: n
|
|
1171
1171
|
});
|
|
1172
1172
|
};
|
|
1173
1173
|
}
|
|
@@ -1177,44 +1177,55 @@ function Q(t) {
|
|
|
1177
1177
|
function yt(t) {
|
|
1178
1178
|
return t.some((e) => e.condition || Q(e));
|
|
1179
1179
|
}
|
|
1180
|
-
async function
|
|
1180
|
+
async function Et(t, e) {
|
|
1181
1181
|
return e.length === 0 || !yt(e) ? e : (await Promise.all(
|
|
1182
|
-
e.map(async (
|
|
1183
|
-
if (!(
|
|
1182
|
+
e.map(async (n) => {
|
|
1183
|
+
if (!(n.condition ? await P(t, n.condition) : !0))
|
|
1184
1184
|
return null;
|
|
1185
|
-
if (!
|
|
1186
|
-
return
|
|
1185
|
+
if (!n.options || !Q(n))
|
|
1186
|
+
return n;
|
|
1187
1187
|
const o = (await Promise.all(
|
|
1188
|
-
|
|
1188
|
+
n.options.map(async (l) => l.condition ? await P(t, l.condition) ? l : null : l)
|
|
1189
1189
|
)).filter((l) => l !== null);
|
|
1190
|
-
return o.length ===
|
|
1190
|
+
return o.length === n.options.length ? n : o.length === 0 ? null : { ...n, options: o };
|
|
1191
1191
|
})
|
|
1192
|
-
)).filter((
|
|
1192
|
+
)).filter((n) => n !== null);
|
|
1193
1193
|
}
|
|
1194
|
-
|
|
1194
|
+
function Pt(t) {
|
|
1195
|
+
return {
|
|
1196
|
+
$$type: "lazy-component",
|
|
1197
|
+
load: t
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
function At(t) {
|
|
1201
|
+
return typeof t == "object" && t !== null && "$$type" in t && t.$$type === "lazy-component";
|
|
1202
|
+
}
|
|
1203
|
+
const $t = (t) => {
|
|
1195
1204
|
const e = new ht(t);
|
|
1196
1205
|
return le(e), e;
|
|
1197
1206
|
};
|
|
1198
1207
|
export {
|
|
1199
1208
|
ht as Picked,
|
|
1200
|
-
|
|
1209
|
+
$t as createClient,
|
|
1201
1210
|
A as createStorageKey,
|
|
1202
1211
|
P as evaluateRuleLogic,
|
|
1203
1212
|
at as getPickedConfig,
|
|
1204
|
-
|
|
1205
|
-
|
|
1213
|
+
Et as getStepFields,
|
|
1214
|
+
At as isLazyLoader,
|
|
1215
|
+
zt as isPickedRoot,
|
|
1216
|
+
Pt as lazyComponent,
|
|
1206
1217
|
C as localStore,
|
|
1207
1218
|
O as sessionStore,
|
|
1208
|
-
|
|
1209
|
-
|
|
1219
|
+
Ot as subscribe,
|
|
1220
|
+
Dt as supportsCookies,
|
|
1210
1221
|
de as supportsCryptoRandomUUID,
|
|
1211
1222
|
N as supportsDocument,
|
|
1212
|
-
|
|
1213
|
-
|
|
1223
|
+
Ut as supportsHistory,
|
|
1224
|
+
Vt as supportsIntersectionObserver,
|
|
1214
1225
|
ue as supportsLocalStorage,
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1226
|
+
Nt as supportsLocation,
|
|
1227
|
+
Tt as supportsSessionStorage,
|
|
1228
|
+
Lt as supportsShadowRoot,
|
|
1229
|
+
_t as supportsWebComponents,
|
|
1219
1230
|
T as supportsWindow
|
|
1220
1231
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Store } from 'effector';
|
|
2
2
|
import { Picked } from '../../picked';
|
|
3
|
+
import { LazyComponentLoader } from './lazyComponent';
|
|
3
4
|
export interface AdaptedComponentStyle {
|
|
4
5
|
sheets?: string[];
|
|
5
6
|
css?: string[];
|
|
@@ -8,7 +9,7 @@ export interface LazyAdaptedComponent<F extends string = string, C = unknown> {
|
|
|
8
9
|
frameworkName: F;
|
|
9
10
|
component: Promise<{
|
|
10
11
|
default: C;
|
|
11
|
-
}>;
|
|
12
|
+
}> | LazyComponentLoader<C>;
|
|
12
13
|
style?: AdaptedComponentStyle;
|
|
13
14
|
}
|
|
14
15
|
export interface EagerAdaptedComponent<F extends string = string, C = unknown> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/entities/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/entities/component/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO;IAC1E,aAAa,EAAE,CAAC,CAAA;IAChB,SAAS,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M,CAAA;QACZ,SAAS,EAAE,gBAAgB,CAAA;KAC5B,GACD,SAAS,CACZ;;;;;;CASD,CAAA;AAEF,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,WAAW,gBAAgB,EAC3B,YAAY,cAAc,KACzB,IAEF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LazyComponentLoader<C = unknown> {
|
|
2
|
+
readonly $$type: 'lazy-component';
|
|
3
|
+
load: () => Promise<{
|
|
4
|
+
default: C;
|
|
5
|
+
}>;
|
|
6
|
+
}
|
|
7
|
+
export declare function lazyComponent<C>(factory: () => Promise<{
|
|
8
|
+
default: C;
|
|
9
|
+
}>): LazyComponentLoader<C>;
|
|
10
|
+
export declare function isLazyLoader(value: unknown): value is LazyComponentLoader;
|
|
11
|
+
//# sourceMappingURL=lazyComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyComponent.d.ts","sourceRoot":"","sources":["../../../../src/entities/component/lazyComponent.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,IAAI,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,CAAC,CAAA;KAAE,CAAC,CAAA;CACpC;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAK/F;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAOzE"}
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type * from './utils/storage';
|
|
|
8
8
|
export { evaluateRuleLogic } from './utils/rules-logic';
|
|
9
9
|
export { getStepFields } from './utils/get-step-fields';
|
|
10
10
|
export { getPickedConfig } from './utils/picked-config';
|
|
11
|
+
export { lazyComponent, isLazyLoader } from './entities/component/lazyComponent';
|
|
11
12
|
/**
|
|
12
13
|
* Create a new Picked client instance and bind it to the window
|
|
13
14
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,iBAAiB,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,YAAY,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,iBAAiB,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAEhF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,mBAAmB,WAIxD,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './exports';
|
|
|
2
2
|
export type * from './client';
|
|
3
3
|
export type * from './entities/action/action';
|
|
4
4
|
export type * from './entities/component/component';
|
|
5
|
+
export type * from './entities/component/lazyComponent';
|
|
5
6
|
export type * from './entities/experience-instance/experience-instance';
|
|
6
7
|
export type * from './entities/experience/experience';
|
|
7
8
|
export type * from './entities/feature/feature';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -172,7 +172,7 @@ export interface SerializableExperience {
|
|
|
172
172
|
export interface CreateExperienceOptions {
|
|
173
173
|
id: string;
|
|
174
174
|
name: string;
|
|
175
|
-
condition?: LogicRule;
|
|
175
|
+
condition?: LogicRule | LogicValue;
|
|
176
176
|
/** @deprecated Use `condition` instead. This property will be removed in a future version. */
|
|
177
177
|
decide?: LogicRule;
|
|
178
178
|
initializeOpen?: LogicRule | LogicValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAGjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAA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BAAuB,EAAE,CAAA;IACvC,OAAO,EAAE,CACP,WAAW,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,UAAU,EAC9D,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;KAAE,KACtC,gBAAgB,CAAA;IACrB,cAAc,EAAE,CACd,kBAAkB,EAAE,wBAAwB,GAAG,uBAAuB,EACtE,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;KAAE,KACtC,uBAAuB,CAAA;IAC5B,aAAa,EAAE,CACb,UAAU,EAAE,sBAAsB,EAClC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;KAAE,KACtC,sBAAsB,CAAA;IAC3B,QAAQ,EAAE,CACR,YAAY,EAAE,kBAAkB,GAAG,iBAAiB,EACpD,IAAI,CAAC,EAAE,gBAAgB,KACpB,iBAAiB,CAAA;IACtB,SAAS,EAAE,CACT,aAAa,EAAE,mBAAmB,GAAG,sBAAsB,EAC3D,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;KAAE,KACtC,sBAAsB,CAAA;IAC3B,SAAS,EAAE,MAAM,UAAU,CAAC,UAAU,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EAGjB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAE1E,OAAO,KAAK,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