@selfcommunity/react-core 0.6.0-alpha.1 → 0.6.0-alpha.2

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.
@@ -19,9 +19,7 @@ function useSCWebSocket() {
19
19
  const scUserContext = (0, SCUserProvider_1.useSCUser)();
20
20
  const [wsInstance, setWsInstance] = (0, react_1.useState)(null);
21
21
  // Websocket uri, prefixPath, protocols and sub-protocols
22
- const _wsProtocol = scContext.settings.notifications.webSocket.secure || !('secure' in scContext.settings.notifications.webSocket)
23
- ? WebSocket_1.WS_PROTOCOL_SECURE
24
- : WebSocket_1.WS_PROTOCOL_INSECURE;
22
+ const _wsProtocol = scContext.settings.notifications.webSocket.secure ? WebSocket_1.WS_PROTOCOL_SECURE : WebSocket_1.WS_PROTOCOL_INSECURE;
25
23
  const _wsPrefixPath = scContext.settings.notifications.webSocket.prefixPath || WebSocket_1.WS_PREFIX_PATH;
26
24
  const _wsUri = `${_wsProtocol}://${new URL(scContext.settings.portal).hostname}/${_wsPrefixPath}/${WebSocket_1.WS_FACILITY_NOTIFY}?subscribe-user`;
27
25
  const _wsSubProtocol = scContext.settings.session.authToken && scContext.settings.session.authToken.accessToken
@@ -107,7 +107,7 @@ export declare const validateWebSocketDisableToastMessage: (value: any) => {
107
107
  export declare const validateWebSocketSecure: (value: any) => {
108
108
  errors: any[];
109
109
  warnings: any[];
110
- value: any;
110
+ value: boolean;
111
111
  };
112
112
  /**
113
113
  * Validate prefixPath (webSocket)
@@ -206,12 +206,8 @@ exports.validateWebSocketDisableToastMessage = validateWebSocketDisableToastMess
206
206
  const validateWebSocketSecure = (value) => {
207
207
  const errors = [];
208
208
  const warnings = [];
209
- if (value) {
210
- if (!(typeof value === 'boolean')) {
211
- errors.push(errors_1.ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
212
- }
213
- }
214
- else {
209
+ if (!(typeof value === 'boolean')) {
210
+ errors.push(errors_1.ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
215
211
  return {
216
212
  errors,
217
213
  warnings,
@@ -16,9 +16,7 @@ export default function useSCWebSocket() {
16
16
  const scUserContext = useSCUser();
17
17
  const [wsInstance, setWsInstance] = useState(null);
18
18
  // Websocket uri, prefixPath, protocols and sub-protocols
19
- const _wsProtocol = scContext.settings.notifications.webSocket.secure || !('secure' in scContext.settings.notifications.webSocket)
20
- ? WS_PROTOCOL_SECURE
21
- : WS_PROTOCOL_INSECURE;
19
+ const _wsProtocol = scContext.settings.notifications.webSocket.secure ? WS_PROTOCOL_SECURE : WS_PROTOCOL_INSECURE;
22
20
  const _wsPrefixPath = scContext.settings.notifications.webSocket.prefixPath || WS_PREFIX_PATH;
23
21
  const _wsUri = `${_wsProtocol}://${new URL(scContext.settings.portal).hostname}/${_wsPrefixPath}/${WS_FACILITY_NOTIFY}?subscribe-user`;
24
22
  const _wsSubProtocol = scContext.settings.session.authToken && scContext.settings.session.authToken.accessToken
@@ -107,7 +107,7 @@ export declare const validateWebSocketDisableToastMessage: (value: any) => {
107
107
  export declare const validateWebSocketSecure: (value: any) => {
108
108
  errors: any[];
109
109
  warnings: any[];
110
- value: any;
110
+ value: boolean;
111
111
  };
112
112
  /**
113
113
  * Validate prefixPath (webSocket)
@@ -193,12 +193,8 @@ export const validateWebSocketDisableToastMessage = (value) => {
193
193
  export const validateWebSocketSecure = (value) => {
194
194
  const errors = [];
195
195
  const warnings = [];
196
- if (value) {
197
- if (!(typeof value === 'boolean')) {
198
- errors.push(ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
199
- }
200
- }
201
- else {
196
+ if (!(typeof value === 'boolean')) {
197
+ errors.push(ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
202
198
  return {
203
199
  errors,
204
200
  warnings,