@apolitical/sdk 0.8.7 → 0.9.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.0] - 2022-05-11
9
+ ### Added
10
+ - Global environment definition to avoid duplication on other modules
11
+
8
12
  ## [0.8.7] - 2022-04-25
9
13
  ### Changed
10
14
  - `@apolitical/auth` version
package/build/index.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/auth","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/auth"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,r,a,n,i){return function(){var o={772:function(t,e,r){var a;t.exports=(a=r(785),function(){"use strict";var t={273:function(t){t.exports=a}},e={};function r(a){var n=e[a];if(void 0!==n)return n.exports;var i=e[a]={exports:{}};return t[a](i,i.exports,r),i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var a in e)r.o(e,a)&&!r.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){r.r(n),r.d(n,{setContext:function(){return u},setupGTM:function(){return d}});var t=r(273),e=r.n(t);const{APOLITICAL:{WEBSITES:{BETA:a,BETA_2:i,LIVE:o,RC:s}}}={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 c=null;const u=({configs:t,origin:e=null})=>{c=((t,e)=>{let r=null,n=null;switch(r="undefined"!=typeof window?window.origin||window.location.origin:e,r){case a:n=t.beta;break;case i:n=t["beta-2"];break;case o:n=t.live;break;case s:n=t.rc;break;default:n=t.local}return n})(t,e)},d=t=>{const r=c;"true"===t["performance-cookie-consent"]&&e().initialize({gtmId:r.id})}}(),n}())},421:function(t,e,r){"use strict";var a,n=(a=r(425))&&a.__esModule?a:{default:a},i={tags:function(t){var e=t.id,r=t.events,a=t.dataLayer,i=t.dataLayerName,o=t.preview,s="&gtm_auth="+t.auth,c="&gtm_preview="+o;return e||(0,n.default)("GTM Id is required"),{iframe:'\n <iframe src="https://www.googletagmanager.com/ns.html?id='+e+s+c+'&gtm_cookies_win=x"\n height="0" width="0" style="display:none;visibility:hidden" id="tag-manager"></iframe>',script:"\n (function(w,d,s,l,i){w[l]=w[l]||[];\n w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js', "+JSON.stringify(r).slice(1,-1)+"});\n var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';\n j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'"+s+c+"&gtm_cookies_win=x';\n f.parentNode.insertBefore(j,f);\n })(window,document,'script','"+i+"','"+e+"');",dataLayerVar:this.dataLayer(a,i)}},dataLayer:function(t,e){return"\n window."+e+" = window."+e+" || [];\n window."+e+".push("+JSON.stringify(t)+")"}};t.exports=i},676:function(t,e,r){"use strict";var a,n=(a=r(421))&&a.__esModule?a:{default:a},i={dataScript:function(t){var e=document.createElement("script");return e.innerHTML=t,e},gtm:function(t){var e=n.default.tags(t);return{noScript:function(){var t=document.createElement("noscript");return t.innerHTML=e.iframe,t},script:function(){var t=document.createElement("script");return t.innerHTML=e.script,t},dataScript:this.dataScript(e.dataLayerVar)}},initialize:function(t){var e=t.gtmId,r=t.events,a=void 0===r?{}:r,n=t.dataLayer,i=t.dataLayerName,o=void 0===i?"dataLayer":i,s=t.auth,c=void 0===s?"":s,u=t.preview,d=void 0===u?"":u,l=this.gtm({id:e,events:a,dataLayer:n||void 0,dataLayerName:o,auth:c,preview:d});n&&document.head.appendChild(l.dataScript),document.head.insertBefore(l.script(),document.head.childNodes[0]),document.body.insertBefore(l.noScript(),document.body.childNodes[0])},dataLayer:function(t){var e=t.dataLayer,r=t.dataLayerName,a=void 0===r?"dataLayer":r;if(window[a])return window[a].push(e);var i=n.default.dataLayer(e,a),o=this.dataScript(i);document.head.insertBefore(o,document.head.childNodes[0])}};t.exports=i},785:function(t,e,r){"use strict";var a,n=(a=r(676))&&a.__esModule?a:{default:a};t.exports=n.default},425:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){console.warn("[react-gtm]",t)}},654:function(t){"use strict";t.exports=r},809:function(e){"use strict";e.exports=t},30:function(t){"use strict";t.exports=e},300:function(t){"use strict";t.exports=a},408:function(t){"use strict";t.exports=i},25:function(t){"use strict";t.exports=n}},s={};function c(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return o[t].call(r.exports,r,r.exports,c),r.exports}c.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(e,{a:e}),e},c.d=function(t,e){for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return function(){"use strict";c.r(u),c.d(u,{assets:function(){return f},decodeBase64:function(){return J},default:function(){return K},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return g},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return q},peopleEngagement:function(){return H},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail},setupGTM:function(){return a.setupGTM}});var t=c(809),e=c(30),r=c(654),a=c(772),n=c(300),i=c.n(n),o={APIS:{ASSETS_API:{BASE_URL:"/api/assets-api",ENDPOINTS:{USERS:"/users",CERTIFICATES:"/certificates"}},MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users",USER_COURSES:"/courses",USER_LESSONS:"/lessons",REGISTRATIONS:"/registrations"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{USERS:"/users",USER_PROPERTIES:"/properties"}}},USERS:{MYSELF_SLUG:"me"}};const s=async t=>{try{const{message:r,response:a,request:n}=t;let i=r;a?i+=` - The request was made and the server responded with ${JSON.stringify({status:a.status,data:a.data})}`:n&&(i+=" - The request was made but no response was received"),console.warn(i),await(0,e.reportError)(new Error(i))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{ASSETS_API:{BASE_URL:d,ENDPOINTS:{USERS:l,CERTIFICATES:p}}}}=o;var f={certificates:{create:async(t,e)=>{let r=[];try{const{data:a}=await i().post(`${d}${l}/${t}${p}`,e);a&&(r=a)}catch(t){await s(t)}return r}}};const{APIS:{MANAGEMENT_API:{BASE_URL:S,ENDPOINTS:{ACCOUNTS:E}}}}=o;var g={accounts:{create:async t=>{try{await i().post(`${S}${E}`,t)}catch(t){throw await s(t),t}},read:async t=>{let e=null;try{({data:e}=await i().get(`${S}${E}/${encodeURIComponent(t)}`))}catch(t){await s(t)}return e},update:async(t,e)=>{try{await i().put(`${S}${E}/${encodeURIComponent(t)}`,e)}catch(t){throw await s(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:m,ENDPOINTS:{REGISTRATIONS:y}}}}=o;var w={list:async t=>{let e=[];try{const{data:r}=await i().get(`${m}${y}`,{params:t});r&&r.length&&(e=r)}catch(t){await s(t)}return e}},h=c(25);const{OK:P,MULTIPLE_CHOICES:_,NOT_FOUND:v,FORBIDDEN:L}=h.StatusCodes,I=t=>t>=P&&t<_||t===L||t===v,{APIS:{PEOPLE_API:{BASE_URL:T,ENDPOINTS:{USERS:A}}}}=o;var N={read:async t=>{let e=null;try{const{data:r}=await i().get(`${T}${A}/${encodeURIComponent(t)}`,{validateStatus:I});r&&r.slug&&(e=r)}catch(t){await s(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:O,ENDPOINTS:{USERS:R,USER_COURSES:b}}},USERS:{MYSELF_SLUG:U}}=o,x=`${O}${R}/${U}${b}`;var $={create:async t=>{try{await i().post(x,t)}catch(t){await s(t)}},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await i().get(x,r);t&&t.length&&(e=t)}catch(t){await s(t)}return e},update:async(t,e)=>{try{await i().put(`${x}/${t}`,e)}catch(t){await s(t)}}};const{APIS:{PEOPLE_API:{BASE_URL:C,ENDPOINTS:{USERS:M,USER_LESSONS:B}}},USERS:{MYSELF_SLUG:j}}=o,D=`${C}${M}/${j}${B}`;var q={registrations:w,users:N,userCourses:$,userLessons:{create:async t=>{let e=null;try{e=await i().post(D,t)}catch(t){await s(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await i().get(D,r);t&&t.length&&(e=t)}catch(t){await s(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:G,ENDPOINTS:{USERS:F,USER_PROPERTIES:V}}},USERS:{MYSELF_SLUG:k}}=o;var H={userProperties:{update:async(t,e)=>{try{await i().put(`${G}${F}/${k}${V}/${t}`,e)}catch(t){await s(t)}}}},Y=c(408);const J=t=>t&&Y.Buffer.from(t,"base64").toString("ascii");function K({authContext:n=null,contentContext:i=null,errorsContext:o=null,gtmContext:s=null,origin:c}){n&&(0,r.setContext)(Object.assign({},n,{origin:c})),i&&(0,t.setContext)(Object.assign({},i,{origin:c})),o&&(0,e.setContext)(Object.assign({},o,{origin:c})),s&&(0,a.setContext)(Object.assign({},s,{origin:c}))}}(),u}()}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","@apolitical/auth","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("@apolitical/auth"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t["@apolitical/auth"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,r,n,a,o){return function(){var i={772:function(t,e,r){var n;t.exports=(n=r(785),function(){"use strict";var t={273:function(t){t.exports=n}},e={};function r(n){var a=e[n];if(void 0!==a)return a.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var a={};return function(){r.r(a),r.d(a,{setContext:function(){return o},setupGTM:function(){return s}});var t=r(273),e=r.n(t);let n=null;const o=({configs:t,environment:e})=>{n=t[e]},i=()=>n,s=t=>{const r=i();"true"===t["performance-cookie-consent"]&&e().initialize({gtmId:r.id})}}(),a}())},421:function(t,e,r){"use strict";var n,a=(n=r(425))&&n.__esModule?n:{default:n},o={tags:function(t){var e=t.id,r=t.events,n=t.dataLayer,o=t.dataLayerName,i=t.preview,s="&gtm_auth="+t.auth,c="&gtm_preview="+i;return e||(0,a.default)("GTM Id is required"),{iframe:'\n <iframe src="https://www.googletagmanager.com/ns.html?id='+e+s+c+'&gtm_cookies_win=x"\n height="0" width="0" style="display:none;visibility:hidden" id="tag-manager"></iframe>',script:"\n (function(w,d,s,l,i){w[l]=w[l]||[];\n w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js', "+JSON.stringify(r).slice(1,-1)+"});\n var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';\n j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl+'"+s+c+"&gtm_cookies_win=x';\n f.parentNode.insertBefore(j,f);\n })(window,document,'script','"+o+"','"+e+"');",dataLayerVar:this.dataLayer(n,o)}},dataLayer:function(t,e){return"\n window."+e+" = window."+e+" || [];\n window."+e+".push("+JSON.stringify(t)+")"}};t.exports=o},676:function(t,e,r){"use strict";var n,a=(n=r(421))&&n.__esModule?n:{default:n},o={dataScript:function(t){var e=document.createElement("script");return e.innerHTML=t,e},gtm:function(t){var e=a.default.tags(t);return{noScript:function(){var t=document.createElement("noscript");return t.innerHTML=e.iframe,t},script:function(){var t=document.createElement("script");return t.innerHTML=e.script,t},dataScript:this.dataScript(e.dataLayerVar)}},initialize:function(t){var e=t.gtmId,r=t.events,n=void 0===r?{}:r,a=t.dataLayer,o=t.dataLayerName,i=void 0===o?"dataLayer":o,s=t.auth,c=void 0===s?"":s,u=t.preview,d=void 0===u?"":u,l=this.gtm({id:e,events:n,dataLayer:a||void 0,dataLayerName:i,auth:c,preview:d});a&&document.head.appendChild(l.dataScript),document.head.insertBefore(l.script(),document.head.childNodes[0]),document.body.insertBefore(l.noScript(),document.body.childNodes[0])},dataLayer:function(t){var e=t.dataLayer,r=t.dataLayerName,n=void 0===r?"dataLayer":r;if(window[n])return window[n].push(e);var o=a.default.dataLayer(e,n),i=this.dataScript(o);document.head.insertBefore(i,document.head.childNodes[0])}};t.exports=o},785:function(t,e,r){"use strict";var n,a=(n=r(676))&&n.__esModule?n:{default:n};t.exports=a.default},425:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){console.warn("[react-gtm]",t)}},654:function(t){"use strict";t.exports=r},809:function(e){"use strict";e.exports=t},30:function(t){"use strict";t.exports=e},300:function(t){"use strict";t.exports=n},408:function(t){"use strict";t.exports=o},25:function(t){"use strict";t.exports=a}},s={};function c(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return i[t].call(r.exports,r,r.exports,c),r.exports}c.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return c.d(e,{a:e}),e},c.d=function(t,e){for(var r in e)c.o(e,r)&&!c.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},c.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},c.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var u={};return function(){"use strict";c.r(u),c.d(u,{assets:function(){return y},decodeBase64:function(){return X},default:function(){return Z},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return v},passwordlessLogin:function(){return r.passwordlessLogin},people:function(){return Y},peopleEngagement:function(){return W},reportError:function(){return e.reportError},sendVerificationEmail:function(){return r.sendVerificationEmail},setupGTM:function(){return n.setupGTM}});var t=c(809),e=c(30),r=c(654),n=c(772),a={APOLITICAL:{WEBSITES:{LIVE:"https://apolitical.co",STAGING:/https:\/\/([\w|\d|-]+)\.apolitical\.co/i,STAGING_SPLITTER:"-"},ENVIRONMENTS:{PRODUCTION:"live",LOCAL:"local"}},APIS:{ASSETS_API:{BASE_URL:"/api/assets-api",ENDPOINTS:{USERS:"/users",CERTIFICATES:"/certificates"}},MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users",USER_COURSES:"/courses",USER_LESSONS:"/lessons",REGISTRATIONS:"/registrations"}},PEOPLE_ENGAGEMENT_API:{BASE_URL:"/api/people-engagement-api",ENDPOINTS:{USERS:"/users",USER_PROPERTIES:"/properties"}}},USERS:{MYSELF_SLUG:"me"}};const{APOLITICAL:{WEBSITES:{LIVE:o,STAGING:i,STAGING_SPLITTER:s},ENVIRONMENTS:{PRODUCTION:d,LOCAL:l}}}=a;var p=c(300),S=c.n(p);const f=async t=>{try{const{message:r,response:n,request:a}=t;let o=r;n?o+=` - The request was made and the server responded with ${JSON.stringify({status:n.status,data:n.data})}`:a&&(o+=" - The request was made but no response was received"),console.warn(o),await(0,e.reportError)(new Error(o))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{ASSETS_API:{BASE_URL:E,ENDPOINTS:{USERS:m,CERTIFICATES:g}}}}=a;var y={certificates:{create:async(t,e)=>{let r=[];try{const{data:n}=await S().post(`${E}${m}/${t}${g}`,e);n&&(r=n)}catch(t){await f(t)}return r}}};const{APIS:{MANAGEMENT_API:{BASE_URL:w,ENDPOINTS:{ACCOUNTS:I}}}}=a;var v={accounts:{create:async t=>{try{await S().post(`${w}${I}`,t)}catch(t){throw await f(t),t}},read:async t=>{let e=null;try{({data:e}=await S().get(`${w}${I}/${encodeURIComponent(t)}`))}catch(t){await f(t)}return e},update:async(t,e)=>{try{await S().put(`${w}${I}/${encodeURIComponent(t)}`,e)}catch(t){throw await f(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:h,ENDPOINTS:{REGISTRATIONS:L}}}}=a;var P={list:async t=>{let e=[];try{const{data:r}=await S().get(`${h}${L}`,{params:t});r&&r.length&&(e=r)}catch(t){await f(t)}return e}},N=c(25);const{OK:T,MULTIPLE_CHOICES:O,NOT_FOUND:_,FORBIDDEN:A}=N.StatusCodes,R=t=>t>=T&&t<O||t===A||t===_,{APIS:{PEOPLE_API:{BASE_URL:U,ENDPOINTS:{USERS:x}}}}=a;var C={read:async t=>{let e=null;try{const{data:r}=await S().get(`${U}${x}/${encodeURIComponent(t)}`,{validateStatus:R});r&&r.slug&&(e=r)}catch(t){await f(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:$,ENDPOINTS:{USERS:b,USER_COURSES:M}}},USERS:{MYSELF_SLUG:G}}=a,j=`${$}${b}/${G}${M}`;var B={create:async t=>{try{await S().post(j,t)}catch(t){await f(t)}},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await S().get(j,r);t&&t.length&&(e=t)}catch(t){await f(t)}return e},update:async(t,e)=>{try{await S().put(`${j}/${t}`,e)}catch(t){await f(t)}}};const{APIS:{PEOPLE_API:{BASE_URL:D,ENDPOINTS:{USERS:q,USER_LESSONS:F}}},USERS:{MYSELF_SLUG:V}}=a,H=`${D}${q}/${V}${F}`;var Y={registrations:P,users:C,userCourses:B,userLessons:{create:async t=>{let e=null;try{e=await S().post(H,t)}catch(t){await f(t)}return e},list:async t=>{let e=[],r=t?{params:t}:{params:{}};try{const{data:t}=await S().get(H,r);t&&t.length&&(e=t)}catch(t){await f(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:k,ENDPOINTS:{USERS:J,USER_PROPERTIES:K}}},USERS:{MYSELF_SLUG:z}}=a;var W={userProperties:{update:async(t,e)=>{try{await S().put(`${k}${J}/${z}${K}/${t}`,e)}catch(t){await f(t)}}}},Q=c(408);const X=t=>t&&Q.Buffer.from(t,"base64").toString("ascii");function Z({authContext:a=null,contentContext:c=null,errorsContext:u=null,gtmContext:p=null,origin:S}){const f=(t=>{let e=null;t?e=t:"undefined"!=typeof window&&(e=window.origin||window.location.origin);let r=null;if(e){const t=e.match(i);r=t?t[1].split(s)[0]:e===o?d:l}return r})(S);a&&(0,r.setContext)(Object.assign({},a,{environment:f,origin:S})),c&&(0,t.setContext)(Object.assign({},c,{environment:f})),u&&(0,e.setContext)(Object.assign({},u,{environment:f})),p&&(0,n.setContext)(Object.assign({},p,{environment:f}))}}(),u}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.8.7",
3
+ "version": "0.9.0",
4
4
  "description": "Browser library to interact with Apolitical's APIs",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -25,34 +25,35 @@
25
25
  "SDK"
26
26
  ],
27
27
  "dependencies": {
28
- "@apolitical/auth": "0.0.3",
29
- "@apolitical/content": "0.3.0",
30
- "@apolitical/error-reporting": "0.1.0",
31
- "@apolitical/gtm": "1.0.1",
28
+ "@apolitical/auth": "0.1.0",
29
+ "@apolitical/content": "0.4.0",
30
+ "@apolitical/error-reporting": "0.2.0",
31
+ "@apolitical/gtm": "1.1.0",
32
32
  "axios": "0.26.0",
33
33
  "buffer": "6.0.3",
34
34
  "http-status-codes": "2.2.0"
35
35
  },
36
36
  "peerDependencies": {
37
- "@apolitical/auth": "0.0.3",
38
- "@apolitical/content": "0.3.0",
39
- "@apolitical/error-reporting": "0.1.0",
40
- "@apolitical/gtm": "1.0.1",
41
- "axios": "0.26.0",
37
+ "@apolitical/auth": "0.1.0",
38
+ "@apolitical/content": "0.4.0",
39
+ "@apolitical/error-reporting": "0.2.0",
40
+ "@apolitical/gtm": "1.1.0",
41
+ "axios": "0.27.2",
42
42
  "buffer": "6.0.3",
43
43
  "http-status-codes": "2.2.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@apolitical/eslint-config": "1.0.2",
47
- "@babel/core": "7.16.12",
48
- "@babel/eslint-parser": "7.16.5",
49
- "@babel/plugin-transform-runtime": "7.16.10",
50
- "@babel/preset-env": "7.16.11",
51
- "husky": "7.0.4",
52
- "jest": "27.4.7",
53
- "jest-junit": "13.0.0",
54
- "lint-staged": "12.3.2",
55
- "webpack": "5.68.0",
46
+ "@apolitical/eslint-config": "2.0.1",
47
+ "@babel/core": "7.17.10",
48
+ "@babel/eslint-parser": "7.17.0",
49
+ "@babel/plugin-transform-runtime": "7.17.10",
50
+ "@babel/preset-env": "7.17.10",
51
+ "husky": "8.0.1",
52
+ "jest": "28.1.0",
53
+ "jest-environment-jsdom": "28.1.0",
54
+ "jest-junit": "13.2.0",
55
+ "lint-staged": "12.4.1",
56
+ "webpack": "5.72.1",
56
57
  "webpack-cli": "4.9.2"
57
58
  },
58
59
  "eslintConfig": {
@@ -90,6 +91,7 @@
90
91
  "default",
91
92
  "jest-junit"
92
93
  ],
94
+ "testEnvironment": "jsdom",
93
95
  "testResultsProcessor": "jest-junit"
94
96
  },
95
97
  "babel": {