@selfcommunity/react-core 0.4.50-events.83 → 0.4.50-events.85
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/hooks/useSCSubscribedEventsManager.d.ts +1 -1
- package/lib/cjs/hooks/useSCSubscribedEventsManager.js +6 -6
- package/lib/esm/hooks/useSCSubscribedEventsManager.d.ts +1 -1
- package/lib/esm/hooks/useSCSubscribedEventsManager.js +6 -6
- package/lib/umd/react-core.js +1 -1
- package/package.json +6 -6
|
@@ -32,7 +32,7 @@ export default function useSCSubscribedEventsManager(user?: SCUserType): {
|
|
|
32
32
|
}) => boolean;
|
|
33
33
|
toggleEventAttendance: (event: SCEventType, userId?: number) => Promise<any>;
|
|
34
34
|
toggleEventNonattendance: (event: SCEventType) => Promise<any>;
|
|
35
|
-
subscriptionStatus: (event
|
|
35
|
+
subscriptionStatus: (event?: SCEventType) => string;
|
|
36
36
|
refresh: () => void;
|
|
37
37
|
emptyCache: () => void;
|
|
38
38
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const react_1 = require("react");
|
|
5
4
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
6
5
|
const types_1 = require("@selfcommunity/types");
|
|
7
|
-
const useSCCachingManager_1 = tslib_1.__importDefault(require("./useSCCachingManager"));
|
|
8
|
-
const Errors_1 = require("../constants/Errors");
|
|
9
6
|
const utils_1 = require("@selfcommunity/utils");
|
|
7
|
+
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
10
10
|
const SCPreferencesProvider_1 = require("../components/provider/SCPreferencesProvider");
|
|
11
|
+
const Errors_1 = require("../constants/Errors");
|
|
11
12
|
const Notification_1 = require("../constants/Notification");
|
|
12
|
-
const
|
|
13
|
-
const pubsub_js_1 = tslib_1.__importDefault(require("pubsub-js"));
|
|
13
|
+
const useSCCachingManager_1 = tslib_1.__importDefault(require("./useSCCachingManager"));
|
|
14
14
|
/**
|
|
15
15
|
:::info
|
|
16
16
|
This custom hook is used to manage the events followed.
|
|
@@ -276,7 +276,7 @@ function useSCSubscribedEventsManager(user) {
|
|
|
276
276
|
if (cache.includes(event === null || event === void 0 ? void 0 : event.id)) {
|
|
277
277
|
return getCurrentEventCacheStatus(event);
|
|
278
278
|
}
|
|
279
|
-
if (authUserId) {
|
|
279
|
+
if (authUserId && event) {
|
|
280
280
|
if ('subscription_status' in event) {
|
|
281
281
|
return getSubscriptionStatus(event);
|
|
282
282
|
}
|
|
@@ -32,7 +32,7 @@ export default function useSCSubscribedEventsManager(user?: SCUserType): {
|
|
|
32
32
|
}) => boolean;
|
|
33
33
|
toggleEventAttendance: (event: SCEventType, userId?: number) => Promise<any>;
|
|
34
34
|
toggleEventNonattendance: (event: SCEventType) => Promise<any>;
|
|
35
|
-
subscriptionStatus: (event
|
|
35
|
+
subscriptionStatus: (event?: SCEventType) => string;
|
|
36
36
|
refresh: () => void;
|
|
37
37
|
emptyCache: () => void;
|
|
38
38
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
2
1
|
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
3
2
|
import { SCEventPrivacyType, SCEventSubscriptionStatusType, SCFeatureName, SCNotificationTopicType, SCNotificationTypologyType, } from '@selfcommunity/types';
|
|
4
|
-
import useSCCachingManager from './useSCCachingManager';
|
|
5
|
-
import { SCOPE_SC_CORE } from '../constants/Errors';
|
|
6
3
|
import { Logger } from '@selfcommunity/utils';
|
|
4
|
+
import PubSub from 'pubsub-js';
|
|
5
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
6
|
+
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
7
7
|
import { useSCPreferences } from '../components/provider/SCPreferencesProvider';
|
|
8
|
+
import { SCOPE_SC_CORE } from '../constants/Errors';
|
|
8
9
|
import { SCNotificationMapping } from '../constants/Notification';
|
|
9
|
-
import
|
|
10
|
-
import PubSub from 'pubsub-js';
|
|
10
|
+
import useSCCachingManager from './useSCCachingManager';
|
|
11
11
|
/**
|
|
12
12
|
:::info
|
|
13
13
|
This custom hook is used to manage the events followed.
|
|
@@ -273,7 +273,7 @@ export default function useSCSubscribedEventsManager(user) {
|
|
|
273
273
|
if (cache.includes(event === null || event === void 0 ? void 0 : event.id)) {
|
|
274
274
|
return getCurrentEventCacheStatus(event);
|
|
275
275
|
}
|
|
276
|
-
if (authUserId) {
|
|
276
|
+
if (authUserId && event) {
|
|
277
277
|
if ('subscription_status' in event) {
|
|
278
278
|
return getSubscriptionStatus(event);
|
|
279
279
|
}
|