@selfcommunity/react-core 0.4.50-alpha.1 → 0.4.50-events.28
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/lib/cjs/components/provider/SCUserProvider/index.js +4 -4
- package/lib/cjs/constants/Cache.d.ts +3 -0
- package/lib/cjs/constants/Cache.js +6 -2
- package/lib/cjs/constants/Integrations.d.ts +13 -0
- package/lib/cjs/constants/Integrations.js +17 -0
- package/lib/cjs/constants/Notifications.d.ts +2 -1
- package/lib/cjs/constants/Notifications.js +4 -3
- package/lib/cjs/constants/Preferences.d.ts +3 -0
- package/lib/cjs/constants/Preferences.js +8 -2
- package/lib/cjs/constants/Routes.d.ts +4 -0
- package/lib/cjs/constants/Routes.js +9 -1
- package/lib/cjs/hooks/useSCFetchEvent.d.ts +20 -0
- package/lib/cjs/hooks/useSCFetchEvent.js +74 -0
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/types/context.d.ts +37 -0
- package/lib/cjs/utils/errors.d.ts +6 -0
- package/lib/cjs/utils/errors.js +12 -0
- package/lib/cjs/utils/hooks/useIsomorphicLayoutEffect.js +2 -1
- package/lib/cjs/utils/notification.js +1 -1
- package/lib/cjs/utils/validator.d.ts +103 -28
- package/lib/cjs/utils/validator.js +178 -31
- package/lib/esm/components/provider/SCUserProvider/index.js +5 -5
- package/lib/esm/constants/Cache.d.ts +3 -0
- package/lib/esm/constants/Cache.js +3 -0
- package/lib/esm/constants/Integrations.d.ts +13 -0
- package/lib/esm/constants/Integrations.js +14 -0
- package/lib/esm/constants/Notifications.d.ts +2 -1
- package/lib/esm/constants/Notifications.js +3 -2
- package/lib/esm/constants/Preferences.d.ts +3 -0
- package/lib/esm/constants/Preferences.js +6 -0
- package/lib/esm/constants/Routes.d.ts +4 -0
- package/lib/esm/constants/Routes.js +8 -0
- package/lib/esm/hooks/useSCFetchEvent.d.ts +20 -0
- package/lib/esm/hooks/useSCFetchEvent.js +71 -0
- package/lib/esm/index.d.ts +2 -1
- package/lib/esm/index.js +2 -1
- package/lib/esm/types/context.d.ts +37 -0
- package/lib/esm/utils/errors.d.ts +6 -0
- package/lib/esm/utils/errors.js +12 -0
- package/lib/esm/utils/hooks/useIsomorphicLayoutEffect.js +2 -1
- package/lib/esm/utils/notification.js +2 -2
- package/lib/esm/utils/validator.d.ts +103 -28
- package/lib/esm/utils/validator.js +171 -30
- package/lib/umd/react-core.js +1 -1
- package/package.json +6 -6
|
@@ -104,17 +104,17 @@ function SCUserProvider({ children }) {
|
|
|
104
104
|
* and document is in foreground refresh the cache
|
|
105
105
|
*/
|
|
106
106
|
(0, react_1.useEffect)(() => {
|
|
107
|
-
|
|
107
|
+
window.document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
108
108
|
return () => {
|
|
109
|
-
|
|
109
|
+
window.document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
110
110
|
};
|
|
111
|
-
});
|
|
111
|
+
}, []);
|
|
112
112
|
/**
|
|
113
113
|
* handler handleVisibilityChange for this provider
|
|
114
114
|
* Refresh followed categories, users, etc..
|
|
115
115
|
*/
|
|
116
116
|
function handleVisibilityChange() {
|
|
117
|
-
if (
|
|
117
|
+
if (!window.document.hidden && state.user) {
|
|
118
118
|
settingsManager.refresh && settingsManager.refresh();
|
|
119
119
|
refreshCounters();
|
|
120
120
|
categoriesManager.refresh && categoriesManager.refresh();
|
|
@@ -17,6 +17,9 @@ 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;
|
|
20
23
|
/** GROUP OBJECT **/
|
|
21
24
|
export declare const GROUP_OBJECT_CACHE_PREFIX_KEY = "_grp_";
|
|
22
25
|
export declare const getGroupObjectCacheKey: (id: any) => string;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Cache prefixes
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.getWidgetStateCacheKey = exports.GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = void 0;
|
|
6
|
+
exports.TRENDING_PEOPLE_TOOLS_STATE_CACHE_PREFIX_KEY = exports.RELATED_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.TRENDING_FEED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_SENT_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_CONNECTIONS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.USER_FOLLOWERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_POPULAR_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.getPmSnippetObjectCacheKey = exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetsObjectCacheKey = exports.PM_SNIPPETS_OBJECT_CACHE_PREFIX_KEY = exports.getAdvObjectCacheKey = exports.ADV_OBJECT_CACHE_PREFIX_KEY = exports.getFeedSPCacheKey = exports.FEED_CACHE_SP_KEY = exports.getVirtualizedScrollStateCacheKey = exports.VIRTUALIZED_SCROLL_STATE_CACHE_PREFIX_KEY = exports.getStateFeedCacheKey = exports.FEED_STATE_CACHE_PREFIX_KEY = exports.getFeedCacheKey = exports.FEED_CACHE_PREFIX_KEY = exports.getBroadcastMessagesObjectCacheKey = exports.BROADCAST_MESSAGES_OBJECT_CACHE_PREFIX_KEY = exports.getContributorsCachePrefixKeys = exports.getContributorsCacheKey = exports.CONTRIBUTORS_CACHE_PREFIX_KEY = exports.getIncubatorObjectCacheKey = exports.INCUBATOR_OBJECT_CACHE_PREFIX_KEY = exports.getGroupsObjectCacheKey = exports.GROUPS_OBJECT_CACHE_PREFIX_KEY = exports.getGroupObjectCacheKey = exports.GROUP_OBJECT_CACHE_PREFIX_KEY = exports.getEventObjectCacheKey = exports.EVENT_OBJECT_CACHE_PREFIX_KEY = exports.getCategoryObjectCacheKey = exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = exports.getCategoriesObjectCacheKey = exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY = exports.getCommentObjectsCachePrefixKeys = exports.getCommentObjectsCacheKey = exports.COMMENT_OBJECTS_CACHE_PREFIX_KEY = exports.getCommentObjectCacheKey = exports.COMMENT_OBJECT_CACHE_PREFIX_KEY = exports.getFeedObjectCacheKey = exports.FEED_OBJECT_CACHE_PREFIX_KEY = void 0;
|
|
7
|
+
exports.getWidgetStateCacheKey = exports.GROUPS_SUBSCRIBED_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUPS_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_REQUESTS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.GROUP_MEMBERS_TOOLS_STATE_CACHE_PREFIX_KEY = exports.POLL_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = exports.INCUBATOR_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = exports.PEOPLE_SUGGESTION_TOOLS_STATE_CACHE_PREFIX_KEY = void 0;
|
|
8
8
|
/** FEED OBJECT **/
|
|
9
9
|
exports.FEED_OBJECT_CACHE_PREFIX_KEY = '_fo_';
|
|
10
10
|
const getFeedObjectCacheKey = (id, type) => `${exports.FEED_OBJECT_CACHE_PREFIX_KEY}${type}_${id}`;
|
|
@@ -27,6 +27,10 @@ exports.getCategoriesObjectCacheKey = getCategoriesObjectCacheKey;
|
|
|
27
27
|
exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = '_ca_';
|
|
28
28
|
const getCategoryObjectCacheKey = (id) => `${exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
29
29
|
exports.getCategoryObjectCacheKey = getCategoryObjectCacheKey;
|
|
30
|
+
/** EVENT OBJECT **/
|
|
31
|
+
exports.EVENT_OBJECT_CACHE_PREFIX_KEY = '_evt_';
|
|
32
|
+
const getEventObjectCacheKey = (id) => `${exports.EVENT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
33
|
+
exports.getEventObjectCacheKey = getEventObjectCacheKey;
|
|
30
34
|
/** GROUP OBJECT **/
|
|
31
35
|
exports.GROUP_OBJECT_CACHE_PREFIX_KEY = '_grp_';
|
|
32
36
|
const getGroupObjectCacheKey = (id) => `${exports.GROUP_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const INTEGRATIONS_OPTION = "integrations";
|
|
2
|
+
export declare const INTEGRATIONS_OPENAI_OPTION = "openai";
|
|
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";
|
|
6
|
+
export declare const DEFAULT_INTEGRATIONS_OPTION: {
|
|
7
|
+
openai: {
|
|
8
|
+
secretKey: any;
|
|
9
|
+
};
|
|
10
|
+
geocoding: {
|
|
11
|
+
apiKey: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_INTEGRATIONS_OPTION = exports.INTEGRATIONS_GEOCODING_APIKEY_OPTION = exports.INTEGRATIONS_GEOCODING_OPTION = exports.INTEGRATIONS_OPENAI_SECRETKEY_OPTION = exports.INTEGRATIONS_OPENAI_OPTION = exports.INTEGRATIONS_OPTION = void 0;
|
|
4
|
+
// integrations
|
|
5
|
+
exports.INTEGRATIONS_OPTION = 'integrations';
|
|
6
|
+
exports.INTEGRATIONS_OPENAI_OPTION = 'openai';
|
|
7
|
+
exports.INTEGRATIONS_OPENAI_SECRETKEY_OPTION = 'secretKey';
|
|
8
|
+
exports.INTEGRATIONS_GEOCODING_OPTION = 'geocoding';
|
|
9
|
+
exports.INTEGRATIONS_GEOCODING_APIKEY_OPTION = 'apiKey';
|
|
10
|
+
exports.DEFAULT_INTEGRATIONS_OPTION = {
|
|
11
|
+
[exports.INTEGRATIONS_OPENAI_OPTION]: {
|
|
12
|
+
[exports.INTEGRATIONS_OPENAI_SECRETKEY_OPTION]: null,
|
|
13
|
+
},
|
|
14
|
+
[exports.INTEGRATIONS_GEOCODING_OPTION]: {
|
|
15
|
+
[exports.INTEGRATIONS_GEOCODING_APIKEY_OPTION]: null,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -9,6 +9,7 @@ export declare const NOTIFICATIONS_MOBILE_NATIVE_PUSH_MESSAGING_OPTION = "mobile
|
|
|
9
9
|
export declare const NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE = "wpnDialogDisabled";
|
|
10
10
|
export declare const NOTIFICATIONS_DISABLE_TOAST_MESSAGE_OPTION = "disableToastMessage";
|
|
11
11
|
export declare const NOTIFICATIONS_MOBILE_NATIVE_DISABLE_OPTION = "disable";
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const NOTIFICATIONS_WEBSOCKET_SECURE_OPTION = "secure";
|
|
13
|
+
export declare const NOTIFICATIONS_WEBSOCKET_PREFIX_PATH_OPTION = "prefixPath";
|
|
13
14
|
export declare const NOTIFICATIONS_APPLICATION_SERVER_KEY_OPTION = "applicationServerKey";
|
|
14
15
|
export declare const DEFAULT_NOTIFICATIONS: SCNotificationsType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_NOTIFICATIONS = exports.NOTIFICATIONS_APPLICATION_SERVER_KEY_OPTION = exports.
|
|
3
|
+
exports.DEFAULT_NOTIFICATIONS = exports.NOTIFICATIONS_APPLICATION_SERVER_KEY_OPTION = exports.NOTIFICATIONS_WEBSOCKET_PREFIX_PATH_OPTION = exports.NOTIFICATIONS_WEBSOCKET_SECURE_OPTION = exports.NOTIFICATIONS_MOBILE_NATIVE_DISABLE_OPTION = exports.NOTIFICATIONS_DISABLE_TOAST_MESSAGE_OPTION = exports.NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE = exports.NOTIFICATIONS_MOBILE_NATIVE_PUSH_MESSAGING_OPTION = exports.NOTIFICATIONS_WEB_PUSH_MESSAGING_OPTION = exports.NOTIFICATIONS_WEB_SOCKET_OPTION = exports.NOTIFICATIONS_OPTION = void 0;
|
|
4
4
|
exports.NOTIFICATIONS_OPTION = 'notifications';
|
|
5
5
|
exports.NOTIFICATIONS_WEB_SOCKET_OPTION = 'webSocket';
|
|
6
6
|
exports.NOTIFICATIONS_WEB_PUSH_MESSAGING_OPTION = 'webPushMessaging';
|
|
@@ -8,12 +8,13 @@ exports.NOTIFICATIONS_MOBILE_NATIVE_PUSH_MESSAGING_OPTION = 'mobileNativePushMes
|
|
|
8
8
|
exports.NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE = 'wpnDialogDisabled';
|
|
9
9
|
exports.NOTIFICATIONS_DISABLE_TOAST_MESSAGE_OPTION = 'disableToastMessage';
|
|
10
10
|
exports.NOTIFICATIONS_MOBILE_NATIVE_DISABLE_OPTION = 'disable';
|
|
11
|
-
exports.
|
|
11
|
+
exports.NOTIFICATIONS_WEBSOCKET_SECURE_OPTION = 'secure';
|
|
12
|
+
exports.NOTIFICATIONS_WEBSOCKET_PREFIX_PATH_OPTION = 'prefixPath';
|
|
12
13
|
exports.NOTIFICATIONS_APPLICATION_SERVER_KEY_OPTION = 'applicationServerKey';
|
|
13
14
|
exports.DEFAULT_NOTIFICATIONS = {
|
|
14
15
|
[exports.NOTIFICATIONS_WEB_SOCKET_OPTION]: {
|
|
15
16
|
[exports.NOTIFICATIONS_DISABLE_TOAST_MESSAGE_OPTION]: false,
|
|
16
|
-
[exports.
|
|
17
|
+
[exports.NOTIFICATIONS_WEBSOCKET_SECURE_OPTION]: true,
|
|
17
18
|
},
|
|
18
19
|
[exports.NOTIFICATIONS_WEB_PUSH_MESSAGING_OPTION]: {
|
|
19
20
|
[exports.NOTIFICATIONS_DISABLE_TOAST_MESSAGE_OPTION]: true,
|
|
@@ -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
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ADDONS_SHARE_POST_ON_FACEBOOK_ENABLED = exports.ADDONS_POST_GEOLOCATION_ENABLED = exports.ADDONS_REGISTRATION_WIZARD = exports.ADDONS_POLLS_ENABLED = exports.ADDONS_LOYALTY_POINTS_COLLECTION = exports.ADDONS_INCUBATOR_SUBSCRIBERS = exports.ADDONS_INCUBATOR_ENABLED = exports.ADDONS_CLOSED_COMMUNITY = exports.ADDONS_AFFINIDY_ENABLED = exports.POINTS_DAILY_VISIT = exports.POINTS_APP_USED = exports.POINTS_SOCIAL_SHARE = exports.POINTS_CONNECTION_OR_FOLLOWER = exports.POINTS_RECEIVE_VOTE = exports.POINTS_MAKE_COMMENT = exports.POINTS_MAKE_POST = exports.POINTS_MAKE_DISCUSSION = exports.LOYALTY_PRIZE_C_IMAGE = exports.LOYALTY_PRIZE_B_IMAGE = exports.LOYALTY_PRIZE_A_IMAGE = exports.STAFF_STAFF_BADGE_LABEL = exports.STAFF_STAFF_BADGE_ICON = exports.IMAGES_ERRORPAGES_IMAGE = exports.IMAGES_ERROR_503 = exports.IMAGES_ERROR_404 = exports.IMAGES_USER_DEFAULT_COVER = exports.IMAGES_APP_ICON = exports.COVERS_VISIBILITY = exports.COVERS_COVER_4_HP_M1920 = exports.COVERS_COVER_3_HP_M1920 = exports.COVERS_COVER_2_HP_M1920 = exports.COVERS_COVER_1_HP_M1920 = exports.COLORS_COLORFONTSECONDARY = exports.COLORS_COLORFONT = exports.COLORS_NAVBARBACK = exports.COLORS_COLORSECONDARY = exports.COLORS_COLORPRIMARY = exports.COLORS_COLORBACK = exports.LOGO_NAVBAR_LOGO_MOBILE = exports.LOGO_NAVBAR_LOGO = exports.STYLE_FONT_FAMILY = exports.TEXT_ERROR_PAGES_SUBTITLE = exports.TEXT_ERROR_PAGES_TITLE = exports.TEXT_APPLICATION_COPYRIGHT = exports.TEXT_APPLICATION_SLOGAN2 = exports.TEXT_APPLICATION_SLOGAN1 = exports.TEXT_APPLICATION_NAME = exports.DEFAULT_GLOBAL_PREFERENCES_OPTION = exports.GLOBAL_PREFERENCES_OPTION = exports.PREFERENCES_OPTION = void 0;
|
|
4
|
-
exports.
|
|
5
|
-
exports.DATA_TYPES = exports.getPreference = exports.getPreferenceName = exports.getPreferenceSection = exports.WEBMASTER_META_DESCRIPTION = exports.WEBMASTER_META_TITLE_HOME_NOT_LOGGED = exports.WEBMASTER_META_ROBOTS = exports.PROVIDERS_WEB_PUSH_ENABLED = exports.PROVIDERS_WEB_PUSH_PUBLIC_KEY = exports.PROVIDERS_GOOGLE_APP_SECRET = exports.PROVIDERS_GOOGLE_APP_KEY = exports.PROVIDERS_GOOGLE_SIGNIN_ENABLED = exports.PROVIDERS_GOOGLE_GEOCODING_API_KEY = exports.PROVIDERS_TWITTER_APP_SECRET = exports.PROVIDERS_TWITTER_APP_KEY = exports.PROVIDERS_TWITTER_SIGNIN_ENABLED = exports.PROVIDERS_LINKEDIN_APP_SECRET = exports.PROVIDERS_LINKEDIN_APP_KEY = void 0;
|
|
4
|
+
exports.PROVIDERS_FACEBOOK_SIGNIN_ENABLED = exports.PROVIDERS_APP_URL_ON_GOOGLE_PLAY = exports.PROVIDERS_APP_URL_ON_APP_STORE = exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED = exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_GROUPS_PRIVATE_ENABLED = exports.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED = exports.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT = exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_ENABLED = exports.CONFIGURATIONS_GDPR_SIGNUP_ACCEPT_HTML = exports.CONFIGURATIONS_GDPR_COOKIE_CONSENT_EXTERNAL_HTML = exports.CONFIGURATIONS_TAG_MANAGER_CONTAINER_ID = exports.CONFIGURATIONS_USER_METADATA_DEFINITIONS = exports.CONFIGURATIONS_APP_URL = exports.CONFIGURATIONS_URL_TEMPLATE_INCUBATOR = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PRIVATE_MESSAGES = exports.CONFIGURATIONS_URL_TEMPLATE_NOTIFICATIONS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE_SETTINGS = exports.CONFIGURATIONS_URL_TEMPLATE_USER_PROFILE = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORIES_LIST = exports.CONFIGURATIONS_URL_TEMPLATE_CATEGORY = exports.CONFIGURATIONS_URL_TEMPLATE_COMMENT = exports.CONFIGURATIONS_URL_TEMPLATE_STATUS = exports.CONFIGURATIONS_URL_TEMPLATE_DISCUSSION = exports.CONFIGURATIONS_URL_TEMPLATE_POST = exports.CONFIGURATIONS_URL_TEMPLATE_VERIFY_EMAIL = exports.CONFIGURATIONS_URL_TEMPLATE_PASSWORD_RECOVER = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_UNSUBSCRIBE = exports.CONFIGURATIONS_URL_TEMPLATE_EMAIL_SETTINGS = exports.CONFIGURATIONS_STATUS_TYPE_ENABLED = exports.CONFIGURATIONS_DISCUSSION_TYPE_ENABLED = exports.CONFIGURATIONS_POST_TYPE_ENABLED = exports.CONFIGURATIONS_USERS_APPROVAL_ENABLED = exports.CONFIGURATIONS_CONTENT_AVAILABILITY = exports.CONFIGURATIONS_STREAM_QUALITY = exports.CONFIGURATIONS_POST_ONLY_STAFF_ENABLED = exports.CONFIGURATIONS_PEOPLE_SEARCH_ENABLED = exports.CONFIGURATIONS_MANUAL_CATEGORIES_ORDER_ENABLED = exports.CONFIGURATIONS_HOME_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ORDER_BY = exports.CONFIGURATIONS_EXPLORE_STREAM_ENABLED = exports.CONFIGURATIONS_FOLLOW_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ONLY_FOR_ANONYMOUS_USERS_ENABLED = exports.ADVERTISING_CUSTOM_ADV_ENABLED = exports.ADDONS_SHARE_POST_ON_LINKEDIN_ENABLED = exports.ADDONS_SHARE_POST_ON_TWITTER_ENABLED = void 0;
|
|
5
|
+
exports.DATA_TYPES = exports.getPreference = exports.getPreferenceName = exports.getPreferenceSection = exports.WEBMASTER_META_DESCRIPTION = exports.WEBMASTER_META_TITLE_HOME_NOT_LOGGED = exports.WEBMASTER_META_ROBOTS = exports.PROVIDERS_WEB_PUSH_ENABLED = exports.PROVIDERS_WEB_PUSH_PUBLIC_KEY = exports.PROVIDERS_GOOGLE_APP_SECRET = exports.PROVIDERS_GOOGLE_APP_KEY = exports.PROVIDERS_GOOGLE_SIGNIN_ENABLED = exports.PROVIDERS_GOOGLE_GEOCODING_API_KEY = exports.PROVIDERS_TWITTER_APP_SECRET = exports.PROVIDERS_TWITTER_APP_KEY = exports.PROVIDERS_TWITTER_SIGNIN_ENABLED = exports.PROVIDERS_LINKEDIN_APP_SECRET = exports.PROVIDERS_LINKEDIN_APP_KEY = exports.PROVIDERS_LINKEDIN_SIGNIN_ENABLED = exports.PROVIDERS_FACEBOOK_APP_SECRET = exports.PROVIDERS_FACEBOOK_APP_KEY = void 0;
|
|
6
6
|
const types_1 = require("@selfcommunity/types");
|
|
7
7
|
/**
|
|
8
8
|
* DEFAULT CONF VALIDATION OPTION
|
|
@@ -135,6 +135,9 @@ exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE = `${types_1.SCPreferenceSection
|
|
|
135
135
|
exports.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.GROUPS_ONLY_STAFF_ENABLED}`;
|
|
136
136
|
exports.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.GROUPS_VISIBILITY_ENABLED}`;
|
|
137
137
|
exports.CONFIGURATIONS_GROUPS_PRIVATE_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.GROUPS_PRIVATE_ENABLED}`;
|
|
138
|
+
exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_ONLY_STAFF_ENABLED}`;
|
|
139
|
+
exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_VISIBILITY_ENABLED}`;
|
|
140
|
+
exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED = `${types_1.SCPreferenceSection.CONFIGURATIONS}.${types_1.SCPreferenceName.EVENTS_PRIVATE_ENABLED}`;
|
|
138
141
|
/**
|
|
139
142
|
* PROVIDERS
|
|
140
143
|
*/
|
|
@@ -274,6 +277,9 @@ exports.DATA_TYPES = {
|
|
|
274
277
|
[exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_TEXT]: stringType,
|
|
275
278
|
[exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_URL]: stringType,
|
|
276
279
|
[exports.CONFIGURATIONS_CUSTOM_NAVBAR_ITEM_IMAGE]: stringType,
|
|
280
|
+
[exports.CONFIGURATIONS_EVENTS_ONLY_STAFF_ENABLED]: booleanType,
|
|
281
|
+
[exports.CONFIGURATIONS_EVENTS_VISIBILITY_ENABLED]: booleanType,
|
|
282
|
+
[exports.CONFIGURATIONS_EVENTS_PRIVATE_ENABLED]: booleanType,
|
|
277
283
|
[exports.CONFIGURATIONS_GROUPS_ONLY_STAFF_ENABLED]: booleanType,
|
|
278
284
|
[exports.CONFIGURATIONS_GROUPS_VISIBILITY_ENABLED]: booleanType,
|
|
279
285
|
[exports.CONFIGURATIONS_GROUPS_PRIVATE_ENABLED]: booleanType,
|
|
@@ -36,6 +36,10 @@ export declare const GROUP_MEMBERS_ROUTE_NAME = "group_members";
|
|
|
36
36
|
export declare const GROUP_MESSAGES_ROUTE_NAME = "group_messages";
|
|
37
37
|
export declare const GROUPS_ROUTE_NAME = "groups";
|
|
38
38
|
export declare const GROUPS_SUBSCRIBED_ROUTE_NAME = "groups_subscribed";
|
|
39
|
+
export declare const EVENT_ROUTE_NAME = "event";
|
|
40
|
+
export declare const EVENTS_ROUTE_NAME = "events";
|
|
41
|
+
export declare const EVENTS_SUBSCRIBED_ROUTE_NAME = "events_subscribed";
|
|
42
|
+
export declare const EVENTS_HIGHLIGHT_ROUTE_NAME = "events_highlight";
|
|
39
43
|
/**
|
|
40
44
|
* Default Routes
|
|
41
45
|
* @type {{[p: string]: string, '[POST_ROUTE_NAME]': string, '[INCUBATOR_ROUTE_NAME]': string, '[LOYALTY_ROUTE_NAME]': string, '[USER_NOTIFICATION_ROUTE_NAME]': string, '[USER_PRIVATE_MESSAGES_ROUTE_NAME]': string, '[COMMENT_ROUTE_NAME]': string, '[DISCUSSION_ROUTE_NAME]': string, '[CATEGORIES_ROUTE_NAME]': string, '[USER_PROFILE_ROUTE_NAME]': string, '[CATEGORY_ROUTE_NAME]': string, '[USER_PROFILE_SETTINGS_ROUTE_NAME]': string, '[STATUS_ROUTE_NAME]': string}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultRoutes = exports.GROUPS_SUBSCRIBED_ROUTE_NAME = exports.GROUPS_ROUTE_NAME = exports.GROUP_MESSAGES_ROUTE_NAME = exports.GROUP_MEMBERS_ROUTE_NAME = exports.GROUP_ROUTE_NAME = exports.LEGAL_PAGES_ROUTE_NAME = exports.CUSTOM_PAGES_ROUTE_NAME = exports.RECOVER_ROUTE_NAME = exports.SIGNUP_ROUTE_NAME = exports.SIGNIN_ROUTE_NAME = exports.INCUBATOR_ROUTE_NAME = exports.LOYALTY_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = exports.USER_PROFILE_CATEGORIES_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_SENT_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWERS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWINGS_ROUTE_NAME = exports.USER_PRIVATE_MESSAGES_ROUTE_NAME = exports.USER_NOTIFICATIONS_ROUTE_NAME = exports.USER_PROFILE_SETTINGS_ROUTE_NAME = exports.USER_PROFILE_ROUTE_NAME = exports.CATEGORIES_LIST_ROUTE_NAME = exports.CATEGORY_TRENDING_FEED_ROUTE_NAME = exports.CATEGORY_ROUTE_NAME = exports.COMMENT_ROUTE_NAME = exports.STATUS_ROUTE_NAME = exports.DISCUSSION_ROUTE_NAME = exports.POST_ROUTE_NAME = exports.EXPLORE_ROUTE_NAME = exports.HOME_ROUTE_NAME = exports.ROUTER_OPTION = exports.PORTAL_OPTION = void 0;
|
|
3
|
+
exports.defaultRoutes = exports.EVENTS_HIGHLIGHT_ROUTE_NAME = exports.EVENTS_SUBSCRIBED_ROUTE_NAME = exports.EVENTS_ROUTE_NAME = exports.EVENT_ROUTE_NAME = exports.GROUPS_SUBSCRIBED_ROUTE_NAME = exports.GROUPS_ROUTE_NAME = exports.GROUP_MESSAGES_ROUTE_NAME = exports.GROUP_MEMBERS_ROUTE_NAME = exports.GROUP_ROUTE_NAME = exports.LEGAL_PAGES_ROUTE_NAME = exports.CUSTOM_PAGES_ROUTE_NAME = exports.RECOVER_ROUTE_NAME = exports.SIGNUP_ROUTE_NAME = exports.SIGNIN_ROUTE_NAME = exports.INCUBATOR_ROUTE_NAME = exports.LOYALTY_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = exports.USER_PROFILE_CATEGORIES_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_SENT_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_REQUESTS_ROUTE_NAME = exports.USER_PROFILE_CONNECTIONS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWERS_ROUTE_NAME = exports.USER_PROFILE_FOLLOWINGS_ROUTE_NAME = exports.USER_PRIVATE_MESSAGES_ROUTE_NAME = exports.USER_NOTIFICATIONS_ROUTE_NAME = exports.USER_PROFILE_SETTINGS_ROUTE_NAME = exports.USER_PROFILE_ROUTE_NAME = exports.CATEGORIES_LIST_ROUTE_NAME = exports.CATEGORY_TRENDING_FEED_ROUTE_NAME = exports.CATEGORY_ROUTE_NAME = exports.COMMENT_ROUTE_NAME = exports.STATUS_ROUTE_NAME = exports.DISCUSSION_ROUTE_NAME = exports.POST_ROUTE_NAME = exports.EXPLORE_ROUTE_NAME = exports.HOME_ROUTE_NAME = exports.ROUTER_OPTION = exports.PORTAL_OPTION = void 0;
|
|
4
4
|
exports.PORTAL_OPTION = 'portal';
|
|
5
5
|
exports.ROUTER_OPTION = 'router';
|
|
6
6
|
/**
|
|
@@ -39,6 +39,10 @@ exports.GROUP_MEMBERS_ROUTE_NAME = 'group_members';
|
|
|
39
39
|
exports.GROUP_MESSAGES_ROUTE_NAME = 'group_messages';
|
|
40
40
|
exports.GROUPS_ROUTE_NAME = 'groups';
|
|
41
41
|
exports.GROUPS_SUBSCRIBED_ROUTE_NAME = 'groups_subscribed';
|
|
42
|
+
exports.EVENT_ROUTE_NAME = 'event';
|
|
43
|
+
exports.EVENTS_ROUTE_NAME = 'events';
|
|
44
|
+
exports.EVENTS_SUBSCRIBED_ROUTE_NAME = 'events_subscribed';
|
|
45
|
+
exports.EVENTS_HIGHLIGHT_ROUTE_NAME = 'events_highlight';
|
|
42
46
|
/**
|
|
43
47
|
* Default Routes
|
|
44
48
|
* @type {{[p: string]: string, '[POST_ROUTE_NAME]': string, '[INCUBATOR_ROUTE_NAME]': string, '[LOYALTY_ROUTE_NAME]': string, '[USER_NOTIFICATION_ROUTE_NAME]': string, '[USER_PRIVATE_MESSAGES_ROUTE_NAME]': string, '[COMMENT_ROUTE_NAME]': string, '[DISCUSSION_ROUTE_NAME]': string, '[CATEGORIES_ROUTE_NAME]': string, '[USER_PROFILE_ROUTE_NAME]': string, '[CATEGORY_ROUTE_NAME]': string, '[USER_PROFILE_SETTINGS_ROUTE_NAME]': string, '[STATUS_ROUTE_NAME]': string}}
|
|
@@ -77,4 +81,8 @@ exports.defaultRoutes = {
|
|
|
77
81
|
[exports.GROUP_MESSAGES_ROUTE_NAME]: '/group/:id/:slug/messages/',
|
|
78
82
|
[exports.GROUPS_ROUTE_NAME]: '/groups/',
|
|
79
83
|
[exports.GROUPS_SUBSCRIBED_ROUTE_NAME]: '/groups/subscribed/',
|
|
84
|
+
[exports.EVENTS_ROUTE_NAME]: '/events/',
|
|
85
|
+
[exports.EVENT_ROUTE_NAME]: '/event/:id/:slug/',
|
|
86
|
+
[exports.EVENTS_SUBSCRIBED_ROUTE_NAME]: '/events/subscribed/',
|
|
87
|
+
[exports.EVENTS_HIGHLIGHT_ROUTE_NAME]: '/events/highlight/',
|
|
80
88
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SCEventType } from '@selfcommunity/types';
|
|
2
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
3
|
+
/**
|
|
4
|
+
:::info
|
|
5
|
+
This custom hook is used to fetch an event object.
|
|
6
|
+
:::
|
|
7
|
+
* @param object
|
|
8
|
+
* @param object.id
|
|
9
|
+
* @param object.event
|
|
10
|
+
* @param object.cacheStrategy
|
|
11
|
+
*/
|
|
12
|
+
export default function useSCFetchEvent({ id, event, cacheStrategy, }: {
|
|
13
|
+
id?: number | string;
|
|
14
|
+
event?: SCEventType;
|
|
15
|
+
cacheStrategy?: CacheStrategies;
|
|
16
|
+
}): {
|
|
17
|
+
scEvent: SCEventType;
|
|
18
|
+
setSCEvent: (event: SCEventType) => void;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const Errors_1 = require("../constants/Errors");
|
|
5
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
6
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
7
|
+
const Cache_1 = require("../constants/Cache");
|
|
8
|
+
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
9
|
+
const SCUserProvider_1 = require("../components/provider/SCUserProvider");
|
|
10
|
+
/**
|
|
11
|
+
:::info
|
|
12
|
+
This custom hook is used to fetch an event object.
|
|
13
|
+
:::
|
|
14
|
+
* @param object
|
|
15
|
+
* @param object.id
|
|
16
|
+
* @param object.event
|
|
17
|
+
* @param object.cacheStrategy
|
|
18
|
+
*/
|
|
19
|
+
function useSCFetchEvent({ id = null, event = null, cacheStrategy = utils_1.CacheStrategies.CACHE_FIRST, }) {
|
|
20
|
+
const __eventId = event ? event.id : id;
|
|
21
|
+
// CONTEXT
|
|
22
|
+
const scUserContext = (0, SCUserProvider_1.useSCUser)();
|
|
23
|
+
const authUserId = scUserContext.user ? scUserContext.user.id : null;
|
|
24
|
+
// CACHE
|
|
25
|
+
const __eventCacheKey = (0, Cache_1.getEventObjectCacheKey)(__eventId);
|
|
26
|
+
const __event = authUserId ? event : (0, utils_1.objectWithoutProperties)(event, ['subscription_status']);
|
|
27
|
+
const [scEvent, setScEvent] = (0, react_1.useState)(cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? utils_1.LRUCache.get(__eventCacheKey, __event) : null);
|
|
28
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
29
|
+
const setSCEvent = (event) => {
|
|
30
|
+
const _e = authUserId ? event : (0, utils_1.objectWithoutProperties)(event, ['subscription_status']);
|
|
31
|
+
setScEvent(_e);
|
|
32
|
+
utils_1.LRUCache.set(__eventCacheKey, _e);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Memoized fetchTag
|
|
36
|
+
*/
|
|
37
|
+
const fetchEvent = (0, react_1.useMemo)(() => () => {
|
|
38
|
+
return api_services_1.http
|
|
39
|
+
.request({
|
|
40
|
+
url: api_services_1.Endpoints.GetEventInfo.url({ id: __eventId }),
|
|
41
|
+
method: api_services_1.Endpoints.GetEventInfo.method,
|
|
42
|
+
})
|
|
43
|
+
.then((res) => {
|
|
44
|
+
if (res.status >= 300) {
|
|
45
|
+
return Promise.reject(res);
|
|
46
|
+
}
|
|
47
|
+
return Promise.resolve(res.data);
|
|
48
|
+
});
|
|
49
|
+
}, [__eventId]);
|
|
50
|
+
/**
|
|
51
|
+
* If id attempt to get the event by id
|
|
52
|
+
*/
|
|
53
|
+
(0, react_1.useEffect)(() => {
|
|
54
|
+
if (__eventId && (!scEvent || (scEvent && __eventId !== scEvent.id))) {
|
|
55
|
+
fetchEvent()
|
|
56
|
+
.then((obj) => {
|
|
57
|
+
setSCEvent(obj);
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
utils_1.LRUCache.delete(__eventCacheKey);
|
|
61
|
+
setError(`Event with id ${id} not found`);
|
|
62
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, `Event with id ${id} not found`);
|
|
63
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, err.message);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, [__eventId, authUserId]);
|
|
67
|
+
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
68
|
+
if (event) {
|
|
69
|
+
setSCEvent(event);
|
|
70
|
+
}
|
|
71
|
+
}, [event, authUserId]);
|
|
72
|
+
return { scEvent, setSCEvent, error };
|
|
73
|
+
}
|
|
74
|
+
exports.default = useSCFetchEvent;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ import useSCFetchUserBlockedBy from './hooks/useSCFetchUserBlockedBy';
|
|
|
62
62
|
import useSCUserIsBlocked from './hooks/useSCUserIsBlocked';
|
|
63
63
|
import useSCFetchGroup from './hooks/useSCFetchGroup';
|
|
64
64
|
import useSCFetchGroups from './hooks/useSCFetchGroups';
|
|
65
|
+
import useSCFetchEvent from './hooks/useSCFetchEvent';
|
|
65
66
|
/**
|
|
66
67
|
* Routing component
|
|
67
68
|
*/
|
|
@@ -81,4 +82,4 @@ import * as Locale from './constants/Locale';
|
|
|
81
82
|
/**
|
|
82
83
|
* List all exports
|
|
83
84
|
*/
|
|
84
|
-
export { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCSettingsManagerType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, Locale, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, };
|
|
85
|
+
export { SCUserContextType, SCFollowedCategoriesManagerType, SCContextProviderType, SCContextType, SCSettingsType, SCSessionType, SCSettingsManagerType, SCFollowedManagerType, SCFollowersManagerType, SCConnectionsManagerType, SCSubscribedIncubatorsManagerType, SCLocaleType, SCNotificationContextType, SCPreferencesContextType, SCThemeContextType, SCRoutingContextType, SCLocaleContextType, SCAlertMessagesContextType, SCThemeAvatarVariableType, SCThemeCategoryIconVariableType, SCThemeCategoryVariableType, SCThemeVariablesType, SCThemeType, SCSubscribedGroupsManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, Locale, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent };
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIsComponentMountedRef = exports.useSCFetchFeed = exports.useSCFetchContributors = exports.useSCMediaClick = exports.useSCFetchIncubator = exports.useSCFetchCategories = exports.useSCFetchCategory = exports.useSCFetchAddressingTagList = exports.useSCFetchTag = exports.useSCFetchCustomAdv = exports.useSCFetchCommentObjects = exports.useSCFetchCommentObject = exports.useSCFetchFeedObject = exports.useSCFetchVote = exports.useSCFetchUserProviders = exports.useSCFetchUser = exports.Locale = exports.UserUtils = exports.SCCache = exports.SCRoutes = exports.Link = exports.useSCAlertMessages = exports.SCAlertMessagesContext = exports.SCAlertMessagesProvider = exports.useSCNotification = exports.SCNotificationContext = exports.SCNotificationProvider = exports.SCNotification = exports.SCFeatures = exports.SCPreferences = exports.SCPreferencesProvider = exports.withSCLocale = exports.useSCLocale = exports.SCLocaleProvider = exports.useSCRouting = exports.SCRoutingProvider = exports.withSCTheme = exports.useSCTheme = exports.SCThemeProvider = exports.useSCPreferences = exports.useSCUser = exports.SCUserProvider = exports.SCContextProvider = exports.useSCContext = exports.SCPreferencesContext = exports.SCLocaleContext = exports.SCRoutingContext = exports.SCThemeContext = exports.SCUserContext = exports.SCContext = void 0;
|
|
4
|
-
exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = void 0;
|
|
4
|
+
exports.useSCFetchEvent = exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
/**
|
|
7
7
|
* ContextProvider component
|
|
@@ -114,6 +114,8 @@ const useSCFetchGroup_1 = tslib_1.__importDefault(require("./hooks/useSCFetchGro
|
|
|
114
114
|
exports.useSCFetchGroup = useSCFetchGroup_1.default;
|
|
115
115
|
const useSCFetchGroups_1 = tslib_1.__importDefault(require("./hooks/useSCFetchGroups"));
|
|
116
116
|
exports.useSCFetchGroups = useSCFetchGroups_1.default;
|
|
117
|
+
const useSCFetchEvent_1 = tslib_1.__importDefault(require("./hooks/useSCFetchEvent"));
|
|
118
|
+
exports.useSCFetchEvent = useSCFetchEvent_1.default;
|
|
117
119
|
/**
|
|
118
120
|
* Routing component
|
|
119
121
|
*/
|
|
@@ -37,6 +37,10 @@ export interface SCSettingsType {
|
|
|
37
37
|
* Object conf of notification.
|
|
38
38
|
*/
|
|
39
39
|
notifications?: SCNotificationsType;
|
|
40
|
+
/**
|
|
41
|
+
* Integrations conf
|
|
42
|
+
*/
|
|
43
|
+
integrations?: SCIntegrationsType;
|
|
40
44
|
/**
|
|
41
45
|
* Callback to handle anonymous action
|
|
42
46
|
* Ex. an anonymous user attempt to post a comment
|
|
@@ -620,3 +624,36 @@ export interface SCAlertMessagesContextType {
|
|
|
620
624
|
*/
|
|
621
625
|
setOptions: (options: any) => void;
|
|
622
626
|
}
|
|
627
|
+
/**
|
|
628
|
+
* Interface SCIntegrationsType
|
|
629
|
+
*/
|
|
630
|
+
export interface SCIntegrationsType {
|
|
631
|
+
/**
|
|
632
|
+
* OpenAI
|
|
633
|
+
*/
|
|
634
|
+
openai?: SCIntegrationsOpenAIType;
|
|
635
|
+
/**
|
|
636
|
+
* Geocoding
|
|
637
|
+
*/
|
|
638
|
+
geocoding?: SCGeocodingType;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Interface SCIntegrationsOpenAIType
|
|
642
|
+
*/
|
|
643
|
+
export interface SCIntegrationsOpenAIType {
|
|
644
|
+
/**
|
|
645
|
+
* Set secretKey OpenAI
|
|
646
|
+
* Default: null
|
|
647
|
+
*/
|
|
648
|
+
secretKey: string | null;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Interface SCGeocodingType
|
|
652
|
+
*/
|
|
653
|
+
export interface SCGeocodingType {
|
|
654
|
+
/**
|
|
655
|
+
* Set secretKey geocoding service
|
|
656
|
+
* Default: null
|
|
657
|
+
*/
|
|
658
|
+
apiKey: string | null;
|
|
659
|
+
}
|
|
@@ -21,6 +21,7 @@ export declare class ValidationError {
|
|
|
21
21
|
static ERROR_INVALID_NOTIFICATIONS_WEBSOCKET: number;
|
|
22
22
|
static ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_DISABLE_TOAST_MESSAGE: number;
|
|
23
23
|
static ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE: number;
|
|
24
|
+
static ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_PREFIX_PATH: number;
|
|
24
25
|
static ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING: number;
|
|
25
26
|
static ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_DISABLE_TOAST_MESSAGE: number;
|
|
26
27
|
static ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_APPLICATION_SERVER_KEY: number;
|
|
@@ -32,6 +33,11 @@ export declare class ValidationError {
|
|
|
32
33
|
static ERROR_INVALID_VOTE: number;
|
|
33
34
|
static ERROR_INVALID_VOTE_REACTIONS: number;
|
|
34
35
|
static ERROR_INVALID_VOTE_REACTIONS_STRUCTURE: number;
|
|
36
|
+
static ERROR_INVALID_INTEGRATIONS: number;
|
|
37
|
+
static ERROR_INVALID_INTEGRATIONS_OPENAI: number;
|
|
38
|
+
static ERROR_INVALID_INTEGRATIONS_OPENAI_SECRETKEY: number;
|
|
39
|
+
static ERROR_INVALID_INTEGRATIONS_GEOCODING: number;
|
|
40
|
+
static ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY: number;
|
|
35
41
|
static defaultErrorMessageMap: {
|
|
36
42
|
[x: number]: string;
|
|
37
43
|
};
|
package/lib/cjs/utils/errors.js
CHANGED
|
@@ -38,6 +38,7 @@ ValidationError.ERROR_INVALID_NOTIFICATIONS = 4900;
|
|
|
38
38
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET = 4901;
|
|
39
39
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_DISABLE_TOAST_MESSAGE = 4902;
|
|
40
40
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE = 4903;
|
|
41
|
+
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_PREFIX_PATH = 4904;
|
|
41
42
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING = 4921;
|
|
42
43
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_DISABLE_TOAST_MESSAGE = 4922;
|
|
43
44
|
ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_APPLICATION_SERVER_KEY = 4923;
|
|
@@ -49,6 +50,11 @@ ValidationError.ERROR_INVALID_PREFERENCES_FEATURES = 5002;
|
|
|
49
50
|
ValidationError.ERROR_INVALID_VOTE = 6000;
|
|
50
51
|
ValidationError.ERROR_INVALID_VOTE_REACTIONS = 6001;
|
|
51
52
|
ValidationError.ERROR_INVALID_VOTE_REACTIONS_STRUCTURE = 6002;
|
|
53
|
+
ValidationError.ERROR_INVALID_INTEGRATIONS = 6100;
|
|
54
|
+
ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI = 6101;
|
|
55
|
+
ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI_SECRETKEY = 6102;
|
|
56
|
+
ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING = 6103;
|
|
57
|
+
ValidationError.ERROR_INVALID_INTEGRATIONS_GEOCODING_APIKEY = 6104;
|
|
52
58
|
ValidationError.defaultErrorMessageMap = {
|
|
53
59
|
[ValidationError.ERROR_INVALID_CONF]: 'Invalid or missing library configuration. Check the configuration that is passed to the SCContextProvider.',
|
|
54
60
|
[ValidationError.ERROR_INVALID_SESSION]: 'Invalid session format.',
|
|
@@ -68,6 +74,7 @@ ValidationError.defaultErrorMessageMap = {
|
|
|
68
74
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET]: 'Invalid notifications (websocket) option.',
|
|
69
75
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_DISABLE_TOAST_MESSAGE]: 'Invalid notifications websocket conf: disableToastMessage must be a boolean value.',
|
|
70
76
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_SECURE]: 'Invalid notifications websocket conf: secure must be a boolean value.',
|
|
77
|
+
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEBSOCKET_PREFIX_PATH]: 'Invalid notifications websocket conf: prefixPath must be a string value.',
|
|
71
78
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING]: 'Invalid notifications (web push messaging) option.',
|
|
72
79
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_DISABLE_TOAST_MESSAGE]: "Invalid notifications web push messaging option. 'disableToastMessage' must be a boolean value.",
|
|
73
80
|
[ValidationError.ERROR_INVALID_NOTIFICATIONS_WEB_PUSH_MESSAGING_APPLICATION_SERVER_KEY]: "Invalid notifications web push messaging option. 'applicationServerKey' must be a string value.",
|
|
@@ -79,6 +86,11 @@ ValidationError.defaultErrorMessageMap = {
|
|
|
79
86
|
[ValidationError.ERROR_INVALID_VOTE]: 'Invalid vote option.',
|
|
80
87
|
[ValidationError.ERROR_INVALID_VOTE_REACTIONS]: "Invalid vote option. 'reactions' must be a valid array of reaction objects.",
|
|
81
88
|
[ValidationError.ERROR_INVALID_VOTE_REACTIONS_STRUCTURE]: "Invalid vote option. 'reactions' must be a valid array of reaction with attributes (id, label, sentiment, image, active).",
|
|
89
|
+
[ValidationError.ERROR_INVALID_INTEGRATIONS]: 'Invalid integrations conf.',
|
|
90
|
+
[ValidationError.ERROR_INVALID_INTEGRATIONS_OPENAI]: 'Invalid integrations (openai) option.',
|
|
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.',
|
|
82
94
|
};
|
|
83
95
|
/**
|
|
84
96
|
* Manage Validation Warnings
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const react_1 = require("react");
|
|
4
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
4
5
|
// Ensure that the SSR uses React.useEffect instead of React.useLayoutEffect
|
|
5
6
|
// because document is undefined on the server-side.
|
|
6
|
-
const useIsomorphicLayoutEffect =
|
|
7
|
+
const useIsomorphicLayoutEffect = (0, utils_1.isClientSideRendering)() ? react_1.useLayoutEffect : react_1.useEffect;
|
|
7
8
|
exports.default = useIsomorphicLayoutEffect;
|
|
@@ -7,7 +7,7 @@ const utils_1 = require("@selfcommunity/utils");
|
|
|
7
7
|
* Check if mobile native push notification is enabled
|
|
8
8
|
*/
|
|
9
9
|
function isMobileNativeNotificationEnabled() {
|
|
10
|
-
return ((
|
|
10
|
+
return (((0, utils_1.isClientSideRendering)() && window[Device_1.PLATFORM_KEY] && window[Device_1.PLATFORM_KEY] in Device_1.PLATFORM) ||
|
|
11
11
|
(utils_1.LocalStorageDB.checkifSupport() && utils_1.LocalStorageDB.get(Device_1.PLATFORM_KEY) && Device_1.PLATFORMS.includes(utils_1.LocalStorageDB.get(Device_1.PLATFORM_KEY))));
|
|
12
12
|
}
|
|
13
13
|
exports.isMobileNativeNotificationEnabled = isMobileNativeNotificationEnabled;
|