cozy-bar 11.0.0-alpha.2 → 11.0.0-alpha.3
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/dom.js +13 -48
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/dist/dom.js
CHANGED
|
@@ -3,57 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.APP_SELECTOR = exports.getUserActionRequired = exports.getAppSlug = exports.getAppNamePrefix = exports.getAppName = exports.getDefaultIcon =
|
|
6
|
+
exports.APP_SELECTOR = exports.getUserActionRequired = exports.getAppSlug = exports.getAppNamePrefix = exports.getAppName = exports.getDefaultIcon = void 0;
|
|
7
7
|
var APP_SELECTOR = '[role=application]'; // return an empty object by default to avoid checking existance
|
|
8
8
|
|
|
9
9
|
exports.APP_SELECTOR = APP_SELECTOR;
|
|
10
10
|
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
if (!
|
|
14
|
-
return
|
|
11
|
+
var getCozyData = function getCozyData() {
|
|
12
|
+
var root = document.querySelector(APP_SELECTOR);
|
|
13
|
+
if (!root || !root.dataset) return {};
|
|
14
|
+
return JSON.parse(root.dataset.cozy);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
var getDefaultStackURL = function getDefaultStackURL(isPublic) {
|
|
18
|
-
var data = getAppNodeDataSet();
|
|
19
|
-
|
|
20
|
-
if (!data.cozyDomain) {
|
|
21
|
-
if (!isPublic) {
|
|
22
|
-
// eslint-disable-next-line no-console
|
|
23
|
-
console.warn("Cozy-bar can't discover the cozy's URL, and will probably fail to initialize the connection with the stack.");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var protocol = window.location.protocol;
|
|
30
|
-
return "".concat(protocol, "//").concat(data.cozyDomain);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
exports.getDefaultStackURL = getDefaultStackURL;
|
|
34
|
-
|
|
35
|
-
var getDefaultToken = function getDefaultToken(isPublic) {
|
|
36
|
-
var data = getAppNodeDataSet();
|
|
37
|
-
|
|
38
|
-
if (!data.cozyToken) {
|
|
39
|
-
if (!isPublic) {
|
|
40
|
-
// eslint-disable-next-line no-console
|
|
41
|
-
console.warn("Cozy-bar can't discover the app's token, and will probably fail to initialize the connection with the stack.");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return data.cozyToken;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
exports.getDefaultToken = getDefaultToken;
|
|
51
|
-
|
|
52
17
|
var getDefaultIcon = function getDefaultIcon() {
|
|
53
|
-
var
|
|
18
|
+
var data = getCozyData();
|
|
54
19
|
|
|
55
|
-
if (
|
|
56
|
-
return
|
|
20
|
+
if (data.app.icon) {
|
|
21
|
+
return data.app.icon;
|
|
57
22
|
} else {
|
|
58
23
|
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
|
59
24
|
}
|
|
@@ -62,22 +27,22 @@ var getDefaultIcon = function getDefaultIcon() {
|
|
|
62
27
|
exports.getDefaultIcon = getDefaultIcon;
|
|
63
28
|
|
|
64
29
|
var getAppName = function getAppName() {
|
|
65
|
-
var data =
|
|
30
|
+
var data = getCozyData();
|
|
66
31
|
return data.app.name || null;
|
|
67
32
|
};
|
|
68
33
|
|
|
69
34
|
exports.getAppName = getAppName;
|
|
70
35
|
|
|
71
36
|
var getAppNamePrefix = function getAppNamePrefix() {
|
|
72
|
-
var data =
|
|
73
|
-
return data.
|
|
37
|
+
var data = getCozyData();
|
|
38
|
+
return data.app.prefix || null;
|
|
74
39
|
};
|
|
75
40
|
|
|
76
41
|
exports.getAppNamePrefix = getAppNamePrefix;
|
|
77
42
|
|
|
78
43
|
var getAppSlug = function getAppSlug() {
|
|
79
|
-
var data =
|
|
80
|
-
return data.
|
|
44
|
+
var data = getCozyData();
|
|
45
|
+
return data.app.slug || null;
|
|
81
46
|
};
|
|
82
47
|
|
|
83
48
|
exports.getAppSlug = getAppSlug;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-bar",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.3",
|
|
4
4
|
"description": "cozy-bar.js library, a small lib provided by cozy-stack to inject the Cozy-bar component into each app",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy Cloud <contact@cozycloud.cc> (https://cozy.io/)",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@cozy/minilog": "^1.0.0",
|
|
37
37
|
"@material-ui/core": "4.12.4",
|
|
38
38
|
"@svgr/cli": "5.4.0",
|
|
39
|
-
"@testing-library/react": "^10.2.1",
|
|
40
39
|
"@testing-library/jest-dom": "^6.2.0",
|
|
40
|
+
"@testing-library/react": "^10.2.1",
|
|
41
41
|
"babel-jest": "24.9.0",
|
|
42
42
|
"babel-loader": "^8.1.0",
|
|
43
43
|
"babel-plugin-css-modules-transform": "^1.6.2",
|
|
@@ -72,7 +72,6 @@
|
|
|
72
72
|
"react": "16.10.1",
|
|
73
73
|
"react-dom": "16.10.1",
|
|
74
74
|
"react-router": "3.2.4",
|
|
75
|
-
"redux-logger": "3.0.6",
|
|
76
75
|
"semantic-release": "15.13.24",
|
|
77
76
|
"style-loader": "0.23.1",
|
|
78
77
|
"stylus": "0.57.0",
|
|
@@ -88,6 +87,7 @@
|
|
|
88
87
|
"prop-types": "15.7.2",
|
|
89
88
|
"react-redux": "5.1.1",
|
|
90
89
|
"redux": "4.1.2",
|
|
90
|
+
"redux-logger": "3.0.6",
|
|
91
91
|
"redux-persist": "5.10.0",
|
|
92
92
|
"redux-thunk": "2.3.0",
|
|
93
93
|
"semver-compare": "^1.0.0"
|