@rebilly/lead-source-tracker 2.14.5 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/build.js +7 -1
  2. package/package.json +4 -11
package/dist/build.js CHANGED
@@ -1 +1,7 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).RebillyLeadSource=t()}(this,(function(){"use strict";var e=function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e,t){var n;n=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function o(){}function c(t,n,c){if("undefined"!=typeof document){"number"==typeof(c=e({path:"/"},o.defaults,c)).expires&&(c.expires=new Date(1*new Date+864e5*c.expires)),c.expires=c.expires?c.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var u="";for(var a in c)c[a]&&(u+="; "+a,!0!==c[a]&&(u+="="+c[a].split(";")[0]));return document.cookie=t+"="+n+u}}function i(e,n){if("undefined"!=typeof document){for(var o={},c=document.cookie?document.cookie.split("; "):[],i=0;i<c.length;i++){var u=c[i].split("="),a=u.slice(1).join("=");n||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var s=t(u[0]);if(a=(r.read||r)(a,s)||t(a),n)try{a=JSON.parse(a)}catch(e){}if(o[s]=a,e===s)break}catch(e){}}return e?o[e]:o}}return o.set=c,o.get=function(e){return i(e,!1)},o.getJSON=function(e){return i(e,!0)},o.remove=function(t,n){c(t,"",e(n,{expires:-1}))},o.defaults={},o.withConverter=n,o}((function(){}))},e.exports=n()}));const t="rls",n={expires:45},r=["path","referrer"],o=[...r,"source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"];function c(e,t){const{document:o}=e;if(function(e){const t=new URLSearchParams(e.location.search),n=t.has("dnt"),{dnt:r}=u(),o=function(e){const{navigator:t}=e;if(e.doNotTrack||t.doNotTrack||t.msDoNotTrack)return"1"==e.doNotTrack||"yes"==t.doNotTrack||"1"==t.doNotTrack||"1"==t.msDoNotTrack}(e);return n||o||r}(e))return i({dnt:!0}),{};const c={path:o.location.host+o.location.pathname,...s(o),...f(o),...d(e)},{leadSource:p}=function(e,t){const o=u();if(o.dnt||e.dnt)return i({dnt:!0});i({dnt:!1});const c=o.leadSource||{},s=r.reduce(((e,t)=>{const n=c[t];return n&&(e[t]=n),e}),{}),d={leadSource:{...c,...l(e.leadSource),...s}};return Object.assign(n,t||{}),a(d),d}({leadSource:c},t);return p||{}}function i({dnt:r=!1}){const o={dnt:r};return r?a(o):e.remove(t,n),o}function u(){const n=e.getJSON(t)||{};return n.dnt?{dnt:!0}:n}function a(r){e.set(t,r,n)}function s(e){const{dataset:t}=e.querySelector("#rls-token")||{};return l(t)}function d(e){const t=new URLSearchParams(e.location.search);return l(o.reduce(((e,n)=>(e[n]=t.get(`utm_${n}`)||t.get(n)||t.get(`utm_${n.toLowerCase()}`)||t.get(n.toLowerCase())||null,e)),{}))}function f(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch(e){return{}}}function l(e={}){return o.reduce(((t,n)=>{const r=(e[n]||"").trim();return r&&(t[n]=r),t}),{})}return"undefined"!=typeof window&&document.addEventListener("DOMContentLoaded",(()=>{c(window)})),{collect:c,clear:i}}));
1
+ (function(C,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(C=typeof globalThis<"u"?globalThis:C||self,C.RebillyLeadSource=g())})(this,function(){"use strict";function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};/*!
2
+ * JavaScript Cookie v2.2.1
3
+ * https://github.com/js-cookie/js-cookie
4
+ *
5
+ * Copyright 2006, 2015 Klaus Hartl & Fagner Brack
6
+ * Released under the MIT license
7
+ */(function(e,n){(function(r){var t;if(e.exports=r(),t=!0,!t){var o=window.Cookies,c=window.Cookies=r();c.noConflict=function(){return window.Cookies=o,c}}})(function(){function r(){for(var c=0,s={};c<arguments.length;c++){var d=arguments[c];for(var l in d)s[l]=d[l]}return s}function t(c){return c.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}function o(c){function s(){}function d(u,a,i){if(!(typeof document>"u")){i=r({path:"/"},s.defaults,i),typeof i.expires=="number"&&(i.expires=new Date(new Date*1+i.expires*864e5)),i.expires=i.expires?i.expires.toUTCString():"";try{var h=JSON.stringify(a);/^[\{\[]/.test(h)&&(a=h)}catch{}a=c.write?c.write(a,u):encodeURIComponent(String(a)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),u=encodeURIComponent(String(u)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var p="";for(var m in i)i[m]&&(p+="; "+m,i[m]!==!0&&(p+="="+i[m].split(";")[0]));return document.cookie=u+"="+a+p}}function l(u,a){if(!(typeof document>"u")){for(var i={},h=document.cookie?document.cookie.split("; "):[],p=0;p<h.length;p++){var m=h[p].split("="),f=m.slice(1).join("=");!a&&f.charAt(0)==='"'&&(f=f.slice(1,-1));try{var w=t(m[0]);if(f=(c.read||c)(f,w)||t(f),a)try{f=JSON.parse(f)}catch{}if(i[w]=f,u===w)break}catch{}}return u?i[u]:i}}return s.set=d,s.get=function(u){return l(u,!1)},s.getJSON=function(u){return l(u,!0)},s.remove=function(u,a){d(u,"",r(a,{expires:-1}))},s.defaults={},s.withConverter=o,s}return o(function(){})})})(g);var N=g.exports;const v=C(N),D="rls",x={expires:45},y=["source","medium","campaign","term","content","affiliate","subAffiliate","clickId","salesAgent"],O=["path","referrer"],R=[...O,...y];function T(e,n){const{document:r}=e;if(_(e))return S({dnt:!0}),{};const t={path:r.location.host+r.location.pathname,...E(r),...I(r),...F(e)},{leadSource:o}=A({leadSource:t},n);return o||{}}function S({dnt:e=!1}){const n={dnt:e};return e?L(n):v.remove(D,x),n}function A(e,n){const r=U();if(r.dnt||e.dnt)return S({dnt:!0});S({dnt:!1});const t=r.leadSource||{},o=O.reduce((s,d)=>{const l=t[d];return l&&(s[d]=l),s},{}),c={leadSource:{...t,...k(e.leadSource),...o}};return Object.assign(x,n||{}),L(c),c}function U(){const e=v.getJSON(D)||{};return e.dnt?{dnt:!0}:e}function L(e){v.set(D,e,x)}function E(e){const{dataset:n}=e.querySelector("#rls-token")||{};return k(n)}function F(e){const n=new URLSearchParams(e.location.search),r=R.reduce((t,o)=>(t[o]=n.get(`utm_${o}`)||n.get(o)||n.get(`utm_${o.toLowerCase()}`)||n.get(o.toLowerCase())||null,t),{});return k(r)}function I(e){try{return new URL(e.referrer).hostname!==e.location.hostname?{referrer:e.referrer}:{}}catch{return{}}}function _(e){const r=new URLSearchParams(e.location.search).has("dnt"),{dnt:t}=U(),o=j(e);return r||o||t}function j(e){const{navigator:n}=e;if(e.doNotTrack||n.doNotTrack||n.msDoNotTrack)return e.doNotTrack=="1"||n.doNotTrack=="yes"||n.doNotTrack=="1"||n.msDoNotTrack=="1"}function k(e={}){return R.reduce((n,r)=>{const t=(e[r]||"").trim();return t&&(n[r]=t),n},{})}return typeof window<"u"&&document.addEventListener("DOMContentLoaded",()=>{T(window)}),{collect:T,clear:S}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebilly/lead-source-tracker",
3
- "version": "2.14.5",
3
+ "version": "2.15.0",
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",
@@ -12,26 +12,19 @@
12
12
  "lint": "eslint src dev --fix --max-warnings 0",
13
13
  "lint:no-fix": "yarn lint --no-fix",
14
14
  "serve": "yarn build && node ./dev/server.js",
15
- "build": "rollup -c"
15
+ "build": "vite build"
16
16
  },
17
17
  "browserslist": [
18
18
  "> 1%",
19
19
  "last 2 versions"
20
20
  ],
21
21
  "devDependencies": {
22
- "@babel/core": "^7.24.0",
23
- "@babel/plugin-transform-runtime": "^7.12.17",
24
- "@babel/preset-env": "^7.22.14",
25
22
  "@rebilly/eslint-config": "*",
26
- "@rollup/plugin-babel": "^6.0.4",
27
- "@rollup/plugin-node-resolve": "^8.4.0",
28
- "@rollup/plugin-commonjs": "^14.0.0",
29
23
  "express": "^4.19.2",
30
- "rollup": "^2.21.0",
31
- "rollup-plugin-terser": "^7.0.2"
24
+ "vite": "^5.1.4",
25
+ "vite-plugin-commonjs": "^0.10.1"
32
26
  },
33
27
  "dependencies": {
34
- "@babel/runtime": "^7.24.1",
35
28
  "js-cookie": "^2.2.1"
36
29
  }
37
30
  }