UNPKG

testsdktsowems

Version:

A tiny linbrary handling abilities

3 lines (2 loc) 3.13 kB
var Sso=function(){'use strict';function a(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a["default"]:a}function b(a,b){return b={exports:{}},a(b,b.exports),b.exports}var c="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,d=b(function(a,b){var d=c&&c.__awaiter||function(a,b,c,d){function e(a){return a instanceof c?a:new c(function(b){b(a)})}return new(c||(c=Promise))(function(c,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d["throw"](a))}catch(a){f(a)}}function i(a){a.done?c(a.value):e(a.value).then(g,h)}i((d=d.apply(a,b||[])).next())})},e=c&&c.__generator||function(a,b){function c(a){return function(b){return d([a,b])}}function d(c){if(e)throw new TypeError("Generator is already executing.");for(;k;)try{if(e=1,h&&(i=2&c[0]?h["return"]:c[0]?h["throw"]||((i=h["return"])&&i.call(h),0):h.next)&&!(i=i.call(h,c[1])).done)return i;switch((h=0,i)&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return k.label++,{value:c[1],done:!1};case 5:k.label++,h=c[1],c=[0];continue;case 7:c=k.ops.pop(),k.trys.pop();continue;default:if((i=k.trys,!(i=0<i.length&&i[i.length-1]))&&(6===c[0]||2===c[0])){k=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){k.label=c[1];break}if(6===c[0]&&k.label<i[1]){k.label=i[1],i=c;break}if(i&&k.label<i[2]){k.label=i[2],k.ops.push(c);break}i[2]&&k.ops.pop(),k.trys.pop();continue;}c=b.call(a,k)}catch(a){c=[6,a],h=0}finally{e=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}var e,h,i,j,k={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return j={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(j[Symbol.iterator]=function(){return this}),j};b.__esModule=!0,b.Sso=void 0,function(a){a.getSignIn=function(a){var b="".concat("https://www.account.finsweet.com/","redirect_url=").concat(a);return b},a.codeAccess=function(a){return fetch("".concat("https://accounts.finsweet.com/api","/auth/authcode"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({code:a})}).then(function(a){return a.json()})["catch"](function(a){return console.log(a)})},a.signin=function(a,b){return d(this,void 0,void 0,function(){var c;return e(this,function(){return c={email:a,password:b},[2,fetch("".concat("https://accounts.finsweet.com/api","/auth/signin"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(c)}).then(function(a){return a.json()})["catch"](function(a){return console.log(a)})]})})},a.newToken=function(a){return fetch("".concat("https://accounts.finsweet.com/api","/auth/refresh-token"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({refreshToken:a})}).then(function(a){return a.json()})["catch"](function(a){return console.log(a)})}}(b.Sso||(b.Sso={}))});a(d),d.Sso;var e=b(function(a,b){b.__esModule=!0,b["default"]=d.Sso,Object.assign(a.exports,d.Sso)}),f=a(e);return f}(); //# sourceMappingURL=testsdktsowems.min.js.map