mitra-interactions-sdk 1.0.60-beta.5 → 1.0.60-beta.6
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/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -450,6 +450,8 @@ async function emailLoginMitra2(options) {
|
|
|
450
450
|
const response = {
|
|
451
451
|
token: data.token,
|
|
452
452
|
baseURL: data.baseURL || authUrl,
|
|
453
|
+
// Guarda o refreshToken do login — é ele que vai no body do refresh depois.
|
|
454
|
+
...data.refreshToken ? { refreshToken: data.refreshToken } : {},
|
|
453
455
|
...data.integrationURL ? { integrationURL: data.integrationURL } : {}
|
|
454
456
|
};
|
|
455
457
|
autoConfigureFromLogin2(response, authUrl, projectId);
|
|
@@ -475,10 +477,16 @@ async function refreshTokenSilently2(authUrl, _projectId) {
|
|
|
475
477
|
if (_refreshPromise2) return _refreshPromise2;
|
|
476
478
|
_refreshPromise2 = (async () => {
|
|
477
479
|
try {
|
|
478
|
-
const
|
|
480
|
+
const config = isConfigured() ? getConfig() : null;
|
|
481
|
+
const refreshToken = config == null ? void 0 : config.refreshToken;
|
|
482
|
+
if (!refreshToken) {
|
|
483
|
+
throw new Error("refreshToken n\xE3o dispon\xEDvel para renova\xE7\xE3o. Fa\xE7a login novamente.");
|
|
484
|
+
}
|
|
485
|
+
const data = await postBffAuth(buildBffAuthEndpoint(authUrl, "/refresh-token"), { refreshToken });
|
|
479
486
|
return {
|
|
480
487
|
token: data.token,
|
|
481
488
|
baseURL: data.baseURL || authUrl,
|
|
489
|
+
...data.refreshToken ? { refreshToken: data.refreshToken } : {},
|
|
482
490
|
...data.integrationURL ? { integrationURL: data.integrationURL } : {}
|
|
483
491
|
};
|
|
484
492
|
} finally {
|