posthog-js
Advanced tools
| import { PropertyMatchType } from '../../types'; | ||
| export declare function doesDeviceTypeMatch(deviceTypes?: string[], matchType?: PropertyMatchType): boolean; |
| import { PropertyMatchType } from '../../types'; | ||
| export declare function doesDeviceTypeMatch(deviceTypes?: string[], matchType?: PropertyMatchType): boolean; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.doesDeviceTypeMatch = doesDeviceTypeMatch; | ||
| var core_1 = require("@posthog/core"); | ||
| var globals_1 = require("../../utils/globals"); | ||
| var property_utils_1 = require("../../utils/property-utils"); | ||
| function doesDeviceTypeMatch(deviceTypes, matchType) { | ||
| if (!deviceTypes || deviceTypes.length === 0) { | ||
| return true; | ||
| } | ||
| if (!globals_1.userAgent) { | ||
| return false; | ||
| } | ||
| var deviceType = (0, core_1.detectDeviceType)(globals_1.userAgent); | ||
| return property_utils_1.propertyComparisons[matchType !== null && matchType !== void 0 ? matchType : 'icontains'](deviceTypes, [deviceType]); | ||
| } | ||
| //# sourceMappingURL=matcher-utils.js.map |
| {"version":3,"file":"matcher-utils.js","sourceRoot":"","sources":["../../../../src/extensions/utils/matcher-utils.ts"],"names":[],"mappings":";;AAKA,kDASC;AAdD,sCAAgD;AAChD,+CAA+C;AAC/C,6DAAgE;AAGhE,SAAgB,mBAAmB,CAAC,WAAsB,EAAE,SAA6B;IACrF,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAA;IACf,CAAC;IACD,IAAI,CAAC,mBAAS,EAAE,CAAC;QACb,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,IAAM,UAAU,GAAG,IAAA,uBAAgB,EAAC,mBAAS,CAAC,CAAA;IAC9C,OAAO,oCAAmB,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,CAAC,CAAA;AACnF,CAAC","sourcesContent":["import { detectDeviceType } from '@posthog/core'\nimport { userAgent } from '../../utils/globals'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { PropertyMatchType } from '../../types'\n\nexport function doesDeviceTypeMatch(deviceTypes?: string[], matchType?: PropertyMatchType): boolean {\n if (!deviceTypes || deviceTypes.length === 0) {\n return true\n }\n if (!userAgent) {\n return false\n }\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[matchType ?? 'icontains'](deviceTypes, [deviceType])\n}\n"]} |
@@ -1,2 +0,2 @@ | ||
| !function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=Array.prototype.forEach,t=null==r?void 0:r.navigator,i=null==r?void 0:r.document,o=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a=null==t?void 0:t.userAgent,u=null!=e?e:{},s={LIB_VERSION:"1.354.2"};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},l.apply(null,arguments)}function c(e,r){return-1!==e.indexOf(r)}var f=Array.isArray,d=Object.prototype,v=d.hasOwnProperty,h=d.toString,p=f||function(e){return"[object Array]"===h.call(e)},g=e=>e===Object(e)&&!p(e),w=e=>{if(g(e)){for(var r in e)if(v.call(e,r))return!1;return!0}return!1},m=e=>void 0===e,_=e=>m(e)||(e=>null===e)(e),b=e=>"[object Number]"==h.call(e)&&e==e,x=e=>e instanceof FormData;function y(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),b(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e<r?(t.warn(" cannot be less than min: "+r+". Using min value instead."),r):e:(t.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),y(n,r,n,t))}class E{constructor(e){this.t={},this.i=e.i,this.o=y(e.bucketSize,0,100,e.u),this.l=y(e.refillRate,0,this.o,e.u),this.v=y(e.refillInterval,0,864e5,e.u)}h(e,r){var n=r-e.lastAccess,t=Math.floor(n/this.v);if(t>0){var i=t*this.l;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+t*this.v}}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.t[t];return i?this.h(i,n):(i={tokens:this.o,lastAccess:n},this.t[t]=i),0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.i)||r.call(this,e)),0===i.tokens)}stop(){this.t={}}}var R="Mobile",S="iOS",M="Android",k="Tablet",P=M+" "+k,A="iPad",O="Apple",B=O+" Watch",I="Safari",U="BlackBerry",N="Samsung",T=N+"Browser",C=N+" Internet",D="Chrome",F=D+" OS",W=D+" "+S,j="Internet Explorer",z=j+" "+R,L="Opera",K=L+" Mini",V="Edge",G="Microsoft "+V,H="Firefox",X=H+" "+S,q="Nintendo",Y="PlayStation",J="Xbox",Q=M+" "+R,Z=R+" "+I,ee="Windows",re=ee+" Phone",ne="Nokia",te="Ouya",ie="Generic",oe=ie+" "+R.toLowerCase(),ae=ie+" "+k.toLowerCase(),ue="Konqueror",se="(\\d+(\\.\\d+)?)",le=new RegExp("Version/"+se),ce=new RegExp(J,"i"),fe=new RegExp(Y+" \\w+","i"),de=new RegExp(q+" \\w+","i"),ve=new RegExp(U+"|PlayBook|BB10","i"),he={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var pe=(e,r)=>r&&c(r,O)||function(e){return c(e,I)&&!c(e,D)&&!c(e,M)}(e),ge=function(e,r){return r=r||"",c(e," OPR/")&&c(e,"Mini")?K:c(e," OPR/")?L:ve.test(e)?U:c(e,"IE"+R)||c(e,"WPDesktop")?z:c(e,T)?C:c(e,V)||c(e,"Edg/")?G:c(e,"FBIOS")?"Facebook "+R:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?W:c(e,"CrMo")||c(e,D)?D:c(e,M)&&c(e,I)?Q:c(e,"FxiOS")?X:c(e.toLowerCase(),ue.toLowerCase())?ue:pe(e,r)?c(e,R)?Z:I:c(e,H)?H:c(e,"MSIE")||c(e,"Trident/")?j:c(e,"Gecko")?H:""},we={[z]:[new RegExp("rv:"+se)],[G]:[new RegExp(V+"?\\/"+se)],[D]:[new RegExp("("+D+"|CrMo)\\/"+se)],[W]:[new RegExp("CriOS\\/"+se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+se)],[I]:[le],[Z]:[le],[L]:[new RegExp("(Opera|OPR)\\/"+se)],[H]:[new RegExp(H+"\\/"+se)],[X]:[new RegExp("FxiOS\\/"+se)],[ue]:[new RegExp("Konqueror[:/]?"+se,"i")],[U]:[new RegExp(U+" "+se),le],[Q]:[new RegExp("android\\s"+se,"i")],[C]:[new RegExp(T+"\\/"+se)],[j]:[new RegExp("(rv:|MSIE )"+se)],Mozilla:[new RegExp("rv:"+se)]},me=function(e,r){var n=ge(e,r),t=we[n];if(m(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},_e=[[new RegExp(J+"; "+J+" (.*?)[);]","i"),e=>[J,e&&e[1]||""]],[new RegExp(q,"i"),[q,""]],[new RegExp(Y,"i"),[Y,""]],[ve,[U,""]],[new RegExp(ee,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[re,""];if(new RegExp(R).test(r)&&!/IEMobile\b/.test(r))return[ee+" "+R,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=he[t]||"";return/arm/i.test(r)&&(i="RT"),[ee,i]}return[ee,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[S,r.join(".")]}return[S,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=m(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+M+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+M+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[M,r.join(".")]}return[M,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[F,""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return de.test(e)?q:fe.test(e)?Y:ce.test(e)?J:new RegExp(te,"i").test(e)?te:new RegExp("("+re+"|WPDesktop)","i").test(e)?re:/iPad/.test(e)?A:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?B:ve.test(e)?U:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ne,"i").test(e)?ne:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(R).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?M:P:new RegExp("(pda|"+R+")","i").test(e)?oe:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ae:""},xe=function(r,n){var{debugEnabled:t}=void 0===n?{}:n,i={p:function(n){if(e&&(u.POSTHOG_DEBUG||t)&&!m(e.console)&&e.console){for(var i=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];i(r,...a)}},info:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling "+e)},createLogger:(e,n)=>xe(r+" "+e,n)};return i},ye=xe("[PostHog.js]"),Ee=ye.createLogger,Re={};function $e(e,r,t){if(p(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===Re)return}function Se(e,r,n){if(!_(e)){if(p(e))return $e(e,r,n);if(x(e)){for(var t of e.entries())if(r.call(n,t[1],t[0])===Re)return}else for(var i in e)if(v.call(e,i)&&r.call(n,e[i],i)===Re)return}}var Me=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},ke=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){$e(r,(function(r){e.push(r)}))})),e},Pe=function(e){var r={};return Se(e,(function(e,n){var t;t=e,("[object String]"==h.call(t)&&e.length>0||b(e))&&(r[n]=e)})),r},Ae=e=>{var r=null==i?void 0:i.createElement("a");return m(r)?null:(r.href=e,r)},Oe=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!p(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Be=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[0]||"",o=t[1],a=i.split("?"),u=a[1],s=a[0],l=(u||"").split("&"),c=[],f=0;f<l.length;f++){var d=l[f].split("=");p(d)&&(r.includes(d[0])?c.push(d[0]+"="+n):c.push(l[f]))}var v=s;return null!=u&&(v+="?"+c.join("&")),null!=o&&(v+="#"+o),v};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return b(e)&&isFinite(e)&&Math.floor(e)===e});var Ie="0123456789abcdef";class Ue{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,t){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(t)||e<0||r<0||n<0||t<0||e>0xffffffffffff||r>4095||n>1073741823||t>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=t>>>24,i[13]=t>>>16,i[14]=t>>>8,i[15]=t,new Ue(i)}toString(){for(var e="",r=0;r<this.bytes.length;r++)e=e+Ie.charAt(this.bytes[r]>>>4)+Ie.charAt(15&this.bytes[r]),3!==r&&5!==r&&7!==r&&9!==r||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ue(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;r<16;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.m=0,this.R=0,this.$=new De}generate(){var e=this.generateOrAbort();if(m(e)){this.m=0;var r=this.generateOrAbort();if(m(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.m)this.m=e,this.S();else{if(!(e+1e4>this.m))return;this.R++,this.R>4398046511103&&(this.m++,this.S())}return Ue.fromFieldsV7(this.m,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.$.nextUint32())}S(){this.R=1024*this.$.nextUint32()+(1023&this.$.nextUint32())}}var Te,Ce=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;r<e.length;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!m(e.crypto)&&crypto.getRandomValues&&(Ce=e=>crypto.getRandomValues(e));class De{constructor(){this.M=new Uint32Array(8),this.k=1/0}nextUint32(){return this.k>=this.M.length&&(Ce(this.M),this.k=0),this.M[this.k++]}}var Fe=()=>We().toString(),We=()=>(Te||(Te=new Ne)).generate(),je="";var ze=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Le(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=i),je)return je;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),o="dmn_chk_"+Fe();!je&&t--;){var a=n.slice(t).join("."),u=o+"=1;domain=."+a+";path=/";r.cookie=u+";max-age=3",r.cookie.includes(o)&&(r.cookie=u+";max-age=0",je=a)}return je}(e);if(!n){var t=(e=>{var r=e.match(ze);return r?r[0]:""})(e);t!==n&&ye.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var Ke={P:()=>!!i,A:function(e){ye.error("cookieStore error: "+e)},O:function(e){if(i){try{for(var r=e+"=",n=i.cookie.split(";").filter((e=>e.length)),t=0;t<n.length;t++){for(var o=n[t];" "==o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(r))return decodeURIComponent(o.substring(r.length,o.length))}}catch(e){}return null}},B:function(e){var r;try{r=JSON.parse(Ke.O(e))||{}}catch(e){}return r},I:function(e,r,n,t,o){if(i)try{var a="",u="",s=Le(i.location.hostname,t);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),a="; expires="+l.toUTCString()}o&&(u="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; SameSite=Lax; path=/"+s+u;return c.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,c}catch(e){return}},U:function(e,r){if(null!=i&&i.cookie)try{Ke.I(e,"",-1,r)}catch(e){return}}},Ve=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ge=ke(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ve),He=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Xe="<masked>",qe=["li_fat_id"];function Ye(e,r,n){if(!i)return{};var t,o,a,u,s=r?ke([],Ve,n||[]):[],l=(t=Be(i.URL,s,Xe),o=e,a=Ge.concat(o||[]),u={},Se(a,(function(e){var r=Oe(t,e);u[e]=r||null})),u),c=function(){var e={};return Se(qe,(function(r){var n=Ke.O(r);e[r]=n||null})),e}();return Me(c,l)}function Je(){return navigator.language||navigator.userLanguage}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ze(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function er(r,n){if(!a)return{};var t,i,u,l=r?ke([],Ve,n||[]):[],[c,f]=function(e){for(var r=0;r<_e.length;r++){var[n,t]=_e[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}(a);return Me(Pe({$os:c,$os_version:f,$browser:ge(a,navigator.vendor),$device:be(a),$device_type:(i=a,u=be(i),u===A||u===P||"Kobo"===u||"Kindle Fire"===u||u===ae?k:u===q||u===J||u===Y||u===te?"Console":u===B?"Wearable":u?R:"Desktop"),$timezone:Qe(),$timezone_offset:Ze()}),{$current_url:Be(null==o?void 0:o.href,l,Xe),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:me(a,navigator.vendor),$browser_language:Je(),$browser_language_prefix:(t=Je(),"string"==typeof t?t.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}function rr(e,r){return[...e||[],...p(r)?r:[r]]}function nr(e,r){return(m(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<y(100*r,0,100,ye)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return""+r+(_(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Ee("[PostHog Action RateLimiting]");function ur(e,r){console.log(e,r)}function sr(e,r,n){if(void 0===n&&(n=5),"object"!=typeof e||"object"!=typeof r)return{};if(e===r)return{};if(!e&&r)return r;if(!r||!e)return{};var t={},i=new Set([...Object.keys(e),...Object.keys(r)]);for(var o of i){var a=e[o],u=r[o];if(m(a))t[o]=u;else if(m(u))t[o]=a;else if(!(a===u||_(a)&&_(u)))if(g(a)&&g(u))if(n>1){var s=sr(a,u,n-1);w(s)||(t[o]=s)}else t[o]="max depth reached, checking for changed value";else t[o]=u}return t}var lr,cr,fr,dr=(lr=null,cr=0,fr=null,{info:e=>{fr!==e&&(cr=0,fr=e),cr++,lr&&clearTimeout(lr),lr=setTimeout((()=>{var r=cr;1===r?ar.info('action "'+e+'" has been rate limited'):ar.info('action "'+e+'" has been rate limited ('+r+" times)"),cr=0,lr=null}),1e3)}});function vr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=ur,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:u=10,__stateComparisonDepth:s}=e,l=new E({refillRate:a,bucketSize:u,refillInterval:1e3,u:ar});return e=>a=>u=>{var c=u,f=e.getState(),d=performance.now(),v=a(c),h=performance.now()-d,p=e.getState(),g=r?r(c):c;if(!g)return v;if(l.consumeRateLimit(c.type))dr.info(c.type);else try{var w=n?n(f,g):f,m=n?n(p,g):p,_=o.changedState?sr(w,m,null!=s?s:5):void 0,{type:b}=g,x={type:b,payload:function(e,r){if(null==e)return{};var n={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==r.indexOf(t))continue;n[t]=e[t]}return n}(g,ir),timestamp:Date.now(),executionTimeMs:h,prevState:o.prevState?w:void 0,nextState:o.nextState?m:void 0,changedState:o.changedState?_:void 0},y=t(x);i(y,x)}catch(e){ar.error("Error logging state:",e)}return v}}var hr=Object.freeze({__proto__:null,browserConsoleLogger:ur,posthogKeaLogger:function(e){void 0===e&&(e={});var r=vr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:vr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&tr(r.properties.distinct_id,e)?l({},r,{properties:l({},r.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?c(e,n.event)?100*Math.random()<y(100*r,0,100,ye)?l({},n,{properties:l({},n.properties,{$sample_type:rr(null==(t=n.properties)?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(i=n.properties)?void 0:i.$sample_threshold,r),$sampled_events:rr(null==(o=n.properties)?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&tr(r.properties.$session_id,e)?l({},r,{properties:l({},r.properties,{$sample_type:rr(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(r.properties.$sample_threshold,e)})}):null},sessionRecordingLoggerForPostHogInstance:e=>(r,n)=>{var t;null==e||null==(t=e.sessionRecording)||t.tryAddCustomEvent("app-state",{title:r,stateEvent:n})},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r,n=Me({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==i?void 0:i.referrer)||"$direct",$referring_domain:null!=i&&i.referrer&&(null==(r=Ae(i.referrer))?void 0:r.host)||"$direct"}),t={};Se(n,(function(e,r){(c(Ge,r)||c(He,r))&&(t[r]=e)})),e.setPersonPropertiesForFlags(t)}});u.posthogCustomizations=hr}(); | ||
| !function(){"use strict";var e="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:e;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=Array.prototype.forEach,t=null==r?void 0:r.navigator,i=null==r?void 0:r.document,o=null==r?void 0:r.location;null==r||r.fetch,null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest&&r.XMLHttpRequest,null==r||r.AbortController;var a=null==t?void 0:t.userAgent,u=null!=e?e:{},s={LIB_VERSION:"1.354.3"};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)({}).hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e},l.apply(null,arguments)}function c(e,r){return-1!==e.indexOf(r)}var f=Array.isArray,d=Object.prototype,v=d.hasOwnProperty,h=d.toString,p=f||function(e){return"[object Array]"===h.call(e)},g=e=>e===Object(e)&&!p(e),w=e=>{if(g(e)){for(var r in e)if(v.call(e,r))return!1;return!0}return!1},m=e=>void 0===e,_=e=>m(e)||(e=>null===e)(e),b=e=>"[object Number]"==h.call(e)&&e==e,x=e=>e instanceof FormData;function y(e,r,n,t,i){return r>n&&(t.warn("min cannot be greater than max."),r=n),b(e)?e>n?(t.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e<r?(t.warn(" cannot be less than min: "+r+". Using min value instead."),r):e:(t.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),y(n,r,n,t))}class E{constructor(e){this.t={},this.i=e.i,this.o=y(e.bucketSize,0,100,e.u),this.l=y(e.refillRate,0,this.o,e.u),this.v=y(e.refillInterval,0,864e5,e.u)}h(e,r){var n=r-e.lastAccess,t=Math.floor(n/this.v);if(t>0){var i=t*this.l;e.tokens=Math.min(e.tokens+i,this.o),e.lastAccess=e.lastAccess+t*this.v}}consumeRateLimit(e){var r,n=Date.now(),t=String(e),i=this.t[t];return i?this.h(i,n):(i={tokens:this.o,lastAccess:n},this.t[t]=i),0===i.tokens||(i.tokens--,0===i.tokens&&(null==(r=this.i)||r.call(this,e)),0===i.tokens)}stop(){this.t={}}}var R="Mobile",S="iOS",M="Android",k="Tablet",P=M+" "+k,A="iPad",O="Apple",B=O+" Watch",I="Safari",U="BlackBerry",N="Samsung",T=N+"Browser",C=N+" Internet",D="Chrome",F=D+" OS",W=D+" "+S,j="Internet Explorer",z=j+" "+R,L="Opera",K=L+" Mini",V="Edge",G="Microsoft "+V,H="Firefox",X=H+" "+S,q="Nintendo",Y="PlayStation",J="Xbox",Q=M+" "+R,Z=R+" "+I,ee="Windows",re=ee+" Phone",ne="Nokia",te="Ouya",ie="Generic",oe=ie+" "+R.toLowerCase(),ae=ie+" "+k.toLowerCase(),ue="Konqueror",se="(\\d+(\\.\\d+)?)",le=new RegExp("Version/"+se),ce=new RegExp(J,"i"),fe=new RegExp(Y+" \\w+","i"),de=new RegExp(q+" \\w+","i"),ve=new RegExp(U+"|PlayBook|BB10","i"),he={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};var pe=(e,r)=>r&&c(r,O)||function(e){return c(e,I)&&!c(e,D)&&!c(e,M)}(e),ge=function(e,r){return r=r||"",c(e," OPR/")&&c(e,"Mini")?K:c(e," OPR/")?L:ve.test(e)?U:c(e,"IE"+R)||c(e,"WPDesktop")?z:c(e,T)?C:c(e,V)||c(e,"Edg/")?G:c(e,"FBIOS")?"Facebook "+R:c(e,"UCWEB")||c(e,"UCBrowser")?"UC Browser":c(e,"CriOS")?W:c(e,"CrMo")||c(e,D)?D:c(e,M)&&c(e,I)?Q:c(e,"FxiOS")?X:c(e.toLowerCase(),ue.toLowerCase())?ue:pe(e,r)?c(e,R)?Z:I:c(e,H)?H:c(e,"MSIE")||c(e,"Trident/")?j:c(e,"Gecko")?H:""},we={[z]:[new RegExp("rv:"+se)],[G]:[new RegExp(V+"?\\/"+se)],[D]:[new RegExp("("+D+"|CrMo)\\/"+se)],[W]:[new RegExp("CriOS\\/"+se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+se)],[I]:[le],[Z]:[le],[L]:[new RegExp("(Opera|OPR)\\/"+se)],[H]:[new RegExp(H+"\\/"+se)],[X]:[new RegExp("FxiOS\\/"+se)],[ue]:[new RegExp("Konqueror[:/]?"+se,"i")],[U]:[new RegExp(U+" "+se),le],[Q]:[new RegExp("android\\s"+se,"i")],[C]:[new RegExp(T+"\\/"+se)],[j]:[new RegExp("(rv:|MSIE )"+se)],Mozilla:[new RegExp("rv:"+se)]},me=function(e,r){var n=ge(e,r),t=we[n];if(m(t))return null;for(var i=0;i<t.length;i++){var o=t[i],a=e.match(o);if(a)return parseFloat(a[a.length-2])}return null},_e=[[new RegExp(J+"; "+J+" (.*?)[);]","i"),e=>[J,e&&e[1]||""]],[new RegExp(q,"i"),[q,""]],[new RegExp(Y,"i"),[Y,""]],[ve,[U,""]],[new RegExp(ee,"i"),(e,r)=>{if(/Phone/.test(r)||/WPDesktop/.test(r))return[re,""];if(new RegExp(R).test(r)&&!/IEMobile\b/.test(r))return[ee+" "+R,""];var n=/Windows NT ([0-9.]+)/i.exec(r);if(n&&n[1]){var t=n[1],i=he[t]||"";return/arm/i.test(r)&&(i="RT"),[ee,i]}return[ee,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var r=[e[3],e[4],e[5]||"0"];return[S,r.join(".")]}return[S,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var r="";return e&&e.length>=3&&(r=m(e[2])?e[3]:e[2]),["watchOS",r]}],[new RegExp("("+M+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+M+")","i"),e=>{if(e&&e[2]){var r=[e[2],e[3],e[4]||"0"];return[M,r.join(".")]}return[M,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var r=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];r[1]=n.join(".")}return r}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[F,""]],[/Linux|debian/i,["Linux",""]]],be=function(e){return de.test(e)?q:fe.test(e)?Y:ce.test(e)?J:new RegExp(te,"i").test(e)?te:new RegExp("("+re+"|WPDesktop)","i").test(e)?re:/iPad/.test(e)?A:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?B:ve.test(e)?U:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ne,"i").test(e)?ne:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(R).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?M:P:new RegExp("(pda|"+R+")","i").test(e)?oe:new RegExp(k,"i").test(e)&&!new RegExp(k+" pc","i").test(e)?ae:""},xe=function(r,n){var{debugEnabled:t}=void 0===n?{}:n,i={p:function(n){if(e&&(u.POSTHOG_DEBUG||t)&&!m(e.console)&&e.console){for(var i=("__rrweb_original__"in e.console[n]?e.console[n].__rrweb_original__:e.console[n]),o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];i(r,...a)}},info:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("log",...r)},warn:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("warn",...r)},error:function(){for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];i.p("error",...r)},critical:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];console.error(r,...n)},uninitializedWarning:e=>{i.error("You must initialize PostHog before calling "+e)},createLogger:(e,n)=>xe(r+" "+e,n)};return i},ye=xe("[PostHog.js]"),Ee=ye.createLogger,Re={};function $e(e,r,t){if(p(e))if(n&&e.forEach===n)e.forEach(r,t);else if("length"in e&&e.length===+e.length)for(var i=0,o=e.length;i<o;i++)if(i in e&&r.call(t,e[i],i)===Re)return}function Se(e,r,n){if(!_(e)){if(p(e))return $e(e,r,n);if(x(e)){for(var t of e.entries())if(r.call(n,t[1],t[0])===Re)return}else for(var i in e)if(v.call(e,i)&&r.call(n,e[i],i)===Re)return}}var Me=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){for(var n in r)void 0!==r[n]&&(e[n]=r[n])})),e},ke=function(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),t=1;t<r;t++)n[t-1]=arguments[t];return $e(n,(function(r){$e(r,(function(r){e.push(r)}))})),e},Pe=function(e){var r={};return Se(e,(function(e,n){var t;t=e,("[object String]"==h.call(t)&&e.length>0||b(e))&&(r[n]=e)})),r},Ae=e=>{var r=null==i?void 0:i.createElement("a");return m(r)?null:(r.href=e,r)},Oe=function(e,r){for(var n,t=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<t.length;i++){var o=t[i].split("=");if(o[0]===r){n=o;break}}if(!p(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch(e){ye.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Be=function(e,r,n){if(!e||!r||!r.length)return e;for(var t=e.split("#"),i=t[0]||"",o=t[1],a=i.split("?"),u=a[1],s=a[0],l=(u||"").split("&"),c=[],f=0;f<l.length;f++){var d=l[f].split("=");p(d)&&(r.includes(d[0])?c.push(d[0]+"="+n):c.push(l[f]))}var v=s;return null!=u&&(v+="?"+c.join("&")),null!=o&&(v+="#"+o),v};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return b(e)&&isFinite(e)&&Math.floor(e)===e});var Ie="0123456789abcdef";class Ue{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,r,n,t){if(!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(t)||e<0||r<0||n<0||t<0||e>0xffffffffffff||r>4095||n>1073741823||t>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|r>>>8,i[7]=r,i[8]=128|n>>>24,i[9]=n>>>16,i[10]=n>>>8,i[11]=n,i[12]=t>>>24,i[13]=t>>>16,i[14]=t>>>8,i[15]=t,new Ue(i)}toString(){for(var e="",r=0;r<this.bytes.length;r++)e=e+Ie.charAt(this.bytes[r]>>>4)+Ie.charAt(15&this.bytes[r]),3!==r&&5!==r&&7!==r&&9!==r||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Ue(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var r=0;r<16;r++){var n=this.bytes[r]-e.bytes[r];if(0!==n)return Math.sign(n)}return 0}}class Ne{constructor(){this.m=0,this.R=0,this.$=new De}generate(){var e=this.generateOrAbort();if(m(e)){this.m=0;var r=this.generateOrAbort();if(m(r))throw new Error("Could not generate UUID after timestamp reset");return r}return e}generateOrAbort(){var e=Date.now();if(e>this.m)this.m=e,this.S();else{if(!(e+1e4>this.m))return;this.R++,this.R>4398046511103&&(this.m++,this.S())}return Ue.fromFieldsV7(this.m,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.$.nextUint32())}S(){this.R=1024*this.$.nextUint32()+(1023&this.$.nextUint32())}}var Te,Ce=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var r=0;r<e.length;r++)e[r]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};e&&!m(e.crypto)&&crypto.getRandomValues&&(Ce=e=>crypto.getRandomValues(e));class De{constructor(){this.M=new Uint32Array(8),this.k=1/0}nextUint32(){return this.k>=this.M.length&&(Ce(this.M),this.k=0),this.M[this.k++]}}var Fe=()=>We().toString(),We=()=>(Te||(Te=new Ne)).generate(),je="";var ze=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Le(e,r){if(r){var n=function(e,r){if(void 0===r&&(r=i),je)return je;if(!r)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var n=e.split("."),t=Math.min(n.length,8),o="dmn_chk_"+Fe();!je&&t--;){var a=n.slice(t).join("."),u=o+"=1;domain=."+a+";path=/";r.cookie=u+";max-age=3",r.cookie.includes(o)&&(r.cookie=u+";max-age=0",je=a)}return je}(e);if(!n){var t=(e=>{var r=e.match(ze);return r?r[0]:""})(e);t!==n&&ye.info("Warning: cookie subdomain discovery mismatch",t,n),n=t}return n?"; domain=."+n:""}return""}var Ke={P:()=>!!i,A:function(e){ye.error("cookieStore error: "+e)},O:function(e){if(i){try{for(var r=e+"=",n=i.cookie.split(";").filter((e=>e.length)),t=0;t<n.length;t++){for(var o=n[t];" "==o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(r))return decodeURIComponent(o.substring(r.length,o.length))}}catch(e){}return null}},B:function(e){var r;try{r=JSON.parse(Ke.O(e))||{}}catch(e){}return r},I:function(e,r,n,t,o){if(i)try{var a="",u="",s=Le(i.location.hostname,t);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),a="; expires="+l.toUTCString()}o&&(u="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(r))+a+"; SameSite=Lax; path=/"+s+u;return c.length>3686.4&&ye.warn("cookieStore warning: large cookie, len="+c.length),i.cookie=c,c}catch(e){return}},U:function(e,r){if(null!=i&&i.cookie)try{Ke.I(e,"",-1,r)}catch(e){return}}},Ve=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ge=ke(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ve),He=["$app_build","$app_name","$app_namespace","$app_version","$browser","$browser_version","$device_type","$current_url","$pathname","$os","$os_name","$os_version","$referring_domain","$referrer","$screen_height","$screen_width","$viewport_height","$viewport_width","$raw_user_agent"],Xe="<masked>",qe=["li_fat_id"];function Ye(e,r,n){if(!i)return{};var t,o,a,u,s=r?ke([],Ve,n||[]):[],l=(t=Be(i.URL,s,Xe),o=e,a=Ge.concat(o||[]),u={},Se(a,(function(e){var r=Oe(t,e);u[e]=r||null})),u),c=function(){var e={};return Se(qe,(function(r){var n=Ke.O(r);e[r]=n||null})),e}();return Me(c,l)}function Je(){return navigator.language||navigator.userLanguage}function Qe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function Ze(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function er(r,n){if(!a)return{};var t,i,u,l=r?ke([],Ve,n||[]):[],[c,f]=function(e){for(var r=0;r<_e.length;r++){var[n,t]=_e[r],i=n.exec(e),o=i&&("function"==typeof t?t(i,e):t);if(o)return o}return["",""]}(a);return Me(Pe({$os:c,$os_version:f,$browser:ge(a,navigator.vendor),$device:be(a),$device_type:(i=a,u=be(i),u===A||u===P||"Kobo"===u||"Kindle Fire"===u||u===ae?k:u===q||u===J||u===Y||u===te?"Console":u===B?"Wearable":u?R:"Desktop"),$timezone:Qe(),$timezone_offset:Ze()}),{$current_url:Be(null==o?void 0:o.href,l,Xe),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:a.length>1e3?a.substring(0,997)+"...":a,$browser_version:me(a,navigator.vendor),$browser_language:Je(),$browser_language_prefix:(t=Je(),"string"==typeof t?t.split("-")[0]:void 0),$screen_height:null==e?void 0:e.screen.height,$screen_width:null==e?void 0:e.screen.width,$viewport_height:null==e?void 0:e.innerHeight,$viewport_width:null==e?void 0:e.innerWidth,$lib:"web",$lib_version:s.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}function rr(e,r){return[...e||[],...p(r)?r:[r]]}function nr(e,r){return(m(e)?1:e)*r}function tr(e,r){return function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return Math.abs(r)}(e)%100<y(100*r,0,100,ye)}var ir=["type"];function or(e){var{type:r,executionTimeMs:n}=e;return""+r+(_(n)?"":" ("+n.toFixed(2)+"ms)")}var ar=Ee("[PostHog Action RateLimiting]");function ur(e,r){console.log(e,r)}function sr(e,r,n){if(void 0===n&&(n=5),"object"!=typeof e||"object"!=typeof r)return{};if(e===r)return{};if(!e&&r)return r;if(!r||!e)return{};var t={},i=new Set([...Object.keys(e),...Object.keys(r)]);for(var o of i){var a=e[o],u=r[o];if(m(a))t[o]=u;else if(m(u))t[o]=a;else if(!(a===u||_(a)&&_(u)))if(g(a)&&g(u))if(n>1){var s=sr(a,u,n-1);w(s)||(t[o]=s)}else t[o]="max depth reached, checking for changed value";else t[o]=u}return t}var lr,cr,fr,dr=(lr=null,cr=0,fr=null,{info:e=>{fr!==e&&(cr=0,fr=e),cr++,lr&&clearTimeout(lr),lr=setTimeout((()=>{var r=cr;1===r?ar.info('action "'+e+'" has been rate limited'):ar.info('action "'+e+'" has been rate limited ('+r+" times)"),cr=0,lr=null}),1e3)}});function vr(e){void 0===e&&(e={});var{maskAction:r,maskState:n,titleFunction:t=or,logger:i=ur,include:o={prevState:!0,nextState:!1,changedState:!0},rateLimiterRefillRate:a=1,rateLimiterBucketSize:u=10,__stateComparisonDepth:s}=e,l=new E({refillRate:a,bucketSize:u,refillInterval:1e3,u:ar});return e=>a=>u=>{var c=u,f=e.getState(),d=performance.now(),v=a(c),h=performance.now()-d,p=e.getState(),g=r?r(c):c;if(!g)return v;if(l.consumeRateLimit(c.type))dr.info(c.type);else try{var w=n?n(f,g):f,m=n?n(p,g):p,_=o.changedState?sr(w,m,null!=s?s:5):void 0,{type:b}=g,x={type:b,payload:function(e,r){if(null==e)return{};var n={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==r.indexOf(t))continue;n[t]=e[t]}return n}(g,ir),timestamp:Date.now(),executionTimeMs:h,prevState:o.prevState?w:void 0,nextState:o.nextState?m:void 0,changedState:o.changedState?_:void 0},y=t(x);i(y,x)}catch(e){ar.error("Error logging state:",e)}return v}}var hr=Object.freeze({__proto__:null,browserConsoleLogger:ur,posthogKeaLogger:function(e){void 0===e&&(e={});var r=vr(e);return{name:"posthog-kea-logger",events:{beforeReduxStore(e){e.middleware.push(r)}}}},posthogReduxLogger:vr,printAndDropEverything:e=>(console.log("Would have sent event:",e),null),sampleByDistinctId:function(e){return r=>r&&tr(r.properties.distinct_id,e)?l({},r,{properties:l({},r.properties,{$sample_type:["sampleByDistinctId"],$sample_threshold:e})}):null},sampleByEvent:function(e,r){return n=>{var t,i,o;return n?c(e,n.event)?100*Math.random()<y(100*r,0,100,ye)?l({},n,{properties:l({},n.properties,{$sample_type:rr(null==(t=n.properties)?void 0:t.$sample_type,"sampleByEvent"),$sample_threshold:nr(null==(i=n.properties)?void 0:i.$sample_threshold,r),$sampled_events:rr(null==(o=n.properties)?void 0:o.$sampled_events,e)})}):null:n:null}},sampleBySessionId:function(e){return r=>r&&tr(r.properties.$session_id,e)?l({},r,{properties:l({},r.properties,{$sample_type:rr(r.properties.$sample_type,"sampleBySessionId"),$sample_threshold:nr(r.properties.$sample_threshold,e)})}):null},sessionRecordingLoggerForPostHogInstance:e=>(r,n)=>{var t;null==e||null==(t=e.sessionRecording)||t.tryAddCustomEvent("app-state",{title:r,stateEvent:n})},setAllPersonProfilePropertiesAsPersonPropertiesForFlags:e=>{var r,n=Me({},er(e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),Ye(e.config.custom_campaign_params,e.config.mask_personal_data_properties,e.config.custom_personal_data_properties),{$referrer:(null==i?void 0:i.referrer)||"$direct",$referring_domain:null!=i&&i.referrer&&(null==(r=Ae(i.referrer))?void 0:r.host)||"$direct"}),t={};Se(n,(function(e,r){(c(Ge,r)||c(He,r))&&(t[r]=e)})),e.setPersonPropertiesForFlags(t)}});u.posthogCustomizations=hr}(); | ||
| //# sourceMappingURL=customizations.full.js.map |
@@ -111,2 +111,3 @@ import { PropertyMatchType } from './types'; | ||
| linkedFlagVariant?: string; | ||
| deviceTypes?: string[]; | ||
| } | ||
@@ -113,0 +114,0 @@ export interface ProductTourAppearance { |
+1
-1
| { | ||
| "name": "posthog-js", | ||
| "version": "1.354.2", | ||
| "version": "1.354.3", | ||
| "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/PostHog/posthog-js", |
@@ -44,2 +44,3 @@ "use strict"; | ||
| var event_utils_1 = require("../../utils/event-utils"); | ||
| var matcher_utils_1 = require("../utils/matcher-utils"); | ||
| var logger = (0, logger_1.createLogger)('[Product Tours]'); | ||
@@ -83,3 +84,4 @@ var document = globals_1.document; | ||
| function checkTourConditions(tour) { | ||
| return isTourInDateRange(tour) && doesTourUrlMatch(tour); | ||
| var _a; | ||
| return isTourInDateRange(tour) && doesTourUrlMatch(tour) && (0, matcher_utils_1.doesDeviceTypeMatch)((_a = tour.conditions) === null || _a === void 0 ? void 0 : _a.deviceTypes); | ||
| } | ||
@@ -86,0 +88,0 @@ var CONTAINER_CLASS = 'ph-product-tour-container'; |
@@ -59,3 +59,2 @@ "use strict"; | ||
| var core_1 = require("@posthog/core"); | ||
| var core_2 = require("@posthog/core"); | ||
| var property_utils_1 = require("../../utils/property-utils"); | ||
@@ -69,2 +68,3 @@ var constants_1 = require("../../constants"); | ||
| var hooks_1 = require("preact/hooks"); | ||
| var matcher_utils_1 = require("../utils/matcher-utils"); | ||
| function getFontFamily(fontFamily) { | ||
@@ -613,12 +613,4 @@ if (fontFamily === 'inherit') { | ||
| function doesSurveyDeviceTypesMatch(survey) { | ||
| var _a, _b, _c; | ||
| if (!((_a = survey.conditions) === null || _a === void 0 ? void 0 : _a.deviceTypes) || ((_b = survey.conditions) === null || _b === void 0 ? void 0 : _b.deviceTypes.length) === 0) { | ||
| return true; | ||
| } | ||
| // if we dont know the device type, assume it is not a match | ||
| if (!globals_1.userAgent) { | ||
| return false; | ||
| } | ||
| var deviceType = (0, core_2.detectDeviceType)(globals_1.userAgent); | ||
| return property_utils_1.propertyComparisons[defaultMatchType((_c = survey.conditions) === null || _c === void 0 ? void 0 : _c.deviceTypesMatchType)](survey.conditions.deviceTypes, [deviceType]); | ||
| var _a, _b; | ||
| return (0, matcher_utils_1.doesDeviceTypeMatch)((_a = survey.conditions) === null || _a === void 0 ? void 0 : _a.deviceTypes, (_b = survey.conditions) === null || _b === void 0 ? void 0 : _b.deviceTypesMatchType); | ||
| } | ||
@@ -625,0 +617,0 @@ function doesSurveyMatchSelector(survey) { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"surveys-extension-utils.js","sourceRoot":"","sources":["../../../../src/extensions/surveys/surveys-extension-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,sCAQC;AAED,oDAEC;AA6PD,0BAgBC;AAED,8BAOC;AAED,0DAyBC;AAED,kDAIC;AA0TD,gDAYC;AAED,gEAcC;AAED,0DAKC;AAsDD,0DAGC;AAMD,gDA8BC;AAjyBD,iCAAqE;AAErE,qEAWoC;AACpC,+CAAyF;AACzF,yDAOiC;AACjC,sCAAkD;AAElD,sCAAgD;AAChD,6DAAgE;AAEhE,6CAAiD;AACjD,gEAA8D;AAC9D,gGAAgG;AAChG,IAAM,MAAM,GAAG,gBAAqC,CAAA;AACpD,IAAM,QAAQ,GAAG,kBAAqB,CAAA;AACtC,4DAAuC;AACvC,sCAAyC;AAEzC,SAAgB,aAAa,CAAC,UAAmB;IAC7C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAA;IACpB,CAAC;IAED,IAAM,gBAAgB,GAClB,2IAA2I,CAAA;IAC/I,OAAO,UAAU,CAAC,CAAC,CAAC,UAAG,UAAU,eAAK,gBAAgB,CAAE,CAAC,CAAC,CAAC,yBAAkB,gBAAgB,CAAE,CAAA;AACnG,CAAC;AAED,SAAgB,oBAAoB,CAAC,UAAkB;IACnD,OAAO,2BAAoB,UAA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type JSX } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window, userAgent } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { detectDeviceType } from '@posthog/core'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { Properties, PropertyMatchType } from '../../types'\nimport { Z_INDEX_SURVEYS } from '../../constants'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: String(Z_INDEX_SURVEYS),\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nexport function hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function hexToRgba(hex: string, opacity: number): string {\n const rgb = hex2rgb(hex)\n const match = rgb.match(/^rgb\\((\\d+),(\\d+),(\\d+)\\)$/)\n if (!match) {\n return hex\n }\n return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${opacity})`\n}\n\nexport function getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n /** Additional properties to include in the survey event */\n properties?: Properties\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n properties,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n ...properties,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n /** Additional properties to include in all survey events */\n properties?: Properties\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n properties: undefined,\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n [deviceType]\n )\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n\n/**\n * Get CSS position styles for a popover/modal based on SurveyPosition\n * Used by both surveys and product tours for consistent positioning\n */\nexport function getPopoverPosition(\n type?: SurveyType,\n position: SurveyPosition = SurveyPosition.Right,\n surveyWidgetType?: SurveyWidgetType\n): Record<string, string> {\n if (type === SurveyType.ExternalSurvey) {\n return {}\n }\n\n switch (position) {\n case SurveyPosition.TopLeft:\n return { top: '0', left: '0', transform: 'translate(30px, 30px)' }\n case SurveyPosition.TopRight:\n return { top: '0', right: '0', transform: 'translate(-30px, 30px)' }\n case SurveyPosition.TopCenter:\n return { top: '0', left: '50%', transform: 'translate(-50%, 30px)' }\n case SurveyPosition.MiddleLeft:\n return { top: '50%', left: '0', transform: 'translate(30px, -50%)' }\n case SurveyPosition.MiddleRight:\n return { top: '50%', right: '0', transform: 'translate(-30px, -50%)' }\n case SurveyPosition.MiddleCenter:\n return { top: '50%', left: '50%', transform: 'translate(-50%, -50%)' }\n case SurveyPosition.Left:\n return { left: '30px' }\n case SurveyPosition.Center:\n return { left: '50%', transform: 'translateX(-50%)' }\n default:\n case SurveyPosition.Right:\n return { right: type === SurveyType.Widget && surveyWidgetType === SurveyWidgetType.Tab ? '60px' : '30px' }\n }\n}\n"]} | ||
| {"version":3,"file":"surveys-extension-utils.js","sourceRoot":"","sources":["../../../../src/extensions/surveys/surveys-extension-utils.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,sCAQC;AAED,oDAEC;AA6PD,0BAgBC;AAED,8BAOC;AAED,0DAyBC;AAED,kDAIC;AA0TD,gDAYC;AAED,gEAEC;AAED,0DAKC;AAsDD,0DAGC;AAMD,gDA8BC;AArxBD,iCAAqE;AAErE,qEAWoC;AACpC,+CAA8E;AAC9E,yDAOiC;AACjC,sCAAkD;AAElD,6DAAgE;AAE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AAgB,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;IACnH,CAAC;AACL,CAAC","sourcesContent":["import { VNode, cloneElement, createContext, type JSX } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { Properties, PropertyMatchType } from '../../types'\nimport { Z_INDEX_SURVEYS } from '../../constants'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\nimport { doesDeviceTypeMatch } from '../utils/matcher-utils'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: String(Z_INDEX_SURVEYS),\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nexport function hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function hexToRgba(hex: string, opacity: number): string {\n const rgb = hex2rgb(hex)\n const match = rgb.match(/^rgb\\((\\d+),(\\d+),(\\d+)\\)$/)\n if (!match) {\n return hex\n }\n return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${opacity})`\n}\n\nexport function getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n /** Additional properties to include in the survey event */\n properties?: Properties\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n properties,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n ...properties,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n /** Additional properties to include in all survey events */\n properties?: Properties\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n properties: undefined,\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n return doesDeviceTypeMatch(survey.conditions?.deviceTypes, survey.conditions?.deviceTypesMatchType)\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n\n/**\n * Get CSS position styles for a popover/modal based on SurveyPosition\n * Used by both surveys and product tours for consistent positioning\n */\nexport function getPopoverPosition(\n type?: SurveyType,\n position: SurveyPosition = SurveyPosition.Right,\n surveyWidgetType?: SurveyWidgetType\n): Record<string, string> {\n if (type === SurveyType.ExternalSurvey) {\n return {}\n }\n\n switch (position) {\n case SurveyPosition.TopLeft:\n return { top: '0', left: '0', transform: 'translate(30px, 30px)' }\n case SurveyPosition.TopRight:\n return { top: '0', right: '0', transform: 'translate(-30px, 30px)' }\n case SurveyPosition.TopCenter:\n return { top: '0', left: '50%', transform: 'translate(-50%, 30px)' }\n case SurveyPosition.MiddleLeft:\n return { top: '50%', left: '0', transform: 'translate(30px, -50%)' }\n case SurveyPosition.MiddleRight:\n return { top: '50%', right: '0', transform: 'translate(-30px, -50%)' }\n case SurveyPosition.MiddleCenter:\n return { top: '50%', left: '50%', transform: 'translate(-50%, -50%)' }\n case SurveyPosition.Left:\n return { left: '30px' }\n case SurveyPosition.Center:\n return { left: '50%', transform: 'translateX(-50%)' }\n default:\n case SurveyPosition.Right:\n return { right: type === SurveyType.Widget && surveyWidgetType === SurveyWidgetType.Tab ? '60px' : '30px' }\n }\n}\n"]} |
@@ -111,2 +111,3 @@ import { PropertyMatchType } from './types'; | ||
| linkedFlagVariant?: string; | ||
| deviceTypes?: string[]; | ||
| } | ||
@@ -113,0 +114,0 @@ export interface ProductTourAppearance { |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"posthog-product-tours-types.js","sourceRoot":"","sources":["../../src/posthog-product-tours-types.ts"],"names":[],"mappings":";;;AAIA,yCAA2C;AAyK9B,QAAA,+BAA+B,GAAoC;IAC5E,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,CAAC;IACf,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,gCAAgC;IAC3C,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,KAAK;IACjB,qBAAqB,EAAE,IAAI;IAC3B,MAAM,EAAE,yBAAa;CACxB,CAAA;AAOD,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC5B,oDAA4B,CAAA;IAC5B,4DAAoC,CAAA;IACpC,4DAAoC,CAAA;IACpC,8DAAsC,CAAA;IACtC,sEAA8C,CAAA;IAC9C,sEAA8C,CAAA;IAC9C,kFAA0D,CAAA;IAC1D,0GAAkF,CAAA;IAClF,oFAA4D,CAAA;AAChE,CAAC,EAVW,oBAAoB,oCAApB,oBAAoB,QAU/B;AAED,IAAY,0BA6BX;AA7BD,WAAY,0BAA0B;IAClC,0DAA4B,CAAA;IAC5B,8DAAgC,CAAA;IAChC,wEAA0C,CAAA;IAC1C,gFAAkD,CAAA;IAClD,oEAAsC,CAAA;IACtC,0EAA4C,CAAA;IAC5C,wEAA0C,CAAA;IAC1C,kFAAoD,CAAA;IACpD,4EAA8C,CAAA;IAC9C,gFAAkD,CAAA;IAClD,4EAA8C,CAAA;IAC9C,kFAAoD,CAAA;IACpD,4EAA8C,CAAA;IAC9C,gFAAkD,CAAA;IAClD,4FAA8D,CAAA;IAC9D,sFAAwD,CAAA;IACxD,oFAAsD,CAAA;IACtD,8FAAgE,CAAA;IAChE,wFAA0D,CAAA;IAC1D,gEAAkC,CAAA;IAClC,gFAAkD,CAAA;IAClD,gFAAkD,CAAA;IAClD,0FAA4D,CAAA;IAC5D,sFAAwD,CAAA;IACxD,oFAAsD,CAAA;IACtD,sFAAwD,CAAA;IACxD,0EAA4C,CAAA;IAC5C,gFAAkD,CAAA;AACtD,CAAC,EA7BW,0BAA0B,0CAA1B,0BAA0B,QA6BrC","sourcesContent":["import { PropertyMatchType } from './types'\nimport { SurveyActionType, SurveyEventWithFilters } from './posthog-surveys-types'\nimport type { InferredSelector } from './extensions/product-tours/element-inference'\nimport { SurveyPosition } from '@posthog/core'\nimport { Z_INDEX_TOURS } from './constants'\n\nexport interface JSONContent {\n type?: string\n attrs?: Record<string, any>\n content?: JSONContent[]\n marks?: { type: string; attrs?: Record<string, any> }[]\n text?: string\n}\n\nexport type ProductTourStepType = 'element' | 'modal' | 'survey' | 'banner'\n\nexport interface ProductTourBannerConfig {\n behavior: 'sticky' | 'static' | 'custom'\n selector?: string\n action?: {\n type: 'none' | 'link' | 'trigger_tour'\n link?: string\n tourId?: string\n }\n animation?: {\n duration?: number\n }\n}\n\n/** Button actions available on modal steps */\nexport type ProductTourButtonAction = 'dismiss' | 'link' | 'next_step' | 'previous_step' | 'trigger_tour'\n\nexport interface ProductTourStepButton {\n text: string\n action: ProductTourButtonAction\n /** URL to open when action is 'link' */\n link?: string\n /** Tour ID to trigger when action is 'trigger_tour' */\n tourId?: string\n}\n\nexport interface ProductTourStepButtons {\n primary?: ProductTourStepButton\n secondary?: ProductTourStepButton\n}\n\nexport type ProductTourSurveyQuestionType = 'open' | 'rating'\n\nexport interface ProductTourSurveyQuestion {\n type: ProductTourSurveyQuestionType\n questionText: string\n /** Rating display type - emoji or number */\n display?: 'emoji' | 'number'\n /** Rating scale - 3 or 5 for emoji, 5 or 10 for number */\n scale?: 3 | 5 | 10\n /** Label for low end of rating scale (e.g., \"Not likely\") */\n lowerBoundLabel?: string\n /** Label for high end of rating scale (e.g., \"Very likely\") */\n upperBoundLabel?: string\n submitButtonText?: string\n backButtonText?: string\n}\n\nexport interface ProductTourStep {\n id: string\n type: ProductTourStepType\n selector?: string\n progressionTrigger: 'button' | 'click'\n content: JSONContent | null\n /** Pre-rendered HTML content from the editor. If present, SDK should use this instead of rendering from JSONContent. */\n contentHtml?: string\n /** Inline survey question config - if present, this is a survey step */\n survey?: ProductTourSurveyQuestion\n /** ID of the auto-created survey for this step (set by backend) */\n linkedSurveyId?: string\n /** ID of the survey question (set by backend, used for event tracking) */\n linkedSurveyQuestionId?: string\n /** Enhanced element data for more reliable lookup at runtime */\n inferenceData?: InferredSelector\n /** Use CSS selector instead of inference. Defaults to false (use inference). */\n useManualSelector?: boolean\n /** Maximum tooltip width in pixels (defaults to 320px) */\n maxWidth?: number\n /** Position for modal/survey steps (defaults to middle_center) */\n modalPosition?: SurveyPosition\n /** Button configuration for modal steps */\n buttons?: ProductTourStepButtons\n /** Banner configuration (only for banner steps) */\n bannerConfig?: ProductTourBannerConfig\n /** translation data for this tour step */\n translations?: Record<string, ProductTourStepTranslation>\n}\n\n/** all translatable content for a given tour step */\nexport interface ProductTourStepTranslation {\n content?: ProductTourStep['content']\n contentHtml?: ProductTourStep['contentHtml']\n buttons?: {\n primary?: Pick<ProductTourStepButton, 'text'>\n secondary?: Pick<ProductTourStepButton, 'text'>\n }\n survey?: Pick<\n ProductTourSurveyQuestion,\n 'questionText' | 'lowerBoundLabel' | 'upperBoundLabel' | 'submitButtonText' | 'backButtonText'\n >\n}\n\nexport interface ProductTourConditions {\n url?: string\n urlMatchType?: PropertyMatchType\n selector?: string\n autoShowDelaySeconds?: number\n events?: {\n values: SurveyEventWithFilters[]\n } | null\n cancelEvents?: {\n values: SurveyEventWithFilters[]\n } | null\n actions?: {\n values: SurveyActionType[]\n } | null\n linkedFlagVariant?: string\n}\n\nexport interface ProductTourAppearance {\n backgroundColor?: string\n textColor?: string\n buttonColor?: string\n borderRadius?: number\n buttonBorderRadius?: number\n borderColor?: string\n fontFamily?: string\n boxShadow?: string\n showOverlay?: boolean\n whiteLabel?: boolean\n /** defaults to true, auto-set to false for announcements/banners */\n dismissOnClickOutside?: boolean\n zIndex?: number\n}\n\nexport type ProductTourDisplayFrequency = 'show_once' | 'until_interacted' | 'always'\n\nexport interface ProductTour {\n id: string\n name: string\n description?: string\n type: 'product_tour'\n auto_launch?: boolean\n start_date: string | null\n end_date: string | null\n current_iteration?: number\n conditions?: ProductTourConditions\n appearance?: ProductTourAppearance\n steps: ProductTourStep[]\n internal_targeting_flag_key?: string\n linked_flag_key?: string\n display_frequency?: ProductTourDisplayFrequency\n disable_image_preload?: boolean\n}\n\nexport type ProductTourCallback = (tours: ProductTour[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type ProductTourSelectorError = 'not_found' | 'multiple_matches' | 'not_visible'\n\nexport type ProductTourDismissReason =\n | 'user_clicked_skip'\n | 'user_clicked_outside'\n | 'escape_key'\n | 'element_unavailable'\n | 'container_unavailable'\n\nexport type ProductTourRenderReason = 'auto' | 'api' | 'trigger' | 'event'\n\nexport const DEFAULT_PRODUCT_TOUR_APPEARANCE: Required<ProductTourAppearance> = {\n backgroundColor: '#ffffff',\n textColor: '#1d1f27',\n buttonColor: '#1d1f27',\n borderRadius: 8,\n buttonBorderRadius: 6,\n borderColor: '#e5e7eb',\n fontFamily: 'system-ui',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n showOverlay: true,\n whiteLabel: false,\n dismissOnClickOutside: true,\n zIndex: Z_INDEX_TOURS,\n}\n\nexport interface ShowTourOptions {\n reason?: ProductTourRenderReason\n enableStrictValidation?: boolean\n}\n\nexport enum ProductTourEventName {\n SHOWN = 'product tour shown',\n DISMISSED = 'product tour dismissed',\n COMPLETED = 'product tour completed',\n STEP_SHOWN = 'product tour step shown',\n STEP_COMPLETED = 'product tour step completed',\n BUTTON_CLICKED = 'product tour button clicked',\n STEP_SELECTOR_FAILED = 'product tour step selector failed',\n BANNER_CONTAINER_SELECTOR_FAILED = 'product tour banner container selector failed',\n BANNER_ACTION_CLICKED = 'product tour banner action clicked',\n}\n\nexport enum ProductTourEventProperties {\n TOUR_ID = '$product_tour_id',\n TOUR_NAME = '$product_tour_name',\n TOUR_ITERATION = '$product_tour_iteration',\n TOUR_RENDER_REASON = '$product_tour_render_reason',\n TOUR_STEP_ID = '$product_tour_step_id',\n TOUR_STEP_ORDER = '$product_tour_step_order',\n TOUR_STEP_TYPE = '$product_tour_step_type',\n TOUR_DISMISS_REASON = '$product_tour_dismiss_reason',\n TOUR_BUTTON_TEXT = '$product_tour_button_text',\n TOUR_BUTTON_ACTION = '$product_tour_button_action',\n TOUR_BUTTON_LINK = '$product_tour_button_link',\n TOUR_BUTTON_TOUR_ID = '$product_tour_button_tour_id',\n TOUR_STEPS_COUNT = '$product_tour_steps_count',\n TOUR_STEP_SELECTOR = '$product_tour_step_selector',\n TOUR_STEP_SELECTOR_FOUND = '$product_tour_step_selector_found',\n TOUR_STEP_ELEMENT_TAG = '$product_tour_step_element_tag',\n TOUR_STEP_ELEMENT_ID = '$product_tour_step_element_id',\n TOUR_STEP_ELEMENT_CLASSES = '$product_tour_step_element_classes',\n TOUR_STEP_ELEMENT_TEXT = '$product_tour_step_element_text',\n TOUR_ERROR = '$product_tour_error',\n TOUR_MATCHES_COUNT = '$product_tour_matches_count',\n TOUR_FAILURE_PHASE = '$product_tour_failure_phase',\n TOUR_WAITED_FOR_ELEMENT = '$product_tour_waited_for_element',\n TOUR_WAIT_DURATION_MS = '$product_tour_wait_duration_ms',\n TOUR_BANNER_SELECTOR = '$product_tour_banner_selector',\n TOUR_LINKED_SURVEY_ID = '$product_tour_linked_survey_id',\n USE_MANUAL_SELECTOR = '$use_manual_selector',\n INFERENCE_DATA_PRESENT = '$inference_data_present',\n}\n"]} | ||
| {"version":3,"file":"posthog-product-tours-types.js","sourceRoot":"","sources":["../../src/posthog-product-tours-types.ts"],"names":[],"mappings":";;;AAIA,yCAA2C;AA0K9B,QAAA,+BAA+B,GAAoC;IAC5E,eAAe,EAAE,SAAS;IAC1B,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,YAAY,EAAE,CAAC;IACf,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,WAAW;IACvB,SAAS,EAAE,gCAAgC;IAC3C,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,KAAK;IACjB,qBAAqB,EAAE,IAAI;IAC3B,MAAM,EAAE,yBAAa;CACxB,CAAA;AAOD,IAAY,oBAUX;AAVD,WAAY,oBAAoB;IAC5B,oDAA4B,CAAA;IAC5B,4DAAoC,CAAA;IACpC,4DAAoC,CAAA;IACpC,8DAAsC,CAAA;IACtC,sEAA8C,CAAA;IAC9C,sEAA8C,CAAA;IAC9C,kFAA0D,CAAA;IAC1D,0GAAkF,CAAA;IAClF,oFAA4D,CAAA;AAChE,CAAC,EAVW,oBAAoB,oCAApB,oBAAoB,QAU/B;AAED,IAAY,0BA6BX;AA7BD,WAAY,0BAA0B;IAClC,0DAA4B,CAAA;IAC5B,8DAAgC,CAAA;IAChC,wEAA0C,CAAA;IAC1C,gFAAkD,CAAA;IAClD,oEAAsC,CAAA;IACtC,0EAA4C,CAAA;IAC5C,wEAA0C,CAAA;IAC1C,kFAAoD,CAAA;IACpD,4EAA8C,CAAA;IAC9C,gFAAkD,CAAA;IAClD,4EAA8C,CAAA;IAC9C,kFAAoD,CAAA;IACpD,4EAA8C,CAAA;IAC9C,gFAAkD,CAAA;IAClD,4FAA8D,CAAA;IAC9D,sFAAwD,CAAA;IACxD,oFAAsD,CAAA;IACtD,8FAAgE,CAAA;IAChE,wFAA0D,CAAA;IAC1D,gEAAkC,CAAA;IAClC,gFAAkD,CAAA;IAClD,gFAAkD,CAAA;IAClD,0FAA4D,CAAA;IAC5D,sFAAwD,CAAA;IACxD,oFAAsD,CAAA;IACtD,sFAAwD,CAAA;IACxD,0EAA4C,CAAA;IAC5C,gFAAkD,CAAA;AACtD,CAAC,EA7BW,0BAA0B,0CAA1B,0BAA0B,QA6BrC","sourcesContent":["import { PropertyMatchType } from './types'\nimport { SurveyActionType, SurveyEventWithFilters } from './posthog-surveys-types'\nimport type { InferredSelector } from './extensions/product-tours/element-inference'\nimport { SurveyPosition } from '@posthog/core'\nimport { Z_INDEX_TOURS } from './constants'\n\nexport interface JSONContent {\n type?: string\n attrs?: Record<string, any>\n content?: JSONContent[]\n marks?: { type: string; attrs?: Record<string, any> }[]\n text?: string\n}\n\nexport type ProductTourStepType = 'element' | 'modal' | 'survey' | 'banner'\n\nexport interface ProductTourBannerConfig {\n behavior: 'sticky' | 'static' | 'custom'\n selector?: string\n action?: {\n type: 'none' | 'link' | 'trigger_tour'\n link?: string\n tourId?: string\n }\n animation?: {\n duration?: number\n }\n}\n\n/** Button actions available on modal steps */\nexport type ProductTourButtonAction = 'dismiss' | 'link' | 'next_step' | 'previous_step' | 'trigger_tour'\n\nexport interface ProductTourStepButton {\n text: string\n action: ProductTourButtonAction\n /** URL to open when action is 'link' */\n link?: string\n /** Tour ID to trigger when action is 'trigger_tour' */\n tourId?: string\n}\n\nexport interface ProductTourStepButtons {\n primary?: ProductTourStepButton\n secondary?: ProductTourStepButton\n}\n\nexport type ProductTourSurveyQuestionType = 'open' | 'rating'\n\nexport interface ProductTourSurveyQuestion {\n type: ProductTourSurveyQuestionType\n questionText: string\n /** Rating display type - emoji or number */\n display?: 'emoji' | 'number'\n /** Rating scale - 3 or 5 for emoji, 5 or 10 for number */\n scale?: 3 | 5 | 10\n /** Label for low end of rating scale (e.g., \"Not likely\") */\n lowerBoundLabel?: string\n /** Label for high end of rating scale (e.g., \"Very likely\") */\n upperBoundLabel?: string\n submitButtonText?: string\n backButtonText?: string\n}\n\nexport interface ProductTourStep {\n id: string\n type: ProductTourStepType\n selector?: string\n progressionTrigger: 'button' | 'click'\n content: JSONContent | null\n /** Pre-rendered HTML content from the editor. If present, SDK should use this instead of rendering from JSONContent. */\n contentHtml?: string\n /** Inline survey question config - if present, this is a survey step */\n survey?: ProductTourSurveyQuestion\n /** ID of the auto-created survey for this step (set by backend) */\n linkedSurveyId?: string\n /** ID of the survey question (set by backend, used for event tracking) */\n linkedSurveyQuestionId?: string\n /** Enhanced element data for more reliable lookup at runtime */\n inferenceData?: InferredSelector\n /** Use CSS selector instead of inference. Defaults to false (use inference). */\n useManualSelector?: boolean\n /** Maximum tooltip width in pixels (defaults to 320px) */\n maxWidth?: number\n /** Position for modal/survey steps (defaults to middle_center) */\n modalPosition?: SurveyPosition\n /** Button configuration for modal steps */\n buttons?: ProductTourStepButtons\n /** Banner configuration (only for banner steps) */\n bannerConfig?: ProductTourBannerConfig\n /** translation data for this tour step */\n translations?: Record<string, ProductTourStepTranslation>\n}\n\n/** all translatable content for a given tour step */\nexport interface ProductTourStepTranslation {\n content?: ProductTourStep['content']\n contentHtml?: ProductTourStep['contentHtml']\n buttons?: {\n primary?: Pick<ProductTourStepButton, 'text'>\n secondary?: Pick<ProductTourStepButton, 'text'>\n }\n survey?: Pick<\n ProductTourSurveyQuestion,\n 'questionText' | 'lowerBoundLabel' | 'upperBoundLabel' | 'submitButtonText' | 'backButtonText'\n >\n}\n\nexport interface ProductTourConditions {\n url?: string\n urlMatchType?: PropertyMatchType\n selector?: string\n autoShowDelaySeconds?: number\n events?: {\n values: SurveyEventWithFilters[]\n } | null\n cancelEvents?: {\n values: SurveyEventWithFilters[]\n } | null\n actions?: {\n values: SurveyActionType[]\n } | null\n linkedFlagVariant?: string\n deviceTypes?: string[]\n}\n\nexport interface ProductTourAppearance {\n backgroundColor?: string\n textColor?: string\n buttonColor?: string\n borderRadius?: number\n buttonBorderRadius?: number\n borderColor?: string\n fontFamily?: string\n boxShadow?: string\n showOverlay?: boolean\n whiteLabel?: boolean\n /** defaults to true, auto-set to false for announcements/banners */\n dismissOnClickOutside?: boolean\n zIndex?: number\n}\n\nexport type ProductTourDisplayFrequency = 'show_once' | 'until_interacted' | 'always'\n\nexport interface ProductTour {\n id: string\n name: string\n description?: string\n type: 'product_tour'\n auto_launch?: boolean\n start_date: string | null\n end_date: string | null\n current_iteration?: number\n conditions?: ProductTourConditions\n appearance?: ProductTourAppearance\n steps: ProductTourStep[]\n internal_targeting_flag_key?: string\n linked_flag_key?: string\n display_frequency?: ProductTourDisplayFrequency\n disable_image_preload?: boolean\n}\n\nexport type ProductTourCallback = (tours: ProductTour[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type ProductTourSelectorError = 'not_found' | 'multiple_matches' | 'not_visible'\n\nexport type ProductTourDismissReason =\n | 'user_clicked_skip'\n | 'user_clicked_outside'\n | 'escape_key'\n | 'element_unavailable'\n | 'container_unavailable'\n\nexport type ProductTourRenderReason = 'auto' | 'api' | 'trigger' | 'event'\n\nexport const DEFAULT_PRODUCT_TOUR_APPEARANCE: Required<ProductTourAppearance> = {\n backgroundColor: '#ffffff',\n textColor: '#1d1f27',\n buttonColor: '#1d1f27',\n borderRadius: 8,\n buttonBorderRadius: 6,\n borderColor: '#e5e7eb',\n fontFamily: 'system-ui',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n showOverlay: true,\n whiteLabel: false,\n dismissOnClickOutside: true,\n zIndex: Z_INDEX_TOURS,\n}\n\nexport interface ShowTourOptions {\n reason?: ProductTourRenderReason\n enableStrictValidation?: boolean\n}\n\nexport enum ProductTourEventName {\n SHOWN = 'product tour shown',\n DISMISSED = 'product tour dismissed',\n COMPLETED = 'product tour completed',\n STEP_SHOWN = 'product tour step shown',\n STEP_COMPLETED = 'product tour step completed',\n BUTTON_CLICKED = 'product tour button clicked',\n STEP_SELECTOR_FAILED = 'product tour step selector failed',\n BANNER_CONTAINER_SELECTOR_FAILED = 'product tour banner container selector failed',\n BANNER_ACTION_CLICKED = 'product tour banner action clicked',\n}\n\nexport enum ProductTourEventProperties {\n TOUR_ID = '$product_tour_id',\n TOUR_NAME = '$product_tour_name',\n TOUR_ITERATION = '$product_tour_iteration',\n TOUR_RENDER_REASON = '$product_tour_render_reason',\n TOUR_STEP_ID = '$product_tour_step_id',\n TOUR_STEP_ORDER = '$product_tour_step_order',\n TOUR_STEP_TYPE = '$product_tour_step_type',\n TOUR_DISMISS_REASON = '$product_tour_dismiss_reason',\n TOUR_BUTTON_TEXT = '$product_tour_button_text',\n TOUR_BUTTON_ACTION = '$product_tour_button_action',\n TOUR_BUTTON_LINK = '$product_tour_button_link',\n TOUR_BUTTON_TOUR_ID = '$product_tour_button_tour_id',\n TOUR_STEPS_COUNT = '$product_tour_steps_count',\n TOUR_STEP_SELECTOR = '$product_tour_step_selector',\n TOUR_STEP_SELECTOR_FOUND = '$product_tour_step_selector_found',\n TOUR_STEP_ELEMENT_TAG = '$product_tour_step_element_tag',\n TOUR_STEP_ELEMENT_ID = '$product_tour_step_element_id',\n TOUR_STEP_ELEMENT_CLASSES = '$product_tour_step_element_classes',\n TOUR_STEP_ELEMENT_TEXT = '$product_tour_step_element_text',\n TOUR_ERROR = '$product_tour_error',\n TOUR_MATCHES_COUNT = '$product_tour_matches_count',\n TOUR_FAILURE_PHASE = '$product_tour_failure_phase',\n TOUR_WAITED_FOR_ELEMENT = '$product_tour_waited_for_element',\n TOUR_WAIT_DURATION_MS = '$product_tour_wait_duration_ms',\n TOUR_BANNER_SELECTOR = '$product_tour_banner_selector',\n TOUR_LINKED_SURVEY_ID = '$product_tour_linked_survey_id',\n USE_MANUAL_SELECTOR = '$use_manual_selector',\n INFERENCE_DATA_PRESENT = '$inference_data_present',\n}\n"]} |
+2
-2
| { | ||
| "name": "posthog-js", | ||
| "version": "1.354.2", | ||
| "version": "1.354.3", | ||
| "description": "Posthog-js allows you to automatically capture usage and send events to PostHog.", | ||
@@ -62,3 +62,3 @@ "repository": "https://github.com/PostHog/posthog-js", | ||
| "@posthog/core": "1.23.1", | ||
| "@posthog/types": "1.354.2" | ||
| "@posthog/types": "1.354.3" | ||
| }, | ||
@@ -65,0 +65,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
33998037
0.06%702
0.57%93469
0.03%+ Added
- Removed
Updated