@picked/client 0.0.1-dev.1771973228237 → 0.0.1-dev.1772057362040
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +697 -608
- package/dist/esm/plugins/create-experience/index.js +194 -228
- package/dist/esm/server/index.js +1 -1
- package/dist/experience-instance-5rr_D--s.cjs +1 -0
- package/dist/experience-instance-CLR80xop.js +819 -0
- package/dist/types/client.d.ts +0 -10
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/action/action.d.ts +5 -2
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +2 -2
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +3 -4
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +51 -14
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +1 -4
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +0 -1
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/picked.d.ts +15 -15
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +24 -21
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/utils/get-step-fields.d.ts +2 -1
- package/dist/types/utils/get-step-fields.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/package.json +1 -7
- package/dist/api-CbXfbi_s.js +0 -19
- package/dist/api-DzSCgBQ2.cjs +0 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +0 -102
- package/dist/experience-instance-CU_pYPyd.js +0 -820
- package/dist/experience-instance-D_Mwuzb4.cjs +0 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -12
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -3
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -23
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -15
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
- package/dist/types/utils/api.d.ts +0 -3
- package/dist/types/utils/api.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("effector"),W=require("@withease/factories"),j=require("./supports-YvpQZxbh.cjs"),N=require("./logger-BsmHUUw1.cjs"),xe=require("./object-BbFTsGh3.cjs");function Ne(e){return typeof e=="number"&&!isNaN(e)}function R(e){return typeof e=="string"}function x(e){return Array.isArray(e)}function ue(e){return e instanceof Promise}function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(Ne(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function M(e){return`${e}`}const Ie={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>m(e)>m(t),">=":(e,t)=>m(e)>=m(t),"<":(e,t,r)=>{const n=m(e),c=m(t);if(r===void 0)return n<c;const a=m(r);return n<c&&c<a},"<=":(e,t,r)=>{const n=m(e),c=m(t);if(r===void 0)return n<=c;const a=m(r);return n<=c&&c<=a},"!!":async e=>await v(e),"!":async e=>!await v(e),"%":(e,t)=>m(e)%m(t),log:e=>(console.log(e),e),in:(e,t)=>t?R(t)?t.indexOf(M(e))!==-1:x(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(M).join(""),substr:(e,t,r)=>{const n=M(e),c=m(t);if(r===void 0)return n.substr(c);const a=m(r);if(a<0){const o=n.substr(c);return o.substr(0,o.length+a)}return n.substr(c,a)},"+":(...e)=>e.reduce((t,r)=>m(t)+m(r),0),"*":(...e)=>e.reduce((t,r)=>m(t)*m(r),1),"-":(e,t)=>{const r=m(e);return t===void 0?-r:r-m(t)},"/":(e,t)=>m(e)/m(t),min:(...e)=>Math.min(...e.map(m)),max:(...e)=>Math.max(...e.map(m)),merge:(...e)=>e.reduce((t,r)=>x(r)?t.concat(r):t.concat([r]),[]),var(e,t){const r=arguments.length>1?t:null;if(e===""||e==="."||e===null||e===void 0)return this;if(typeof e=="number"&&Array.isArray(this))return e>=0&&e<this.length?this[e]:r;const n=M(e);if(n===""||n===".")return this;const c=n.split(".");let a=this;for(const o of c){if(a==null)return r;if(Array.isArray(a)){const f=parseInt(o,10);isNaN(f)?a=a[o]:a=a[f]}else a=a[o]}return a!==void 0?a:r},async missing(...e){const t=x(e[0])?e[0]:e,r=[];for(const n of t){const c=await g({var:n},this);(c===null||c==="")&&r.push(`${n}`)}return r},async missing_some(e,t){const r=await g({missing:t},this);if(!x(r)||!x(t))return[];const n=r.filter(R);return t.filter(R).length-n.length>=m(e)?[]:n},invoke(...e){const[t,...r]=e;return typeof t!="function"?null:Reflect.apply(t,null,r)},regexp_matches(e,t){let r=e,n="";if(x(e)){const[a,o]=e;r=a,n=o}return!R(r)||!R(n)?!1:new RegExp(r,n).test(M(t))},throw(e){throw new Error(M(e))}};async function g(e,t){if(!e)return e;if(ue(e))return g(await e,t);if(x(e))return Promise.all(e.map(o=>g(o,t)));if(!ie(e))return e;const r=ke(e);let n=r?e[r]??[]:[];switch(x(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await v(await g(n[o],t)))return g(n[o+1],t);return n.length%2===1?g(n[n.length-1],t):null;case"and":{let o=null;for(const f of n)if(o=await g(f,t),!await v(o))return o;return o}case"or":{let o=null;for(const f of n)if(o=await g(f,t),await v(o))return o;return o}case"map":{const o=await g(n[0],t);return x(o)?await Promise.all(o.map(f=>g(n[1],f))):[]}case"filter":{const o=await g(n[0],t);return x(o)?(await Promise.all(o.map(async p=>{const h=await v(await g(n[1],p));return{item:p,shouldInclude:h}}))).filter(({shouldInclude:p})=>p).map(({item:p})=>p):[]}case"reduce":{const o=await g(n[0],t);if(!x(o))return n.length>2?await g(n[2],t):null;const f=n[1];let h=n.length>2?await g(n[2],t):null;for(const k of o)h=await g(f,{current:k,accumulator:h});return h}case"all":{const o=await g(n[0],t);if(!x(o)||o.length===0)return!1;for(const f of o)if(!await v(await g(n[1],f)))return!1;return!0}case"some":{const o=await g(n[0],t);if(!x(o))return!1;for(const f of o)if(await v(await g(n[1],f)))return!0;return!1}case"none":{const o=await g(n[0],t);if(!x(o))return!0;for(const f of o)if(await v(await g(n[1],f)))return!1;return!0}case"catch":try{return await g(n[0],t)}catch(o){return ie(o)?await g(o,t):n[1]?await g(n[1],o):o instanceof Error?o.message:o}}const c=await Promise.all(n.map(o=>g(o,t))),a=r?Ie[r]:void 0;if(!a)throw new Error(`Unrecognized operation ${r}`);return a.apply(t,c)}async function v(e){return ue(e)?v(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function ke(e){return Object.keys(e)[0]}function fe(e){return!xe.isEmpty(e)}async function Y(e,t,r){const n=e.getStateSnapshot(),c=e.predicates.listStore.getState().reduce((f,p)=>({...f,[p.name]:(...h)=>p.predicate({...n,args:h})}),{}),a=e.features.listStore.getState().reduce((f,p)=>({...f,[p.id]:async()=>{const{bucket:h}=await p.getBucket();return h}}),{}),o={...r,responses:e.responses.getAllStore.getState(),location:typeof n.location=="object"?{hash:n.location.hash,host:n.location.host,hostname:n.location.hostname,href:n.location.href,origin:n.location.origin,pathname:n.location.pathname,port:n.location.port,protocol:n.location.protocol,search:n.location.search}:void 0,predicates:c,features:a};return await g(t,o)}function ve(e){return!j.supportsWindow()||!j.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}const be="open";function Ae(e){if(!j.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:be})}function Oe(){return new Promise((e,t)=>{if(!j.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function Fe(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const q="picked-root",U="picked-target",Be="picked-root";function _e(e,t){return[...e,{selector:`${Be}[experience-id="${t}"]`,placement:"replace"}].flatMap(n=>{const c=ve(n.selector).filter(a=>!Me(a,t)&&!le(a,t));return{...n,elements:c}})}function $e(e,t){return e.flatMap(r=>r.elements.map(n=>De(n,r.placement,t)))}function Te(e,t){e.classList.add(U),e.classList.add(`${U}-${t}`)}function Me(e,t){return t?e.classList.contains(`${U}-${t}`):e.classList.contains(`${U}`)}function le(e,t){return t?e.classList.contains(`${q}-${t}`):e.classList.contains(q)}function Le(e){const t=document.createElement("div");return t.style.display="block",t.classList.add(q),t.classList.add(`${q}-${e}`),t}function De(e,t,r){let n;const c=Le(r);if(e instanceof Document)n=e.body.appendChild(c);else{switch(t){case"replace":e.replaceWith(c);break;case"before":e.before(c);break;case"after":e.after(c);break;case"prepend":e.prepend(c);break;default:e.append(c);break}n=c}return n}function se(e){return e.type==="conditional"}function B(e){return e.type==="step"}function ce(e){return e.type==="experience"}function J(e){return e.type==="origin"}function ae(e){return e.type==="action"}const de=(e,t,r,n,c=new Set)=>c.has(r.id)?[]:(c.add(r.id),B(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const f=e.find(p=>p.id===o.destinationNodeId);return f?de(e,t,f,!1,c):[]})),Re=(e,t,r)=>de(e,t,r,!0,new Set),pe=(e,t,r,n,c=new Set)=>{if(c.has(r.id))return[-1,-1];c.add(r.id);const a=t.filter(p=>p.sourceNodeId===r.id);if(a.length===0)return[0,0];let o=1/0,f=-1/0;for(const p of a){const h=e.find(_=>_.id===p.destinationNodeId);if(!h)continue;const[k,A]=pe(e,t,h,!1,new Set(c));k!==-1&&(o=Math.min(o,k+1),f=Math.max(f,A+1))}return o===1/0?[-1,-1]:[o,f]},Pe=(e,t,r)=>pe(e,t,r,!0,new Set),ge=(e,t,r,n=new Set)=>{if(n.has(r.id))return[-1,-1];if(n.add(r.id),r.type==="origin")return[0,0];const c=t.filter(f=>f.destinationNodeId===r.id);if(c.length===0)return[-1,-1];let a=1/0,o=-1/0;for(const f of c){const p=e.find(A=>A.id===f.sourceNodeId);if(!p)continue;const[h,k]=ge(e,t,p,new Set(n));h!==-1&&(a=Math.min(a,h+1),o=Math.max(o,k+1))}return a===1/0?[-1,-1]:[a,o]},He=(e,t,r)=>ge(e,t,r,new Set),me=e=>e.find(r=>r.type==="origin")||null,Q=(e,t,r)=>{if(!e)return me(t);const n=r.find(a=>a.sourceNodeId===e.id);if(!n)return null;const c=t.find(a=>a.id===n.destinationNodeId);return c||null};async function Ce(e,t,r,n){const c=e?"true":"false",a=n.find(o=>o.sourceNodeHandle===c&&o.sourceNodeId===t);return r.find(o=>o.id===a?.destinationNodeId)}const Z=s.createDomain("experience-instance"),je=W.createFactory(({client:e,experience:t,target:r,options:n})=>{const c=s.createEvent(),a=s.createEvent(),o=s.createEvent(),f=s.createEvent(),p=s.createEvent(),h=s.createEvent(),k=t.componentStore,A=Z.store("transitioning"),_=e.history.entriesStore.map(i=>i.filter(d=>d.experienceId===t.id)),P=_.map(i=>i.filter(d=>B(d.node))),u=_.map(i=>i.at(-1)?.node||null),S=s.combine(t.treeStore,u,({steps:i},d)=>i.find(l=>d&&B(d)&&l.id===d.stepId)||null),E=s.combine(t.treeStore,P,({steps:i},d)=>{const l=d.at(-2);if(!l||!B(l.node))return null;const y=l.node;return i.find(O=>O.id===y.stepId)||null}),$=s.combine(t.treeStore,u,({nodes:i,edges:d},l)=>l?Re(i,d,l):[]),L=s.combine(t.treeStore,u,({nodes:i,edges:d},l)=>l?He(i,d,l):[-1,-1]),G=s.combine(t.treeStore,u,({nodes:i,edges:d},l)=>l?Pe(i,d,l):[-1,-1]),T=Z.store(!1),H=s.createApi(T,{open:()=>!0,close:()=>!1,toggle:i=>!i,set:(i,d)=>d}),he=s.createEffect(async()=>{e.history.back({experienceId:t.id})}),ye=s.attach({source:t.treeStore,effect:async(i,d)=>{const l=i.nodes.find(y=>B(y)&&y.stepId===d);l&&e.history.push({experienceId:t.id,node:l})}}),ee=s.attach({source:u,effect:i=>{}}),K=s.attach({source:t.treeStore,effect:async({nodes:i})=>me(i)}),V=s.attach({source:t.treeStore,effect:async({nodes:i,edges:d},l)=>{if(J(l))return Q(l,i,d)}}),z=s.attach({source:t.treeStore,effect:async({nodes:i,edges:d,conditionals:l},y)=>{if(!se(y))return;const O=l.find(b=>b.id===y.conditionalId);if(!O)return;const I=y.id,w=await Y(e,O.condition);return Ce(!!w,I,i,d)}}),te=s.attach({source:t.treeStore,effect:async({nodes:i,edges:d},l)=>{if(!ae(l))return;const y=l.action;if(!y){N.logger("warn",`Action node ${l.id} has no action name`);return}const O=e.actions.getByName(y).getState();if(!O){N.logger("warn",`Action '${y}' not registered on client`);const I=d.find(w=>w.sourceNodeId===l.id&&w.sourceNodeHandle==="false");return I?i.find(w=>w.id===I.destinationNodeId):null}if(typeof O.action!="function"){N.logger("warn",`Action '${y}' is not a function`);const I=d.find(w=>w.sourceNodeId===l.id&&w.sourceNodeHandle==="false");return I?i.find(w=>w.id===I.destinationNodeId):null}try{N.logger("info",`Executing action: ${y}`),await O.action(y);const I=d.find(b=>b.sourceNodeId===l.id&&b.sourceNodeHandle==="true");if(!I)return N.logger("warn",`No 'true' edge found for action node ${l.id}`),null;const w=i.find(b=>b.id===I.destinationNodeId);return N.logger("info",`Action '${y}' succeeded, moving to node ${w?.id}`),w||null}catch(I){N.logger("warn",`Action '${y}' failed:`,I);const w=d.find(C=>C.sourceNodeId===l.id&&C.sourceNodeHandle==="false");if(!w)return N.logger("warn",`No 'false' edge found for action node ${l.id}`),null;const b=i.find(C=>C.id===w.destinationNodeId);return N.logger("info",`Action '${y}' failed, moving to node ${b?.id}`),b||null}}}),we=s.createEffect(i=>{if(ce(i))return e.launchExperienceById(i.experienceId)}),ne=s.attach({source:[u,t.treeStore],effect:async([i,{nodes:d,edges:l}])=>Q(i,d,l)}),D=s.attach({source:[u,t.treeStore],effect:async([i,{nodes:d,edges:l}])=>Q(i,d,l)}),Ee=s.createEffect(i=>{e.history.push({experienceId:t.id,node:i})}),re=s.attach({source:t.configStore,effect:async({initializeOpenLogic:i})=>n?.initialiseOpen!==void 0?n.initialiseOpen:fe(i)?!!await Y(e,i):i??!1}),F=Object.freeze({id:Math.random().toString(36).substring(7),experienceId:t.id,configStore:t.configStore,target:r,componentStore:k,stateStore:A,isOpenStore:T,open:H.open,close:H.close,toggleOpen:H.toggle,setOpen:H.set,treeStore:t.treeStore,fieldsStore:t.fieldsStore,currentNodeStore:u,currentStepStore:S,previousStepStore:E,nextReachableStepNodesStore:$,stepsToOriginStore:L,stepsToLeafStore:G,goToNextStep:a,goToPreviousStep:o,goToStepById:f,stepsHistoryStore:P}),X=s.createEvent(),oe=s.createEvent();return s.sample({source:u,target:X}),s.sample({clock:X,filter:i=>i===null,target:K}),s.sample({clock:X,filter:i=>i!==null,target:oe}),s.split({source:oe,match:i=>se(i)?"condition":B(i)?"step":ce(i)?"launchExperience":J(i)?"origin":ae(i)?"action":"other",cases:{origin:V,condition:z,step:ee,launchExperience:we,action:te,__:s.createEvent()}}),s.sample({clock:[z.doneData,V.doneData,K.doneData,D.doneData,ne.doneData,te.doneData],filter:Boolean,target:Ee}),s.sample({clock:a,target:D}),s.sample({clock:a,source:S,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit",step:i,experience:F}))}),s.sample({clock:D.done,source:S,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit_success",step:i,experience:F}))}),s.sample({clock:D.fail,source:S,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_submit_error",step:i,experience:F}))}),s.sample({clock:o,target:he}),s.sample({clock:f,target:ye}),s.sample({source:s.combine([z.pending,V.pending,K.pending,D.pending]),fn:i=>i.some(Boolean)?"transitioning":"ready",target:A}),s.sample({clock:ee.doneData,source:S,filter:Boolean,target:e.eventBus.prepend(i=>({type:"step_enter",step:i,experience:F}))}),s.sample({clock:h,target:re}),s.sample({source:re.doneData,fn:Boolean,target:T}),s.sample({source:u,clock:c,filter:i=>i?J(i):!0,target:ne}),s.sample({source:T,filter:Boolean,target:c}),s.sample({source:T,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:F}))}),s.sample({source:T,filter:i=>!i,target:e.eventBus.prepend(()=>({type:"experience_close",experience:F}))}),s.sample({clock:p,target:[h]}),p(),F});function Se(e){return W.invoke(je,e)}const qe=W.createFactory(({client:e})=>{const t=Z.store({}),r=s.createEvent(),n=s.createEvent(),c=s.createEvent(),a=s.createApi(t,{register(u,S){const E=[...u[S.experienceId]??[]];return E.push(S),{...u,[S.experienceId]:E}},unregister(u,S){const E=S.experienceId,$=u[E]?.filter(L=>L!==S);return{...u,[E]:$??[]}}}),o=s.createEffect(({experience:u,target:S,options:E})=>Se({client:e,experience:u,target:S,options:E})),f=s.createEffect(u=>{a.register(u)}),p=s.createEffect(u=>{u.target&&Fe(u.target,()=>{c(u)})}),h=s.createEffect(u=>{a.unregister(u)}),k=s.createEffect(u=>{const S=u.componentStore.getState();if(!S){N.logger("warn","No app component registered. Skipping init.");return}const E=S.frameworkStore.getState();if(!E){N.logger("error",`No framework registered for component '${S.name}'. Skipping rendering.`);return}const $=u.target;if(!$){N.logger("error",`No target element registered for experience '${u.experienceId}'. Skipping rendering.`);return}const L=Ae($);try{E.render(L,S.component,e,u)}catch(G){N.logger("error",G)}});s.sample({clock:r,target:o}),s.sample({clock:c,target:h}),s.sample({clock:o.doneData,target:[f,p,n]}),s.sample({clock:o.doneData,target:e.eventBus.prepend(u=>({type:"experience_initialize",experience:u}))}),s.sample({clock:n,target:k});function A(u,S,E){r({experience:u,target:S,options:E})}const _=t.map(u=>Object.values(u).flat());function P(u){return t.map(S=>S[u]||[],{skipVoid:!1})}return{spawn:A,getByExperienceId:P,listStore:_}});function Ue(e){return W.invoke(qe,e)}exports.createAppHosts=$e;exports.createExperienceInstance=Se;exports.createExperienceInstanceIndex=Ue;exports.domInteractive=Oe;exports.evaluateRuleLogic=Y;exports.getTargetElements=_e;exports.isPickedRoot=le;exports.isRulesLogic=fe;exports.isStepNode=B;exports.tagTargetElement=Te;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FNV-1a 32-bit hash.
|
|
3
|
-
* Deterministic, fast, well-distributed for short strings.
|
|
4
|
-
*/
|
|
5
|
-
export declare function fnv1a32(input: string): number;
|
|
6
|
-
/**
|
|
7
|
-
* Deterministic bucket allocation for A/B testing.
|
|
8
|
-
* Hashes `${sessionId}:${featureId}:${version}` and returns whether
|
|
9
|
-
* the resulting bucket (0–99) falls within the feature's weight.
|
|
10
|
-
*/
|
|
11
|
-
export declare function allocateBucket(sessionId: string, featureId: string, version: number, weight: number): boolean;
|
|
12
|
-
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/hash.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAU7C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAYT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACjE,mBAAmB,SAAS,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Plugin } from '../../entities/plugin/plugin';
|
|
2
|
-
import { DynamicExperiencesPluginOptions, ProjectConfig } from './types';
|
|
3
|
-
export declare function fetchProject(apiUrl: string, projectId: string, previewToken?: string): Promise<ProjectConfig | null>;
|
|
4
|
-
/**
|
|
5
|
-
* Plugin that fetches feature configuration from the Picked REST API
|
|
6
|
-
* and registers features with deterministic bucket allocation.
|
|
7
|
-
*
|
|
8
|
-
* Features are fetched during the `onStart` hook, before experience
|
|
9
|
-
* initialization. Search param feature overrides take precedence.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* import { dynamicExperiencesPlugin } from '@picked/client/plugins/dynamic-experiences'
|
|
14
|
-
*
|
|
15
|
-
* createClient({
|
|
16
|
-
* plugins: [
|
|
17
|
-
* dynamicExperiencesPlugin()
|
|
18
|
-
* ]
|
|
19
|
-
* })
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function dynamicExperiencesPlugin(options?: DynamicExperiencesPluginOptions): Plugin;
|
|
23
|
-
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAwB,MAAM,SAAS,CAAA;AAyHnG,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAgC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,MAAM,CAoC1F"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface ProjectConfigFeature {
|
|
2
|
-
id: string;
|
|
3
|
-
name: string;
|
|
4
|
-
enabled: boolean;
|
|
5
|
-
weight: number;
|
|
6
|
-
version: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ProjectConfig {
|
|
9
|
-
features: ProjectConfigFeature[];
|
|
10
|
-
}
|
|
11
|
-
export interface DynamicExperiencesPluginOptions {
|
|
12
|
-
apiUrl?: string;
|
|
13
|
-
projectConfig?: ProjectConfig;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dynamic-experiences/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/utils/api.ts"],"names":[],"mappings":"AAMA,wBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI1E;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAAC,QAAQ,CAAC,CAQnB"}
|