@beinformed/ui 1.15.1 → 1.16.0
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/CHANGELOG.md +7 -0
- package/esm/hooks/useAuthentication.js +4 -1
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/models/attributes/AttributeContent.js +4 -4
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/redux/actions/SignIn.js +9 -0
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +5 -0
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +43 -0
- package/esm/utils/helpers/checkResource.js.map +1 -0
- package/esm/utils/index.js +1 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/hooks/useAuthentication.js +3 -0
- package/lib/hooks/useAuthentication.js.flow +7 -5
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js +4 -4
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/redux/actions/SignIn.js +14 -2
- package/lib/redux/actions/SignIn.js.flow +8 -0
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +5 -0
- package/lib/redux/reducers/AuthReducer.js.flow +3 -0
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +52 -13
- package/lib/redux/types.js.flow +5 -0
- package/lib/utils/helpers/__tests__/checkResource.spec.js.flow +56 -0
- package/lib/utils/helpers/checkResource.js +57 -0
- package/{src/utils/helpers/checkResourceExists.js → lib/utils/helpers/checkResource.js.flow} +19 -0
- package/lib/utils/helpers/checkResource.js.map +1 -0
- package/lib/utils/index.js +4 -4
- package/lib/utils/index.js.flow +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +7 -7
- package/src/hooks/useAuthentication.js +7 -5
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/redux/actions/SignIn.js +8 -0
- package/src/redux/reducers/AuthReducer.js +3 -0
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +52 -13
- package/src/redux/types.js +5 -0
- package/src/utils/helpers/__tests__/checkResource.spec.js +56 -0
- package/{lib/utils/helpers/checkResourceExists.js.flow → src/utils/helpers/checkResource.js} +19 -0
- package/src/utils/index.js +1 -1
- package/esm/utils/helpers/checkResourceExists.js +0 -23
- package/esm/utils/helpers/checkResourceExists.js.map +0 -1
- package/lib/utils/helpers/checkResourceExists.js +0 -34
- package/lib/utils/helpers/checkResourceExists.js.map +0 -1
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
2
|
-
import { BASE } from "../../constants/Constants";
|
|
3
|
-
/**
|
|
4
|
-
* Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)
|
|
5
|
-
* When the resource returns a 404, the resource does not exists and the method returns false
|
|
6
|
-
*
|
|
7
|
-
* @param url
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export var resourceExists = function resourceExists(url) {
|
|
12
|
-
var _context;
|
|
13
|
-
|
|
14
|
-
var fullUrl = _concatInstanceProperty(_context = "".concat(BASE, "/")).call(_context, url).replace(/\/\//g, "/");
|
|
15
|
-
|
|
16
|
-
var xhr = new XMLHttpRequest();
|
|
17
|
-
xhr.open("HEAD", fullUrl, false);
|
|
18
|
-
xhr.setRequestHeader("Accept", "application/json");
|
|
19
|
-
xhr.setRequestHeader("Content-Type", "application/json");
|
|
20
|
-
xhr.send();
|
|
21
|
-
return xhr.status !== 404;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=checkResourceExists.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/helpers/checkResourceExists.js"],"names":["BASE","resourceExists","url","fullUrl","replace","xhr","XMLHttpRequest","open","setRequestHeader","send","status"],"mappings":";AACA,SAASA,IAAT,QAAqB,2BAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAA0B;AAAA;;AACtD,MAAMC,OAAO,GAAG,6CAAGH,IAAH,uBAAWE,GAAX,EAAiBE,OAAjB,CAAyB,OAAzB,EAAkC,GAAlC,CAAhB;;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;AACAD,EAAAA,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;AACAE,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;AACAH,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;AACAH,EAAAA,GAAG,CAACI,IAAJ;AAEA,SAAOJ,GAAG,CAACK,MAAJ,KAAe,GAAtB;AACD,CAVM","sourcesContent":["// @flow\nimport { BASE } from \"../../constants/Constants\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string): boolean => {\n const fullUrl = `${BASE}/${url}`.replace(/\\/\\//g, \"/\");\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send();\n\n return xhr.status !== 404;\n};\n"],"file":"checkResourceExists.js"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.resourceExists = void 0;
|
|
9
|
-
|
|
10
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
-
|
|
12
|
-
var _Constants = require("../../constants/Constants");
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)
|
|
16
|
-
* When the resource returns a 404, the resource does not exists and the method returns false
|
|
17
|
-
*
|
|
18
|
-
* @param url
|
|
19
|
-
* @returns {boolean}
|
|
20
|
-
*/
|
|
21
|
-
var resourceExists = function resourceExists(url) {
|
|
22
|
-
var _context;
|
|
23
|
-
|
|
24
|
-
var fullUrl = (0, _concat.default)(_context = "".concat(_Constants.BASE, "/")).call(_context, url).replace(/\/\//g, "/");
|
|
25
|
-
var xhr = new XMLHttpRequest();
|
|
26
|
-
xhr.open("HEAD", fullUrl, false);
|
|
27
|
-
xhr.setRequestHeader("Accept", "application/json");
|
|
28
|
-
xhr.setRequestHeader("Content-Type", "application/json");
|
|
29
|
-
xhr.send();
|
|
30
|
-
return xhr.status !== 404;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
exports.resourceExists = resourceExists;
|
|
34
|
-
//# sourceMappingURL=checkResourceExists.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/helpers/checkResourceExists.js"],"names":["resourceExists","url","fullUrl","BASE","replace","xhr","XMLHttpRequest","open","setRequestHeader","send","status"],"mappings":";;;;;;;;;;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAA0B;AAAA;;AACtD,MAAMC,OAAO,GAAG,0CAAGC,eAAH,uBAAWF,GAAX,EAAiBG,OAAjB,CAAyB,OAAzB,EAAkC,GAAlC,CAAhB;AAEA,MAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;AACAD,EAAAA,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBL,OAAjB,EAA0B,KAA1B;AACAG,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;AACAH,EAAAA,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;AACAH,EAAAA,GAAG,CAACI,IAAJ;AAEA,SAAOJ,GAAG,CAACK,MAAJ,KAAe,GAAtB;AACD,CAVM","sourcesContent":["// @flow\nimport { BASE } from \"../../constants/Constants\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string): boolean => {\n const fullUrl = `${BASE}/${url}`.replace(/\\/\\//g, \"/\");\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send();\n\n return xhr.status !== 404;\n};\n"],"file":"checkResourceExists.js"}
|