@picked/client 0.0.4-next.1 → 0.0.5-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/cjs/index.js +1 -1
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugins/create-experience/index.js +154 -143
- package/dist/types/plugins/create-experience/create-experience.d.ts +7 -2
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var M=Object.defineProperty;var T=(t,e,s)=>e in t?M(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var y=(t,e,s)=>T(t,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("effector"),h=require("@withease/factories"),b=require("../experience-instance-DwO_yZK0.cjs"),x=require("../logger-BsmHUUw1.cjs"),k=require("../storage-BPJwmlva.cjs"),V=require("../id-BKIWbSTy.cjs"),N=require("../object-BbFTsGh3.cjs"),w=require("../supports-B6KShYPU.cjs"),O=d.createDomain("experience"),z=h.createFactory(({client:t,experience:e})=>{const s=O.store(e),o=d.createApi(s,{merge(n,f){return{...n,...f.experience}}}),i=s.map(n=>({type:n.type,name:n.name,decisionLogic:n.decide,targetSelectors:n.targets})),p=t.components.listStore.map(n=>n.find(f=>f.name===`experience:${e.id}`)||n.find(f=>f.name==="experience"),{skipVoid:!1}),r=s.map(n=>({steps:n.steps,nodes:n.nodes,edges:n.edges,conditionals:n.conditionals}));return{id:e.id,configStore:i,treeStore:r,componentStore:p,merge:o.merge}});function q(t){return h.invoke(z,t)}const K=h.createFactory(({client:t})=>{const e=O.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.id]:n}}});function o(r){const n=e.getState()[r.id];if(n){n.merge({experience:r,strategy:"override"});return}const f=q({client:t,experience:r});s.register(f)}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getById:p,listStore:i}});function _(t){return h.invoke(K,t)}const H=(t,e)=>{e.register(t)},L=(t,e)=>{const{targetSelectors:s}=e.configStore.getState(),o=b.getTargetElements(s,e.id);o.forEach(({elements:p})=>p.forEach(r=>b.tagTargetElement(r,e.id))),b.createAppHosts(o,e.id).forEach(p=>{t.experienceInstances.spawn(e,p)})},D=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await U(t,e)&&L(t,e)}))},U=async(t,e)=>{const{type:s,decisionLogic:o,targetSelectors:i}=e.configStore.getState();return b.getTargetElements(i,e.id).length<1?!1:s==="funnel"?o?await b.evaluateRuleLogic(t,o)===!0:!1:i.length===0?!1:b.isRulesLogic(o)?await b.evaluateRuleLogic(t,o)===!0:!0},W=(t,e,s)=>{const o=e.name,i=e.setup(t);if(i){const p=s[o]??{};s[o]=Object.freeze({...p,...i})}},G=d.createDomain("component"),J=h.createFactory(({client:t,component:e,name:s})=>{const o=t.frameworks.getByName(e.frameworkName);return{name:s,component:e,frameworkStore:o}});function Y(t){return h.invoke(J,t)}const Q=h.createFactory(({client:t})=>{const e=G.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:n}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Component '${r}' already registered. Registering again will override the previous registration.`);const v=Y({client:t,name:r,component:n});s.register(v)}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function X(t){return h.invoke(Q,t)}const B=(t,e,s)=>{s.register(t,e)},Z=d.createDomain("framework"),ee=h.createFactory(({client:t})=>{const e=Z.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:n.framework}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Framework '${r}' already registered. Registering again will override the previous registration.`),s.register({name:r,framework:n})}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function te(t){return h.invoke(ee,t)}const re=(t,e)=>{e.register(t.name,t)},se=6e3,R=k.createStorageKey("last_ping","global"),ne=t=>`${t}/api/v1/ping`,oe=async t=>{try{const e=Date.now(),s=localStorage.getItem(R);if(s&&e-parseInt(s)<se)return!0;const o=ne(t.apiUrl),i={projectId:t.projectId,path:window.location.pathname},p=JSON.stringify(i),r={"Content-Type":"application/json"},n=document.getElementById("picked_script"),f=n==null?void 0:n.dataset.verceltoken;f&&(r["x-vercel-protection-bypass"]=f);const u=(await fetch(o,{method:"POST",headers:r,body:p})).ok;return u&&localStorage.setItem(R,e.toString()),u}catch(e){return x.logger("error",e),!1}};function ie(t){const e=typeof window<"u",s={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(s)}const ae=d.createDomain("predicate"),ce=h.createFactory(({client:t})=>{const e=ae.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:{name:n.name,predicate:n.predicate}}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Predicate '${r}' already registered. Registering again will override the previous registration.`),s.register(Object.freeze({name:r,predicate:n}))}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function ue(t){return h.invoke(ce,t)}const le=(t,e,s)=>{s.register(t,e)},$=d.createDomain("feature"),pe=h.createFactory(()=>{const t=$.store({}),e=$.store([]),s=d.createApi(t,{register(u,c){return{...u,[c.id]:c.feature}}});function o(u,c){t.getState()[u]&&x.logger("warn",`Feature '${u}' already registered. Registering again will override the previous registration.`);const g={id:u,feature:{...c,id:u}};s.register(Object.freeze({id:u,feature:g}))}const i=d.createEffect(async({id:u,key:c,storage:a="local"})=>{const g=k.createStorageKey(`feature:${u}:${c}`,"global"),l=(a==="session"?k.sessionStore:k.localStore).get(g).boolean();if(l!==null)return{id:u,bucket:l}}),p=d.createEffect(u=>{if(!u)return null;const c=k.createStorageKey(`feature:${u.id}:${u.key}`,"global");(u.storage==="session"?k.sessionStore:k.localStore).set(c,u.bucket)}),r=new Map,n=d.attach({source:{allFeaturesStore:t,resolvedFeaturesStore:e},effect:async({allFeaturesStore:u,resolvedFeaturesStore:c},{id:a,decide:g,key:m})=>{const l=c.find(j=>j.id===a);if(l)return l;const S=u[a];if(!S)throw new Error(`Feature with id '${a}' not found`);const F=r.get(`${a}:${m}`);if(F){const j=await F;return{id:S.id,bucket:j,storage:S.feature.storage}}const P=g();r.set(`${a}:${m}`,P);const I=await P;return{id:S.id,bucket:I,storage:S.feature.storage}}});d.sample({clock:s.register,fn:u=>{const{id:c,feature:a}=u;return{id:c,key:a.feature.key,storage:a.feature.storage}},target:i}),d.sample({source:e,clock:[i.doneData,n.doneData],fn:(u,c)=>!c||u.some(a=>a.id===c.id)?u:[...u,c],target:e}),d.sample({source:t,clock:n.doneData,fn:(u,c)=>{var S;const{id:a,bucket:g,storage:m}=c,l=(S=u[a])==null?void 0:S.feature.key;return l?{key:l,id:a,bucket:g,storage:m}:null},target:p});const f=d.combine({allFeaturesStore:t,resolvedFeaturesStore:e}).map(({allFeaturesStore:u,resolvedFeaturesStore:c})=>Object.values(u).map(a=>{const g=c.find(m=>m.id===a.id);return g?{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:()=>({id:a.id,bucket:g.bucket}),isResolved:!0}:{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:async()=>await n(a.feature),isResolved:!1}}));function v(u){return t.map(c=>c[u],{skipVoid:!1})}return{register:o,getByName:v,listStore:f}});function ge(){return h.invoke(pe)}const de=(t,e,s)=>{s.register(t,e)},E=d.createDomain("history");function C(t,e){return{id:V.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const fe=h.createFactory(()=>{const t=E.store({entries:[]}),e=E.event(),s=E.event(),o=E.event(),i=E.event();t.on(e,(r,n)=>({entries:[...r.entries,C(n.experienceId,n.node)]})),t.on(s,(r,n)=>({entries:[...r.entries.slice(0,-1),C(n.experienceId,n.node)]})),t.on(i,(r,n)=>n);function p(r,n){const f={lastStepIndex:-1,secondLastStepIndex:-1};for(let v=r.length-1;v>=0;v--){const u=r[v],c=u==null?void 0:u.node;if(!(!c||!b.isStepNode(c))&&!(n&&(u==null?void 0:u.experienceId)!==n))if(f.lastStepIndex===-1)f.lastStepIndex=v;else{f.secondLastStepIndex=v;break}}return f}return t.on(o,(r,n)=>{const{secondLastStepIndex:f}=p(r.entries,n.experienceId),v=f!==-1?r.entries.slice(0,f+1):r.entries;return{...r,entries:v}}),{push:e,replace:s,back:o,restore:i,entriesStore:t.map(r=>r.entries)}});function me(){return h.invoke(fe)}const ye=()=>d.createEvent(),he=d.createDomain("field"),Se=h.createFactory(()=>{const t=he.store({}),e=d.createApi(t,{register(r,n){return{...r,[n.field.id]:n.field}}});function s(r){e.register({field:r})}const o=t.map(r=>Object.values(r));function i(r){return t.map(n=>n[r]||null)}function p(r){return t.map(n=>Object.values(n).find(f=>f.name===r)||null)}return{register:s,getById:i,listStore:o,getByName:p}});function ve(){return h.invoke(Se)}const ke=(t,e)=>{e.register(t)},we=d.createDomain("response"),be=h.createFactory(({client:t})=>{const e=we.store({}),s=d.createEvent(),o=d.createEvent(),i=d.createApi(e,{register(c,a){return{...c,[a.fieldId]:a.response}},clear(c,a){const{[a]:g,...m}=c;return m},clearAll(){return{}}});function p(c,a){i.register({fieldId:c,response:a})}async function r(c){const a=[];return await Promise.allSettled(Object.entries(c).map(async([g,m])=>{let l=m;const S=t.fields.getById(g).getState();if(!S){a.push({fieldId:g,userMessage:`Field '${g}' not found`,systemMessage:`No field with ID '${g}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:l});return}if(S.multiple&&(typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&(l=[l]),!N.isEmpty(S.validation)){const F=await b.evaluateRuleLogic(t,S.validation,{$input:l});if(typeof F=="string"){a.push({fieldId:g,userMessage:F,systemMessage:`Field validation resulted in an error: ${F}.`,value:l});return}if(F===!1){a.push({fieldId:g,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:l});return}}if(S.required&&(typeof l>"u"||l===null||l===""||Array.isArray(l)&&!l.length)){a.push({fieldId:g,userMessage:"This field is required",systemMessage:"Field is required.",value:l});return}if(!S.multiple&&Array.isArray(l)&&l.length>1){a.push({fieldId:g,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:l});return}if(S.options){const F=S.options.map(I=>I.value),P=Array.isArray(l)?l:[l];Array.isArray(l)&&(P.every(I=>F.includes(I))||a.push({fieldId:g,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${F.join(", ")}`,value:l}))}})),a.length?{errors:a}:(Object.entries(c).forEach(([g,m])=>{p(g,m)}),{errors:[]})}const n=e.map(c=>c),f=e.map(c=>Object.keys(c).map(g=>({fieldId:g,value:c[g]})));function v(c){const a=t.fields.getById(c),g=e.map(m=>m[c]||null);return d.combine({f:a,r:g},({f:m,r:l})=>l||(m!=null&&m.defaultValue?m.defaultValue:null))}function u(c){const a=t.fields.getByName(c);return d.combine({f:a,s:e},({f:g,s:m})=>{const l=g&&m[g.id]||null;return l||(g!=null&&g.defaultValue?g.defaultValue:null)})}return d.sample({clock:s,target:i.clearAll}),d.sample({clock:o,target:i.clear}),{register:p,clearAll:s,clear:o,commit:r,listStore:f,getAllStore:n,getByFieldId:v,getByFieldName:u}});function Fe(t){return h.invoke(be,t)}const xe=()=>"0.0.4-next.1";function Ie(){if(w.supportsDocument()){const t=[document.currentScript,document.getElementById("picked_script"),document.getElementById("picked"),document.getElementById("cvly"),document.getElementById("cvly-x")];for(const e of t)if(e!=null&&e.dataset.api)return e.dataset.api}return"https://api.picked.app"}function Ee(){if(!w.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},s=new Set;for(const[i]of t.entries())i.startsWith("picked-")&&s.add(i);for(const i of s){const p=i.replace("picked-","");e[p]=t.getAll(i)}const o=k.createStorageKey("s");if(s.size>0)k.sessionStore.set(o,e);else{const i=k.sessionStore.get(o);if(i)return i.json()||{}}return e}class A{constructor(e){y(this,"options");y(this,"isReady",!1);y(this,"project");y(this,"plugins",{});y(this,"eventBus",ye());y(this,"organizationId");y(this,"projectId");y(this,"apiUrl");y(this,"searchParams",Ee());y(this,"history",me());y(this,"components",X({client:this}));y(this,"experienceInstances",b.createExperienceInstanceIndex({client:this}));y(this,"experiences",_({client:this}));y(this,"frameworks",te({client:this}));y(this,"predicates",ue({client:this}));y(this,"features",ge());y(this,"fields",ve());y(this,"responses",Fe({client:this}));x.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||Ie(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.eventBus({type:"initialized",version:xe()}),x.logger("info","Picked client initialized.")}start(){oe(this),(async()=>{w.supportsDocument()&&(document.body&&await D(this),await b.domInteractive(),await D(this),this.eventBus({type:"ready"}),this.isReady=!0)})()}registerFramework(e){re(e,this.frameworks)}registerComponent(e,s){B(e,s,this.components)}registerPlugin(e){W(this,e,this.plugins)}registerFeature(e,s){de(e,s,this.features)}registerPredicate(e,s){le(e,s,this.predicates)}registerField(e){ke(e,this.fields)}registerExperience(e){e.component&&B(`experience:${e.id}`,e.component,this.components),H(e,this.experiences)}getStateSnapshot(){return ie(this)}async launchExperienceById(e){const s=this.experiences.getById(e).getState();if(!s){x.logger("warn",`Experience with id '${e}' not found.`);return}L(this,s)}setupPlugins(){var e;(e=this.options.plugins)==null||e.forEach(s=>{if(Array.isArray(s)){s.forEach(i=>{this.registerPlugin(i)});return}const o=typeof s=="function"?s():s;if(Array.isArray(o)){o.forEach(i=>this.registerPlugin(i));return}this.registerPlugin(o)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([s,o])=>{const i=typeof o=="function"?o():o;this.registerFeature(s,i)}),this.searchParams.feature&&this.searchParams.feature.forEach(s=>{try{const[o,i]=s.split(":");if(!o||!i)return;let p=i;p==="true"&&(p=!0),p==="false"&&(p=!1),this.registerFeature(o,{key:`${p}`,name:o,decide:()=>p,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([s,o])=>{if(typeof o!="function"){x.logger("warn",`Predicate "${s}" is not a function.`);return}this.registerPredicate(s,o)})}getPluginConfig(e){return this.plugins[e]??{}}}y(A,"logger",x.logger);const Pe=t=>{const e=new A(t);return w.bindClient(e),e};exports.isPickedRoot=b.isPickedRoot;exports.createStorageKey=k.createStorageKey;exports.localStore=k.localStore;exports.sessionStore=k.sessionStore;exports.subscribe=k.subscribe;exports.supportsCookies=w.supportsCookies;exports.supportsDocument=w.supportsDocument;exports.supportsHistory=w.supportsHistory;exports.supportsIntersectionObserver=w.supportsIntersectionObserver;exports.supportsLocalStorage=w.supportsLocalStorage;exports.supportsLocation=w.supportsLocation;exports.supportsSessionStorage=w.supportsSessionStorage;exports.supportsShadowRoot=w.supportsShadowRoot;exports.supportsWebComponents=w.supportsWebComponents;exports.supportsWindow=w.supportsWindow;exports.Picked=A;exports.createClient=Pe;
|
|
1
|
+
"use strict";var M=Object.defineProperty;var T=(t,e,s)=>e in t?M(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var y=(t,e,s)=>T(t,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("effector"),h=require("@withease/factories"),b=require("../experience-instance-DwO_yZK0.cjs"),x=require("../logger-BsmHUUw1.cjs"),k=require("../storage-BPJwmlva.cjs"),V=require("../id-BKIWbSTy.cjs"),N=require("../object-BbFTsGh3.cjs"),w=require("../supports-B6KShYPU.cjs"),O=d.createDomain("experience"),z=h.createFactory(({client:t,experience:e})=>{const s=O.store(e),o=d.createApi(s,{merge(n,f){return{...n,...f.experience}}}),i=s.map(n=>({type:n.type,name:n.name,decisionLogic:n.decide,targetSelectors:n.targets})),p=t.components.listStore.map(n=>n.find(f=>f.name===`experience:${e.id}`)||n.find(f=>f.name==="experience"),{skipVoid:!1}),r=s.map(n=>({steps:n.steps,nodes:n.nodes,edges:n.edges,conditionals:n.conditionals}));return{id:e.id,configStore:i,treeStore:r,componentStore:p,merge:o.merge}});function q(t){return h.invoke(z,t)}const K=h.createFactory(({client:t})=>{const e=O.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.id]:n}}});function o(r){const n=e.getState()[r.id];if(n){n.merge({experience:r,strategy:"override"});return}const f=q({client:t,experience:r});s.register(f)}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getById:p,listStore:i}});function _(t){return h.invoke(K,t)}const H=(t,e)=>{e.register(t)},L=(t,e)=>{const{targetSelectors:s}=e.configStore.getState(),o=b.getTargetElements(s,e.id);o.forEach(({elements:p})=>p.forEach(r=>b.tagTargetElement(r,e.id))),b.createAppHosts(o,e.id).forEach(p=>{t.experienceInstances.spawn(e,p)})},D=async t=>{await Promise.all(t.experiences.listStore.getState().map(async e=>{await U(t,e)&&L(t,e)}))},U=async(t,e)=>{const{type:s,decisionLogic:o,targetSelectors:i}=e.configStore.getState();return b.getTargetElements(i,e.id).length<1?!1:s==="funnel"?o?await b.evaluateRuleLogic(t,o)===!0:!1:i.length===0?!1:b.isRulesLogic(o)?await b.evaluateRuleLogic(t,o)===!0:!0},W=(t,e,s)=>{const o=e.name,i=e.setup(t);if(i){const p=s[o]??{};s[o]=Object.freeze({...p,...i})}},G=d.createDomain("component"),J=h.createFactory(({client:t,component:e,name:s})=>{const o=t.frameworks.getByName(e.frameworkName);return{name:s,component:e,frameworkStore:o}});function Y(t){return h.invoke(J,t)}const Q=h.createFactory(({client:t})=>{const e=G.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:n}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Component '${r}' already registered. Registering again will override the previous registration.`);const v=Y({client:t,name:r,component:n});s.register(v)}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function X(t){return h.invoke(Q,t)}const B=(t,e,s)=>{s.register(t,e)},Z=d.createDomain("framework"),ee=h.createFactory(({client:t})=>{const e=Z.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:n.framework}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Framework '${r}' already registered. Registering again will override the previous registration.`),s.register({name:r,framework:n})}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function te(t){return h.invoke(ee,t)}const re=(t,e)=>{e.register(t.name,t)},se=6e3,R=k.createStorageKey("last_ping","global"),ne=t=>`${t}/api/v1/ping`,oe=async t=>{try{const e=Date.now(),s=localStorage.getItem(R);if(s&&e-parseInt(s)<se)return!0;const o=ne(t.apiUrl),i={projectId:t.projectId,path:window.location.pathname},p=JSON.stringify(i),r={"Content-Type":"application/json"},n=document.getElementById("picked_script"),f=n==null?void 0:n.dataset.verceltoken;f&&(r["x-vercel-protection-bypass"]=f);const u=(await fetch(o,{method:"POST",headers:r,body:p})).ok;return u&&localStorage.setItem(R,e.toString()),u}catch(e){return x.logger("error",e),!1}};function ie(t){const e=typeof window<"u",s={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(s)}const ae=d.createDomain("predicate"),ce=h.createFactory(({client:t})=>{const e=ae.store({}),s=d.createApi(e,{register(r,n){return{...r,[n.name]:{name:n.name,predicate:n.predicate}}}});function o(r,n){e.getState()[r]&&x.logger("warn",`Predicate '${r}' already registered. Registering again will override the previous registration.`),s.register(Object.freeze({name:r,predicate:n}))}const i=e.map(r=>Object.values(r));function p(r){return e.map(n=>n[r],{skipVoid:!1})}return{register:o,getByName:p,listStore:i}});function ue(t){return h.invoke(ce,t)}const le=(t,e,s)=>{s.register(t,e)},$=d.createDomain("feature"),pe=h.createFactory(()=>{const t=$.store({}),e=$.store([]),s=d.createApi(t,{register(u,c){return{...u,[c.id]:c.feature}}});function o(u,c){t.getState()[u]&&x.logger("warn",`Feature '${u}' already registered. Registering again will override the previous registration.`);const g={id:u,feature:{...c,id:u}};s.register(Object.freeze({id:u,feature:g}))}const i=d.createEffect(async({id:u,key:c,storage:a="local"})=>{const g=k.createStorageKey(`feature:${u}:${c}`,"global"),l=(a==="session"?k.sessionStore:k.localStore).get(g).boolean();if(l!==null)return{id:u,bucket:l}}),p=d.createEffect(u=>{if(!u)return null;const c=k.createStorageKey(`feature:${u.id}:${u.key}`,"global");(u.storage==="session"?k.sessionStore:k.localStore).set(c,u.bucket)}),r=new Map,n=d.attach({source:{allFeaturesStore:t,resolvedFeaturesStore:e},effect:async({allFeaturesStore:u,resolvedFeaturesStore:c},{id:a,decide:g,key:m})=>{const l=c.find(j=>j.id===a);if(l)return l;const S=u[a];if(!S)throw new Error(`Feature with id '${a}' not found`);const F=r.get(`${a}:${m}`);if(F){const j=await F;return{id:S.id,bucket:j,storage:S.feature.storage}}const P=g();r.set(`${a}:${m}`,P);const I=await P;return{id:S.id,bucket:I,storage:S.feature.storage}}});d.sample({clock:s.register,fn:u=>{const{id:c,feature:a}=u;return{id:c,key:a.feature.key,storage:a.feature.storage}},target:i}),d.sample({source:e,clock:[i.doneData,n.doneData],fn:(u,c)=>!c||u.some(a=>a.id===c.id)?u:[...u,c],target:e}),d.sample({source:t,clock:n.doneData,fn:(u,c)=>{var S;const{id:a,bucket:g,storage:m}=c,l=(S=u[a])==null?void 0:S.feature.key;return l?{key:l,id:a,bucket:g,storage:m}:null},target:p});const f=d.combine({allFeaturesStore:t,resolvedFeaturesStore:e}).map(({allFeaturesStore:u,resolvedFeaturesStore:c})=>Object.values(u).map(a=>{const g=c.find(m=>m.id===a.id);return g?{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:()=>({id:a.id,bucket:g.bucket}),isResolved:!0}:{id:a.id,name:a.feature.name,key:a.feature.key,getBucket:async()=>await n(a.feature),isResolved:!1}}));function v(u){return t.map(c=>c[u],{skipVoid:!1})}return{register:o,getByName:v,listStore:f}});function ge(){return h.invoke(pe)}const de=(t,e,s)=>{s.register(t,e)},E=d.createDomain("history");function C(t,e){return{id:V.generateId(`history-entry-${Date.now()}-${Math.random()}}`),node:e,at:Date.now(),experienceId:t}}const fe=h.createFactory(()=>{const t=E.store({entries:[]}),e=E.event(),s=E.event(),o=E.event(),i=E.event();t.on(e,(r,n)=>({entries:[...r.entries,C(n.experienceId,n.node)]})),t.on(s,(r,n)=>({entries:[...r.entries.slice(0,-1),C(n.experienceId,n.node)]})),t.on(i,(r,n)=>n);function p(r,n){const f={lastStepIndex:-1,secondLastStepIndex:-1};for(let v=r.length-1;v>=0;v--){const u=r[v],c=u==null?void 0:u.node;if(!(!c||!b.isStepNode(c))&&!(n&&(u==null?void 0:u.experienceId)!==n))if(f.lastStepIndex===-1)f.lastStepIndex=v;else{f.secondLastStepIndex=v;break}}return f}return t.on(o,(r,n)=>{const{secondLastStepIndex:f}=p(r.entries,n.experienceId),v=f!==-1?r.entries.slice(0,f+1):r.entries;return{...r,entries:v}}),{push:e,replace:s,back:o,restore:i,entriesStore:t.map(r=>r.entries)}});function me(){return h.invoke(fe)}const ye=()=>d.createEvent(),he=d.createDomain("field"),Se=h.createFactory(()=>{const t=he.store({}),e=d.createApi(t,{register(r,n){return{...r,[n.field.id]:n.field}}});function s(r){e.register({field:r})}const o=t.map(r=>Object.values(r));function i(r){return t.map(n=>n[r]||null)}function p(r){return t.map(n=>Object.values(n).find(f=>f.name===r)||null)}return{register:s,getById:i,listStore:o,getByName:p}});function ve(){return h.invoke(Se)}const ke=(t,e)=>{e.register(t)},we=d.createDomain("response"),be=h.createFactory(({client:t})=>{const e=we.store({}),s=d.createEvent(),o=d.createEvent(),i=d.createApi(e,{register(c,a){return{...c,[a.fieldId]:a.response}},clear(c,a){const{[a]:g,...m}=c;return m},clearAll(){return{}}});function p(c,a){i.register({fieldId:c,response:a})}async function r(c){const a=[];return await Promise.allSettled(Object.entries(c).map(async([g,m])=>{let l=m;const S=t.fields.getById(g).getState();if(!S){a.push({fieldId:g,userMessage:`Field '${g}' not found`,systemMessage:`No field with ID '${g}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,value:l});return}if(S.multiple&&(typeof l=="string"||typeof l=="number"||typeof l=="boolean")&&(l=[l]),!N.isEmpty(S.validation)){const F=await b.evaluateRuleLogic(t,S.validation,{$input:l});if(typeof F=="string"){a.push({fieldId:g,userMessage:F,systemMessage:`Field validation resulted in an error: ${F}.`,value:l});return}if(F===!1){a.push({fieldId:g,userMessage:"This field is invalid",systemMessage:"Field validation resulted in an unspecified error.",value:l});return}}if(S.required&&(typeof l>"u"||l===null||l===""||Array.isArray(l)&&!l.length)){a.push({fieldId:g,userMessage:"This field is required",systemMessage:"Field is required.",value:l});return}if(!S.multiple&&Array.isArray(l)&&l.length>1){a.push({fieldId:g,userMessage:"This field expects a single response",systemMessage:"Field expects a single response.",value:l});return}if(S.options){const F=S.options.map(I=>I.value),P=Array.isArray(l)?l:[l];Array.isArray(l)&&(P.every(I=>F.includes(I))||a.push({fieldId:g,userMessage:"This field expects a valid option",systemMessage:`Field expects a valid option. Valid options are: ${F.join(", ")}`,value:l}))}})),a.length?{errors:a}:(Object.entries(c).forEach(([g,m])=>{p(g,m)}),{errors:[]})}const n=e.map(c=>c),f=e.map(c=>Object.keys(c).map(g=>({fieldId:g,value:c[g]})));function v(c){const a=t.fields.getById(c),g=e.map(m=>m[c]||null);return d.combine({f:a,r:g},({f:m,r:l})=>l||(m!=null&&m.defaultValue?m.defaultValue:null))}function u(c){const a=t.fields.getByName(c);return d.combine({f:a,s:e},({f:g,s:m})=>{const l=g&&m[g.id]||null;return l||(g!=null&&g.defaultValue?g.defaultValue:null)})}return d.sample({clock:s,target:i.clearAll}),d.sample({clock:o,target:i.clear}),{register:p,clearAll:s,clear:o,commit:r,listStore:f,getAllStore:n,getByFieldId:v,getByFieldName:u}});function Fe(t){return h.invoke(be,t)}const xe=()=>"0.0.5-next.1";function Ie(){if(w.supportsDocument()){const t=[document.currentScript,document.getElementById("picked_script"),document.getElementById("picked"),document.getElementById("cvly"),document.getElementById("cvly-x")];for(const e of t)if(e!=null&&e.dataset.api)return e.dataset.api}return"https://api.picked.app"}function Ee(){if(!w.supportsWindow())return{};const t=new URLSearchParams(window.location.search),e={},s=new Set;for(const[i]of t.entries())i.startsWith("picked-")&&s.add(i);for(const i of s){const p=i.replace("picked-","");e[p]=t.getAll(i)}const o=k.createStorageKey("s");if(s.size>0)k.sessionStore.set(o,e);else{const i=k.sessionStore.get(o);if(i)return i.json()||{}}return e}class A{constructor(e){y(this,"options");y(this,"isReady",!1);y(this,"project");y(this,"plugins",{});y(this,"eventBus",ye());y(this,"organizationId");y(this,"projectId");y(this,"apiUrl");y(this,"searchParams",Ee());y(this,"history",me());y(this,"components",X({client:this}));y(this,"experienceInstances",b.createExperienceInstanceIndex({client:this}));y(this,"experiences",_({client:this}));y(this,"frameworks",te({client:this}));y(this,"predicates",ue({client:this}));y(this,"features",ge());y(this,"fields",ve());y(this,"responses",Fe({client:this}));x.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||Ie(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.eventBus({type:"initialized",version:xe()}),x.logger("info","Picked client initialized.")}start(){oe(this),(async()=>{w.supportsDocument()&&(document.body&&await D(this),await b.domInteractive(),await D(this),this.eventBus({type:"ready"}),this.isReady=!0)})()}registerFramework(e){re(e,this.frameworks)}registerComponent(e,s){B(e,s,this.components)}registerPlugin(e){W(this,e,this.plugins)}registerFeature(e,s){de(e,s,this.features)}registerPredicate(e,s){le(e,s,this.predicates)}registerField(e){ke(e,this.fields)}registerExperience(e){e.component&&B(`experience:${e.id}`,e.component,this.components),H(e,this.experiences)}getStateSnapshot(){return ie(this)}async launchExperienceById(e){const s=this.experiences.getById(e).getState();if(!s){x.logger("warn",`Experience with id '${e}' not found.`);return}L(this,s)}setupPlugins(){var e;(e=this.options.plugins)==null||e.forEach(s=>{if(Array.isArray(s)){s.forEach(i=>{this.registerPlugin(i)});return}const o=typeof s=="function"?s():s;if(Array.isArray(o)){o.forEach(i=>this.registerPlugin(i));return}this.registerPlugin(o)})}setupFeatures(){const e=this.options.features;e&&(Object.entries(e).forEach(([s,o])=>{const i=typeof o=="function"?o():o;this.registerFeature(s,i)}),this.searchParams.feature&&this.searchParams.feature.forEach(s=>{try{const[o,i]=s.split(":");if(!o||!i)return;let p=i;p==="true"&&(p=!0),p==="false"&&(p=!1),this.registerFeature(o,{key:`${p}`,name:o,decide:()=>p,storage:"session"})}catch{}}))}setupPredicates(){const e=this.options.predicates;e&&Object.entries(e).forEach(([s,o])=>{if(typeof o!="function"){x.logger("warn",`Predicate "${s}" is not a function.`);return}this.registerPredicate(s,o)})}getPluginConfig(e){return this.plugins[e]??{}}}y(A,"logger",x.logger);const Pe=t=>{const e=new A(t);return w.bindClient(e),e};exports.isPickedRoot=b.isPickedRoot;exports.createStorageKey=k.createStorageKey;exports.localStore=k.localStore;exports.sessionStore=k.sessionStore;exports.subscribe=k.subscribe;exports.supportsCookies=w.supportsCookies;exports.supportsDocument=w.supportsDocument;exports.supportsHistory=w.supportsHistory;exports.supportsIntersectionObserver=w.supportsIntersectionObserver;exports.supportsLocalStorage=w.supportsLocalStorage;exports.supportsLocation=w.supportsLocation;exports.supportsSessionStorage=w.supportsSessionStorage;exports.supportsShadowRoot=w.supportsShadowRoot;exports.supportsWebComponents=w.supportsWebComponents;exports.supportsWindow=w.supportsWindow;exports.Picked=A;exports.createClient=Pe;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../id-BKIWbSTy.cjs"),o={serialize(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../../../id-BKIWbSTy.cjs"),o={serialize(e){return JSON.stringify(e)},deserialize(e){return JSON.parse(e)}},g=e=>({name:"create-experience",setup:a=>{e.experiences.forEach(l=>{const s=l.serialize(),d=o.deserialize(s);d.component=l.component,a.registerExperience(d),d.fields.forEach(p=>{a.registerField(p)})})}}),z=e=>({id:f.generateId("step"),label:e.label,fields:e.fields??[],addField(a){var s,d;const l="serialize"in a?a:y(a);return(s=this.fields)!=null&&s.includes(l)||(d=this.fields)==null||d.push(l),l}}),N=(e,a)=>{const l={id:f.generateId("step"),label:e.label,experience:a,fields:e.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 o.serialize({id:this.id,label:this.label,fieldIds:this.fields.map(s=>s.id)})}};return c({step:l,type:"step"},a),l},b=()=>[0,0],c=(e,a)=>{const l={id:f.generateId("node"),position:b(),experience:a};if(e.type==="step"){const d={...l,type:"step",connectedStep:e.step,serialize(){return o.serialize({id:this.id,type:this.type,stepId:this.connectedStep.id,position:this.position,label:this.connectedStep.label})}};return d.connectedStep.node=d,d}if(e.type==="conditional"){const d={...l,type:"conditional",connectedConditional:e.conditional,serialize(){return o.serialize({id:this.id,type:this.type,conditionalId:this.connectedConditional.id,position:this.position})}};return d.connectedConditional.node=d,d}return e.type==="experience"?{...l,type:"experience",connectedExperience:e.experience,serialize(){return o.serialize({id:this.id,type:this.type,experienceId:this.connectedExperience.id,position:this.position})}}:{...l,type:"origin",serialize(){return o.serialize({id:this.id,type:this.type,position:this.position})}}},h=(e,a)=>({id:f.generateId("edge"),sourceNode:e.sourceNode,sourceNodeHandle:e.sourceNodeHandle,destinationNode:e.destinationNode,experience:a,serialize(){return o.serialize({id:this.id,sourceNodeHandle:this.sourceNodeHandle??void 0,sourceNodeId:this.sourceNode.id,destinationNodeId:this.destinationNode.id})}}),m=(e,a)=>{const l={id:f.generateId("conditional"),condition:e.condition,node:null,experience:a,addTrue(s){if(!this.node||!s.node)throw new Error("todo no node");const d=h({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"true"},this.experience);this.experience.edges.push(d)},addFalse(s){if(!this.node||!s.node)throw new Error("todo no node");const d=h({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"false"},this.experience);this.experience.edges.push(d)},serialize(){return o.serialize({id:this.id,condition:this.condition})}};return c({conditional:l,type:"conditional"},a),l},y=e=>{var l;return{id:e.id,name:e.name,type:e.type,label:e.label,placeholder:e.placeholder,description:e.description,helpText:e.helpText,defaultValue:e.defaultValue,multiple:e.multiple,validation:e.validation,required:e.required,options:((l=e.options)==null?void 0:l.map(s=>({...s})))||null,policies:e.policies,serialize(){const s={id:this.id,name:this.name,label:this.label,placeholder:this.placeholder,required:this.required,description:this.description,helpText:this.helpText,validation:this.validation,policies:this.policies},d=typeof this.defaultValue=="string"?this.defaultValue:null,p=typeof this.defaultValue=="number"?this.defaultValue:null,n=typeof this.defaultValue=="boolean"?this.defaultValue:null;switch(this.type){case"text":if(this.multiple){let i=null;if(Array.isArray(this.defaultValue)){i=[];for(const t of this.defaultValue)typeof t=="string"&&i.push(t);i.length===0&&(i=null)}return o.serialize({...s,type:"text",multiple:!0,defaultValue:i,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:`${t.value}`})):null})}return o.serialize({...s,type:"text",multiple:!1,defaultValue:d,options:this.options?this.options.map(i=>({id:i.id,label:i.label,value:`${i.value}`})):null});case"number":if(this.multiple){let i=null;if(Array.isArray(this.defaultValue)){i=[];for(const t of this.defaultValue)typeof t=="number"&&i.push(t);i.length===0&&(i=null)}return o.serialize({...s,type:"number",multiple:!0,defaultValue:i,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:Number(t.value)})):null})}return o.serialize({...s,type:"number",multiple:!1,defaultValue:p,options:this.options?this.options.map(i=>({id:i.id,label:i.label,value:Number(i.value)})):null});case"boolean":if(this.multiple){let i=null;if(Array.isArray(this.defaultValue)){i=[];for(const t of this.defaultValue)typeof t=="boolean"&&i.push(t);i.length===0&&(i=null)}return o.serialize({...s,type:"boolean",multiple:!0,defaultValue:i,options:this.options?this.options.map(t=>({id:t.id,label:t.label,value:!!t.value})):null})}return o.serialize({...s,type:"boolean",multiple:!1,defaultValue:n,options:this.options?this.options.map(i=>({id:i.id,label:i.label,value:!!i.value})):null});default:throw new Error("Unsupported field type")}}}},x=e=>{const a=[],l=[],s=[],d=[],p=[];return{id:e.id,component:e.component,type:e.type,name:e.name,decide:e.decide,targets:e.targets,steps:a,nodes:l,edges:s,fields:p,conditionals:d,addStep(n,i){let t=i==null?void 0:i.node;this.nodes.length===0&&(t=c({type:"origin"},this),this.nodes.push(t));const r="serialize"in n?n:N(n,this);if(t){if(!r.node)throw new Error("todo no node");const u=h({sourceNode:t,destinationNode:r.node,sourceNodeHandle:null},this);this.edges.push(u)}return r.fields.length>0&&r.fields.forEach(u=>{this.fields.includes(u)||this.fields.push(u)}),this.steps.includes(r)||(this.steps.push(r),r.node&&this.nodes.push(r.node)),r},addConditional(n,i){let t=i==null?void 0:i.node;this.nodes.length===0&&(t=c({type:"origin"},this),this.nodes.push(t));const r="serialize"in n?n:m(n,this);if(t){if(!r.node)throw new Error("todo no node");const u=h({sourceNode:t,destinationNode:r.node,sourceNodeHandle:null},this);this.edges.push(u)}return this.conditionals.includes(r)||(this.conditionals.push(r),r.node&&this.nodes.push(r.node)),r},addExperience(n,i){let t=i==null?void 0:i.node;this.nodes.length===0&&(t=c({type:"origin"},this),this.nodes.push(t));const r=c({type:"experience",experience:n},this);if(this.nodes.push(r),t){const u=h({sourceNode:t,destinationNode:r,sourceNodeHandle:null},this);this.edges.push(u)}return n},addField(n,i){const t="serialize"in n?n:y(n);return i&&i.fields.push(t),this.fields.includes(t)||this.fields.push(t),t},serialize(){return o.serialize({id:this.id,type:this.type,component:this.component,name:this.name,decide:this.decide,targets:this.targets,steps:this.steps.map(n=>o.deserialize(n.serialize())),nodes:this.nodes.map(n=>o.deserialize(n.serialize())),edges:this.edges.map(n=>o.deserialize(n.serialize())),conditionals:this.conditionals.map(n=>o.deserialize(n.serialize())),fields:this.fields.map(n=>o.deserialize(n.serialize()))})}}};exports.createConditional=m;exports.createEdge=h;exports.createExperience=x;exports.createExperiencePlugin=g;exports.createField=y;exports.createNode=c;exports.createStep=z;exports.serialization=o;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
import { g as f } from "../../../id-BW-g3y32.js";
|
|
2
|
-
const
|
|
3
|
-
serialize(
|
|
4
|
-
return JSON.stringify(
|
|
2
|
+
const r = {
|
|
3
|
+
serialize(e) {
|
|
4
|
+
return JSON.stringify(e);
|
|
5
5
|
},
|
|
6
|
-
deserialize(
|
|
7
|
-
return JSON.parse(
|
|
6
|
+
deserialize(e) {
|
|
7
|
+
return JSON.parse(e);
|
|
8
8
|
}
|
|
9
|
-
}, b = (
|
|
9
|
+
}, b = (e) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (a) => {
|
|
12
|
-
|
|
13
|
-
const s =
|
|
14
|
-
o.component =
|
|
15
|
-
a.registerField(
|
|
12
|
+
e.experiences.forEach((l) => {
|
|
13
|
+
const s = l.serialize(), o = r.deserialize(s);
|
|
14
|
+
o.component = l.component, a.registerExperience(o), o.fields.forEach((c) => {
|
|
15
|
+
a.registerField(c);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
|
|
19
|
+
}), x = (e) => ({
|
|
20
|
+
id: f("step"),
|
|
21
|
+
label: e.label,
|
|
22
|
+
fields: e.fields ?? [],
|
|
23
|
+
addField(a) {
|
|
24
|
+
var s, o;
|
|
25
|
+
const l = "serialize" in a ? a : m(a);
|
|
26
|
+
return (s = this.fields) != null && s.includes(l) || (o = this.fields) == null || o.push(l), l;
|
|
27
|
+
}
|
|
28
|
+
}), y = (e, a) => {
|
|
29
|
+
const l = {
|
|
21
30
|
id: f("step"),
|
|
22
|
-
label:
|
|
31
|
+
label: e.label,
|
|
23
32
|
experience: a,
|
|
24
|
-
fields: [],
|
|
33
|
+
fields: e.fields ?? [],
|
|
25
34
|
node: null,
|
|
26
35
|
nextStep(s) {
|
|
27
36
|
return this.experience.addStep(s, this);
|
|
@@ -36,27 +45,27 @@ const l = {
|
|
|
36
45
|
return this.experience.addField(s, this);
|
|
37
46
|
},
|
|
38
47
|
serialize() {
|
|
39
|
-
return
|
|
48
|
+
return r.serialize({
|
|
40
49
|
id: this.id,
|
|
41
50
|
label: this.label,
|
|
42
51
|
fieldIds: this.fields.map((s) => s.id)
|
|
43
52
|
});
|
|
44
53
|
}
|
|
45
54
|
};
|
|
46
|
-
return
|
|
47
|
-
},
|
|
48
|
-
const
|
|
55
|
+
return h({ step: l, type: "step" }, a), l;
|
|
56
|
+
}, z = () => [0, 0], h = (e, a) => {
|
|
57
|
+
const l = {
|
|
49
58
|
id: f("node"),
|
|
50
|
-
position:
|
|
59
|
+
position: z(),
|
|
51
60
|
experience: a
|
|
52
61
|
};
|
|
53
|
-
if (
|
|
62
|
+
if (e.type === "step") {
|
|
54
63
|
const o = {
|
|
55
|
-
...
|
|
64
|
+
...l,
|
|
56
65
|
type: "step",
|
|
57
|
-
connectedStep:
|
|
66
|
+
connectedStep: e.step,
|
|
58
67
|
serialize() {
|
|
59
|
-
return
|
|
68
|
+
return r.serialize({
|
|
60
69
|
id: this.id,
|
|
61
70
|
type: this.type,
|
|
62
71
|
stepId: this.connectedStep.id,
|
|
@@ -67,13 +76,13 @@ const l = {
|
|
|
67
76
|
};
|
|
68
77
|
return o.connectedStep.node = o, o;
|
|
69
78
|
}
|
|
70
|
-
if (
|
|
79
|
+
if (e.type === "conditional") {
|
|
71
80
|
const o = {
|
|
72
|
-
...
|
|
81
|
+
...l,
|
|
73
82
|
type: "conditional",
|
|
74
|
-
connectedConditional:
|
|
83
|
+
connectedConditional: e.conditional,
|
|
75
84
|
serialize() {
|
|
76
|
-
return
|
|
85
|
+
return r.serialize({
|
|
77
86
|
id: this.id,
|
|
78
87
|
type: this.type,
|
|
79
88
|
conditionalId: this.connectedConditional.id,
|
|
@@ -83,12 +92,12 @@ const l = {
|
|
|
83
92
|
};
|
|
84
93
|
return o.connectedConditional.node = o, o;
|
|
85
94
|
}
|
|
86
|
-
return
|
|
87
|
-
...
|
|
95
|
+
return e.type === "experience" ? {
|
|
96
|
+
...l,
|
|
88
97
|
type: "experience",
|
|
89
|
-
connectedExperience:
|
|
98
|
+
connectedExperience: e.experience,
|
|
90
99
|
serialize() {
|
|
91
|
-
return
|
|
100
|
+
return r.serialize({
|
|
92
101
|
id: this.id,
|
|
93
102
|
type: this.type,
|
|
94
103
|
experienceId: this.connectedExperience.id,
|
|
@@ -96,34 +105,34 @@ const l = {
|
|
|
96
105
|
});
|
|
97
106
|
}
|
|
98
107
|
} : {
|
|
99
|
-
...
|
|
108
|
+
...l,
|
|
100
109
|
type: "origin",
|
|
101
110
|
serialize() {
|
|
102
|
-
return
|
|
111
|
+
return r.serialize({
|
|
103
112
|
id: this.id,
|
|
104
113
|
type: this.type,
|
|
105
114
|
position: this.position
|
|
106
115
|
});
|
|
107
116
|
}
|
|
108
117
|
};
|
|
109
|
-
}, p = (
|
|
118
|
+
}, p = (e, a) => ({
|
|
110
119
|
id: f("edge"),
|
|
111
|
-
sourceNode:
|
|
112
|
-
sourceNodeHandle:
|
|
113
|
-
destinationNode:
|
|
120
|
+
sourceNode: e.sourceNode,
|
|
121
|
+
sourceNodeHandle: e.sourceNodeHandle,
|
|
122
|
+
destinationNode: e.destinationNode,
|
|
114
123
|
experience: a,
|
|
115
124
|
serialize() {
|
|
116
|
-
return
|
|
125
|
+
return r.serialize({
|
|
117
126
|
id: this.id,
|
|
118
127
|
sourceNodeHandle: this.sourceNodeHandle ?? void 0,
|
|
119
128
|
sourceNodeId: this.sourceNode.id,
|
|
120
129
|
destinationNodeId: this.destinationNode.id
|
|
121
130
|
});
|
|
122
131
|
}
|
|
123
|
-
}), N = (
|
|
124
|
-
const
|
|
132
|
+
}), N = (e, a) => {
|
|
133
|
+
const l = {
|
|
125
134
|
id: f("conditional"),
|
|
126
|
-
condition:
|
|
135
|
+
condition: e.condition,
|
|
127
136
|
node: null,
|
|
128
137
|
experience: a,
|
|
129
138
|
addTrue(s) {
|
|
@@ -145,31 +154,31 @@ const l = {
|
|
|
145
154
|
this.experience.edges.push(o);
|
|
146
155
|
},
|
|
147
156
|
serialize() {
|
|
148
|
-
return
|
|
157
|
+
return r.serialize({
|
|
149
158
|
id: this.id,
|
|
150
159
|
condition: this.condition
|
|
151
160
|
});
|
|
152
161
|
}
|
|
153
162
|
};
|
|
154
|
-
return
|
|
155
|
-
},
|
|
156
|
-
var
|
|
163
|
+
return h({ conditional: l, type: "conditional" }, a), l;
|
|
164
|
+
}, m = (e) => {
|
|
165
|
+
var l;
|
|
157
166
|
return {
|
|
158
|
-
id:
|
|
159
|
-
name:
|
|
160
|
-
type:
|
|
161
|
-
label:
|
|
162
|
-
placeholder:
|
|
163
|
-
description:
|
|
164
|
-
helpText:
|
|
165
|
-
defaultValue:
|
|
166
|
-
multiple:
|
|
167
|
-
validation:
|
|
168
|
-
required:
|
|
169
|
-
options: ((
|
|
167
|
+
id: e.id,
|
|
168
|
+
name: e.name,
|
|
169
|
+
type: e.type,
|
|
170
|
+
label: e.label,
|
|
171
|
+
placeholder: e.placeholder,
|
|
172
|
+
description: e.description,
|
|
173
|
+
helpText: e.helpText,
|
|
174
|
+
defaultValue: e.defaultValue,
|
|
175
|
+
multiple: e.multiple,
|
|
176
|
+
validation: e.validation,
|
|
177
|
+
required: e.required,
|
|
178
|
+
options: ((l = e.options) == null ? void 0 : l.map((s) => ({
|
|
170
179
|
...s
|
|
171
180
|
}))) || null,
|
|
172
|
-
policies:
|
|
181
|
+
policies: e.policies,
|
|
173
182
|
serialize() {
|
|
174
183
|
const s = {
|
|
175
184
|
id: this.id,
|
|
@@ -181,22 +190,22 @@ const l = {
|
|
|
181
190
|
helpText: this.helpText,
|
|
182
191
|
validation: this.validation,
|
|
183
192
|
policies: this.policies
|
|
184
|
-
}, o = typeof this.defaultValue == "string" ? this.defaultValue : null,
|
|
193
|
+
}, o = typeof this.defaultValue == "string" ? this.defaultValue : null, c = typeof this.defaultValue == "number" ? this.defaultValue : null, n = typeof this.defaultValue == "boolean" ? this.defaultValue : null;
|
|
185
194
|
switch (this.type) {
|
|
186
195
|
case "text":
|
|
187
196
|
if (this.multiple) {
|
|
188
|
-
let
|
|
197
|
+
let i = null;
|
|
189
198
|
if (Array.isArray(this.defaultValue)) {
|
|
190
|
-
|
|
199
|
+
i = [];
|
|
191
200
|
for (const t of this.defaultValue)
|
|
192
|
-
typeof t == "string" &&
|
|
193
|
-
|
|
201
|
+
typeof t == "string" && i.push(t);
|
|
202
|
+
i.length === 0 && (i = null);
|
|
194
203
|
}
|
|
195
|
-
return
|
|
204
|
+
return r.serialize({
|
|
196
205
|
...s,
|
|
197
206
|
type: "text",
|
|
198
207
|
multiple: !0,
|
|
199
|
-
defaultValue:
|
|
208
|
+
defaultValue: i,
|
|
200
209
|
options: this.options ? this.options.map((t) => ({
|
|
201
210
|
id: t.id,
|
|
202
211
|
label: t.label,
|
|
@@ -204,31 +213,31 @@ const l = {
|
|
|
204
213
|
})) : null
|
|
205
214
|
});
|
|
206
215
|
}
|
|
207
|
-
return
|
|
216
|
+
return r.serialize({
|
|
208
217
|
...s,
|
|
209
218
|
type: "text",
|
|
210
219
|
multiple: !1,
|
|
211
220
|
defaultValue: o,
|
|
212
|
-
options: this.options ? this.options.map((
|
|
213
|
-
id:
|
|
214
|
-
label:
|
|
215
|
-
value: `${
|
|
221
|
+
options: this.options ? this.options.map((i) => ({
|
|
222
|
+
id: i.id,
|
|
223
|
+
label: i.label,
|
|
224
|
+
value: `${i.value}`
|
|
216
225
|
})) : null
|
|
217
226
|
});
|
|
218
227
|
case "number":
|
|
219
228
|
if (this.multiple) {
|
|
220
|
-
let
|
|
229
|
+
let i = null;
|
|
221
230
|
if (Array.isArray(this.defaultValue)) {
|
|
222
|
-
|
|
231
|
+
i = [];
|
|
223
232
|
for (const t of this.defaultValue)
|
|
224
|
-
typeof t == "number" &&
|
|
225
|
-
|
|
233
|
+
typeof t == "number" && i.push(t);
|
|
234
|
+
i.length === 0 && (i = null);
|
|
226
235
|
}
|
|
227
|
-
return
|
|
236
|
+
return r.serialize({
|
|
228
237
|
...s,
|
|
229
238
|
type: "number",
|
|
230
239
|
multiple: !0,
|
|
231
|
-
defaultValue:
|
|
240
|
+
defaultValue: i,
|
|
232
241
|
options: this.options ? this.options.map((t) => ({
|
|
233
242
|
id: t.id,
|
|
234
243
|
label: t.label,
|
|
@@ -236,31 +245,31 @@ const l = {
|
|
|
236
245
|
})) : null
|
|
237
246
|
});
|
|
238
247
|
}
|
|
239
|
-
return
|
|
248
|
+
return r.serialize({
|
|
240
249
|
...s,
|
|
241
250
|
type: "number",
|
|
242
251
|
multiple: !1,
|
|
243
|
-
defaultValue:
|
|
244
|
-
options: this.options ? this.options.map((
|
|
245
|
-
id:
|
|
246
|
-
label:
|
|
247
|
-
value: Number(
|
|
252
|
+
defaultValue: c,
|
|
253
|
+
options: this.options ? this.options.map((i) => ({
|
|
254
|
+
id: i.id,
|
|
255
|
+
label: i.label,
|
|
256
|
+
value: Number(i.value)
|
|
248
257
|
})) : null
|
|
249
258
|
});
|
|
250
259
|
case "boolean":
|
|
251
260
|
if (this.multiple) {
|
|
252
|
-
let
|
|
261
|
+
let i = null;
|
|
253
262
|
if (Array.isArray(this.defaultValue)) {
|
|
254
|
-
|
|
263
|
+
i = [];
|
|
255
264
|
for (const t of this.defaultValue)
|
|
256
|
-
typeof t == "boolean" &&
|
|
257
|
-
|
|
265
|
+
typeof t == "boolean" && i.push(t);
|
|
266
|
+
i.length === 0 && (i = null);
|
|
258
267
|
}
|
|
259
|
-
return
|
|
268
|
+
return r.serialize({
|
|
260
269
|
...s,
|
|
261
270
|
type: "boolean",
|
|
262
271
|
multiple: !0,
|
|
263
|
-
defaultValue:
|
|
272
|
+
defaultValue: i,
|
|
264
273
|
options: this.options ? this.options.map((t) => ({
|
|
265
274
|
id: t.id,
|
|
266
275
|
label: t.label,
|
|
@@ -268,15 +277,15 @@ const l = {
|
|
|
268
277
|
})) : null
|
|
269
278
|
});
|
|
270
279
|
}
|
|
271
|
-
return
|
|
280
|
+
return r.serialize({
|
|
272
281
|
...s,
|
|
273
282
|
type: "boolean",
|
|
274
283
|
multiple: !1,
|
|
275
284
|
defaultValue: n,
|
|
276
|
-
options: this.options ? this.options.map((
|
|
277
|
-
id:
|
|
278
|
-
label:
|
|
279
|
-
value: !!
|
|
285
|
+
options: this.options ? this.options.map((i) => ({
|
|
286
|
+
id: i.id,
|
|
287
|
+
label: i.label,
|
|
288
|
+
value: !!i.value
|
|
280
289
|
})) : null
|
|
281
290
|
});
|
|
282
291
|
// todo: support for object type fields
|
|
@@ -302,85 +311,87 @@ const l = {
|
|
|
302
311
|
}
|
|
303
312
|
}
|
|
304
313
|
};
|
|
305
|
-
},
|
|
306
|
-
const a = [],
|
|
314
|
+
}, V = (e) => {
|
|
315
|
+
const a = [], l = [], s = [], o = [], c = [];
|
|
307
316
|
return {
|
|
308
|
-
id:
|
|
309
|
-
component:
|
|
310
|
-
type:
|
|
311
|
-
name:
|
|
312
|
-
decide:
|
|
313
|
-
targets:
|
|
317
|
+
id: e.id,
|
|
318
|
+
component: e.component,
|
|
319
|
+
type: e.type,
|
|
320
|
+
name: e.name,
|
|
321
|
+
decide: e.decide,
|
|
322
|
+
targets: e.targets,
|
|
314
323
|
steps: a,
|
|
315
|
-
nodes:
|
|
324
|
+
nodes: l,
|
|
316
325
|
edges: s,
|
|
317
|
-
fields:
|
|
326
|
+
fields: c,
|
|
318
327
|
conditionals: o,
|
|
319
|
-
addStep(n,
|
|
320
|
-
let t =
|
|
321
|
-
this.nodes.length === 0 && (t =
|
|
322
|
-
const
|
|
328
|
+
addStep(n, i) {
|
|
329
|
+
let t = i == null ? void 0 : i.node;
|
|
330
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
331
|
+
const d = "serialize" in n ? n : y(n, this);
|
|
323
332
|
if (t) {
|
|
324
|
-
if (!
|
|
333
|
+
if (!d.node)
|
|
325
334
|
throw new Error("todo no node");
|
|
326
|
-
const
|
|
327
|
-
{ sourceNode: t, destinationNode:
|
|
335
|
+
const u = p(
|
|
336
|
+
{ sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
|
|
328
337
|
this
|
|
329
338
|
);
|
|
330
|
-
this.edges.push(
|
|
339
|
+
this.edges.push(u);
|
|
331
340
|
}
|
|
332
|
-
return
|
|
341
|
+
return d.fields.length > 0 && d.fields.forEach((u) => {
|
|
342
|
+
this.fields.includes(u) || this.fields.push(u);
|
|
343
|
+
}), this.steps.includes(d) || (this.steps.push(d), d.node && this.nodes.push(d.node)), d;
|
|
333
344
|
},
|
|
334
|
-
addConditional(n,
|
|
335
|
-
let t =
|
|
336
|
-
this.nodes.length === 0 && (t =
|
|
337
|
-
const
|
|
345
|
+
addConditional(n, i) {
|
|
346
|
+
let t = i == null ? void 0 : i.node;
|
|
347
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
348
|
+
const d = "serialize" in n ? n : N(n, this);
|
|
338
349
|
if (t) {
|
|
339
|
-
if (!
|
|
350
|
+
if (!d.node)
|
|
340
351
|
throw new Error("todo no node");
|
|
341
|
-
const
|
|
342
|
-
{ sourceNode: t, destinationNode:
|
|
352
|
+
const u = p(
|
|
353
|
+
{ sourceNode: t, destinationNode: d.node, sourceNodeHandle: null },
|
|
343
354
|
this
|
|
344
355
|
);
|
|
345
|
-
this.edges.push(
|
|
356
|
+
this.edges.push(u);
|
|
346
357
|
}
|
|
347
|
-
return this.conditionals.includes(
|
|
358
|
+
return this.conditionals.includes(d) || (this.conditionals.push(d), d.node && this.nodes.push(d.node)), d;
|
|
348
359
|
},
|
|
349
|
-
addExperience(n,
|
|
350
|
-
let t =
|
|
351
|
-
this.nodes.length === 0 && (t =
|
|
352
|
-
const
|
|
360
|
+
addExperience(n, i) {
|
|
361
|
+
let t = i == null ? void 0 : i.node;
|
|
362
|
+
this.nodes.length === 0 && (t = h({ type: "origin" }, this), this.nodes.push(t));
|
|
363
|
+
const d = h(
|
|
353
364
|
{ type: "experience", experience: n },
|
|
354
365
|
this
|
|
355
366
|
);
|
|
356
|
-
if (this.nodes.push(
|
|
357
|
-
const
|
|
358
|
-
{ sourceNode: t, destinationNode:
|
|
367
|
+
if (this.nodes.push(d), t) {
|
|
368
|
+
const u = p(
|
|
369
|
+
{ sourceNode: t, destinationNode: d, sourceNodeHandle: null },
|
|
359
370
|
this
|
|
360
371
|
);
|
|
361
|
-
this.edges.push(
|
|
372
|
+
this.edges.push(u);
|
|
362
373
|
}
|
|
363
374
|
return n;
|
|
364
375
|
},
|
|
365
|
-
addField(n,
|
|
366
|
-
const t = "serialize" in n ? n :
|
|
367
|
-
return
|
|
376
|
+
addField(n, i) {
|
|
377
|
+
const t = "serialize" in n ? n : m(n);
|
|
378
|
+
return i && i.fields.push(t), this.fields.includes(t) || this.fields.push(t), t;
|
|
368
379
|
},
|
|
369
380
|
serialize() {
|
|
370
|
-
return
|
|
381
|
+
return r.serialize({
|
|
371
382
|
id: this.id,
|
|
372
383
|
type: this.type,
|
|
373
384
|
component: this.component,
|
|
374
385
|
name: this.name,
|
|
375
386
|
decide: this.decide,
|
|
376
387
|
targets: this.targets,
|
|
377
|
-
steps: this.steps.map((n) =>
|
|
378
|
-
nodes: this.nodes.map((n) =>
|
|
379
|
-
edges: this.edges.map((n) =>
|
|
388
|
+
steps: this.steps.map((n) => r.deserialize(n.serialize())),
|
|
389
|
+
nodes: this.nodes.map((n) => r.deserialize(n.serialize())),
|
|
390
|
+
edges: this.edges.map((n) => r.deserialize(n.serialize())),
|
|
380
391
|
conditionals: this.conditionals.map(
|
|
381
|
-
(n) =>
|
|
392
|
+
(n) => r.deserialize(n.serialize())
|
|
382
393
|
),
|
|
383
|
-
fields: this.fields.map((n) =>
|
|
394
|
+
fields: this.fields.map((n) => r.deserialize(n.serialize()))
|
|
384
395
|
});
|
|
385
396
|
}
|
|
386
397
|
};
|
|
@@ -388,10 +399,10 @@ const l = {
|
|
|
388
399
|
export {
|
|
389
400
|
N as createConditional,
|
|
390
401
|
p as createEdge,
|
|
391
|
-
|
|
402
|
+
V as createExperience,
|
|
392
403
|
b as createExperiencePlugin,
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
404
|
+
m as createField,
|
|
405
|
+
h as createNode,
|
|
406
|
+
x as createStep,
|
|
407
|
+
r as serialization
|
|
397
408
|
};
|
|
@@ -19,6 +19,7 @@ export interface SerializableStep extends Nodeable {
|
|
|
19
19
|
}
|
|
20
20
|
export interface CreateStepOptions {
|
|
21
21
|
label: string;
|
|
22
|
+
fields?: SerializableField[];
|
|
22
23
|
}
|
|
23
24
|
export type SerializableNode = SerializableStepNode | SerializableConditionalNode | SerializableLaunchExperienceNode | SerializableOriginNode;
|
|
24
25
|
export interface SerializableBaseNode {
|
|
@@ -117,7 +118,7 @@ export interface SerializableExperience {
|
|
|
117
118
|
edges: SerializableEdge[];
|
|
118
119
|
fields: SerializableField[];
|
|
119
120
|
conditionals: SerializableConditional[];
|
|
120
|
-
addStep: (stepOptions: CreateStepOptions | SerializableStep, after?: {
|
|
121
|
+
addStep: (stepOptions: CreateStepOptions | SerializableStep | OrphanStep, after?: {
|
|
121
122
|
node: SerializableNode | null;
|
|
122
123
|
}) => SerializableStep;
|
|
123
124
|
addConditional: (conditionalOptions: CreateConditionalOptions | SerializableConditional, after?: {
|
|
@@ -137,7 +138,11 @@ export interface CreateExperienceOptions {
|
|
|
137
138
|
component?: AdaptedComponent;
|
|
138
139
|
type: string;
|
|
139
140
|
}
|
|
140
|
-
export
|
|
141
|
+
export type OrphanStep = Omit<SerializableStep, 'nextStep' | 'nextConditional' | 'addNextExperience' | 'node' | 'serialize' | 'addField' | 'experience'> & {
|
|
142
|
+
addField: (fieldOrFieldOptions: CreateFieldOptions | SerializableField) => void;
|
|
143
|
+
};
|
|
144
|
+
export declare const createStep: (stepOptions: CreateStepOptions) => OrphanStep;
|
|
145
|
+
export declare const bindExperienceStep: (stepOptions: CreateStepOptions | OrphanStep, experience: SerializableExperience) => SerializableStep;
|
|
141
146
|
export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
|
|
142
147
|
export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
|
|
143
148
|
export declare const createConditional: (conditionalOptions: CreateConditionalOptions, experience: SerializableExperience) => SerializableConditional;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,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,QAAQ;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,EAAE,CAAA;IAC3B,UAAU,EAAE,sBAAsB,CAAA;IAClC,QAAQ,EAAE,CAAC,WAAW,EAAE,iBAAiB,GAAG,gBAAgB,KAAK,gBAAgB,CAAA;IACjF,eAAe,EAAE,CACf,kBAAkB,EAAE,wBAAwB,GAAG,uBAAuB,KACnE,uBAAuB,CAAA;IAC5B,iBAAiB,EAAE,CAAC,UAAU,EAAE,sBAAsB,KAAK,sBAAsB,CAAA;IACjF,QAAQ,EAAE,CAAC,YAAY,EAAE,kBAAkB,GAAG,iBAAiB,KAAK,iBAAiB,CAAA;IACrF,SAAS,EAAE,MAAM,UAAU,CAAC,cAAc,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"create-experience.d.ts","sourceRoot":"","sources":["../../../../src/plugins/create-experience/create-experience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,MAAM,oBAAoB,CAAA;AACnD,OAAO,KAAK,EACV,KAAK,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EAClB,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,QAAQ;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,iBAAiB,EAAE,CAAA;I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