@selfcommunity/react-core 0.4.55 → 0.5.0-alpha.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.
Files changed (76) hide show
  1. package/lib/cjs/components/provider/SCAlertMessagesProvider/index.js +3 -4
  2. package/lib/cjs/components/provider/SCContextProvider/index.js +6 -5
  3. package/lib/cjs/components/provider/SCLocaleProvider/index.js +4 -6
  4. package/lib/cjs/components/provider/SCNotificationProvider/index.js +3 -2
  5. package/lib/cjs/components/provider/SCPreferencesProvider/index.js +18 -3
  6. package/lib/cjs/components/provider/SCRoutingProvider/index.js +3 -2
  7. package/lib/cjs/components/provider/SCThemeProvider/index.js +4 -5
  8. package/lib/cjs/components/provider/SCUserProvider/index.js +9 -2
  9. package/lib/cjs/components/provider/SCVoteProvider/index.js +3 -3
  10. package/lib/cjs/components/router/index.js +3 -2
  11. package/lib/cjs/constants/Cache.d.ts +11 -0
  12. package/lib/cjs/constants/Cache.js +15 -2
  13. package/lib/cjs/constants/Integrations.d.ts +5 -0
  14. package/lib/cjs/constants/Integrations.js +6 -1
  15. package/lib/cjs/constants/Preferences.d.ts +3 -0
  16. package/lib/cjs/constants/Preferences.js +8 -2
  17. package/lib/cjs/constants/Routes.d.ts +5 -0
  18. package/lib/cjs/constants/Routes.js +11 -1
  19. package/lib/cjs/hooks/useSCFetchEvent.d.ts +22 -0
  20. package/lib/cjs/hooks/useSCFetchEvent.js +87 -0
  21. package/lib/cjs/hooks/useSCFetchEvents.d.ts +22 -0
  22. package/lib/cjs/hooks/useSCFetchEvents.js +83 -0
  23. package/lib/cjs/hooks/useSCSubscribedEventsManager.d.ts +38 -0
  24. package/lib/cjs/hooks/useSCSubscribedEventsManager.js +297 -0
  25. package/lib/cjs/hooks/useSCWebPushMessaging.js +3 -4
  26. package/lib/cjs/index.d.ts +8 -3
  27. package/lib/cjs/index.js +13 -3
  28. package/lib/cjs/types/context.d.ts +71 -2
  29. package/lib/cjs/types/index.d.ts +2 -2
  30. package/lib/cjs/utils/errors.d.ts +2 -0
  31. package/lib/cjs/utils/errors.js +4 -0
  32. package/lib/cjs/utils/event.d.ts +8 -0
  33. package/lib/cjs/utils/event.js +29 -0
  34. package/lib/cjs/utils/user.d.ts +7 -0
  35. package/lib/cjs/utils/user.js +11 -1
  36. package/lib/cjs/utils/validator.d.ts +30 -1
  37. package/lib/cjs/utils/validator.js +52 -1
  38. package/lib/esm/components/provider/SCAlertMessagesProvider/index.js +3 -3
  39. package/lib/esm/components/provider/SCContextProvider/index.js +6 -5
  40. package/lib/esm/components/provider/SCLocaleProvider/index.js +4 -5
  41. package/lib/esm/components/provider/SCNotificationProvider/index.js +3 -2
  42. package/lib/esm/components/provider/SCPreferencesProvider/index.js +18 -2
  43. package/lib/esm/components/provider/SCRoutingProvider/index.js +3 -2
  44. package/lib/esm/components/provider/SCThemeProvider/index.js +4 -5
  45. package/lib/esm/components/provider/SCUserProvider/index.js +9 -2
  46. package/lib/esm/components/provider/SCVoteProvider/index.js +3 -2
  47. package/lib/esm/components/router/index.js +3 -2
  48. package/lib/esm/constants/Cache.d.ts +11 -0
  49. package/lib/esm/constants/Cache.js +11 -0
  50. package/lib/esm/constants/Integrations.d.ts +5 -0
  51. package/lib/esm/constants/Integrations.js +5 -0
  52. package/lib/esm/constants/Preferences.d.ts +3 -0
  53. package/lib/esm/constants/Preferences.js +6 -0
  54. package/lib/esm/constants/Routes.d.ts +5 -0
  55. package/lib/esm/constants/Routes.js +10 -0
  56. package/lib/esm/hooks/useSCFetchEvent.d.ts +22 -0
  57. package/lib/esm/hooks/useSCFetchEvent.js +84 -0
  58. package/lib/esm/hooks/useSCFetchEvents.d.ts +22 -0
  59. package/lib/esm/hooks/useSCFetchEvents.js +81 -0
  60. package/lib/esm/hooks/useSCSubscribedEventsManager.d.ts +38 -0
  61. package/lib/esm/hooks/useSCSubscribedEventsManager.js +293 -0
  62. package/lib/esm/hooks/useSCWebPushMessaging.js +3 -4
  63. package/lib/esm/index.d.ts +8 -3
  64. package/lib/esm/index.js +7 -2
  65. package/lib/esm/types/context.d.ts +71 -2
  66. package/lib/esm/types/index.d.ts +2 -2
  67. package/lib/esm/utils/errors.d.ts +2 -0
  68. package/lib/esm/utils/errors.js +4 -0
  69. package/lib/esm/utils/event.d.ts +8 -0
  70. package/lib/esm/utils/event.js +25 -0
  71. package/lib/esm/utils/user.d.ts +7 -0
  72. package/lib/esm/utils/user.js +9 -0
  73. package/lib/esm/utils/validator.d.ts +30 -1
  74. package/lib/esm/utils/validator.js +49 -0
  75. package/lib/umd/react-core.js +1 -1
  76. package/package.json +6 -6
@@ -1,3 +1,3 @@
1
- import { SCUserContextType, SCFollowedManagerType, SCFollowersManagerType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCSubscribedIncubatorsManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCPreferencesContextType, SCNotificationContextType, SCLocaleType, SCVoteType, SCVoteContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCSubscribedGroupsManagerType } from './context';
1
+ import { SCUserContextType, SCFollowedManagerType, SCFollowersManagerType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCSubscribedIncubatorsManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCPreferencesContextType, SCNotificationContextType, SCLocaleType, SCVoteType, SCVoteContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType } from './context';
2
2
  import { SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType } from './theme';
3
- export { SCUserContextType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCVoteType, SCVoteContextType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, };
3
+ export { SCUserContextType, SCFollowedCategoriesManagerType, SCSettingsManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCBlockedUsersManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCVoteType, SCVoteContextType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeUserVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCSubscribedEventsManagerType, };
@@ -36,6 +36,8 @@ export declare class ValidationError {
36
36
  static ERROR_INVALID_INTEGRATIONS: number;
37
37
  static ERROR_INVALID_INTEGRATIONS_OPENAI: number;
38
38
  static ERROR_INVALID_INTEGRATIONS_OPENAI_SECRETKEY: number;
39
+ static ERROR_INVALID_INTEGRATIONS_GEOCODING: number;
40
+ static ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY: number;
39
41
  static defaultErrorMessageMap: {
40
42
  [x: number]: string;
41
43
  };
@@ -53,6 +53,8 @@ ValidationError.ERROR_INVALID_VOTE_REACTIONS_STRUCTURE = 6002;
53
53
  ValidationError.ERROR_INVALID_INTEGRATIONS = 6100;
54
54
  ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI = 6101;
55
55
  ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI_SECRETKEY = 6102;
56
+ ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING = 6103;
57
+ ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY = 6104;
56
58
  ValidationError.defaultErrorMessageMap = {
57
59
  [ValidationError.ERROR_INVALID_CONF]: 'Invalid or missing library configuration. Check the configuration that is passed to the SCContextProvider.',
58
60
  [ValidationError.ERROR_INVALID_SESSION]: 'Invalid session format.',
@@ -87,6 +89,8 @@ ValidationError.defaultErrorMessageMap = {
87
89
  [ValidationError.ERROR_INVALID_INTEGRATIONS]: 'Invalid integrations conf.',
88
90
  [ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI]: 'Invalid integrations (openai) option.',
89
91
  [ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI_SECRETKEY]: 'Invalid integrations openai conf: secretKey must be a string value.',
92
+ [ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING]: 'Invalid integrations (geocoding) option.',
93
+ [ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY]: 'Invalid integrations geocoding conf: apiKey must be a string value.',
90
94
  };
91
95
  /**
92
96
  * Manage Validation Warnings
@@ -0,0 +1,8 @@
1
+ import { SCEventSubscriptionStatusType, SCEventType } from '@selfcommunity/types';
2
+ /**
3
+ * Get event status
4
+ * @returns status or null
5
+ * @param event
6
+ * @param going
7
+ */
8
+ export declare function getEventStatus(event: SCEventType, going: boolean): SCEventSubscriptionStatusType | null;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEventStatus = void 0;
4
+ const types_1 = require("@selfcommunity/types");
5
+ /**
6
+ * Get event status
7
+ * @returns status or null
8
+ * @param event
9
+ * @param going
10
+ */
11
+ function getEventStatus(event, going) {
12
+ const { subscription_status: status, privacy } = event;
13
+ if (!status) {
14
+ return privacy === types_1.SCEventPrivacyType.PRIVATE ? types_1.SCEventSubscriptionStatusType.REQUESTED : types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
15
+ }
16
+ switch (status) {
17
+ case types_1.SCEventSubscriptionStatusType.INVITED:
18
+ case types_1.SCEventSubscriptionStatusType.GOING:
19
+ case types_1.SCEventSubscriptionStatusType.NOT_GOING:
20
+ return types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
21
+ case types_1.SCEventSubscriptionStatusType.SUBSCRIBED:
22
+ return going ? types_1.SCEventSubscriptionStatusType.GOING : types_1.SCEventSubscriptionStatusType.NOT_GOING;
23
+ case types_1.SCEventSubscriptionStatusType.REQUESTED:
24
+ return privacy === types_1.SCEventPrivacyType.PRIVATE ? null : types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
25
+ default:
26
+ return null;
27
+ }
28
+ }
29
+ exports.getEventStatus = getEventStatus;
@@ -6,6 +6,7 @@ import { SCUserType } from '@selfcommunity/types';
6
6
  export declare const ADMIN_ROLE = "admin";
7
7
  export declare const MODERATOR_ROLE = "moderator";
8
8
  export declare const EDITOR_ROLE = "editor";
9
+ export declare const COMMUNITY_CREATOR = 1;
9
10
  /**
10
11
  * Get user role from roles(set)
11
12
  * @param user
@@ -18,6 +19,12 @@ export declare function getUserRole(user: SCUserType): string | null;
18
19
  * @returns boolean
19
20
  */
20
21
  export declare function isAdmin(user: SCUserType): boolean;
22
+ /**
23
+ * Check if user is admin
24
+ * @param user
25
+ * @returns boolean
26
+ */
27
+ export declare function isCommunityCreator(user: SCUserType): boolean;
21
28
  /**
22
29
  * Check if user is moderator
23
30
  * @param user
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBlocked = exports.isStaff = exports.isEditor = exports.isModerator = exports.isAdmin = exports.getUserRole = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
3
+ exports.isBlocked = exports.isStaff = exports.isEditor = exports.isModerator = exports.isCommunityCreator = exports.isAdmin = exports.getUserRole = exports.COMMUNITY_CREATOR = exports.EDITOR_ROLE = exports.MODERATOR_ROLE = exports.ADMIN_ROLE = void 0;
4
4
  const types_1 = require("@selfcommunity/types");
5
5
  /**
6
6
  * Staff Roles
@@ -9,6 +9,7 @@ const types_1 = require("@selfcommunity/types");
9
9
  exports.ADMIN_ROLE = 'admin';
10
10
  exports.MODERATOR_ROLE = 'moderator';
11
11
  exports.EDITOR_ROLE = 'editor';
12
+ exports.COMMUNITY_CREATOR = 1;
12
13
  /**
13
14
  * Get user role from roles(set)
14
15
  * @param user
@@ -39,6 +40,15 @@ function isAdmin(user) {
39
40
  return getUserRole(user) === exports.ADMIN_ROLE;
40
41
  }
41
42
  exports.isAdmin = isAdmin;
43
+ /**
44
+ * Check if user is admin
45
+ * @param user
46
+ * @returns boolean
47
+ */
48
+ function isCommunityCreator(user) {
49
+ return user && user.id === exports.COMMUNITY_CREATOR;
50
+ }
51
+ exports.isCommunityCreator = isCommunityCreator;
42
52
  /**
43
53
  * Check if user is moderator
44
54
  * @param user
@@ -1,4 +1,4 @@
1
- import { SCIntegrationsOpenAIType, SCIntegrationsType, SCNotificationsMobileNativePushMessagingType, SCNotificationsType, SCNotificationsWebPushMessagingType, SCNotificationsWebSocketType, SCSettingsType } from '../types/context';
1
+ import { SCGeocodingType, SCIntegrationsOpenAIType, SCIntegrationsType, SCNotificationsMobileNativePushMessagingType, SCNotificationsType, SCNotificationsWebPushMessagingType, SCNotificationsWebSocketType, SCSettingsType } from '../types/context';
2
2
  import { ValidationResult } from './errors';
3
3
  import { SCLocaleType } from '../types';
4
4
  /**
@@ -320,6 +320,9 @@ export declare function validateIntegrations(v: SCIntegrationsType): {
320
320
  openai: {
321
321
  secretKey: any;
322
322
  };
323
+ geocoding: {
324
+ apiKey: any;
325
+ };
323
326
  };
324
327
  };
325
328
  /**
@@ -337,6 +340,21 @@ export declare const validateOpenAI: (v: any) => {
337
340
  value: SCIntegrationsOpenAIType;
338
341
  v?: undefined;
339
342
  };
343
+ /**
344
+ * Validate Geocoding Option
345
+ * @param v
346
+ */
347
+ export declare const validateGeocoding: (v: any) => {
348
+ errors: any[];
349
+ warnings: any[];
350
+ v: any;
351
+ value?: undefined;
352
+ } | {
353
+ errors: any[];
354
+ warnings: any[];
355
+ value: SCGeocodingType;
356
+ v?: undefined;
357
+ };
340
358
  /**
341
359
  * Validate OpenAI secret key option
342
360
  * @param value
@@ -347,6 +365,16 @@ export declare const validateOpenAISecretKey: (value: any) => {
347
365
  warnings: any[];
348
366
  value: any;
349
367
  };
368
+ /**
369
+ * Validate Geocoding api key option
370
+ * @param value
371
+ * @return {}
372
+ */
373
+ export declare const validateGeocodingApiKey: (value: any) => {
374
+ errors: any[];
375
+ warnings: any[];
376
+ value: any;
377
+ };
350
378
  /**
351
379
  * Valid options
352
380
  * @type {{}}
@@ -362,6 +390,7 @@ export declare const preferencesOptions: Record<string, any>;
362
390
  export declare const voteOptions: Record<string, any>;
363
391
  export declare const integrationsOptions: Record<string, any>;
364
392
  export declare const integrationsOpenAIOptions: Record<string, any>;
393
+ export declare const integrationsGeocodingOptions: Record<string, any>;
365
394
  export declare const validOptions: {
366
395
  [x: string]: any;
367
396
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateOptions = exports.validOptions = exports.integrationsOpenAIOptions = exports.integrationsOptions = exports.voteOptions = exports.preferencesOptions = exports.notificationsMobileNativePushMessagingOptions = exports.notificationsWebPushMessagingOptions = exports.notificationsWebSocketOptions = exports.notificationsOptions = exports.localeOptions = exports.sessionOptions = exports.settingsOptions = exports.validateOpenAISecretKey = exports.validateOpenAI = exports.validateIntegrations = exports.validateVote = exports.validateReactions = exports.validatePreferences = exports.validateFeatures = exports.validateGlobalPreferences = exports.validateContextProviders = exports.validateHandleAnonymousAction = exports.validateTheme = exports.validateRouter = exports.validateLocale = exports.validateLocaleMessages = exports.validateLocaleDefault = exports.validatePortal = exports.validateMobileNativePushMessagingDisable = exports.validateMobileNativePushMessaging = exports.validateWebPushMessagingApplicationServerKey = exports.validateWebPushMessagingDisableToastMessage = exports.validateWebPushMessaging = exports.validateWebSocketPrefixPath = exports.validateWebSocketSecure = exports.validateWebSocketDisableToastMessage = exports.validateWebSocket = exports.validateNotifications = exports.validateHandleLogout = exports.validateHandleRefreshToken = exports.validateSessionAuthTokenOption = exports.validateSessionClientId = exports.validateSessionType = exports.validateSession = void 0;
3
+ exports.validateOptions = exports.validOptions = exports.integrationsGeocodingOptions = exports.integrationsOpenAIOptions = exports.integrationsOptions = exports.voteOptions = exports.preferencesOptions = exports.notificationsMobileNativePushMessagingOptions = exports.notificationsWebPushMessagingOptions = exports.notificationsWebSocketOptions = exports.notificationsOptions = exports.localeOptions = exports.sessionOptions = exports.settingsOptions = exports.validateGeocodingApiKey = exports.validateOpenAISecretKey = exports.validateGeocoding = exports.validateOpenAI = exports.validateIntegrations = exports.validateVote = exports.validateReactions = exports.validatePreferences = exports.validateFeatures = exports.validateGlobalPreferences = exports.validateContextProviders = exports.validateHandleAnonymousAction = exports.validateTheme = exports.validateRouter = exports.validateLocale = exports.validateLocaleMessages = exports.validateLocaleDefault = exports.validatePortal = exports.validateMobileNativePushMessagingDisable = exports.validateMobileNativePushMessaging = exports.validateWebPushMessagingApplicationServerKey = exports.validateWebPushMessagingDisableToastMessage = exports.validateWebPushMessaging = exports.validateWebSocketPrefixPath = exports.validateWebSocketSecure = exports.validateWebSocketDisableToastMessage = exports.validateWebSocket = exports.validateNotifications = exports.validateHandleLogout = exports.validateHandleRefreshToken = exports.validateSessionAuthTokenOption = exports.validateSessionClientId = exports.validateSessionType = exports.validateSession = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const Locale = tslib_1.__importStar(require("../constants/Locale"));
6
6
  const utils_1 = require("@selfcommunity/utils");
@@ -674,6 +674,31 @@ const validateOpenAI = (v) => {
674
674
  return { errors, warnings, value };
675
675
  };
676
676
  exports.validateOpenAI = validateOpenAI;
677
+ /**
678
+ * Validate Geocoding Option
679
+ * @param v
680
+ */
681
+ const validateGeocoding = (v) => {
682
+ //console.log(v);
683
+ const errors = [];
684
+ const warnings = [];
685
+ if (v && !(0, utils_1.isObject)(v)) {
686
+ errors.push(errors_1.ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING);
687
+ return { errors, warnings, v };
688
+ }
689
+ const _options = Object.keys(exports.integrationsGeocodingOptions);
690
+ const value = Object.keys(v)
691
+ .filter((key) => _options.includes(key))
692
+ .reduce((obj, key) => {
693
+ const res = exports.integrationsGeocodingOptions[key].validator(v[key], v);
694
+ res.errors.map((error) => errors.push(error));
695
+ res.warnings.map((warning) => warnings.push(warning));
696
+ obj[key] = res.value;
697
+ return obj;
698
+ }, {});
699
+ return { errors, warnings, value };
700
+ };
701
+ exports.validateGeocoding = validateGeocoding;
677
702
  /**
678
703
  * Validate OpenAI secret key option
679
704
  * @param value
@@ -688,6 +713,20 @@ const validateOpenAISecretKey = (value) => {
688
713
  return { errors, warnings, value };
689
714
  };
690
715
  exports.validateOpenAISecretKey = validateOpenAISecretKey;
716
+ /**
717
+ * Validate Geocoding api key option
718
+ * @param value
719
+ * @return {}
720
+ */
721
+ const validateGeocodingApiKey = (value) => {
722
+ const errors = [];
723
+ const warnings = [];
724
+ if (!value || !(0, utils_1.isString)(value)) {
725
+ errors.push(errors_1.ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY);
726
+ }
727
+ return { errors, warnings, value };
728
+ };
729
+ exports.validateGeocodingApiKey = validateGeocodingApiKey;
691
730
  /**
692
731
  * Components Widget
693
732
  */
@@ -822,6 +861,14 @@ const IntegrationOpenAISecretKeyOption = {
822
861
  name: Integrations.INTEGRATIONS_OPENAI_SECRETKEY_OPTION,
823
862
  validator: exports.validateOpenAISecretKey,
824
863
  };
864
+ const IntegrationGeocodingOption = {
865
+ name: Integrations.INTEGRATIONS_GEOCODING_OPTION,
866
+ validator: exports.validateGeocoding,
867
+ };
868
+ const IntegrationGeocodingApiKeyOption = {
869
+ name: Integrations.INTEGRATIONS_GEOCODING_APIKEY_OPTION,
870
+ validator: exports.validateGeocodingApiKey,
871
+ };
825
872
  /**
826
873
  * Valid options
827
874
  * @type {{}}
@@ -876,10 +923,14 @@ exports.voteOptions = {
876
923
  };
877
924
  exports.integrationsOptions = {
878
925
  [IntegrationOpenAIOption.name]: IntegrationOpenAIOption,
926
+ [IntegrationGeocodingOption.name]: IntegrationGeocodingOption,
879
927
  };
880
928
  exports.integrationsOpenAIOptions = {
881
929
  [IntegrationOpenAISecretKeyOption.name]: IntegrationOpenAISecretKeyOption,
882
930
  };
931
+ exports.integrationsGeocodingOptions = {
932
+ [IntegrationGeocodingApiKeyOption.name]: IntegrationGeocodingApiKeyOption,
933
+ };
883
934
  exports.validOptions = Object.assign({}, exports.settingsOptions);
884
935
  /**
885
936
  * Validate all options by type
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from 'react';
2
3
  import { SnackbarProvider } from 'notistack';
3
4
  /**
4
5
  * Creates Global Context
@@ -28,8 +29,7 @@ export const SCAlertMessagesContext = createContext({});
28
29
  */
29
30
  export default function SCAlertMessagesProvider({ children = null }) {
30
31
  const [options, setOptions] = useState({ maxSnack: 3, autoHideDuration: null });
31
- return (React.createElement(SCAlertMessagesContext.Provider, { value: { options, setOptions } },
32
- React.createElement(SnackbarProvider, Object.assign({}, options), children)));
32
+ return (_jsx(SCAlertMessagesContext.Provider, Object.assign({ value: { options, setOptions } }, { children: _jsx(SnackbarProvider, Object.assign({}, options, { children: children })) })));
33
33
  }
34
34
  /**
35
35
  * Let's only export the `useSCAlertMessages` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useMemo, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, useState } from 'react';
2
3
  import { http } from '@selfcommunity/api-services';
3
4
  import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
4
5
  import { validateOptions, validOptions } from '../../../utils/validator';
@@ -79,10 +80,10 @@ export default function SCContextProvider({ conf, children }) {
79
80
  * Nesting all necessary providers
80
81
  * All child components will use help contexts to works
81
82
  */
82
- return (React.createElement(SCContext.Provider, { value: { settings } }, settings &&
83
- settings.contextProviders.reduceRight((memo, ContextProvider) => {
84
- return React.createElement(ContextProvider, null, memo);
85
- }, children)));
83
+ return (_jsx(SCContext.Provider, Object.assign({ value: { settings } }, { children: settings &&
84
+ settings.contextProviders.reduceRight((memo, ContextProvider) => {
85
+ return _jsx(ContextProvider, { children: memo });
86
+ }, children) })));
86
87
  }
87
88
  /**
88
89
  * Let's only export the `useSCContext` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useMemo, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, useState } from 'react';
2
3
  import { useSCContext } from '../SCContextProvider';
3
4
  import { loadLocaleData } from '../../../utils/locale';
4
5
  import { DEFAULT_LANGUAGE_UI } from '../../../constants/Locale';
@@ -72,8 +73,7 @@ export default function SCLocaleProvider({ children = null }) {
72
73
  }
73
74
  throw error;
74
75
  };
75
- return (React.createElement(SCLocaleContext.Provider, { value: { locale, messages, selectLocale } },
76
- React.createElement(IntlProvider, { key: locale, locale: locale, messages: messages, onError: handleIntlError }, children)));
76
+ return (_jsx(SCLocaleContext.Provider, Object.assign({ value: { locale, messages, selectLocale } }, { children: _jsx(IntlProvider, Object.assign({ locale: locale, messages: messages, onError: handleIntlError }, { children: children }), locale) })));
77
77
  }
78
78
  /**
79
79
  * Export hoc to inject the base theme to components
@@ -81,8 +81,7 @@ export default function SCLocaleProvider({ children = null }) {
81
81
  */
82
82
  export const withSCLocale = (Component) => (props) => {
83
83
  const scLocaleContext = useContext(SCLocaleContext);
84
- return (React.createElement(IntlProvider, { locale: scLocaleContext.locale, messages: scLocaleContext.messages },
85
- React.createElement(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props))));
84
+ return (_jsx(IntlProvider, Object.assign({ locale: scLocaleContext.locale, messages: scLocaleContext.messages }, { children: _jsx(Component, Object.assign({ setLanguage: scLocaleContext.selectLocale }, props)) })));
86
85
  };
87
86
  /**
88
87
  * Let's only export the `useSCLocale` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
2
3
  import useSCWebSocket from '../../../hooks/useSCWebSocket';
3
4
  import useSCWebPushMessaging from '../../../hooks/useSCWebPushMessaging';
4
5
  import useSCMobileNativePushMessaging from '../../../hooks/useSCMobileNativePushMessaging';
@@ -32,7 +33,7 @@ export default function SCNotificationProvider({ children = null }) {
32
33
  const { wsInstance } = useSCWebSocket();
33
34
  const { wpSubscription } = useSCWebPushMessaging();
34
35
  const { mnpmInstance } = useSCMobileNativePushMessaging();
35
- return React.createElement(SCNotificationContext.Provider, { value: { wsInstance, wpSubscription, mnpmInstance } }, children);
36
+ return _jsx(SCNotificationContext.Provider, Object.assign({ value: { wsInstance, wpSubscription, mnpmInstance } }, { children: children }));
36
37
  }
37
38
  /**
38
39
  * Let's only export the `useSCNotification` hook instead of the context.
@@ -1,6 +1,7 @@
1
- import React, { createContext, useContext, useEffect, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { FeatureService, PreferenceService } from '@selfcommunity/api-services';
3
3
  import { Logger } from '@selfcommunity/utils';
4
+ import { createContext, useContext, useEffect, useState } from 'react';
4
5
  import { SCOPE_SC_CORE } from '../../../constants/Errors';
5
6
  import { useSCContext } from '../SCContextProvider';
6
7
  /**
@@ -50,13 +51,28 @@ export default function SCPreferencesProvider({ children = null }) {
50
51
  .catch((_error) => {
51
52
  Logger.error(SCOPE_SC_CORE, _error);
52
53
  setError(_error);
54
+ // setLoading(false);
53
55
  });
54
56
  }, []);
57
+ /**
58
+ * Force refresh of preferences & features
59
+ */
60
+ const refresh = () => {
61
+ Promise.all([PreferenceService.getAllPreferences(), FeatureService.getAllFeatures()])
62
+ .then(function ([preferences, features]) {
63
+ setPreferences(preferences['results'].reduce((obj, p) => (Object.assign(Object.assign({}, obj), { [`${p.section}.${p.name}`]: p })), {}));
64
+ setFeatures(features['results'].filter((f) => f.enabled).map((f) => f.name));
65
+ })
66
+ .catch((_error) => {
67
+ Logger.error(SCOPE_SC_CORE, _error);
68
+ setError(_error);
69
+ });
70
+ };
55
71
  /**
56
72
  * Nesting all necessary providers
57
73
  * All child components will use help contexts to works
58
74
  */
59
- return React.createElement(SCPreferencesContext.Provider, { value: { preferences, features } }, !loading && children);
75
+ return (_jsx(SCPreferencesContext.Provider, Object.assign({ value: { preferences, features, setPreferences, setFeatures, refresh } }, { children: !loading && children })));
60
76
  }
61
77
  /**
62
78
  * Let's only export the `useSCPreferences` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useMemo } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo } from 'react';
2
3
  import { useSCContext } from '../SCContextProvider';
3
4
  import { SCPreferencesContext } from '../SCPreferencesProvider';
4
5
  import * as SCPreferences from '../../../constants/Preferences';
@@ -100,7 +101,7 @@ export default function SCRoutingProvider({ children = null }) {
100
101
  routes,
101
102
  url,
102
103
  }), [routerLink, routes]);
103
- return React.createElement(SCRoutingContext.Provider, { value: contextValue }, children);
104
+ return _jsx(SCRoutingContext.Provider, Object.assign({ value: contextValue }, { children: children }));
104
105
  }
105
106
  /**
106
107
  * Let's only export the `useSCTheme` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from 'react';
2
3
  import ThemeProvider from '@mui/material/styles/ThemeProvider';
3
4
  import getTheme from '../../../themes/theme';
4
5
  import { useSCContext } from '../SCContextProvider';
@@ -55,8 +56,7 @@ export default function SCThemeProvider({ children = null }) {
55
56
  useDeepCompareEffectNoCheck(() => {
56
57
  setCustomTheme(theme);
57
58
  }, [scContext.settings.theme]);
58
- return (React.createElement(SCThemeContext.Provider, { value: { theme, setTheme: setCustomTheme } },
59
- React.createElement(ThemeProvider, { theme: theme }, children)));
59
+ return (_jsx(SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: _jsx(ThemeProvider, Object.assign({ theme: theme }, { children: children })) })));
60
60
  }
61
61
  /**
62
62
  * Export hoc to inject the base theme to components
@@ -64,8 +64,7 @@ export default function SCThemeProvider({ children = null }) {
64
64
  */
65
65
  export const withSCTheme = (Component) => (props) => {
66
66
  const scThemeContext = useContext(SCThemeContext);
67
- return (React.createElement(ThemeProvider, { theme: scThemeContext.theme },
68
- React.createElement(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props))));
67
+ return (_jsx(ThemeProvider, Object.assign({ theme: scThemeContext.theme }, { children: _jsx(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props)) })));
69
68
  };
70
69
  /**
71
70
  * Let's only export the `useSCTheme` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useEffect, useMemo, useRef } from 'react';
2
3
  import { UserService } from '@selfcommunity/api-services';
3
4
  import { SCContext } from '../SCContextProvider';
4
5
  import useSCAuth, { userActionTypes } from '../../../hooks/useSCAuth';
@@ -16,6 +17,7 @@ import useSCSubscribedIncubatorsManager from '../../../hooks/useSCSubscribedIncu
16
17
  import useSCBlockedUsersManager from '../../../hooks/useSCBlockedUsersManager';
17
18
  import * as Session from '../../../constants/Session';
18
19
  import useSCSubscribedGroupsManager from '../../../hooks/useSCSubscribedGroupsManager';
20
+ import useSCSubscribedEventsManager from '../../../hooks/useSCSubscribedEventsManager';
19
21
  /**
20
22
  * SCUserContext (Authentication Context)
21
23
  *
@@ -68,6 +70,7 @@ export default function SCUserProvider({ children }) {
68
70
  const categoriesManager = useSCFollowedCategoriesManager(state.user, updateUser);
69
71
  const blockedUsersManager = useSCBlockedUsersManager(state.user);
70
72
  const subscribedGroupsManager = useSCSubscribedGroupsManager(state.user);
73
+ const subscribedEventsManager = useSCSubscribedEventsManager(state.user);
71
74
  /**
72
75
  * Ref notifications subscribers: BLOCKED_USER, UNBLOCKED_USER
73
76
  */
@@ -119,6 +122,7 @@ export default function SCUserProvider({ children }) {
119
122
  subscribedIncubatorsManager.refresh && subscribedIncubatorsManager.refresh();
120
123
  blockedUsersManager.refresh && blockedUsersManager.refresh();
121
124
  subscribedGroupsManager.refresh && subscribedGroupsManager.refresh();
125
+ subscribedEventsManager.refresh && subscribedEventsManager.refresh();
122
126
  }
123
127
  }
124
128
  /**
@@ -215,6 +219,7 @@ export default function SCUserProvider({ children }) {
215
219
  incubators: subscribedIncubatorsManager,
216
220
  blockedUsers: blockedUsersManager,
217
221
  groups: subscribedGroupsManager,
222
+ events: subscribedEventsManager,
218
223
  },
219
224
  }), [
220
225
  state,
@@ -233,12 +238,14 @@ export default function SCUserProvider({ children }) {
233
238
  subscribedIncubatorsManager.incubators,
234
239
  subscribedGroupsManager.loading,
235
240
  subscribedGroupsManager.groups,
241
+ subscribedEventsManager.loading,
242
+ subscribedEventsManager.events,
236
243
  ]);
237
244
  /**
238
245
  * We only want to render the underlying app after we
239
246
  * assert for the presence of a current user.
240
247
  */
241
- return React.createElement(SCUserContext.Provider, { value: contextValue }, children);
248
+ return _jsx(SCUserContext.Provider, Object.assign({ value: contextValue }, { children: children }));
242
249
  }
243
250
  /**
244
251
  * Let's only export the `useSCUser` hook instead of the context.
@@ -1,4 +1,5 @@
1
- import React, { createContext, useCallback, useContext, useEffect, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useState } from 'react';
2
3
  import { ReactionService } from '@selfcommunity/api-services';
3
4
  import { Logger } from '@selfcommunity/utils';
4
5
  import { SCOPE_SC_CORE } from '../../../constants/Errors';
@@ -78,7 +79,7 @@ export default function SCVoteProvider({ children = null }) {
78
79
  * Nesting all necessary providers
79
80
  * All child components will use help contexts to works
80
81
  */
81
- return React.createElement(SCVoteContext.Provider, { value: { reactions, isLoading, refreshReactions } }, initialized && children);
82
+ return _jsx(SCVoteContext.Provider, Object.assign({ value: { reactions, isLoading, refreshReactions } }, { children: initialized && children }));
82
83
  }
83
84
  /**
84
85
  * Let's only export the `useSCPreferences` hook instead of the context.
@@ -1,4 +1,5 @@
1
1
  import { __rest } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import React, { useContext } from 'react';
3
4
  import { SCRoutingContext } from '../provider/SCRoutingProvider';
4
5
  /**
@@ -19,10 +20,10 @@ const Link = (_a, ref) => {
19
20
  const scRoutingContext = useContext(SCRoutingContext);
20
21
  if (scRoutingContext.routerLink) {
21
22
  const ComponentLink = scRoutingContext.routerLink;
22
- return (React.createElement(ComponentLink, Object.assign({}, other, { ref: ref }), children));
23
+ return (_jsx(ComponentLink, Object.assign({}, other, { ref: ref }, { children: children })));
23
24
  }
24
25
  const { to } = other, rest = __rest(other, ["to"]);
25
- return (React.createElement("a", Object.assign({ href: to }, rest, { ref: ref }), children));
26
+ return (_jsx("a", Object.assign({ href: to }, rest, { ref: ref }, { children: children })));
26
27
  };
27
28
  /**
28
29
  :::info
@@ -17,6 +17,12 @@ export declare const getCategoriesObjectCacheKey: () => string;
17
17
  /** CATEGORY OBJECT **/
18
18
  export declare const CATEGORY_OBJECT_CACHE_PREFIX_KEY = "_ca_";
19
19
  export declare const getCategoryObjectCacheKey: (id: any) => string;
20
+ /** EVENT OBJECT **/
21
+ export declare const EVENT_OBJECT_CACHE_PREFIX_KEY = "_evt_";
22
+ export declare const getEventObjectCacheKey: (id: any) => string;
23
+ /** EVENTS OBJECT **/
24
+ export declare const EVENTS_OBJECT_CACHE_PREFIX_KEY = "_evts_";
25
+ export declare const getEventsObjectCacheKey: () => string;
20
26
  /** GROUP OBJECT **/
21
27
  export declare const GROUP_OBJECT_CACHE_PREFIX_KEY = "_grp_";
22
28
  export declare const getGroupObjectCacheKey: (id: any) => string;
@@ -58,6 +64,11 @@ export declare const CATEGORIES_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = "_cSug
58
64
  export declare const CATEGORIES_POPULAR_TOOLS_STATE_CACHE_PREFIX_KEY = "_cPopWidget_";
59
65
  export declare const USER_FOLLOWERS_TOOLS_STATE_CACHE_PREFIX_KEY = "_uFolWidget_";
60
66
  export declare const USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_uFoldWidget_";
67
+ export declare const USER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uEvents_";
68
+ export declare const USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = "_uOtherEvents_";
69
+ export declare const USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = "_uPartecipantsEvents_";
70
+ export declare const USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = "_uInvitedEvents_";
71
+ export declare const USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = "_uRequestsEvents_";
61
72
  export declare const USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = "_uConWidget_";
62
73
  export declare const USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = "_uConReqWidget_";
63
74
  export declare const USER_CONNECTIONS_REQUESTS_SENT_TOOLS_STATE_CACHE_PREFIX_KEY = "_uConReqSentWidget_";
@@ -17,6 +17,12 @@ export const getCategoriesObjectCacheKey = () => `${CATEGORIES_OBJECT_CACHE_PREF
17
17
  /** CATEGORY OBJECT **/
18
18
  export const CATEGORY_OBJECT_CACHE_PREFIX_KEY = '_ca_';
19
19
  export const getCategoryObjectCacheKey = (id) => `${CATEGORY_OBJECT_CACHE_PREFIX_KEY}${id}`;
20
+ /** EVENT OBJECT **/
21
+ export const EVENT_OBJECT_CACHE_PREFIX_KEY = '_evt_';
22
+ export const getEventObjectCacheKey = (id) => `${EVENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
23
+ /** EVENTS OBJECT **/
24
+ export const EVENTS_OBJECT_CACHE_PREFIX_KEY = '_evts_';
25
+ export const getEventsObjectCacheKey = () => `${EVENTS_OBJECT_CACHE_PREFIX_KEY}`;
20
26
  /** GROUP OBJECT **/
21
27
  export const GROUP_OBJECT_CACHE_PREFIX_KEY = '_grp_';
22
28
  export const getGroupObjectCacheKey = (id) => `${GROUP_OBJECT_CACHE_PREFIX_KEY}${id}`;
@@ -62,6 +68,11 @@ export const CATEGORIES_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = '_cSugWidget_'
62
68
  export const CATEGORIES_POPULAR_TOOLS_STATE_CACHE_PREFIX_KEY = '_cPopWidget_';
63
69
  export const USER_FOLLOWERS_TOOLS_STATE_CACHE_PREFIX_KEY = '_uFolWidget_';
64
70
  export const USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_uFoldWidget_';
71
+ export const USER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uEvents_';
72
+ export const USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = '_uOtherEvents_';
73
+ export const USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uPartecipantsEvents_';
74
+ export const USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = '_uInvitedEvents_';
75
+ export const USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = '_uRequestsEvents_';
65
76
  export const USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = '_uConWidget_';
66
77
  export const USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = '_uConReqWidget_';
67
78
  export const USER_CONNECTIONS_REQUESTS_SENT_TOOLS_STATE_CACHE_PREFIX_KEY = '_uConReqSentWidget_';
@@ -1,8 +1,13 @@
1
1
  export declare const INTEGRATIONS_OPTION = "integrations";
2
2
  export declare const INTEGRATIONS_OPENAI_OPTION = "openai";
3
3
  export declare const INTEGRATIONS_OPENAI_SECRETKEY_OPTION = "secretKey";
4
+ export declare const INTEGRATIONS_GEOCODING_OPTION = "geocoding";
5
+ export declare const INTEGRATIONS_GEOCODING_APIKEY_OPTION = "apiKey";
4
6
  export declare const DEFAULT_INTEGRATIONS_OPTION: {
5
7
  openai: {
6
8
  secretKey: any;
7
9
  };
10
+ geocoding: {
11
+ apiKey: any;
12
+ };
8
13
  };
@@ -2,8 +2,13 @@
2
2
  export const INTEGRATIONS_OPTION = 'integrations';
3
3
  export const INTEGRATIONS_OPENAI_OPTION = 'openai';
4
4
  export const INTEGRATIONS_OPENAI_SECRETKEY_OPTION = 'secretKey';
5
+ export const INTEGRATIONS_GEOCODING_OPTION = 'geocoding';
6
+ export const INTEGRATIONS_GEOCODING_APIKEY_OPTION = 'apiKey';
5
7
  export const DEFAULT_INTEGRATIONS_OPTION = {
6
8
  [INTEGRATIONS_OPENAI_OPTION]: {
7
9
  [INTEGRATIONS_OPENAI_SECRETKEY_OPTION]: null,
8
10
  },
11
+ [INTEGRATIONS_GEOCODING_OPTION]: {
12
+ [INTEGRATIONS_GEOCODING_APIKEY_OPTION]: null,
13
+ },
9
14
  };
@@ -129,6 +129,9 @@ export declare const CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE: string;
129
129
  export declare const CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED: string;
130
130
  export declare const CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED: string;
131
131
  export declare const CONFIGURATIONS_GROUPS_PRIVATE_ENABLED: string;
132
+ export declare const CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED: string;
133
+ export declare const CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED: string;
134
+ export declare const CONFIGURATIONS_EVENTS_PRIVATE_ENABLED: string;
132
135
  /**
133
136
  * PROVIDERS
134
137
  */