@getuserfeedback/sdk 0.3.0 → 0.3.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/index.js +2 -2
- package/dist/index.js.map +7 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w={INSTANCE_FLOW_STATE_CHANGED:"instance:flow:state-changed",INSTANCE_FLOW_STATE_CHANGED_INSTANCE:"instance:flow:state-changed:instance",INSTANCE_COMMAND_SETTLED:"instance:command:settled",INSTANCE_COMMAND_UNSUPPORTED:"instance:command:unsupported",INSTANCE_READY:"instance:ready",INSTANCE_BRIDGE_MOUNTED:"instance:bridge:mounted",INSTANCE_BRIDGE_UNMOUNTED:"instance:bridge:unmounted",INSTANCE_IFRAME_READY:"instance:iframe:ready",INSTANCE_ERROR:"instance:error",INSTANCE_APP_EVENT:"instance:app-event"},C={configure:"gx.command.configure.v1",open:"gx.command.open.v1",prefetch:"gx.command.prefetch.v1",prerender:"gx.command.prerender.v1",identify:"gx.command.identify.v1",close:"gx.command.close.v1",reset:"gx.command.reset.v1",setContainer:"gx.command.setContainer.v1",setDefaultContainerPolicy:"gx.command.setDefaultContainerPolicy.v1"},wm=[C.configure,C.open,C.prefetch,C.prerender,C.identify,C.close,C.reset,C.setContainer,C.setDefaultContainerPolicy],Um=["gx.protocol.public.v1",...wm],$m="__getuserfeedback_runtime",i="v1",q=(E)=>`getuserfeedback:${E}`;function Wm(E){if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID==="function")return globalThis.crypto.randomUUID();let T=`${Date.now()}_${Math.random().toString(36).slice(2)}`;return E?`${E}_${T}`:T}var x=()=>Wm("req");var A=(E)=>typeof E==="string"&&E.trim().length>0;function s(E){if(typeof E!=="object"||E===null)return!1;let T=E;return A(T.instanceId)&&typeof T.isOpen==="boolean"&&typeof T.isLoading==="boolean"&&(typeof T.width>"u"||typeof T.width==="number")&&(typeof T.height>"u"||typeof T.height==="number")&&A(T.flowHandleId)}function t(E){if(typeof E!=="object"||E===null)return!1;let T=E;return A(T.instanceId)&&typeof T.isOpen==="boolean"&&typeof T.isLoading==="boolean"&&(typeof T.width>"u"||typeof T.width==="number")&&(typeof T.height>"u"||typeof T.height==="number")}function jm(E){if(typeof E!=="object"||E===null)return!1;let T=E;if(!A(T.requestId)||typeof T.instanceId!=="string"&&T.instanceId!==null||typeof T.kind!=="string"||typeof T.ok!=="boolean")return!1;if(T.ok===!0)return!0;if(T.ok===!1&&typeof T.error==="object"&&T.error!==null)return typeof T.error.message==="string";return!1}var qm=30000,zm="COMMAND_SETTLEMENT_TIMEOUT";class L extends Error{code=zm;requestId;constructor(E){super(`Timed out waiting for command settlement: ${E}`);this.name="CommandSettlementTimeoutError",this.requestId=E}}var Lm=(E)=>{if(typeof CustomEvent<"u")return E instanceof CustomEvent;return typeof E==="object"&&E!==null&&"detail"in E},h=(E)=>{let T=E.requestId.trim();if(!T)return Promise.reject(Error("requestId must be a non-empty string"));let G=E.windowRef??(typeof window>"u"?void 0:window);if(!G)return Promise.reject(Error("Cannot await command settlement without window"));let X=q(w.INSTANCE_COMMAND_SETTLED),M=Math.max(0,E.timeoutMs??qm);return new Promise((P,Y)=>{let B=()=>{if(typeof G.removeEventListener==="function")G.removeEventListener(X,v)},H=setTimeout(()=>{B(),Y(new L(T))},M),v=(V)=>{if(!Lm(V))return;let y=V.detail;if(!jm(y)||y.requestId!==T)return;let _=y;if(B(),clearTimeout(H),_.ok){P(_);return}Y(Error(_.error.message??`Command ${_.kind} failed without an error payload`))};G.addEventListener(X,v)})};var n=(E)=>{return async(T,G)=>{let X=x(),M=Hm(G?.idempotencyKey);E({version:"1",requestId:X,idempotencyKey:M??X,command:T}),await h({requestId:X})}},Hm=(E)=>{if(E===void 0)return null;let T=E.trim();if(!T)throw Error("idempotencyKey must be a non-empty string");return T};var Gm="0.3.0".trim(),a=Gm.length>0?Gm:"0.0.0-local";var l={isOpen:!1,isLoading:!1,width:void 0,height:void 0},Jm=new Map,Qm=(E)=>E,gm=()=>{if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID==="function")return Qm(globalThis.crypto.randomUUID());return Qm(`handle_${Date.now()}_${Math.random().toString(36).slice(2)}`)},rm=()=>{if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID==="function")return globalThis.crypto.randomUUID();return`sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`},Am=(E,T)=>{if(typeof E==="string")return{kind:"identify",userId:E,traits:T};return{kind:"identify",traits:E}},bm=120,Xm=120,pm=(E)=>E.apiKey,cm=()=>typeof window>"u"?globalThis:window,um=()=>{let E=cm(),T=Jm.get(E);if(T)return T;let G=new Map;return Jm.set(E,G),G},om=({apiKey:E,_cdn:T="https://cdn.getuserfeedback.com",disableAutoLoad:G=!1,colorScheme:X,disableTelemetry:M=!1,enableDebug:P=!1,defaultConsent:Y})=>{let B=pm({apiKey:E,_cdn:T,disableAutoLoad:G,colorScheme:X,disableTelemetry:M,enableDebug:P,defaultConsent:Y}),H=um(),v=H.get(B);if(v){if(v.updateOptions({apiKey:E,_cdn:T,disableAutoLoad:G,colorScheme:X,disableTelemetry:M,enableDebug:P,defaultConsent:Y}),!G)v.client.load();return v.client}let V=T,y=(m)=>{},_=a,Zm="v1",b=rm(),d={loader:"sdk",clientName:"@getuserfeedback/sdk",clientVersion:_,transport:"snippet"},Cm=[...Um],g=Y,Mm=()=>({apiKey:E,clientMeta:d,capabilities:[...Cm],...X!==void 0&&{colorScheme:X},...M!==void 0&&{disableTelemetry:M},...P!==void 0&&{enableDebug:P},...g!==void 0&&{defaultConsent:g}}),r=!1,D=null,k=G,p=new Map,e=l,N=(m)=>({isOpen:m.isOpen,isLoading:m.isLoading,width:m.width,height:m.height}),mm=(m)=>{let O=p.get(m);if(!O)return N(l);return N(O)},Em=(m,O)=>{p.set(m,N(O))},Tm=()=>N(e),Vm=(m)=>{e=N(m)},ym=(m)=>{if(!p.has(m))Em(m,l)},S=()=>r,K=(m)=>{if(typeof window>"u")return;if(!window.__getuserfeedback_queue)window.__getuserfeedback_queue=[];let O={...m,instanceId:m.instanceId??b,clientMeta:m.clientMeta??d};window.__getuserfeedback_queue.push(O)},c=(m)=>{let O=m??x();return K({version:"1",instanceId:b,requestId:O,idempotencyKey:O,command:{kind:"init",opts:Mm()}}),O},Dm=(m,O)=>{let j=x();K({version:"1",requestId:j,idempotencyKey:j,command:{kind:"setContainer",flowHandleId:m,container:O}})},u=(m)=>{let O=x();K({version:"1",requestId:O,idempotencyKey:O,command:{kind:"setDefaultContainerPolicy",policy:m}})},f=(m)=>{return m.catch((O)=>{throw y(O),O})},fm=()=>{if(typeof window>"u")return;if(!S()){if(k)throw Error("Widget not loaded. Call client.load() first.");o()}},Fm=n((m)=>K(m)),F=async(m)=>{return fm(),Fm(m)},Rm=(m)=>{if(!S())return;let O=x();K({version:"1",requestId:O,idempotencyKey:O,command:{kind:"configure",opts:m}})},xm=(m)=>{if(k=m.disableAutoLoad??k,g=m.defaultConsent??g,m._cdn!==void 0&&m._cdn!==V)if(S()||D!==null){let O=Error("_cdn cannot be changed after widget init; keeping original");y(O)}else V=m._cdn;if(Pm(m),!k&&!S())o()},Pm=(m)=>{if(!S())return;let O={};if(m.colorScheme!==void 0)O.colorScheme=m.colorScheme;Rm(O)},o=()=>{if(typeof window>"u")return;if(S()||D)return;let m=()=>{let U=V.endsWith("/")?V:`${V}/`,$=`loader/${Zm}/${encodeURIComponent(E)}/loader.js`,J=new URL($,U).toString();if(!document.querySelector(`link[href="${J}"][rel="preload"]`)){let Q=document.createElement("link");Q.rel="preload",Q.as="script",Q.href=J,document.head.appendChild(Q)}let z=document.createElement("script");if(z.src=J,z.async=!0,z.dataset)z.dataset.disableAutoRegister="true";else if(typeof z.setAttribute==="function")z.setAttribute("data-disable-auto-register","true");document.head.appendChild(z)},O=window[$m];if(O?.alive){let U=O.protocolVersion;if(U!==i)throw Error(`Incompatible loader runtime protocol: expected ${i}, received ${U??"unknown"}`);c(),r=!0;return}if(!Array.isArray(window.__getuserfeedback_queue)){let U=c();m(),r=!0;let $;$=h({requestId:U,timeoutMs:Xm}).then(()=>{}).catch((z)=>{y(z)}).finally(()=>{if(D===$)D=null}),D=$;return}r=!0;let W;W=(async()=>{let U=x();c(U);try{await h({requestId:U,timeoutMs:bm});return}catch($){if($ instanceof L){m(),await h({requestId:U,timeoutMs:Xm});return}throw $}})().catch((U)=>{y(U)}).finally(()=>{if(D===W)D=null}),D=W},vm=(m,O)=>{Dm(m,O)},Nm=(m)=>{if(m===null){u({kind:"floating"});return}u({kind:"hostContainer",host:m,sharing:"shared"})},Sm=(m,O,j)=>{if(j?.emitInitial??!0)O(mm(m));if(typeof window>"u")return()=>{};let W=q(w.INSTANCE_FLOW_STATE_CHANGED),R=(Q)=>{let Z=Q.detail;if(!s(Z)||Z.flowHandleId!==m)return;let Om={isOpen:Z.isOpen,isLoading:Z.isLoading,width:Z.width,height:Z.height};Em(m,Om),O(N(Om))},U=!1,$=j?.signal,J=null,z=()=>{if(U)return;if(U=!0,window.removeEventListener(W,R),$&&J)$.removeEventListener("abort",J)};if(window.addEventListener(W,R),$){if(J=()=>{z()},$.aborted)return z(),z;$.addEventListener("abort",J,{once:!0})}return z},hm=(m,O)=>{if(O?.emitInitial??!0)m(Tm());if(typeof window>"u")return()=>{};let j=q(w.INSTANCE_FLOW_STATE_CHANGED_INSTANCE),W=(z)=>{let Q=z.detail;if(!t(Q)||Q.instanceId!==b)return;let Z={isOpen:Q.isOpen,isLoading:Q.isLoading,width:Q.width,height:Q.height};Vm(Z),m(N(Z))},R=!1,U=O?.signal,$=null,J=()=>{if(R)return;if(R=!0,window.removeEventListener(j,W),U&&$)U.removeEventListener("abort",$)};if(window.addEventListener(j,W),U){if($=()=>{J()},U.aborted)return J(),J;U.addEventListener("abort",$,{once:!0})}return J},Ym=(m)=>{let O=m;if(!O.trim())throw Error("flowId must be a non-empty string");let j=gm();return ym(j),{flowId:O,open:(W)=>{return f(F({kind:"open",flowId:O,flowHandleId:j,containerRequirement:W?.containerRequirement,hideCloseButton:W?.hideCloseButton}))},prefetch:()=>f(F({kind:"prefetch",flowId:O})),prerender:(W)=>f(F({kind:"prerender",flowId:O,flowHandleId:j,hideCloseButton:W?.hideCloseButton})),close:()=>f(F({kind:"close",flowHandleId:j})),setContainer:(W)=>{vm(j,W)},getFlowState:()=>mm(j),subscribeFlowState:(W,R)=>Sm(j,W,R)}},_m=(m)=>Ym(m),Bm=()=>{if(typeof window>"u")return Promise.resolve();return f(F({kind:"close"}))},km=()=>{if(typeof window>"u")return Promise.resolve();return f(F({kind:"reset"}))};function Km(m,O){if(typeof window>"u")return Promise.resolve();return f(F(Am(m,O)))}let I={load:o,setDefaultContainerPolicy:(m)=>{u(m)},setContainer:(m)=>{Nm(m)},getFlowState:()=>Tm(),subscribeFlowState:(m,O)=>hm(m,O),flow:_m,close:Bm,reset:km,configure:(m)=>{if(typeof window>"u")return Promise.resolve();if(!S())return Promise.resolve();return f(F({kind:"configure",opts:m}))},identify:Km};if(H.set(B,{client:I,updateOptions:xm}),!k)I.load();return I};export{om as createClient,a as SDK_VERSION};
|
|
1
|
+
var g={INSTANCE_FLOW_STATE_CHANGED:"instance:flow:state-changed",INSTANCE_FLOW_STATE_CHANGED_INSTANCE:"instance:flow:state-changed:instance",INSTANCE_COMMAND_SETTLED:"instance:command:settled",INSTANCE_COMMAND_UNSUPPORTED:"instance:command:unsupported",INSTANCE_READY:"instance:ready",INSTANCE_BRIDGE_MOUNTED:"instance:bridge:mounted",INSTANCE_BRIDGE_UNMOUNTED:"instance:bridge:unmounted",INSTANCE_IFRAME_READY:"instance:iframe:ready",INSTANCE_ERROR:"instance:error",INSTANCE_APP_EVENT:"instance:app-event"},x={configure:"gx.command.configure.v1",open:"gx.command.open.v1",prefetch:"gx.command.prefetch.v1",prerender:"gx.command.prerender.v1",identify:"gx.command.identify.v1",close:"gx.command.close.v1",reset:"gx.command.reset.v1",setContainer:"gx.command.setContainer.v1",setDefaultContainerPolicy:"gx.command.setDefaultContainerPolicy.v1"},wT=[x.configure,x.open,x.prefetch,x.prerender,x.identify,x.close,x.reset,x.setContainer,x.setDefaultContainerPolicy],XT=["gx.protocol.public.v1",...wT],ZT="__getuserfeedback_runtime",t="v1",w=(m)=>`getuserfeedback:${m}`;function MT(m){if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID==="function")return globalThis.crypto.randomUUID();let E=`${Date.now()}_${Math.random().toString(36).slice(2)}`;return m?`${m}_${E}`:E}var Y=()=>MT("req");var L=(m)=>typeof m==="string"&&m.trim().length>0;function n(m){if(typeof m!=="object"||m===null)return!1;let E=m;return L(E.instanceId)&&typeof E.isOpen==="boolean"&&typeof E.isLoading==="boolean"&&(typeof E.width>"u"||typeof E.width==="number")&&(typeof E.height>"u"||typeof E.height==="number")&&L(E.flowHandleId)}function a(m){if(typeof m!=="object"||m===null)return!1;let E=m;return L(E.instanceId)&&typeof E.isOpen==="boolean"&&typeof E.isLoading==="boolean"&&(typeof E.width>"u"||typeof E.width==="number")&&(typeof E.height>"u"||typeof E.height==="number")}function WT(m){if(typeof m!=="object"||m===null)return!1;let E=m;if(!L(E.requestId)||typeof E.instanceId!=="string"&&E.instanceId!==null||typeof E.kind!=="string"||typeof E.ok!=="boolean")return!1;if(E.ok===!0)return!0;if(E.ok===!1&&typeof E.error==="object"&&E.error!==null)return typeof E.error.message==="string";return!1}var HT=["open","prerender","prefetch"];function l(m){if(!m.ok||!HT.includes(m.kind))return null;let E=m.result;if(typeof E!=="object"||E===null)return null;let G=E;if(!L(G.flowHandleId))return null;return{flowHandleId:G.flowHandleId,...L(G.flowRunId)&&{flowRunId:G.flowRunId}}}var AT=30000,zT="COMMAND_SETTLEMENT_TIMEOUT";class H extends Error{code=zT;requestId;constructor(m){super(`Timed out waiting for command settlement: ${m}`);this.name="CommandSettlementTimeoutError",this.requestId=m}}var pT=(m)=>{if(typeof CustomEvent<"u")return m instanceof CustomEvent;return typeof m==="object"&&m!==null&&"detail"in m},B=(m)=>{let E=m.requestId.trim();if(!E)return Promise.reject(Error("requestId must be a non-empty string"));let G=m.windowRef??(typeof window>"u"?void 0:window);if(!G)return Promise.reject(Error("Cannot await command settlement without window"));let Z=w(g.INSTANCE_COMMAND_SETTLED),z=Math.max(0,m.timeoutMs??AT);return new Promise((C,S)=>{let W=()=>{if(typeof G.removeEventListener==="function")G.removeEventListener(Z,V)},y=setTimeout(()=>{W(),S(new H(E))},z),V=(D)=>{if(!pT(D))return;let F=D.detail;if(!WT(F)||F.requestId!==E)return;let R=F;if(W(),clearTimeout(y),R.ok){C(R);return}S(Error(R.error.message??`Command ${R.kind} failed without an error payload`))};G.addEventListener(Z,V)})};var d=(m)=>{return async(E,G)=>{let Z=Y(),z=rT(G?.idempotencyKey);m({version:"1",requestId:Z,idempotencyKey:z??Z,command:E}),await B({requestId:Z})}},rT=(m)=>{if(m===void 0)return null;let E=m.trim();if(!E)throw Error("idempotencyKey must be a non-empty string");return E};var VT="0.3.1".trim(),e=VT.length>0?VT:"0.0.0-local";var DT=(m)=>{let E,G=Promise.resolve(),Z=!0,z=new Set,C=(W)=>{E=W;for(let y of z)y(W)};return{runCommand:(W,y)=>{let V=async()=>{let F=W(E),R=await y(F),p=m.getHandleIdFromSettlement(R);if(p)C(p);return R},D=Z?V():G.then(V,V);return Z=!1,G=D.then(()=>{Z=!0},()=>{Z=!0}),D},getHandleId:()=>E,subscribeHandle:(W)=>{if(z.add(W),E)W(E);return()=>{z.delete(W)}}}};function vT(){let m=[];return{push:(E)=>{m.push(E)},drain:()=>{let E=m.slice();return m.length=0,E}}}var A={isOpen:!1,isLoading:!1,width:void 0,height:void 0},FT=new Map,bT=()=>{if(typeof globalThis.crypto<"u"&&typeof globalThis.crypto.randomUUID==="function")return globalThis.crypto.randomUUID();return`sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`},cT=(m,E)=>{if(typeof m==="string")return{kind:"identify",userId:m,traits:E};return{kind:"identify",traits:m}},uT=120,CT=120,IT=(m)=>m.apiKey,oT=()=>typeof window>"u"?globalThis:window,sT=()=>{let m=oT(),E=FT.get(m);if(E)return E;let G=new Map;return FT.set(m,G),G},iT=({apiKey:m,_cdn:E="https://cdn.getuserfeedback.com",disableAutoLoad:G=!1,colorScheme:Z,disableTelemetry:z=!1,enableDebug:C=!1,defaultConsent:S})=>{let W=IT({apiKey:m,_cdn:E,disableAutoLoad:G,colorScheme:Z,disableTelemetry:z,enableDebug:C,defaultConsent:S}),y=sT(),V=y.get(W);if(V){if(V.updateOptions({apiKey:m,_cdn:E,disableAutoLoad:G,colorScheme:Z,disableTelemetry:z,enableDebug:C,defaultConsent:S}),!G)V.client.load();return V.client}let D=E,F=(T)=>{},R=e,p="v1",c=bT(),TT={loader:"sdk",clientName:"@getuserfeedback/sdk",clientVersion:R,transport:"snippet"},RT=[...XT],r=S,NT=()=>({apiKey:m,clientMeta:TT,capabilities:[...RT],...Z!==void 0&&{colorScheme:Z},...z!==void 0&&{disableTelemetry:z},...C!==void 0&&{enableDebug:C},...r!==void 0&&{defaultConsent:r}}),b=!1,_=null,q=G,u=new Map,ET=A,N=(T)=>({isOpen:T.isOpen,isLoading:T.isLoading,width:T.width,height:T.height}),mT=(T)=>{let U=u.get(T);if(!U)return N(A);return N(U)},OT=(T,U)=>{u.set(T,N(U))},UT=()=>N(ET),PT=(T)=>{ET=N(T)},xT=(T)=>{if(!u.has(T))OT(T,A)},f=()=>b,h=(T)=>{if(typeof window>"u")return;if(!window.__getuserfeedback_queue)window.__getuserfeedback_queue=[];let U={...T,instanceId:T.instanceId??c,clientMeta:T.clientMeta??TT};window.__getuserfeedback_queue.push(U)},I=(T)=>{let U=T??Y();return h({version:"1",instanceId:c,requestId:U,idempotencyKey:U,command:{kind:"init",opts:NT()}}),U},YT=(T,U)=>{let X=Y();h({version:"1",requestId:X,idempotencyKey:X,command:{kind:"setContainer",flowHandleId:T,container:U}})},o=(T)=>{let U=Y();h({version:"1",requestId:U,idempotencyKey:U,command:{kind:"setDefaultContainerPolicy",policy:T}})},P=(T)=>{return T.catch((U)=>{throw F(U),U})},$T=()=>{if(typeof window>"u")return;if(!f()){if(q)throw Error("Widget not loaded. Call client.load() first.");s()}},yT=d((T)=>h(T)),k=async(T)=>{return $T(),yT(T)},_T=(T)=>{if(!f())return;let U=Y();h({version:"1",requestId:U,idempotencyKey:U,command:{kind:"configure",opts:T}})},KT=(T)=>{if(q=T.disableAutoLoad??q,r=T.defaultConsent??r,T._cdn!==void 0&&T._cdn!==D)if(f()||_!==null){let U=Error("_cdn cannot be changed after widget init; keeping original");F(U)}else D=T._cdn;if(BT(T),!q&&!f())s()},BT=(T)=>{if(!f())return;let U={};if(T.colorScheme!==void 0)U.colorScheme=T.colorScheme;_T(U)},s=()=>{if(typeof window>"u")return;if(f()||_)return;let T=()=>{let j=D.endsWith("/")?D:`${D}/`,O=`loader/${p}/${encodeURIComponent(m)}/loader.js`,$=new URL(O,j).toString();if(!document.querySelector(`link[href="${$}"][rel="preload"]`)){let M=document.createElement("link");M.rel="preload",M.as="script",M.href=$,document.head.appendChild(M)}let Q=document.createElement("script");if(Q.src=$,Q.async=!0,Q.dataset)Q.dataset.disableAutoRegister="true";else if(typeof Q.setAttribute==="function")Q.setAttribute("data-disable-auto-register","true");document.head.appendChild(Q)},U=window[ZT];if(U?.alive){let j=U.protocolVersion;if(j!==t)throw Error(`Incompatible loader runtime protocol: expected ${t}, received ${j??"unknown"}`);I(),b=!0;return}if(!Array.isArray(window.__getuserfeedback_queue)){let j=I();T(),b=!0;let O;O=B({requestId:j,timeoutMs:CT}).then(()=>{}).catch((Q)=>{F(Q)}).finally(()=>{if(_===O)_=null}),_=O;return}b=!0;let J;J=(async()=>{let j=Y();I(j);try{await B({requestId:j,timeoutMs:uT});return}catch(O){if(O instanceof H){T(),await B({requestId:j,timeoutMs:CT});return}throw O}})().catch((j)=>{F(j)}).finally(()=>{if(_===J)_=null}),_=J},jT=(T,U)=>{YT(T,U)},ST=(T)=>{if(T===null){o({kind:"floating"});return}o({kind:"hostContainer",host:T,sharing:"shared"})},GT=(T,U,X)=>{if(X?.emitInitial??!0)U(mT(T));if(typeof window>"u")return()=>{};let J=w(g.INSTANCE_FLOW_STATE_CHANGED),K=(M)=>{let v=M.detail;if(!n(v)||v.flowHandleId!==T)return;let JT={isOpen:v.isOpen,isLoading:v.isLoading,width:v.width,height:v.height};OT(T,JT),U(N(JT))},j=!1,O=X?.signal,$=null,Q=()=>{if(j)return;if(j=!0,window.removeEventListener(J,K),O&&$)O.removeEventListener("abort",$)};if(window.addEventListener(J,K),O){if($=()=>{Q()},O.aborted)return Q(),Q;O.addEventListener("abort",$,{once:!0})}return Q},fT=(T,U)=>{if(U?.emitInitial??!0)T(UT());if(typeof window>"u")return()=>{};let X=w(g.INSTANCE_FLOW_STATE_CHANGED_INSTANCE),J=(Q)=>{let M=Q.detail;if(!a(M)||M.instanceId!==c)return;let v={isOpen:M.isOpen,isLoading:M.isLoading,width:M.width,height:M.height};PT(v),T(N(v))},K=!1,j=U?.signal,O=null,$=()=>{if(K)return;if(K=!0,window.removeEventListener(X,J),j&&O)j.removeEventListener("abort",O)};if(window.addEventListener(X,J),j){if(O=()=>{$()},j.aborted)return $(),$;j.addEventListener("abort",O,{once:!0})}return $},hT=(T)=>{let U=vT(),X=[],J=DT({getHandleIdFromSettlement:(O)=>{return l(O)?.flowHandleId}}),K=()=>{let O=J.getHandleId();if(!O)return;for(let $ of U.drain())if($.type==="setContainer")jT(O,$.element);else P(k({kind:"close",flowHandleId:O}));for(let $ of X)GT(O,$.callback,$.options);X.length=0};J.subscribeHandle((O)=>{xT(O),K()});let j=async(O)=>{await J.runCommand(O,async($)=>{$T();let Q=Y();return h({version:"1",requestId:Q,idempotencyKey:Q,command:$}),B({requestId:Q})})};return{flowId:T,open:(O)=>P(j(($)=>({kind:"open",flowId:T,flowHandleId:$,containerRequirement:O?.containerRequirement,hideCloseButton:O?.hideCloseButton}))),prefetch:()=>P(j((O)=>({kind:"prefetch",flowId:T,flowHandleId:O}))),prerender:(O)=>P(j(($)=>({kind:"prerender",flowId:T,flowHandleId:$,hideCloseButton:O?.hideCloseButton}))),close:()=>{let O=J.getHandleId();if(!O)return U.push({type:"close"}),Promise.resolve();return P(k({kind:"close",flowHandleId:O}))},setContainer:(O)=>{let $=J.getHandleId();if(!$){U.push({type:"setContainer",element:O});return}jT($,O)},getFlowState:()=>{let O=J.getHandleId();return O?mT(O):N(A)},subscribeFlowState:(O,$)=>{let Q=J.getHandleId();if(!Q){if($?.emitInitial!==!1)O(N(A));return X.push({callback:O,options:$}),()=>{let M=X.findIndex((v)=>v.callback===O);if(M>=0)X.splice(M,1)}}return GT(Q,O,$)}}},QT=new Map,kT=(T)=>{let U=T.trim();if(!U)throw Error("flowId must be a non-empty string");let X=QT.get(U);if(X)return X;let J=hT(U);return QT.set(U,J),J},LT=()=>{if(typeof window>"u")return Promise.resolve();return P(k({kind:"close"}))},qT=()=>{if(typeof window>"u")return Promise.resolve();return P(k({kind:"reset"}))};function gT(T,U){if(typeof window>"u")return Promise.resolve();return P(k(cT(T,U)))}let i={load:s,setDefaultContainerPolicy:(T)=>{o(T)},setContainer:(T)=>{ST(T)},getFlowState:()=>UT(),subscribeFlowState:(T,U)=>fT(T,U),flow:kT,close:LT,reset:qT,configure:(T)=>{if(typeof window>"u")return Promise.resolve();if(!f())return Promise.resolve();return P(k({kind:"configure",opts:T}))},identify:gT};if(y.set(W,{client:i,updateOptions:KT}),!q)i.load();return i};export{iT as createClient,e as SDK_VERSION};
|
|
2
2
|
|
|
3
|
-
//# debugId=
|
|
3
|
+
//# debugId=D669065FCE5028D664756E2164756E21
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../shared/src/constants.ts", "../../shared/src/unique-id.ts", "../../shared/src/request-id.ts", "../../shared/src/protocol/host-event-contract.ts", "../../shared/src/protocol/command-settlement.ts", "../../shared/src/protocol/command-dispatch.ts", "../src/version.ts", "../src/client.ts"],
|
|
3
|
+
"sources": ["../../shared/src/constants.ts", "../../shared/src/unique-id.ts", "../../shared/src/request-id.ts", "../../shared/src/protocol/host-event-contract.ts", "../../shared/src/protocol/command-settlement.ts", "../../shared/src/protocol/command-dispatch.ts", "../src/version.ts", "../../shared/src/utils/lazy-handle-client.ts", "../../shared/src/utils/pending-queue.ts", "../src/client.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { PublicCommandPayload } from \"./protocol/sdk-types\";\n\n// TODO: review this file and remove unused events\n\nexport const TELEMETRY_EVENTS = {\n\tINSTANCE_READY: \"instance_ready\",\n\tVIEW_DISPLAYED: \"view_displayed\",\n\tVIEW_CLOSED: \"view_closed\",\n\tFLOW_DISPLAYED: \"flow_displayed\",\n\tFLOW_CLOSED: \"flow_closed\",\n} as const;\n\nexport type TelemetryEventName =\n\t(typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EVENTS];\n\n// Data attribute used to anchor widget styles & root element. Shared so build\n// scripts, runtime code and tests stay in sync.\nexport const WIDGET_SELECTOR = \"[data-gx-widget]\" as const;\n\nexport const PARENT_ORIGIN_PARAM = \"gx_parent_origin\" as const;\n\nexport const WIDGET_EVENTS = {\n\tREADY: \"gx:ready\",\n\tBRIDGE_MOUNTED: \"gx:bridge-mounted\",\n\tBRIDGE_UNMOUNTED: \"gx:bridge-unmounted\",\n\tIFRAME_READY: \"gx:iframe-ready\",\n} as const;\n\nexport type WidgetEventName =\n\t(typeof WIDGET_EVENTS)[keyof typeof WIDGET_EVENTS];\n\n// Host event names (DOM events emitted by widget for external consumption)\n// Uses prefix \"getuserfeedback:\" for namespacing\nexport const HOST_EVENT_PREFIX = \"getuserfeedback:\" as const;\n\nexport const HOST_EVENT_KEYS = {\n\tINSTANCE_FLOW_STATE_CHANGED: \"instance:flow:state-changed\",\n\tINSTANCE_FLOW_STATE_CHANGED_INSTANCE: \"instance:flow:state-changed:instance\",\n\tINSTANCE_COMMAND_SETTLED: \"instance:command:settled\",\n\tINSTANCE_COMMAND_UNSUPPORTED: \"instance:command:unsupported\",\n\tINSTANCE_READY: \"instance:ready\",\n\tINSTANCE_BRIDGE_MOUNTED: \"instance:bridge:mounted\",\n\tINSTANCE_BRIDGE_UNMOUNTED: \"instance:bridge:unmounted\",\n\tINSTANCE_IFRAME_READY: \"instance:iframe:ready\",\n\tINSTANCE_ERROR: \"instance:error\",\n\tINSTANCE_APP_EVENT: \"instance:app-event\",\n} as const;\n\ntype SdkCapabilityCommandKind = Exclude<PublicCommandPayload[\"kind\"], \"init\">;\n\nconst SDK_COMMAND_CAPABILITY_BY_KIND = {\n\tconfigure: \"gx.command.configure.v1\",\n\topen: \"gx.command.open.v1\",\n\tprefetch: \"gx.command.prefetch.v1\",\n\tprerender: \"gx.command.prerender.v1\",\n\tidentify: \"gx.command.identify.v1\",\n\tclose: \"gx.command.close.v1\",\n\treset: \"gx.command.reset.v1\",\n\tsetContainer: \"gx.command.setContainer.v1\",\n\tsetDefaultContainerPolicy: \"gx.command.setDefaultContainerPolicy.v1\",\n} as const satisfies Record<\n\tSdkCapabilityCommandKind,\n\t`gx.command.${string}.v${number}`\n>;\n\nconst SDK_COMMAND_CAPABILITIES = [\n\tSDK_COMMAND_CAPABILITY_BY_KIND.configure,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.open,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.prefetch,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.prerender,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.identify,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.close,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.reset,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.setContainer,\n\tSDK_COMMAND_CAPABILITY_BY_KIND.setDefaultContainerPolicy,\n] as const;\n\ntype SdkCommandCapability =\n\t(typeof SDK_COMMAND_CAPABILITY_BY_KIND)[keyof typeof SDK_COMMAND_CAPABILITY_BY_KIND];\ntype _AssertAllCommandCapabilitiesAreAnnounced =\n\tExclude<\n\t\tSdkCommandCapability,\n\t\t(typeof SDK_COMMAND_CAPABILITIES)[number]\n\t> extends never\n\t\t? true\n\t\t: never;\ntype _AssertNoUnknownCommandCapabilities =\n\tExclude<\n\t\t(typeof SDK_COMMAND_CAPABILITIES)[number],\n\t\tSdkCommandCapability\n\t> extends never\n\t\t? true\n\t\t: never;\n\n/**\n * Stable capability tokens announced by the browser SDK during init.\n * These are versioned and namespaced to support forward-compatible negotiation.\n */\nexport const SDK_PROTOCOL_CAPABILITIES = [\n\t\"gx.protocol.public.v1\",\n\t...SDK_COMMAND_CAPABILITIES,\n] as const;\n\nexport type SdkProtocolCapability = (typeof SDK_PROTOCOL_CAPABILITIES)[number];\n\nexport const LOADER_RUNTIME_GLOBAL_KEY = \"__getuserfeedback_runtime\" as const;\nexport const LOADER_RUNTIME_PROTOCOL_VERSION = \"v1\" as const;\n\n// Helper to construct full event name with prefix\nexport const toHostEventName = (key: string): string =>\n\t`${HOST_EVENT_PREFIX}${key}`;\n",
|
|
6
6
|
"/**\n * Generates a unique string ID. Uses crypto.randomUUID when available,\n * otherwise falls back to a timestamp + random string.\n *\n * @param prefix - Optional prefix for the fallback format (e.g. \"req\", \"err\").\n * Only affects fallback; UUIDs have no prefix.\n */\nexport function createUniqueId(prefix?: string): string {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\tconst fallback = `${Date.now()}_${Math.random().toString(36).slice(2)}`;\n\treturn prefix ? `${prefix}_${fallback}` : fallback;\n}\n",
|
|
7
7
|
"import { createUniqueId } from \"./unique-id\";\n\nexport const createCommandRequestId = (): string => createUniqueId(\"req\");\n",
|
|
8
|
-
"/**\n * Types and type guards for flow state and lifecycle events.\n */\n\n/** Current state of the flow: whether it is open, loading, and its dimensions (if known). */\nexport interface FlowState {\n\t/** True when the flow is visible. */\n\tisOpen: boolean;\n\t/** True when the flow is loading (e.g. fetching or rendering). */\n\tisLoading: boolean;\n\t/** Flow width in pixels when known. */\n\twidth?: number;\n\t/** Flow height in pixels when known. */\n\theight?: number;\n}\n\nexport interface FlowStateChangedDetail extends FlowState {\n\tinstanceId: string;\n\tflowHandleId: string;\n}\n\nexport interface InstanceFlowStateChangedDetail extends FlowState {\n\tinstanceId: string;\n}\n\nconst isNonEmptyString = (v: unknown): v is string =>\n\ttypeof v === \"string\" && v.trim().length > 0;\n\nexport function isFlowStateChangedDetail(\n\tdetail: unknown,\n): detail is FlowStateChangedDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\treturn (\n\t\tisNonEmptyString(d.instanceId) &&\n\t\ttypeof d.isOpen === \"boolean\" &&\n\t\ttypeof d.isLoading === \"boolean\" &&\n\t\t(typeof d.width === \"undefined\" || typeof d.width === \"number\") &&\n\t\t(typeof d.height === \"undefined\" || typeof d.height === \"number\") &&\n\t\tisNonEmptyString(d.flowHandleId)\n\t);\n}\n\nexport function isInstanceFlowStateChangedDetail(\n\tdetail: unknown,\n): detail is InstanceFlowStateChangedDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\treturn (\n\t\tisNonEmptyString(d.instanceId) &&\n\t\ttypeof d.isOpen === \"boolean\" &&\n\t\ttypeof d.isLoading === \"boolean\" &&\n\t\t(typeof d.width === \"undefined\" || typeof d.width === \"number\") &&\n\t\t(typeof d.height === \"undefined\" || typeof d.height === \"number\")\n\t);\n}\n\nexport interface CommandSettledSuccessDetail {\n\trequestId: string;\n\tinstanceId: string | null;\n\tkind: string;\n\tok: true;\n\tresult?: unknown;\n}\n\nexport interface CommandSettledFailureDetail {\n\trequestId: string;\n\tinstanceId: string | null;\n\tkind: string;\n\tok: false;\n\terror: { message: string; code?: string };\n}\n\nexport type CommandSettledDetail =\n\t| CommandSettledSuccessDetail\n\t| CommandSettledFailureDetail;\n\nexport function isCommandSettledDetail(\n\tdetail: unknown,\n): detail is CommandSettledDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\tif (\n\t\t!isNonEmptyString(d.requestId) ||\n\t\t(typeof d.instanceId !== \"string\" && d.instanceId !== null) ||\n\t\ttypeof d.kind !== \"string\" ||\n\t\ttypeof d.ok !== \"boolean\"\n\t) {\n\t\treturn false;\n\t}\n\tif (d.ok === true) {\n\t\treturn true;\n\t}\n\tif (d.ok === false && typeof d.error === \"object\" && d.error !== null) {\n\t\tconst err = d.error as Record<string, unknown>;\n\t\treturn typeof err.message === \"string\";\n\t}\n\treturn false;\n}\n",
|
|
8
|
+
"/**\n * Types and type guards for flow state and lifecycle events.\n */\n\n/** Current state of the flow: whether it is open, loading, and its dimensions (if known). */\nexport interface FlowState {\n\t/** True when the flow is visible. */\n\tisOpen: boolean;\n\t/** True when the flow is loading (e.g. fetching or rendering). */\n\tisLoading: boolean;\n\t/** Flow width in pixels when known. */\n\twidth?: number;\n\t/** Flow height in pixels when known. */\n\theight?: number;\n}\n\nexport interface FlowStateChangedDetail extends FlowState {\n\tinstanceId: string;\n\tflowHandleId: string;\n}\n\nexport interface InstanceFlowStateChangedDetail extends FlowState {\n\tinstanceId: string;\n}\n\nconst isNonEmptyString = (v: unknown): v is string =>\n\ttypeof v === \"string\" && v.trim().length > 0;\n\nexport function isFlowStateChangedDetail(\n\tdetail: unknown,\n): detail is FlowStateChangedDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\treturn (\n\t\tisNonEmptyString(d.instanceId) &&\n\t\ttypeof d.isOpen === \"boolean\" &&\n\t\ttypeof d.isLoading === \"boolean\" &&\n\t\t(typeof d.width === \"undefined\" || typeof d.width === \"number\") &&\n\t\t(typeof d.height === \"undefined\" || typeof d.height === \"number\") &&\n\t\tisNonEmptyString(d.flowHandleId)\n\t);\n}\n\nexport function isInstanceFlowStateChangedDetail(\n\tdetail: unknown,\n): detail is InstanceFlowStateChangedDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\treturn (\n\t\tisNonEmptyString(d.instanceId) &&\n\t\ttypeof d.isOpen === \"boolean\" &&\n\t\ttypeof d.isLoading === \"boolean\" &&\n\t\t(typeof d.width === \"undefined\" || typeof d.width === \"number\") &&\n\t\t(typeof d.height === \"undefined\" || typeof d.height === \"number\")\n\t);\n}\n\nexport interface CommandSettledSuccessDetail {\n\trequestId: string;\n\tinstanceId: string | null;\n\tkind: string;\n\tok: true;\n\tresult?: unknown;\n}\n\nexport interface CommandSettledFailureDetail {\n\trequestId: string;\n\tinstanceId: string | null;\n\tkind: string;\n\tok: false;\n\terror: { message: string; code?: string };\n}\n\nexport type CommandSettledDetail =\n\t| CommandSettledSuccessDetail\n\t| CommandSettledFailureDetail;\n\nexport function isCommandSettledDetail(\n\tdetail: unknown,\n): detail is CommandSettledDetail {\n\tif (typeof detail !== \"object\" || detail === null) return false;\n\tconst d = detail as Record<string, unknown>;\n\tif (\n\t\t!isNonEmptyString(d.requestId) ||\n\t\t(typeof d.instanceId !== \"string\" && d.instanceId !== null) ||\n\t\ttypeof d.kind !== \"string\" ||\n\t\ttypeof d.ok !== \"boolean\"\n\t) {\n\t\treturn false;\n\t}\n\tif (d.ok === true) {\n\t\treturn true;\n\t}\n\tif (d.ok === false && typeof d.error === \"object\" && d.error !== null) {\n\t\tconst err = d.error as Record<string, unknown>;\n\t\treturn typeof err.message === \"string\";\n\t}\n\treturn false;\n}\n\n/** Result of extracting a flow handle from a successful open/prerender/prefetch settlement. */\nexport type FlowHandleFromSettlement = {\n\tflowHandleId: string;\n\tflowRunId?: string;\n};\n\n/**\n * Host-facing handle result: same shape as FlowHandleFromSettlement.\n * Used when projecting instance:command:settled so the SDK receives flowHandleId (and flowRunId when present).\n */\nexport type HostHandleSettlementResult = FlowHandleFromSettlement;\n\n/**\n * Return the host-facing handle result for a command settlement, or null.\n * Use in the loader when projecting instance:command:settled; keeps the host contract in one place (no zod).\n */\nexport function getHostHandleResultFromSettlement(detail: {\n\tok: boolean;\n\tkind: string;\n\tresult?: unknown;\n}): HostHandleSettlementResult | null {\n\treturn getFlowHandleFromSettlementDetail(detail);\n}\n\nconst HANDLE_RETURNING_KINDS = [\"open\", \"prerender\", \"prefetch\"] as const;\n\n/**\n * Extract flow handle from a successful command settlement when the command\n * is one that can return a handle (open, prerender, prefetch). Uses plain\n * checks only (no Zod). Returns null if detail is not ok, kind is not one of\n * those, or result does not contain a non-empty flowHandleId.\n */\nexport function getFlowHandleFromSettlementDetail(detail: {\n\tok: boolean;\n\tkind: string;\n\tresult?: unknown;\n}): FlowHandleFromSettlement | null {\n\tif (\n\t\t!detail.ok ||\n\t\t!HANDLE_RETURNING_KINDS.includes(\n\t\t\tdetail.kind as (typeof HANDLE_RETURNING_KINDS)[number],\n\t\t)\n\t) {\n\t\treturn null;\n\t}\n\tconst result = detail.result;\n\tif (typeof result !== \"object\" || result === null) {\n\t\treturn null;\n\t}\n\tconst r = result as Record<string, unknown>;\n\tif (!isNonEmptyString(r.flowHandleId)) {\n\t\treturn null;\n\t}\n\treturn {\n\t\tflowHandleId: r.flowHandleId,\n\t\t...(isNonEmptyString(r.flowRunId) && { flowRunId: r.flowRunId }),\n\t};\n}\n",
|
|
9
9
|
"import { HOST_EVENT_KEYS, toHostEventName } from \"../constants\";\nimport {\n\ttype CommandSettledDetail,\n\tisCommandSettledDetail,\n} from \"./host-event-contract\";\n\ntype WaitForCommandSettlementInput = {\n\trequestId: string;\n\twindowRef?: Window;\n\ttimeoutMs?: number;\n};\n\nconst DEFAULT_SETTLEMENT_TIMEOUT_MS = 30_000;\nexport const COMMAND_SETTLEMENT_TIMEOUT_CODE =\n\t\"COMMAND_SETTLEMENT_TIMEOUT\" as const;\n\nexport class CommandSettlementTimeoutError extends Error {\n\treadonly code = COMMAND_SETTLEMENT_TIMEOUT_CODE;\n\treadonly requestId: string;\n\n\tconstructor(requestId: string) {\n\t\tsuper(`Timed out waiting for command settlement: ${requestId}`);\n\t\tthis.name = \"CommandSettlementTimeoutError\";\n\t\tthis.requestId = requestId;\n\t}\n}\n\nconst eventHasDetail = (event: Event): event is Event & { detail: unknown } => {\n\tif (typeof CustomEvent !== \"undefined\") {\n\t\treturn event instanceof CustomEvent;\n\t}\n\treturn typeof event === \"object\" && event !== null && \"detail\" in event;\n};\n\nexport const waitForCommandSettlement = (\n\tinput: WaitForCommandSettlementInput,\n): Promise<CommandSettledDetail> => {\n\tconst requestId = input.requestId.trim();\n\tif (!requestId) {\n\t\treturn Promise.reject(new Error(\"requestId must be a non-empty string\"));\n\t}\n\tconst targetWindow =\n\t\tinput.windowRef ?? (typeof window === \"undefined\" ? undefined : window);\n\tif (!targetWindow) {\n\t\treturn Promise.reject(\n\t\t\tnew Error(\"Cannot await command settlement without window\"),\n\t\t);\n\t}\n\tconst eventName = toHostEventName(HOST_EVENT_KEYS.INSTANCE_COMMAND_SETTLED);\n\tconst timeoutMs = Math.max(\n\t\t0,\n\t\tinput.timeoutMs ?? DEFAULT_SETTLEMENT_TIMEOUT_MS,\n\t);\n\treturn new Promise<CommandSettledDetail>((resolve, reject) => {\n\t\tconst cleanup = (): void => {\n\t\t\tif (typeof targetWindow.removeEventListener === \"function\") {\n\t\t\t\ttargetWindow.removeEventListener(eventName, handleEvent);\n\t\t\t}\n\t\t};\n\n\t\tconst timeoutId = setTimeout(() => {\n\t\t\tcleanup();\n\t\t\treject(new CommandSettlementTimeoutError(requestId));\n\t\t}, timeoutMs);\n\n\t\tconst handleEvent = (event: Event): void => {\n\t\t\tif (!eventHasDetail(event)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst raw = event.detail;\n\t\t\tif (!isCommandSettledDetail(raw) || raw.requestId !== requestId) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst detail = raw;\n\t\t\tcleanup();\n\t\t\tclearTimeout(timeoutId);\n\t\t\tif (detail.ok) {\n\t\t\t\tresolve(detail);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treject(\n\t\t\t\tnew Error(\n\t\t\t\t\tdetail.error.message ??\n\t\t\t\t\t\t`Command ${detail.kind} failed without an error payload`,\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\t\ttargetWindow.addEventListener(eventName, handleEvent);\n\t});\n};\n",
|
|
10
10
|
"import { createCommandRequestId } from \"../request-id\";\nimport { waitForCommandSettlement } from \"./command-settlement\";\nimport type { CommandEnvelope, PublicCommandPayload } from \"./sdk-types\";\n\n/**\n * A command input: the pure payload with `kind` and command-specific fields.\n * Distributes over the PublicCommandPayload union so discriminant\n * narrowing is preserved (e.g. `{ kind: \"open\", flowId }` type-checks).\n */\nexport type CommandInput = PublicCommandPayload extends infer C\n\t? C extends PublicCommandPayload\n\t\t? C\n\t\t: never\n\t: never;\n\ntype DispatchOptions = {\n\tidempotencyKey?: string;\n};\n\n/**\n * Creates a dispatch function that wraps a command payload in an envelope,\n * pushes it into the queue, and returns a promise that settles when the\n * runtime acknowledges it.\n *\n * Request IDs are generated automatically.\n *\n * @example\n * ```ts\n * const dispatch = createCommandDispatch((env) => queue.push(env));\n * await dispatch({ kind: \"open\", flowId: \"f1\", flowHandleId: \"h1\" });\n * ```\n */\nexport const createCommandDispatch = (\n\tpush: (envelope: CommandEnvelope) => void,\n): ((input: CommandInput, options?: DispatchOptions) => Promise<void>) => {\n\treturn async (\n\t\tinput: CommandInput,\n\t\toptions?: DispatchOptions,\n\t): Promise<void> => {\n\t\tconst requestId = createCommandRequestId();\n\t\tconst idempotencyKey = resolveIdempotencyKey(options?.idempotencyKey);\n\t\tconst envelope: CommandEnvelope = {\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: idempotencyKey ?? requestId,\n\t\t\tcommand: input,\n\t\t};\n\t\tpush(envelope);\n\t\tawait waitForCommandSettlement({ requestId });\n\t};\n};\n\nconst resolveIdempotencyKey = (value?: string): string | null => {\n\tif (value === undefined) {\n\t\treturn null;\n\t}\n\tconst idempotencyKey = value.trim();\n\tif (!idempotencyKey) {\n\t\tthrow new Error(\"idempotencyKey must be a non-empty string\");\n\t}\n\treturn idempotencyKey;\n};\n",
|
|
11
11
|
"declare const __GX_SDK_VERSION__: string | undefined;\n\nconst sdkVersion =\n\ttypeof __GX_SDK_VERSION__ === \"string\" ? __GX_SDK_VERSION__.trim() : \"\";\n\n// Build scripts inject __GX_SDK_VERSION__ for published artifacts.\n// Source-linked workspace usage may not inject defines, so keep a safe fallback.\nexport const SDK_VERSION = sdkVersion.length > 0 ? sdkVersion : \"0.0.0-local\";\n",
|
|
12
|
-
"import {\n\tHOST_EVENT_KEYS,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttoHostEventName,\n} from \"shared/constants\";\nimport {\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandDispatch,\n\ttype FlowState as HostFlowState,\n\ttype InitOptions,\n\tisFlowStateChangedDetail,\n\tisInstanceFlowStateChangedDetail,\n\twaitForCommandSettlement,\n} from \"shared/protocol/sdk\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type { ClientOptions };\n\nimport { createCommandRequestId } from \"shared/request-id\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: CommandEnvelope[];\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\n/** Current state of a flow run (open/loading + dimensions when known). */\nexport type FlowState = HostFlowState;\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\n\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/**\n\t * Controls where the flow may mount.\n\t * - `any` (default): loader may use default mounting policy.\n\t * - `hostOnly`: wait until a custom per-flow container is registered.\n\t */\n\tcontainerRequirement?: \"any\" | \"hostOnly\";\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, set container, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow (show the survey). */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Attach the flow UI to a DOM element, or `null` to detach. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n};\n\n/** getuserfeedback client: load the widget, open flows, configure colorScheme/consent/auth, and identify users. */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Attach all instance flows to a DOM element, or `null` to restore default host mounting. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .setContainer(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Reset widget state and user identity. */\n\treset: () => Promise<void>;\n\t/** Update color scheme, consent, or auth. */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/** Associate the current user via either (userId, optionalTraits) or (traits). */\n\tidentify: {\n\t\t(userId: string, traits?: IdentifyTraits): Promise<void>;\n\t\t(traits: IdentifyTraits): Promise<void>;\n\t};\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (options: ClientOptions) => void;\n};\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nconst asFlowHandleId = (value: string): FlowHandleId => value;\n\nconst createFlowHandleId = (): FlowHandleId => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn asFlowHandleId(globalThis.crypto.randomUUID());\n\t}\n\treturn asFlowHandleId(\n\t\t`handle_${Date.now()}_${Math.random().toString(36).slice(2)}`,\n\t);\n};\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraits?: IdentifyTraits,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits,\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t};\n};\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 120;\n\nconst resolveRegistryKey = (options: ClientOptions): string => options.apiKey;\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing client when called with the same\n * `apiKey` and equivalent options; otherwise creates a new one.\n */\nexport const createClient = ({\n\tapiKey,\n\t_cdn = \"https://cdn.getuserfeedback.com\",\n\tdisableAutoLoad = false,\n\tcolorScheme,\n\tdisableTelemetry = false,\n\tenableDebug = false,\n\tdefaultConsent,\n}: ClientOptions): Client => {\n\tconst registryKey = resolveRegistryKey({\n\t\tapiKey,\n\t\t_cdn,\n\t\tdisableAutoLoad,\n\t\tcolorScheme,\n\t\tdisableTelemetry,\n\t\tenableDebug,\n\t\tdefaultConsent,\n\t});\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions({\n\t\t\tapiKey,\n\t\t\t_cdn,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t});\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet _cdnConfig = _cdn;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst loaderVersion = \"v1\";\n\tconst clientInstanceId = createClientInstanceId();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\ttransport: \"snippet\",\n\t};\n\n\tconst capabilities = [...SDK_PROTOCOL_CAPABILITIES];\n\n\tlet defaultConsentConfig = defaultConsent;\n\n\tconst buildInitOpts = (): InitOptions => ({\n\t\tapiKey,\n\t\tclientMeta,\n\t\tcapabilities: [...capabilities],\n\t\t...(colorScheme !== undefined && { colorScheme }),\n\t\t...(disableTelemetry !== undefined && { disableTelemetry }),\n\t\t...(enableDebug !== undefined && { enableDebug }),\n\t\t...(defaultConsentConfig !== undefined && {\n\t\t\tdefaultConsent: defaultConsentConfig,\n\t\t}),\n\t});\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (envelope: CommandEnvelope): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (!window.__getuserfeedback_queue) {\n\t\t\twindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\twindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (requestId?: string): string => {\n\t\tconst registrationRequestId = requestId ?? createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId: registrationRequestId,\n\t\t\tidempotencyKey: registrationRequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts() },\n\t\t});\n\t\treturn registrationRequestId;\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t});\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t});\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawDispatch = createCommandDispatch((cmd) => enqueue(cmd));\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\treturn rawDispatch(input);\n\t};\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn;\n\t\t}\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"configure\", opts },\n\t\t});\n\t};\n\n\tconst updateOptions = (next: ClientOptions): void => {\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\n\t\tif (next._cdn !== undefined && next._cdn !== _cdnConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_cdn cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\t_cdnConfig = next._cdn;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst cdnBase = _cdnConfig.endsWith(\"/\") ? _cdnConfig : `${_cdnConfig}/`;\n\t\t\tconst loaderScriptPath = `loader/${loaderVersion}/${encodeURIComponent(\n\t\t\t\tapiKey,\n\t\t\t)}/loader.js`;\n\t\t\tconst scriptUrl = new URL(loaderScriptPath, cdnBase).toString();\n\t\t\tif (!document.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)) {\n\t\t\t\tconst preload = document.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\tdocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = document.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\tdocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = window[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tenqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(window.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t};\n\n\tconst setContainerForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\t// Always enqueue — commands sit in the global queue until the\n\t\t// loader processes them. The command-router stores containers in\n\t\t// pendingContainer and applies them when a flow run is allocated.\n\t\tenqueueSetContainer(flowHandleId, element);\n\t};\n\n\tconst setDefaultContainer = (element: HTMLElement | null): void => {\n\t\tif (element === null) {\n\t\t\tenqueueSetDefaultContainerPolicy({ kind: \"floating\" });\n\t\t\treturn;\n\t\t}\n\t\tenqueueSetDefaultContainerPolicy({\n\t\t\tkind: \"hostContainer\",\n\t\t\thost: element,\n\t\t\tsharing: \"shared\",\n\t\t});\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst eventName = toHostEventName(\n\t\t\tHOST_EVENT_KEYS.INSTANCE_FLOW_STATE_CHANGED,\n\t\t);\n\n\t\tconst handleFlowStateEvent = (event: Event): void => {\n\t\t\tconst detail = (event as CustomEvent<unknown>).detail;\n\t\t\tif (\n\t\t\t\t!isFlowStateChangedDetail(detail) ||\n\t\t\t\tdetail.flowHandleId !== flowHandleId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\tcallback(cloneFlowState(nextState));\n\t\t};\n\n\t\tlet isUnsubscribed = false;\n\t\tconst signal = options?.signal;\n\t\tlet handleAbort: (() => void) | null = null;\n\n\t\tconst unsubscribe = (): void => {\n\t\t\tif (isUnsubscribed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisUnsubscribed = true;\n\t\t\twindow.removeEventListener(eventName, handleFlowStateEvent);\n\t\t\tif (signal && handleAbort) {\n\t\t\t\tsignal.removeEventListener(\"abort\", handleAbort);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(eventName, handleFlowStateEvent);\n\n\t\tif (signal) {\n\t\t\thandleAbort = () => {\n\t\t\t\tunsubscribe();\n\t\t\t};\n\t\t\tif (signal.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn unsubscribe;\n\t\t\t}\n\t\t\tsignal.addEventListener(\"abort\", handleAbort, { once: true });\n\t\t}\n\n\t\treturn unsubscribe;\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst eventName = toHostEventName(\n\t\t\tHOST_EVENT_KEYS.INSTANCE_FLOW_STATE_CHANGED_INSTANCE,\n\t\t);\n\n\t\tconst handleFlowStateEvent = (event: Event): void => {\n\t\t\tconst detail = (event as CustomEvent<unknown>).detail;\n\t\t\tif (\n\t\t\t\t!isInstanceFlowStateChangedDetail(detail) ||\n\t\t\t\tdetail.instanceId !== clientInstanceId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetInstanceFlowState(nextState);\n\t\t\tcallback(cloneFlowState(nextState));\n\t\t};\n\n\t\tlet isUnsubscribed = false;\n\t\tconst signal = options?.signal;\n\t\tlet handleAbort: (() => void) | null = null;\n\n\t\tconst unsubscribe = (): void => {\n\t\t\tif (isUnsubscribed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisUnsubscribed = true;\n\t\t\twindow.removeEventListener(eventName, handleFlowStateEvent);\n\t\t\tif (signal && handleAbort) {\n\t\t\t\tsignal.removeEventListener(\"abort\", handleAbort);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(eventName, handleFlowStateEvent);\n\n\t\tif (signal) {\n\t\t\thandleAbort = () => {\n\t\t\t\tunsubscribe();\n\t\t\t};\n\t\t\tif (signal.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn unsubscribe;\n\t\t\t}\n\t\t\tsignal.addEventListener(\"abort\", handleAbort, { once: true });\n\t\t}\n\n\t\treturn unsubscribe;\n\t};\n\n\tconst createFlowRun = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput;\n\t\tif (!flowId.trim()) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst flowHandleId = createFlowHandleId();\n\t\tensureFlowStateForHandle(flowHandleId);\n\n\t\treturn {\n\t\t\tflowId,\n\t\t\topen: (options?: OpenFlowOptions) => {\n\t\t\t\treturn reportAsyncError(\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\tflowId,\n\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\tcontainerRequirement: options?.containerRequirement,\n\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t},\n\t\t\tprefetch: () => reportAsyncError(dispatch({ kind: \"prefetch\", flowId })),\n\t\t\tprerender: (options?: PrerenderFlowOptions) =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tdispatch({\n\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\tflowId,\n\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\tclose: () => reportAsyncError(dispatch({ kind: \"close\", flowHandleId })),\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tsetContainerForHandle(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState: () => getFlowStateForHandle(flowHandleId),\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => subscribeFlowStateForHandle(flowHandleId, callback, options),\n\t\t};\n\t};\n\n\tconst flow = (flowIdInput: string): FlowRun => createFlowRun(flowIdInput);\n\n\tconst close = (): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(dispatch({ kind: \"close\" }));\n\t};\n\n\tconst reset = (): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(dispatch({ kind: \"reset\" }));\n\t};\n\n\tfunction identify(userId: string, traits?: IdentifyTraits): Promise<void>;\n\tfunction identify(traits: IdentifyTraits): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraits?: IdentifyTraits,\n\t): Promise<void> {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(toIdentifyCommandPayload(identifyInput, traits)),\n\t\t);\n\t}\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\treturn reportAsyncError(dispatch({ kind: \"configure\", opts: updates }));\n\t};\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\tsetDefaultContainer(element);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t};\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n\nexport default createClient;\n"
|
|
12
|
+
"type Subscriber<THandleId extends string> = (handleId: THandleId) => void;\n\nexport type LazyHandleClient<THandleId extends string, TSettlement> = {\n\trunCommand: <TPayload>(\n\t\tbuildPayload: (handleId: THandleId | undefined) => TPayload,\n\t\tdispatchAndWait: (payload: TPayload) => Promise<TSettlement>,\n\t) => Promise<TSettlement>;\n\tgetHandleId: () => THandleId | undefined;\n\tsubscribeHandle: (subscriber: Subscriber<THandleId>) => () => void;\n};\n\nexport type CreateLazyHandleClientOptions<\n\tTHandleId extends string,\n\tTSettlement,\n> = {\n\tgetHandleIdFromSettlement: (settlement: TSettlement) => THandleId | undefined;\n};\n\n/**\n * Serializes commands for a lazily initialized handle.\n * Each command payload is built only when its turn runs, so it always sees\n * the latest settled handle id from prior commands.\n */\nexport const createLazyHandleClient = <THandleId extends string, TSettlement>(\n\toptions: CreateLazyHandleClientOptions<THandleId, TSettlement>,\n): LazyHandleClient<THandleId, TSettlement> => {\n\tlet handleId: THandleId | undefined;\n\tlet tail = Promise.resolve();\n\tlet isIdle = true;\n\tconst subscribers = new Set<Subscriber<THandleId>>();\n\n\tconst publishHandle = (nextHandleId: THandleId): void => {\n\t\thandleId = nextHandleId;\n\t\tfor (const subscriber of subscribers) {\n\t\t\tsubscriber(nextHandleId);\n\t\t}\n\t};\n\n\tconst runCommand: LazyHandleClient<THandleId, TSettlement>[\"runCommand\"] = (\n\t\tbuildPayload,\n\t\tdispatchAndWait,\n\t) => {\n\t\tconst execute = async (): Promise<TSettlement> => {\n\t\t\tconst payload = buildPayload(handleId);\n\t\t\tconst settlement = await dispatchAndWait(payload);\n\t\t\tconst settledHandleId = options.getHandleIdFromSettlement(settlement);\n\t\t\tif (settledHandleId) {\n\t\t\t\tpublishHandle(settledHandleId);\n\t\t\t}\n\t\t\treturn settlement;\n\t\t};\n\n\t\tconst run = isIdle ? execute() : tail.then(execute, execute);\n\t\tisIdle = false;\n\t\ttail = run.then(\n\t\t\t() => {\n\t\t\t\tisIdle = true;\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tisIdle = true;\n\t\t\t},\n\t\t);\n\t\treturn run;\n\t};\n\n\treturn {\n\t\trunCommand,\n\t\tgetHandleId: () => handleId,\n\t\tsubscribeHandle: (subscriber) => {\n\t\t\tsubscribers.add(subscriber);\n\t\t\tif (handleId) {\n\t\t\t\tsubscriber(handleId);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tsubscribers.delete(subscriber);\n\t\t\t};\n\t\t},\n\t};\n};\n",
|
|
13
|
+
"/**\n * Simple typed FIFO queue: push items, drain returns and clears.\n * Use for pending actions that are applied in order when ready.\n */\nexport function createPendingQueue<T>(): {\n\tpush: (item: T) => void;\n\tdrain: () => T[];\n} {\n\tconst queue: T[] = [];\n\treturn {\n\t\tpush: (item: T) => {\n\t\t\tqueue.push(item);\n\t\t},\n\t\tdrain: () => {\n\t\t\tconst out = queue.slice();\n\t\t\tqueue.length = 0;\n\t\t\treturn out;\n\t\t},\n\t};\n}\n",
|
|
14
|
+
"import {\n\tHOST_EVENT_KEYS,\n\tLOADER_RUNTIME_GLOBAL_KEY,\n\tLOADER_RUNTIME_PROTOCOL_VERSION,\n\tSDK_PROTOCOL_CAPABILITIES,\n\ttoHostEventName,\n} from \"shared/constants\";\nimport {\n\ttype ClientMeta,\n\ttype ClientOptions,\n\ttype Command,\n\ttype CommandEnvelope,\n\tCommandSettlementTimeoutError,\n\ttype ConfigureOptions,\n\ttype ContainerPolicy,\n\tcreateCommandDispatch,\n\ttype FlowState as HostFlowState,\n\ttype InitOptions,\n\tisFlowStateChangedDetail,\n\tisInstanceFlowStateChangedDetail,\n\twaitForCommandSettlement,\n} from \"shared/protocol/sdk\";\nimport { SDK_VERSION } from \"./version\";\n\nexport type { ClientOptions };\n\nimport { getFlowHandleFromSettlementDetail } from \"shared/protocol/sdk\";\nimport { createCommandRequestId } from \"shared/request-id\";\nimport { createLazyHandleClient } from \"shared/utils/lazy-handle-client\";\nimport { createPendingQueue } from \"shared/utils/pending-queue\";\n\n/** @internal */\ndeclare global {\n\tinterface Window {\n\t\t__getuserfeedback_queue?: CommandEnvelope[];\n\t\t[LOADER_RUNTIME_GLOBAL_KEY]?: {\n\t\t\talive?: boolean;\n\t\t\tprotocolVersion?: string;\n\t\t};\n\t}\n}\n\ntype FlowHandleId = string;\n\n/** Current state of a flow run (open/loading + dimensions when known). */\nexport type FlowState = HostFlowState;\n\n/** Callback invoked when flow state changes. */\nexport type FlowStateCallback = (state: FlowState) => void;\ntype IdentifyTraits = Record<string, unknown>;\n\n/** Options for opening a flow run. */\nexport type OpenFlowOptions = {\n\t/**\n\t * Controls where the flow may mount.\n\t * - `any` (default): loader may use default mounting policy.\n\t * - `hostOnly`: wait until a custom per-flow container is registered.\n\t */\n\tcontainerRequirement?: \"any\" | \"hostOnly\";\n\t/**\n\t * When `true`, the flow view does not show a close button.\n\t * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for prerendering a flow run. */\nexport type PrerenderFlowOptions = {\n\t/**\n\t * When `true`, the prerendered view does not show a close button.\n\t */\n\thideCloseButton?: boolean;\n};\n\n/** Options for subscribing to flow state updates. */\nexport type SubscribeFlowStateOptions = {\n\t/** Emit the current snapshot immediately. Default `true`. */\n\temitInitial?: boolean;\n\t/** Auto-unsubscribe when the signal is aborted. */\n\tsignal?: AbortSignal;\n};\n\nconst DEFAULT_FLOW_STATE: FlowState = {\n\tisOpen: false,\n\tisLoading: false,\n\twidth: undefined,\n\theight: undefined,\n};\n\n/** Instance for a specific flow: open, prefetch, prerender, close, set container, and subscribe to flow state. */\nexport type FlowRun = {\n\t/** The flow/survey ID this instance refers to. */\n\tflowId: string;\n\t/** Open the flow (show the survey). */\n\topen: (options?: OpenFlowOptions) => Promise<void>;\n\t/** Prefetch the flow so it opens faster when you call `open()`. */\n\tprefetch: () => Promise<void>;\n\t/** Prerender the flow into a container (e.g. for a custom dialog). */\n\tprerender: (options?: PrerenderFlowOptions) => Promise<void>;\n\t/** Close this flow. */\n\tclose: () => Promise<void>;\n\t/** Attach the flow UI to a DOM element, or `null` to detach. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Return the latest known flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to open/loading/dimensions; returns an unsubscribe function. */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n};\n\n/** getuserfeedback client: load the widget, open flows, configure colorScheme/consent/auth, and identify users. */\nexport type Client = {\n\t/** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */\n\tload: () => void;\n\t/** Set how this instance should choose default containers for flows. */\n\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => void;\n\t/** Attach all instance flows to a DOM element, or `null` to restore default host mounting. */\n\tsetContainer: (element: HTMLElement | null) => void;\n\t/** Return the latest known instance-level flow state snapshot. */\n\tgetFlowState: () => FlowState;\n\t/** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */\n\tsubscribeFlowState: (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t) => () => void;\n\t/** Return a flow instance; call .open(), .prefetch(), .prerender(), .setContainer(), .close() on it. */\n\tflow: (flowId: string) => FlowRun;\n\t/** Close all open flows. */\n\tclose: () => Promise<void>;\n\t/** Reset widget state and user identity. */\n\treset: () => Promise<void>;\n\t/** Update color scheme, consent, or auth. */\n\tconfigure: (updates: ConfigureOptions) => Promise<void>;\n\t/** Associate the current user via either (userId, optionalTraits) or (traits). */\n\tidentify: {\n\t\t(userId: string, traits?: IdentifyTraits): Promise<void>;\n\t\t(traits: IdentifyTraits): Promise<void>;\n\t};\n};\n\ntype ClientRegistryEntry = {\n\tclient: Client;\n\tupdateOptions: (options: ClientOptions) => void;\n};\n\nconst clientRegistry = new Map<object, Map<string, ClientRegistryEntry>>();\n\nconst createClientInstanceId = (): string => {\n\tif (\n\t\ttypeof globalThis.crypto !== \"undefined\" &&\n\t\ttypeof globalThis.crypto.randomUUID === \"function\"\n\t) {\n\t\treturn globalThis.crypto.randomUUID();\n\t}\n\treturn `sdk-${Date.now()}-${Math.random().toString(16).slice(2)}`;\n};\n\nconst toIdentifyCommandPayload = (\n\tidentifyInput: string | IdentifyTraits,\n\ttraits?: IdentifyTraits,\n): Extract<Command, { kind: \"identify\" }> => {\n\tif (typeof identifyInput === \"string\") {\n\t\treturn {\n\t\t\tkind: \"identify\",\n\t\t\tuserId: identifyInput,\n\t\t\ttraits,\n\t\t};\n\t}\n\treturn {\n\t\tkind: \"identify\",\n\t\ttraits: identifyInput,\n\t};\n};\n\nconst LOADER_RUNTIME_PROBE_TIMEOUT_MS = 120;\nconst LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS = 120;\n\nconst resolveRegistryKey = (options: ClientOptions): string => options.apiKey;\n\nconst resolveRegistryScope = (): object =>\n\ttypeof window === \"undefined\" ? globalThis : window;\n\nconst getRegistryForScope = (): Map<string, ClientRegistryEntry> => {\n\tconst scope = resolveRegistryScope();\n\tconst existing = clientRegistry.get(scope);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = new Map<string, ClientRegistryEntry>();\n\tclientRegistry.set(scope, created);\n\treturn created;\n};\n\n/**\n * Create a getuserfeedback client. Reuses an existing client when called with the same\n * `apiKey` and equivalent options; otherwise creates a new one.\n */\nexport const createClient = ({\n\tapiKey,\n\t_cdn = \"https://cdn.getuserfeedback.com\",\n\tdisableAutoLoad = false,\n\tcolorScheme,\n\tdisableTelemetry = false,\n\tenableDebug = false,\n\tdefaultConsent,\n}: ClientOptions): Client => {\n\tconst registryKey = resolveRegistryKey({\n\t\tapiKey,\n\t\t_cdn,\n\t\tdisableAutoLoad,\n\t\tcolorScheme,\n\t\tdisableTelemetry,\n\t\tenableDebug,\n\t\tdefaultConsent,\n\t});\n\tconst registry = getRegistryForScope();\n\tconst existing = registry.get(registryKey);\n\tif (existing) {\n\t\texisting.updateOptions({\n\t\t\tapiKey,\n\t\t\t_cdn,\n\t\t\tdisableAutoLoad,\n\t\t\tcolorScheme,\n\t\t\tdisableTelemetry,\n\t\t\tenableDebug,\n\t\t\tdefaultConsent,\n\t\t});\n\t\tif (!disableAutoLoad) {\n\t\t\texisting.client.load();\n\t\t}\n\t\treturn existing.client;\n\t}\n\n\tlet _cdnConfig = _cdn;\n\n\tconst notifyError = (_error: unknown): void => {\n\t\t// No-op: track/use hooks removed from public API.\n\t};\n\n\tconst sdkVersion = SDK_VERSION;\n\tconst loaderVersion = \"v1\";\n\tconst clientInstanceId = createClientInstanceId();\n\tconst clientMeta: ClientMeta = {\n\t\tloader: \"sdk\",\n\t\tclientName: \"@getuserfeedback/sdk\",\n\t\tclientVersion: sdkVersion,\n\t\ttransport: \"snippet\",\n\t};\n\n\tconst capabilities = [...SDK_PROTOCOL_CAPABILITIES];\n\n\tlet defaultConsentConfig = defaultConsent;\n\n\tconst buildInitOpts = (): InitOptions => ({\n\t\tapiKey,\n\t\tclientMeta,\n\t\tcapabilities: [...capabilities],\n\t\t...(colorScheme !== undefined && { colorScheme }),\n\t\t...(disableTelemetry !== undefined && { disableTelemetry }),\n\t\t...(enableDebug !== undefined && { enableDebug }),\n\t\t...(defaultConsentConfig !== undefined && {\n\t\t\tdefaultConsent: defaultConsentConfig,\n\t\t}),\n\t});\n\n\tlet loaderRequested = false;\n\tlet pendingLoad: Promise<void> | null = null;\n\tlet disableAutoLoadConfig = disableAutoLoad;\n\tconst flowStateByHandle = new Map<FlowHandleId, FlowState>();\n\tlet instanceFlowState: FlowState = DEFAULT_FLOW_STATE;\n\n\tconst cloneFlowState = (state: FlowState): FlowState => ({\n\t\tisOpen: state.isOpen,\n\t\tisLoading: state.isLoading,\n\t\twidth: state.width,\n\t\theight: state.height,\n\t});\n\n\tconst getFlowStateForHandle = (flowHandleId: FlowHandleId): FlowState => {\n\t\tconst existing = flowStateByHandle.get(flowHandleId);\n\t\tif (!existing) {\n\t\t\treturn cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t}\n\t\treturn cloneFlowState(existing);\n\t};\n\n\tconst setFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tstate: FlowState,\n\t): void => {\n\t\tflowStateByHandle.set(flowHandleId, cloneFlowState(state));\n\t};\n\n\tconst getInstanceFlowState = (): FlowState =>\n\t\tcloneFlowState(instanceFlowState);\n\n\tconst setInstanceFlowState = (state: FlowState): void => {\n\t\tinstanceFlowState = cloneFlowState(state);\n\t};\n\n\tconst ensureFlowStateForHandle = (flowHandleId: FlowHandleId): void => {\n\t\tif (!flowStateByHandle.has(flowHandleId)) {\n\t\t\tsetFlowStateForHandle(flowHandleId, DEFAULT_FLOW_STATE);\n\t\t}\n\t};\n\n\tconst isLoaderRequested = (): boolean => loaderRequested;\n\n\tconst enqueue = (envelope: CommandEnvelope): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (!window.__getuserfeedback_queue) {\n\t\t\twindow.__getuserfeedback_queue = [];\n\t\t}\n\t\t// Stamp instanceId and clientMeta so the loader can route commands.\n\t\tconst stamped: CommandEnvelope = {\n\t\t\t...envelope,\n\t\t\tinstanceId: envelope.instanceId ?? clientInstanceId,\n\t\t\tclientMeta: envelope.clientMeta ?? clientMeta,\n\t\t};\n\t\twindow.__getuserfeedback_queue.push(stamped);\n\t};\n\n\tconst enqueueInstanceRegistration = (requestId?: string): string => {\n\t\tconst registrationRequestId = requestId ?? createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\tinstanceId: clientInstanceId,\n\t\t\trequestId: registrationRequestId,\n\t\t\tidempotencyKey: registrationRequestId,\n\t\t\tcommand: { kind: \"init\", opts: buildInitOpts() },\n\t\t});\n\t\treturn registrationRequestId;\n\t};\n\n\tconst enqueueSetContainer = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"setContainer\", flowHandleId, container: element },\n\t\t});\n\t};\n\n\tconst enqueueSetDefaultContainerPolicy = (policy: ContainerPolicy): void => {\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"setDefaultContainerPolicy\", policy },\n\t\t});\n\t};\n\n\tconst reportAsyncError = <T>(promise: Promise<T>): Promise<T> => {\n\t\treturn promise.catch((error) => {\n\t\t\tnotifyError(error);\n\t\t\tthrow error;\n\t\t});\n\t};\n\n\tconst ensureCommandsCanRun = (): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\tif (disableAutoLoadConfig) {\n\t\t\t\tthrow new Error(\"Widget not loaded. Call client.load() first.\");\n\t\t\t}\n\t\t\tload();\n\t\t}\n\t};\n\n\t/** Enqueue a command and await its settlement.\n\t * The loader resolves instanceId from the instance registry. */\n\tconst rawDispatch = createCommandDispatch((cmd) => enqueue(cmd));\n\tconst dispatch = async (input: Command): Promise<void> => {\n\t\tensureCommandsCanRun();\n\t\treturn rawDispatch(input);\n\t};\n\n\tconst enqueueConfigUpdate = (opts: ConfigureOptions): void => {\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn;\n\t\t}\n\t\tconst requestId = createCommandRequestId();\n\t\tenqueue({\n\t\t\tversion: \"1\",\n\t\t\trequestId,\n\t\t\tidempotencyKey: requestId,\n\t\t\tcommand: { kind: \"configure\", opts },\n\t\t});\n\t};\n\n\tconst updateOptions = (next: ClientOptions): void => {\n\t\tdisableAutoLoadConfig = next.disableAutoLoad ?? disableAutoLoadConfig;\n\t\tdefaultConsentConfig = next.defaultConsent ?? defaultConsentConfig;\n\n\t\tif (next._cdn !== undefined && next._cdn !== _cdnConfig) {\n\t\t\tif (isLoaderRequested() || pendingLoad !== null) {\n\t\t\t\tconst error = new Error(\n\t\t\t\t\t\"_cdn cannot be changed after widget init; keeping original\",\n\t\t\t\t);\n\t\t\t\tnotifyError(error);\n\t\t\t} else {\n\t\t\t\t_cdnConfig = next._cdn;\n\t\t\t}\n\t\t}\n\n\t\tapplyStartupConfig(next);\n\n\t\tif (!disableAutoLoadConfig && !isLoaderRequested()) {\n\t\t\tload();\n\t\t}\n\t};\n\n\tconst applyStartupConfig = (next: ClientOptions): void => {\n\t\t// Send configure payload from next (colorScheme only from ClientOptions).\n\t\tif (!isLoaderRequested()) return;\n\t\tconst opts: ConfigureOptions = {};\n\t\tif (next.colorScheme !== undefined) opts.colorScheme = next.colorScheme;\n\t\tenqueueConfigUpdate(opts);\n\t};\n\n\tconst load = (): void => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn;\n\t\t}\n\t\tif (isLoaderRequested() || pendingLoad) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst appendLoaderScript = (): void => {\n\t\t\tconst cdnBase = _cdnConfig.endsWith(\"/\") ? _cdnConfig : `${_cdnConfig}/`;\n\t\t\tconst loaderScriptPath = `loader/${loaderVersion}/${encodeURIComponent(\n\t\t\t\tapiKey,\n\t\t\t)}/loader.js`;\n\t\t\tconst scriptUrl = new URL(loaderScriptPath, cdnBase).toString();\n\t\t\tif (!document.querySelector(`link[href=\"${scriptUrl}\"][rel=\"preload\"]`)) {\n\t\t\t\tconst preload = document.createElement(\"link\");\n\t\t\t\tpreload.rel = \"preload\";\n\t\t\t\tpreload.as = \"script\";\n\t\t\t\tpreload.href = scriptUrl;\n\t\t\t\tdocument.head.appendChild(preload);\n\t\t\t}\n\n\t\t\tconst script = document.createElement(\"script\");\n\t\t\tscript.src = scriptUrl;\n\t\t\tscript.async = true;\n\t\t\tif (script.dataset) {\n\t\t\t\tscript.dataset.disableAutoRegister = \"true\";\n\t\t\t} else if (typeof script.setAttribute === \"function\") {\n\t\t\t\tscript.setAttribute(\"data-disable-auto-register\", \"true\");\n\t\t\t}\n\t\t\tdocument.head.appendChild(script);\n\t\t};\n\n\t\tconst runtimeMarker = window[LOADER_RUNTIME_GLOBAL_KEY];\n\t\tif (runtimeMarker?.alive) {\n\t\t\tconst protocolVersion = runtimeMarker.protocolVersion;\n\t\t\tif (protocolVersion !== LOADER_RUNTIME_PROTOCOL_VERSION) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Incompatible loader runtime protocol: expected ${LOADER_RUNTIME_PROTOCOL_VERSION}, received ${protocolVersion ?? \"unknown\"}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tenqueueInstanceRegistration();\n\t\t\tloaderRequested = true;\n\t\t\treturn;\n\t\t}\n\n\t\tconst hasCommandQueue = Array.isArray(window.__getuserfeedback_queue);\n\t\tif (!hasCommandQueue) {\n\t\t\tconst requestId = enqueueInstanceRegistration();\n\t\t\tappendLoaderScript();\n\t\t\tloaderRequested = true;\n\t\t\tlet trackedPending: Promise<void>;\n\t\t\tconst pending = waitForCommandSettlement({\n\t\t\t\trequestId,\n\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t})\n\t\t\t\t.then(() => {})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tnotifyError(error);\n\t\t\t\t});\n\t\t\ttrackedPending = pending.finally(() => {\n\t\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\t\tpendingLoad = null;\n\t\t\t\t}\n\t\t\t});\n\t\t\tpendingLoad = trackedPending;\n\t\t\treturn;\n\t\t}\n\n\t\tloaderRequested = true;\n\n\t\tlet trackedPending: Promise<void>;\n\t\tconst pending = (async () => {\n\t\t\tconst requestId = createCommandRequestId();\n\t\t\tenqueueInstanceRegistration(requestId);\n\t\t\ttry {\n\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\trequestId,\n\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_PROBE_TIMEOUT_MS,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof CommandSettlementTimeoutError) {\n\t\t\t\t\tappendLoaderScript();\n\t\t\t\t\tawait waitForCommandSettlement({\n\t\t\t\t\t\trequestId,\n\t\t\t\t\t\ttimeoutMs: LOADER_RUNTIME_POST_LOAD_TIMEOUT_MS,\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})().catch((error) => {\n\t\t\tnotifyError(error);\n\t\t});\n\t\ttrackedPending = pending.finally(() => {\n\t\t\tif (pendingLoad === trackedPending) {\n\t\t\t\tpendingLoad = null;\n\t\t\t}\n\t\t});\n\t\tpendingLoad = trackedPending;\n\t};\n\n\tconst setContainerForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\telement: HTMLElement | null,\n\t): void => {\n\t\t// Always enqueue — commands sit in the global queue until the\n\t\t// loader processes them. The command-router stores containers in\n\t\t// pendingContainer and applies them when a flow run is allocated.\n\t\tenqueueSetContainer(flowHandleId, element);\n\t};\n\n\tconst setDefaultContainer = (element: HTMLElement | null): void => {\n\t\tif (element === null) {\n\t\t\tenqueueSetDefaultContainerPolicy({ kind: \"floating\" });\n\t\t\treturn;\n\t\t}\n\t\tenqueueSetDefaultContainerPolicy({\n\t\t\tkind: \"hostContainer\",\n\t\t\thost: element,\n\t\t\tsharing: \"shared\",\n\t\t});\n\t};\n\n\tconst subscribeFlowStateForHandle = (\n\t\tflowHandleId: FlowHandleId,\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getFlowStateForHandle(flowHandleId));\n\t\t}\n\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst eventName = toHostEventName(\n\t\t\tHOST_EVENT_KEYS.INSTANCE_FLOW_STATE_CHANGED,\n\t\t);\n\n\t\tconst handleFlowStateEvent = (event: Event): void => {\n\t\t\tconst detail = (event as CustomEvent<unknown>).detail;\n\t\t\tif (\n\t\t\t\t!isFlowStateChangedDetail(detail) ||\n\t\t\t\tdetail.flowHandleId !== flowHandleId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetFlowStateForHandle(flowHandleId, nextState);\n\t\t\tcallback(cloneFlowState(nextState));\n\t\t};\n\n\t\tlet isUnsubscribed = false;\n\t\tconst signal = options?.signal;\n\t\tlet handleAbort: (() => void) | null = null;\n\n\t\tconst unsubscribe = (): void => {\n\t\t\tif (isUnsubscribed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisUnsubscribed = true;\n\t\t\twindow.removeEventListener(eventName, handleFlowStateEvent);\n\t\t\tif (signal && handleAbort) {\n\t\t\t\tsignal.removeEventListener(\"abort\", handleAbort);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(eventName, handleFlowStateEvent);\n\n\t\tif (signal) {\n\t\t\thandleAbort = () => {\n\t\t\t\tunsubscribe();\n\t\t\t};\n\t\t\tif (signal.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn unsubscribe;\n\t\t\t}\n\t\t\tsignal.addEventListener(\"abort\", handleAbort, { once: true });\n\t\t}\n\n\t\treturn unsubscribe;\n\t};\n\n\tconst subscribeFlowStateForInstance = (\n\t\tcallback: FlowStateCallback,\n\t\toptions?: SubscribeFlowStateOptions,\n\t): (() => void) => {\n\t\tif (options?.emitInitial ?? true) {\n\t\t\tcallback(getInstanceFlowState());\n\t\t}\n\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst eventName = toHostEventName(\n\t\t\tHOST_EVENT_KEYS.INSTANCE_FLOW_STATE_CHANGED_INSTANCE,\n\t\t);\n\n\t\tconst handleFlowStateEvent = (event: Event): void => {\n\t\t\tconst detail = (event as CustomEvent<unknown>).detail;\n\t\t\tif (\n\t\t\t\t!isInstanceFlowStateChangedDetail(detail) ||\n\t\t\t\tdetail.instanceId !== clientInstanceId\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextState: FlowState = {\n\t\t\t\tisOpen: detail.isOpen,\n\t\t\t\tisLoading: detail.isLoading,\n\t\t\t\twidth: detail.width,\n\t\t\t\theight: detail.height,\n\t\t\t};\n\t\t\tsetInstanceFlowState(nextState);\n\t\t\tcallback(cloneFlowState(nextState));\n\t\t};\n\n\t\tlet isUnsubscribed = false;\n\t\tconst signal = options?.signal;\n\t\tlet handleAbort: (() => void) | null = null;\n\n\t\tconst unsubscribe = (): void => {\n\t\t\tif (isUnsubscribed) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tisUnsubscribed = true;\n\t\t\twindow.removeEventListener(eventName, handleFlowStateEvent);\n\t\t\tif (signal && handleAbort) {\n\t\t\t\tsignal.removeEventListener(\"abort\", handleAbort);\n\t\t\t}\n\t\t};\n\n\t\twindow.addEventListener(eventName, handleFlowStateEvent);\n\n\t\tif (signal) {\n\t\t\thandleAbort = () => {\n\t\t\t\tunsubscribe();\n\t\t\t};\n\t\t\tif (signal.aborted) {\n\t\t\t\tunsubscribe();\n\t\t\t\treturn unsubscribe;\n\t\t\t}\n\t\t\tsignal.addEventListener(\"abort\", handleAbort, { once: true });\n\t\t}\n\n\t\treturn unsubscribe;\n\t};\n\n\t/** flow() is the single entry point and validates flowId (non-empty after trim). */\n\tconst createFlowRun = (flowId: string): FlowRun => {\n\t\ttype PendingAction =\n\t\t\t| { type: \"setContainer\"; element: HTMLElement | null }\n\t\t\t| { type: \"close\" };\n\t\tconst pendingActions = createPendingQueue<PendingAction>();\n\t\ttype PendingSubscriber = {\n\t\t\tcallback: FlowStateCallback;\n\t\t\toptions?: SubscribeFlowStateOptions;\n\t\t};\n\t\tconst pendingSubscribers: PendingSubscriber[] = [];\n\t\tconst handleClient = createLazyHandleClient<\n\t\t\tFlowHandleId,\n\t\t\t{\n\t\t\t\tok: boolean;\n\t\t\t\tkind: string;\n\t\t\t\tresult?: unknown;\n\t\t\t}\n\t\t>({\n\t\t\tgetHandleIdFromSettlement: (settlement) => {\n\t\t\t\tconst handle = getFlowHandleFromSettlementDetail(settlement);\n\t\t\t\treturn handle?.flowHandleId;\n\t\t\t},\n\t\t});\n\n\t\tconst flushPending = (): void => {\n\t\t\tconst id = handleClient.getHandleId();\n\t\t\tif (!id) return;\n\t\t\tfor (const action of pendingActions.drain()) {\n\t\t\t\tif (action.type === \"setContainer\") {\n\t\t\t\t\tsetContainerForHandle(id, action.element);\n\t\t\t\t} else {\n\t\t\t\t\treportAsyncError(dispatch({ kind: \"close\", flowHandleId: id }));\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const sub of pendingSubscribers) {\n\t\t\t\tsubscribeFlowStateForHandle(id, sub.callback, sub.options);\n\t\t\t}\n\t\t\tpendingSubscribers.length = 0;\n\t\t};\n\t\thandleClient.subscribeHandle((flowHandleId) => {\n\t\t\tensureFlowStateForHandle(flowHandleId);\n\t\t\tflushPending();\n\t\t});\n\n\t\ttype HandleCommandPayload = Extract<\n\t\t\tCommand,\n\t\t\t{ kind: \"open\" } | { kind: \"prefetch\" } | { kind: \"prerender\" }\n\t\t>;\n\n\t\tconst enqueueAndWaitForSettlement = async (\n\t\t\tbuildPayload: (\n\t\t\t\tflowHandleId: FlowHandleId | undefined,\n\t\t\t) => HandleCommandPayload,\n\t\t): Promise<void> => {\n\t\t\tawait handleClient.runCommand(buildPayload, async (payload) => {\n\t\t\t\tensureCommandsCanRun();\n\t\t\t\tconst requestId = createCommandRequestId();\n\t\t\t\tenqueue({\n\t\t\t\t\tversion: \"1\",\n\t\t\t\t\trequestId,\n\t\t\t\t\tidempotencyKey: requestId,\n\t\t\t\t\tcommand: payload,\n\t\t\t\t});\n\t\t\t\treturn waitForCommandSettlement({ requestId });\n\t\t\t});\n\t\t};\n\n\t\treturn {\n\t\t\tflowId,\n\t\t\topen: (options?: OpenFlowOptions) =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) => ({\n\t\t\t\t\t\tkind: \"open\",\n\t\t\t\t\t\tflowId,\n\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\tcontainerRequirement: options?.containerRequirement,\n\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\tprefetch: () =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) => ({\n\t\t\t\t\t\tkind: \"prefetch\",\n\t\t\t\t\t\tflowId,\n\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\tprerender: (options?: PrerenderFlowOptions) =>\n\t\t\t\treportAsyncError(\n\t\t\t\t\tenqueueAndWaitForSettlement((flowHandleId) => ({\n\t\t\t\t\t\tkind: \"prerender\",\n\t\t\t\t\t\tflowId,\n\t\t\t\t\t\tflowHandleId,\n\t\t\t\t\t\thideCloseButton: options?.hideCloseButton,\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\tclose: () => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tpendingActions.push({ type: \"close\" });\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t}\n\t\t\t\treturn reportAsyncError(dispatch({ kind: \"close\", flowHandleId }));\n\t\t\t},\n\t\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tpendingActions.push({ type: \"setContainer\", element });\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetContainerForHandle(flowHandleId, element);\n\t\t\t},\n\t\t\tgetFlowState: () => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\treturn flowHandleId\n\t\t\t\t\t? getFlowStateForHandle(flowHandleId)\n\t\t\t\t\t: cloneFlowState(DEFAULT_FLOW_STATE);\n\t\t\t},\n\t\t\tsubscribeFlowState: (\n\t\t\t\tcallback: FlowStateCallback,\n\t\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t\t) => {\n\t\t\t\tconst flowHandleId = handleClient.getHandleId();\n\t\t\t\tif (!flowHandleId) {\n\t\t\t\t\tif (options?.emitInitial !== false) {\n\t\t\t\t\t\tcallback(cloneFlowState(DEFAULT_FLOW_STATE));\n\t\t\t\t\t}\n\t\t\t\t\tpendingSubscribers.push({ callback, options });\n\t\t\t\t\treturn () => {\n\t\t\t\t\t\tconst i = pendingSubscribers.findIndex(\n\t\t\t\t\t\t\t(s) => s.callback === callback,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (i >= 0) pendingSubscribers.splice(i, 1);\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn subscribeFlowStateForHandle(flowHandleId, callback, options);\n\t\t\t},\n\t\t};\n\t};\n\n\tconst flowRunByFlowId = new Map<string, FlowRun>();\n\tconst flow = (flowIdInput: string): FlowRun => {\n\t\tconst flowId = flowIdInput.trim();\n\t\tif (!flowId) {\n\t\t\tthrow new Error(\"flowId must be a non-empty string\");\n\t\t}\n\t\tconst existing = flowRunByFlowId.get(flowId);\n\t\tif (existing) return existing;\n\t\tconst run = createFlowRun(flowId);\n\t\tflowRunByFlowId.set(flowId, run);\n\t\treturn run;\n\t};\n\n\tconst close = (): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(dispatch({ kind: \"close\" }));\n\t};\n\n\tconst reset = (): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(dispatch({ kind: \"reset\" }));\n\t};\n\n\tfunction identify(userId: string, traits?: IdentifyTraits): Promise<void>;\n\tfunction identify(traits: IdentifyTraits): Promise<void>;\n\tfunction identify(\n\t\tidentifyInput: string | IdentifyTraits,\n\t\ttraits?: IdentifyTraits,\n\t): Promise<void> {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\treturn reportAsyncError(\n\t\t\tdispatch(toIdentifyCommandPayload(identifyInput, traits)),\n\t\t);\n\t}\n\n\tconst configure = (updates: ConfigureOptions): Promise<void> => {\n\t\tif (typeof window === \"undefined\") {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!isLoaderRequested()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\t// Send updates as-is; loader merges and forwards deltas to core.\n\t\treturn reportAsyncError(dispatch({ kind: \"configure\", opts: updates }));\n\t};\n\n\tconst client: Client = {\n\t\tload,\n\t\tsetDefaultContainerPolicy: (policy: ContainerPolicy) => {\n\t\t\tenqueueSetDefaultContainerPolicy(policy);\n\t\t},\n\t\tsetContainer: (element: HTMLElement | null) => {\n\t\t\tsetDefaultContainer(element);\n\t\t},\n\t\tgetFlowState: () => getInstanceFlowState(),\n\t\tsubscribeFlowState: (\n\t\t\tcallback: FlowStateCallback,\n\t\t\toptions?: SubscribeFlowStateOptions,\n\t\t) => subscribeFlowStateForInstance(callback, options),\n\t\tflow,\n\t\tclose,\n\t\treset,\n\t\tconfigure,\n\t\tidentify,\n\t};\n\n\tregistry.set(registryKey, {\n\t\tclient,\n\t\tupdateOptions,\n\t});\n\n\tif (!disableAutoLoadConfig) {\n\t\tclient.load();\n\t}\n\n\treturn client;\n};\n\nexport default createClient;\n"
|
|
13
15
|
],
|
|
14
|
-
"mappings": "AAmCO,IAAM,EAAkB,CAC9B,4BAA6B,8BAC7B,qCAAsC,uCACtC,yBAA0B,2BAC1B,6BAA8B,+BAC9B,eAAgB,iBAChB,wBAAyB,0BACzB,0BAA2B,4BAC3B,sBAAuB,wBACvB,eAAgB,iBAChB,mBAAoB,oBACrB,EAIM,EAAiC,CACtC,UAAW,0BACX,KAAM,qBACN,SAAU,yBACV,UAAW,0BACX,SAAU,yBACV,MAAO,sBACP,MAAO,sBACP,aAAc,6BACd,0BAA2B,yCAC5B,EAKM,GAA2B,CAChC,EAA+B,UAC/B,EAA+B,KAC/B,EAA+B,SAC/B,EAA+B,UAC/B,EAA+B,SAC/B,EAA+B,MAC/B,EAA+B,MAC/B,EAA+B,aAC/B,EAA+B,yBAChC,EAuBa,GAA4B,CACxC,wBACA,GAAG,EACJ,EAIa,GAA4B,4BAC5B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