@selfcommunity/react-core 0.6.7-payments.182 → 0.6.7-payments.184
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/SCThemeProvider/index.js +3 -3
- package/lib/cjs/constants/Cache.d.ts +4 -1
- package/lib/cjs/constants/Cache.js +6 -2
- package/lib/cjs/constants/Routes.d.ts +1 -0
- package/lib/cjs/constants/Routes.js +4 -2
- package/lib/cjs/hooks/useSCFetchPaymentOrder.d.ts +20 -0
- package/lib/cjs/hooks/useSCFetchPaymentOrder.js +70 -0
- package/lib/cjs/hooks/useSCJoinedCoursesManager.js +8 -8
- package/lib/cjs/hooks/useSCSubscribedEventsManager.js +6 -6
- package/lib/cjs/hooks/useSCSubscribedGroupsManager.js +8 -8
- package/lib/cjs/hooks/useSCWebPushMessaging.js +2 -2
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +4 -1
- package/lib/cjs/themes/theme.js +2 -2
- package/lib/cjs/types/theme.d.ts +1 -1
- package/lib/cjs/utils/hooks/index.d.ts +2 -1
- package/lib/cjs/utils/hooks/index.js +3 -1
- package/lib/cjs/utils/hooks/useResizeObserver.d.ts +1 -0
- package/lib/cjs/utils/hooks/useResizeObserver.js +16 -0
- package/lib/esm/components/provider/SCThemeProvider/index.js +1 -1
- package/lib/esm/constants/Cache.d.ts +4 -1
- package/lib/esm/constants/Cache.js +4 -1
- package/lib/esm/constants/Routes.d.ts +1 -0
- package/lib/esm/constants/Routes.js +2 -0
- package/lib/esm/hooks/useSCFetchPaymentOrder.d.ts +20 -0
- package/lib/esm/hooks/useSCFetchPaymentOrder.js +67 -0
- package/lib/esm/hooks/useSCJoinedCoursesManager.js +7 -7
- package/lib/esm/hooks/useSCSubscribedEventsManager.js +5 -5
- package/lib/esm/hooks/useSCSubscribedGroupsManager.js +7 -7
- package/lib/esm/hooks/useSCWebPushMessaging.js +1 -1
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +3 -2
- package/lib/esm/themes/theme.js +1 -1
- package/lib/esm/types/theme.d.ts +1 -1
- package/lib/esm/utils/hooks/index.d.ts +2 -1
- package/lib/esm/utils/hooks/index.js +2 -1
- package/lib/esm/utils/hooks/useResizeObserver.d.ts +1 -0
- package/lib/esm/utils/hooks/useResizeObserver.js +13 -0
- package/lib/umd/react-core.js +1 -1
- package/package.json +5 -5
|
@@ -63,12 +63,12 @@ export default function useSCJoinedCoursesManager(user) {
|
|
|
63
63
|
case SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE:
|
|
64
64
|
_status = SCCourseJoinStatusType.INVITED;
|
|
65
65
|
break;
|
|
66
|
-
case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
67
|
+
_status = SCCourseJoinStatusType.REQUESTED;
|
|
68
|
+
break;
|
|
69
69
|
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE:
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
_status = SCCourseJoinStatusType.JOINED;
|
|
71
|
+
break; */
|
|
72
72
|
case SCNotificationTypologyType.USER_ADDED_TO_COURSE:
|
|
73
73
|
_status = SCCourseJoinStatusType.JOINED;
|
|
74
74
|
break;
|
|
@@ -247,7 +247,7 @@ export default function useSCJoinedCoursesManager(user) {
|
|
|
247
247
|
if (cache.includes(course.id)) {
|
|
248
248
|
return getCurrentCourseCacheStatus(course);
|
|
249
249
|
}
|
|
250
|
-
if (authUserId) {
|
|
250
|
+
if (authUserId && course) {
|
|
251
251
|
if ('join_status' in course) {
|
|
252
252
|
return getJoinStatus(course);
|
|
253
253
|
}
|
|
@@ -256,7 +256,7 @@ export default function useSCJoinedCoursesManager(user) {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
return null;
|
|
259
|
-
}, [loading, cache, authUserId]);
|
|
259
|
+
}, [loading, cache, authUserId, getJoinStatus, getCurrentCourseCacheStatus]);
|
|
260
260
|
/**
|
|
261
261
|
* Empty cache on logout
|
|
262
262
|
*/
|
|
@@ -64,12 +64,12 @@ export default function useSCSubscribedEventsManager(user) {
|
|
|
64
64
|
case SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT:
|
|
65
65
|
_status = SCEventSubscriptionStatusType.INVITED;
|
|
66
66
|
break;
|
|
67
|
-
case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT:
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT:
|
|
68
|
+
_status = SCEventSubscriptionStatusType.REQUESTED;
|
|
69
|
+
break;
|
|
70
70
|
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT:
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
_status = SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
72
|
+
break; */
|
|
73
73
|
case SCNotificationTypologyType.USER_ADDED_TO_EVENT:
|
|
74
74
|
_status = SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
75
75
|
break;
|
|
@@ -64,12 +64,12 @@ export default function useSCSubscribedGroupsManager(user) {
|
|
|
64
64
|
case SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP:
|
|
65
65
|
_status = SCGroupSubscriptionStatusType.INVITED;
|
|
66
66
|
break;
|
|
67
|
-
case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP:
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP:
|
|
68
|
+
_status = SCGroupSubscriptionStatusType.REQUESTED;
|
|
69
|
+
break;
|
|
70
70
|
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP:
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
_status = SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
72
|
+
break; */
|
|
73
73
|
case SCNotificationTypologyType.USER_ADDED_TO_GROUP:
|
|
74
74
|
_status = SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
75
75
|
break;
|
|
@@ -248,7 +248,7 @@ export default function useSCSubscribedGroupsManager(user) {
|
|
|
248
248
|
if (cache.includes(group.id)) {
|
|
249
249
|
return getCurrentGroupCacheStatus(group);
|
|
250
250
|
}
|
|
251
|
-
if (authUserId) {
|
|
251
|
+
if (authUserId && group) {
|
|
252
252
|
if ('subscription_status' in group) {
|
|
253
253
|
return getSubscriptionStatus(group);
|
|
254
254
|
}
|
|
@@ -257,7 +257,7 @@ export default function useSCSubscribedGroupsManager(user) {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
return null;
|
|
260
|
-
}, [loading, cache, authUserId]);
|
|
260
|
+
}, [loading, cache, authUserId, getSubscriptionStatus, getCurrentGroupCacheStatus]);
|
|
261
261
|
/**
|
|
262
262
|
* Empty cache on logout
|
|
263
263
|
*/
|
|
@@ -3,7 +3,7 @@ import { useContext, useEffect, useRef, useState } from 'react';
|
|
|
3
3
|
import { useSCContext } from '../components/provider/SCContextProvider';
|
|
4
4
|
import { useSCUser } from '../components/provider/SCUserProvider';
|
|
5
5
|
import { Logger } from '@selfcommunity/utils';
|
|
6
|
-
import Button from '@mui/material
|
|
6
|
+
import { Button } from '@mui/material';
|
|
7
7
|
import { loadVersionBrowser, urlB64ToUint8Array } from '@selfcommunity/utils';
|
|
8
8
|
import { SCOPE_SC_CORE } from '../constants/Errors';
|
|
9
9
|
import { http, Endpoints } from '@selfcommunity/api-services';
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ import useSCFetchCourses from './hooks/useSCFetchCourses';
|
|
|
73
73
|
import useSCFetchLesson from './hooks/useSCFetchLesson';
|
|
74
74
|
import useSCPaymentsEnabled from './hooks/useSCPaymentsEnabled';
|
|
75
75
|
import useSCFetchPaymentProduct from './hooks/useSCFetchPaymentProduct';
|
|
76
|
+
import useSCFetchPaymentOrder from './hooks/useSCFetchPaymentOrder';
|
|
76
77
|
/**
|
|
77
78
|
* Routing component
|
|
78
79
|
*/
|
|
@@ -84,7 +85,7 @@ import * as SCRoutes from './constants/Routes';
|
|
|
84
85
|
*/
|
|
85
86
|
import * as UserUtils from './utils/user';
|
|
86
87
|
import getTheme from './themes/theme';
|
|
87
|
-
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility } from './utils/hooks';
|
|
88
|
+
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver } from './utils/hooks';
|
|
88
89
|
import { getEventStatus } from './utils/event';
|
|
89
90
|
/**
|
|
90
91
|
* Constants:
|
|
@@ -95,4 +96,4 @@ import * as Preferences from './constants/Preferences';
|
|
|
95
96
|
/**
|
|
96
97
|
* List all exports
|
|
97
98
|
*/
|
|
98
|
-
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, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, useSCPaymentsEnabled, useSCFetchPaymentProduct, };
|
|
99
|
+
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, SCSubscribedEventsManagerType, SCJoinedCoursesManagerType, SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, useSCPaymentsEnabled, useSCFetchPaymentProduct, useSCFetchPaymentOrder, };
|
package/lib/esm/index.js
CHANGED
|
@@ -69,6 +69,7 @@ import useSCFetchCourses from './hooks/useSCFetchCourses';
|
|
|
69
69
|
import useSCFetchLesson from './hooks/useSCFetchLesson';
|
|
70
70
|
import useSCPaymentsEnabled from './hooks/useSCPaymentsEnabled';
|
|
71
71
|
import useSCFetchPaymentProduct from './hooks/useSCFetchPaymentProduct';
|
|
72
|
+
import useSCFetchPaymentOrder from './hooks/useSCFetchPaymentOrder';
|
|
72
73
|
/**
|
|
73
74
|
* Routing component
|
|
74
75
|
*/
|
|
@@ -80,7 +81,7 @@ import * as SCRoutes from './constants/Routes';
|
|
|
80
81
|
*/
|
|
81
82
|
import * as UserUtils from './utils/user';
|
|
82
83
|
import getTheme from './themes/theme';
|
|
83
|
-
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, } from './utils/hooks';
|
|
84
|
+
import { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver } from './utils/hooks';
|
|
84
85
|
import { getEventStatus } from './utils/event';
|
|
85
86
|
/**
|
|
86
87
|
* Constants:
|
|
@@ -91,4 +92,4 @@ import * as Preferences from './constants/Preferences';
|
|
|
91
92
|
/**
|
|
92
93
|
* List all exports
|
|
93
94
|
*/
|
|
94
|
-
export { SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, useSCPaymentsEnabled, useSCFetchPaymentProduct, };
|
|
95
|
+
export { SCContext, SCUserContext, SCThemeContext, SCRoutingContext, SCLocaleContext, SCPreferencesContext, useSCContext, SCContextProvider, SCUserProvider, useSCUser, useSCPreferences, SCThemeProvider, useSCTheme, withSCTheme, getTheme, SCRoutingProvider, useSCRouting, SCLocaleProvider, useSCLocale, withSCLocale, SCPreferencesProvider, SCPreferences, SCFeatures, SCNotification, SCNotificationProvider, SCNotificationContext, useSCNotification, SCAlertMessagesProvider, SCAlertMessagesContext, useSCAlertMessages, Link, SCRoutes, SCCache, UserUtils, getEventStatus, Locale, Preferences, useSCFetchUser, useSCFetchUserProviders, useSCFetchVote, useSCFetchFeedObject, useSCFetchCommentObject, useSCFetchCommentObjects, useSCFetchLessonCommentObject, useSCFetchLessonCommentObjects, useSCFetchCustomAdv, useSCFetchTag, useSCFetchAddressingTagList, useSCFetchCategory, useSCFetchCategories, useSCFetchIncubator, useSCMediaClick, useSCFetchContributors, useSCFetchFeed, useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, useSCFetchPrivateMessageSnippets, useSCFetchBroadcastMessages, useSCFetchUserBlockedBy, useSCUserIsBlocked, useSCFetchGroup, useSCFetchGroups, useSCFetchEvent, useSCFetchEvents, useSCFetchLiveStream, useSCGoogleApiLoader, useSCFetchCourse, useSCFetchCourses, useSCFetchLesson, useSCPaymentsEnabled, useSCFetchPaymentProduct, useSCFetchPaymentOrder, };
|
package/lib/esm/themes/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import createTheme from '@mui/material
|
|
1
|
+
import { createTheme } from '@mui/material';
|
|
2
2
|
import { mergeDeep } from '@selfcommunity/utils';
|
|
3
3
|
import validateColor from 'validate-color';
|
|
4
4
|
import { COLORS_COLORBACK, COLORS_COLORPRIMARY, COLORS_COLORSECONDARY, COLORS_COLORFONT, COLORS_COLORFONTSECONDARY, COLORS_NAVBARBACK, STYLE_FONT_FAMILY, } from '../constants/Preferences';
|
package/lib/esm/types/theme.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
|
|
|
4
4
|
import useEffectOnce from './useEffectOnce';
|
|
5
5
|
import useNoInitialEffect from './useNoInitialEffect';
|
|
6
6
|
import usePageVisibility from './usePageVisibility';
|
|
7
|
-
|
|
7
|
+
import useResizeObserver from './useResizeObserver';
|
|
8
|
+
export { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, };
|
|
@@ -4,4 +4,5 @@ import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
|
|
|
4
4
|
import useEffectOnce from './useEffectOnce';
|
|
5
5
|
import useNoInitialEffect from './useNoInitialEffect';
|
|
6
6
|
import usePageVisibility from './usePageVisibility';
|
|
7
|
-
|
|
7
|
+
import useResizeObserver from './useResizeObserver';
|
|
8
|
+
export { useIsComponentMountedRef, usePreviousValue, useIsomorphicLayoutEffect, useEffectOnce, useNoInitialEffect, usePageVisibility, useResizeObserver, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useResizeObserver(element: Element | null, options: ResizeObserverOptions | undefined, observerCallback: ResizeObserverCallback): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export default function useResizeObserver(element, options, observerCallback) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
if (!element || !('ResizeObserver' in window)) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
const observer = new ResizeObserver(observerCallback);
|
|
8
|
+
observer.observe(element, options);
|
|
9
|
+
return () => {
|
|
10
|
+
observer.disconnect();
|
|
11
|
+
};
|
|
12
|
+
}, [element, options, observerCallback]);
|
|
13
|
+
}
|