@picked/client 0.0.5-next.1 → 0.0.5
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 +143 -154
- package/dist/types/plugins/create-experience/create-experience.d.ts +2 -7
- 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.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
|
+
"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"),I=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]&&I.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]&&I.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 I.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]&&I.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]&&I.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 x=await P;return{id:S.id,bucket:x,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(x=>x.value),P=Array.isArray(l)?l:[l];Array.isArray(l)&&(P.every(x=>F.includes(x))||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 Ie=()=>"0.0.5";function xe(){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}));I.logger("info","Picked client initializing."),this.organizationId=e.organizationId,this.projectId=e.projectId,this.options=Object.freeze(e),this.apiUrl=e.apiUrl||xe(),this.setupPlugins(),this.setupFeatures(),this.setupPredicates(),this.eventBus({type:"initialized",version:Ie()}),I.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){I.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"){I.logger("warn",`Predicate "${s}" is not a function.`);return}this.registerPredicate(s,o)})}getPluginConfig(e){return this.plugins[e]??{}}}y(A,"logger",I.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(i){return JSON.stringify(i)},deserialize(i){return JSON.parse(i)}},N=i=>({name:"create-experience",setup:a=>{i.experiences.forEach(d=>{const s=d.serialize(),l=o.deserialize(s);l.component=d.component,a.registerExperience(l),l.fields.forEach(h=>{a.registerField(h)})})}}),y=(i,a)=>{const d={id:f.generateId("step"),label:i.label,experience:a,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 u({step:d,type:"step"},a),d},z=()=>[0,0],u=(i,a)=>{const d={id:f.generateId("node"),position:z(),experience:a};if(i.type==="step"){const l={...d,type:"step",connectedStep:i.step,serialize(){return o.serialize({id:this.id,type:this.type,stepId:this.connectedStep.id,position:this.position,label:this.connectedStep.label})}};return l.connectedStep.node=l,l}if(i.type==="conditional"){const l={...d,type:"conditional",connectedConditional:i.conditional,serialize(){return o.serialize({id:this.id,type:this.type,conditionalId:this.connectedConditional.id,position:this.position})}};return l.connectedConditional.node=l,l}return i.type==="experience"?{...d,type:"experience",connectedExperience:i.experience,serialize(){return o.serialize({id:this.id,type:this.type,experienceId:this.connectedExperience.id,position:this.position})}}:{...d,type:"origin",serialize(){return o.serialize({id:this.id,type:this.type,position:this.position})}}},c=(i,a)=>({id:f.generateId("edge"),sourceNode:i.sourceNode,sourceNodeHandle:i.sourceNodeHandle,destinationNode:i.destinationNode,experience:a,serialize(){return o.serialize({id:this.id,sourceNodeHandle:this.sourceNodeHandle??void 0,sourceNodeId:this.sourceNode.id,destinationNodeId:this.destinationNode.id})}}),m=(i,a)=>{const d={id:f.generateId("conditional"),condition:i.condition,node:null,experience:a,addTrue(s){if(!this.node||!s.node)throw new Error("todo no node");const l=c({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"true"},this.experience);this.experience.edges.push(l)},addFalse(s){if(!this.node||!s.node)throw new Error("todo no node");const l=c({sourceNode:this.node,destinationNode:s.node,sourceNodeHandle:"false"},this.experience);this.experience.edges.push(l)},serialize(){return o.serialize({id:this.id,condition:this.condition})}};return u({conditional:d,type:"conditional"},a),d},g=i=>{var d;return{id:i.id,name:i.name,type:i.type,label:i.label,placeholder:i.placeholder,description:i.description,helpText:i.helpText,defaultValue:i.defaultValue,multiple:i.multiple,validation:i.validation,required:i.required,options:((d=i.options)==null?void 0:d.map(s=>({...s})))||null,policies:i.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},l=typeof this.defaultValue=="string"?this.defaultValue:null,h=typeof this.defaultValue=="number"?this.defaultValue:null,n=typeof this.defaultValue=="boolean"?this.defaultValue:null;switch(this.type){case"text":if(this.multiple){let e=null;if(Array.isArray(this.defaultValue)){e=[];for(const t of this.defaultValue)typeof t=="string"&&e.push(t);e.length===0&&(e=null)}return o.serialize({...s,type:"text",multiple:!0,defaultValue:e,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:l,options:this.options?this.options.map(e=>({id:e.id,label:e.label,value:`${e.value}`})):null});case"number":if(this.multiple){let e=null;if(Array.isArray(this.defaultValue)){e=[];for(const t of this.defaultValue)typeof t=="number"&&e.push(t);e.length===0&&(e=null)}return o.serialize({...s,type:"number",multiple:!0,defaultValue:e,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:h,options:this.options?this.options.map(e=>({id:e.id,label:e.label,value:Number(e.value)})):null});case"boolean":if(this.multiple){let e=null;if(Array.isArray(this.defaultValue)){e=[];for(const t of this.defaultValue)typeof t=="boolean"&&e.push(t);e.length===0&&(e=null)}return o.serialize({...s,type:"boolean",multiple:!0,defaultValue:e,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(e=>({id:e.id,label:e.label,value:!!e.value})):null});default:throw new Error("Unsupported field type")}}}},b=i=>{const a=[],d=[],s=[],l=[],h=[];return{id:i.id,component:i.component,type:i.type,name:i.name,decide:i.decide,targets:i.targets,steps:a,nodes:d,edges:s,fields:h,conditionals:l,addStep(n,e){let t=e==null?void 0:e.node;this.nodes.length===0&&(t=u({type:"origin"},this),this.nodes.push(t));const r="serialize"in n?n:y(n,this);if(t){if(!r.node)throw new Error("todo no node");const p=c({sourceNode:t,destinationNode:r.node,sourceNodeHandle:null},this);this.edges.push(p)}return this.steps.includes(r)||(this.steps.push(r),r.node&&this.nodes.push(r.node)),r},addConditional(n,e){let t=e==null?void 0:e.node;this.nodes.length===0&&(t=u({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 p=c({sourceNode:t,destinationNode:r.node,sourceNodeHandle:null},this);this.edges.push(p)}return this.conditionals.includes(r)||(this.conditionals.push(r),r.node&&this.nodes.push(r.node)),r},addExperience(n,e){let t=e==null?void 0:e.node;this.nodes.length===0&&(t=u({type:"origin"},this),this.nodes.push(t));const r=u({type:"experience",experience:n},this);if(this.nodes.push(r),t){const p=c({sourceNode:t,destinationNode:r,sourceNodeHandle:null},this);this.edges.push(p)}return n},addField(n,e){const t="serialize"in n?n:g(n);return e&&e.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=c;exports.createExperience=b;exports.createExperiencePlugin=N;exports.createField=g;exports.createNode=u;exports.createStep=y;exports.serialization=o;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
1
|
import { g as f } from "../../../id-BW-g3y32.js";
|
|
2
|
-
const
|
|
3
|
-
serialize(
|
|
4
|
-
return JSON.stringify(
|
|
2
|
+
const l = {
|
|
3
|
+
serialize(i) {
|
|
4
|
+
return JSON.stringify(i);
|
|
5
5
|
},
|
|
6
|
-
deserialize(
|
|
7
|
-
return JSON.parse(
|
|
6
|
+
deserialize(i) {
|
|
7
|
+
return JSON.parse(i);
|
|
8
8
|
}
|
|
9
|
-
}, b = (
|
|
9
|
+
}, b = (i) => ({
|
|
10
10
|
name: "create-experience",
|
|
11
11
|
setup: (a) => {
|
|
12
|
-
|
|
13
|
-
const s =
|
|
14
|
-
o.component =
|
|
15
|
-
a.registerField(
|
|
12
|
+
i.experiences.forEach((d) => {
|
|
13
|
+
const s = d.serialize(), o = l.deserialize(s);
|
|
14
|
+
o.component = d.component, a.registerExperience(o), o.fields.forEach((h) => {
|
|
15
|
+
a.registerField(h);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
|
|
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 = {
|
|
19
|
+
}), m = (i, a) => {
|
|
20
|
+
const d = {
|
|
30
21
|
id: f("step"),
|
|
31
|
-
label:
|
|
22
|
+
label: i.label,
|
|
32
23
|
experience: a,
|
|
33
|
-
fields:
|
|
24
|
+
fields: [],
|
|
34
25
|
node: null,
|
|
35
26
|
nextStep(s) {
|
|
36
27
|
return this.experience.addStep(s, this);
|
|
@@ -45,27 +36,27 @@ const r = {
|
|
|
45
36
|
return this.experience.addField(s, this);
|
|
46
37
|
},
|
|
47
38
|
serialize() {
|
|
48
|
-
return
|
|
39
|
+
return l.serialize({
|
|
49
40
|
id: this.id,
|
|
50
41
|
label: this.label,
|
|
51
42
|
fieldIds: this.fields.map((s) => s.id)
|
|
52
43
|
});
|
|
53
44
|
}
|
|
54
45
|
};
|
|
55
|
-
return
|
|
56
|
-
},
|
|
57
|
-
const
|
|
46
|
+
return u({ step: d, type: "step" }, a), d;
|
|
47
|
+
}, y = () => [0, 0], u = (i, a) => {
|
|
48
|
+
const d = {
|
|
58
49
|
id: f("node"),
|
|
59
|
-
position:
|
|
50
|
+
position: y(),
|
|
60
51
|
experience: a
|
|
61
52
|
};
|
|
62
|
-
if (
|
|
53
|
+
if (i.type === "step") {
|
|
63
54
|
const o = {
|
|
64
|
-
...
|
|
55
|
+
...d,
|
|
65
56
|
type: "step",
|
|
66
|
-
connectedStep:
|
|
57
|
+
connectedStep: i.step,
|
|
67
58
|
serialize() {
|
|
68
|
-
return
|
|
59
|
+
return l.serialize({
|
|
69
60
|
id: this.id,
|
|
70
61
|
type: this.type,
|
|
71
62
|
stepId: this.connectedStep.id,
|
|
@@ -76,13 +67,13 @@ const r = {
|
|
|
76
67
|
};
|
|
77
68
|
return o.connectedStep.node = o, o;
|
|
78
69
|
}
|
|
79
|
-
if (
|
|
70
|
+
if (i.type === "conditional") {
|
|
80
71
|
const o = {
|
|
81
|
-
...
|
|
72
|
+
...d,
|
|
82
73
|
type: "conditional",
|
|
83
|
-
connectedConditional:
|
|
74
|
+
connectedConditional: i.conditional,
|
|
84
75
|
serialize() {
|
|
85
|
-
return
|
|
76
|
+
return l.serialize({
|
|
86
77
|
id: this.id,
|
|
87
78
|
type: this.type,
|
|
88
79
|
conditionalId: this.connectedConditional.id,
|
|
@@ -92,12 +83,12 @@ const r = {
|
|
|
92
83
|
};
|
|
93
84
|
return o.connectedConditional.node = o, o;
|
|
94
85
|
}
|
|
95
|
-
return
|
|
96
|
-
...
|
|
86
|
+
return i.type === "experience" ? {
|
|
87
|
+
...d,
|
|
97
88
|
type: "experience",
|
|
98
|
-
connectedExperience:
|
|
89
|
+
connectedExperience: i.experience,
|
|
99
90
|
serialize() {
|
|
100
|
-
return
|
|
91
|
+
return l.serialize({
|
|
101
92
|
id: this.id,
|
|
102
93
|
type: this.type,
|
|
103
94
|
experienceId: this.connectedExperience.id,
|
|
@@ -105,34 +96,34 @@ const r = {
|
|
|
105
96
|
});
|
|
106
97
|
}
|
|
107
98
|
} : {
|
|
108
|
-
...
|
|
99
|
+
...d,
|
|
109
100
|
type: "origin",
|
|
110
101
|
serialize() {
|
|
111
|
-
return
|
|
102
|
+
return l.serialize({
|
|
112
103
|
id: this.id,
|
|
113
104
|
type: this.type,
|
|
114
105
|
position: this.position
|
|
115
106
|
});
|
|
116
107
|
}
|
|
117
108
|
};
|
|
118
|
-
}, p = (
|
|
109
|
+
}, p = (i, a) => ({
|
|
119
110
|
id: f("edge"),
|
|
120
|
-
sourceNode:
|
|
121
|
-
sourceNodeHandle:
|
|
122
|
-
destinationNode:
|
|
111
|
+
sourceNode: i.sourceNode,
|
|
112
|
+
sourceNodeHandle: i.sourceNodeHandle,
|
|
113
|
+
destinationNode: i.destinationNode,
|
|
123
114
|
experience: a,
|
|
124
115
|
serialize() {
|
|
125
|
-
return
|
|
116
|
+
return l.serialize({
|
|
126
117
|
id: this.id,
|
|
127
118
|
sourceNodeHandle: this.sourceNodeHandle ?? void 0,
|
|
128
119
|
sourceNodeId: this.sourceNode.id,
|
|
129
120
|
destinationNodeId: this.destinationNode.id
|
|
130
121
|
});
|
|
131
122
|
}
|
|
132
|
-
}), N = (
|
|
133
|
-
const
|
|
123
|
+
}), N = (i, a) => {
|
|
124
|
+
const d = {
|
|
134
125
|
id: f("conditional"),
|
|
135
|
-
condition:
|
|
126
|
+
condition: i.condition,
|
|
136
127
|
node: null,
|
|
137
128
|
experience: a,
|
|
138
129
|
addTrue(s) {
|
|
@@ -154,31 +145,31 @@ const r = {
|
|
|
154
145
|
this.experience.edges.push(o);
|
|
155
146
|
},
|
|
156
147
|
serialize() {
|
|
157
|
-
return
|
|
148
|
+
return l.serialize({
|
|
158
149
|
id: this.id,
|
|
159
150
|
condition: this.condition
|
|
160
151
|
});
|
|
161
152
|
}
|
|
162
153
|
};
|
|
163
|
-
return
|
|
164
|
-
},
|
|
165
|
-
var
|
|
154
|
+
return u({ conditional: d, type: "conditional" }, a), d;
|
|
155
|
+
}, z = (i) => {
|
|
156
|
+
var d;
|
|
166
157
|
return {
|
|
167
|
-
id:
|
|
168
|
-
name:
|
|
169
|
-
type:
|
|
170
|
-
label:
|
|
171
|
-
placeholder:
|
|
172
|
-
description:
|
|
173
|
-
helpText:
|
|
174
|
-
defaultValue:
|
|
175
|
-
multiple:
|
|
176
|
-
validation:
|
|
177
|
-
required:
|
|
178
|
-
options: ((
|
|
158
|
+
id: i.id,
|
|
159
|
+
name: i.name,
|
|
160
|
+
type: i.type,
|
|
161
|
+
label: i.label,
|
|
162
|
+
placeholder: i.placeholder,
|
|
163
|
+
description: i.description,
|
|
164
|
+
helpText: i.helpText,
|
|
165
|
+
defaultValue: i.defaultValue,
|
|
166
|
+
multiple: i.multiple,
|
|
167
|
+
validation: i.validation,
|
|
168
|
+
required: i.required,
|
|
169
|
+
options: ((d = i.options) == null ? void 0 : d.map((s) => ({
|
|
179
170
|
...s
|
|
180
171
|
}))) || null,
|
|
181
|
-
policies:
|
|
172
|
+
policies: i.policies,
|
|
182
173
|
serialize() {
|
|
183
174
|
const s = {
|
|
184
175
|
id: this.id,
|
|
@@ -190,22 +181,22 @@ const r = {
|
|
|
190
181
|
helpText: this.helpText,
|
|
191
182
|
validation: this.validation,
|
|
192
183
|
policies: this.policies
|
|
193
|
-
}, o = typeof this.defaultValue == "string" ? this.defaultValue : null,
|
|
184
|
+
}, o = typeof this.defaultValue == "string" ? this.defaultValue : null, h = typeof this.defaultValue == "number" ? this.defaultValue : null, n = typeof this.defaultValue == "boolean" ? this.defaultValue : null;
|
|
194
185
|
switch (this.type) {
|
|
195
186
|
case "text":
|
|
196
187
|
if (this.multiple) {
|
|
197
|
-
let
|
|
188
|
+
let e = null;
|
|
198
189
|
if (Array.isArray(this.defaultValue)) {
|
|
199
|
-
|
|
190
|
+
e = [];
|
|
200
191
|
for (const t of this.defaultValue)
|
|
201
|
-
typeof t == "string" &&
|
|
202
|
-
|
|
192
|
+
typeof t == "string" && e.push(t);
|
|
193
|
+
e.length === 0 && (e = null);
|
|
203
194
|
}
|
|
204
|
-
return
|
|
195
|
+
return l.serialize({
|
|
205
196
|
...s,
|
|
206
197
|
type: "text",
|
|
207
198
|
multiple: !0,
|
|
208
|
-
defaultValue:
|
|
199
|
+
defaultValue: e,
|
|
209
200
|
options: this.options ? this.options.map((t) => ({
|
|
210
201
|
id: t.id,
|
|
211
202
|
label: t.label,
|
|
@@ -213,31 +204,31 @@ const r = {
|
|
|
213
204
|
})) : null
|
|
214
205
|
});
|
|
215
206
|
}
|
|
216
|
-
return
|
|
207
|
+
return l.serialize({
|
|
217
208
|
...s,
|
|
218
209
|
type: "text",
|
|
219
210
|
multiple: !1,
|
|
220
211
|
defaultValue: o,
|
|
221
|
-
options: this.options ? this.options.map((
|
|
222
|
-
id:
|
|
223
|
-
label:
|
|
224
|
-
value: `${
|
|
212
|
+
options: this.options ? this.options.map((e) => ({
|
|
213
|
+
id: e.id,
|
|
214
|
+
label: e.label,
|
|
215
|
+
value: `${e.value}`
|
|
225
216
|
})) : null
|
|
226
217
|
});
|
|
227
218
|
case "number":
|
|
228
219
|
if (this.multiple) {
|
|
229
|
-
let
|
|
220
|
+
let e = null;
|
|
230
221
|
if (Array.isArray(this.defaultValue)) {
|
|
231
|
-
|
|
222
|
+
e = [];
|
|
232
223
|
for (const t of this.defaultValue)
|
|
233
|
-
typeof t == "number" &&
|
|
234
|
-
|
|
224
|
+
typeof t == "number" && e.push(t);
|
|
225
|
+
e.length === 0 && (e = null);
|
|
235
226
|
}
|
|
236
|
-
return
|
|
227
|
+
return l.serialize({
|
|
237
228
|
...s,
|
|
238
229
|
type: "number",
|
|
239
230
|
multiple: !0,
|
|
240
|
-
defaultValue:
|
|
231
|
+
defaultValue: e,
|
|
241
232
|
options: this.options ? this.options.map((t) => ({
|
|
242
233
|
id: t.id,
|
|
243
234
|
label: t.label,
|
|
@@ -245,31 +236,31 @@ const r = {
|
|
|
245
236
|
})) : null
|
|
246
237
|
});
|
|
247
238
|
}
|
|
248
|
-
return
|
|
239
|
+
return l.serialize({
|
|
249
240
|
...s,
|
|
250
241
|
type: "number",
|
|
251
242
|
multiple: !1,
|
|
252
|
-
defaultValue:
|
|
253
|
-
options: this.options ? this.options.map((
|
|
254
|
-
id:
|
|
255
|
-
label:
|
|
256
|
-
value: Number(
|
|
243
|
+
defaultValue: h,
|
|
244
|
+
options: this.options ? this.options.map((e) => ({
|
|
245
|
+
id: e.id,
|
|
246
|
+
label: e.label,
|
|
247
|
+
value: Number(e.value)
|
|
257
248
|
})) : null
|
|
258
249
|
});
|
|
259
250
|
case "boolean":
|
|
260
251
|
if (this.multiple) {
|
|
261
|
-
let
|
|
252
|
+
let e = null;
|
|
262
253
|
if (Array.isArray(this.defaultValue)) {
|
|
263
|
-
|
|
254
|
+
e = [];
|
|
264
255
|
for (const t of this.defaultValue)
|
|
265
|
-
typeof t == "boolean" &&
|
|
266
|
-
|
|
256
|
+
typeof t == "boolean" && e.push(t);
|
|
257
|
+
e.length === 0 && (e = null);
|
|
267
258
|
}
|
|
268
|
-
return
|
|
259
|
+
return l.serialize({
|
|
269
260
|
...s,
|
|
270
261
|
type: "boolean",
|
|
271
262
|
multiple: !0,
|
|
272
|
-
defaultValue:
|
|
263
|
+
defaultValue: e,
|
|
273
264
|
options: this.options ? this.options.map((t) => ({
|
|
274
265
|
id: t.id,
|
|
275
266
|
label: t.label,
|
|
@@ -277,15 +268,15 @@ const r = {
|
|
|
277
268
|
})) : null
|
|
278
269
|
});
|
|
279
270
|
}
|
|
280
|
-
return
|
|
271
|
+
return l.serialize({
|
|
281
272
|
...s,
|
|
282
273
|
type: "boolean",
|
|
283
274
|
multiple: !1,
|
|
284
275
|
defaultValue: n,
|
|
285
|
-
options: this.options ? this.options.map((
|
|
286
|
-
id:
|
|
287
|
-
label:
|
|
288
|
-
value: !!
|
|
276
|
+
options: this.options ? this.options.map((e) => ({
|
|
277
|
+
id: e.id,
|
|
278
|
+
label: e.label,
|
|
279
|
+
value: !!e.value
|
|
289
280
|
})) : null
|
|
290
281
|
});
|
|
291
282
|
// todo: support for object type fields
|
|
@@ -311,87 +302,85 @@ const r = {
|
|
|
311
302
|
}
|
|
312
303
|
}
|
|
313
304
|
};
|
|
314
|
-
},
|
|
315
|
-
const a = [],
|
|
305
|
+
}, x = (i) => {
|
|
306
|
+
const a = [], d = [], s = [], o = [], h = [];
|
|
316
307
|
return {
|
|
317
|
-
id:
|
|
318
|
-
component:
|
|
319
|
-
type:
|
|
320
|
-
name:
|
|
321
|
-
decide:
|
|
322
|
-
targets:
|
|
308
|
+
id: i.id,
|
|
309
|
+
component: i.component,
|
|
310
|
+
type: i.type,
|
|
311
|
+
name: i.name,
|
|
312
|
+
decide: i.decide,
|
|
313
|
+
targets: i.targets,
|
|
323
314
|
steps: a,
|
|
324
|
-
nodes:
|
|
315
|
+
nodes: d,
|
|
325
316
|
edges: s,
|
|
326
|
-
fields:
|
|
317
|
+
fields: h,
|
|
327
318
|
conditionals: o,
|
|
328
|
-
addStep(n,
|
|
329
|
-
let t =
|
|
330
|
-
this.nodes.length === 0 && (t =
|
|
331
|
-
const
|
|
319
|
+
addStep(n, e) {
|
|
320
|
+
let t = e == null ? void 0 : e.node;
|
|
321
|
+
this.nodes.length === 0 && (t = u({ type: "origin" }, this), this.nodes.push(t));
|
|
322
|
+
const r = "serialize" in n ? n : m(n, this);
|
|
332
323
|
if (t) {
|
|
333
|
-
if (!
|
|
324
|
+
if (!r.node)
|
|
334
325
|
throw new Error("todo no node");
|
|
335
|
-
const
|
|
336
|
-
{ sourceNode: t, destinationNode:
|
|
326
|
+
const c = p(
|
|
327
|
+
{ sourceNode: t, destinationNode: r.node, sourceNodeHandle: null },
|
|
337
328
|
this
|
|
338
329
|
);
|
|
339
|
-
this.edges.push(
|
|
330
|
+
this.edges.push(c);
|
|
340
331
|
}
|
|
341
|
-
return
|
|
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;
|
|
332
|
+
return this.steps.includes(r) || (this.steps.push(r), r.node && this.nodes.push(r.node)), r;
|
|
344
333
|
},
|
|
345
|
-
addConditional(n,
|
|
346
|
-
let t =
|
|
347
|
-
this.nodes.length === 0 && (t =
|
|
348
|
-
const
|
|
334
|
+
addConditional(n, e) {
|
|
335
|
+
let t = e == null ? void 0 : e.node;
|
|
336
|
+
this.nodes.length === 0 && (t = u({ type: "origin" }, this), this.nodes.push(t));
|
|
337
|
+
const r = "serialize" in n ? n : N(n, this);
|
|
349
338
|
if (t) {
|
|
350
|
-
if (!
|
|
339
|
+
if (!r.node)
|
|
351
340
|
throw new Error("todo no node");
|
|
352
|
-
const
|
|
353
|
-
{ sourceNode: t, destinationNode:
|
|
341
|
+
const c = p(
|
|
342
|
+
{ sourceNode: t, destinationNode: r.node, sourceNodeHandle: null },
|
|
354
343
|
this
|
|
355
344
|
);
|
|
356
|
-
this.edges.push(
|
|
345
|
+
this.edges.push(c);
|
|
357
346
|
}
|
|
358
|
-
return this.conditionals.includes(
|
|
347
|
+
return this.conditionals.includes(r) || (this.conditionals.push(r), r.node && this.nodes.push(r.node)), r;
|
|
359
348
|
},
|
|
360
|
-
addExperience(n,
|
|
361
|
-
let t =
|
|
362
|
-
this.nodes.length === 0 && (t =
|
|
363
|
-
const
|
|
349
|
+
addExperience(n, e) {
|
|
350
|
+
let t = e == null ? void 0 : e.node;
|
|
351
|
+
this.nodes.length === 0 && (t = u({ type: "origin" }, this), this.nodes.push(t));
|
|
352
|
+
const r = u(
|
|
364
353
|
{ type: "experience", experience: n },
|
|
365
354
|
this
|
|
366
355
|
);
|
|
367
|
-
if (this.nodes.push(
|
|
368
|
-
const
|
|
369
|
-
{ sourceNode: t, destinationNode:
|
|
356
|
+
if (this.nodes.push(r), t) {
|
|
357
|
+
const c = p(
|
|
358
|
+
{ sourceNode: t, destinationNode: r, sourceNodeHandle: null },
|
|
370
359
|
this
|
|
371
360
|
);
|
|
372
|
-
this.edges.push(
|
|
361
|
+
this.edges.push(c);
|
|
373
362
|
}
|
|
374
363
|
return n;
|
|
375
364
|
},
|
|
376
|
-
addField(n,
|
|
377
|
-
const t = "serialize" in n ? n :
|
|
378
|
-
return
|
|
365
|
+
addField(n, e) {
|
|
366
|
+
const t = "serialize" in n ? n : z(n);
|
|
367
|
+
return e && e.fields.push(t), this.fields.includes(t) || this.fields.push(t), t;
|
|
379
368
|
},
|
|
380
369
|
serialize() {
|
|
381
|
-
return
|
|
370
|
+
return l.serialize({
|
|
382
371
|
id: this.id,
|
|
383
372
|
type: this.type,
|
|
384
373
|
component: this.component,
|
|
385
374
|
name: this.name,
|
|
386
375
|
decide: this.decide,
|
|
387
376
|
targets: this.targets,
|
|
388
|
-
steps: this.steps.map((n) =>
|
|
389
|
-
nodes: this.nodes.map((n) =>
|
|
390
|
-
edges: this.edges.map((n) =>
|
|
377
|
+
steps: this.steps.map((n) => l.deserialize(n.serialize())),
|
|
378
|
+
nodes: this.nodes.map((n) => l.deserialize(n.serialize())),
|
|
379
|
+
edges: this.edges.map((n) => l.deserialize(n.serialize())),
|
|
391
380
|
conditionals: this.conditionals.map(
|
|
392
|
-
(n) =>
|
|
381
|
+
(n) => l.deserialize(n.serialize())
|
|
393
382
|
),
|
|
394
|
-
fields: this.fields.map((n) =>
|
|
383
|
+
fields: this.fields.map((n) => l.deserialize(n.serialize()))
|
|
395
384
|
});
|
|
396
385
|
}
|
|
397
386
|
};
|
|
@@ -399,10 +388,10 @@ const r = {
|
|
|
399
388
|
export {
|
|
400
389
|
N as createConditional,
|
|
401
390
|
p as createEdge,
|
|
402
|
-
|
|
391
|
+
x as createExperience,
|
|
403
392
|
b as createExperiencePlugin,
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
393
|
+
z as createField,
|
|
394
|
+
u as createNode,
|
|
395
|
+
m as createStep,
|
|
396
|
+
l as serialization
|
|
408
397
|
};
|
|
@@ -19,7 +19,6 @@ export interface SerializableStep extends Nodeable {
|
|
|
19
19
|
}
|
|
20
20
|
export interface CreateStepOptions {
|
|
21
21
|
label: string;
|
|
22
|
-
fields?: SerializableField[];
|
|
23
22
|
}
|
|
24
23
|
export type SerializableNode = SerializableStepNode | SerializableConditionalNode | SerializableLaunchExperienceNode | SerializableOriginNode;
|
|
25
24
|
export interface SerializableBaseNode {
|
|
@@ -118,7 +117,7 @@ export interface SerializableExperience {
|
|
|
118
117
|
edges: SerializableEdge[];
|
|
119
118
|
fields: SerializableField[];
|
|
120
119
|
conditionals: SerializableConditional[];
|
|
121
|
-
addStep: (stepOptions: CreateStepOptions | SerializableStep
|
|
120
|
+
addStep: (stepOptions: CreateStepOptions | SerializableStep, after?: {
|
|
122
121
|
node: SerializableNode | null;
|
|
123
122
|
}) => SerializableStep;
|
|
124
123
|
addConditional: (conditionalOptions: CreateConditionalOptions | SerializableConditional, after?: {
|
|
@@ -138,11 +137,7 @@ export interface CreateExperienceOptions {
|
|
|
138
137
|
component?: AdaptedComponent;
|
|
139
138
|
type: string;
|
|
140
139
|
}
|
|
141
|
-
export
|
|
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;
|
|
140
|
+
export declare const createStep: (stepOptions: CreateStepOptions, experience: SerializableExperience) => SerializableStep;
|
|
146
141
|
export declare const createNode: (nodeOptions: CreateNodeOptions, experience: SerializableExperience) => SerializableNode;
|
|
147
142
|
export declare const createEdge: (edgeOptions: CreateEdgeOptions, experience: SerializableExperience) => SerializableEdge;
|
|
148
143
|
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;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,sBA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