@apolitical/sdk 0.9.0 → 0.9.1-rc.3

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.1] - 2022-05-13
9
+ ### Fixed
10
+ - Error handling on select environment function
11
+
8
12
  ## [0.9.0] - 2022-05-11
9
13
  ### Added
10
14
  - Global environment definition to avoid duplication on other modules
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,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}()}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/auth"),require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/auth","@apolitical/content","@apolitical/error-reporting","axios","http-status-codes","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/auth"),require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/auth"],t["@apolitical/content"],t["@apolitical/error-reporting"],t.axios,t["http-status-codes"],t.buffer)}(this,(function(t,e,n,r,a,o){return function(){var i={772:function(t,e,n){var r;t.exports=(r=n(785),function(){"use strict";var t={273:function(t){t.exports=r}},e={};function n(r){var a=e[r];if(void 0!==a)return a.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.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(){n.r(a),n.d(a,{setContext:function(){return o},setupGTM:function(){return s}});var t=n(273),e=n.n(t);let r=null;const o=({configs:t,environment:e})=>{if(!e)throw new Error("Cannot set context: Environment not defined");if(!t)throw new Error("Cannot set context: REACT_APP_GTM_ID not defined");if(!t[e])throw new Error(`Cannot set context: REACT_APP_GTM_ID not defined for environment - ${JSON.stringify({configs:t,environment:e})}`);r=t[e]},i=()=>r,s=t=>{const n=i();"true"===t["performance-cookie-consent"]&&e().initialize({gtmId:n.id})}}(),a}())},421:function(t,e,n){"use strict";var r,a=(r=n(425))&&r.__esModule?r:{default:r},o={tags:function(t){var e=t.id,n=t.events,r=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(n).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(r,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,n){"use strict";var r,a=(r=n(421))&&r.__esModule?r:{default:r},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,n=t.events,r=void 0===n?{}:n,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:r,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,n=t.dataLayerName,r=void 0===n?"dataLayer":n;if(window[r])return window[r].push(e);var o=a.default.dataLayer(e,r),i=this.dataScript(o);document.head.insertBefore(i,document.head.childNodes[0])}};t.exports=o},785:function(t,e,n){"use strict";var r,a=(r=n(676))&&r.__esModule?r:{default:r};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(e){"use strict";e.exports=t},809:function(t){"use strict";t.exports=e},30:function(t){"use strict";t.exports=n},300:function(t){"use strict";t.exports=r},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 n=s[t]={exports:{}};return i[t].call(n.exports,n,n.exports,c),n.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 n in e)c.o(e,n)&&!c.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},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 Z},default:function(){return tt},getAuthContext:function(){return t.getContext},getEntries:function(){return e.getEntries},getEntry:function(){return e.getEntry},management:function(){return I},passwordlessLogin:function(){return t.passwordlessLogin},people:function(){return K},peopleEngagement:function(){return Q},reportError:function(){return n.reportError},sendVerificationEmail:function(){return t.sendVerificationEmail},setupGTM:function(){return r.setupGTM}});var t=c(654),e=c(809),n=c(30),r=c(772),a={APOLITICAL:{WEBSITES:{LIVE:"https://apolitical.co",LOCALHOST:"localhost",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,LOCALHOST:i,STAGING:s,STAGING_SPLITTER:d},ENVIRONMENTS:{PRODUCTION:l,LOCAL:p}}}=a;var f=c(300),S=c.n(f);const E=async t=>{try{const{message:e,response:r,request:a}=t;let o=e;r?o+=` - The request was made and the server responded with ${JSON.stringify({status:r.status,data:r.data})}`:a&&(o+=" - The request was made but no response was received"),console.warn(o),await(0,n.reportError)(new Error(o))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{ASSETS_API:{BASE_URL:m,ENDPOINTS:{USERS:g,CERTIFICATES:w}}}}=a;var y={certificates:{create:async(t,e)=>{let n=[];try{const{data:r}=await S().post(`${m}${g}/${t}${w}`,e);r&&(n=r)}catch(t){await E(t)}return n}}};const{APIS:{MANAGEMENT_API:{BASE_URL:h,ENDPOINTS:{ACCOUNTS:v}}}}=a;var I={accounts:{create:async t=>{try{await S().post(`${h}${v}`,t)}catch(t){throw await E(t),t}},read:async t=>{let e=null;try{({data:e}=await S().get(`${h}${v}/${encodeURIComponent(t)}`))}catch(t){await E(t)}return e},update:async(t,e)=>{try{await S().put(`${h}${v}/${encodeURIComponent(t)}`,e)}catch(t){throw await E(t),t}}}};const{APIS:{PEOPLE_API:{BASE_URL:L,ENDPOINTS:{REGISTRATIONS:P}}}}=a;var T={list:async t=>{let e=[];try{const{data:n}=await S().get(`${L}${P}`,{params:t});n&&n.length&&(e=n)}catch(t){await E(t)}return e}},O=c(25);const{OK:_,MULTIPLE_CHOICES:N,NOT_FOUND:A,FORBIDDEN:R}=O.StatusCodes,C=t=>t>=_&&t<N||t===R||t===A,{APIS:{PEOPLE_API:{BASE_URL:x,ENDPOINTS:{USERS:U}}}}=a;var $={read:async t=>{let e=null;try{const{data:n}=await S().get(`${x}${U}/${encodeURIComponent(t)}`,{validateStatus:C});n&&n.slug&&(e=n)}catch(t){await E(t)}return e}};const{APIS:{PEOPLE_API:{BASE_URL:b,ENDPOINTS:{USERS:M,USER_COURSES:G}}},USERS:{MYSELF_SLUG:j}}=a,D=`${b}${M}/${j}${G}`;var B={create:async t=>{try{await S().post(D,t)}catch(t){await E(t)}},list:async t=>{let e=[],n=t?{params:t}:{params:{}};try{const{data:t}=await S().get(D,n);t&&t.length&&(e=t)}catch(t){await E(t)}return e},update:async(t,e)=>{try{await S().put(`${D}/${t}`,e)}catch(t){await E(t)}}};const{APIS:{PEOPLE_API:{BASE_URL:q,ENDPOINTS:{USERS:F,USER_LESSONS:V}}},USERS:{MYSELF_SLUG:H}}=a,J=`${q}${F}/${H}${V}`;var K={registrations:T,users:$,userCourses:B,userLessons:{create:async t=>{let e=null;try{e=await S().post(J,t)}catch(t){await E(t)}return e},list:async t=>{let e=[],n=t?{params:t}:{params:{}};try{const{data:t}=await S().get(J,n);t&&t.length&&(e=t)}catch(t){await E(t)}return e}}};const{APIS:{PEOPLE_ENGAGEMENT_API:{BASE_URL:Y,ENDPOINTS:{USERS:k,USER_PROPERTIES:W}}},USERS:{MYSELF_SLUG:z}}=a;var Q={userProperties:{update:async(t,e)=>{try{await S().put(`${Y}${k}/${z}${W}/${t}`,e)}catch(t){await E(t)}}}},X=c(408);const Z=t=>t&&X.Buffer.from(t,"base64").toString("ascii");function tt({authContext:a=null,contentContext:c=null,errorsContext:u=null,gtmContext:f=null,origin:S}){try{const E=(t=>{let e=null;t?e=t:"undefined"!=typeof window&&(e=window.origin||window.location.origin),e||new Error("Cannot select environment: Website not defined");let n=null;const r=e.match(s);return r?n=r[1].split(d)[0]:e===o?n=l:e.includes(i)&&(n=p),n||new Error(`Cannot select environment: No rule for website ${e}`),n})(S);a&&(0,t.setContext)(Object.assign({},a,{environment:E,origin:S})),c&&(0,e.setContext)(Object.assign({},c,{environment:E})),u&&(0,n.setContext)(Object.assign({},u,{environment:E})),f&&(0,r.setContext)(Object.assign({},f,{environment:E}))}catch(t){console.warn(`Cannot load SDK: ${t.message}`)}}}(),u}()}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1-rc.3",
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,19 +25,19 @@
25
25
  "SDK"
26
26
  ],
27
27
  "dependencies": {
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",
28
+ "@apolitical/auth": "0.1.1-rc.3",
29
+ "@apolitical/content": "0.4.1-rc.1",
30
+ "@apolitical/error-reporting": "0.2.1-rc.1",
31
+ "@apolitical/gtm": "1.1.1-rc.1",
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.1.0",
38
- "@apolitical/content": "0.4.0",
39
- "@apolitical/error-reporting": "0.2.0",
40
- "@apolitical/gtm": "1.1.0",
37
+ "@apolitical/auth": "0.1.1-rc.3",
38
+ "@apolitical/content": "0.4.1-rc.1",
39
+ "@apolitical/error-reporting": "0.2.1-rc.1",
40
+ "@apolitical/gtm": "1.1.1-rc.1",
41
41
  "axios": "0.27.2",
42
42
  "buffer": "6.0.3",
43
43
  "http-status-codes": "2.2.0"