@rebilly/lead-source-tracker 8.20.10 → 8.20.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/build.js +1 -1
  2. package/package.json +1 -1
package/dist/build.js CHANGED
@@ -1 +1 @@
1
- (function(u,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(u=typeof globalThis<"u"?globalThis:u||self,u.RebillyLeadSource=f())})(this,function(){"use strict";/*! js-cookie v3.0.8 | MIT */function u(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var c in n)c!=="__proto__"&&(e[c]=n[c])}return e}var f={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function p(e,r){function n(t,a,o){if(!(typeof document>"u")){o=u({},r,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,o[s]!==!0&&(i+="="+o[s].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+i}}function c(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],o={},i=0;i<a.length;i++){var s=a[i].split("="),I=s.slice(1).join("=");try{var l=decodeURIComponent(s[0]);if(l in o||(o[l]=e.read(I,l)),t===l)break}catch{}}return t?o[t]:o}}return Object.create({set:n,get:c,remove:function(t,a){n(t,"",u({},a,{expires:-1}))},withAttributes:function(t){return p(this.converter,u({},this.attributes,t))},withConverter:function(t){return p(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var m=p(f,{path:"/"});const h="rls",g={expires:45},O=["source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"],C=["path","referrer"],k=[...C,...O];function S(e,r){const{document:n}=e;if(w(e))return d({dnt:!0}),{};const c={path:n.location.host+n.location.pathname,...U(n),...T(n),...y(e)},{leadSource:t}=R({leadSource:c},r);return t||{}}function d({dnt:e=!1}){const r={dnt:e};return e?x(r):m.remove(h,g),r}function R(e,r){const n=D();if(n.dnt||e.dnt)return d({dnt:!0});d({dnt:!1});const c=n.leadSource||{},t=C.reduce((o,i)=>{const s=c[i];return s&&(o[i]=s),o},{}),a={leadSource:{...c,...v(e.leadSource),...t}};return Object.assign(g,r||{}),x(a),a}function D(){const e=m.get(h);if(!e)return{};try{const r=JSON.parse(e);return r.dnt?{dnt:!0}:r}catch{return{}}}function x(e){m.set(h,JSON.stringify(e),g)}function U(e){const{dataset:r}=e.querySelector("#rls-token")||{};return v(r)}function y(e){const r=new URLSearchParams(e.location.search),n=k.reduce((c,t)=>(c[t]=r.get(`utm_${t}`)||r.get(t)||r.get(`utm_${t.toLowerCase()}`)||r.get(t.toLowerCase())||null,c),{});return v(n)}function T(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch{return{}}}function w(e){const n=new URLSearchParams(e.location.search).has("dnt"),{dnt:c}=D(),t=F(e);return n||t||c}function F(e){const{navigator:r}=e;if(e.doNotTrack||r.doNotTrack||r.msDoNotTrack)return e.doNotTrack=="1"||r.doNotTrack=="yes"||r.doNotTrack=="1"||r.msDoNotTrack=="1"}function v(e={}){return k.reduce((r,n)=>{const c=(e[n]||"").trim();return c&&(r[n]=c),r},{})}return typeof window<"u"&&document.addEventListener("DOMContentLoaded",()=>{S(window)}),{collect:S,clear:d}});
1
+ (function(u,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(u=typeof globalThis<"u"?globalThis:u||self,u.RebillyLeadSource=f())})(this,function(){"use strict";/*! js-cookie v3.0.7 | MIT */function u(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var c in n)c!=="__proto__"&&(e[c]=n[c])}return e}var f={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function p(e,r){function n(t,a,o){if(!(typeof document>"u")){o=u({},r,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var i="";for(var s in o)o[s]&&(i+="; "+s,o[s]!==!0&&(i+="="+o[s].split(";")[0]));return document.cookie=t+"="+e.write(a,t)+i}}function c(t){if(!(typeof document>"u"||arguments.length&&!t)){for(var a=document.cookie?document.cookie.split("; "):[],o={},i=0;i<a.length;i++){var s=a[i].split("="),I=s.slice(1).join("=");try{var l=decodeURIComponent(s[0]);if(l in o||(o[l]=e.read(I,l)),t===l)break}catch{}}return t?o[t]:o}}return Object.create({set:n,get:c,remove:function(t,a){n(t,"",u({},a,{expires:-1}))},withAttributes:function(t){return p(this.converter,u({},this.attributes,t))},withConverter:function(t){return p(u({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(e)}})}var m=p(f,{path:"/"});const h="rls",g={expires:45},O=["source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"],C=["path","referrer"],k=[...C,...O];function S(e,r){const{document:n}=e;if(w(e))return d({dnt:!0}),{};const c={path:n.location.host+n.location.pathname,...U(n),...T(n),...y(e)},{leadSource:t}=R({leadSource:c},r);return t||{}}function d({dnt:e=!1}){const r={dnt:e};return e?x(r):m.remove(h,g),r}function R(e,r){const n=D();if(n.dnt||e.dnt)return d({dnt:!0});d({dnt:!1});const c=n.leadSource||{},t=C.reduce((o,i)=>{const s=c[i];return s&&(o[i]=s),o},{}),a={leadSource:{...c,...v(e.leadSource),...t}};return Object.assign(g,r||{}),x(a),a}function D(){const e=m.get(h);if(!e)return{};try{const r=JSON.parse(e);return r.dnt?{dnt:!0}:r}catch{return{}}}function x(e){m.set(h,JSON.stringify(e),g)}function U(e){const{dataset:r}=e.querySelector("#rls-token")||{};return v(r)}function y(e){const r=new URLSearchParams(e.location.search),n=k.reduce((c,t)=>(c[t]=r.get(`utm_${t}`)||r.get(t)||r.get(`utm_${t.toLowerCase()}`)||r.get(t.toLowerCase())||null,c),{});return v(n)}function T(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch{return{}}}function w(e){const n=new URLSearchParams(e.location.search).has("dnt"),{dnt:c}=D(),t=F(e);return n||t||c}function F(e){const{navigator:r}=e;if(e.doNotTrack||r.doNotTrack||r.msDoNotTrack)return e.doNotTrack=="1"||r.doNotTrack=="yes"||r.doNotTrack=="1"||r.msDoNotTrack=="1"}function v(e={}){return k.reduce((r,n)=>{const c=(e[n]||"").trim();return c&&(r[n]=c),r},{})}return typeof window<"u"&&document.addEventListener("DOMContentLoaded",()=>{S(window)}),{collect:S,clear:d}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/lead-source-tracker",
3
- "version": "8.20.10",
3
+ "version": "8.20.11",
4
4
  "description": "Simple library which is used to collect and store lead source information into a cookie",
5
5
  "author": "Rebilly",
6
6
  "repository": "https://github.com/Rebilly/rebilly",