@picked/client 0.0.49-next.1 → 0.0.50-next.1
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/{api-sPUT21Vf.cjs → api-CdSLUdBr.cjs} +1 -1
- package/dist/{api-DlWmrA8P.js → api-DOhZIcQL.js} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/plugins/create-experience/index.js +218 -220
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/types/entities/experience/experience.d.ts +4 -6
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/picked.d.ts +3 -3
- package/dist/types/plugins/create-experience/create-experience.d.ts +0 -4
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a="Picked-Client",d="Picked-Version";function s(e,t){return{[a]:e,[d]:t}}const o=()=>"0.0.
|
|
1
|
+
"use strict";const a="Picked-Client",d="Picked-Version";function s(e,t){return{[a]:e,[d]:t}}const o=()=>"0.0.50-next.1",E="v1";function c(e,t){return new URL(`/api/${E}/${t}`,e).toString()}function i(e){return{...s("sdk",o()),...e}}async function f(e,t,n){const r=c(e,t);return fetch(r,{headers:i(n)})}async function l(e,t,n,r){const u=c(e,t);return fetch(u,{method:"POST",headers:{"Content-Type":"application/json",...i(r)},body:JSON.stringify(n)})}exports.createClientHeaders=s;exports.get=f;exports.getVersion=o;exports.post=l;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("effector"),S=require("@withease/factories"),I=require("../experience-instance-BsXG5XJ4.cjs"),E=require("../logger-BsmHUUw1.cjs"),w=require("../storage-Be5xWNPC.cjs"),U=require("../api-sPUT21Vf.cjs"),K=require("../id-BKIWbSTy.cjs"),G=require("../object-BbFTsGh3.cjs"),k=require("../supports-YvpQZxbh.cjs"),L=g.createDomain("experience"),W=S.createFactory(({client:t,experience:e})=>{const r=L.store(e),s=g.createApi(r,{merge(l,m){return{...l,...m.experience}}}),n=r.map(l=>({name:l.name,decisionLogic:l.condition??l.decide,targetSelectors:l.targets,initializeOpenLogic:e.initializeOpen})),p=t.components.listStore.map(l=>(e.componentName?l.find(m=>m.name===e.componentName):void 0)||l.find(m=>m.name===`experience:${e.id}`)||l.find(m=>m.name==="experience"),{skipVoid:!1}),a=r.map(l=>({steps:l.steps,nodes:l.nodes,edges:l.edges,conditionals:l.conditionals})),i=r.map(l=>l.fields),c=e.actions??[];return{id:e.id,configStore:n,treeStore:a,fieldsStore:i,componentStore:p,actions:c,merge:s.merge}});function J(t){return S.invoke(W,t)}const Y=S.createFactory(({client:t})=>{const e=L.store({}),r=g.createApi(e,{register(c,l){return{...c,[l.id]:l}}});function s(c){const l=e.getState()[c.id];if(l){l.merge({experience:c,strategy:"override"});return}const m=J({client:t,experience:c});r.register(m)}const n=e.map(c=>Object.values(c));function p(c){return e.map(l=>l[c],{skipVoid:!1})}const a=g.attach({source:e,effect:async(c,{id:l,options:m})=>{const b=c[l];if(!b){E.logger("warn",`Experience with id '${l}' not found.`);return}if(m?.bypassCondition){$(t,b,m);return}await V(t,b)&&$(t,b,m)}}),i=g.attach({source:t.experienceInstances.listStore,effect:(c,{id:l,options:m})=>{const b=c.filter(y=>y.experienceId===l);if(b.length>0)for(const y of b)y.open();else a({id:l,options:{...m,initialiseOpen:!0}})}});return{register:s,get:p,getById:p,launch:a,open:i,listStore:n}});function Q(t){return S.invoke(Y,t)}const X=(t,e)=>{e.register(t)},$=(t,e,r)=>{const{targetSelectors:s}=e.configStore.getState(),n=I.getTargetElements(s,e.id);n.forEach(({elements:a})=>a.forEach(i=>I.tagTargetElement(i,e.id))),I.createAppHosts(n,e.id).forEach(a=>{r?t.experienceInstances.spawn(e,a,r):t.experienceInstances.spawn(e,a)})},z=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await V(t,e)&&$(t,e)}))},V=async(t,e)=>{if(!t.preconditionPassed||!t.session?.isUser)return!1;const{decisionLogic:r,targetSelectors:s}=e.configStore.getState();return I.getTargetElements(s,e.id).length<1||s.length===0?!1:r===void 0?!0:I.isRulesLogic(r)?await I.evaluateRuleLogic(t,r)===!0:!0},Z=(t,e,r)=>{const s=e.name,n=e.setup(t);if(n){const p=r[s]??{};r[s]=Object.freeze({...p,...n})}},ee=g.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=g.createApi(e,{register(a,i){return{...a,[i.name]:i}}});function s(a,i){e.getState()[a]&&E.logger("warn",`Component '${a}' already registered. Registering again will override the previous registration.`);const l=re({client:t,name:a,component:i});r.register(l)}const n=e.map(a=>Object.values(a));function p(a){return e.map(i=>i[a],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ne(t){return S.invoke(se,t)}const D=(t,e,r)=>{r.register(t,e)},ie=g.createDomain("framework"),oe=S.createFactory(({client:t})=>{const e=ie.store({}),r=g.createApi(e,{register(a,i){return{...a,[i.name]:i.framework}}});function s(a,i){e.getState()[a]&&E.logger("warn",`Framework '${a}' already registered. Registering again will override the previous registration.`),r.register({name:a,framework:i})}const n=e.map(a=>Object.values(a));function p(a){return e.map(i=>i[a],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});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 n={projectId:t.projectId,path:window.location.pathname},p={},i=document.getElementById("picked_script")?.dataset.verceltoken;i&&(p["x-vercel-protection-bypass"]=i);const l=(await U.post(t.apiUrl,"ping",n,p)).ok;return l&&r.set(e),l}catch(e){return E.logger("error",e),!1}};function N(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=g.createDomain("predicate"),fe=S.createFactory(({client:t})=>{const e=pe.store({}),r=g.createApi(e,{register(i,c){return{...i,[c.name]:{name:c.name,predicate:c.predicate}}}});function s(i,c){e.getState()[i]&&E.logger("warn",`Predicate '${i}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:i,predicate:c}))}const n=e.map(i=>Object.values(i));function p(i){return e.map(c=>c[i]?.predicate,{skipVoid:!1})}function a(i){const c=g.createStore(()=>{},{skipVoid:!1}),l=g.createEffect(async()=>{const m=p(i).getState();if(!m)return;const b=N(t);return(...y)=>m({...b,args:y})});return g.sample({source:{responses:t.responses.listStore,fields:t.fields.listStore},target:l}),g.sample({clock:l.doneData,filter:m=>m!==void 0,target:c}),l(),c}return{register:s,getByName:p,listStore:n,getEvokablePredicate:a}});function ge(t){return S.invoke(fe,t)}const me=(t,e,r)=>{r.register(t,e)},B=g.createDomain("feature"),ye=S.createFactory(({client:t})=>{const e=B.store({}),r=B.store([]),s=g.createApi(e,{register(o,u){return{...o,[u.id]:u.feature}}});function n(o,u){e.getState()[o]&&E.logger("warn",`Feature '${o}' already registered. Registering again will override the previous registration.`);const d={id:o,feature:{...u,id:o}};s.register(Object.freeze({id:o,feature:d}))}const p=g.createEffect(async({id:o,key:u,storage:f="local"})=>{const d=w.createStorageKey(`feature:${o}:${u}`,"global"),v=(f==="session"?w.sessionStore:w.localStore).get(d).boolean();return v===null?null:{id:o,key:u,bucket:v,storage:f}}),a=g.createEffect(o=>{if(!o)return null;const u=w.createStorageKey(`feature:${o.id}:${o.key}`,"global");(o.storage==="session"?w.sessionStore:w.localStore).set(u,o.bucket)}),i=new Map,c=g.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:o,resolvedFeaturesStore:u},{id:f,decide:d,key:h})=>{const v=u.find(P=>P.id===f&&P.key===h);if(v)return v;const x=o[f];if(!x)throw new Error(`Feature with id '${f}' not found`);const A=i.get(`${f}:${h}`);if(A!==void 0){const P=await A;return{id:x.id,bucket:P,key:h,storage:x.feature.storage}}const F=d();i.set(`${f}:${h}`,F);const H=await F;return{id:x.id,bucket:H,key:h,storage:x.feature.storage}}});g.sample({clock:s.register,fn:o=>{const{id:u,feature:f}=o;return{id:u,key:f.feature.key,storage:f.feature.storage}},target:p}),g.sample({source:e,clock:c.doneData,fn:(o,u)=>{const{id:f,bucket:d,storage:h}=u,v=o[f]?.feature.key;return v?{key:v,id:f,bucket:d,storage:h}:null},target:a});const l=g.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:o,resolvedFeaturesStore:u})=>Object.values(o).map(f=>{const d=u.find(h=>h.id===f.id&&h.key===f.feature.key);return d?{id:f.id,name:f.feature.name,key:f.feature.key,getBucket:()=>({id:f.id,bucket:d.bucket}),isResolved:!0}:{id:f.id,name:f.feature.name,key:f.feature.key,getBucket:async()=>await c(f.feature),isResolved:!1}}));g.sample({clock:c.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:o},{id:u,key:f})=>!o.some(h=>h.id===u&&h.key===f),fn:(o,u)=>u,target:t.eventBus.prepend(o=>({type:"feature_decide",feature:o}))}),g.sample({clock:[p.doneData,c.doneData],source:r,fn:(o,u)=>!u||o.some(d=>d.id===u.id&&d.key===u.key)?o:[...o,u],target:r});function m(o){return l.map(u=>u.find(f=>f.id===o))}function b(o){return e.map(u=>u[o],{skipVoid:!1})}function y(o){const u=g.createStore(async()=>{},{skipVoid:!1}),f=g.createEffect(async()=>{const d=m(o).getState();if(d)return async()=>(await d.getBucket()).bucket});return g.sample({source:r,filter:d=>d.some(h=>h.id===o),target:f}),g.sample({clock:f.doneData,filter:d=>d!==void 0,target:u}),f(),u}return{register:n,getById:m,getByName:b,listStore:l,getEvokableFeature:y}});function he(t){return S.invoke(ye,t)}const Se=(t,e,r)=>{r.register(t,e)},j=g.createDomain("history");function O(t,e){return{id:K.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(),n=j.event();t.on(e,(a,i)=>({entries:[...a.entries,O(i.experienceId,i.node)]})),t.on(r,(a,i)=>({entries:[...a.entries.slice(0,-1),O(i.experienceId,i.node)]})),t.on(n,(a,i)=>i);function p(a,i){const c={lastStepIndex:-1,secondLastStepIndex:-1};for(let l=a.length-1;l>=0;l--){const m=a[l],b=m?.node;if(!(!b||!I.isStepNode(b))&&!(i&&m?.experienceId!==i))if(c.lastStepIndex===-1)c.lastStepIndex=l;else{c.secondLastStepIndex=l;break}}return c}return t.on(s,(a,i)=>{const{secondLastStepIndex:c}=p(a.entries,i.experienceId),l=c!==-1?a.entries.slice(0,c+1):a.entries;return{...a,entries:l}}),{push:e,replace:r,back:s,restore:n,entriesStore:t.map(a=>a.entries)}});function ke(){return S.invoke(ve)}let we=0;const be=t=>{const e=g.createStore([]);return g.sample({clock:t,source:e,fn:(r,s)=>[...r,{id:we++,at:new Date,payload:s}],target:e}),e},Ie=g.createDomain("field"),Fe=S.createFactory(()=>{const t=Ie.store({}),e=g.createApi(t,{register(i,c){return{...i,[c.field.id]:c.field}}});function r(i){e.register({field:i})}function s(i,c){const l=p(i).getState();if(!l)return;const m=Object.assign({},l,{...c});e.register({field:{...m}})}const n=t.map(i=>Object.values(i));function p(i){return t.map(c=>c[i]||null)}function a(i){return t.map(c=>Object.values(c).find(l=>l.name===i)||null)}return{register:r,update:s,getById:p,listStore:n,getByName:a}});function Ee(){return S.invoke(Fe)}const xe=(t,e)=>{e.register(t)},je=g.createDomain("action"),Ae=S.createFactory(()=>{const t=je.store({}),e=g.createApi(t,{register(a,i){return{...a,[i.name]:{name:i.name,action:i.action}}}});function r(a,i){e.register({name:a,action:i})}const s=t.map(a=>Object.values(a));function n(a){return t.map(i=>i[a],{skipVoid:!1})}function p(a){return t.map(i=>{const c=i[a];return c?c.action:void 0},{skipVoid:!1})}return{register:r,getByName:n,listStore:s,getEvokableAction:p}});function Pe(){return S.invoke(Ae)}const Re=(t,e,r)=>{r.register(t,e)};function C(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function Ce(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null}function M(t){try{return JSON.stringify(t),!0}catch{return!1}}const $e=g.createDomain("response"),ze=S.createFactory(({client:t})=>{const e=$e.store({}),r=g.createEvent(),s=g.createEvent(),n=g.createApi(e,{register(y,o){return{...y,[o.fieldId]:o.response}},registerBatch(y,o){return{...y,...o}},clear(y,o){const{[o]:u,...f}=y;return f},clearAll(){return{}}});function p(y,o){if(typeof y=="string"){if(o===void 0)throw new Error("Response is required when registering a single field");n.register({fieldId:y,response:o})}else n.registerBatch(y)}async function a(y){const o=[];return await Promise.allSettled(Object.entries(y).map(async([u,f])=>{let d=f;const h=t.fields.getById(u).getState();if(!h){o.push({fieldId:u,userMessage:`Field '${u}' not found`,systemMessage:`No field with ID '${u}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:d});return}if(h.multiple&&(typeof d=="string"||typeof d=="number"||typeof d=="boolean")&&(d=[d]),h.validation&&!G.isEmpty(h.validation)&&!C(d)){const v=await I.evaluateRuleLogic(t,h.validation,{$input:d});if(typeof v=="string"){o.push({fieldId:u,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:d});return}if(v===!1){o.push({fieldId:u,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:d});return}}if(h.required&&C(d)){o.push({fieldId:u,userMessage:"This field is required",systemMessage:"Field is required.",value:d});return}if(!h.multiple&&Array.isArray(d)&&d.length>1){o.push({fieldId:u,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:d});return}if(h.type==="object"&&!C(d))if(h.multiple){if(!Array.isArray(d)){o.push({fieldId:u,userMessage:"This field expects multiple values",systemMessage:"Field expects an array of objects.",value:d});return}for(const v of d){if(typeof v!="object"||v===null){o.push({fieldId:u,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:d});return}if(!M(v)){o.push({fieldId:u,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:d});return}}}else{if(Array.isArray(d)){o.push({fieldId:u,userMessage:"This field expects a single value",systemMessage:"Field expects a single object, not an array.",value:d});return}if(typeof d!="object"||d===null){o.push({fieldId:u,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:d});return}if(!M(d)){o.push({fieldId:u,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:d});return}}if(Array.isArray(h.options)&&h.options.length>0){const v=Array.isArray(d)?d:[d];if(h.type==="object"){const x=h.options.map(F=>JSON.stringify(F.value));v.every(F=>x.includes(JSON.stringify(F)))||o.push({fieldId:u,userMessage:"This field expects a valid option",systemMessage:"Field expects a valid option from the defined choices.",value:d})}else{const x=h.options.map(F=>F.value);v.every(F=>!Ce(F)||F===null?!1:x.includes(F))||o.push({fieldId:u,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:d})}}})),{responsesToCommit:y,validationErrors:o}}async function i(y){const{responsesToCommit:o,validationErrors:u}=await a(y);return u.length?{errors:u}:(n.registerBatch(o),{errors:[]})}const c=e.map(y=>y),l=e.map(y=>Object.keys(y).map(u=>({fieldId:u,value:y[u]})));function m(y){const o=t.fields.getById(y),u=e.map(f=>f[y]||null);return g.combine({f:o,r:u},({f,r:d})=>d||(f?.defaultValue?f.defaultValue:null))}function b(y){const o=t.fields.getByName(y);return g.combine({f:o,s:e},({f:u,s:f})=>{const d=u&&f[u.id]||null;return d||(u?.defaultValue?u.defaultValue:null)})}return g.sample({clock:r,target:n.clearAll}),g.sample({clock:s,target:n.clear}),{register:p,clearAll:r,clear:s,commit:i,getResponsesToCommit:a,listStore:l,getAllStore:c,getByFieldId:m,getByFieldName:b}});function De(t){return S.invoke(ze,t)}function Be(){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 Oe(){if(!k.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},r=new Set;for(const[n]of t.entries())n.startsWith("picked-")&&r.add(n);for(const n of r){const p=n.replace("picked-","");e[p]=t.getAll(n)}const s=w.createStorageKey("s");if(r.size>0)w.sessionStore.set(s,e);else{const n=w.sessionStore.get(s);if(n)return n.json()||{}}return e}function Me(){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 Ue=w.createStorageKey("session","global"),Le=()=>{const t=w.localStore.get(Ue);let e;t.isSet()&&(e=t.json());const r=n=>t.set({id:n.id,isUser:n.isUser,identifiers:n.identifiers}),s={id:e?.id??Me(),isUser:e?.isUser??void 0,identifiers:e?.identifiers??void 0,setIsUser(n){this.isUser=n,r(this)},setIdentifier(n,p){this.identifiers={...this.identifiers,[n]:p},r(this)},removeIdentifier(n){this.identifiers&&(this.identifiers=Object.fromEntries(Object.entries(this.identifiers).filter(([p])=>p!==n)),this.identifiers=Object.keys(this.identifiers).length?this.identifiers:void 0,r(this))}};return r(s),s},Ve=()=>k.supportsLocalStorage()?Le():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 Te(){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 _e(t){const{organizationId:e,projectId:r}=t;if(e&&r)return{organizationId:e,projectId:r};const s=Ne();if(s)return s;const n=Te();if(n)return n;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 g=require("effector"),S=require("@withease/factories"),I=require("../experience-instance-BsXG5XJ4.cjs"),E=require("../logger-BsmHUUw1.cjs"),w=require("../storage-Be5xWNPC.cjs"),U=require("../api-CdSLUdBr.cjs"),K=require("../id-BKIWbSTy.cjs"),G=require("../object-BbFTsGh3.cjs"),k=require("../supports-YvpQZxbh.cjs"),L=g.createDomain("experience"),W=S.createFactory(({client:t,experience:e})=>{const r=L.store(e),s=g.createApi(r,{merge(l,m){return{...l,...m.experience}}}),n=r.map(l=>({name:l.name,decisionLogic:l.condition,targetSelectors:l.targets,initializeOpenLogic:e.initializeOpen})),p=t.components.listStore.map(l=>(e.componentName?l.find(m=>m.name===e.componentName):void 0)||l.find(m=>m.name===`experience:${e.id}`)||l.find(m=>m.name==="experience"),{skipVoid:!1}),a=r.map(l=>({steps:l.steps,nodes:l.nodes,edges:l.edges,conditionals:l.conditionals})),i=r.map(l=>l.fields),c=e.actions??[];return{id:e.id,configStore:n,treeStore:a,fieldsStore:i,componentStore:p,actions:c,merge:s.merge}});function J(t){return S.invoke(W,t)}const Y=S.createFactory(({client:t})=>{const e=L.store({}),r=g.createApi(e,{register(c,l){return{...c,[l.id]:l}}});function s(c){const l=e.getState()[c.id];if(l){l.merge({experience:c,strategy:"override"});return}const m=J({client:t,experience:c});r.register(m)}const n=e.map(c=>Object.values(c));function p(c){return e.map(l=>l[c],{skipVoid:!1})}const a=g.attach({source:e,effect:async(c,{id:l,options:m})=>{const b=c[l];if(!b){E.logger("warn",`Experience with id '${l}' not found.`);return}if(m?.bypassCondition){$(t,b,m);return}await V(t,b)&&$(t,b,m)}}),i=g.attach({source:t.experienceInstances.listStore,effect:(c,{id:l,options:m})=>{const b=c.filter(y=>y.experienceId===l);if(b.length>0)for(const y of b)y.open();else a({id:l,options:{...m,initialiseOpen:!0}})}});return{register:s,get:p,getById:p,launch:a,open:i,listStore:n}});function Q(t){return S.invoke(Y,t)}const X=(t,e)=>{e.register(t)},$=(t,e,r)=>{const{targetSelectors:s}=e.configStore.getState(),n=I.getTargetElements(s,e.id);n.forEach(({elements:a})=>a.forEach(i=>I.tagTargetElement(i,e.id))),I.createAppHosts(n,e.id).forEach(a=>{r?t.experienceInstances.spawn(e,a,r):t.experienceInstances.spawn(e,a)})},z=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await V(t,e)&&$(t,e)}))},V=async(t,e)=>{if(!t.preconditionPassed||!t.session?.isUser)return!1;const{decisionLogic:r,targetSelectors:s}=e.configStore.getState();return I.getTargetElements(s,e.id).length<1||s.length===0?!1:r===void 0?!0:I.isRulesLogic(r)?await I.evaluateRuleLogic(t,r)===!0:!0},Z=(t,e,r)=>{const s=e.name,n=e.setup(t);if(n){const p=r[s]??{};r[s]=Object.freeze({...p,...n})}},ee=g.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=g.createApi(e,{register(a,i){return{...a,[i.name]:i}}});function s(a,i){e.getState()[a]&&E.logger("warn",`Component '${a}' already registered. Registering again will override the previous registration.`);const l=re({client:t,name:a,component:i});r.register(l)}const n=e.map(a=>Object.values(a));function p(a){return e.map(i=>i[a],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ne(t){return S.invoke(se,t)}const D=(t,e,r)=>{r.register(t,e)},ie=g.createDomain("framework"),oe=S.createFactory(({client:t})=>{const e=ie.store({}),r=g.createApi(e,{register(a,i){return{...a,[i.name]:i.framework}}});function s(a,i){e.getState()[a]&&E.logger("warn",`Framework '${a}' already registered. Registering again will override the previous registration.`),r.register({name:a,framework:i})}const n=e.map(a=>Object.values(a));function p(a){return e.map(i=>i[a],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});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 n={projectId:t.projectId,path:window.location.pathname},p={},i=document.getElementById("picked_script")?.dataset.verceltoken;i&&(p["x-vercel-protection-bypass"]=i);const l=(await U.post(t.apiUrl,"ping",n,p)).ok;return l&&r.set(e),l}catch(e){return E.logger("error",e),!1}};function N(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=g.createDomain("predicate"),fe=S.createFactory(({client:t})=>{const e=pe.store({}),r=g.createApi(e,{register(i,c){return{...i,[c.name]:{name:c.name,predicate:c.predicate}}}});function s(i,c){e.getState()[i]&&E.logger("warn",`Predicate '${i}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:i,predicate:c}))}const n=e.map(i=>Object.values(i));function p(i){return e.map(c=>c[i]?.predicate,{skipVoid:!1})}function a(i){const c=g.createStore(()=>{},{skipVoid:!1}),l=g.createEffect(async()=>{const m=p(i).getState();if(!m)return;const b=N(t);return(...y)=>m({...b,args:y})});return g.sample({source:{responses:t.responses.listStore,fields:t.fields.listStore},target:l}),g.sample({clock:l.doneData,filter:m=>m!==void 0,target:c}),l(),c}return{register:s,getByName:p,listStore:n,getEvokablePredicate:a}});function ge(t){return S.invoke(fe,t)}const me=(t,e,r)=>{r.register(t,e)},B=g.createDomain("feature"),ye=S.createFactory(({client:t})=>{const e=B.store({}),r=B.store([]),s=g.createApi(e,{register(o,u){return{...o,[u.id]:u.feature}}});function n(o,u){e.getState()[o]&&E.logger("warn",`Feature '${o}' already registered. Registering again will override the previous registration.`);const d={id:o,feature:{...u,id:o}};s.register(Object.freeze({id:o,feature:d}))}const p=g.createEffect(async({id:o,key:u,storage:f="local"})=>{const d=w.createStorageKey(`feature:${o}:${u}`,"global"),v=(f==="session"?w.sessionStore:w.localStore).get(d).boolean();return v===null?null:{id:o,key:u,bucket:v,storage:f}}),a=g.createEffect(o=>{if(!o)return null;const u=w.createStorageKey(`feature:${o.id}:${o.key}`,"global");(o.storage==="session"?w.sessionStore:w.localStore).set(u,o.bucket)}),i=new Map,c=g.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:o,resolvedFeaturesStore:u},{id:f,decide:d,key:h})=>{const v=u.find(P=>P.id===f&&P.key===h);if(v)return v;const x=o[f];if(!x)throw new Error(`Feature with id '${f}' not found`);const A=i.get(`${f}:${h}`);if(A!==void 0){const P=await A;return{id:x.id,bucket:P,key:h,storage:x.feature.storage}}const F=d();i.set(`${f}:${h}`,F);const H=await F;return{id:x.id,bucket:H,key:h,storage:x.feature.storage}}});g.sample({clock:s.register,fn:o=>{const{id:u,feature:f}=o;return{id:u,key:f.feature.key,storage:f.feature.storage}},target:p}),g.sample({source:e,clock:c.doneData,fn:(o,u)=>{const{id:f,bucket:d,storage:h}=u,v=o[f]?.feature.key;return v?{key:v,id:f,bucket:d,storage:h}:null},target:a});const l=g.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:o,resolvedFeaturesStore:u})=>Object.values(o).map(f=>{const d=u.find(h=>h.id===f.id&&h.key===f.feature.key);return d?{id:f.id,name:f.feature.name,key:f.feature.key,getBucket:()=>({id:f.id,bucket:d.bucket}),isResolved:!0}:{id:f.id,name:f.feature.name,key:f.feature.key,getBucket:async()=>await c(f.feature),isResolved:!1}}));g.sample({clock:c.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:o},{id:u,key:f})=>!o.some(h=>h.id===u&&h.key===f),fn:(o,u)=>u,target:t.eventBus.prepend(o=>({type:"feature_decide",feature:o}))}),g.sample({clock:[p.doneData,c.doneData],source:r,fn:(o,u)=>!u||o.some(d=>d.id===u.id&&d.key===u.key)?o:[...o,u],target:r});function m(o){return l.map(u=>u.find(f=>f.id===o))}function b(o){return e.map(u=>u[o],{skipVoid:!1})}function y(o){const u=g.createStore(async()=>{},{skipVoid:!1}),f=g.createEffect(async()=>{const d=m(o).getState();if(d)return async()=>(await d.getBucket()).bucket});return g.sample({source:r,filter:d=>d.some(h=>h.id===o),target:f}),g.sample({clock:f.doneData,filter:d=>d!==void 0,target:u}),f(),u}return{register:n,getById:m,getByName:b,listStore:l,getEvokableFeature:y}});function he(t){return S.invoke(ye,t)}const Se=(t,e,r)=>{r.register(t,e)},j=g.createDomain("history");function O(t,e){return{id:K.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(),n=j.event();t.on(e,(a,i)=>({entries:[...a.entries,O(i.experienceId,i.node)]})),t.on(r,(a,i)=>({entries:[...a.entries.slice(0,-1),O(i.experienceId,i.node)]})),t.on(n,(a,i)=>i);function p(a,i){const c={lastStepIndex:-1,secondLastStepIndex:-1};for(let l=a.length-1;l>=0;l--){const m=a[l],b=m?.node;if(!(!b||!I.isStepNode(b))&&!(i&&m?.experienceId!==i))if(c.lastStepIndex===-1)c.lastStepIndex=l;else{c.secondLastStepIndex=l;break}}return c}return t.on(s,(a,i)=>{const{secondLastStepIndex:c}=p(a.entries,i.experienceId),l=c!==-1?a.entries.slice(0,c+1):a.entries;return{...a,entries:l}}),{push:e,replace:r,back:s,restore:n,entriesStore:t.map(a=>a.entries)}});function ke(){return S.invoke(ve)}let we=0;const be=t=>{const e=g.createStore([]);return g.sample({clock:t,source:e,fn:(r,s)=>[...r,{id:we++,at:new Date,payload:s}],target:e}),e},Ie=g.createDomain("field"),Fe=S.createFactory(()=>{const t=Ie.store({}),e=g.createApi(t,{register(i,c){return{...i,[c.field.id]:c.field}}});function r(i){e.register({field:i})}function s(i,c){const l=p(i).getState();if(!l)return;const m=Object.assign({},l,{...c});e.register({field:{...m}})}const n=t.map(i=>Object.values(i));function p(i){return t.map(c=>c[i]||null)}function a(i){return t.map(c=>Object.values(c).find(l=>l.name===i)||null)}return{register:r,update:s,getById:p,listStore:n,getByName:a}});function Ee(){return S.invoke(Fe)}const xe=(t,e)=>{e.register(t)},je=g.createDomain("action"),Ae=S.createFactory(()=>{const t=je.store({}),e=g.createApi(t,{register(a,i){return{...a,[i.name]:{name:i.name,action:i.action}}}});function r(a,i){e.register({name:a,action:i})}const s=t.map(a=>Object.values(a));function n(a){return t.map(i=>i[a],{skipVoid:!1})}function p(a){return t.map(i=>{const c=i[a];return c?c.action:void 0},{skipVoid:!1})}return{register:r,getByName:n,listStore:s,getEvokableAction:p}});function Pe(){return S.invoke(Ae)}const Re=(t,e,r)=>{r.register(t,e)};function C(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function Ce(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null}function M(t){try{return JSON.stringify(t),!0}catch{return!1}}const $e=g.createDomain("response"),ze=S.createFactory(({client:t})=>{const e=$e.store({}),r=g.createEvent(),s=g.createEvent(),n=g.createApi(e,{register(y,o){return{...y,[o.fieldId]:o.response}},registerBatch(y,o){return{...y,...o}},clear(y,o){const{[o]:u,...f}=y;return f},clearAll(){return{}}});function p(y,o){if(typeof y=="string"){if(o===void 0)throw new Error("Response is required when registering a single field");n.register({fieldId:y,response:o})}else n.registerBatch(y)}async function a(y){const o=[];return await Promise.allSettled(Object.entries(y).map(async([u,f])=>{let d=f;const h=t.fields.getById(u).getState();if(!h){o.push({fieldId:u,userMessage:`Field '${u}' not found`,systemMessage:`No field with ID '${u}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:d});return}if(h.multiple&&(typeof d=="string"||typeof d=="number"||typeof d=="boolean")&&(d=[d]),h.validation&&!G.isEmpty(h.validation)&&!C(d)){const v=await I.evaluateRuleLogic(t,h.validation,{$input:d});if(typeof v=="string"){o.push({fieldId:u,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:d});return}if(v===!1){o.push({fieldId:u,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:d});return}}if(h.required&&C(d)){o.push({fieldId:u,userMessage:"This field is required",systemMessage:"Field is required.",value:d});return}if(!h.multiple&&Array.isArray(d)&&d.length>1){o.push({fieldId:u,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:d});return}if(h.type==="object"&&!C(d))if(h.multiple){if(!Array.isArray(d)){o.push({fieldId:u,userMessage:"This field expects multiple values",systemMessage:"Field expects an array of objects.",value:d});return}for(const v of d){if(typeof v!="object"||v===null){o.push({fieldId:u,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:d});return}if(!M(v)){o.push({fieldId:u,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:d});return}}}else{if(Array.isArray(d)){o.push({fieldId:u,userMessage:"This field expects a single value",systemMessage:"Field expects a single object, not an array.",value:d});return}if(typeof d!="object"||d===null){o.push({fieldId:u,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:d});return}if(!M(d)){o.push({fieldId:u,userMessage:"This field contains non-serializable data",systemMessage:"Field value contains non-JSON-serializable data (functions, circular references, etc.).",value:d});return}}if(Array.isArray(h.options)&&h.options.length>0){const v=Array.isArray(d)?d:[d];if(h.type==="object"){const x=h.options.map(F=>JSON.stringify(F.value));v.every(F=>x.includes(JSON.stringify(F)))||o.push({fieldId:u,userMessage:"This field expects a valid option",systemMessage:"Field expects a valid option from the defined choices.",value:d})}else{const x=h.options.map(F=>F.value);v.every(F=>!Ce(F)||F===null?!1:x.includes(F))||o.push({fieldId:u,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:d})}}})),{responsesToCommit:y,validationErrors:o}}async function i(y){const{responsesToCommit:o,validationErrors:u}=await a(y);return u.length?{errors:u}:(n.registerBatch(o),{errors:[]})}const c=e.map(y=>y),l=e.map(y=>Object.keys(y).map(u=>({fieldId:u,value:y[u]})));function m(y){const o=t.fields.getById(y),u=e.map(f=>f[y]||null);return g.combine({f:o,r:u},({f,r:d})=>d||(f?.defaultValue?f.defaultValue:null))}function b(y){const o=t.fields.getByName(y);return g.combine({f:o,s:e},({f:u,s:f})=>{const d=u&&f[u.id]||null;return d||(u?.defaultValue?u.defaultValue:null)})}return g.sample({clock:r,target:n.clearAll}),g.sample({clock:s,target:n.clear}),{register:p,clearAll:r,clear:s,commit:i,getResponsesToCommit:a,listStore:l,getAllStore:c,getByFieldId:m,getByFieldName:b}});function De(t){return S.invoke(ze,t)}function Be(){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 Oe(){if(!k.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},r=new Set;for(const[n]of t.entries())n.startsWith("picked-")&&r.add(n);for(const n of r){const p=n.replace("picked-","");e[p]=t.getAll(n)}const s=w.createStorageKey("s");if(r.size>0)w.sessionStore.set(s,e);else{const n=w.sessionStore.get(s);if(n)return n.json()||{}}return e}function Me(){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 Ue=w.createStorageKey("session","global"),Le=()=>{const t=w.localStore.get(Ue);let e;t.isSet()&&(e=t.json());const r=n=>t.set({id:n.id,isUser:n.isUser,identifiers:n.identifiers}),s={id:e?.id??Me(),isUser:e?.isUser??void 0,identifiers:e?.identifiers??void 0,setIsUser(n){this.isUser=n,r(this)},setIdentifier(n,p){this.identifiers={...this.identifiers,[n]:p},r(this)},removeIdentifier(n){this.identifiers&&(this.identifiers=Object.fromEntries(Object.entries(this.identifiers).filter(([p])=>p!==n)),this.identifiers=Object.keys(this.identifiers).length?this.identifiers:void 0,r(this))}};return r(s),s},Ve=()=>k.supportsLocalStorage()?Le():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 Te(){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 _e(t){const{organizationId:e,projectId:r}=t;if(e&&r)return{organizationId:e,projectId:r};const s=Ne();if(s)return s;const n=Te();if(n)return n;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
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 qe={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(([s,n])=>`${s}: ${n}`);return e.format(r)}return t instanceof Set?e.format(Array.from(t).map(String)):t}};function He(t){return typeof t=="object"&&t!==null}function Ke(t,e){let r=e;for(const s of t.split("."))if(He(r)&&s in r)r=r[s];else return;return typeof r=="function"?r():r}function Ge(t,e){const r=t.split("|").map(p=>p.trim()),s=r.shift()??"";let n=Ke(s,e);for(const p of r){const[a,...i]=p.split(":"),c=a?.trim()??"",l=i.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g,""),m=qe[c];m&&(n=m(n,l))}return R(n)?"":typeof n=="object"?JSON.stringify(n):String(n)}function We(t,e){let r="",s=0;for(;s<t.length;)if(t[s]==="{"&&t[s+1]==="{"){s+=2;let n="";for(;s<t.length;){if(t[s]==="}"&&t[s+1]==="}"){s+=2;break}n+=t[s++]}r+=Ge(n.trim(),e)}else r+=t[s++];return r}class _{static logger=E.logger;options;isReady=!1;project;plugins={};pluginStartHooks=[];eventBus=g.createEvent();events;organizationId;projectId;apiUrl;dashboardUrl;documentationSiteUrl;session;precondition;condition;preconditionPassed;searchParams=Oe();history=ke();components=ne({client:this});experienceInstances=I.createExperienceInstanceIndex({client:this});experiences=Q({client:this});frameworks=ae({client:this});predicates=ge({client:this});features=he({client:this});responses=De({client:this});fields=Ee();actions=Pe();constructor(e){E.logger("info","Picked client initializing."),this.events=be(this.eventBus);const{organizationId:r,projectId:s}=_e(e);this.organizationId=r,this.projectId=s,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||Be(),this.dashboardUrl=e.dashboardUrl??"https://dashboard.picked.app",this.documentationSiteUrl=e.documentationSiteUrl??"https://docs.picked.app",this.session=Ve(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.setupActions(),this.setupComponents(),this.precondition=e.precondition,this.condition=e.condition,this.eventBus({type:"load",version:U.getVersion()}),E.logger("info","Picked client initialized.")}start=()=>{de(this),(async()=>{if(!k.supportsDocument())return;await this.runPluginStartHooks();const r=await this.evaluateGate(this.precondition);this.preconditionPassed=r;let s;r&&(s=await this.evaluateGate(this.condition));const n=r&&s===!0;if(typeof s=="boolean"&&this.session){const p=s;this.session.setIsUser(p),this.eventBus({type:"user_decide",value:p})}if(this.eventBus({type:"initialize"}),n&&z(this),await I.domInteractive(),n&&z(this),this.eventBus({type:"ready"}),this.isReady=!0,this.session){const{id:p,isUser:a,identifiers:i}=this.session;this.eventBus({type:"session",id:p,isUser:a,identifiers:i})}})()};registerFramework=e=>{ce(e,this.frameworks)};registerComponent=(e,r)=>{D(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&&D(`experience:${e.id}`,e.component,this.components),X(e,this.experiences)};getStateSnapshot=()=>N(this);launchExperienceById=async(e,r)=>{this.experiences.launch({id:e,options:r})};openExperienceById=async e=>{this.experiences.open({id:e})};async runPluginStartHooks(){for(const e of this.pluginStartHooks)await e()}async evaluateGate(e){return e===void 0?!0:typeof e=="boolean"?e:await I.evaluateRuleLogic(this,e)===!0}setupPlugins(){this.options.plugins?.forEach(e=>{if(Array.isArray(e)){e.forEach(s=>{this.registerPlugin(s)});return}const r=typeof e=="function"?e():e;if(Array.isArray(r)){r.forEach(s=>this.registerPlugin(s));return}this.registerPlugin(r)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([r,s])=>{const n=typeof s=="function"?s():s;this.registerFeature(r,n)}),this.searchParams.feature&&this.searchParams.feature.forEach(r=>{try{const[s,n]=r.split(":");if(!s||!n)return;let p=n;p==="true"&&(p=!0),p==="false"&&(p=!1),this.registerFeature(s,{key:`${p}`,name:s,decide:()=>p,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([r,s])=>{if(typeof s!="function"){E.logger("warn",`Predicate "${r}" is not a function.`);return}this.registerPredicate(r,s)})}setupActions(){const e=this.options.actions;e&&Object.entries(e).forEach(([r,s])=>{if(typeof s!="function"){E.logger("warn",`Action "${r}" is not a function.`);return}this.registerAction(r,s)})}setupComponents(){const e=this.options.components;e&&Object.entries(e).forEach(([r,s])=>{this.registerComponent(r,s)})}getPluginConfig=e=>this.plugins[e]??{};renderString=(e,r)=>{const s=this.responses.listStore.getState().reduce((n,p)=>(n[p.fieldId]=p.value,n),{});return We(e,{...r,responses:s})}}function q(t){return t.options?.some(e=>"condition"in e)??!1}function Je(t){return t.some(e=>e.condition||q(e))}async function Ye(t,e){return e.length===0||!Je(e)?e:(await Promise.all(e.map(async s=>{if(!(s.condition?await I.evaluateRuleLogic(t,s.condition):!0))return null;if(!s.options||!q(s))return s;const a=(await Promise.all(s.options.map(async c=>c.condition?await I.evaluateRuleLogic(t,c.condition)?c:null:c))).filter(c=>c!==null);return a.length===s.options.length?s:a.length===0?null:{...s,options:a}}))).filter(s=>s!==null)}function Qe(t){return{$$type:"lazy-component",load:t}}function Xe(t){return typeof t=="object"&&t!==null&&"$$type"in t&&t.$$type==="lazy-component"}const Ze=t=>{const e=new _(t);return k.bindClient(e),e};exports.evaluateRuleLogic=I.evaluateRuleLogic;exports.isPickedRoot=I.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=_;exports.createClient=Ze;exports.getPickedConfig=T;exports.getStepFields=Ye;exports.isLazyLoader=Xe;exports.lazyComponent=Qe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../../id-BKIWbSTy.cjs"),r={serialize(i){return JSON.stringify(i)},deserialize(i){return JSON.parse(i)}},m=i=>({name:"create-experience",setup:d=>{i.experiences.forEach(t=>{const s=t.serialize(),o=r.deserialize(s);o.component=t.component,d.registerExperience(o),o.fields.forEach(f=>{d.registerField(f)})})}}),y=(i,d)=>({id:p.generateId("node"),experience:d,type:"action",action:i.action,addNext(s){if(!s.node)throw new Error("Cannot connect to node");const o=c({sourceNode:this,destinationNode:s.node,sourceNodeHandle:null},d);d.edges.push(o)},onSuccess(s){if(!s.node)throw new Error("Cannot connect to node");const o=c({sourceNode:this,destinationNode:s.node,sourceNodeHandle:"true"},d);d.edges.push(o)},onFail(s){if(!s.node)throw new Error("Cannot connect to node");const o=c({sourceNode:this,destinationNode:s.node,sourceNodeHandle:"false"},d);d.edges.push(o)},serialize(){return r.serialize({id:this.id,type:this.type,action:this.action})}}),z=i=>({id:i.id??p.generateId("step"),label:i.label,fields:i.fields??[],addField(d){const t="serialize"in d?d:g(d);return this.fields.includes(t)||this.fields.push(t),t}}),b=(i,d)=>{const t={id:i.id??p.generateId("step"),label:i.label,experience:d,fields:i.fields??[],node:null,nextStep(s){return this.experience.addStep(s,this)},nextConditional(s){return this.experience.addConditional(s,this)},addNextExperience(s){return this.experience.addExperience(s,this)},addField(s){return this.experience.addField(s,this)},serialize(){return r.serialize({id:this.id,label:this.label,fieldIds:this.fields.map(s=>s.id)})}};return h({step:t,type:"step"},d),t},h=(i,d)=>{const t={id:p.generateId("node"),experience:d};if(i.type==="step"){const o={...t,type:"step",connectedStep:i.step,serialize(){return r.serialize({id:this.id,type:this.type,stepId:this.connectedStep.id,label:this.connectedStep.label})}};return o.connectedStep.node=o,o}if(i.type==="conditional"){const o={...t,type:"conditional",connectedConditional:i.conditional,serialize(){return r.serialize({id:this.id,type:this.type,conditionalId:this.connectedConditional.id})}};return o.connectedConditional.node=o,o}return i.type==="experience"?{...t,type:"experience",connectedExperience:i.experience,serialize(){return r.serialize({id:this.id,type:this.type,experienceId:this.connectedExperience.id})}}:{...t,type:"origin",serialize(){return r.serialize({id:this.id,type:this.type})}}},c=(i,d)=>({id:p.generateId("edge"),sourceNode:i.sourceNode,sourceNodeHandle:i.sourceNodeHandle,destinationNode:i.destinationNode,experience:d,serialize(){return r.serialize({id:this.id,sourceNodeHandle:this.sourceNodeHandle??void 0,sourceNodeId:this.sourceNode.id,destinationNodeId:this.destinationNode.id})}}),N=(i,d)=>{const t={id:p.generateId("conditional"),label:i.label,condition:i.condition,node:null,experience:d,addTrue(s){if(!this.node||!s.node)throw new Error("todo no node");const o=c({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"true"},this.experience);this.experience.edges.push(o)},addFalse(s){if(!this.node||!s.node)throw new Error("todo no node");const o=c({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"false"},this.experience);this.experience.edges.push(o)},serialize(){return r.serialize({id:this.id,label:this.label,condition:this.condition})}};return h({conditional:t,type:"conditional"},d),t},g=i=>({id:i.id,name:i.name,type:i.type,label:i.label,placeholder:i.placeholder,description:i.description,helpText:i.helpText,defaultValue:i.defaultValue??null,multiple:i.multiple,validation:i.validation??{},condition:i.condition,required:i.required,options:i.options?.map(t=>({id:"id"in t?t.id:p.generateId("option"),...t}))??null,policies:i.policies,serialize(){const t={id:this.id,name:this.name,label:this.label,placeholder:this.placeholder,required:this.required,description:this.description,helpText:this.helpText,validation:this.validation,condition:this.condition,policies:this.policies},s=typeof this.defaultValue=="string"?this.defaultValue:void 0,o=typeof this.defaultValue=="number"?this.defaultValue:void 0,f=typeof this.defaultValue=="boolean"?this.defaultValue:void 0;switch(this.type){case"text":if(this.multiple){let e;if(Array.isArray(this.defaultValue)){e=[];for(const n of this.defaultValue)typeof n=="string"&&e.push(n);e.length===0&&(e=void 0)}return r.serialize({...t,type:"text",multiple:!0,defaultValue:e,options:this.options?this.options.map(n=>({id:n.id,label:n.label,value:`${n.value}`,condition:n.condition})):null})}return r.serialize({...t,type:"text",multiple:!1,defaultValue:s,options:this.options?this.options.map(e=>({id:e.id,label:e.label,value:`${e.value}`,condition:e.condition})):null});case"number":if(this.multiple){let e;if(Array.isArray(this.defaultValue)){e=[];for(const n of this.defaultValue)typeof n=="number"&&e.push(n);e.length===0&&(e=void 0)}return r.serialize({...t,type:"number",multiple:!0,defaultValue:e,options:this.options?this.options.map(n=>({id:n.id,label:n.label,value:Number(n.value),condition:n.condition})):null})}return r.serialize({...t,type:"number",multiple:!1,defaultValue:o,options:this.options?this.options.map(e=>({id:e.id,label:e.label,value:Number(e.value),condition:e.condition})):null});case"boolean":if(this.multiple){let e;if(Array.isArray(this.defaultValue)){e=[];for(const n of this.defaultValue)typeof n=="boolean"&&e.push(n);e.length===0&&(e=void 0)}return r.serialize({...t,type:"boolean",multiple:!0,defaultValue:e,options:this.options?this.options.map(n=>({id:n.id,label:n.label,value:!!n.value,condition:n.condition})):null})}return r.serialize({...t,type:"boolean",multiple:!1,defaultValue:f,options:this.options?this.options.map(e=>({id:e.id,label:e.label,value:!!e.value,condition:e.condition})):null});case"object":return this.multiple?r.serialize({...t,type:"object",multiple:!0,defaultValue:this.defaultValue,options:this.options?this.options.map(e=>({id:e.id,label:e.label,description:e.description,value:e.value,condition:e.condition})):null}):r.serialize({...t,type:"object",multiple:!1,defaultValue:this.defaultValue,options:this.options?this.options.map(e=>({id:e.id,label:e.label,description:e.description,value:e.value,condition:e.condition})):null});default:throw new Error("Unsupported field type")}}}),v=i=>{const d=[],t=[],s=[],o=[],f=[];return{id:i.id,component:i.component,name:i.name,initializeOpen:i.initializeOpen,condition:i.condition,targets:i.targets,steps:d,nodes:t,edges:s,fields:f,conditionals:o,addStep(e,n){let l=n?.node;this.nodes.length===0&&(l=h({type:"origin"},this),this.nodes.push(l));const a="serialize"in e?e:b(e,this);if(l){if(!a.node)throw new Error("todo no node");const u=c({sourceNode:l,destinationNode:a.node,sourceNodeHandle:null},this);this.edges.push(u)}return a.fields.length>0&&a.fields.forEach(u=>{this.fields.includes(u)||this.fields.push(u)}),this.steps.includes(a)||(this.steps.push(a),a.node&&this.nodes.push(a.node)),a},addAction(e,n){let l=n?.node;this.nodes.length===0&&(l=h({type:"origin"},this),this.nodes.push(l));const a="serialize"in e?e:y(e,this);if(l){const u=c({sourceNode:l,destinationNode:a,sourceNodeHandle:null},this);this.edges.push(u)}return this.nodes.push(a),a},addConditional(e,n){let l=n?.node;this.nodes.length===0&&(l=h({type:"origin"},this),this.nodes.push(l));const a="serialize"in e?e:N(e,this);if(l){if(!a.node)throw new Error("todo no node");const u=c({sourceNode:l,destinationNode:a.node,sourceNodeHandle:null},this);this.edges.push(u)}return this.conditionals.includes(a)||(this.conditionals.push(a),a.node&&this.nodes.push(a.node)),a},addExperience(e,n){let l=n?.node;this.nodes.length===0&&(l=h({type:"origin"},this),this.nodes.push(l));const a=h({type:"experience",experience:e},this);if(this.nodes.push(a),l){const u=c({sourceNode:l,destinationNode:a,sourceNodeHandle:null},this);this.edges.push(u)}return e},addField(e,n){const l="serialize"in e?e:g(e);return n&&n.fields.push(l),this.fields.includes(l)||this.fields.push(l),l},serialize(){return r.serialize({id:this.id,component:this.component,name:this.name,initializeOpen:this.initializeOpen,condition:this.condition,targets:this.targets,steps:this.steps.map(e=>r.deserialize(e.serialize())),nodes:this.nodes.map(e=>r.deserialize(e.serialize())),edges:this.edges.map(e=>r.deserialize(e.serialize())),conditionals:this.conditionals.map(e=>r.deserialize(e.serialize())),fields:this.fields.map(e=>r.deserialize(e.serialize()))})}}};exports.createConditional=N;exports.createEdge=c;exports.createExperience=v;exports.createExperiencePlugin=m;exports.createField=g;exports.createNode=h;exports.createStep=z;exports.serialization=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../api-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../api-CdSLUdBr.cjs"),a=require("../../../logger-BsmHUUw1.cjs");function d(e){let r=2166136261;for(let n=0;n<e.length;n++)r^=e.charCodeAt(n),r=Math.imul(r,16777619);return r>>>0}function g(e){return d(e)%100}function p(e,r){return r<=0?!1:r>=100?!0:e<r}function h(e){return typeof e!="object"||e===null||!("id"in e&&"name"in e&&"enabled"in e&&"weight"in e&&"version"in e)?!1:typeof e.id=="string"&&typeof e.name=="string"&&typeof e.enabled=="boolean"&&typeof e.weight=="number"&&typeof e.version=="number"}function l(e){return typeof e!="object"||e===null||!("features"in e)||!Array.isArray(e.features)?!1:e.features.every(h)}function y(e){const r=e.searchParams["preview-token"];if(r&&r.length>0)return r[0]}function m(e){const r=new Set,n=e.searchParams.feature;if(!n)return r;for(const i of n){const t=i.indexOf(":");t>0&&r.add(i.substring(0,t))}return r}function c(e,r,n){const i=m(e),t=e.session?.id;if(!t)throw new Error("Session ID is required for feature registration");const o=g(t);for(const s of r.features)i.has(s.id)||v(e,s,n,o)}function v(e,r,n,i){e.registerFeature(r.id,{key:`v${r.version}`,name:r.name,storage:n?"session":"local",decide:()=>r.enabled?p(i,r.weight):!1})}function w(){let e;try{e=__PICKED_PROJECT_CONFIG__}catch{return}if(e===void 0)return;let r;if(typeof e=="string")try{r=JSON.parse(e)}catch{a.logger("warn","Build-time project config is not valid JSON");return}else r=e;if(l(r))return r;a.logger("warn","Build-time project config has invalid shape, falling back to runtime fetch")}function j(e){try{const r=new URL(e).hostname;return r==="localhost"||r==="127.0.0.1"||r==="::1"}catch{return!1}}function b(e){if(typeof e!="object"||e===null||!("cause"in e))return!1;const{cause:r}=e;return typeof r!="object"||r===null||!("code"in r)?!1:r.code==="ECONNREFUSED"}async function u(e,r,n){const i=n?.previewToken?`projects/${r}?preview_token=${encodeURIComponent(n.previewToken)}`:`projects/${r}`;let t;try{t=await f.get(e,i,n?.headers)}catch(s){return j(e)&&b(s)||a.logger("warn","Failed to fetch project config",s),null}if(!t.ok)return a.logger("warn",`Project config request failed with status ${t.status.toString()}`),null;let o;try{o=await t.json()}catch{return a.logger("warn","Failed to parse project config response"),null}return l(o)?o:(a.logger("warn","Invalid project config response shape"),null)}function P(e){return{name:"dynamic-experiences",setup:r=>{const n=e?.apiUrl??r.apiUrl;return{onStart:async()=>{const i=y(r);if(i){const s=await u(n,r.projectId,{previewToken:i});s&&c(r,s,!0);return}const t=e?.projectConfig??w();if(t){c(r,t,!1);return}const o=await u(n,r.projectId);o&&c(r,o,!1)}}}}}exports.createClientHeaders=f.createClientHeaders;exports.dynamicExperiencesPlugin=P;exports.fetchProject=u;
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { f as zt } from "../experience-instance-fvSEb72i.js";
|
|
|
5
5
|
import { l as w } from "../logger-C9a75KZn.js";
|
|
6
6
|
import { c as A, l as C, s as O } from "../storage-Co_LbKr_.js";
|
|
7
7
|
import { a as Ot } from "../storage-Co_LbKr_.js";
|
|
8
|
-
import { p as ae, g as ce } from "../api-
|
|
8
|
+
import { p as ae, g as ce } from "../api-DOhZIcQL.js";
|
|
9
9
|
import { g as ue } from "../id-BW-g3y32.js";
|
|
10
10
|
import { i as de } from "../object-JwZ58NOH.js";
|
|
11
11
|
import { s as L, a as _, b as le, c as pe, d as fe } from "../supports-8YT4QKI7.js";
|
|
@@ -21,7 +21,7 @@ const Y = x("experience"), ge = b(
|
|
|
21
21
|
}
|
|
22
22
|
}), n = r.map((d) => ({
|
|
23
23
|
name: d.name,
|
|
24
|
-
decisionLogic: d.condition
|
|
24
|
+
decisionLogic: d.condition,
|
|
25
25
|
targetSelectors: d.targets,
|
|
26
26
|
initializeOpenLogic: e.initializeOpen
|
|
27
27
|
})), p = t.components.listStore.map(
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as p } from "../../../id-BW-g3y32.js";
|
|
2
2
|
const r = {
|
|
3
|
-
serialize(
|
|
4
|
-
return JSON.stringify(
|
|
3
|
+
serialize(i) {
|
|
4
|
+
return JSON.stringify(i);
|
|
5
5
|
},
|
|
6
|
-
deserialize(
|
|
7
|
-
return JSON.parse(
|
|
6
|
+
deserialize(i) {
|
|
7
|
+
return JSON.parse(i);
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, b = (i) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
|
-
setup: (
|
|
12
|
-
|
|
13
|
-
const n =
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
setup: (o) => {
|
|
12
|
+
i.experiences.forEach((t) => {
|
|
13
|
+
const n = t.serialize(), d = r.deserialize(n);
|
|
14
|
+
d.component = t.component, o.registerExperience(d), d.fields.forEach((f) => {
|
|
15
|
+
o.registerField(f);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
id:
|
|
21
|
-
experience:
|
|
19
|
+
}), m = (i, o) => ({
|
|
20
|
+
id: p("node"),
|
|
21
|
+
experience: o,
|
|
22
22
|
type: "action",
|
|
23
|
-
action:
|
|
23
|
+
action: i.action,
|
|
24
24
|
addNext(n) {
|
|
25
25
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
26
|
-
const
|
|
26
|
+
const d = c(
|
|
27
27
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: null },
|
|
28
|
-
|
|
28
|
+
o
|
|
29
29
|
);
|
|
30
|
-
|
|
30
|
+
o.edges.push(d);
|
|
31
31
|
},
|
|
32
32
|
onSuccess(n) {
|
|
33
33
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
34
|
-
const
|
|
34
|
+
const d = c(
|
|
35
35
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
36
|
-
|
|
36
|
+
o
|
|
37
37
|
);
|
|
38
|
-
|
|
38
|
+
o.edges.push(d);
|
|
39
39
|
},
|
|
40
40
|
onFail(n) {
|
|
41
41
|
if (!n.node) throw new Error("Cannot connect to node");
|
|
42
|
-
const
|
|
42
|
+
const d = c(
|
|
43
43
|
{ sourceNode: this, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
44
|
-
|
|
44
|
+
o
|
|
45
45
|
);
|
|
46
|
-
|
|
46
|
+
o.edges.push(d);
|
|
47
47
|
},
|
|
48
48
|
serialize() {
|
|
49
49
|
return r.serialize({
|
|
@@ -52,20 +52,20 @@ const r = {
|
|
|
52
52
|
action: this.action
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
}),
|
|
56
|
-
id:
|
|
57
|
-
label:
|
|
58
|
-
fields:
|
|
59
|
-
addField(
|
|
60
|
-
const
|
|
61
|
-
return this.fields.includes(
|
|
55
|
+
}), v = (i) => ({
|
|
56
|
+
id: i.id ?? p("step"),
|
|
57
|
+
label: i.label,
|
|
58
|
+
fields: i.fields ?? [],
|
|
59
|
+
addField(o) {
|
|
60
|
+
const t = "serialize" in o ? o : N(o);
|
|
61
|
+
return this.fields.includes(t) || this.fields.push(t), t;
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
64
|
-
const
|
|
65
|
-
id:
|
|
66
|
-
label:
|
|
67
|
-
experience:
|
|
68
|
-
fields:
|
|
63
|
+
}), y = (i, o) => {
|
|
64
|
+
const t = {
|
|
65
|
+
id: i.id ?? p("step"),
|
|
66
|
+
label: i.label,
|
|
67
|
+
experience: o,
|
|
68
|
+
fields: i.fields ?? [],
|
|
69
69
|
node: null,
|
|
70
70
|
nextStep(n) {
|
|
71
71
|
return this.experience.addStep(n, this);
|
|
@@ -87,17 +87,17 @@ const r = {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
return
|
|
91
|
-
},
|
|
92
|
-
const
|
|
93
|
-
id:
|
|
94
|
-
experience:
|
|
90
|
+
return h({ step: t, type: "step" }, o), t;
|
|
91
|
+
}, h = (i, o) => {
|
|
92
|
+
const t = {
|
|
93
|
+
id: p("node"),
|
|
94
|
+
experience: o
|
|
95
95
|
};
|
|
96
|
-
if (
|
|
97
|
-
const
|
|
98
|
-
...
|
|
96
|
+
if (i.type === "step") {
|
|
97
|
+
const d = {
|
|
98
|
+
...t,
|
|
99
99
|
type: "step",
|
|
100
|
-
connectedStep:
|
|
100
|
+
connectedStep: i.step,
|
|
101
101
|
serialize() {
|
|
102
102
|
return r.serialize({
|
|
103
103
|
id: this.id,
|
|
@@ -107,13 +107,13 @@ const r = {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
return
|
|
110
|
+
return d.connectedStep.node = d, d;
|
|
111
111
|
}
|
|
112
|
-
if (
|
|
113
|
-
const
|
|
114
|
-
...
|
|
112
|
+
if (i.type === "conditional") {
|
|
113
|
+
const d = {
|
|
114
|
+
...t,
|
|
115
115
|
type: "conditional",
|
|
116
|
-
connectedConditional:
|
|
116
|
+
connectedConditional: i.conditional,
|
|
117
117
|
serialize() {
|
|
118
118
|
return r.serialize({
|
|
119
119
|
id: this.id,
|
|
@@ -122,12 +122,12 @@ const r = {
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
|
-
return
|
|
125
|
+
return d.connectedConditional.node = d, d;
|
|
126
126
|
}
|
|
127
|
-
return
|
|
128
|
-
...
|
|
127
|
+
return i.type === "experience" ? {
|
|
128
|
+
...t,
|
|
129
129
|
type: "experience",
|
|
130
|
-
connectedExperience:
|
|
130
|
+
connectedExperience: i.experience,
|
|
131
131
|
serialize() {
|
|
132
132
|
return r.serialize({
|
|
133
133
|
id: this.id,
|
|
@@ -136,7 +136,7 @@ const r = {
|
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
} : {
|
|
139
|
-
...
|
|
139
|
+
...t,
|
|
140
140
|
type: "origin",
|
|
141
141
|
serialize() {
|
|
142
142
|
return r.serialize({
|
|
@@ -145,12 +145,12 @@ const r = {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
},
|
|
149
|
-
id:
|
|
150
|
-
sourceNode:
|
|
151
|
-
sourceNodeHandle:
|
|
152
|
-
destinationNode:
|
|
153
|
-
experience:
|
|
148
|
+
}, c = (i, o) => ({
|
|
149
|
+
id: p("edge"),
|
|
150
|
+
sourceNode: i.sourceNode,
|
|
151
|
+
sourceNodeHandle: i.sourceNodeHandle,
|
|
152
|
+
destinationNode: i.destinationNode,
|
|
153
|
+
experience: o,
|
|
154
154
|
serialize() {
|
|
155
155
|
return r.serialize({
|
|
156
156
|
id: this.id,
|
|
@@ -159,30 +159,30 @@ const r = {
|
|
|
159
159
|
destinationNodeId: this.destinationNode.id
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
}),
|
|
163
|
-
const
|
|
164
|
-
id:
|
|
165
|
-
label:
|
|
166
|
-
condition:
|
|
162
|
+
}), z = (i, o) => {
|
|
163
|
+
const t = {
|
|
164
|
+
id: p("conditional"),
|
|
165
|
+
label: i.label,
|
|
166
|
+
condition: i.condition,
|
|
167
167
|
node: null,
|
|
168
|
-
experience:
|
|
168
|
+
experience: o,
|
|
169
169
|
addTrue(n) {
|
|
170
170
|
if (!this.node || !n.node)
|
|
171
171
|
throw new Error("todo no node");
|
|
172
|
-
const
|
|
172
|
+
const d = c(
|
|
173
173
|
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "true" },
|
|
174
174
|
this.experience
|
|
175
175
|
);
|
|
176
|
-
this.experience.edges.push(
|
|
176
|
+
this.experience.edges.push(d);
|
|
177
177
|
},
|
|
178
178
|
addFalse(n) {
|
|
179
179
|
if (!this.node || !n.node)
|
|
180
180
|
throw new Error("todo no node");
|
|
181
|
-
const
|
|
181
|
+
const d = c(
|
|
182
182
|
{ sourceNode: this.node, destinationNode: n.node, sourceNodeHandle: "false" },
|
|
183
183
|
this.experience
|
|
184
184
|
);
|
|
185
|
-
this.experience.edges.push(
|
|
185
|
+
this.experience.edges.push(d);
|
|
186
186
|
},
|
|
187
187
|
serialize() {
|
|
188
188
|
return r.serialize({
|
|
@@ -192,28 +192,28 @@ const r = {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
|
-
return
|
|
196
|
-
},
|
|
197
|
-
id:
|
|
198
|
-
name:
|
|
199
|
-
type:
|
|
200
|
-
label:
|
|
201
|
-
placeholder:
|
|
202
|
-
description:
|
|
203
|
-
helpText:
|
|
204
|
-
defaultValue:
|
|
205
|
-
multiple:
|
|
206
|
-
validation:
|
|
207
|
-
condition:
|
|
208
|
-
required:
|
|
209
|
-
options:
|
|
210
|
-
id: "id" in
|
|
211
|
-
...
|
|
195
|
+
return h({ conditional: t, type: "conditional" }, o), t;
|
|
196
|
+
}, N = (i) => ({
|
|
197
|
+
id: i.id,
|
|
198
|
+
name: i.name,
|
|
199
|
+
type: i.type,
|
|
200
|
+
label: i.label,
|
|
201
|
+
placeholder: i.placeholder,
|
|
202
|
+
description: i.description,
|
|
203
|
+
helpText: i.helpText,
|
|
204
|
+
defaultValue: i.defaultValue ?? null,
|
|
205
|
+
multiple: i.multiple,
|
|
206
|
+
validation: i.validation ?? {},
|
|
207
|
+
condition: i.condition,
|
|
208
|
+
required: i.required,
|
|
209
|
+
options: i.options?.map((t) => ({
|
|
210
|
+
id: "id" in t ? t.id : p("option"),
|
|
211
|
+
...t
|
|
212
212
|
})) ?? null,
|
|
213
|
-
policies:
|
|
213
|
+
policies: i.policies,
|
|
214
214
|
// eslint-disable-next-line sonarjs/cognitive-complexity -- this function handles all field types and subtypes; splitting it would increase indirection without improving clarity. Addressed in PR #1372
|
|
215
215
|
serialize() {
|
|
216
|
-
const
|
|
216
|
+
const t = {
|
|
217
217
|
id: this.id,
|
|
218
218
|
name: this.name,
|
|
219
219
|
label: this.label,
|
|
@@ -224,219 +224,218 @@ const r = {
|
|
|
224
224
|
validation: this.validation,
|
|
225
225
|
condition: this.condition,
|
|
226
226
|
policies: this.policies
|
|
227
|
-
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0,
|
|
227
|
+
}, n = typeof this.defaultValue == "string" ? this.defaultValue : void 0, d = typeof this.defaultValue == "number" ? this.defaultValue : void 0, f = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
|
|
228
228
|
switch (this.type) {
|
|
229
229
|
case "text":
|
|
230
230
|
if (this.multiple) {
|
|
231
|
-
let
|
|
231
|
+
let e;
|
|
232
232
|
if (Array.isArray(this.defaultValue)) {
|
|
233
|
-
|
|
234
|
-
for (const
|
|
235
|
-
typeof
|
|
236
|
-
|
|
233
|
+
e = [];
|
|
234
|
+
for (const s of this.defaultValue)
|
|
235
|
+
typeof s == "string" && e.push(s);
|
|
236
|
+
e.length === 0 && (e = void 0);
|
|
237
237
|
}
|
|
238
238
|
return r.serialize({
|
|
239
|
-
...
|
|
239
|
+
...t,
|
|
240
240
|
type: "text",
|
|
241
241
|
multiple: !0,
|
|
242
|
-
defaultValue:
|
|
243
|
-
options: this.options ? this.options.map((
|
|
244
|
-
id:
|
|
245
|
-
label:
|
|
246
|
-
value: `${
|
|
247
|
-
condition:
|
|
242
|
+
defaultValue: e,
|
|
243
|
+
options: this.options ? this.options.map((s) => ({
|
|
244
|
+
id: s.id,
|
|
245
|
+
label: s.label,
|
|
246
|
+
value: `${s.value}`,
|
|
247
|
+
condition: s.condition
|
|
248
248
|
})) : null
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
251
|
return r.serialize({
|
|
252
|
-
...
|
|
252
|
+
...t,
|
|
253
253
|
type: "text",
|
|
254
254
|
multiple: !1,
|
|
255
255
|
defaultValue: n,
|
|
256
|
-
options: this.options ? this.options.map((
|
|
257
|
-
id:
|
|
258
|
-
label:
|
|
259
|
-
value: `${
|
|
260
|
-
condition:
|
|
256
|
+
options: this.options ? this.options.map((e) => ({
|
|
257
|
+
id: e.id,
|
|
258
|
+
label: e.label,
|
|
259
|
+
value: `${e.value}`,
|
|
260
|
+
condition: e.condition
|
|
261
261
|
})) : null
|
|
262
262
|
});
|
|
263
263
|
case "number":
|
|
264
264
|
if (this.multiple) {
|
|
265
|
-
let
|
|
265
|
+
let e;
|
|
266
266
|
if (Array.isArray(this.defaultValue)) {
|
|
267
|
-
|
|
268
|
-
for (const
|
|
269
|
-
typeof
|
|
270
|
-
|
|
267
|
+
e = [];
|
|
268
|
+
for (const s of this.defaultValue)
|
|
269
|
+
typeof s == "number" && e.push(s);
|
|
270
|
+
e.length === 0 && (e = void 0);
|
|
271
271
|
}
|
|
272
272
|
return r.serialize({
|
|
273
|
-
...
|
|
273
|
+
...t,
|
|
274
274
|
type: "number",
|
|
275
275
|
multiple: !0,
|
|
276
|
-
defaultValue:
|
|
277
|
-
options: this.options ? this.options.map((
|
|
278
|
-
id:
|
|
279
|
-
label:
|
|
280
|
-
value: Number(
|
|
281
|
-
condition:
|
|
276
|
+
defaultValue: e,
|
|
277
|
+
options: this.options ? this.options.map((s) => ({
|
|
278
|
+
id: s.id,
|
|
279
|
+
label: s.label,
|
|
280
|
+
value: Number(s.value),
|
|
281
|
+
condition: s.condition
|
|
282
282
|
})) : null
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
return r.serialize({
|
|
286
|
-
...
|
|
286
|
+
...t,
|
|
287
287
|
type: "number",
|
|
288
288
|
multiple: !1,
|
|
289
|
-
defaultValue:
|
|
290
|
-
options: this.options ? this.options.map((
|
|
291
|
-
id:
|
|
292
|
-
label:
|
|
293
|
-
value: Number(
|
|
294
|
-
condition:
|
|
289
|
+
defaultValue: d,
|
|
290
|
+
options: this.options ? this.options.map((e) => ({
|
|
291
|
+
id: e.id,
|
|
292
|
+
label: e.label,
|
|
293
|
+
value: Number(e.value),
|
|
294
|
+
condition: e.condition
|
|
295
295
|
})) : null
|
|
296
296
|
});
|
|
297
297
|
case "boolean":
|
|
298
298
|
if (this.multiple) {
|
|
299
|
-
let
|
|
299
|
+
let e;
|
|
300
300
|
if (Array.isArray(this.defaultValue)) {
|
|
301
|
-
|
|
302
|
-
for (const
|
|
303
|
-
typeof
|
|
304
|
-
|
|
301
|
+
e = [];
|
|
302
|
+
for (const s of this.defaultValue)
|
|
303
|
+
typeof s == "boolean" && e.push(s);
|
|
304
|
+
e.length === 0 && (e = void 0);
|
|
305
305
|
}
|
|
306
306
|
return r.serialize({
|
|
307
|
-
...
|
|
307
|
+
...t,
|
|
308
308
|
type: "boolean",
|
|
309
309
|
multiple: !0,
|
|
310
|
-
defaultValue:
|
|
311
|
-
options: this.options ? this.options.map((
|
|
312
|
-
id:
|
|
313
|
-
label:
|
|
314
|
-
value: !!
|
|
315
|
-
condition:
|
|
310
|
+
defaultValue: e,
|
|
311
|
+
options: this.options ? this.options.map((s) => ({
|
|
312
|
+
id: s.id,
|
|
313
|
+
label: s.label,
|
|
314
|
+
value: !!s.value,
|
|
315
|
+
condition: s.condition
|
|
316
316
|
})) : null
|
|
317
317
|
});
|
|
318
318
|
}
|
|
319
319
|
return r.serialize({
|
|
320
|
-
...
|
|
320
|
+
...t,
|
|
321
321
|
type: "boolean",
|
|
322
322
|
multiple: !1,
|
|
323
|
-
defaultValue:
|
|
324
|
-
options: this.options ? this.options.map((
|
|
325
|
-
id:
|
|
326
|
-
label:
|
|
327
|
-
value: !!
|
|
328
|
-
condition:
|
|
323
|
+
defaultValue: f,
|
|
324
|
+
options: this.options ? this.options.map((e) => ({
|
|
325
|
+
id: e.id,
|
|
326
|
+
label: e.label,
|
|
327
|
+
value: !!e.value,
|
|
328
|
+
condition: e.condition
|
|
329
329
|
})) : null
|
|
330
330
|
});
|
|
331
331
|
case "object":
|
|
332
332
|
return this.multiple ? r.serialize({
|
|
333
|
-
...
|
|
333
|
+
...t,
|
|
334
334
|
type: "object",
|
|
335
335
|
multiple: !0,
|
|
336
336
|
defaultValue: this.defaultValue,
|
|
337
|
-
options: this.options ? this.options.map((
|
|
338
|
-
id:
|
|
339
|
-
label:
|
|
340
|
-
description:
|
|
341
|
-
value:
|
|
342
|
-
condition:
|
|
337
|
+
options: this.options ? this.options.map((e) => ({
|
|
338
|
+
id: e.id,
|
|
339
|
+
label: e.label,
|
|
340
|
+
description: e.description,
|
|
341
|
+
value: e.value,
|
|
342
|
+
condition: e.condition
|
|
343
343
|
})) : null
|
|
344
344
|
}) : r.serialize({
|
|
345
|
-
...
|
|
345
|
+
...t,
|
|
346
346
|
type: "object",
|
|
347
347
|
multiple: !1,
|
|
348
348
|
defaultValue: this.defaultValue,
|
|
349
|
-
options: this.options ? this.options.map((
|
|
350
|
-
id:
|
|
351
|
-
label:
|
|
352
|
-
description:
|
|
353
|
-
value:
|
|
354
|
-
condition:
|
|
349
|
+
options: this.options ? this.options.map((e) => ({
|
|
350
|
+
id: e.id,
|
|
351
|
+
label: e.label,
|
|
352
|
+
description: e.description,
|
|
353
|
+
value: e.value,
|
|
354
|
+
condition: e.condition
|
|
355
355
|
})) : null
|
|
356
356
|
});
|
|
357
357
|
default:
|
|
358
358
|
throw new Error("Unsupported field type");
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
}),
|
|
362
|
-
const
|
|
361
|
+
}), x = (i) => {
|
|
362
|
+
const o = [], t = [], n = [], d = [], f = [];
|
|
363
363
|
return {
|
|
364
|
-
id:
|
|
365
|
-
component:
|
|
366
|
-
name:
|
|
367
|
-
initializeOpen:
|
|
368
|
-
condition:
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
nodes: s,
|
|
364
|
+
id: i.id,
|
|
365
|
+
component: i.component,
|
|
366
|
+
name: i.name,
|
|
367
|
+
initializeOpen: i.initializeOpen,
|
|
368
|
+
condition: i.condition,
|
|
369
|
+
targets: i.targets,
|
|
370
|
+
steps: o,
|
|
371
|
+
nodes: t,
|
|
373
372
|
edges: n,
|
|
374
|
-
fields:
|
|
375
|
-
conditionals:
|
|
376
|
-
addStep(
|
|
377
|
-
let l =
|
|
378
|
-
this.nodes.length === 0 && (l =
|
|
379
|
-
const a = "serialize" in
|
|
373
|
+
fields: f,
|
|
374
|
+
conditionals: d,
|
|
375
|
+
addStep(e, s) {
|
|
376
|
+
let l = s?.node;
|
|
377
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
378
|
+
const a = "serialize" in e ? e : y(e, this);
|
|
380
379
|
if (l) {
|
|
381
380
|
if (!a.node)
|
|
382
381
|
throw new Error("todo no node");
|
|
383
|
-
const
|
|
382
|
+
const u = c(
|
|
384
383
|
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
385
384
|
this
|
|
386
385
|
);
|
|
387
|
-
this.edges.push(
|
|
386
|
+
this.edges.push(u);
|
|
388
387
|
}
|
|
389
|
-
return a.fields.length > 0 && a.fields.forEach((
|
|
390
|
-
this.fields.includes(
|
|
388
|
+
return a.fields.length > 0 && a.fields.forEach((u) => {
|
|
389
|
+
this.fields.includes(u) || this.fields.push(u);
|
|
391
390
|
}), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
|
|
392
391
|
},
|
|
393
|
-
addAction(
|
|
394
|
-
let l =
|
|
395
|
-
this.nodes.length === 0 && (l =
|
|
396
|
-
const a = "serialize" in
|
|
392
|
+
addAction(e, s) {
|
|
393
|
+
let l = s?.node;
|
|
394
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
395
|
+
const a = "serialize" in e ? e : m(e, this);
|
|
397
396
|
if (l) {
|
|
398
|
-
const
|
|
397
|
+
const u = c(
|
|
399
398
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
400
399
|
this
|
|
401
400
|
);
|
|
402
|
-
this.edges.push(
|
|
401
|
+
this.edges.push(u);
|
|
403
402
|
}
|
|
404
403
|
return this.nodes.push(a), a;
|
|
405
404
|
},
|
|
406
|
-
addConditional(
|
|
407
|
-
let l =
|
|
408
|
-
this.nodes.length === 0 && (l =
|
|
409
|
-
const a = "serialize" in
|
|
405
|
+
addConditional(e, s) {
|
|
406
|
+
let l = s?.node;
|
|
407
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
408
|
+
const a = "serialize" in e ? e : z(e, this);
|
|
410
409
|
if (l) {
|
|
411
410
|
if (!a.node)
|
|
412
411
|
throw new Error("todo no node");
|
|
413
|
-
const
|
|
412
|
+
const u = c(
|
|
414
413
|
{ sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
|
|
415
414
|
this
|
|
416
415
|
);
|
|
417
|
-
this.edges.push(
|
|
416
|
+
this.edges.push(u);
|
|
418
417
|
}
|
|
419
418
|
return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
|
|
420
419
|
},
|
|
421
|
-
addExperience(
|
|
422
|
-
let l =
|
|
423
|
-
this.nodes.length === 0 && (l =
|
|
424
|
-
const a =
|
|
425
|
-
{ type: "experience", experience:
|
|
420
|
+
addExperience(e, s) {
|
|
421
|
+
let l = s?.node;
|
|
422
|
+
this.nodes.length === 0 && (l = h({ type: "origin" }, this), this.nodes.push(l));
|
|
423
|
+
const a = h(
|
|
424
|
+
{ type: "experience", experience: e },
|
|
426
425
|
this
|
|
427
426
|
);
|
|
428
427
|
if (this.nodes.push(a), l) {
|
|
429
|
-
const
|
|
428
|
+
const u = c(
|
|
430
429
|
{ sourceNode: l, destinationNode: a, sourceNodeHandle: null },
|
|
431
430
|
this
|
|
432
431
|
);
|
|
433
|
-
this.edges.push(
|
|
432
|
+
this.edges.push(u);
|
|
434
433
|
}
|
|
435
|
-
return
|
|
434
|
+
return e;
|
|
436
435
|
},
|
|
437
|
-
addField(
|
|
438
|
-
const l = "serialize" in
|
|
439
|
-
return
|
|
436
|
+
addField(e, s) {
|
|
437
|
+
const l = "serialize" in e ? e : N(e);
|
|
438
|
+
return s && s.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
|
|
440
439
|
},
|
|
441
440
|
serialize() {
|
|
442
441
|
return r.serialize({
|
|
@@ -444,27 +443,26 @@ const r = {
|
|
|
444
443
|
component: this.component,
|
|
445
444
|
name: this.name,
|
|
446
445
|
initializeOpen: this.initializeOpen,
|
|
447
|
-
condition: this.condition
|
|
448
|
-
decide: this.decide,
|
|
446
|
+
condition: this.condition,
|
|
449
447
|
targets: this.targets,
|
|
450
|
-
steps: this.steps.map((
|
|
451
|
-
nodes: this.nodes.map((
|
|
452
|
-
edges: this.edges.map((
|
|
448
|
+
steps: this.steps.map((e) => r.deserialize(e.serialize())),
|
|
449
|
+
nodes: this.nodes.map((e) => r.deserialize(e.serialize())),
|
|
450
|
+
edges: this.edges.map((e) => r.deserialize(e.serialize())),
|
|
453
451
|
conditionals: this.conditionals.map(
|
|
454
|
-
(
|
|
452
|
+
(e) => r.deserialize(e.serialize())
|
|
455
453
|
),
|
|
456
|
-
fields: this.fields.map((
|
|
454
|
+
fields: this.fields.map((e) => r.deserialize(e.serialize()))
|
|
457
455
|
});
|
|
458
456
|
}
|
|
459
457
|
};
|
|
460
458
|
};
|
|
461
459
|
export {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
460
|
+
z as createConditional,
|
|
461
|
+
c as createEdge,
|
|
462
|
+
x as createExperience,
|
|
463
|
+
b as createExperiencePlugin,
|
|
464
|
+
N as createField,
|
|
465
|
+
h as createNode,
|
|
466
|
+
v as createStep,
|
|
469
467
|
r as serialization
|
|
470
468
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as l } from "../../../api-
|
|
2
|
-
import { c as S } from "../../../api-
|
|
1
|
+
import { a as l } from "../../../api-DOhZIcQL.js";
|
|
2
|
+
import { c as S } from "../../../api-DOhZIcQL.js";
|
|
3
3
|
import { l as a } from "../../../logger-C9a75KZn.js";
|
|
4
4
|
function d(e) {
|
|
5
5
|
let r = 2166136261;
|
|
@@ -11,7 +11,7 @@ declare const createExperienceFactory: ({ client, experience }: {
|
|
|
11
11
|
id: string;
|
|
12
12
|
configStore: import('effector').Store<{
|
|
13
13
|
name: string;
|
|
14
|
-
decisionLogic:
|
|
14
|
+
decisionLogic: LogicValue | LogicRule;
|
|
15
15
|
targetSelectors: ExperienceTarget[];
|
|
16
16
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
17
17
|
}>;
|
|
@@ -62,7 +62,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
62
62
|
id: string;
|
|
63
63
|
configStore: import('effector').Store<{
|
|
64
64
|
name: string;
|
|
65
|
-
decisionLogic:
|
|
65
|
+
decisionLogic: LogicValue | LogicRule;
|
|
66
66
|
targetSelectors: ExperienceTarget[];
|
|
67
67
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
68
68
|
}>;
|
|
@@ -89,7 +89,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
89
89
|
id: string;
|
|
90
90
|
configStore: import('effector').Store<{
|
|
91
91
|
name: string;
|
|
92
|
-
decisionLogic:
|
|
92
|
+
decisionLogic: LogicValue | LogicRule;
|
|
93
93
|
targetSelectors: ExperienceTarget[];
|
|
94
94
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
95
95
|
}>;
|
|
@@ -126,7 +126,7 @@ declare const createExperienceIndexFactory: ({ client }: {
|
|
|
126
126
|
id: string;
|
|
127
127
|
configStore: import('effector').Store<{
|
|
128
128
|
name: string;
|
|
129
|
-
decisionLogic:
|
|
129
|
+
decisionLogic: LogicValue | LogicRule;
|
|
130
130
|
targetSelectors: ExperienceTarget[];
|
|
131
131
|
initializeOpenLogic: LogicValue | LogicRule;
|
|
132
132
|
}>;
|
|
@@ -217,8 +217,6 @@ export interface Experience {
|
|
|
217
217
|
initializeOpen?: LogicRule | LogicValue;
|
|
218
218
|
actions?: ExperienceAction[];
|
|
219
219
|
condition?: LogicRule | LogicValue;
|
|
220
|
-
/** @deprecated Use `condition` instead. This property will be removed in a future version. */
|
|
221
|
-
decide?: LogicRule;
|
|
222
220
|
edges: ExperienceEdge[];
|
|
223
221
|
nodes: ExperienceNode[];
|
|
224
222
|
fields: Field[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experience.d.ts","sourceRoot":"","sources":["../../../../src/entities/experience/experience.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3C,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAC3E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAIjE,QAAA,MAAM,uBAAuB,2BACF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;oBAIjB,OAAO,CAAC,UAAU,CAAC;kBAAY,UAAU;;CAuD5F,CAAA;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,EACtF,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAE5C;AAED,2CAA2C;AAC3C,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,iGAAiG;IACjG,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,2GAA2G;AAC3G,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,CAAA;AAEnF,QAAA,MAAM,4BAA4B,e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AAiB,oBAAoB,KACpC,IAEF,CAAA;AAED;;;;GAIG;AAEH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,MAAM,EACd,YAAY,eAAe,EAC3B,UAAU,uBAAuB,SAkBlC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAU,QAAQ,MAAM,kBASzD,CAAA;AAmBD,eAAO,MAAM,0BAA0B,GACrC,QAAQ,MAAM,EACd,YAAY,eAAe,KAC1B,OAAO,CAAC,OAAO,CAiCjB,CAAA"}
|
package/dist/types/picked.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare class Picked {
|
|
|
70
70
|
id: string;
|
|
71
71
|
configStore: import('effector').Store<{
|
|
72
72
|
name: string;
|
|
73
|
-
decisionLogic:
|
|
73
|
+
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
74
74
|
targetSelectors: import('.').ExperienceTarget[];
|
|
75
75
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
76
76
|
}>;
|
|
@@ -96,7 +96,7 @@ export declare class Picked {
|
|
|
96
96
|
id: string;
|
|
97
97
|
configStore: import('effector').Store<{
|
|
98
98
|
name: string;
|
|
99
|
-
decisionLogic:
|
|
99
|
+
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
100
100
|
targetSelectors: import('.').ExperienceTarget[];
|
|
101
101
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
102
102
|
}>;
|
|
@@ -130,7 +130,7 @@ export declare class Picked {
|
|
|
130
130
|
id: string;
|
|
131
131
|
configStore: import('effector').Store<{
|
|
132
132
|
name: string;
|
|
133
|
-
decisionLogic:
|
|
133
|
+
decisionLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
134
134
|
targetSelectors: import('.').ExperienceTarget[];
|
|
135
135
|
initializeOpenLogic: import('./logic-engine').LogicValue | LogicRule;
|
|
136
136
|
}>;
|
|
@@ -146,8 +146,6 @@ export interface SerializableExperience {
|
|
|
146
146
|
component?: AdaptedComponent;
|
|
147
147
|
name: string;
|
|
148
148
|
condition?: LogicRule | LogicValue;
|
|
149
|
-
/** @deprecated Use `condition` instead. This property will be removed in a future version. */
|
|
150
|
-
decide?: LogicRule;
|
|
151
149
|
initializeOpen?: LogicRule | LogicValue;
|
|
152
150
|
targets: ExperienceTarget[];
|
|
153
151
|
steps: SerializableStep[];
|
|
@@ -174,8 +172,6 @@ export interface CreateExperienceOptions {
|
|
|
174
172
|
id: string;
|
|
175
173
|
name: string;
|
|
176
174
|
condition?: LogicRule | LogicValue;
|
|
177
|
-
/** @deprecated Use `condition` instead. This property will be removed in a future version. */
|
|
178
|
-
decide?: LogicRule;
|
|
179
175
|
initializeOpen?: LogicRule | LogicValue;
|
|
180
176
|
targets: ExperienceTarget[];
|
|
181
177
|
component?: AdaptedComponent;
|
|
@@ -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,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEhE,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAiB,SAAQ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,EAAE;QACT,eAAe,CAAC,EAAE,OAAO,CAAA;QACzB,eAAe,CAAC,EAAE,OAAO,CAAA;KAC1B,CAAA;IACD,OAAO,EACH;QACE,EAAE,EAAE,MAAM,CAAA;QACV,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,KAAK,EAAE,SAAS,CAAA;QAChB,SAAS,CAAC,EAAE,SAAS,CAAA;KACtB,EAAE,GACH,IAAI,CAAA;IACR;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,CAAA;CAChB,GAAG;IACF,SAAS,EAAE,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;CACnC,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IAClC,
|
|
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,CAAA;AAC/D,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACV,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEhE,MAAM,WAAW,QAAQ;IACvB,IAAI,E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