@seniorsistemas/senior-platform-data
Advanced tools
Comparing version 3.0.0 to 3.1.0-0dfbd7e7-a2f3-4e6c-a4c8-e8fa14191108
@@ -0,3 +1,15 @@ | ||
# {version} | ||
[{date}] | ||
### Quebras de compatibilidade | ||
* [SRE-8967](http://jira.senior.com.br/browse/SRE-8967) - Alteração na função `getUserData` para chamar a versão 8 da API `getUser`. Essa versão passa a trazer a URL da foto do usuário armazenada no blob-service ao invés da foto em base64. | ||
# 3.1.0 | ||
[25/08/2020] | ||
### Melhorias | ||
* [ARQPTF-3193](http://jira.senior.com.br/browse/ARQPTF-3193) - Adicionado mensagem mais informativa ao erro exibido no console ao não possuir token inicializado. | ||
Também adicionado uma sugestão de ajuste no código fonte a ser seguido no README.md. | ||
# 3.0.0 | ||
[03/09/2019] | ||
@@ -4,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("@seniorsistemas/senior-platform-data",[],t):"object"==typeof exports?exports["@seniorsistemas/senior-platform-data"]=t():e["@seniorsistemas/senior-platform-data"]=t()}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function o(){return c.hasTabData()?c.getToken():f.getServicesUrl().then(function(e){return e?f.getToken():i.getToken()})}function u(){return c.hasTabData()?c.getRestUrl():f.getServicesUrl().then(function(e){return e?e+"rest/":i.getRestUrl()})}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.service=t.user=void 0;var a=r(2),i=n(a),s=r(3),c=n(s),l=r(4),f=n(l),d=r(6);t.user={getToken:o,getAuthHeader:function(){return(0,d.getAuthHeader)(o)},getUserData:function(){return(0,d.getUserData)(u,o)},getRememberMe:f.getRememberMe},t.service={getRestUrl:u,getSoapUrl:f.getSoapUrl,getODataUrl:f.getODataUrl},t.utils={getDomain:f.getDomain,getSelectedSub:f.getSelectedSub,getSelectedCompany:f.getSelectedCompany}},function(e,t,r){"use strict";function n(){return a||(console.warn("Senior Platform data not found. Waiting for message event..."),a=new Promise(function(e,t){setTimeout(function(){t(new Error("It was not possible to retrieve the Senior Platform data"))},5e3),window.addEventListener("message",function(t){t.data&&t.data.token&&t.data.token.username&&t.data.token.token_type&&e(t.data)})})),a}function o(){return n().then(function(e){return e.servicesUrl})}function u(){return n().then(function(e){return e.token})}Object.defineProperty(t,"__esModule",{value:!0}),t.getRestUrl=o,t.getToken=u;var a=void 0},function(e,t,r){"use strict";function n(){return window&&window.name&&0===window.name.indexOf(a)}function o(){return Promise.resolve(i.servicesUrl)}function u(){return Promise.resolve(i.token)}Object.defineProperty(t,"__esModule",{value:!0}),t.hasTabData=n,t.getRestUrl=o,t.getToken=u;var a=t.PREFIX="SENIOR_CREDENTIALS",i=n()?JSON.parse(window.name.substring(a.length)):{}},function(e,t,r){"use strict";function n(){return Promise.resolve(m.default.get("com.senior.services.url"))}function o(){return n().then(function(e){return e?e+"rest/":m.default.get("com.senior.pau.services.url")})}function u(){return n().then(function(e){return e?e+"soap/":m.default.get("com.senior.pau.soap.url")})}function a(){return n().then(function(e){return e?e+"odata/":m.default.get("com.senior.pau.odata.url")})}function i(){var e=JSON.parse(m.default.get("com.senior.token")||"{}");return Object.keys(e).length||(e=JSON.parse(JSON.parse(m.default.get("com.senior.pau.token")||'"{}"'))),Promise.resolve(e)}function s(){return Promise.resolve(m.default.get("com.senior.rememberme")||m.default.get("com.senior.pau.rememberme"))}function c(){return Promise.resolve(m.default.get("com.senior.domain")||m.default.get("com.senior.pau.domain"))}function l(){return Promise.resolve(m.default.get("com.senior.selectedSub")||m.default.get("com.senior.pau.selectedSub"))}function f(){return Promise.resolve(m.default.get("com.senior.selectedCompany")||m.default.get("com.senior.pau.selectedCompany"))}Object.defineProperty(t,"__esModule",{value:!0}),t.getServicesUrl=n,t.getRestUrl=o,t.getSoapUrl=u,t.getODataUrl=a,t.getToken=i,t.getRememberMe=s,t.getDomain=c,t.getSelectedSub=l,t.getSelectedCompany=f;var d=r(5),m=function(e){return e&&e.__esModule?e:{default:e}}(d)},function(e,t){e.exports=require("js-cookie")},function(e,t,r){"use strict";function n(e){return e().then(function(e){return e&&Object.keys(e).length?e.token_type+" "+e.access_token:""})}function o(e,t){return Promise.all([e(),t()]).then(function(e){var t=u(e,2),r=t[0],n=t[1];return i.default.post(r+"platform/user/queries/getUser",{},{headers:{Authorization:n.token_type+" "+n.access_token}}).then(function(e){return e.data})})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw u}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getAuthHeader=n,t.getUserData=o;var a=r(7),i=function(e){return e&&e.__esModule?e:{default:e}}(a)},function(e,t){e.exports=require("axios")}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("@seniorsistemas/senior-platform-data",[],t):"object"==typeof exports?exports["@seniorsistemas/senior-platform-data"]=t():e["@seniorsistemas/senior-platform-data"]=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(){return c.hasTabData()?c.getToken():f.getServicesUrl().then(function(e){return e?f.getToken():a.getToken()})}function u(){return c.hasTabData()?c.getRestUrl():f.getServicesUrl().then(function(e){return e?e+"rest/":a.getRestUrl()})}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.service=t.user=void 0;var i=n(2),a=r(i),s=n(3),c=r(s),l=n(4),f=r(l),d=n(6);t.user={getToken:o,getAuthHeader:function(){return(0,d.getAuthHeader)(o)},getUserData:function(){return(0,d.getUserData)(u,o)},getRememberMe:f.getRememberMe},t.service={getRestUrl:u,getSoapUrl:f.getSoapUrl,getODataUrl:f.getODataUrl},t.utils={getDomain:f.getDomain,getSelectedSub:f.getSelectedSub,getSelectedCompany:f.getSelectedCompany}},function(e,t,n){"use strict";function r(){return i||(console.warn("Senior Platform data not found. Waiting for message event..."),i=new Promise(function(e,t){setTimeout(function(){t(new Error("It was not possible to retrieve the Senior Platform data. Try to get a token on initialization."))},5e3),window.addEventListener("message",function(t){t.data&&t.data.token&&t.data.token.username&&t.data.token.token_type&&e(t.data)})})),i}function o(){return r().then(function(e){return e.servicesUrl})}function u(){return r().then(function(e){return e.token})}Object.defineProperty(t,"__esModule",{value:!0}),t.getRestUrl=o,t.getToken=u;var i=void 0},function(e,t,n){"use strict";function r(){return window&&window.name&&0===window.name.indexOf(i)}function o(){return Promise.resolve(a.servicesUrl)}function u(){return Promise.resolve(a.token)}Object.defineProperty(t,"__esModule",{value:!0}),t.hasTabData=r,t.getRestUrl=o,t.getToken=u;var i=t.PREFIX="SENIOR_CREDENTIALS",a=r()?JSON.parse(window.name.substring(i.length)):{}},function(e,t,n){"use strict";function r(){return Promise.resolve(m.default.get("com.senior.services.url"))}function o(){return r().then(function(e){return e?e+"rest/":m.default.get("com.senior.pau.services.url")})}function u(){return r().then(function(e){return e?e+"soap/":m.default.get("com.senior.pau.soap.url")})}function i(){return r().then(function(e){return e?e+"odata/":m.default.get("com.senior.pau.odata.url")})}function a(){var e=JSON.parse(m.default.get("com.senior.token")||"{}");return Object.keys(e).length||(e=JSON.parse(JSON.parse(m.default.get("com.senior.pau.token")||'"{}"'))),Promise.resolve(e)}function s(){return Promise.resolve(m.default.get("com.senior.rememberme")||m.default.get("com.senior.pau.rememberme"))}function c(){return Promise.resolve(m.default.get("com.senior.domain")||m.default.get("com.senior.pau.domain"))}function l(){return Promise.resolve(m.default.get("com.senior.selectedSub")||m.default.get("com.senior.pau.selectedSub"))}function f(){return Promise.resolve(m.default.get("com.senior.selectedCompany")||m.default.get("com.senior.pau.selectedCompany"))}Object.defineProperty(t,"__esModule",{value:!0}),t.getServicesUrl=r,t.getRestUrl=o,t.getSoapUrl=u,t.getODataUrl=i,t.getToken=a,t.getRememberMe=s,t.getDomain=c,t.getSelectedSub=l,t.getSelectedCompany=f;var d=n(5),m=function(e){return e&&e.__esModule?e:{default:e}}(d)},function(e,t){e.exports=require("js-cookie")},function(e,t,n){"use strict";function r(e){return e().then(function(e){return e&&Object.keys(e).length?e.token_type+" "+e.access_token:""})}function o(e,t){return Promise.all([e(),t()]).then(function(e){var t=u(e,2),n=t[0],r=t[1];return a.default.post(n+"platform/user/queries/getUser",{includePhoto:!0},{headers:{Authorization:r.token_type+" "+r.access_token,Accept:"application/json;seniorx.version=8"}}).then(function(e){return e.data})})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){var n=[],r=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,u=e}finally{try{!r&&a.return&&a.return()}finally{if(o)throw u}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getAuthHeader=r,t.getUserData=o;var i=n(7),a=function(e){return e&&e.__esModule?e:{default:e}}(i)},function(e,t){e.exports=require("axios")}])}); |
{ | ||
"name": "@seniorsistemas/senior-platform-data", | ||
"version": "3.0.0", | ||
"version": "3.1.0-0dfbd7e7-a2f3-4e6c-a4c8-e8fa14191108", | ||
"description": "API para retornar valores dos usuários, atualmente retorna via cookies", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -42,1 +42,28 @@ # senior-platform-data | ||
O componente carrega automaticamente o token e servicesUrl à partir dos parâmetros passados na abertura pelo menu. | ||
### FAQ | ||
Estou recebendo erro no console com a seguinte mensagem: | ||
"It was not possible to retrieve the Senior Platform data. Try to get a token on initialization.". O que devo fazer para funcionar? | ||
Abaixo um exemplo para inicializar o token: | ||
``` | ||
import { Injectable } from '@angular/core'; | ||
import { user } from "@seniorsistemas/senior-platform-data"; | ||
import { Observable, of } from 'rxjs'; | ||
@Injectable() | ||
export class AppService { | ||
private token = null; | ||
constructor() { | ||
//Inicializa o token da propriedade corrente. | ||
user.getToken().then(data => this.token = data.token); | ||
} | ||
getUser(): Observable<any> { | ||
if(this.token) { | ||
return of(this.token); | ||
} else { | ||
throw new Error('Error getting token'); | ||
} | ||
} | ||
} | ||
``` |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
14273
68
3