@apolitical/sdk 0.4.0-beta.4 → 0.4.0-beta.5
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 +1 -1
- package/package.json +1 -1
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("
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("auth0-js"),require("buffer")):"function"==typeof define&&define.amd?define(["@apolitical/content","@apolitical/error-reporting","axios","http-status-codes","auth0-js","buffer"],e):"object"==typeof exports?exports.ApoliticalSDK=e(require("@apolitical/content"),require("@apolitical/error-reporting"),require("axios"),require("http-status-codes"),require("auth0-js"),require("buffer")):t.ApoliticalSDK=e(t["@apolitical/content"],t["@apolitical/error-reporting"],t.axios,t["http-status-codes"],t["auth0-js"],t.buffer)}(this,(function(t,e,r,n,o,i){return function(){"use strict";var a={809:function(e){e.exports=t},30:function(t){t.exports=e},852:function(t){t.exports=o},300:function(t){t.exports=r},408:function(t){t.exports=i},25:function(t){t.exports=n}},s={};function c(t){var e=s[t];if(void 0!==e)return e.exports;var r=s[t]={exports:{}};return a[t](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(){c.r(u),c.d(u,{auth:function(){return _},decodeBase64:function(){return x},default:function(){return C},getEntries:function(){return t.getEntries},getEntry:function(){return t.getEntry},management:function(){return R},people:function(){return g},reportError:function(){return e.reportError}});var t=c(809),e=c(30),r={APIS:{MANAGEMENT_API:{BASE_URL:"/api/management-api",ENDPOINTS:{ACCOUNTS:"/accounts"}},PEOPLE_API:{BASE_URL:"/api/people-api",ENDPOINTS:{USERS:"/users"}}},APOLITICAL:{WEBSITES:{BETA:"https://beta.apolitical.co",BETA_2:"https://beta-2.apolitical.co",LIVE:"https://apolitical.co",RC:"https://rc.apolitical.co"}},AUTH0:{DEFAULT_REDIRECT_URI:"user-onboarding/authorisation",PASSWORDLESS_START:{REDIRECT_URI:"signup/verify-email?changedEmail=true&postSignup=false",RESPONSE_TYPE:"token id_token",SCOPE:"openid profile email"}}};const{APOLITICAL:{WEBSITES:{BETA:n,BETA_2:o,LIVE:i,RC:a}}}=r;let s=null;var l=c(300),p=c.n(l),f=c(25);const E=async t=>{try{let r=!1,n="Error at Apolitical SDK: ";if(t.response){switch(t.response.status){case f.StatusCodes.NOT_FOUND:case f.StatusCodes.FORBIDDEN:r=!0}n+=JSON.stringify(t.response)}else t.request?n+=JSON.stringify(t.request):n+=t.message;if(console.warn(n),r)return;await(0,e.reportError)(new Error(n))}catch(t){console.warn(`Cannot handle error: ${t.message}`)}},{APIS:{PEOPLE_API:{BASE_URL:S,ENDPOINTS:{USERS:d}}}}=r;var g={users:{read:async t=>{let e=null;try{({data:e}=await p().get(`${S}${d}/${t}`))}catch(t){await E(t)}return e}}},A=c(852),T=c.n(A);const{AUTH0:{DEFAULT_REDIRECT_URI:h,PASSWORDLESS_START:{REDIRECT_URI:y,RESPONSE_TYPE:b,SCOPE:O}}}=r;var P={sendVerificationEmail:async t=>{const e=s,r=new(T().WebAuth)(Object.assign({},e,{redirectUri:e.redirectUri.replace(h,y),responseType:b,scope:O}));try{return new Promise(((e,n)=>{r.passwordlessStart({connection:"email",send:"code",email:t},(function(t,r){t&&n(t),e(r)}))}))}catch(t){throw new Error("An error occurred while trying to trigger the verify user email.",t)}}};const{APIS:{MANAGEMENT_API:{BASE_URL:I,ENDPOINTS:{ACCOUNTS:w}}}}=r;var R={accounts:{create:async t=>{try{await p().post(`${I}${w}`,t),await P.sendVerificationEmail(t.email)}catch(t){throw await E(t),t}},read:async t=>{let e=null;try{({data:e}=await p().get(`${I}${w}/${t}`))}catch(t){await E(t)}return e}}};const _={authentication:P};var m=c(408);const x=t=>t&&m.Buffer.from(t,"base64").toString("ascii");function C({authContext:r=null,contentContext:c=null,errorsContext:u=null,origin:l}){r&&(({configs:t,origin:e=null})=>{s=((t,e)=>{let r=null,s=null;switch(r="undefined"!=typeof window?window.origin||window.location.origin:e,r){case n:s=t.beta;break;case o:s=t["beta-2"];break;case i:s=t.live;break;case a:s=t.rc;break;default:s=t.local}return s})(t,e)})(Object.assign({},r,{origin:l})),c&&(0,t.setContext)(Object.assign({},c,{origin:l})),u&&(0,e.setContext)(Object.assign({},u,{origin:l}))}}(),u}()}));
|
package/package.json
CHANGED