Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@seniorsistemas/senior-platform-data

Package Overview
Dependencies
Maintainers
2
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@seniorsistemas/senior-platform-data - npm Package Compare versions

Comparing version 5.2.0 to 5.3.0-0e062680-5a27-4c78-af3c-a772db15c37a

31

CHANGELOG.md

@@ -0,1 +1,28 @@

# {version}
[{date}]
### Quebras de compatibilidade
* N/A.
### Novas funcionalidades
* [ARQPTF-6633](https://jira.senior.com.br/browse/ARQPTF-6633) - Criação das funções para salvar (setPreference) e buscar (getPreference) uma preferencia do usuário no indexedDB.
### Melhorias
* N/A.
### Correções
* N/A.
### Alterações na base de dados
* N/A.
### Alteração de dependências
* N/A.
# 5.3.0
[11/12/2023]
### Melhorias
* [ARQENG-317](http://jira.senior.com.br/browse/ARQENG-317) - Adicionado parâmetro no método getToken para não aguardar o token quando não existir no cookie.
# 5.2.0

@@ -23,3 +50,3 @@ [06/07/2023]

### Quebras de compatibilidade
* [SRE-9011](http://jira.senior.com.br/browse/SRE-9011) - Adicionado o parâmetro opcional `useCache` na função `getUserData`. O valor padrão será `true`.
* [SRE-9011](http://jira.senior.com.br/browse/SRE-9011) - Adicionado o parâmetro opcional `useCache` na função `getUserData`. O valor padrão será `true`.

@@ -50,3 +77,3 @@ **NOTA**: O comportamento padrão será de utilizar o cache da resposta do `getUser` que terá o tempo de vida padrão de `1800000 milissegundos (30 minutos)`. Caso exista o item `SENIOR_USER_INFO_TTL` no localStorage, o ttl será pego de lá. Para não utilizar o cache, basta informar o parâmetro useCache com o valor `false`. É importante ressaltar que essas informações poderão estar desatualizadas em caso de alguma atualização do usuário ser feita no sistema, sendo necessário relogar.

* Alterado a chamada da api de `obterMeusDados` para `getUser`, no qual será necessário alterar a chamada das propriedades do objeto retornado pela função `getUserData`:
```

@@ -53,0 +80,0 @@ Retorno:

9

dist/index.d.ts

@@ -6,4 +6,4 @@ // Type definitions for @seniorsistemas/senior-platform-data

export namespace user {
export function getAuthHeader(): Promise<string>;
export function getToken(): Promise<any>;
export function getAuthHeader(skipWaitToken?: boolean): Promise<string>;
export function getToken(skipWaitToken?: boolean): Promise<any>;
export function getUserData(useCache?: boolean): Promise<any>;

@@ -26,1 +26,6 @@ export function getRememberMe(): Promise<any>;

}
export namespace preference {
export function setPreference(preference: any): Promise<any>;
export function getPreference(onpreferenceIDj: any): Promise<any>;
}

@@ -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():u.getToken()})}function a(){return c.hasTabData()?c.getRestUrl():f.getServicesUrl().then(function(e){return e?e+"rest/":u.getRestUrl()})}Object.defineProperty(t,"__esModule",{value:!0}),t.utils=t.service=t.user=void 0;var i=r(2),u=n(i),s=r(3),c=n(s),l=r(4),f=n(l),d=r(6),g=new c.NewTabProvider,m=new u.IFrameProvider,v=new f.CookiesProvider;t.user={getToken:o,getAuthHeader:function(){return(0,d.getAuthHeader)(o)},getUserData:function(e){return(0,d.getUserData)(a,o,e)},getRememberMe:f.getRememberMe},t.service={getRestUrl:a,getXServicesUrl:function(){if(c.hasTabData())return g.getXServicesUrl();var e=v.getXServicesUrl();return e||m.getXServicesUrl()},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(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return s||(console.warn("Senior Platform data not found. Waiting for message event..."),s=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)})})),s}function a(){return o().then(function(e){return e.servicesUrl})}function i(){return o().then(function(e){return e.token})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.getRestUrl=a,t.getToken=i;var s=void 0;t.IFrameProvider=function(){function e(){n(this,e)}return u(e,[{key:"getXServicesUrl",value:function(){return o().then(function(e){return e.xServicesUrl})}}]),e}()},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return window&&window.name&&0===window.name.indexOf(s)}function a(){return Promise.resolve(c.servicesUrl)}function i(){return Promise.resolve(c.token)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.hasTabData=o,t.getRestUrl=a,t.getToken=i;var s=t.PREFIX="SENIOR_CREDENTIALS",c=o()?JSON.parse(window.name.substring(s.length)):{};t.NewTabProvider=function(){function e(){n(this,e)}return u(e,[{key:"getXServicesUrl",value:function(){return Promise.resolve(c.xServicesUrl)}}]),e}()},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return Promise.resolve(v.default.get("com.senior.services.url"))}function a(){return o().then(function(e){return e?e+"rest/":v.default.get("com.senior.pau.services.url")})}function i(){return o().then(function(e){return e?e+"soap/":v.default.get("com.senior.pau.soap.url")})}function u(){return o().then(function(e){return e?e+"odata/":v.default.get("com.senior.pau.odata.url")})}function s(){var e=JSON.parse(v.default.get("com.senior.token")||"{}");return Object.keys(e).length||(e=JSON.parse(JSON.parse(v.default.get("com.senior.pau.token")||'"{}"'))),Promise.resolve(e)}function c(){return Promise.resolve(v.default.get("com.senior.rememberme")||v.default.get("com.senior.pau.rememberme"))}function l(){return Promise.resolve(v.default.get("com.senior.domain")||v.default.get("com.senior.pau.domain"))}function f(){return Promise.resolve(v.default.get("com.senior.selectedSub")||v.default.get("com.senior.pau.selectedSub"))}function d(){return Promise.resolve(v.default.get("com.senior.selectedCompany")||v.default.get("com.senior.pau.selectedCompany"))}Object.defineProperty(t,"__esModule",{value:!0}),t.CookiesProvider=void 0;var g=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.getServicesUrl=o,t.getRestUrl=a,t.getSoapUrl=i,t.getODataUrl=u,t.getToken=s,t.getRememberMe=c,t.getDomain=l,t.getSelectedSub=f,t.getSelectedCompany=d;var m=r(5),v=function(e){return e&&e.__esModule?e:{default:e}}(m);t.CookiesProvider=function(){function e(){n(this,e)}return g(e,[{key:"getXServicesUrl",value:function(){return Promise.resolve(v.default.get("com.senior.x.services.url"))}}]),e}()},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){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=localStorage.getItem(c)||l;return Promise.all([e(),t()]).then(function(e){var t=a(e,2),o=t[0],i=t[1],c=null,l=localStorage.getItem(s);if(r&&l){var f=JSON.parse(l);if(f.data.username+"@"+f.data.tenantDomain===i.username&&f.ttl>Date.now())return new Promise(function(e){return e(f.data)});f.ttl<Date.now()&&(c=f.ETag)}return u.default.post(o+"platform/user/queries/getUser",{includePhoto:!0},{headers:{Authorization:i.token_type+" "+i.access_token,Accept:"application/json;seniorx.version=8","If-None-Match":c}}).then(function(e){var t=Date.now()+Number(n),r={data:e.data,ttl:t,ETag:e.headers.ETag};return 304===e.status&&(r.data=JSON.parse(l).data),localStorage.setItem(s,JSON.stringify(r)),r.data})})}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw a}}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 i=r(7),u=function(e){return e&&e.__esModule?e:{default:e}}(i),s="SENIOR_USER_INFO",c="SENIOR_USER_INFO_TTL",l="1800000"},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(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.getRestUrl():f.getServicesUrl().then(function(e){return e?e+"rest/":i.getRestUrl()})}Object.defineProperty(t,"__esModule",{value:!0}),t.preference=t.utils=t.service=t.user=void 0;var u=r(2),i=n(u),a=r(3),c=n(a),s=r(4),f=n(s),l=r(6),d=n(l),v=r(9),g=new c.NewTabProvider,m=new i.IFrameProvider,p=new f.CookiesProvider,y=new d.IndexedDBProvider,b=function(e){return c.hasTabData()?c.getToken():f.getServicesUrl().then(function(t){return t?f.getToken():e?Promise.reject():i.getToken()})};t.user={getToken:function(e){return b(e)},getAuthHeader:function(e){return(0,v.getAuthHeader)(b(e))},getUserData:function(e){return(0,v.getUserData)(o,b,e)},getRememberMe:f.getRememberMe},t.service={getRestUrl:o,getXServicesUrl:function(){if(c.hasTabData())return g.getXServicesUrl();var e=p.getXServicesUrl();return e||m.getXServicesUrl()},getSoapUrl:f.getSoapUrl,getODataUrl:f.getODataUrl},t.utils={getDomain:f.getDomain,getSelectedSub:f.getSelectedSub,getSelectedCompany:f.getSelectedCompany},t.preference={setPreference:y.setPreference,getPreference:y.getPreference}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return c||(console.warn("Senior Platform data not found. Waiting for message event..."),c=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."))},s),window.addEventListener("message",function(t){t.data&&t.data.token&&t.data.token.username&&t.data.token.token_type&&e(t.data)})})),c}function u(){return o().then(function(e){return e.servicesUrl})}function i(){return o().then(function(e){return e.token})}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.getRestUrl=u,t.getToken=i;var c=void 0,s=5e3;t.IFrameProvider=function(){function e(){n(this,e)}return a(e,[{key:"getXServicesUrl",value:function(){return o().then(function(e){return e.xServicesUrl})}}]),e}()},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return window&&window.name&&0===window.name.indexOf(c)}function u(){return Promise.resolve(s.servicesUrl)}function i(){return Promise.resolve(s.token)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.hasTabData=o,t.getRestUrl=u,t.getToken=i;var c=t.PREFIX="SENIOR_CREDENTIALS",s=o()?JSON.parse(window.name.substring(c.length)):{};t.NewTabProvider=function(){function e(){n(this,e)}return a(e,[{key:"getXServicesUrl",value:function(){return Promise.resolve(s.xServicesUrl)}}]),e}()},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return Promise.resolve(m.default.get("com.senior.services.url"))}function u(){return o().then(function(e){return e?e+"rest/":m.default.get("com.senior.pau.services.url")})}function i(){return o().then(function(e){return e?e+"soap/":m.default.get("com.senior.pau.soap.url")})}function a(){return o().then(function(e){return e?e+"odata/":m.default.get("com.senior.pau.odata.url")})}function c(){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 f(){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 d(){return Promise.resolve(m.default.get("com.senior.selectedCompany")||m.default.get("com.senior.pau.selectedCompany"))}Object.defineProperty(t,"__esModule",{value:!0}),t.CookiesProvider=void 0;var v=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.getServicesUrl=o,t.getRestUrl=u,t.getSoapUrl=i,t.getODataUrl=a,t.getToken=c,t.getRememberMe=s,t.getDomain=f,t.getSelectedSub=l,t.getSelectedCompany=d;var g=r(5),m=function(e){return e&&e.__esModule?e:{default:e}}(g);t.CookiesProvider=function(){function e(){n(this,e)}return v(e,[{key:"getXServicesUrl",value:function(){return Promise.resolve(m.default.get("com.senior.x.services.url"))}}]),e}()},function(e,t){e.exports=require("js-cookie")},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.IndexedDBProvider=void 0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};r(7);var i=r(8),a=void 0,c=function e(t){try{var r={};return console.log(t),Object.keys(t).forEach(function(n){if(t[n]){console.log(n);var o=t[n].valueOf();d(o)?r[n]=e(o):r[n]=s(o,n).toString()}}),r}catch(e){console.error("Error:",e)}},s=function(e,t){return i.AES.encrypt(e,t.toString())},f=function e(t){var r={};return console.log(t),t?(Object.keys(t).forEach(function(n){var o=t[n].valueOf();d(o)?r[n]=e(o):r[n]=l(o,n)}),r):r},l=function(e,t){return i.AES.decrypt(e,t.toString()).toString(i.enc.Utf8)},d=function(e){return"object"===(void 0===e?"undefined":u(e))},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"readonly";return a.transaction(e,t)},g=function(){return new Promise(function(e,t){var r=indexedDB.open("platformDB",1);r.onupgradeneeded=function(){var t=r.result,n={keyPath:"username"};t.objectStoreNames.contains("userPreference")||t.createObjectStore("userPreference",n),e(t)},r.onerror=function(){t(new Error(r.error))},r.onsuccess=function(){e(r.result)}})};t.IndexedDBProvider=function(){function e(){n(this,e),this.createDB()}return o(e,[{key:"createDB",value:function(){g().then(function(e){a=e}).catch(function(e){console.error(e)})}},{key:"setPreference",value:function(e){return new Promise(function(t,r){var n=c(e.value),o={username:e.username,value:n};console.log(o);var u=v("userPreference","readwrite"),i=u.objectStore("userPreference"),a=i.put(o);a.onsuccess=function(){t(a.result)},a.onerror=function(){r(new Error(a.error))}})}},{key:"getPreference",value:function(e){return new Promise(function(t,r){var n=v("userPreference"),o=n.objectStore("userPreference"),u=o.get(e);u.onsuccess=function(){console.log(u);var e=u.result.value||{};console.log(e);var r=f(e);t(r)},u.onerror=function(){r(new Error(u.error))}})}}]),e}()},function(e,t){e.exports=require("regenerator-runtime/runtime")},function(e,t){e.exports=require("crypto-js")},function(e,t,r){"use strict";function n(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=localStorage.getItem(c)||s;return Promise.all([e(),t()]).then(function(e){var t=o(e,2),u=t[0],c=t[1],s=null,f=localStorage.getItem(a);if(r&&f){var l=JSON.parse(f);if(l.data.username+"@"+l.data.tenantDomain===c.username&&l.ttl>Date.now())return new Promise(function(e){return e(l.data)});l.ttl<Date.now()&&(s=l.ETag)}return i.default.post(u+"platform/user/queries/getUser",{includePhoto:!0},{headers:{Authorization:c.token_type+" "+c.access_token,Accept:"application/json;seniorx.version=8","If-None-Match":s}}).then(function(e){var t=Date.now()+Number(n),r={data:e.data,ttl:t,ETag:e.headers.ETag};return 304===e.status&&(r.data=JSON.parse(f).data),localStorage.setItem(a,JSON.stringify(r)),r.data})})}Object.defineProperty(t,"__esModule",{value:!0}),t.getAuthHeader=void 0;var o=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&a.return&&a.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.getUserData=n;var u=r(10),i=function(e){return e&&e.__esModule?e:{default:e}}(u),a="SENIOR_USER_INFO",c="SENIOR_USER_INFO_TTL",s="1800000";t.getAuthHeader=function(e){return e.then(function(e){return e&&Object.keys(e).length?e.token_type+" "+e.access_token:""})}},function(e,t){e.exports=require("axios")}])});
{
"name": "@seniorsistemas/senior-platform-data",
"version": "5.2.0",
"version": "5.3.0-0e062680-5a27-4c78-af3c-a772db15c37a",
"description": "API para retornar valores dos usuários, atualmente retorna via cookies",

@@ -47,4 +47,6 @@ "project": {

"axios": "~0.17.1",
"js-cookie": "~2.2.0"
"crypto-js": "^4.2.0",
"js-cookie": "~2.2.0",
"regenerator-runtime": "^0.14.0"
}
}

@@ -20,2 +20,13 @@ # senior-platform-data

### **Utilização da API IndexedDB para salvar as preferências dos usuários**
Para utilizá-la no local desejado basta fazer o import:
`import { preference } from "@seniorsistemas/senior-platform-data";`
E após isso, chamar as funções, como por exemplo:
`preference.setPreference({ username: 'username', value: {preference1: value, preference2: value...} }).then(r => {console.log(r)}).catch(e => {console.error(e)})`
Todas as funções são assíncronas, tendo em mente que no futuro estas informações podem ser armazenadas em outro lugar ao invés de nos cookies.

@@ -41,2 +52,6 @@

* `preference`
* `setPreference()` - Insere uma preferência do usuário no IndexedDB
* `getPrefence()` - Retorna uma preferência do usuário
### **Integração para passagem credenciais na abertura de nova aba ou iframe**

@@ -48,3 +63,3 @@

### FAQ
Estou recebendo erro no console com a seguinte mensagem:
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?

@@ -56,3 +71,3 @@ Abaixo um exemplo para inicializar o token:

import { Observable, of } from 'rxjs';
@Injectable()

@@ -62,3 +77,3 @@ export class AppService {

constructor() {
//Inicializa o token da propriedade corrente.
//Inicializa o token da propriedade corrente.
user.getToken().then(data => this.token = data.token);

@@ -74,2 +89,2 @@ }

}
```
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc