@picked/client 0.0.1-dev.1773364848747 → 0.0.1-dev.1773368658489

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.
@@ -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-dev.1773364848747",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;
1
+ "use strict";const a="Picked-Client",d="Picked-Version";function s(e,t){return{[a]:e,[d]:t}}const o=()=>"0.0.1-dev.1773368658489",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;
@@ -5,7 +5,7 @@ function u(n, t) {
5
5
  [a]: t
6
6
  };
7
7
  }
8
- const d = () => "0.0.1-dev.1773364848747", E = "v1";
8
+ const d = () => "0.0.1-dev.1773368658489", E = "v1";
9
9
  function s(n, t) {
10
10
  return new URL(`/api/${E}/${t}`, n).toString();
11
11
  }
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-DQC5OMTN.cjs"),H=require("../id-BKIWbSTy.cjs"),G=require("../object-BbFTsGh3.cjs"),W=require("../to-kebab-case-BsOQ8CON.cjs"),k=require("../supports-YvpQZxbh.cjs"),L=g.createDomain("experience"),J=S.createFactory(({client:t,experience:e})=>{const r=L.store(e),s=g.createApi(r,{merge(u,m){return{...u,...m.experience}}}),n=r.map(u=>({name:u.name,decisionLogic:u.condition,targetSelectors:u.targets,initializeOpenLogic:e.initializeOpen})),p=t.components.listStore.map(u=>(e.componentName?u.find(m=>m.name===e.componentName):void 0)||u.find(m=>m.name===`experience:${e.id}`)||u.find(m=>m.name==="experience"),{skipVoid:!1}),o=r.map(u=>({steps:u.steps,nodes:u.nodes,edges:u.edges,conditionals:u.conditionals})),c=r.map(u=>u.fields),a=e.actions??[];return{id:e.id,configStore:n,treeStore:o,fieldsStore:c,componentStore:p,actions:a,merge:s.merge}});function Y(t){return S.invoke(J,t)}const Q=S.createFactory(({client:t})=>{const e=L.store({}),r=g.createApi(e,{register(a,u){return{...a,[u.id]:u}}});function s(a){const u=e.getState()[a.id];if(u){u.merge({experience:a,strategy:"override"});return}const m=Y({client:t,experience:a});r.register(m)}const n=e.map(a=>Object.values(a));function p(a){return e.map(u=>u[a],{skipVoid:!1})}const o=g.attach({source:e,effect:async(a,{id:u,options:m})=>{const b=a[u];if(!b){E.logger("warn",`Experience with id '${u}' not found.`);return}if(m?.bypassCondition){$(t,b,m);return}await V(t,b)&&$(t,b,m)}}),c=g.attach({source:t.experienceInstances.listStore,effect:(a,{id:u,options:m})=>{const b=a.filter(y=>y.experienceId===u);if(b.length>0)for(const y of b)y.open();else o({id:u,options:{...m,initialiseOpen:!0}})}});return{register:s,get:p,getById:p,launch:o,open:c,listStore:n}});function X(t){return S.invoke(Q,t)}const Z=(t,e)=>{e.register(t)},$=(t,e,r)=>{const{targetSelectors:s}=e.configStore.getState(),n=I.getTargetElements(s,e.id);n.forEach(({elements:o})=>o.forEach(c=>I.tagTargetElement(c,e.id))),I.createAppHosts(n,e.id).forEach(o=>{r?t.experienceInstances.spawn(e,o,r):t.experienceInstances.spawn(e,o)})},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},ee=(t,e,r)=>{const s=e.name,n=e.setup(t);if(n){const p=r[s]??{};r[s]=Object.freeze({...p,...n})}},te=g.createDomain("component"),re=S.createFactory(({client:t,component:e,name:r})=>{const s=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:s}});function se(t){return S.invoke(re,t)}const ne=S.createFactory(({client:t})=>{const e=te.store({}),r=g.createApi(e,{register(o,c){return{...o,[c.name]:c}}});function s(o,c){e.getState()[o]&&E.logger("warn",`Component '${o}' already registered. Registering again will override the previous registration.`);const u=se({client:t,name:o,component:c});r.register(u)}const n=e.map(o=>Object.values(o));function p(o){return e.map(c=>c[o],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ie(t){return S.invoke(ne,t)}const B=(t,e,r)=>{r.register(t,e)},oe=g.createDomain("framework"),ae=S.createFactory(({client:t})=>{const e=oe.store({}),r=g.createApi(e,{register(o,c){return{...o,[c.name]:c.framework}}});function s(o,c){e.getState()[o]&&E.logger("warn",`Framework '${o}' already registered. Registering again will override the previous registration.`),r.register({name:o,framework:c})}const n=e.map(o=>Object.values(o));function p(o){return e.map(c=>c[o],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ce(t){return S.invoke(ae,t)}const ue=(t,e)=>{e.register(t.name,t)},le=6e3,de=w.createStorageKey("last_ping","global"),pe=async t=>{try{const e=Date.now(),r=w.localStore.get(de);let s=0;if(r.isSet()&&(s=r.json()??0),s&&e-s<le)return!0;const n={projectId:t.projectId,path:window.location.pathname},p={},c=document.getElementById("picked_script")?.dataset.verceltoken;c&&(p["x-vercel-protection-bypass"]=c);const u=(await U.post(t.apiUrl,"ping",n,p)).ok;return u&&r.set(e),u}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 fe=g.createDomain("predicate"),ge=S.createFactory(({client:t})=>{const e=fe.store({}),r=g.createApi(e,{register(c,a){return{...c,[a.name]:{name:a.name,predicate:a.predicate}}}});function s(c,a){e.getState()[c]&&E.logger("warn",`Predicate '${c}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:c,predicate:a}))}const n=e.map(c=>Object.values(c));function p(c){return e.map(a=>a[c]?.predicate,{skipVoid:!1})}function o(c){const a=g.createStore(()=>{},{skipVoid:!1}),u=g.createEffect(async()=>{const m=p(c).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:u}),g.sample({clock:u.doneData,filter:m=>m!==void 0,target:a}),u(),a}return{register:s,getByName:p,listStore:n,getEvokablePredicate:o}});function me(t){return S.invoke(ge,t)}const ye=(t,e,r)=>{r.register(t,e)},D=g.createDomain("feature"),he=S.createFactory(({client:t})=>{const e=D.store({}),r=D.store([]),s=g.createApi(e,{register(i,l){return{...i,[l.id]:l.feature}}});function n(i,l){e.getState()[i]&&E.logger("warn",`Feature '${i}' already registered. Registering again will override the previous registration.`);const d={id:i,feature:{...l,id:i}};s.register(Object.freeze({id:i,feature:d}))}const p=g.createEffect(async({id:i,key:l,storage:f="local"})=>{const d=w.createStorageKey(`feature:${i}:${l}`,"global"),v=(f==="session"?w.sessionStore:w.localStore).get(d).boolean();return v===null?null:{id:i,key:l,bucket:v,storage:f}}),o=g.createEffect(i=>{if(!i)return null;const l=w.createStorageKey(`feature:${i.id}:${i.key}`,"global");(i.storage==="session"?w.sessionStore:w.localStore).set(l,i.bucket)}),c=new Map,a=g.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:i,resolvedFeaturesStore:l},{id:f,decide:d,key:h})=>{const v=l.find(P=>P.id===f&&P.key===h);if(v)return v;const x=i[f];if(!x)throw new Error(`Feature with id '${f}' not found`);const A=c.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();c.set(`${f}:${h}`,F);const q=await F;return{id:x.id,bucket:q,key:h,storage:x.feature.storage}}});g.sample({clock:s.register,fn:i=>{const{id:l,feature:f}=i;return{id:l,key:f.feature.key,storage:f.feature.storage}},target:p}),g.sample({source:e,clock:a.doneData,fn:(i,l)=>{const{id:f,bucket:d,storage:h}=l,v=i[f]?.feature.key;return v?{key:v,id:f,bucket:d,storage:h}:null},target:o});const u=g.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:i,resolvedFeaturesStore:l})=>Object.values(i).map(f=>{const d=l.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 a(f.feature),isResolved:!1}}));g.sample({clock:a.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:i},{id:l,key:f})=>!i.some(h=>h.id===l&&h.key===f),fn:(i,l)=>l,target:t.eventBus.prepend(i=>({type:"feature_decide",feature:i}))}),g.sample({clock:[p.doneData,a.doneData],source:r,fn:(i,l)=>!l||i.some(d=>d.id===l.id&&d.key===l.key)?i:[...i,l],target:r});function m(i){return u.map(l=>l.find(f=>f.id===i))}function b(i){return e.map(l=>l[i],{skipVoid:!1})}function y(i){const l=g.createStore(async()=>{},{skipVoid:!1}),f=g.createEffect(async()=>{const d=m(i).getState();if(d)return async()=>(await d.getBucket()).bucket});return g.sample({source:r,filter:d=>d.some(h=>h.id===i),target:f}),g.sample({clock:f.doneData,filter:d=>d!==void 0,target:l}),f(),l}return{register:n,getById:m,getByName:b,listStore:u,getEvokableFeature:y}});function Se(t){return S.invoke(he,t)}const ve=(t,e,r)=>{r.register(t,e)},j=g.createDomain("history");function O(t,e){return{id:H.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const ke=S.createFactory(()=>{const t=j.store({entries:[]}),e=j.event(),r=j.event(),s=j.event(),n=j.event();t.on(e,(o,c)=>({entries:[...o.entries,O(c.experienceId,c.node)]})),t.on(r,(o,c)=>({entries:[...o.entries.slice(0,-1),O(c.experienceId,c.node)]})),t.on(n,(o,c)=>c);function p(o,c){const a={lastStepIndex:-1,secondLastStepIndex:-1};for(let u=o.length-1;u>=0;u--){const m=o[u],b=m?.node;if(!(!b||!I.isStepNode(b))&&!(c&&m?.experienceId!==c))if(a.lastStepIndex===-1)a.lastStepIndex=u;else{a.secondLastStepIndex=u;break}}return a}return t.on(s,(o,c)=>{const{secondLastStepIndex:a}=p(o.entries,c.experienceId),u=a!==-1?o.entries.slice(0,a+1):o.entries;return{...o,entries:u}}),{push:e,replace:r,back:s,restore:n,entriesStore:t.map(o=>o.entries)}});function be(){return S.invoke(ke)}let we=0;const Ie=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},Fe=g.createDomain("field"),Ee=S.createFactory(()=>{const t=Fe.store({}),e=g.createApi(t,{register(a,u){return{...a,[u.resolvedKey]:{...u.field,key:u.resolvedKey}}}});function r(a){e.register({field:a,resolvedKey:a.key})}function s(a,u){const m=p(a).getState();if(!m)return;const b=Object.assign({},m,{...u});e.register({field:{...b},resolvedKey:a})}const n=t.map(a=>Object.values(a));function p(a){return t.map(u=>u[a]||null)}function o(a){return t.map(u=>Object.values(u).find(m=>m.id===a)||null)}function c(a){return t.map(u=>Object.values(u).find(m=>m.name===a)||null)}return{register:r,update:s,getByKey:p,getById:o,listStore:n,getByName:c}});function xe(){return S.invoke(Ee)}const je=(t,e)=>{e.register(t)},Ae=g.createDomain("action"),Pe=S.createFactory(()=>{const t=Ae.store({}),e=g.createApi(t,{register(o,c){return{...o,[c.name]:{name:c.name,action:c.action}}}});function r(o,c){e.register({name:o,action:c})}const s=t.map(o=>Object.values(o));function n(o){return t.map(c=>c[o],{skipVoid:!1})}function p(o){return t.map(c=>{const a=c[o];return a?a.action:void 0},{skipVoid:!1})}return{register:r,getByName:n,listStore:s,getEvokableAction:p}});function Re(){return S.invoke(Pe)}const Ce=(t,e,r)=>{r.register(t,e)};function C(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function $e(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 ze=g.createDomain("response"),Be=S.createFactory(({client:t})=>{const e=ze.store({}),r=g.createEvent(),s=g.createEvent(),n=g.createApi(e,{register(y,i){return{...y,[i.fieldId]:i.response}},registerBatch(y,i){return{...y,...i}},clear(y,i){const{[i]:l,...f}=y;return f},clearAll(){return{}}});function p(y,i){if(typeof y=="string"){if(i===void 0)throw new Error("Response is required when registering a single field");n.register({fieldId:y,response:i})}else n.registerBatch(y)}async function o(y){const i=[];return await Promise.allSettled(Object.entries(y).map(async([l,f])=>{let d=f;const h=t.fields.getByKey(l).getState();if(!h){i.push({fieldId:l,userMessage:`Field '${l}' not found`,systemMessage:`No field with ID '${l}' 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"){i.push({fieldId:l,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:d});return}if(v===!1){i.push({fieldId:l,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:d});return}}if(h.required&&C(d)){i.push({fieldId:l,userMessage:"This field is required",systemMessage:"Field is required.",value:d});return}if(!h.multiple&&Array.isArray(d)&&d.length>1){i.push({fieldId:l,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)){i.push({fieldId:l,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){i.push({fieldId:l,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:d});return}if(!M(v)){i.push({fieldId:l,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)){i.push({fieldId:l,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){i.push({fieldId:l,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:d});return}if(!M(d)){i.push({fieldId:l,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)))||i.push({fieldId:l,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=>!$e(F)||F===null?!1:x.includes(F))||i.push({fieldId:l,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:d})}}})),{responsesToCommit:y,validationErrors:i}}async function c(y){const{responsesToCommit:i,validationErrors:l}=await o(y);return l.length?{errors:l}:(n.registerBatch(i),{errors:[]})}const a=e.map(y=>y),u=e.map(y=>Object.keys(y).map(l=>({fieldId:l,value:y[l]})));function m(y){const i=t.fields.getByKey(y),l=e.map(f=>f[y]||null);return g.combine({f:i,r:l},({f,r:d})=>d||(f?.defaultValue?f.defaultValue:null))}function b(y){const i=t.fields.getByName(y);return g.combine({f:i,s:e},({f:l,s:f})=>{const d=l&&f[l.key??W.toKebabCase(l.name)]||null;return d||(l?.defaultValue?l.defaultValue:null)})}return g.sample({clock:r,target:n.clearAll}),g.sample({clock:s,target:n.clear}),{register:p,clearAll:r,clear:s,commit:c,getResponsesToCommit:o,listStore:u,getAllStore:a,getByFieldId:m,getByFieldName:b}});function De(t){return S.invoke(Be,t)}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[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 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 Le=w.createStorageKey("session","global"),Ve=()=>{const t=w.localStore.get(Le);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??Ue(),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},Ne=()=>k.supportsLocalStorage()?Ve():null;function T(){if(k.supportsWindow())return globalThis.window.pickedConfig}function Te(){if(!k.supportsWindow())return;const t=T(),e=t?.organizationId,r=t?.projectId;return e&&r?{organizationId:e,projectId:r}:void 0}function Ke(){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=Te();if(s)return s;const n=Ke();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-ClqvxrZP.cjs"),H=require("../id-BKIWbSTy.cjs"),G=require("../object-BbFTsGh3.cjs"),W=require("../to-kebab-case-BsOQ8CON.cjs"),k=require("../supports-YvpQZxbh.cjs"),L=g.createDomain("experience"),J=S.createFactory(({client:t,experience:e})=>{const r=L.store(e),s=g.createApi(r,{merge(u,m){return{...u,...m.experience}}}),n=r.map(u=>({name:u.name,decisionLogic:u.condition,targetSelectors:u.targets,initializeOpenLogic:e.initializeOpen})),p=t.components.listStore.map(u=>(e.componentName?u.find(m=>m.name===e.componentName):void 0)||u.find(m=>m.name===`experience:${e.id}`)||u.find(m=>m.name==="experience"),{skipVoid:!1}),o=r.map(u=>({steps:u.steps,nodes:u.nodes,edges:u.edges,conditionals:u.conditionals})),c=r.map(u=>u.fields),a=e.actions??[];return{id:e.id,configStore:n,treeStore:o,fieldsStore:c,componentStore:p,actions:a,merge:s.merge}});function Y(t){return S.invoke(J,t)}const Q=S.createFactory(({client:t})=>{const e=L.store({}),r=g.createApi(e,{register(a,u){return{...a,[u.id]:u}}});function s(a){const u=e.getState()[a.id];if(u){u.merge({experience:a,strategy:"override"});return}const m=Y({client:t,experience:a});r.register(m)}const n=e.map(a=>Object.values(a));function p(a){return e.map(u=>u[a],{skipVoid:!1})}const o=g.attach({source:e,effect:async(a,{id:u,options:m})=>{const b=a[u];if(!b){E.logger("warn",`Experience with id '${u}' not found.`);return}if(m?.bypassCondition){$(t,b,m);return}await V(t,b)&&$(t,b,m)}}),c=g.attach({source:t.experienceInstances.listStore,effect:(a,{id:u,options:m})=>{const b=a.filter(y=>y.experienceId===u);if(b.length>0)for(const y of b)y.open();else o({id:u,options:{...m,initialiseOpen:!0}})}});return{register:s,get:p,getById:p,launch:o,open:c,listStore:n}});function X(t){return S.invoke(Q,t)}const Z=(t,e)=>{e.register(t)},$=(t,e,r)=>{const{targetSelectors:s}=e.configStore.getState(),n=I.getTargetElements(s,e.id);n.forEach(({elements:o})=>o.forEach(c=>I.tagTargetElement(c,e.id))),I.createAppHosts(n,e.id).forEach(o=>{r?t.experienceInstances.spawn(e,o,r):t.experienceInstances.spawn(e,o)})},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},ee=(t,e,r)=>{const s=e.name,n=e.setup(t);if(n){const p=r[s]??{};r[s]=Object.freeze({...p,...n})}},te=g.createDomain("component"),re=S.createFactory(({client:t,component:e,name:r})=>{const s=t.frameworks.getByName(e.frameworkName);return{name:r,component:e,frameworkStore:s}});function se(t){return S.invoke(re,t)}const ne=S.createFactory(({client:t})=>{const e=te.store({}),r=g.createApi(e,{register(o,c){return{...o,[c.name]:c}}});function s(o,c){e.getState()[o]&&E.logger("warn",`Component '${o}' already registered. Registering again will override the previous registration.`);const u=se({client:t,name:o,component:c});r.register(u)}const n=e.map(o=>Object.values(o));function p(o){return e.map(c=>c[o],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ie(t){return S.invoke(ne,t)}const B=(t,e,r)=>{r.register(t,e)},oe=g.createDomain("framework"),ae=S.createFactory(({client:t})=>{const e=oe.store({}),r=g.createApi(e,{register(o,c){return{...o,[c.name]:c.framework}}});function s(o,c){e.getState()[o]&&E.logger("warn",`Framework '${o}' already registered. Registering again will override the previous registration.`),r.register({name:o,framework:c})}const n=e.map(o=>Object.values(o));function p(o){return e.map(c=>c[o],{skipVoid:!1})}return{register:s,getByName:p,listStore:n}});function ce(t){return S.invoke(ae,t)}const ue=(t,e)=>{e.register(t.name,t)},le=6e3,de=w.createStorageKey("last_ping","global"),pe=async t=>{try{const e=Date.now(),r=w.localStore.get(de);let s=0;if(r.isSet()&&(s=r.json()??0),s&&e-s<le)return!0;const n={projectId:t.projectId,path:window.location.pathname},p={},c=document.getElementById("picked_script")?.dataset.verceltoken;c&&(p["x-vercel-protection-bypass"]=c);const u=(await U.post(t.apiUrl,"ping",n,p)).ok;return u&&r.set(e),u}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 fe=g.createDomain("predicate"),ge=S.createFactory(({client:t})=>{const e=fe.store({}),r=g.createApi(e,{register(c,a){return{...c,[a.name]:{name:a.name,predicate:a.predicate}}}});function s(c,a){e.getState()[c]&&E.logger("warn",`Predicate '${c}' already registered. Registering again will override the previous registration.`),r.register(Object.freeze({name:c,predicate:a}))}const n=e.map(c=>Object.values(c));function p(c){return e.map(a=>a[c]?.predicate,{skipVoid:!1})}function o(c){const a=g.createStore(()=>{},{skipVoid:!1}),u=g.createEffect(async()=>{const m=p(c).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:u}),g.sample({clock:u.doneData,filter:m=>m!==void 0,target:a}),u(),a}return{register:s,getByName:p,listStore:n,getEvokablePredicate:o}});function me(t){return S.invoke(ge,t)}const ye=(t,e,r)=>{r.register(t,e)},D=g.createDomain("feature"),he=S.createFactory(({client:t})=>{const e=D.store({}),r=D.store([]),s=g.createApi(e,{register(i,l){return{...i,[l.id]:l.feature}}});function n(i,l){e.getState()[i]&&E.logger("warn",`Feature '${i}' already registered. Registering again will override the previous registration.`);const d={id:i,feature:{...l,id:i}};s.register(Object.freeze({id:i,feature:d}))}const p=g.createEffect(async({id:i,key:l,storage:f="local"})=>{const d=w.createStorageKey(`feature:${i}:${l}`,"global"),v=(f==="session"?w.sessionStore:w.localStore).get(d).boolean();return v===null?null:{id:i,key:l,bucket:v,storage:f}}),o=g.createEffect(i=>{if(!i)return null;const l=w.createStorageKey(`feature:${i.id}:${i.key}`,"global");(i.storage==="session"?w.sessionStore:w.localStore).set(l,i.bucket)}),c=new Map,a=g.attach({source:{allFeaturesStore:e,resolvedFeaturesStore:r},effect:async({allFeaturesStore:i,resolvedFeaturesStore:l},{id:f,decide:d,key:h})=>{const v=l.find(P=>P.id===f&&P.key===h);if(v)return v;const x=i[f];if(!x)throw new Error(`Feature with id '${f}' not found`);const A=c.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();c.set(`${f}:${h}`,F);const q=await F;return{id:x.id,bucket:q,key:h,storage:x.feature.storage}}});g.sample({clock:s.register,fn:i=>{const{id:l,feature:f}=i;return{id:l,key:f.feature.key,storage:f.feature.storage}},target:p}),g.sample({source:e,clock:a.doneData,fn:(i,l)=>{const{id:f,bucket:d,storage:h}=l,v=i[f]?.feature.key;return v?{key:v,id:f,bucket:d,storage:h}:null},target:o});const u=g.combine({allFeaturesStore:e,resolvedFeaturesStore:r}).map(({allFeaturesStore:i,resolvedFeaturesStore:l})=>Object.values(i).map(f=>{const d=l.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 a(f.feature),isResolved:!1}}));g.sample({clock:a.doneData,source:{resolvedFeatures:r},filter:({resolvedFeatures:i},{id:l,key:f})=>!i.some(h=>h.id===l&&h.key===f),fn:(i,l)=>l,target:t.eventBus.prepend(i=>({type:"feature_decide",feature:i}))}),g.sample({clock:[p.doneData,a.doneData],source:r,fn:(i,l)=>!l||i.some(d=>d.id===l.id&&d.key===l.key)?i:[...i,l],target:r});function m(i){return u.map(l=>l.find(f=>f.id===i))}function b(i){return e.map(l=>l[i],{skipVoid:!1})}function y(i){const l=g.createStore(async()=>{},{skipVoid:!1}),f=g.createEffect(async()=>{const d=m(i).getState();if(d)return async()=>(await d.getBucket()).bucket});return g.sample({source:r,filter:d=>d.some(h=>h.id===i),target:f}),g.sample({clock:f.doneData,filter:d=>d!==void 0,target:l}),f(),l}return{register:n,getById:m,getByName:b,listStore:u,getEvokableFeature:y}});function Se(t){return S.invoke(he,t)}const ve=(t,e,r)=>{r.register(t,e)},j=g.createDomain("history");function O(t,e){return{id:H.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const ke=S.createFactory(()=>{const t=j.store({entries:[]}),e=j.event(),r=j.event(),s=j.event(),n=j.event();t.on(e,(o,c)=>({entries:[...o.entries,O(c.experienceId,c.node)]})),t.on(r,(o,c)=>({entries:[...o.entries.slice(0,-1),O(c.experienceId,c.node)]})),t.on(n,(o,c)=>c);function p(o,c){const a={lastStepIndex:-1,secondLastStepIndex:-1};for(let u=o.length-1;u>=0;u--){const m=o[u],b=m?.node;if(!(!b||!I.isStepNode(b))&&!(c&&m?.experienceId!==c))if(a.lastStepIndex===-1)a.lastStepIndex=u;else{a.secondLastStepIndex=u;break}}return a}return t.on(s,(o,c)=>{const{secondLastStepIndex:a}=p(o.entries,c.experienceId),u=a!==-1?o.entries.slice(0,a+1):o.entries;return{...o,entries:u}}),{push:e,replace:r,back:s,restore:n,entriesStore:t.map(o=>o.entries)}});function be(){return S.invoke(ke)}let we=0;const Ie=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},Fe=g.createDomain("field"),Ee=S.createFactory(()=>{const t=Fe.store({}),e=g.createApi(t,{register(a,u){return{...a,[u.resolvedKey]:{...u.field,key:u.resolvedKey}}}});function r(a){e.register({field:a,resolvedKey:a.key})}function s(a,u){const m=p(a).getState();if(!m)return;const b=Object.assign({},m,{...u});e.register({field:{...b},resolvedKey:a})}const n=t.map(a=>Object.values(a));function p(a){return t.map(u=>u[a]||null)}function o(a){return t.map(u=>Object.values(u).find(m=>m.id===a)||null)}function c(a){return t.map(u=>Object.values(u).find(m=>m.name===a)||null)}return{register:r,update:s,getByKey:p,getById:o,listStore:n,getByName:c}});function xe(){return S.invoke(Ee)}const je=(t,e)=>{e.register(t)},Ae=g.createDomain("action"),Pe=S.createFactory(()=>{const t=Ae.store({}),e=g.createApi(t,{register(o,c){return{...o,[c.name]:{name:c.name,action:c.action}}}});function r(o,c){e.register({name:o,action:c})}const s=t.map(o=>Object.values(o));function n(o){return t.map(c=>c[o],{skipVoid:!1})}function p(o){return t.map(c=>{const a=c[o];return a?a.action:void 0},{skipVoid:!1})}return{register:r,getByName:n,listStore:s,getEvokableAction:p}});function Re(){return S.invoke(Pe)}const Ce=(t,e,r)=>{r.register(t,e)};function C(t){return typeof t>"u"||t===null||t===""||Array.isArray(t)&&!t.length}function $e(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 ze=g.createDomain("response"),Be=S.createFactory(({client:t})=>{const e=ze.store({}),r=g.createEvent(),s=g.createEvent(),n=g.createApi(e,{register(y,i){return{...y,[i.fieldId]:i.response}},registerBatch(y,i){return{...y,...i}},clear(y,i){const{[i]:l,...f}=y;return f},clearAll(){return{}}});function p(y,i){if(typeof y=="string"){if(i===void 0)throw new Error("Response is required when registering a single field");n.register({fieldId:y,response:i})}else n.registerBatch(y)}async function o(y){const i=[];return await Promise.allSettled(Object.entries(y).map(async([l,f])=>{let d=f;const h=t.fields.getByKey(l).getState();if(!h){i.push({fieldId:l,userMessage:`Field '${l}' not found`,systemMessage:`No field with ID '${l}' 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"){i.push({fieldId:l,userMessage:v,systemMessage:`Field validation resulted in an error: ${v}.`,value:d});return}if(v===!1){i.push({fieldId:l,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:d});return}}if(h.required&&C(d)){i.push({fieldId:l,userMessage:"This field is required",systemMessage:"Field is required.",value:d});return}if(!h.multiple&&Array.isArray(d)&&d.length>1){i.push({fieldId:l,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)){i.push({fieldId:l,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){i.push({fieldId:l,userMessage:"This field expects object values",systemMessage:"Field expects an array of objects, but received non-object value.",value:d});return}if(!M(v)){i.push({fieldId:l,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)){i.push({fieldId:l,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){i.push({fieldId:l,userMessage:"This field expects an object value",systemMessage:"Field expects an object value.",value:d});return}if(!M(d)){i.push({fieldId:l,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)))||i.push({fieldId:l,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=>!$e(F)||F===null?!1:x.includes(F))||i.push({fieldId:l,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${x.join(", ")}`,value:d})}}})),{responsesToCommit:y,validationErrors:i}}async function c(y){const{responsesToCommit:i,validationErrors:l}=await o(y);return l.length?{errors:l}:(n.registerBatch(i),{errors:[]})}const a=e.map(y=>y),u=e.map(y=>Object.keys(y).map(l=>({fieldId:l,value:y[l]})));function m(y){const i=t.fields.getByKey(y),l=e.map(f=>f[y]||null);return g.combine({f:i,r:l},({f,r:d})=>d||(f?.defaultValue?f.defaultValue:null))}function b(y){const i=t.fields.getByName(y);return g.combine({f:i,s:e},({f:l,s:f})=>{const d=l&&f[l.key??W.toKebabCase(l.name)]||null;return d||(l?.defaultValue?l.defaultValue:null)})}return g.sample({clock:r,target:n.clearAll}),g.sample({clock:s,target:n.clear}),{register:p,clearAll:r,clear:s,commit:c,getResponsesToCommit:o,listStore:u,getAllStore:a,getByFieldId:m,getByFieldName:b}});function De(t){return S.invoke(Be,t)}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[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 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 Le=w.createStorageKey("session","global"),Ve=()=>{const t=w.localStore.get(Le);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??Ue(),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},Ne=()=>k.supportsLocalStorage()?Ve():null;function T(){if(k.supportsWindow())return globalThis.window.pickedConfig}function Te(){if(!k.supportsWindow())return;const t=T(),e=t?.organizationId,r=t?.projectId;return e&&r?{organizationId:e,projectId:r}:void 0}function Ke(){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=Te();if(s)return s;const n=Ke();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 Ge(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 We(t,e){const r=t.split("|").map(p=>p.trim()),s=r.shift()??"";let n=Ge(s,e);for(const p of r){const[o,...c]=p.split(":"),a=o?.trim()??"",u=c.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g,""),m=qe[a];m&&(n=m(n,u))}return R(n)?"":typeof n=="object"?JSON.stringify(n):String(n)}function Je(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+=We(n.trim(),e)}else r+=t[s++];return r}class K{static logger=E.logger;options;isReady=!1;project;plugins={};pluginStartHooks=[];eventBus=g.createEvent();events;organizationId;projectId;apiUrl;dashboardUrl;documentationSiteUrl;session;precondition;condition;preconditionPassed;searchParams=Me();history=be();components=ie({client:this});experienceInstances=I.createExperienceInstanceIndex({client:this});experiences=X({client:this});frameworks=ce({client:this});predicates=me({client:this});features=Se({client:this});responses=De({client:this});fields=xe();actions=Re();constructor(e){E.logger("info","Picked client initializing."),this.events=Ie(this.eventBus);const{organizationId:r,projectId:s}=_e(e);this.organizationId=r,this.projectId=s,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=Ne(),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=()=>{pe(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:o,identifiers:c}=this.session;this.eventBus({type:"session",id:p,isUser:o,identifiers:c})}})()};registerFramework=e=>{ue(e,this.frameworks)};registerComponent=(e,r)=>{B(e,r,this.components)};registerPlugin=e=>{ee(this,e,this.plugins);const r=this.plugins[e.name];r?.onStart&&this.pluginStartHooks.push(r.onStart)};registerFeature=(e,r)=>{ve(e,r,this.features)};registerPredicate=(e,r)=>{ye(e,r,this.predicates)};registerField=e=>{je(e,this.fields)};registerAction=(e,r)=>{Ce(e,r,this.actions)};registerExperience=e=>{e.component&&B(`experience:${e.id}`,e.component,this.components),Z(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 Je(e,{...r,responses:s})}}function _(t){return t.options?.some(e=>"condition"in e)??!1}function Ye(t){return t.some(e=>e.condition||_(e))}async function Qe(t,e){return e.length===0||!Ye(e)?e:(await Promise.all(e.map(async s=>{if(!(s.condition?await I.evaluateRuleLogic(t,s.condition):!0))return null;if(!s.options||!_(s))return s;const o=(await Promise.all(s.options.map(async a=>a.condition?await I.evaluateRuleLogic(t,a.condition)?a:null:a))).filter(a=>a!==null);return o.length===s.options.length?s:o.length===0?null:{...s,options:o}}))).filter(s=>s!==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 K(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=K;exports.createClient=et;exports.getPickedConfig=T;exports.getStepFields=Qe;exports.isLazyLoader=Ze;exports.lazyComponent=Xe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../../../id-BKIWbSTy.cjs"),m=require("../../../to-kebab-case-BsOQ8CON.cjs"),r={serialize(i){return JSON.stringify(i)},deserialize(i){return JSON.parse(i)}},N=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)})})}}),z=(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})}}),b=i=>({id:i.id??p.generateId("step"),key:i.key??m.toKebabCase(i.name),name:i.name,fields:i.fields??[],addField(d){const t="serialize"in d?d:y(d);return this.fields.includes(t)||this.fields.push(t),t}}),v=(i,d)=>{const t={id:i.id??p.generateId("step"),key:i.key??m.toKebabCase(i.name),name:i.name,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,key:m.toKebabCase(this.name),name:this.name,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,name:this.connectedStep.name})}};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})}}),g=(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},y=i=>({id:i.id??p.generateId("field"),key:i.key??m.toKebabCase(i.name),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,key:this.key,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")}}}),x=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 a=n?.node;this.nodes.length===0&&(a=h({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:v(e,this);if(a){if(!l.node)throw new Error("todo no node");const u=c({sourceNode:a,destinationNode:l.node,sourceNodeHandle:null},this);this.edges.push(u)}return l.fields.length>0&&l.fields.forEach(u=>{this.fields.includes(u)||this.fields.push(u)}),this.steps.includes(l)||(this.steps.push(l),l.node&&this.nodes.push(l.node)),l},addAction(e,n){let a=n?.node;this.nodes.length===0&&(a=h({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:z(e,this);if(a){const u=c({sourceNode:a,destinationNode:l,sourceNodeHandle:null},this);this.edges.push(u)}return this.nodes.push(l),l},addConditional(e,n){let a=n?.node;this.nodes.length===0&&(a=h({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:g(e,this);if(a){if(!l.node)throw new Error("todo no node");const u=c({sourceNode:a,destinationNode:l.node,sourceNodeHandle:null},this);this.edges.push(u)}return this.conditionals.includes(l)||(this.conditionals.push(l),l.node&&this.nodes.push(l.node)),l},addExperience(e,n){let a=n?.node;this.nodes.length===0&&(a=h({type:"origin"},this),this.nodes.push(a));const l=h({type:"experience",experience:e},this);if(this.nodes.push(l),a){const u=c({sourceNode:a,destinationNode:l,sourceNodeHandle:null},this);this.edges.push(u)}return e},addField(e,n){const a="serialize"in e?e:y(e);return n&&n.fields.push(a),this.fields.includes(a)||this.fields.push(a),a},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=g;exports.createEdge=c;exports.createExperience=x;exports.createExperiencePlugin=N;exports.createField=y;exports.createNode=h;exports.createStep=b;exports.serialization=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../id-BKIWbSTy.cjs"),m=require("../../../to-kebab-case-BsOQ8CON.cjs"),r={serialize(i){return JSON.stringify(i)},deserialize(i){return JSON.parse(i)}},N=i=>({name:"create-experience",setup:o=>{i.experiences.forEach(n=>{const d=n.serialize(),s=r.deserialize(d);s.component=n.component,o.registerExperience(s),s.fields.forEach(u=>{o.registerField(u)})})}}),b=(i,o)=>({id:f.generateId("node"),experience:o,type:"action",action:i.action,addNext(d){if(!d.node)throw new Error("Cannot connect to node");const s=h({sourceNode:this,destinationNode:d.node,sourceNodeHandle:null},o);o.edges.push(s)},onSuccess(d){if(!d.node)throw new Error("Cannot connect to node");const s=h({sourceNode:this,destinationNode:d.node,sourceNodeHandle:"true"},o);o.edges.push(s)},onFail(d){if(!d.node)throw new Error("Cannot connect to node");const s=h({sourceNode:this,destinationNode:d.node,sourceNodeHandle:"false"},o);o.edges.push(s)},serialize(){return r.serialize({id:this.id,type:this.type,action:this.action})}}),z=i=>{const o=i.name??i.label??"";return{id:i.id??f.generateId("step"),key:i.key??m.toKebabCase(o),name:o,fields:i.fields??[],addField(n){const d="serialize"in n?n:y(n);return this.fields.includes(d)||this.fields.push(d),d}}},v=(i,o)=>{const n="label"in i?i.label:void 0,d=i.name??n??"",s={id:i.id??f.generateId("step"),key:i.key??m.toKebabCase(d),name:d,experience:o,fields:i.fields??[],node:null,nextStep(u){return this.experience.addStep(u,this)},nextConditional(u){return this.experience.addConditional(u,this)},addNextExperience(u){return this.experience.addExperience(u,this)},addField(u){return this.experience.addField(u,this)},serialize(){return r.serialize({id:this.id,key:m.toKebabCase(this.name),name:this.name,fieldIds:this.fields.map(u=>u.id)})}};return p({step:s,type:"step"},o),s},p=(i,o)=>{const n={id:f.generateId("node"),experience:o};if(i.type==="step"){const s={...n,type:"step",connectedStep:i.step,serialize(){return r.serialize({id:this.id,type:this.type,stepId:this.connectedStep.id,name:this.connectedStep.name})}};return s.connectedStep.node=s,s}if(i.type==="conditional"){const s={...n,type:"conditional",connectedConditional:i.conditional,serialize(){return r.serialize({id:this.id,type:this.type,conditionalId:this.connectedConditional.id})}};return s.connectedConditional.node=s,s}return i.type==="experience"?{...n,type:"experience",connectedExperience:i.experience,serialize(){return r.serialize({id:this.id,type:this.type,experienceId:this.connectedExperience.id})}}:{...n,type:"origin",serialize(){return r.serialize({id:this.id,type:this.type})}}},h=(i,o)=>({id:f.generateId("edge"),sourceNode:i.sourceNode,sourceNodeHandle:i.sourceNodeHandle,destinationNode:i.destinationNode,experience:o,serialize(){return r.serialize({id:this.id,sourceNodeHandle:this.sourceNodeHandle??void 0,sourceNodeId:this.sourceNode.id,destinationNodeId:this.destinationNode.id})}}),g=(i,o)=>{const n={id:f.generateId("conditional"),label:i.label,condition:i.condition,node:null,experience:o,addTrue(d){if(!this.node||!d.node)throw new Error("todo no node");const s=h({sourceNode:this.node,destinationNode:d.node,sourceNodeHandle:"true"},this.experience);this.experience.edges.push(s)},addFalse(d){if(!this.node||!d.node)throw new Error("todo no node");const s=h({sourceNode:this.node,destinationNode:d.node,sourceNodeHandle:"false"},this.experience);this.experience.edges.push(s)},serialize(){return r.serialize({id:this.id,label:this.label,condition:this.condition})}};return p({conditional:n,type:"conditional"},o),n},y=i=>({id:i.id??f.generateId("field"),key:i.key??m.toKebabCase(i.name),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(n=>({id:"id"in n?n.id:f.generateId("option"),...n}))??null,policies:i.policies,serialize(){const n={id:this.id,key:this.key,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},d=typeof this.defaultValue=="string"?this.defaultValue:void 0,s=typeof this.defaultValue=="number"?this.defaultValue:void 0,u=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 t of this.defaultValue)typeof t=="string"&&e.push(t);e.length===0&&(e=void 0)}return r.serialize({...n,type:"text",multiple:!0,defaultValue:e,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:`${t.value}`,condition:t.condition})):null})}return r.serialize({...n,type:"text",multiple:!1,defaultValue:d,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 t of this.defaultValue)typeof t=="number"&&e.push(t);e.length===0&&(e=void 0)}return r.serialize({...n,type:"number",multiple:!0,defaultValue:e,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:Number(t.value),condition:t.condition})):null})}return r.serialize({...n,type:"number",multiple:!1,defaultValue:s,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 t of this.defaultValue)typeof t=="boolean"&&e.push(t);e.length===0&&(e=void 0)}return r.serialize({...n,type:"boolean",multiple:!0,defaultValue:e,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:!!t.value,condition:t.condition})):null})}return r.serialize({...n,type:"boolean",multiple:!1,defaultValue:u,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({...n,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({...n,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")}}}),x=i=>{const o=[],n=[],d=[],s=[],u=[];return{id:i.id,component:i.component,name:i.name,initializeOpen:i.initializeOpen,condition:i.condition,targets:i.targets,steps:o,nodes:n,edges:d,fields:u,conditionals:s,addStep(e,t){let a=t?.node;this.nodes.length===0&&(a=p({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:v(e,this);if(a){if(!l.node)throw new Error("todo no node");const c=h({sourceNode:a,destinationNode:l.node,sourceNodeHandle:null},this);this.edges.push(c)}return l.fields.length>0&&l.fields.forEach(c=>{this.fields.includes(c)||this.fields.push(c)}),this.steps.includes(l)||(this.steps.push(l),l.node&&this.nodes.push(l.node)),l},addAction(e,t){let a=t?.node;this.nodes.length===0&&(a=p({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:b(e,this);if(a){const c=h({sourceNode:a,destinationNode:l,sourceNodeHandle:null},this);this.edges.push(c)}return this.nodes.push(l),l},addConditional(e,t){let a=t?.node;this.nodes.length===0&&(a=p({type:"origin"},this),this.nodes.push(a));const l="serialize"in e?e:g(e,this);if(a){if(!l.node)throw new Error("todo no node");const c=h({sourceNode:a,destinationNode:l.node,sourceNodeHandle:null},this);this.edges.push(c)}return this.conditionals.includes(l)||(this.conditionals.push(l),l.node&&this.nodes.push(l.node)),l},addExperience(e,t){let a=t?.node;this.nodes.length===0&&(a=p({type:"origin"},this),this.nodes.push(a));const l=p({type:"experience",experience:e},this);if(this.nodes.push(l),a){const c=h({sourceNode:a,destinationNode:l,sourceNodeHandle:null},this);this.edges.push(c)}return e},addField(e,t){const a="serialize"in e?e:y(e);return t&&t.fields.push(a),this.fields.includes(a)||this.fields.push(a),a},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=g;exports.createEdge=h;exports.createExperience=x;exports.createExperiencePlugin=N;exports.createField=y;exports.createNode=p;exports.createStep=z;exports.serialization=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../api-DQC5OMTN.cjs"),a=require("../../../logger-BsmHUUw1.cjs");function g(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 d(e){return g(e)%100}function p(e,r){return r<=0?!1:r>=100?!0:e<r}function h(e){return typeof e!="object"||e===null||!("key"in e&&"name"in e&&"enabled"in e&&"weight"in e&&"version"in e)?!1:typeof e.key=="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 o of n){const t=o.indexOf(":");t>0&&r.add(o.substring(0,t))}return r}function c(e,r,n){const o=m(e),t=e.session?.id;if(!t)throw new Error("Session ID is required for feature registration");const i=d(t);for(const s of r.features)o.has(s.key)||v(e,s,n,i)}function v(e,r,n,o){e.registerFeature(r.key,{key:`v${r.version}`,name:r.name,storage:n?"session":"local",decide:()=>r.enabled?p(o,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 o=n?.previewToken?`projects/${r}?preview_token=${encodeURIComponent(n.previewToken)}`:`projects/${r}`;let t;try{t=await f.get(e,o,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 i;try{i=await t.json()}catch{return a.logger("warn","Failed to parse project config response"),null}return l(i)?i:(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 o=y(r);if(o){const s=await u(n,r.projectId,{previewToken:o});s&&c(r,s,!0);return}const t=e?.projectConfig??w();if(t){c(r,t,!1);return}const i=await u(n,r.projectId);i&&c(r,i,!1)}}}}}exports.createClientHeaders=f.createClientHeaders;exports.dynamicExperiencesPlugin=P;exports.fetchProject=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../api-ClqvxrZP.cjs"),a=require("../../../logger-BsmHUUw1.cjs");function g(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 d(e){return g(e)%100}function p(e,r){return r<=0?!1:r>=100?!0:e<r}function h(e){return typeof e!="object"||e===null||!("key"in e&&"name"in e&&"enabled"in e&&"weight"in e&&"version"in e)?!1:typeof e.key=="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 o of n){const t=o.indexOf(":");t>0&&r.add(o.substring(0,t))}return r}function c(e,r,n){const o=m(e),t=e.session?.id;if(!t)throw new Error("Session ID is required for feature registration");const i=d(t);for(const s of r.features)o.has(s.key)||v(e,s,n,i)}function v(e,r,n,o){e.registerFeature(r.key,{key:`v${r.version}`,name:r.name,storage:n?"session":"local",decide:()=>r.enabled?p(o,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 o=n?.previewToken?`projects/${r}?preview_token=${encodeURIComponent(n.previewToken)}`:`projects/${r}`;let t;try{t=await f.get(e,o,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 i;try{i=await t.json()}catch{return a.logger("warn","Failed to parse project config response"),null}return l(i)?i:(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 o=y(r);if(o){const s=await u(n,r.projectId,{previewToken:o});s&&c(r,s,!0);return}const t=e?.projectConfig??w();if(t){c(r,t,!1);return}const i=await u(n,r.projectId);i&&c(r,i,!1)}}}}}exports.createClientHeaders=f.createClientHeaders;exports.dynamicExperiencesPlugin=P;exports.fetchProject=u;
package/dist/esm/index.js CHANGED
@@ -5,7 +5,7 @@ import { f as Ot } 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 Ut } from "../storage-Co_LbKr_.js";
8
- import { p as ae, g as ce } from "../api-CMwQlyo0.js";
8
+ import { p as ae, g as ce } from "../api-DVmW_Ytn.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 { t as le } from "../to-kebab-case-BPnCZjhB.js";
@@ -1,4 +1,4 @@
1
- import { g as h } from "../../../id-BW-g3y32.js";
1
+ import { g as p } from "../../../id-BW-g3y32.js";
2
2
  import { t as m } from "../../../to-kebab-case-BPnCZjhB.js";
3
3
  const r = {
4
4
  serialize(i) {
@@ -10,41 +10,41 @@ const r = {
10
10
  }, x = (i) => ({
11
11
  name: "create-experience",
12
12
  setup: (d) => {
13
- i.experiences.forEach((t) => {
14
- const s = t.serialize(), o = r.deserialize(s);
15
- o.component = t.component, d.registerExperience(o), o.fields.forEach((f) => {
16
- d.registerField(f);
13
+ i.experiences.forEach((n) => {
14
+ const o = n.serialize(), s = r.deserialize(o);
15
+ s.component = n.component, d.registerExperience(s), s.fields.forEach((u) => {
16
+ d.registerField(u);
17
17
  });
18
18
  });
19
19
  }
20
20
  }), N = (i, d) => ({
21
- id: h("node"),
21
+ id: p("node"),
22
22
  experience: d,
23
23
  type: "action",
24
24
  action: i.action,
25
- addNext(s) {
26
- if (!s.node) throw new Error("Cannot connect to node");
27
- const o = c(
28
- { sourceNode: this, destinationNode: s.node, sourceNodeHandle: null },
25
+ addNext(o) {
26
+ if (!o.node) throw new Error("Cannot connect to node");
27
+ const s = h(
28
+ { sourceNode: this, destinationNode: o.node, sourceNodeHandle: null },
29
29
  d
30
30
  );
31
- d.edges.push(o);
31
+ d.edges.push(s);
32
32
  },
33
- onSuccess(s) {
34
- if (!s.node) throw new Error("Cannot connect to node");
35
- const o = c(
36
- { sourceNode: this, destinationNode: s.node, sourceNodeHandle: "true" },
33
+ onSuccess(o) {
34
+ if (!o.node) throw new Error("Cannot connect to node");
35
+ const s = h(
36
+ { sourceNode: this, destinationNode: o.node, sourceNodeHandle: "true" },
37
37
  d
38
38
  );
39
- d.edges.push(o);
39
+ d.edges.push(s);
40
40
  },
41
- onFail(s) {
42
- if (!s.node) throw new Error("Cannot connect to node");
43
- const o = c(
44
- { sourceNode: this, destinationNode: s.node, sourceNodeHandle: "false" },
41
+ onFail(o) {
42
+ if (!o.node) throw new Error("Cannot connect to node");
43
+ const s = h(
44
+ { sourceNode: this, destinationNode: o.node, sourceNodeHandle: "false" },
45
45
  d
46
46
  );
47
- d.edges.push(o);
47
+ d.edges.push(s);
48
48
  },
49
49
  serialize() {
50
50
  return r.serialize({
@@ -53,53 +53,56 @@ const r = {
53
53
  action: this.action
54
54
  });
55
55
  }
56
- }), V = (i) => ({
57
- id: i.id ?? h("step"),
58
- key: i.key ?? m(i.name),
59
- name: i.name,
60
- fields: i.fields ?? [],
61
- addField(d) {
62
- const t = "serialize" in d ? d : y(d);
63
- return this.fields.includes(t) || this.fields.push(t), t;
64
- }
65
- }), z = (i, d) => {
66
- const t = {
67
- id: i.id ?? h("step"),
68
- key: i.key ?? m(i.name),
69
- name: i.name,
56
+ }), V = (i) => {
57
+ const d = i.name ?? i.label ?? "";
58
+ return {
59
+ id: i.id ?? p("step"),
60
+ key: i.key ?? m(d),
61
+ name: d,
62
+ fields: i.fields ?? [],
63
+ addField(n) {
64
+ const o = "serialize" in n ? n : y(n);
65
+ return this.fields.includes(o) || this.fields.push(o), o;
66
+ }
67
+ };
68
+ }, z = (i, d) => {
69
+ const n = "label" in i ? i.label : void 0, o = i.name ?? n ?? "", s = {
70
+ id: i.id ?? p("step"),
71
+ key: i.key ?? m(o),
72
+ name: o,
70
73
  experience: d,
71
74
  fields: i.fields ?? [],
72
75
  node: null,
73
- nextStep(s) {
74
- return this.experience.addStep(s, this);
76
+ nextStep(u) {
77
+ return this.experience.addStep(u, this);
75
78
  },
76
- nextConditional(s) {
77
- return this.experience.addConditional(s, this);
79
+ nextConditional(u) {
80
+ return this.experience.addConditional(u, this);
78
81
  },
79
- addNextExperience(s) {
80
- return this.experience.addExperience(s, this);
82
+ addNextExperience(u) {
83
+ return this.experience.addExperience(u, this);
81
84
  },
82
- addField(s) {
83
- return this.experience.addField(s, this);
85
+ addField(u) {
86
+ return this.experience.addField(u, this);
84
87
  },
85
88
  serialize() {
86
89
  return r.serialize({
87
90
  id: this.id,
88
91
  key: m(this.name),
89
92
  name: this.name,
90
- fieldIds: this.fields.map((s) => s.id)
93
+ fieldIds: this.fields.map((u) => u.id)
91
94
  });
92
95
  }
93
96
  };
94
- return p({ step: t, type: "step" }, d), t;
95
- }, p = (i, d) => {
96
- const t = {
97
- id: h("node"),
97
+ return f({ step: s, type: "step" }, d), s;
98
+ }, f = (i, d) => {
99
+ const n = {
100
+ id: p("node"),
98
101
  experience: d
99
102
  };
100
103
  if (i.type === "step") {
101
- const o = {
102
- ...t,
104
+ const s = {
105
+ ...n,
103
106
  type: "step",
104
107
  connectedStep: i.step,
105
108
  serialize() {
@@ -111,11 +114,11 @@ const r = {
111
114
  });
112
115
  }
113
116
  };
114
- return o.connectedStep.node = o, o;
117
+ return s.connectedStep.node = s, s;
115
118
  }
116
119
  if (i.type === "conditional") {
117
- const o = {
118
- ...t,
120
+ const s = {
121
+ ...n,
119
122
  type: "conditional",
120
123
  connectedConditional: i.conditional,
121
124
  serialize() {
@@ -126,10 +129,10 @@ const r = {
126
129
  });
127
130
  }
128
131
  };
129
- return o.connectedConditional.node = o, o;
132
+ return s.connectedConditional.node = s, s;
130
133
  }
131
134
  return i.type === "experience" ? {
132
- ...t,
135
+ ...n,
133
136
  type: "experience",
134
137
  connectedExperience: i.experience,
135
138
  serialize() {
@@ -140,7 +143,7 @@ const r = {
140
143
  });
141
144
  }
142
145
  } : {
143
- ...t,
146
+ ...n,
144
147
  type: "origin",
145
148
  serialize() {
146
149
  return r.serialize({
@@ -149,8 +152,8 @@ const r = {
149
152
  });
150
153
  }
151
154
  };
152
- }, c = (i, d) => ({
153
- id: h("edge"),
155
+ }, h = (i, d) => ({
156
+ id: p("edge"),
154
157
  sourceNode: i.sourceNode,
155
158
  sourceNodeHandle: i.sourceNodeHandle,
156
159
  destinationNode: i.destinationNode,
@@ -164,29 +167,29 @@ const r = {
164
167
  });
165
168
  }
166
169
  }), g = (i, d) => {
167
- const t = {
168
- id: h("conditional"),
170
+ const n = {
171
+ id: p("conditional"),
169
172
  label: i.label,
170
173
  condition: i.condition,
171
174
  node: null,
172
175
  experience: d,
173
- addTrue(s) {
174
- if (!this.node || !s.node)
176
+ addTrue(o) {
177
+ if (!this.node || !o.node)
175
178
  throw new Error("todo no node");
176
- const o = c(
177
- { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "true" },
179
+ const s = h(
180
+ { sourceNode: this.node, destinationNode: o.node, sourceNodeHandle: "true" },
178
181
  this.experience
179
182
  );
180
- this.experience.edges.push(o);
183
+ this.experience.edges.push(s);
181
184
  },
182
- addFalse(s) {
183
- if (!this.node || !s.node)
185
+ addFalse(o) {
186
+ if (!this.node || !o.node)
184
187
  throw new Error("todo no node");
185
- const o = c(
186
- { sourceNode: this.node, destinationNode: s.node, sourceNodeHandle: "false" },
188
+ const s = h(
189
+ { sourceNode: this.node, destinationNode: o.node, sourceNodeHandle: "false" },
187
190
  this.experience
188
191
  );
189
- this.experience.edges.push(o);
192
+ this.experience.edges.push(s);
190
193
  },
191
194
  serialize() {
192
195
  return r.serialize({
@@ -196,9 +199,9 @@ const r = {
196
199
  });
197
200
  }
198
201
  };
199
- return p({ conditional: t, type: "conditional" }, d), t;
202
+ return f({ conditional: n, type: "conditional" }, d), n;
200
203
  }, y = (i) => ({
201
- id: i.id ?? h("field"),
204
+ id: i.id ?? p("field"),
202
205
  key: i.key ?? m(i.name),
203
206
  name: i.name,
204
207
  type: i.type,
@@ -211,14 +214,14 @@ const r = {
211
214
  validation: i.validation ?? {},
212
215
  condition: i.condition,
213
216
  required: i.required,
214
- options: i.options?.map((t) => ({
215
- id: "id" in t ? t.id : h("option"),
216
- ...t
217
+ options: i.options?.map((n) => ({
218
+ id: "id" in n ? n.id : p("option"),
219
+ ...n
217
220
  })) ?? null,
218
221
  policies: i.policies,
219
222
  // 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
220
223
  serialize() {
221
- const t = {
224
+ const n = {
222
225
  id: this.id,
223
226
  key: this.key,
224
227
  name: this.name,
@@ -230,35 +233,35 @@ const r = {
230
233
  validation: this.validation,
231
234
  condition: this.condition,
232
235
  policies: this.policies
233
- }, 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;
236
+ }, o = typeof this.defaultValue == "string" ? this.defaultValue : void 0, s = typeof this.defaultValue == "number" ? this.defaultValue : void 0, u = typeof this.defaultValue == "boolean" ? this.defaultValue : void 0;
234
237
  switch (this.type) {
235
238
  case "text":
236
239
  if (this.multiple) {
237
240
  let e;
238
241
  if (Array.isArray(this.defaultValue)) {
239
242
  e = [];
240
- for (const n of this.defaultValue)
241
- typeof n == "string" && e.push(n);
243
+ for (const t of this.defaultValue)
244
+ typeof t == "string" && e.push(t);
242
245
  e.length === 0 && (e = void 0);
243
246
  }
244
247
  return r.serialize({
245
- ...t,
248
+ ...n,
246
249
  type: "text",
247
250
  multiple: !0,
248
251
  defaultValue: e,
249
- options: this.options ? this.options.map((n) => ({
250
- id: n.id,
251
- label: n.label,
252
- value: `${n.value}`,
253
- condition: n.condition
252
+ options: this.options ? this.options.map((t) => ({
253
+ id: t.id,
254
+ label: t.label,
255
+ value: `${t.value}`,
256
+ condition: t.condition
254
257
  })) : null
255
258
  });
256
259
  }
257
260
  return r.serialize({
258
- ...t,
261
+ ...n,
259
262
  type: "text",
260
263
  multiple: !1,
261
- defaultValue: s,
264
+ defaultValue: o,
262
265
  options: this.options ? this.options.map((e) => ({
263
266
  id: e.id,
264
267
  label: e.label,
@@ -271,28 +274,28 @@ const r = {
271
274
  let e;
272
275
  if (Array.isArray(this.defaultValue)) {
273
276
  e = [];
274
- for (const n of this.defaultValue)
275
- typeof n == "number" && e.push(n);
277
+ for (const t of this.defaultValue)
278
+ typeof t == "number" && e.push(t);
276
279
  e.length === 0 && (e = void 0);
277
280
  }
278
281
  return r.serialize({
279
- ...t,
282
+ ...n,
280
283
  type: "number",
281
284
  multiple: !0,
282
285
  defaultValue: e,
283
- options: this.options ? this.options.map((n) => ({
284
- id: n.id,
285
- label: n.label,
286
- value: Number(n.value),
287
- condition: n.condition
286
+ options: this.options ? this.options.map((t) => ({
287
+ id: t.id,
288
+ label: t.label,
289
+ value: Number(t.value),
290
+ condition: t.condition
288
291
  })) : null
289
292
  });
290
293
  }
291
294
  return r.serialize({
292
- ...t,
295
+ ...n,
293
296
  type: "number",
294
297
  multiple: !1,
295
- defaultValue: o,
298
+ defaultValue: s,
296
299
  options: this.options ? this.options.map((e) => ({
297
300
  id: e.id,
298
301
  label: e.label,
@@ -305,28 +308,28 @@ const r = {
305
308
  let e;
306
309
  if (Array.isArray(this.defaultValue)) {
307
310
  e = [];
308
- for (const n of this.defaultValue)
309
- typeof n == "boolean" && e.push(n);
311
+ for (const t of this.defaultValue)
312
+ typeof t == "boolean" && e.push(t);
310
313
  e.length === 0 && (e = void 0);
311
314
  }
312
315
  return r.serialize({
313
- ...t,
316
+ ...n,
314
317
  type: "boolean",
315
318
  multiple: !0,
316
319
  defaultValue: e,
317
- options: this.options ? this.options.map((n) => ({
318
- id: n.id,
319
- label: n.label,
320
- value: !!n.value,
321
- condition: n.condition
320
+ options: this.options ? this.options.map((t) => ({
321
+ id: t.id,
322
+ label: t.label,
323
+ value: !!t.value,
324
+ condition: t.condition
322
325
  })) : null
323
326
  });
324
327
  }
325
328
  return r.serialize({
326
- ...t,
329
+ ...n,
327
330
  type: "boolean",
328
331
  multiple: !1,
329
- defaultValue: f,
332
+ defaultValue: u,
330
333
  options: this.options ? this.options.map((e) => ({
331
334
  id: e.id,
332
335
  label: e.label,
@@ -336,7 +339,7 @@ const r = {
336
339
  });
337
340
  case "object":
338
341
  return this.multiple ? r.serialize({
339
- ...t,
342
+ ...n,
340
343
  type: "object",
341
344
  multiple: !0,
342
345
  defaultValue: this.defaultValue,
@@ -348,7 +351,7 @@ const r = {
348
351
  condition: e.condition
349
352
  })) : null
350
353
  }) : r.serialize({
351
- ...t,
354
+ ...n,
352
355
  type: "object",
353
356
  multiple: !1,
354
357
  defaultValue: this.defaultValue,
@@ -365,7 +368,7 @@ const r = {
365
368
  }
366
369
  }
367
370
  }), E = (i) => {
368
- const d = [], t = [], s = [], o = [], f = [];
371
+ const d = [], n = [], o = [], s = [], u = [];
369
372
  return {
370
373
  id: i.id,
371
374
  component: i.component,
@@ -374,74 +377,74 @@ const r = {
374
377
  condition: i.condition,
375
378
  targets: i.targets,
376
379
  steps: d,
377
- nodes: t,
378
- edges: s,
379
- fields: f,
380
- conditionals: o,
381
- addStep(e, n) {
382
- let l = n?.node;
383
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
380
+ nodes: n,
381
+ edges: o,
382
+ fields: u,
383
+ conditionals: s,
384
+ addStep(e, t) {
385
+ let l = t?.node;
386
+ this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
384
387
  const a = "serialize" in e ? e : z(e, this);
385
388
  if (l) {
386
389
  if (!a.node)
387
390
  throw new Error("todo no node");
388
- const u = c(
391
+ const c = h(
389
392
  { sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
390
393
  this
391
394
  );
392
- this.edges.push(u);
395
+ this.edges.push(c);
393
396
  }
394
- return a.fields.length > 0 && a.fields.forEach((u) => {
395
- this.fields.includes(u) || this.fields.push(u);
397
+ return a.fields.length > 0 && a.fields.forEach((c) => {
398
+ this.fields.includes(c) || this.fields.push(c);
396
399
  }), this.steps.includes(a) || (this.steps.push(a), a.node && this.nodes.push(a.node)), a;
397
400
  },
398
- addAction(e, n) {
399
- let l = n?.node;
400
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
401
+ addAction(e, t) {
402
+ let l = t?.node;
403
+ this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
401
404
  const a = "serialize" in e ? e : N(e, this);
402
405
  if (l) {
403
- const u = c(
406
+ const c = h(
404
407
  { sourceNode: l, destinationNode: a, sourceNodeHandle: null },
405
408
  this
406
409
  );
407
- this.edges.push(u);
410
+ this.edges.push(c);
408
411
  }
409
412
  return this.nodes.push(a), a;
410
413
  },
411
- addConditional(e, n) {
412
- let l = n?.node;
413
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
414
+ addConditional(e, t) {
415
+ let l = t?.node;
416
+ this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
414
417
  const a = "serialize" in e ? e : g(e, this);
415
418
  if (l) {
416
419
  if (!a.node)
417
420
  throw new Error("todo no node");
418
- const u = c(
421
+ const c = h(
419
422
  { sourceNode: l, destinationNode: a.node, sourceNodeHandle: null },
420
423
  this
421
424
  );
422
- this.edges.push(u);
425
+ this.edges.push(c);
423
426
  }
424
427
  return this.conditionals.includes(a) || (this.conditionals.push(a), a.node && this.nodes.push(a.node)), a;
425
428
  },
426
- addExperience(e, n) {
427
- let l = n?.node;
428
- this.nodes.length === 0 && (l = p({ type: "origin" }, this), this.nodes.push(l));
429
- const a = p(
429
+ addExperience(e, t) {
430
+ let l = t?.node;
431
+ this.nodes.length === 0 && (l = f({ type: "origin" }, this), this.nodes.push(l));
432
+ const a = f(
430
433
  { type: "experience", experience: e },
431
434
  this
432
435
  );
433
436
  if (this.nodes.push(a), l) {
434
- const u = c(
437
+ const c = h(
435
438
  { sourceNode: l, destinationNode: a, sourceNodeHandle: null },
436
439
  this
437
440
  );
438
- this.edges.push(u);
441
+ this.edges.push(c);
439
442
  }
440
443
  return e;
441
444
  },
442
- addField(e, n) {
445
+ addField(e, t) {
443
446
  const l = "serialize" in e ? e : y(e);
444
- return n && n.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
447
+ return t && t.fields.push(l), this.fields.includes(l) || this.fields.push(l), l;
445
448
  },
446
449
  serialize() {
447
450
  return r.serialize({
@@ -464,11 +467,11 @@ const r = {
464
467
  };
465
468
  export {
466
469
  g as createConditional,
467
- c as createEdge,
470
+ h as createEdge,
468
471
  E as createExperience,
469
472
  x as createExperiencePlugin,
470
473
  y as createField,
471
- p as createNode,
474
+ f as createNode,
472
475
  V as createStep,
473
476
  r as serialization
474
477
  };
@@ -1,5 +1,5 @@
1
- import { a as l } from "../../../api-CMwQlyo0.js";
2
- import { c as S } from "../../../api-CMwQlyo0.js";
1
+ import { a as l } from "../../../api-DVmW_Ytn.js";
2
+ import { c as S } from "../../../api-DVmW_Ytn.js";
3
3
  import { l as a } from "../../../logger-C9a75KZn.js";
4
4
  function d(e) {
5
5
  let r = 2166136261;
@@ -21,7 +21,11 @@ export interface SerializableStep extends Nodeable {
21
21
  export interface CreateStepOptions {
22
22
  id?: string;
23
23
  key?: string;
24
- name: string;
24
+ name?: string;
25
+ /**
26
+ * @deprecated Use `name` instead. If provided, `label` will be used as `name`.
27
+ */
28
+ label?: string;
25
29
  fields?: SerializableField[];
26
30
  }
27
31
  export type SerializableNode = SerializableStepNode | SerializableConditionalNode | SerializableLaunchExperienceNode | SerializableOriginNode | SerializableActionNode;
@@ -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,OAA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AS,GAAG,UAAU,CAAA;IAClC,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACvC,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,IAAI,CAC3B,gBAAgB,EACd,UAAU,GACV,iBAAiB,GACjB,mBAAmB,GACnB,MAAM,GACN,WAAW,GACX,UAAU,GACV,YAAY,CACf,GAAG;IACF,QAAQ,EAAE,CAAC,mBAAmB,EAAE,kBAAkB,GAAG,iBAAiB,KAAK,IAAI,CAAA;CAChF,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,aAAa,iBAAiB,KAAG,UAiB3D,CAAA;AAED,eAAO,MAAM,kBAAkB,GAC7B,aAAa,iBAAiB,GAAG,UAAU,EAC3C,YAAY,sBAAsB,KACjC,gBAiCF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBA0EF,CAAA;AAED,eAAO,MAAM,UAAU,GACrB,aAAa,iBAAiB,EAC9B,YAAY,sBAAsB,KACjC,gBAkBF,CAAA;AAED,eAAO,MAAM,iBAAiB,GAC5B,oBAAoB,wBAAwB,EAC5C,YAAY,sBAAsB,KACjC,uBA4CF,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,SAAS,GAAG,SAAS,EACzD,cAAc,kBAAkB,KAC/B,iBAAiB,CAAC,CAAC,CAoOrB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,YAAY,uBAAuB,KAAG,sBAsLtE,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,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658489",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },