cozy-bar 12.2.3 → 12.2.4
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/components/Bar.spec.jsx +5 -1
- package/dist/components/Drawer.js +1 -5
- package/dist/components/Settings/SettingsContent.js +32 -11
- package/dist/components/Settings/helper.js +17 -2
- package/dist/components/Settings/index.js +0 -3
- package/dist/index.js +1 -1
- package/dist/lib/exceptions.js +2 -23
- package/dist/lib/reducers/apps.js +6 -0
- package/dist/lib/reducers/index.js +1 -3
- package/dist/lib/reducers/settings.js +23 -91
- package/dist/lib/stack-client.js +1 -12
- package/dist/lib/stack.js +0 -5
- package/package.json +1 -1
|
@@ -33,7 +33,11 @@ describe('Bar', () => {
|
|
|
33
33
|
isPublic = false,
|
|
34
34
|
hasFetchedApps = false
|
|
35
35
|
} = {}) => {
|
|
36
|
-
const mockClient = createMockClient({
|
|
36
|
+
const mockClient = createMockClient({
|
|
37
|
+
clientOptions: {
|
|
38
|
+
uri: 'http://cozy.localhost:8080'
|
|
39
|
+
}
|
|
40
|
+
})
|
|
37
41
|
|
|
38
42
|
const result = render(
|
|
39
43
|
<BarLike client={mockClient}>
|
|
@@ -303,7 +303,6 @@ var Drawer = /*#__PURE__*/function (_Component) {
|
|
|
303
303
|
|
|
304
304
|
var _this$props2 = this.props,
|
|
305
305
|
visible = _this$props2.visible,
|
|
306
|
-
settingsAppURL = _this$props2.settingsAppURL,
|
|
307
306
|
storageData = _this$props2.storageData,
|
|
308
307
|
isInvertedTheme = _this$props2.isInvertedTheme;
|
|
309
308
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -329,7 +328,6 @@ var Drawer = /*#__PURE__*/function (_Component) {
|
|
|
329
328
|
}, /*#__PURE__*/_react.default.createElement(_SettingsContent.default, {
|
|
330
329
|
onLogOut: this.handleLogout,
|
|
331
330
|
storageData: storageData,
|
|
332
|
-
settingsAppURL: settingsAppURL,
|
|
333
331
|
isDrawer: true
|
|
334
332
|
}))));
|
|
335
333
|
}
|
|
@@ -344,15 +342,13 @@ Drawer.propTypes = {
|
|
|
344
342
|
onLogOut: _propTypes.default.func,
|
|
345
343
|
isInvertedTheme: _propTypes.default.bool,
|
|
346
344
|
storageData: _propTypes.default.object,
|
|
347
|
-
settingsAppURL: _propTypes.default.string,
|
|
348
345
|
fetchSettingsData: _propTypes.default.func,
|
|
349
346
|
logOut: _propTypes.default.func
|
|
350
347
|
};
|
|
351
348
|
|
|
352
349
|
var mapStateToProps = function mapStateToProps(state) {
|
|
353
350
|
return {
|
|
354
|
-
storageData: (0, _reducers.getStorageData)(state)
|
|
355
|
-
settingsAppURL: (0, _reducers.getSettingsAppURL)(state)
|
|
351
|
+
storageData: (0, _reducers.getStorageData)(state)
|
|
356
352
|
};
|
|
357
353
|
};
|
|
358
354
|
|
|
@@ -15,6 +15,8 @@ var _cozyFlags = _interopRequireDefault(require("cozy-flags"));
|
|
|
15
15
|
|
|
16
16
|
var _cozyDeviceHelper = require("cozy-device-helper");
|
|
17
17
|
|
|
18
|
+
var _cozyClient = require("cozy-client");
|
|
19
|
+
|
|
18
20
|
var _Icon = _interopRequireDefault(require("cozy-ui/transpiled/react/Icon"));
|
|
19
21
|
|
|
20
22
|
var _Openwith = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Openwith"));
|
|
@@ -37,6 +39,8 @@ var _Help = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Help"
|
|
|
37
39
|
|
|
38
40
|
var _Email = _interopRequireDefault(require("cozy-ui/transpiled/react/Icons/Email"));
|
|
39
41
|
|
|
42
|
+
var _helper = require("./helper");
|
|
43
|
+
|
|
40
44
|
var _StorageData = _interopRequireDefault(require("./StorageData"));
|
|
41
45
|
|
|
42
46
|
var _useI18n2 = _interopRequireDefault(require("../useI18n"));
|
|
@@ -74,7 +78,6 @@ var NavItem = function NavItem(_ref3) {
|
|
|
74
78
|
|
|
75
79
|
var SettingsContent = function SettingsContent(_ref4) {
|
|
76
80
|
var onLogOut = _ref4.onLogOut,
|
|
77
|
-
settingsAppURL = _ref4.settingsAppURL,
|
|
78
81
|
storageData = _ref4.storageData,
|
|
79
82
|
_ref4$isDrawer = _ref4.isDrawer,
|
|
80
83
|
isDrawer = _ref4$isDrawer === void 0 ? false : _ref4$isDrawer,
|
|
@@ -84,11 +87,15 @@ var SettingsContent = function SettingsContent(_ref4) {
|
|
|
84
87
|
var _useI18n = (0, _useI18n2.default)(),
|
|
85
88
|
t = _useI18n.t;
|
|
86
89
|
|
|
90
|
+
var client = (0, _cozyClient.useClient)();
|
|
87
91
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
88
92
|
className: "coz-nav-pop-content"
|
|
89
|
-
}, isDrawer && /*#__PURE__*/_react.default.createElement("hr", null),
|
|
93
|
+
}, isDrawer && /*#__PURE__*/_react.default.createElement("hr", null), /*#__PURE__*/_react.default.createElement(NavGroup, null, /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
90
94
|
role: "menuitem",
|
|
91
|
-
href:
|
|
95
|
+
href: (0, _helper.getSettingsLink)({
|
|
96
|
+
client: client,
|
|
97
|
+
hash: 'profile'
|
|
98
|
+
}),
|
|
92
99
|
target: "_self",
|
|
93
100
|
title: t('profile')
|
|
94
101
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
@@ -104,28 +111,40 @@ var SettingsContent = function SettingsContent(_ref4) {
|
|
|
104
111
|
role: "menuitem",
|
|
105
112
|
target: "_self",
|
|
106
113
|
title: t('storage'),
|
|
107
|
-
href:
|
|
114
|
+
href: (0, _helper.getSettingsLink)({
|
|
115
|
+
client: client,
|
|
116
|
+
hash: 'storage'
|
|
117
|
+
})
|
|
108
118
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
109
119
|
icon: _GraphCircle.default
|
|
110
|
-
}), /*#__PURE__*/_react.default.createElement("span", null, t('storage'), /*#__PURE__*/_react.default.createElement(_StorageData.default, {
|
|
120
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, t('storage'), storageData ? /*#__PURE__*/_react.default.createElement(_StorageData.default, {
|
|
111
121
|
data: storageData
|
|
112
|
-
}))))), /*#__PURE__*/_react.default.createElement(NavGroup, null, (0, _cozyFlags.default)('settings.permissions-dashboard') && /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
122
|
+
}) : null)))), /*#__PURE__*/_react.default.createElement(NavGroup, null, (0, _cozyFlags.default)('settings.permissions-dashboard') && /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
113
123
|
role: "menuitem",
|
|
114
|
-
href:
|
|
124
|
+
href: (0, _helper.getSettingsLink)({
|
|
125
|
+
client: client,
|
|
126
|
+
hash: 'permissions/slug'
|
|
127
|
+
}),
|
|
115
128
|
target: "_self",
|
|
116
129
|
title: t('permissions')
|
|
117
130
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
118
131
|
icon: _Hand.default
|
|
119
132
|
}), t('permissions'))), /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
120
133
|
role: "menuitem",
|
|
121
|
-
href:
|
|
134
|
+
href: (0, _helper.getSettingsLink)({
|
|
135
|
+
client: client,
|
|
136
|
+
hash: 'connectedDevices'
|
|
137
|
+
}),
|
|
122
138
|
target: "_self",
|
|
123
139
|
title: t('connectedDevices')
|
|
124
140
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
125
141
|
icon: _Devices.default
|
|
126
142
|
}), t('connectedDevices'))), /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
127
143
|
role: "menuitem",
|
|
128
|
-
href:
|
|
144
|
+
href: (0, _helper.getSettingsLink)({
|
|
145
|
+
client: client,
|
|
146
|
+
hash: 'sessions'
|
|
147
|
+
}),
|
|
129
148
|
target: "_self",
|
|
130
149
|
title: t('connections')
|
|
131
150
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
@@ -140,7 +159,10 @@ var SettingsContent = function SettingsContent(_ref4) {
|
|
|
140
159
|
icon: _Help.default
|
|
141
160
|
}), t('help'), /*#__PURE__*/_react.default.createElement(ExternalLinkIcon, null))), /*#__PURE__*/_react.default.createElement(NavItem, null, /*#__PURE__*/_react.default.createElement("a", {
|
|
142
161
|
role: "menuitem",
|
|
143
|
-
href:
|
|
162
|
+
href: (0, _helper.getSettingsLink)({
|
|
163
|
+
client: client,
|
|
164
|
+
hash: 'support'
|
|
165
|
+
}),
|
|
144
166
|
target: "_self",
|
|
145
167
|
title: t('contact')
|
|
146
168
|
}, /*#__PURE__*/_react.default.createElement(MenuIcon, {
|
|
@@ -161,7 +183,6 @@ SettingsContent.defaultProps = {
|
|
|
161
183
|
SettingsContent.propTypes = {
|
|
162
184
|
shoulDisplayViewOfferButton: _propTypes.default.bool,
|
|
163
185
|
onLogOut: _propTypes.default.func.isRequired,
|
|
164
|
-
settingsAppURL: _propTypes.default.string,
|
|
165
186
|
storageData: _propTypes.default.object,
|
|
166
187
|
isDrawer: _propTypes.default.bool
|
|
167
188
|
};
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isFetchingQueries = void 0;
|
|
6
|
+
exports.getSettingsLink = exports.isFetchingQueries = void 0;
|
|
7
|
+
|
|
8
|
+
var _cozyClient = require("cozy-client");
|
|
7
9
|
|
|
8
10
|
var isFetchingQueries = function isFetchingQueries(requests) {
|
|
9
11
|
return requests.some(function (request) {
|
|
@@ -11,4 +13,17 @@ var isFetchingQueries = function isFetchingQueries(requests) {
|
|
|
11
13
|
});
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
exports.isFetchingQueries = isFetchingQueries;
|
|
16
|
+
exports.isFetchingQueries = isFetchingQueries;
|
|
17
|
+
|
|
18
|
+
var getSettingsLink = function getSettingsLink(_ref) {
|
|
19
|
+
var client = _ref.client,
|
|
20
|
+
hash = _ref.hash;
|
|
21
|
+
return (0, _cozyClient.generateWebLink)({
|
|
22
|
+
cozyUrl: client.getStackClient().uri,
|
|
23
|
+
slug: 'settings',
|
|
24
|
+
hash: hash,
|
|
25
|
+
subDomainType: client.getInstanceOptions().subdomain
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
exports.getSettingsLink = getSettingsLink;
|
|
@@ -59,7 +59,6 @@ var Settings = function Settings(_ref) {
|
|
|
59
59
|
logOut = _ref.logOut,
|
|
60
60
|
_onLogOut = _ref.onLogOut,
|
|
61
61
|
storageData = _ref.storageData,
|
|
62
|
-
settingsAppURL = _ref.settingsAppURL,
|
|
63
62
|
isFetching = _ref.isFetching;
|
|
64
63
|
|
|
65
64
|
var _useState = (0, _react.useState)(false),
|
|
@@ -150,7 +149,6 @@ var Settings = function Settings(_ref) {
|
|
|
150
149
|
}
|
|
151
150
|
},
|
|
152
151
|
storageData: storageData,
|
|
153
|
-
settingsAppURL: settingsAppURL,
|
|
154
152
|
shoulDisplayViewOfferButton: shouldDisplayViewOfferButton,
|
|
155
153
|
managerUrlPremiumLink: managerUrlPremiumLink
|
|
156
154
|
})));
|
|
@@ -161,7 +159,6 @@ exports.Settings = Settings;
|
|
|
161
159
|
var mapStateToProps = function mapStateToProps(state) {
|
|
162
160
|
return {
|
|
163
161
|
storageData: (0, _reducers.getStorageData)(state),
|
|
164
|
-
settingsAppURL: (0, _reducers.getSettingsAppURL)(state),
|
|
165
162
|
isBusy: (0, _reducers.isSettingsBusy)(state),
|
|
166
163
|
isFetching: (0, _reducers.isFetchingSettings)(state)
|
|
167
164
|
};
|
package/dist/index.js
CHANGED
package/dist/lib/exceptions.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.UnauthorizedStackException = exports.
|
|
8
|
+
exports.UnauthorizedStackException = exports.UnavailableStackException = exports.MethodNotAllowedException = exports.NotFoundException = exports.ServerErrorException = exports.ForbiddenException = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -150,25 +150,4 @@ var UnauthorizedStackException = /*#__PURE__*/function (_Error6) {
|
|
|
150
150
|
return UnauthorizedStackException;
|
|
151
151
|
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
152
152
|
|
|
153
|
-
exports.UnauthorizedStackException = UnauthorizedStackException;
|
|
154
|
-
|
|
155
|
-
var UnavailableSettingsException = /*#__PURE__*/function (_Error7) {
|
|
156
|
-
(0, _inherits2.default)(UnavailableSettingsException, _Error7);
|
|
157
|
-
|
|
158
|
-
var _super7 = _createSuper(UnavailableSettingsException);
|
|
159
|
-
|
|
160
|
-
function UnavailableSettingsException(message) {
|
|
161
|
-
var _this7;
|
|
162
|
-
|
|
163
|
-
(0, _classCallCheck2.default)(this, UnavailableSettingsException);
|
|
164
|
-
_this7 = _super7.call(this);
|
|
165
|
-
_this7.name = 'UnavailableSettings';
|
|
166
|
-
_this7.message = message || "The 'Settings' application isn't available or installed in the stack";
|
|
167
|
-
_this7.stack = new Error().stack;
|
|
168
|
-
return _this7;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return UnavailableSettingsException;
|
|
172
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
173
|
-
|
|
174
|
-
exports.UnavailableSettingsException = UnavailableSettingsException;
|
|
153
|
+
exports.UnauthorizedStackException = UnauthorizedStackException;
|
|
@@ -24,6 +24,7 @@ var RECEIVE_APP_LIST = 'RECEIVE_APP_LIST';
|
|
|
24
24
|
var RECEIVE_HOME_APP = 'RECEIVE_HOME_APP';
|
|
25
25
|
var FETCH_APPS = 'FETCH_APPS';
|
|
26
26
|
var FETCH_APPS_FAILURE = 'FETCH_APPS_FAILURE';
|
|
27
|
+
var FETCH_APPS_SUCCESS = 'FETCH_APPS_SUCCESS';
|
|
27
28
|
var SET_INFOS = 'SET_INFOS';
|
|
28
29
|
|
|
29
30
|
var isCurrentApp = function isCurrentApp(state, app) {
|
|
@@ -236,6 +237,11 @@ var reducer = function reducer() {
|
|
|
236
237
|
isFetching: true
|
|
237
238
|
});
|
|
238
239
|
|
|
240
|
+
case FETCH_APPS_SUCCESS:
|
|
241
|
+
return (0, _objectSpread2.default)({}, state, {
|
|
242
|
+
isFetching: false
|
|
243
|
+
});
|
|
244
|
+
|
|
239
245
|
case FETCH_APPS_FAILURE:
|
|
240
246
|
return (0, _objectSpread2.default)({}, state, {
|
|
241
247
|
isFetching: false
|
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.reducers = exports.onRealtimeDelete = exports.onRealtimeCreate = exports.getHelpLink = exports.isFetchingSettings = exports.isSettingsBusy = exports.
|
|
8
|
+
exports.default = exports.reducers = exports.onRealtimeDelete = exports.onRealtimeCreate = exports.getHelpLink = exports.isFetchingSettings = exports.isSettingsBusy = exports.getStorageData = exports.hasFetched = exports.isCurrentApp = exports.isFetchingApps = exports.getHomeApp = exports.getApps = exports.fetchContext = exports.logOut = exports.fetchSettingsData = exports.setInfos = exports.fetchApps = void 0;
|
|
9
9
|
|
|
10
10
|
var _redux = require("redux");
|
|
11
11
|
|
|
@@ -47,8 +47,6 @@ var hasFetched = proxy('apps', apps.hasFetched);
|
|
|
47
47
|
exports.hasFetched = hasFetched;
|
|
48
48
|
var getStorageData = proxy('settings', settings.getStorageData);
|
|
49
49
|
exports.getStorageData = getStorageData;
|
|
50
|
-
var getSettingsAppURL = proxy('settings', settings.getSettingsAppURL);
|
|
51
|
-
exports.getSettingsAppURL = getSettingsAppURL;
|
|
52
50
|
var isSettingsBusy = proxy('settings', settings.isSettingsBusy);
|
|
53
51
|
exports.isSettingsBusy = isSettingsBusy;
|
|
54
52
|
var isFetchingSettings = proxy('settings', settings.isFetchingSettings);
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.logOut = exports.fetchSettingsData = exports.isFetchingSettings = exports.isSettingsBusy = exports.
|
|
8
|
+
exports.default = exports.logOut = exports.fetchSettingsData = exports.isFetchingSettings = exports.isSettingsBusy = exports.getStorageData = exports.LOG_OUT = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
|
|
11
11
|
|
|
@@ -20,7 +20,6 @@ var FETCH_SETTINGS_BUSY = 'FETCH_SETTINGS_BUSY';
|
|
|
20
20
|
var FETCH_SETTINGS_SUCCESS = 'FETCH_SETTINGS_SUCCESS';
|
|
21
21
|
var RECEIVE_NO_CONTEXT = 'RECEIVE_NO_CONTEXT';
|
|
22
22
|
var RECEIVE_STORAGE = 'RECEIVE_STORAGE';
|
|
23
|
-
var RECEIVE_SETTINGS_URL = 'RECEIVE_SETTINGS_URL';
|
|
24
23
|
var LOG_OUT = 'LOG_OUT';
|
|
25
24
|
exports.LOG_OUT = LOG_OUT;
|
|
26
25
|
var BUSY_DELAY = 450; // selectors
|
|
@@ -31,12 +30,6 @@ var getStorageData = function getStorageData(state) {
|
|
|
31
30
|
|
|
32
31
|
exports.getStorageData = getStorageData;
|
|
33
32
|
|
|
34
|
-
var getSettingsAppURL = function getSettingsAppURL(state) {
|
|
35
|
-
return state.settingsAppURL;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.getSettingsAppURL = getSettingsAppURL;
|
|
39
|
-
|
|
40
33
|
var isSettingsBusy = function isSettingsBusy(state) {
|
|
41
34
|
return state.isBusy;
|
|
42
35
|
};
|
|
@@ -90,65 +83,14 @@ var fetchStorageData = function fetchStorageData() {
|
|
|
90
83
|
}();
|
|
91
84
|
};
|
|
92
85
|
|
|
93
|
-
var fetchSettingsAppURL = function fetchSettingsAppURL() {
|
|
94
|
-
return /*#__PURE__*/function () {
|
|
95
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(dispatch, getState) {
|
|
96
|
-
var settingsAppURL;
|
|
97
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
98
|
-
while (1) {
|
|
99
|
-
switch (_context2.prev = _context2.next) {
|
|
100
|
-
case 0:
|
|
101
|
-
if (!getState().cozyBar.settings.settingsAppURL) {
|
|
102
|
-
_context2.next = 2;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return _context2.abrupt("return", dispatch({
|
|
107
|
-
type: RECEIVE_SETTINGS_URL,
|
|
108
|
-
settingsAppURL: getState().cozyBar.settings.settingsAppURL
|
|
109
|
-
}));
|
|
110
|
-
|
|
111
|
-
case 2:
|
|
112
|
-
_context2.prev = 2;
|
|
113
|
-
_context2.next = 5;
|
|
114
|
-
return _stack.default.get.settingsAppURL();
|
|
115
|
-
|
|
116
|
-
case 5:
|
|
117
|
-
settingsAppURL = _context2.sent;
|
|
118
|
-
return _context2.abrupt("return", dispatch({
|
|
119
|
-
type: RECEIVE_SETTINGS_URL,
|
|
120
|
-
settingsAppURL: settingsAppURL
|
|
121
|
-
}));
|
|
122
|
-
|
|
123
|
-
case 9:
|
|
124
|
-
_context2.prev = 9;
|
|
125
|
-
_context2.t0 = _context2["catch"](2);
|
|
126
|
-
// eslint-disable-next-line no-console
|
|
127
|
-
console.warn('Settings app is unavailable, settings links are disabled');
|
|
128
|
-
return _context2.abrupt("return", null);
|
|
129
|
-
|
|
130
|
-
case 13:
|
|
131
|
-
case "end":
|
|
132
|
-
return _context2.stop();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}, _callee2, null, [[2, 9]]);
|
|
136
|
-
}));
|
|
137
|
-
|
|
138
|
-
return function (_x2, _x3) {
|
|
139
|
-
return _ref2.apply(this, arguments);
|
|
140
|
-
};
|
|
141
|
-
}();
|
|
142
|
-
};
|
|
143
|
-
|
|
144
86
|
var fetchSettingsData = function fetchSettingsData() {
|
|
145
87
|
var displayBusy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
146
88
|
return /*#__PURE__*/function () {
|
|
147
|
-
var
|
|
89
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(dispatch) {
|
|
148
90
|
var busySpinner;
|
|
149
|
-
return _regenerator.default.wrap(function
|
|
91
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
150
92
|
while (1) {
|
|
151
|
-
switch (
|
|
93
|
+
switch (_context2.prev = _context2.next) {
|
|
152
94
|
case 0:
|
|
153
95
|
dispatch({
|
|
154
96
|
type: FETCH_SETTINGS
|
|
@@ -160,29 +102,25 @@ var fetchSettingsData = function fetchSettingsData() {
|
|
|
160
102
|
type: FETCH_SETTINGS_BUSY
|
|
161
103
|
});
|
|
162
104
|
}, BUSY_DELAY);
|
|
163
|
-
|
|
105
|
+
_context2.next = 4;
|
|
164
106
|
return dispatch(fetchStorageData());
|
|
165
107
|
|
|
166
108
|
case 4:
|
|
167
|
-
_context3.next = 6;
|
|
168
|
-
return dispatch(fetchSettingsAppURL());
|
|
169
|
-
|
|
170
|
-
case 6:
|
|
171
109
|
clearTimeout(busySpinner);
|
|
172
110
|
dispatch({
|
|
173
111
|
type: FETCH_SETTINGS_SUCCESS
|
|
174
112
|
});
|
|
175
113
|
|
|
176
|
-
case
|
|
114
|
+
case 6:
|
|
177
115
|
case "end":
|
|
178
|
-
return
|
|
116
|
+
return _context2.stop();
|
|
179
117
|
}
|
|
180
118
|
}
|
|
181
|
-
},
|
|
119
|
+
}, _callee2);
|
|
182
120
|
}));
|
|
183
121
|
|
|
184
|
-
return function (
|
|
185
|
-
return
|
|
122
|
+
return function (_x2) {
|
|
123
|
+
return _ref2.apply(this, arguments);
|
|
186
124
|
};
|
|
187
125
|
}();
|
|
188
126
|
};
|
|
@@ -191,38 +129,38 @@ exports.fetchSettingsData = fetchSettingsData;
|
|
|
191
129
|
|
|
192
130
|
var logOut = function logOut() {
|
|
193
131
|
return /*#__PURE__*/function () {
|
|
194
|
-
var
|
|
195
|
-
return _regenerator.default.wrap(function
|
|
132
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(dispatch) {
|
|
133
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
196
134
|
while (1) {
|
|
197
|
-
switch (
|
|
135
|
+
switch (_context3.prev = _context3.next) {
|
|
198
136
|
case 0:
|
|
199
137
|
dispatch({
|
|
200
138
|
type: LOG_OUT
|
|
201
139
|
});
|
|
202
|
-
|
|
203
|
-
|
|
140
|
+
_context3.prev = 1;
|
|
141
|
+
_context3.next = 4;
|
|
204
142
|
return _stack.default.logout();
|
|
205
143
|
|
|
206
144
|
case 4:
|
|
207
|
-
|
|
145
|
+
_context3.next = 9;
|
|
208
146
|
break;
|
|
209
147
|
|
|
210
148
|
case 6:
|
|
211
|
-
|
|
212
|
-
|
|
149
|
+
_context3.prev = 6;
|
|
150
|
+
_context3.t0 = _context3["catch"](1);
|
|
213
151
|
// eslint-disable-next-line no-console
|
|
214
|
-
console.warn('Error while logging out in the cozy-bar',
|
|
152
|
+
console.warn('Error while logging out in the cozy-bar', _context3.t0);
|
|
215
153
|
|
|
216
154
|
case 9:
|
|
217
155
|
case "end":
|
|
218
|
-
return
|
|
156
|
+
return _context3.stop();
|
|
219
157
|
}
|
|
220
158
|
}
|
|
221
|
-
},
|
|
159
|
+
}, _callee3, null, [[1, 6]]);
|
|
222
160
|
}));
|
|
223
161
|
|
|
224
|
-
return function (
|
|
225
|
-
return
|
|
162
|
+
return function (_x3) {
|
|
163
|
+
return _ref3.apply(this, arguments);
|
|
226
164
|
};
|
|
227
165
|
}();
|
|
228
166
|
}; // reducers
|
|
@@ -233,7 +171,6 @@ var defaultState = {
|
|
|
233
171
|
contextNotExist: false,
|
|
234
172
|
isFetching: false,
|
|
235
173
|
isBusy: false,
|
|
236
|
-
settingsAppURL: null,
|
|
237
174
|
storageData: null
|
|
238
175
|
};
|
|
239
176
|
|
|
@@ -268,11 +205,6 @@ var reducer = function reducer() {
|
|
|
268
205
|
storageData: action.storageData
|
|
269
206
|
});
|
|
270
207
|
|
|
271
|
-
case RECEIVE_SETTINGS_URL:
|
|
272
|
-
return (0, _objectSpread2.default)({}, state, {
|
|
273
|
-
settingsAppURL: action.settingsAppURL
|
|
274
|
-
});
|
|
275
|
-
|
|
276
208
|
case LOG_OUT:
|
|
277
209
|
return defaultState;
|
|
278
210
|
|
package/dist/lib/stack-client.js
CHANGED
|
@@ -380,16 +380,6 @@ var cozyFetchJSON = function cozyFetchJSON(cozy, method, path, body) {
|
|
|
380
380
|
return responseData;
|
|
381
381
|
});
|
|
382
382
|
};
|
|
383
|
-
|
|
384
|
-
var getSettingsAppURL = function getSettingsAppURL() {
|
|
385
|
-
return getApp('settings').then(function (settings) {
|
|
386
|
-
if (!settings) {
|
|
387
|
-
throw new _exceptions.UnavailableSettingsException();
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
return settings.links.related;
|
|
391
|
-
});
|
|
392
|
-
};
|
|
393
383
|
/**
|
|
394
384
|
* Initializes the functions to call the cozy stack
|
|
395
385
|
*
|
|
@@ -424,8 +414,7 @@ var _default = {
|
|
|
424
414
|
storageData: getStorageData,
|
|
425
415
|
iconProps: getAppIconProps,
|
|
426
416
|
cozyURL: getCozyURLOrigin,
|
|
427
|
-
intents: getIntents
|
|
428
|
-
settingsAppURL: getSettingsAppURL
|
|
417
|
+
intents: getIntents
|
|
429
418
|
},
|
|
430
419
|
updateAccessToken: updateAccessToken,
|
|
431
420
|
cozyFetchJSON: cozyFetchJSON,
|
package/dist/lib/stack.js
CHANGED
|
@@ -94,11 +94,6 @@ var get = {
|
|
|
94
94
|
var _current$get6;
|
|
95
95
|
|
|
96
96
|
return (_current$get6 = current().get).cozyURL.apply(_current$get6, arguments);
|
|
97
|
-
},
|
|
98
|
-
settingsAppURL: function settingsAppURL() {
|
|
99
|
-
var _current$get7;
|
|
100
|
-
|
|
101
|
-
return (_current$get7 = current().get).settingsAppURL.apply(_current$get7, arguments);
|
|
102
97
|
}
|
|
103
98
|
};
|
|
104
99
|
var stackProxy = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-bar",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.4",
|
|
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/)",
|