@apolitical/gtm 1.0.1-rc.1 → 1.0.1-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1,2 +1 @@
1
- /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-gtm-module")):"function"==typeof define&&define.amd?define(["react-gtm-module"],t):"object"==typeof exports?exports.ApoliticalGTM=t(require("react-gtm-module")):e.ApoliticalGTM=t(e["react-gtm-module"])}(this,(function(e){return function(){"use strict";var t={489:function(e,t){t.Q=function(e,t){if("string"!=typeof e)throw new TypeError("argument str must be a string");for(var n={},o=t||{},a=e.split(";"),u=o.decode||r,c=0;c<a.length;c++){var s=a[c],f=s.indexOf("=");if(!(f<0)){var p=s.substring(0,f).trim();if(null==n[p]){var l=s.substring(f+1,s.length).trim();'"'===l[0]&&(l=l.slice(1,-1)),n[p]=i(l,u)}}}return n},t.q=function(e,t,r){var i=r||{},a=i.encode||n;if("function"!=typeof a)throw new TypeError("option encode is invalid");if(!o.test(e))throw new TypeError("argument name is invalid");var u=a(t);if(u&&!o.test(u))throw new TypeError("argument val is invalid");var c=e+"="+u;if(null!=i.maxAge){var s=i.maxAge-0;if(isNaN(s)||!isFinite(s))throw new TypeError("option maxAge is invalid");c+="; Max-Age="+Math.floor(s)}if(i.domain){if(!o.test(i.domain))throw new TypeError("option domain is invalid");c+="; Domain="+i.domain}if(i.path){if(!o.test(i.path))throw new TypeError("option path is invalid");c+="; Path="+i.path}if(i.expires){if("function"!=typeof i.expires.toUTCString)throw new TypeError("option expires is invalid");c+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(c+="; HttpOnly"),i.secure&&(c+="; Secure"),i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"strict":c+="; SameSite=Strict";break;case"none":c+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return c};var r=decodeURIComponent,n=encodeURIComponent,o=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function i(e,t){try{return t(e)}catch(t){return e}}},418:function(e){var t=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var a,u,c=o(e),s=1;s<arguments.length;s++){for(var f in a=Object(arguments[s]))r.call(a,f)&&(c[f]=a[f]);if(t){u=t(a);for(var p=0;p<u.length;p++)n.call(a,u[p])&&(c[u[p]]=a[u[p]])}}return c}},408:function(e,t,r){var n=r(418),o=60109,i=60110;if("function"==typeof Symbol&&Symbol.for){var a=Symbol.for;a("react.element"),a("react.portal"),a("react.fragment"),a("react.strict_mode"),a("react.profiler"),o=a("react.provider"),i=a("react.context"),a("react.forward_ref"),a("react.suspense"),a("react.memo"),a("react.lazy")}"function"==typeof Symbol&&Symbol.iterator;function u(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var c={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},s={};function f(e,t,r){this.props=e,this.context=t,this.refs=s,this.updater=r||c}function p(){}function l(e,t,r){this.props=e,this.context=t,this.refs=s,this.updater=r||c}f.prototype.isReactComponent={},f.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(u(85));this.updater.enqueueSetState(this,e,t,"setState")},f.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},p.prototype=f.prototype;var d=l.prototype=new p;d.constructor=l,n(d,f.prototype),d.isPureReactComponent=!0;Object.prototype.hasOwnProperty;var h=null;function m(){var e=h;if(null===e)throw Error(u(321));return e}t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:i,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.useContext=function(e,t){return m().useContext(e,t)},t.useLayoutEffect=function(e,t){return m().useLayoutEffect(e,t)},t.useMemo=function(e,t){return m().useMemo(e,t)},t.useRef=function(e){return m().useRef(e)},t.useState=function(e){return m().useState(e)}},294:function(e,t,r){e.exports=r(408)},273:function(t){t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return function(){n.r(o),n.d(o,{setContext:function(){return y},setupGTM:function(){return g}});var e=n(294),t=n(489);function r(e,t){void 0===t&&(t={});var r=function(e){return e&&"j"===e[0]&&":"===e[1]?e.substr(2):e}(e);if(function(e,t){return void 0===t&&(t=!e||"{"!==e[0]&&"["!==e[0]&&'"'!==e[0]),!t}(r,t.doNotParse))try{return JSON.parse(r)}catch(e){}return e}var i=function(){return i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)},a=function(){function e(e,r){var n=this;this.changeListeners=[],this.HAS_DOCUMENT_COOKIE=!1,this.cookies=function(e,r){return"string"==typeof e?t.Q(e,r):"object"==typeof e&&null!==e?e:{}}(e,r),new Promise((function(){n.HAS_DOCUMENT_COOKIE="object"==typeof document&&"string"==typeof document.cookie})).catch((function(){}))}return e.prototype._updateBrowserValues=function(e){this.HAS_DOCUMENT_COOKIE&&(this.cookies=t.Q(document.cookie,e))},e.prototype._emitChange=function(e){for(var t=0;t<this.changeListeners.length;++t)this.changeListeners[t](e)},e.prototype.get=function(e,t,n){return void 0===t&&(t={}),this._updateBrowserValues(n),r(this.cookies[e],t)},e.prototype.getAll=function(e,t){void 0===e&&(e={}),this._updateBrowserValues(t);var n={};for(var o in this.cookies)n[o]=r(this.cookies[o],e);return n},e.prototype.set=function(e,r,n){var o;"object"==typeof r&&(r=JSON.stringify(r)),this.cookies=i(i({},this.cookies),((o={})[e]=r,o)),this.HAS_DOCUMENT_COOKIE&&(document.cookie=t.q(e,r,n)),this._emitChange({name:e,value:r,options:n})},e.prototype.remove=function(e,r){var n=r=i(i({},r),{expires:new Date(1970,1,1,0,0,1),maxAge:0});this.cookies=i({},this.cookies),delete this.cookies[e],this.HAS_DOCUMENT_COOKIE&&(document.cookie=t.q(e,"",n)),this._emitChange({name:e,value:void 0,options:r})},e.prototype.addChangeListener=function(e){this.changeListeners.push(e)},e.prototype.removeChangeListener=function(e){var t=this.changeListeners.indexOf(e);t>=0&&this.changeListeners.splice(t,1)},e}(),u=e.createContext(new a),c=(u.Provider,u.Consumer,u);var s=n(273),f=n.n(s);const{APOLITICAL:{WEBSITES:{BETA:p,BETA_2:l,LIVE:d,RC:h}}}={APOLITICAL:{WEBSITES:{BETA:"https://beta.apolitical.co",BETA_2:"https://beta-2.apolitical.co",LIVE:"https://apolitical.co",RC:"https://rc.apolitical.co"},ENVIRONMENTS:{BETA:"beta",BETA_2:"beta",RC:"rc",LIVE:"master"}}};let m=null;const y=({configs:e,origin:t=null})=>{m=((e,t)=>{let r=null,n=null;switch(r="undefined"!=typeof window?window.origin||window.location.origin:t,r){case p:n=e.beta;break;case l:n=e["beta-2"];break;case d:n=e.live;break;case h:n=e.rc;break;default:n=e.local}return n})(e,t)},v=()=>m,g=()=>{const t=v(),[r]=function(t){var r=(0,e.useContext)(c);if(!r)throw new Error("Missing <CookiesProvider>");var n=r.getAll(),o=(0,e.useState)(n),i=o[0],a=o[1],u=(0,e.useRef)(i);return"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement&&(0,e.useLayoutEffect)((function(){function e(){var e=r.getAll();(function(e,t,r){if(!e)return!0;for(var n=0,o=e;n<o.length;n++){var i=o[n];if(t[i]!==r[i])return!0}return!1})(t||null,e,u.current)&&a(e),u.current=e}return r.addChangeListener(e),function(){r.removeChangeListener(e)}}),[r]),[i,(0,e.useMemo)((function(){return r.set.bind(r)}),[r]),(0,e.useMemo)((function(){return r.remove.bind(r)}),[r])]}(["cookie-banner","performance-cookie-consent"]);"true"===r["performance-cookie-consent"]&&f().initialize({gtmId:t.id})}}(),o}()}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-gtm-module")):"function"==typeof define&&define.amd?define(["react-gtm-module"],t):"object"==typeof exports?exports.ApoliticalGTM=t(require("react-gtm-module")):e.ApoliticalGTM=t(e["react-gtm-module"])}(this,(function(e){return function(){"use strict";var t={273:function(t){t.exports=e}},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var i=o[e]={exports:{}};return t[e](i,i.exports,n),i.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return function(){n.r(r),n.d(r,{setContext:function(){return l},setupGTM:function(){return p}});var e=n(273),t=n.n(e);const{APOLITICAL:{WEBSITES:{BETA:o,BETA_2:i,LIVE:c,RC:a}}}={APOLITICAL:{WEBSITES:{BETA:"https://beta.apolitical.co",BETA_2:"https://beta-2.apolitical.co",LIVE:"https://apolitical.co",RC:"https://rc.apolitical.co"},ENVIRONMENTS:{BETA:"beta",BETA_2:"beta",RC:"rc",LIVE:"master"}}};let u=null;const l=({configs:e,origin:t=null})=>{u=((e,t)=>{let n=null,r=null;switch(n="undefined"!=typeof window?window.origin||window.location.origin:t,n){case o:r=e.beta;break;case i:r=e["beta-2"];break;case c:r=e.live;break;case a:r=e.rc;break;default:r=e.local}return r})(e,t)},f=()=>u,p=e=>{const o=f();"true"===e["performance-cookie-consent"]&&t().initialize({gtmId:o.id})}}(),r}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/gtm",
3
- "version": "1.0.1-rc.1",
3
+ "version": "1.0.1-rc.2",
4
4
  "description": "Browser library to interact with Google Tag Manager (GTM)",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -25,13 +25,9 @@
25
25
  "Template"
26
26
  ],
27
27
  "dependencies": {
28
- "react": "17.0.2",
29
- "react-cookie": "4.1.1",
30
28
  "react-gtm-module": "2.0.11"
31
29
  },
32
30
  "peerDependencies": {
33
- "react": "17.0.2",
34
- "react-cookie": "4.1.1",
35
31
  "react-gtm-module": "2.0.11"
36
32
  },
37
33
  "devDependencies": {
@@ -1,21 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- /*!
8
- * cookie
9
- * Copyright(c) 2012-2014 Roman Shtylman
10
- * Copyright(c) 2015 Douglas Christopher Wilson
11
- * MIT Licensed
12
- */
13
-
14
- /** @license React v17.0.2
15
- * react.production.min.js
16
- *
17
- * Copyright (c) Facebook, Inc. and its affiliates.
18
- *
19
- * This source code is licensed under the MIT license found in the
20
- * LICENSE file in the root directory of this source tree.
21
- */