@selfcommunity/react-core 0.6.0-alpha.3 → 0.6.0-alpha.5

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,7 +19,9 @@ 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 ? WebSocket_1.WS_PROTOCOL_SECURE : WebSocket_1.WS_PROTOCOL_INSECURE;
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;
23
25
  const _wsPrefixPath = scContext.settings.notifications.webSocket.prefixPath || WebSocket_1.WS_PREFIX_PATH;
24
26
  const _wsUri = `${_wsProtocol}://${new URL(scContext.settings.portal).hostname}/${_wsPrefixPath}/${WebSocket_1.WS_FACILITY_NOTIFY}?subscribe-user`;
25
27
  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: boolean;
110
+ value: any;
111
111
  };
112
112
  /**
113
113
  * Validate prefixPath (webSocket)
@@ -206,8 +206,12 @@ exports.validateWebSocketDisableToastMessage = validateWebSocketDisableToastMess
206
206
  const validateWebSocketSecure = (value) => {
207
207
  const errors = [];
208
208
  const warnings = [];
209
- if (!(typeof value === 'boolean')) {
210
- errors.push(errors_1.ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
209
+ if ((value === null || value === void 0 ? void 0 : value.toString()) !== undefined) {
210
+ if (!(typeof value === 'boolean')) {
211
+ errors.push(errors_1.ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
212
+ }
213
+ }
214
+ else {
211
215
  return {
212
216
  errors,
213
217
  warnings,
@@ -675,7 +679,6 @@ exports.validateOpenAI = validateOpenAI;
675
679
  * @param v
676
680
  */
677
681
  const validateGeocoding = (v) => {
678
- //console.log(v);
679
682
  const errors = [];
680
683
  const warnings = [];
681
684
  if (v && !(0, utils_1.isObject)(v)) {
@@ -16,7 +16,9 @@ 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 ? WS_PROTOCOL_SECURE : WS_PROTOCOL_INSECURE;
19
+ const _wsProtocol = scContext.settings.notifications.webSocket.secure || !('secure' in scContext.settings.notifications.webSocket)
20
+ ? WS_PROTOCOL_SECURE
21
+ : WS_PROTOCOL_INSECURE;
20
22
  const _wsPrefixPath = scContext.settings.notifications.webSocket.prefixPath || WS_PREFIX_PATH;
21
23
  const _wsUri = `${_wsProtocol}://${new URL(scContext.settings.portal).hostname}/${_wsPrefixPath}/${WS_FACILITY_NOTIFY}?subscribe-user`;
22
24
  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: boolean;
110
+ value: any;
111
111
  };
112
112
  /**
113
113
  * Validate prefixPath (webSocket)
@@ -193,8 +193,12 @@ export const validateWebSocketDisableToastMessage = (value) => {
193
193
  export const validateWebSocketSecure = (value) => {
194
194
  const errors = [];
195
195
  const warnings = [];
196
- if (!(typeof value === 'boolean')) {
197
- errors.push(ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
196
+ if ((value === null || value === void 0 ? void 0 : value.toString()) !== undefined) {
197
+ if (!(typeof value === 'boolean')) {
198
+ errors.push(ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE);
199
+ }
200
+ }
201
+ else {
198
202
  return {
199
203
  errors,
200
204
  warnings,
@@ -640,7 +644,6 @@ export const validateOpenAI = (v) => {
640
644
  * @param v
641
645
  */
642
646
  export const validateGeocoding = (v) => {
643
- //console.log(v);
644
647
  const errors = [];
645
648
  const warnings = [];
646
649
  if (v && !isObject(v)) {