@flows/js
Version:
Flows JS SDK - Build native product growth experiences, your way
2 lines (1 loc) • 3.84 kB
JavaScript
var k=Object.defineProperty,S=Object.defineProperties,D=Object.getOwnPropertyDescriptor,P=Object.getOwnPropertyDescriptors;var i=Object.getOwnPropertySymbols;var m=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable;var x=o=>{throw TypeError(o)};var f=(o,t,e)=>t in o?k(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,L=(o,t)=>{for(var e in t||(t={}))m.call(t,e)&&f(o,e,t[e]);if(i)for(var e of i(t))b.call(t,e)&&f(o,e,t[e]);return o},M=(o,t)=>S(o,P(t));var A=(o,t)=>{var e={};for(var s in o)m.call(o,s)&&t.indexOf(s)<0&&(e[s]=o[s]);if(o!=null&&i)for(var s of i(o))t.indexOf(s)<0&&b.call(o,s)&&(e[s]=o[s]);return e};var N=(o,t,e,s)=>{for(var n=s>1?void 0:s?D(t,e):t,a=o.length-1,c;a>=0;a--)(c=o[a])&&(n=(s?c(t,e,n):c(n))||n);return s&&n&&k(t,e,n),n};var v=(o,t,e)=>t.has(o)||x("Cannot "+e);var V=(o,t,e)=>(v(o,t,"read from private field"),e?e.call(o):t.get(o)),F=(o,t,e)=>t.has(o)?x("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),_=(o,t,e,s)=>(v(o,t,"write to private field"),s?s.call(o,e):t.set(o,e),e);var O=/^https?:\/\/localhost/,q=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,G=o=>(!!o).toString(),T="flows-debug-enabled",$="flows-debug-position",U=[{value:"top-left",label:"Top Left"},{value:"top-right",label:"Top Right"},{value:"bottom-left",label:"Bottom Left"},{value:"bottom-right",label:"Bottom Right"}],J=()=>{let o=localStorage.getItem($);return U.some(t=>t.value===o)?o:"bottom-right"},W={organizationId:{true:"Organization ID is valid.",false:"Organization ID is not valid."},userId:{true:"User ID is set.",false:"User ID is not set."},environment:{true:"Environment is set.",false:"Environment is not set."},apiError:{true:"API responded successfully.",false:"API returned an error. Check the browser console for details."},title:{user:"User Information","sdk-setup":"SDK Setup",blocks:"Blocks",pathname:"Pathname",settings:"Settings"}},X=o=>{if(typeof o!="undefined")return o;let t=sessionStorage.getItem(T);return t?t==="true":O.test(window.location.origin)},H=o=>`https://app.flows.sh/org/${o}`,Q="https://flows.sh/docs/sdk-overview#debug-mode",C=()=>{if(typeof window=="undefined")return!1;let o=navigator.userAgent.includes("Mac"),t=/(?:iphone|ipad|ipod)/i.test(navigator.userAgent);return o||t},Y=o=>(C()?o.metaKey:o.ctrlKey)&&o.shiftKey&&o.altKey&&o.key.toLowerCase()==="f";var R="#22262d",j="#fff",p="%cFlows%c",u=`color:${j};background:${R};padding:2px 4px;border-radius:4px`,d={error:(o,...t)=>{console.error(`${p} ${o}`,u,"",...t)},warn:(o,...t)=>{console.warn(`${p} ${o}`,u,"",...t)},info:(o,...t)=>{console.info(`${p} ${o}`,u,"",...t)}};var eo=(o,t)=>{let e=new Set([...t.exitedBlockIds,...t.updatedBlocks.map(s=>s.id)]);return[...o.filter(s=>!e.has(s.id)),...t.updatedBlocks]},h=(o,t)=>{o.slottable&&!o.slotId&&(t==="component"&&d.error(`Encountered workflow block "${o.componentType}" that is slottable but has no slotId`),t==="tour-component"&&d.error(`Encountered tour block "${o.componentType}" that is slottable but has no slotId`))},B=o=>{o.forEach(t=>{var e;h(t,"component"),(e=t.tourBlocks)==null||e.forEach(s=>{h(s,"tour-component")})})};import{computed as y,effect as K,signal as r}from"@preact/signals-core";var io=r(),lo=r(),g=r(null),l=y(()=>{var o;return(o=g.value)!=null?o:[]}),ao=r([]);K(()=>{let o=l.value;B(o)});var co=r(!1),po=r(!1),uo=o=>{g.value=l.value.filter(t=>t.id!==o)},go=(o,t)=>{g.value=l.value.map(e=>e.id===o?t(e):e)},fo=y(()=>l.value.filter(o=>o.type==="tour")),ko=r([]);var I="@flows/js";var E="1.19.4";var vo=`${I}@${E}`;export{L as a,M as b,A as c,N as d,V as e,F as f,_ as g,d as h,eo as i,q as j,G as k,T as l,$ as m,U as n,J as o,W as p,X as q,H as r,Q as s,C as t,Y as u,io as v,lo as w,g as x,l as y,ao as z,co as A,po as B,uo as C,go as D,fo as E,ko as F,vo as G};