@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
|
@@ -4,7 +4,7 @@ exports.useSCTheme = exports.withSCTheme = exports.SCThemeContext = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const react_1 = require("react");
|
|
7
|
-
const
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
8
|
const theme_1 = tslib_1.__importDefault(require("../../../themes/theme"));
|
|
9
9
|
const SCContextProvider_1 = require("../SCContextProvider");
|
|
10
10
|
const SCPreferencesProvider_1 = require("../SCPreferencesProvider");
|
|
@@ -60,7 +60,7 @@ function SCThemeProvider({ children = null }) {
|
|
|
60
60
|
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
61
61
|
setCustomTheme(theme);
|
|
62
62
|
}, [scContext.settings.theme]);
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(exports.SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: (0, jsx_runtime_1.jsx)(
|
|
63
|
+
return ((0, jsx_runtime_1.jsx)(exports.SCThemeContext.Provider, Object.assign({ value: { theme, setTheme: setCustomTheme } }, { children: (0, jsx_runtime_1.jsx)(material_1.ThemeProvider, Object.assign({ theme: theme }, { children: children })) })));
|
|
64
64
|
}
|
|
65
65
|
exports.default = SCThemeProvider;
|
|
66
66
|
/**
|
|
@@ -69,7 +69,7 @@ exports.default = SCThemeProvider;
|
|
|
69
69
|
*/
|
|
70
70
|
const withSCTheme = (Component) => (props) => {
|
|
71
71
|
const scThemeContext = (0, react_1.useContext)(exports.SCThemeContext);
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, Object.assign({ theme: scThemeContext.theme }, { children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ setTheme: scThemeContext.setTheme }, props)) })));
|
|
73
73
|
};
|
|
74
74
|
exports.withSCTheme = withSCTheme;
|
|
75
75
|
/**
|
|
@@ -76,9 +76,12 @@ export declare const getPmSnippetsObjectCacheKey: () => string;
|
|
|
76
76
|
/** PRIVATE MESSAGE SNIPPET OBJECT **/
|
|
77
77
|
export declare const PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = "_pms_";
|
|
78
78
|
export declare const getPmSnippetObjectCacheKey: (id: any) => string;
|
|
79
|
-
/**
|
|
79
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
80
80
|
export declare const PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = "_ppo_";
|
|
81
81
|
export declare const getPaymentProductObjectCacheKey: (id: any) => string;
|
|
82
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
83
|
+
export declare const PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = "_pord_";
|
|
84
|
+
export declare const getPaymentOrderObjectCacheKey: (id: any) => string;
|
|
82
85
|
/** TOOLS */
|
|
83
86
|
export declare const CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = "_cListWidget_";
|
|
84
87
|
export declare const CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_cFolWidget_";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
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.getLiveStreamObjectCacheKey = exports.LIVESTREAM_OBJECT_CACHE_PREFIX_KEY = exports.getEventsObjectCacheKey = exports.EVENTS_OBJECT_CACHE_PREFIX_KEY = exports.getEventObjectCacheKey = exports.EVENT_OBJECT_CACHE_PREFIX_KEY = exports.getLessonObjectCacheKey = exports.LESSON_OBJECT_CACHE_PREFIX_KEY = exports.getCoursesObjectCacheKey = exports.COURSES_OBJECT_CACHE_PREFIX_KEY = exports.getCourseObjectCacheKey = exports.COURSE_OBJECT_CACHE_PREFIX_KEY = exports.getCategoryObjectCacheKey = exports.CATEGORY_OBJECT_CACHE_PREFIX_KEY = exports.getCategoriesObjectCacheKey = exports.CATEGORIES_OBJECT_CACHE_PREFIX_KEY = exports.getLessonCommentsCachePrefixKeys = exports.getLessonCommentsCacheKey = exports.LESSON_COMMENTS_CACHE_PREFIX_KEY = exports.getLessonCommentCacheKey = exports.LESSON_COMMENT_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 = 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.EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = exports.USER_LIVE_STREAM_CACHE_PREFIX_KEY = exports.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USERS_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.STUDENTS_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USERS_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_CREATED_COURSES_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.getPaymentProductObjectCacheKey = exports.PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetObjectCacheKey = exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetsObjectCacheKey = 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 = 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.EVENT_MEDIA_STATE_CACHE_PREFIX_KEY = exports.USER_LIVE_STREAM_CACHE_PREFIX_KEY = exports.USER_REQUESTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_INVITED_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_COMMENTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USERS_REQUESTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.STUDENTS_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USERS_PARTECIPANTS_COURSES_STATE_CACHE_PREFIX_KEY = exports.USER_PARTECIPANTS_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_OTHER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_EVENTS_STATE_CACHE_PREFIX_KEY = exports.USER_CREATED_COURSES_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.getPaymentOrderObjectCacheKey = exports.PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = exports.getPaymentProductObjectCacheKey = exports.PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetObjectCacheKey = exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = exports.getPmSnippetsObjectCacheKey = 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}`;
|
|
@@ -112,10 +112,14 @@ exports.getPmSnippetsObjectCacheKey = getPmSnippetsObjectCacheKey;
|
|
|
112
112
|
exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = '_pms_';
|
|
113
113
|
const getPmSnippetObjectCacheKey = (id) => `${exports.PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
114
114
|
exports.getPmSnippetObjectCacheKey = getPmSnippetObjectCacheKey;
|
|
115
|
-
/**
|
|
115
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
116
116
|
exports.PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = '_ppo_';
|
|
117
117
|
const getPaymentProductObjectCacheKey = (id) => `${exports.PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
118
118
|
exports.getPaymentProductObjectCacheKey = getPaymentProductObjectCacheKey;
|
|
119
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
120
|
+
exports.PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = '_pord_';
|
|
121
|
+
const getPaymentOrderObjectCacheKey = (id) => `${exports.PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
122
|
+
exports.getPaymentOrderObjectCacheKey = getPaymentOrderObjectCacheKey;
|
|
119
123
|
/** TOOLS */
|
|
120
124
|
exports.CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = '_cListWidget_';
|
|
121
125
|
exports.CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_cFolWidget_';
|
|
@@ -25,6 +25,7 @@ export declare const USER_PROFILE_CATEGORIES_ROUTE_NAME = "user_categories";
|
|
|
25
25
|
export declare const USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = "user_followed_posts";
|
|
26
26
|
export declare const USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = "user_followed_discussions";
|
|
27
27
|
export declare const USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME = "user_payments_history_orders";
|
|
28
|
+
export declare const USER_PAYMENTS_ORDER_PDF_ROUTE_NAME = "user_payments_order_pdf";
|
|
28
29
|
export declare const USER_PAYMENT_METHODS_ROUTE_NAME = "user_payment_methods";
|
|
29
30
|
export declare const LOYALTY_ROUTE_NAME = "loyalty";
|
|
30
31
|
export declare const INCUBATOR_ROUTE_NAME = "incubator";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.defaultRoutes = exports.CHECKOUT_PAYMENT = exports.LIVESTREAM_ROUTE_NAME = void 0;
|
|
3
|
+
exports.EVENTS_SUBSCRIBED_ROUTE_NAME = exports.EVENTS_SUGGESTED_ROUTE_NAME = exports.COURSES_ROUTE_NAME = exports.COURSE_LESSON_COMMENTS_ROUTE_NAME = exports.COURSE_LESSON_EDIT_ROUTE_NAME = exports.COURSE_LESSON_PREVIEW_ROUTE_NAME = exports.COURSE_LESSON_ROUTE_NAME = exports.COURSE_DASHBOARD_ROUTE_NAME = exports.COURSE_EDIT_ROUTE_NAME = exports.COURSE_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_PAYMENT_METHODS_ROUTE_NAME = exports.USER_PAYMENTS_ORDER_PDF_ROUTE_NAME = exports.USER_PAYMENTS_HISTORY_ORDERS_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
|
+
exports.defaultRoutes = exports.CHECKOUT_PAYMENT = exports.LIVESTREAM_ROUTE_NAME = exports.EVENTS_HIGHLIGHT_ROUTE_NAME = void 0;
|
|
5
5
|
exports.PORTAL_OPTION = 'portal';
|
|
6
6
|
exports.ROUTER_OPTION = 'router';
|
|
7
7
|
/**
|
|
@@ -29,6 +29,7 @@ exports.USER_PROFILE_CATEGORIES_ROUTE_NAME = 'user_categories';
|
|
|
29
29
|
exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = 'user_followed_posts';
|
|
30
30
|
exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = 'user_followed_discussions';
|
|
31
31
|
exports.USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME = 'user_payments_history_orders';
|
|
32
|
+
exports.USER_PAYMENTS_ORDER_PDF_ROUTE_NAME = 'user_payments_order_pdf';
|
|
32
33
|
exports.USER_PAYMENT_METHODS_ROUTE_NAME = 'user_payment_methods';
|
|
33
34
|
exports.LOYALTY_ROUTE_NAME = 'loyalty';
|
|
34
35
|
exports.INCUBATOR_ROUTE_NAME = 'incubator';
|
|
@@ -84,6 +85,7 @@ exports.defaultRoutes = {
|
|
|
84
85
|
[exports.USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME]: '/user/:id/posts/followed/',
|
|
85
86
|
[exports.USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME]: '/user/:id/discussions/followed/',
|
|
86
87
|
[exports.USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME]: '/user/:id/:username/history_orders/',
|
|
88
|
+
[exports.USER_PAYMENTS_ORDER_PDF_ROUTE_NAME]: '/user/:id/:username/order/:pid/pdf/',
|
|
87
89
|
[exports.USER_PAYMENT_METHODS_ROUTE_NAME]: '/user/:id/:username/payment_methods/',
|
|
88
90
|
[exports.LOYALTY_ROUTE_NAME]: '/loyalty/',
|
|
89
91
|
[exports.INCUBATOR_ROUTE_NAME]: '/incubator/:id/',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SCPaymentOrder } from '@selfcommunity/types';
|
|
2
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
3
|
+
/**
|
|
4
|
+
:::info
|
|
5
|
+
This custom hook is used to fetch a payment order.
|
|
6
|
+
:::
|
|
7
|
+
* @param object
|
|
8
|
+
* @param object.id
|
|
9
|
+
* @param object.paymentOrder
|
|
10
|
+
* @param object.cacheStrategy
|
|
11
|
+
*/
|
|
12
|
+
export default function useSCFetchPaymentOrder({ id, paymentOrder, cacheStrategy, }: {
|
|
13
|
+
id?: number | string;
|
|
14
|
+
paymentOrder?: SCPaymentOrder;
|
|
15
|
+
cacheStrategy?: CacheStrategies;
|
|
16
|
+
}): {
|
|
17
|
+
scPaymentOrder: SCPaymentOrder;
|
|
18
|
+
setSCPaymentOrder: (c: SCPaymentOrder) => void;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const api_services_1 = require("@selfcommunity/api-services");
|
|
4
|
+
const utils_1 = require("@selfcommunity/utils");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const use_deep_compare_effect_1 = require("use-deep-compare-effect");
|
|
7
|
+
const SCUserProvider_1 = require("../components/provider/SCUserProvider");
|
|
8
|
+
const Cache_1 = require("../constants/Cache");
|
|
9
|
+
const Errors_1 = require("../constants/Errors");
|
|
10
|
+
/**
|
|
11
|
+
:::info
|
|
12
|
+
This custom hook is used to fetch a payment order.
|
|
13
|
+
:::
|
|
14
|
+
* @param object
|
|
15
|
+
* @param object.id
|
|
16
|
+
* @param object.paymentOrder
|
|
17
|
+
* @param object.cacheStrategy
|
|
18
|
+
*/
|
|
19
|
+
function useSCFetchPaymentOrder({ id = null, paymentOrder = null, cacheStrategy = utils_1.CacheStrategies.NETWORK_ONLY, }) {
|
|
20
|
+
const __paymentOrderId = (0, react_1.useMemo)(() => (paymentOrder === null || paymentOrder === void 0 ? void 0 : paymentOrder.id) || id, [paymentOrder, id]);
|
|
21
|
+
// CONTEXT
|
|
22
|
+
const scUserContext = (0, SCUserProvider_1.useSCUser)();
|
|
23
|
+
const authUserId = (0, react_1.useMemo)(() => { var _a; return ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) || null; }, [scUserContext.user]);
|
|
24
|
+
// CACHE
|
|
25
|
+
const __paymentOrderCacheKey = (0, react_1.useMemo)(() => (0, Cache_1.getPaymentOrderObjectCacheKey)(__paymentOrderId), [__paymentOrderId]);
|
|
26
|
+
const [scPaymentOrder, setScPaymentOrder] = (0, react_1.useState)(cacheStrategy !== utils_1.CacheStrategies.NETWORK_ONLY ? utils_1.LRUCache.get(__paymentOrderCacheKey, paymentOrder) : null);
|
|
27
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
28
|
+
const setSCPaymentOrder = (0, react_1.useCallback)((c) => {
|
|
29
|
+
setScPaymentOrder(c);
|
|
30
|
+
utils_1.LRUCache.set(__paymentOrderCacheKey, c);
|
|
31
|
+
}, [setScPaymentOrder, __paymentOrderCacheKey]);
|
|
32
|
+
/**
|
|
33
|
+
* Memoized fetch order
|
|
34
|
+
*/
|
|
35
|
+
const fetchPaymentOrder = (0, react_1.useMemo)(() => (id) => {
|
|
36
|
+
return api_services_1.http
|
|
37
|
+
.request({
|
|
38
|
+
url: api_services_1.Endpoints.GetPaymentOrder.url({ id }),
|
|
39
|
+
method: api_services_1.Endpoints.GetPaymentOrder.method,
|
|
40
|
+
})
|
|
41
|
+
.then((res) => {
|
|
42
|
+
if (res.status >= 300) {
|
|
43
|
+
return Promise.reject(res);
|
|
44
|
+
}
|
|
45
|
+
return Promise.resolve(res.data);
|
|
46
|
+
});
|
|
47
|
+
}, []);
|
|
48
|
+
/**
|
|
49
|
+
* If id attempt to get the course by id
|
|
50
|
+
*/
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
if (id !== null && id !== undefined && !paymentOrder) {
|
|
53
|
+
fetchPaymentOrder(id)
|
|
54
|
+
.then((e) => {
|
|
55
|
+
setSCPaymentOrder(e);
|
|
56
|
+
})
|
|
57
|
+
.catch((err) => {
|
|
58
|
+
utils_1.LRUCache.delete(__paymentOrderCacheKey);
|
|
59
|
+
utils_1.Logger.error(Errors_1.SCOPE_SC_CORE, err.message);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}, [id, paymentOrder, authUserId]);
|
|
63
|
+
(0, use_deep_compare_effect_1.useDeepCompareEffectNoCheck)(() => {
|
|
64
|
+
if (paymentOrder) {
|
|
65
|
+
setSCPaymentOrder(paymentOrder);
|
|
66
|
+
}
|
|
67
|
+
}, [paymentOrder, authUserId]);
|
|
68
|
+
return { scPaymentOrder, setSCPaymentOrder, error };
|
|
69
|
+
}
|
|
70
|
+
exports.default = useSCFetchPaymentOrder;
|
|
@@ -66,12 +66,12 @@ function useSCJoinedCoursesManager(user) {
|
|
|
66
66
|
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_COURSE:
|
|
67
67
|
_status = types_1.SCCourseJoinStatusType.INVITED;
|
|
68
68
|
break;
|
|
69
|
-
case
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
case
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_COURSE:
|
|
70
|
+
_status = SCCourseJoinStatusType.REQUESTED;
|
|
71
|
+
break;
|
|
72
|
+
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_COURSE:
|
|
73
|
+
_status = SCCourseJoinStatusType.JOINED;
|
|
74
|
+
break; */
|
|
75
75
|
case types_1.SCNotificationTypologyType.USER_ADDED_TO_COURSE:
|
|
76
76
|
_status = types_1.SCCourseJoinStatusType.JOINED;
|
|
77
77
|
break;
|
|
@@ -250,7 +250,7 @@ function useSCJoinedCoursesManager(user) {
|
|
|
250
250
|
if (cache.includes(course.id)) {
|
|
251
251
|
return getCurrentCourseCacheStatus(course);
|
|
252
252
|
}
|
|
253
|
-
if (authUserId) {
|
|
253
|
+
if (authUserId && course) {
|
|
254
254
|
if ('join_status' in course) {
|
|
255
255
|
return getJoinStatus(course);
|
|
256
256
|
}
|
|
@@ -259,7 +259,7 @@ function useSCJoinedCoursesManager(user) {
|
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
261
|
return null;
|
|
262
|
-
}, [loading, cache, authUserId]);
|
|
262
|
+
}, [loading, cache, authUserId, getJoinStatus, getCurrentCourseCacheStatus]);
|
|
263
263
|
/**
|
|
264
264
|
* Empty cache on logout
|
|
265
265
|
*/
|
|
@@ -67,12 +67,12 @@ function useSCSubscribedEventsManager(user) {
|
|
|
67
67
|
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_EVENT:
|
|
68
68
|
_status = types_1.SCEventSubscriptionStatusType.INVITED;
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
case
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_EVENT:
|
|
71
|
+
_status = SCEventSubscriptionStatusType.REQUESTED;
|
|
72
|
+
break;
|
|
73
|
+
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_EVENT:
|
|
74
|
+
_status = SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
75
|
+
break; */
|
|
76
76
|
case types_1.SCNotificationTypologyType.USER_ADDED_TO_EVENT:
|
|
77
77
|
_status = types_1.SCEventSubscriptionStatusType.SUBSCRIBED;
|
|
78
78
|
break;
|
|
@@ -67,12 +67,12 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
67
67
|
case types_1.SCNotificationTypologyType.USER_INVITED_TO_JOIN_GROUP:
|
|
68
68
|
_status = types_1.SCGroupSubscriptionStatusType.INVITED;
|
|
69
69
|
break;
|
|
70
|
-
case
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
case
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
/* case SCNotificationTypologyType.USER_REQUESTED_TO_JOIN_GROUP:
|
|
71
|
+
_status = SCGroupSubscriptionStatusType.REQUESTED;
|
|
72
|
+
break;
|
|
73
|
+
case SCNotificationTypologyType.USER_ACCEPTED_TO_JOIN_GROUP:
|
|
74
|
+
_status = SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
75
|
+
break; */
|
|
76
76
|
case types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP:
|
|
77
77
|
_status = types_1.SCGroupSubscriptionStatusType.SUBSCRIBED;
|
|
78
78
|
break;
|
|
@@ -251,7 +251,7 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
251
251
|
if (cache.includes(group.id)) {
|
|
252
252
|
return getCurrentGroupCacheStatus(group);
|
|
253
253
|
}
|
|
254
|
-
if (authUserId) {
|
|
254
|
+
if (authUserId && group) {
|
|
255
255
|
if ('subscription_status' in group) {
|
|
256
256
|
return getSubscriptionStatus(group);
|
|
257
257
|
}
|
|
@@ -260,7 +260,7 @@ function useSCSubscribedGroupsManager(user) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
return null;
|
|
263
|
-
}, [loading, cache, authUserId]);
|
|
263
|
+
}, [loading, cache, authUserId, getSubscriptionStatus, getCurrentGroupCacheStatus]);
|
|
264
264
|
/**
|
|
265
265
|
* Empty cache on logout
|
|
266
266
|
*/
|
|
@@ -7,7 +7,7 @@ const react_1 = require("react");
|
|
|
7
7
|
const SCContextProvider_1 = require("../components/provider/SCContextProvider");
|
|
8
8
|
const SCUserProvider_1 = require("../components/provider/SCUserProvider");
|
|
9
9
|
const utils_1 = require("@selfcommunity/utils");
|
|
10
|
-
const
|
|
10
|
+
const material_1 = require("@mui/material");
|
|
11
11
|
const utils_2 = require("@selfcommunity/utils");
|
|
12
12
|
const Errors_1 = require("../constants/Errors");
|
|
13
13
|
const api_services_1 = require("@selfcommunity/api-services");
|
|
@@ -61,7 +61,7 @@ function useSCWebPushMessaging() {
|
|
|
61
61
|
const showCustomRequestNotificationSnackbar = () => {
|
|
62
62
|
if (!js_cookie_1.default.get(Notifications_1.NOTIFICATIONS_WEB_PUSH_MESSAGING_DIALOG_COOKIE)) {
|
|
63
63
|
enqueueSnackbar(intl.formatMessage({ id: 'ui.webPushNotification.requestPermission', defaultMessage: 'ui.webPushNotification.requestPermission' }), {
|
|
64
|
-
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(
|
|
64
|
+
action: (snackbarId) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => requestNotificationPermission(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.allow', defaultMessage: 'ui.webPushNotification.allow' }) })), (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ size: "small", sx: { color: '#FFF' }, onClick: () => closeRequestNotificationSnackbar(snackbarId) }, { children: intl.formatMessage({ id: 'ui.webPushNotification.block', defaultMessage: 'ui.webPushNotification.block' }) }))] })),
|
|
65
65
|
variant: 'default',
|
|
66
66
|
anchorOrigin: { horizontal: 'center', vertical: 'bottom' },
|
|
67
67
|
preventDuplicate: true,
|
package/lib/cjs/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/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSCFetchCategories = exports.useSCFetchCategory = exports.useSCFetchAddressingTagList = exports.useSCFetchTag = exports.useSCFetchCustomAdv = exports.useSCFetchLessonCommentObjects = exports.useSCFetchLessonCommentObject = exports.useSCFetchCommentObjects = exports.useSCFetchCommentObject = exports.useSCFetchFeedObject = exports.useSCFetchVote = exports.useSCFetchUserProviders = exports.useSCFetchUser = exports.Preferences = exports.Locale = exports.getEventStatus = 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.getTheme = 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.useSCFetchPaymentProduct = exports.useSCPaymentsEnabled = exports.useSCFetchLesson = exports.useSCFetchCourses = exports.useSCFetchCourse = exports.useSCGoogleApiLoader = exports.useSCFetchLiveStream = exports.useSCFetchEvents = exports.useSCFetchEvent = exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = exports.useSCFetchFeed = exports.useSCFetchContributors = exports.useSCMediaClick = exports.useSCFetchIncubator = void 0;
|
|
4
|
+
exports.useSCFetchPaymentOrder = exports.useSCFetchPaymentProduct = exports.useSCPaymentsEnabled = exports.useSCFetchLesson = exports.useSCFetchCourses = exports.useSCFetchCourse = exports.useSCGoogleApiLoader = exports.useSCFetchLiveStream = exports.useSCFetchEvents = exports.useSCFetchEvent = exports.useSCFetchGroups = exports.useSCFetchGroup = exports.useSCUserIsBlocked = exports.useSCFetchUserBlockedBy = exports.useSCFetchBroadcastMessages = exports.useSCFetchPrivateMessageSnippets = exports.useResizeObserver = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = exports.useSCFetchFeed = exports.useSCFetchContributors = exports.useSCMediaClick = exports.useSCFetchIncubator = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
/**
|
|
7
7
|
* ContextProvider component
|
|
@@ -136,6 +136,8 @@ const useSCPaymentsEnabled_1 = tslib_1.__importDefault(require("./hooks/useSCPay
|
|
|
136
136
|
exports.useSCPaymentsEnabled = useSCPaymentsEnabled_1.default;
|
|
137
137
|
const useSCFetchPaymentProduct_1 = tslib_1.__importDefault(require("./hooks/useSCFetchPaymentProduct"));
|
|
138
138
|
exports.useSCFetchPaymentProduct = useSCFetchPaymentProduct_1.default;
|
|
139
|
+
const useSCFetchPaymentOrder_1 = tslib_1.__importDefault(require("./hooks/useSCFetchPaymentOrder"));
|
|
140
|
+
exports.useSCFetchPaymentOrder = useSCFetchPaymentOrder_1.default;
|
|
139
141
|
/**
|
|
140
142
|
* Routing component
|
|
141
143
|
*/
|
|
@@ -158,6 +160,7 @@ Object.defineProperty(exports, "useIsomorphicLayoutEffect", { enumerable: true,
|
|
|
158
160
|
Object.defineProperty(exports, "useEffectOnce", { enumerable: true, get: function () { return hooks_1.useEffectOnce; } });
|
|
159
161
|
Object.defineProperty(exports, "useNoInitialEffect", { enumerable: true, get: function () { return hooks_1.useNoInitialEffect; } });
|
|
160
162
|
Object.defineProperty(exports, "usePageVisibility", { enumerable: true, get: function () { return hooks_1.usePageVisibility; } });
|
|
163
|
+
Object.defineProperty(exports, "useResizeObserver", { enumerable: true, get: function () { return hooks_1.useResizeObserver; } });
|
|
161
164
|
const event_1 = require("./utils/event");
|
|
162
165
|
Object.defineProperty(exports, "getEventStatus", { enumerable: true, get: function () { return event_1.getEventStatus; } });
|
|
163
166
|
/**
|
package/lib/cjs/themes/theme.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
5
|
const utils_1 = require("@selfcommunity/utils");
|
|
6
6
|
const validate_color_1 = tslib_1.__importDefault(require("validate-color"));
|
|
7
7
|
const Preferences_1 = require("../constants/Preferences");
|
|
@@ -72,6 +72,6 @@ const getTheme = (options, preferences) => {
|
|
|
72
72
|
typography: Object.assign({}, (isValidPreference(preferences, Preferences_1.STYLE_FONT_FAMILY, utils_2.isString) && { fontFamily: preferences[Preferences_1.STYLE_FONT_FAMILY].value })),
|
|
73
73
|
}
|
|
74
74
|
: {};
|
|
75
|
-
return (0,
|
|
75
|
+
return (0, material_1.createTheme)((0, utils_1.mergeDeep)(Object.assign({ selfcommunity }, defaultOptions), options));
|
|
76
76
|
};
|
|
77
77
|
exports.default = getTheme;
|
package/lib/cjs/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, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = void 0;
|
|
3
|
+
exports.useResizeObserver = exports.usePageVisibility = exports.useNoInitialEffect = exports.useEffectOnce = exports.useIsomorphicLayoutEffect = exports.usePreviousValue = exports.useIsComponentMountedRef = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const useIsComponentMountedRef_1 = tslib_1.__importDefault(require("./useIsComponentMountedRef"));
|
|
6
6
|
exports.useIsComponentMountedRef = useIsComponentMountedRef_1.default;
|
|
@@ -14,3 +14,5 @@ const useNoInitialEffect_1 = tslib_1.__importDefault(require("./useNoInitialEffe
|
|
|
14
14
|
exports.useNoInitialEffect = useNoInitialEffect_1.default;
|
|
15
15
|
const usePageVisibility_1 = tslib_1.__importDefault(require("./usePageVisibility"));
|
|
16
16
|
exports.usePageVisibility = usePageVisibility_1.default;
|
|
17
|
+
const useResizeObserver_1 = tslib_1.__importDefault(require("./useResizeObserver"));
|
|
18
|
+
exports.useResizeObserver = useResizeObserver_1.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useResizeObserver(element: Element | null, options: ResizeObserverOptions | undefined, observerCallback: ResizeObserverCallback): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
function useResizeObserver(element, options, observerCallback) {
|
|
5
|
+
(0, react_1.useEffect)(() => {
|
|
6
|
+
if (!element || !('ResizeObserver' in window)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const observer = new ResizeObserver(observerCallback);
|
|
10
|
+
observer.observe(element, options);
|
|
11
|
+
return () => {
|
|
12
|
+
observer.disconnect();
|
|
13
|
+
};
|
|
14
|
+
}, [element, options, observerCallback]);
|
|
15
|
+
}
|
|
16
|
+
exports.default = useResizeObserver;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useState } from 'react';
|
|
3
|
-
import ThemeProvider from '@mui/material
|
|
3
|
+
import { ThemeProvider } from '@mui/material';
|
|
4
4
|
import getTheme from '../../../themes/theme';
|
|
5
5
|
import { useSCContext } from '../SCContextProvider';
|
|
6
6
|
import { useSCPreferences } from '../SCPreferencesProvider';
|
|
@@ -76,9 +76,12 @@ export declare const getPmSnippetsObjectCacheKey: () => string;
|
|
|
76
76
|
/** PRIVATE MESSAGE SNIPPET OBJECT **/
|
|
77
77
|
export declare const PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = "_pms_";
|
|
78
78
|
export declare const getPmSnippetObjectCacheKey: (id: any) => string;
|
|
79
|
-
/**
|
|
79
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
80
80
|
export declare const PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = "_ppo_";
|
|
81
81
|
export declare const getPaymentProductObjectCacheKey: (id: any) => string;
|
|
82
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
83
|
+
export declare const PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = "_pord_";
|
|
84
|
+
export declare const getPaymentOrderObjectCacheKey: (id: any) => string;
|
|
82
85
|
/** TOOLS */
|
|
83
86
|
export declare const CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = "_cListWidget_";
|
|
84
87
|
export declare const CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = "_cFolWidget_";
|
|
@@ -80,9 +80,12 @@ export const getPmSnippetsObjectCacheKey = () => `${PM_SNIPPETS_OBJECT_CACHE_PRE
|
|
|
80
80
|
/** PRIVATE MESSAGE SNIPPET OBJECT **/
|
|
81
81
|
export const PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY = '_pms_';
|
|
82
82
|
export const getPmSnippetObjectCacheKey = (id) => `${PM_SNIPPET_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
83
|
-
/**
|
|
83
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
84
84
|
export const PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY = '_ppo_';
|
|
85
85
|
export const getPaymentProductObjectCacheKey = (id) => `${PAYMENT_PRODUCT_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
86
|
+
/** PAYMENT PRODUCT OBJECT **/
|
|
87
|
+
export const PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY = '_pord_';
|
|
88
|
+
export const getPaymentOrderObjectCacheKey = (id) => `${PAYMENT_ORDER_OBJECT_CACHE_PREFIX_KEY}${id}`;
|
|
86
89
|
/** TOOLS */
|
|
87
90
|
export const CATEGORIES_LIST_TOOLS_STATE_CACHE_PREFIX_KEY = '_cListWidget_';
|
|
88
91
|
export const CATEGORIES_FOLLOWED_TOOLS_STATE_CACHE_PREFIX_KEY = '_cFolWidget_';
|
|
@@ -25,6 +25,7 @@ export declare const USER_PROFILE_CATEGORIES_ROUTE_NAME = "user_categories";
|
|
|
25
25
|
export declare const USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = "user_followed_posts";
|
|
26
26
|
export declare const USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = "user_followed_discussions";
|
|
27
27
|
export declare const USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME = "user_payments_history_orders";
|
|
28
|
+
export declare const USER_PAYMENTS_ORDER_PDF_ROUTE_NAME = "user_payments_order_pdf";
|
|
28
29
|
export declare const USER_PAYMENT_METHODS_ROUTE_NAME = "user_payment_methods";
|
|
29
30
|
export declare const LOYALTY_ROUTE_NAME = "loyalty";
|
|
30
31
|
export declare const INCUBATOR_ROUTE_NAME = "incubator";
|
|
@@ -25,6 +25,7 @@ export const USER_PROFILE_CATEGORIES_ROUTE_NAME = 'user_categories';
|
|
|
25
25
|
export const USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME = 'user_followed_posts';
|
|
26
26
|
export const USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME = 'user_followed_discussions';
|
|
27
27
|
export const USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME = 'user_payments_history_orders';
|
|
28
|
+
export const USER_PAYMENTS_ORDER_PDF_ROUTE_NAME = 'user_payments_order_pdf';
|
|
28
29
|
export const USER_PAYMENT_METHODS_ROUTE_NAME = 'user_payment_methods';
|
|
29
30
|
export const LOYALTY_ROUTE_NAME = 'loyalty';
|
|
30
31
|
export const INCUBATOR_ROUTE_NAME = 'incubator';
|
|
@@ -80,6 +81,7 @@ export const defaultRoutes = {
|
|
|
80
81
|
[USER_PROFILE_FOLLOWED_POSTS_ROUTE_NAME]: '/user/:id/posts/followed/',
|
|
81
82
|
[USER_PROFILE_FOLLOWED_DISCUSSIONS_ROUTE_NAME]: '/user/:id/discussions/followed/',
|
|
82
83
|
[USER_PAYMENTS_HISTORY_ORDERS_ROUTE_NAME]: '/user/:id/:username/history_orders/',
|
|
84
|
+
[USER_PAYMENTS_ORDER_PDF_ROUTE_NAME]: '/user/:id/:username/order/:pid/pdf/',
|
|
83
85
|
[USER_PAYMENT_METHODS_ROUTE_NAME]: '/user/:id/:username/payment_methods/',
|
|
84
86
|
[LOYALTY_ROUTE_NAME]: '/loyalty/',
|
|
85
87
|
[INCUBATOR_ROUTE_NAME]: '/incubator/:id/',
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SCPaymentOrder } from '@selfcommunity/types';
|
|
2
|
+
import { CacheStrategies } from '@selfcommunity/utils';
|
|
3
|
+
/**
|
|
4
|
+
:::info
|
|
5
|
+
This custom hook is used to fetch a payment order.
|
|
6
|
+
:::
|
|
7
|
+
* @param object
|
|
8
|
+
* @param object.id
|
|
9
|
+
* @param object.paymentOrder
|
|
10
|
+
* @param object.cacheStrategy
|
|
11
|
+
*/
|
|
12
|
+
export default function useSCFetchPaymentOrder({ id, paymentOrder, cacheStrategy, }: {
|
|
13
|
+
id?: number | string;
|
|
14
|
+
paymentOrder?: SCPaymentOrder;
|
|
15
|
+
cacheStrategy?: CacheStrategies;
|
|
16
|
+
}): {
|
|
17
|
+
scPaymentOrder: SCPaymentOrder;
|
|
18
|
+
setSCPaymentOrder: (c: SCPaymentOrder) => void;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Endpoints, http } from '@selfcommunity/api-services';
|
|
2
|
+
import { CacheStrategies, Logger, LRUCache } from '@selfcommunity/utils';
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect';
|
|
5
|
+
import { useSCUser } from '../components/provider/SCUserProvider';
|
|
6
|
+
import { getPaymentOrderObjectCacheKey } from '../constants/Cache';
|
|
7
|
+
import { SCOPE_SC_CORE } from '../constants/Errors';
|
|
8
|
+
/**
|
|
9
|
+
:::info
|
|
10
|
+
This custom hook is used to fetch a payment order.
|
|
11
|
+
:::
|
|
12
|
+
* @param object
|
|
13
|
+
* @param object.id
|
|
14
|
+
* @param object.paymentOrder
|
|
15
|
+
* @param object.cacheStrategy
|
|
16
|
+
*/
|
|
17
|
+
export default function useSCFetchPaymentOrder({ id = null, paymentOrder = null, cacheStrategy = CacheStrategies.NETWORK_ONLY, }) {
|
|
18
|
+
const __paymentOrderId = useMemo(() => (paymentOrder === null || paymentOrder === void 0 ? void 0 : paymentOrder.id) || id, [paymentOrder, id]);
|
|
19
|
+
// CONTEXT
|
|
20
|
+
const scUserContext = useSCUser();
|
|
21
|
+
const authUserId = useMemo(() => { var _a; return ((_a = scUserContext.user) === null || _a === void 0 ? void 0 : _a.id) || null; }, [scUserContext.user]);
|
|
22
|
+
// CACHE
|
|
23
|
+
const __paymentOrderCacheKey = useMemo(() => getPaymentOrderObjectCacheKey(__paymentOrderId), [__paymentOrderId]);
|
|
24
|
+
const [scPaymentOrder, setScPaymentOrder] = useState(cacheStrategy !== CacheStrategies.NETWORK_ONLY ? LRUCache.get(__paymentOrderCacheKey, paymentOrder) : null);
|
|
25
|
+
const [error, setError] = useState(null);
|
|
26
|
+
const setSCPaymentOrder = useCallback((c) => {
|
|
27
|
+
setScPaymentOrder(c);
|
|
28
|
+
LRUCache.set(__paymentOrderCacheKey, c);
|
|
29
|
+
}, [setScPaymentOrder, __paymentOrderCacheKey]);
|
|
30
|
+
/**
|
|
31
|
+
* Memoized fetch order
|
|
32
|
+
*/
|
|
33
|
+
const fetchPaymentOrder = useMemo(() => (id) => {
|
|
34
|
+
return http
|
|
35
|
+
.request({
|
|
36
|
+
url: Endpoints.GetPaymentOrder.url({ id }),
|
|
37
|
+
method: Endpoints.GetPaymentOrder.method,
|
|
38
|
+
})
|
|
39
|
+
.then((res) => {
|
|
40
|
+
if (res.status >= 300) {
|
|
41
|
+
return Promise.reject(res);
|
|
42
|
+
}
|
|
43
|
+
return Promise.resolve(res.data);
|
|
44
|
+
});
|
|
45
|
+
}, []);
|
|
46
|
+
/**
|
|
47
|
+
* If id attempt to get the course by id
|
|
48
|
+
*/
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (id !== null && id !== undefined && !paymentOrder) {
|
|
51
|
+
fetchPaymentOrder(id)
|
|
52
|
+
.then((e) => {
|
|
53
|
+
setSCPaymentOrder(e);
|
|
54
|
+
})
|
|
55
|
+
.catch((err) => {
|
|
56
|
+
LRUCache.delete(__paymentOrderCacheKey);
|
|
57
|
+
Logger.error(SCOPE_SC_CORE, err.message);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, [id, paymentOrder, authUserId]);
|
|
61
|
+
useDeepCompareEffectNoCheck(() => {
|
|
62
|
+
if (paymentOrder) {
|
|
63
|
+
setSCPaymentOrder(paymentOrder);
|
|
64
|
+
}
|
|
65
|
+
}, [paymentOrder, authUserId]);
|
|
66
|
+
return { scPaymentOrder, setSCPaymentOrder, error };
|
|
67
|
+
}
|